FFmpeg
Loading...
Searching...
No Matches
checkasm_config.h
Go to the documentation of this file.
1/*
2 * Copyright © 2025, Martin Storsjo
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef CHECKASM_CONFIG_H
28#define CHECKASM_CONFIG_H
29
31
32#ifdef CHECKASM_HAVE_GENERATED_H
33#include "checkasm_config_generated.h"
34#endif
35
36#ifndef __has_include
37 #define __has_include(x) 0
38#endif
39
40#ifndef ARCH_AARCH64
41 #define ARCH_AARCH64 CHECKASM_ARCH_AARCH64
42#endif
43
44#ifndef ARCH_ARM
45 #define ARCH_ARM CHECKASM_ARCH_ARM
46#endif
47
48#ifndef ARCH_LOONGARCH
49 #define ARCH_LOONGARCH CHECKASM_ARCH_LOONGARCH
50#endif
51
52#ifndef ARCH_LOONGARCH32
53 #define ARCH_LOONGARCH32 CHECKASM_ARCH_LOONGARCH32
54#endif
55
56#ifndef ARCH_LOONGARCH64
57 #define ARCH_LOONGARCH64 CHECKASM_ARCH_LOONGARCH64
58#endif
59
60#ifndef ARCH_PPC64LE
61 #define ARCH_PPC64LE CHECKASM_ARCH_PPC64LE
62#endif
63
64#ifndef ARCH_RISCV
65 #define ARCH_RISCV CHECKASM_ARCH_RISCV
66#endif
67
68#ifndef ARCH_RV32
69 #define ARCH_RV32 CHECKASM_ARCH_RV32
70#endif
71
72#ifndef ARCH_RV64
73 #define ARCH_RV64 CHECKASM_ARCH_RV64
74#endif
75
76#ifndef ARCH_X86
77 #define ARCH_X86 CHECKASM_ARCH_X86
78#endif
79
80#ifndef ARCH_X86_32
81 #define ARCH_X86_32 CHECKASM_ARCH_X86_32
82#endif
83
84#ifndef ARCH_X86_64
85 #define ARCH_X86_64 CHECKASM_ARCH_X86_64
86#endif
87
88#ifndef CHECKASM_VERSION
89 #define CHECKASM_VERSION "unknown"
90#endif
91
92#ifndef HAVE_ELF_AUX_INFO
93 #if defined(__FreeBSD__)
94 /* Also OpenBSD since 7.6 */
95 #define HAVE_ELF_AUX_INFO 1
96 #else
97 #define HAVE_ELF_AUX_INFO 0
98 #endif
99#endif
100
101#ifndef HAVE_GETAUXVAL
102 #if defined(__linux__)
103 /* Since glibc 2.16 (2012), since Android 18 (4.3) */
104 #define HAVE_GETAUXVAL 1
105 #else
106 #define HAVE_GETAUXVAL 0
107 #endif
108#endif
109
110#ifndef HAVE_LINUX_PERF
111 #if defined(__linux__) && __has_include(<linux/perf_event.h>)
112 #define HAVE_LINUX_PERF 1
113 #else
114 #define HAVE_LINUX_PERF 0
115 #endif
116#endif
117
118#ifndef HAVE_IOCTL
119 #if defined(__linux__) || defined(__APPLE__) || defined(__DragonFly__) \
120 || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
121 || defined(__unix__)
122 /* Or just !defined(_WIN32), plus defines for identifying RiscOS? */
123 #define HAVE_IOCTL 1
124 #else
125 #define HAVE_IOCTL 0
126 #endif
127#endif
128
129#ifndef HAVE_ISATTY
130 #if defined(__linux__) || defined(__APPLE__) || defined(__DragonFly__) \
131 || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
132 || defined(__unix__) || defined(__OS2__)
133 #define HAVE_ISATTY 1
134 #else
135 #define HAVE_ISATTY 0
136 #endif
137#endif
138
139#ifndef HAVE_SIGACTION
140 #if defined(__linux__) || defined(__APPLE__) || defined(__DragonFly__) \
141 || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
142 || defined(__unix__) || defined(__OS2__)
143 #define HAVE_SIGACTION 1
144 #else
145 #define HAVE_SIGACTION 0
146 #endif
147#endif
148
149#ifndef HAVE_SIGLONGJMP
150 #if defined(__linux__) || defined(__APPLE__) || defined(__DragonFly__) \
151 || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
152 || defined(__unix__) || defined(__OS2__)
153 #define HAVE_SIGLONGJMP 1
154 #else
155 #define HAVE_SIGLONGJMP 0
156 #endif
157#endif
158
159#ifndef HAVE_STDBIT_H
160 #if __has_include(<stdbit.h>)
161 #define HAVE_STDBIT_H 1
162 #else
163 #define HAVE_STDBIT_H 0
164 #endif
165#endif
166
167#ifndef HAVE_PTHREAD_NP_H
168 #if __has_include(<pthread_np.h>)
169 /* DragonFlyBSD, FreeBSD */
170 #define HAVE_PTHREAD_NP_H 1
171 #else
172 #define HAVE_PTHREAD_NP_H 0
173 #endif
174#endif
175
176#ifndef HAVE_PTHREAD_SETAFFINITY_NP
177 #if (defined(__linux__) && !defined(__ANDROID__)) || defined(__DragonFly__) \
178 || defined(__FreeBSD__)
179 #define HAVE_PTHREAD_SETAFFINITY_NP 1
180 #else
181 #define HAVE_PTHREAD_SETAFFINITY_NP 0
182 #endif
183#endif
184
185#ifndef HAVE_CLOCK_GETTIME
186 #if defined(__linux__) || defined(__APPLE__) || defined(__DragonFly__) \
187 || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
188 #define HAVE_CLOCK_GETTIME 1
189 #else
190 #define HAVE_CLOCK_GETTIME 0
191 #endif
192#endif
193
194#ifndef HAVE_PRCTL
195 #if defined(__linux__)
196 #define HAVE_PRCTL 1
197 #else
198 #define HAVE_PRCTL 0
199 #endif
200#endif
201
202#ifndef PREFIX
203 /* This one is different; this one is defined/undefined, not defined to
204 * 0/1. */
205 #if (defined(_WIN32) && ARCH_X86_32) || defined(__APPLE__) || defined(__OS2__)
206 #define PREFIX
207 #else
208 #undef PREFIX
209 #endif
210#endif
211
212#if ARCH_AARCH64
213 /* Just default to 0 unless the caller has detected support and set it
214 * in the generated header. */
215 #ifndef HAVE_AS_ARCHEXT_SVE_DIRECTIVE
216 #define HAVE_AS_ARCHEXT_SVE_DIRECTIVE 0
217 #endif
218 #ifndef HAVE_AS_ARCHEXT_SME_DIRECTIVE
219 #define HAVE_AS_ARCHEXT_SME_DIRECTIVE 0
220 #endif
221 #ifndef HAVE_SVE
222 #define HAVE_SVE 0
223 #endif
224 #ifndef HAVE_SME
225 #define HAVE_SME 0
226 #endif
227#endif
228
229#if ARCH_RISCV
230 #ifndef HAVE_ASM_HWPROBE_H
231 #if __has_include(<asm/hwprobe.h>)
232 #define HAVE_ASM_HWPROBE_H 1
233 #else
234 #define HAVE_ASM_HWPROBE_H 0
235 #endif
236 #endif
237
238 #ifndef HAVE_SYS_HWPROBE_H
239 #if __has_include(<sys/hwprobe.h>)
240 #define HAVE_SYS_HWPROBE_H 1
241 #else
242 #define HAVE_SYS_HWPROBE_H 0
243 #endif
244 #endif
245#endif
246
247/**
248 * Exports symbols for internal use inside the checkasm self-tests.
249 */
250#ifndef CHECKASM_SELF_API
251 #ifdef CHECKASM_BUILDING_TESTS
252 #define CHECKASM_SELF_API CHECKASM_API
253 #else
254 #define CHECKASM_SELF_API
255 #endif
256#endif
257
258#endif /* CHECKASM_CONFIG_H */