Commit | Line | Data |
---|---|---|
67bf9823 JA |
1 | #!/bin/sh |
2 | # | |
3 | # Fio configure script. Heavily influenced by the manual qemu configure | |
c922e0b0 | 4 | # script. Sad this is easier than autoconf and enemies. |
67bf9823 JA |
5 | # |
6 | ||
7 | # set temporary file name | |
8 | if test ! -z "$TMPDIR" ; then | |
9 | TMPDIR1="${TMPDIR}" | |
10 | elif test ! -z "$TEMPDIR" ; then | |
11 | TMPDIR1="${TEMPDIR}" | |
12 | else | |
13 | TMPDIR1="/tmp" | |
14 | fi | |
15 | ||
16 | TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c" | |
9ee669fa | 17 | TMPC2="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c" |
67bf9823 JA |
18 | TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o" |
19 | TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe" | |
20 | ||
21 | # NB: do not call "exit" in the trap handler; this is buggy with some shells; | |
22 | # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> | |
9ee669fa | 23 | trap "rm -f $TMPC $TMPC2 $TMPO $TMPE" EXIT INT QUIT TERM |
67bf9823 JA |
24 | |
25 | rm -rf config.log | |
26 | ||
27 | config_host_mak="config-host.mak" | |
4feafb1e JA |
28 | config_host_h="config-host.h" |
29 | ||
30 | rm -rf $config_host_mak | |
31 | rm -rf $config_host_h | |
67bf9823 | 32 | |
d7145a78 JA |
33 | fatal() { |
34 | echo $@ | |
35 | echo "Configure failed, check config.log and/or the above output" | |
36 | rm -rf $config_host_mak | |
37 | rm -rf $config_host_h | |
38 | exit 1 | |
39 | } | |
40 | ||
484b0b65 TK |
41 | # Print result for each configuration test |
42 | print_config() { | |
43 | printf "%-30s%s\n" "$1" "$2" | |
44 | } | |
45 | ||
44404c5a | 46 | # Default CFLAGS |
4c0b3d98 | 47 | CFLAGS="-D_GNU_SOURCE -include config-host.h $CFLAGS" |
af4862b3 | 48 | BUILD_CFLAGS="" |
67bf9823 JA |
49 | |
50 | # Print a helpful header at the top of config.log | |
51 | echo "# FIO configure log $(date)" >> config.log | |
52 | printf "# Configured with:" >> config.log | |
53 | printf " '%s'" "$0" "$@" >> config.log | |
54 | echo >> config.log | |
55 | echo "#" >> config.log | |
56 | ||
7560fe7c JA |
57 | # Print configure header at the top of $config_host_h |
58 | echo "/*" > $config_host_h | |
59 | echo " * Automatically generated by configure - do not modify" >> $config_host_h | |
60 | printf " * Configured with:" >> $config_host_h | |
61 | printf " * '%s'" "$0" "$@" >> $config_host_h | |
62 | echo "" >> $config_host_h | |
63 | echo " */" >> $config_host_h | |
64 | ||
67bf9823 JA |
65 | do_cc() { |
66 | # Run the compiler, capturing its output to the log. | |
67 | echo $cc "$@" >> config.log | |
68 | $cc "$@" >> config.log 2>&1 || return $? | |
69 | # Test passed. If this is an --enable-werror build, rerun | |
70 | # the test with -Werror and bail out if it fails. This | |
71 | # makes warning-generating-errors in configure test code | |
72 | # obvious to developers. | |
73 | if test "$werror" != "yes"; then | |
74 | return 0 | |
75 | fi | |
76 | # Don't bother rerunning the compile if we were already using -Werror | |
77 | case "$*" in | |
78 | *-Werror*) | |
79 | return 0 | |
80 | ;; | |
81 | esac | |
82 | echo $cc -Werror "$@" >> config.log | |
83 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
84 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
85 | echo "This is probably a bug in the configure script. The failing command" | |
86 | echo "will be at the bottom of config.log." | |
d7145a78 | 87 | fatal "You can run configure with --disable-werror to bypass this check." |
67bf9823 JA |
88 | } |
89 | ||
90 | compile_object() { | |
44f668d7 | 91 | do_cc $CFLAGS -Werror-implicit-function-declaration -c -o $TMPO $TMPC |
67bf9823 JA |
92 | } |
93 | ||
94 | compile_prog() { | |
95 | local_cflags="$1" | |
adaa46d8 | 96 | local_ldflags="$2 $LIBS" |
67bf9823 | 97 | echo "Compiling test case $3" >> config.log |
44f668d7 | 98 | do_cc $CFLAGS -Werror-implicit-function-declaration $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags |
67bf9823 JA |
99 | } |
100 | ||
101 | feature_not_found() { | |
102 | feature=$1 | |
c55d728b | 103 | packages=$2 |
67bf9823 JA |
104 | |
105 | echo "ERROR" | |
106 | echo "ERROR: User requested feature $feature" | |
c55d728b JA |
107 | if test ! -z "$packages" ; then |
108 | echo "ERROR: That feature needs $packages installed" | |
109 | fi | |
67bf9823 | 110 | echo "ERROR: configure was not able to find it" |
d7145a78 | 111 | fatal "ERROR" |
67bf9823 JA |
112 | } |
113 | ||
114 | has() { | |
115 | type "$1" >/dev/null 2>&1 | |
116 | } | |
117 | ||
118 | check_define() { | |
119 | cat > $TMPC <<EOF | |
120 | #if !defined($1) | |
121 | #error $1 not defined | |
122 | #endif | |
123 | int main(void) | |
124 | { | |
125 | return 0; | |
126 | } | |
127 | EOF | |
128 | compile_object | |
129 | } | |
130 | ||
4feafb1e JA |
131 | output_sym() { |
132 | echo "$1=y" >> $config_host_mak | |
133 | echo "#define $1" >> $config_host_h | |
134 | } | |
135 | ||
67bf9823 JA |
136 | targetos="" |
137 | cpu="" | |
138 | ||
91f94d5b | 139 | # default options |
47f44635 JA |
140 | show_help="no" |
141 | exit_val=0 | |
ebec2094 | 142 | gfio_check="no" |
1b10477b | 143 | libhdfs="no" |
43f3cec2 | 144 | pmemblk="no" |
cbb15e42 | 145 | devdax="no" |
ae0db592 | 146 | pmem="no" |
de26b824 | 147 | disable_lex="" |
3ee2a3c1 | 148 | disable_pmem="no" |
a817dc3b | 149 | disable_native="no" |
9f75af77 | 150 | march_set="no" |
247ef2aa | 151 | libiscsi="no" |
d643a1e2 | 152 | libnbd="no" |
e2defc22 | 153 | libaio_uring="no" |
5a8a6a03 | 154 | dynamic_engines="no" |
020d54bd | 155 | prefix=/usr/local |
91f94d5b | 156 | |
cb1125b0 JA |
157 | # parse options |
158 | for opt do | |
159 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
160 | case "$opt" in | |
020d54bd JA |
161 | --prefix=*) prefix="$optarg" |
162 | ;; | |
8b156d8e JA |
163 | --cpu=*) cpu="$optarg" |
164 | ;; | |
c8931876 JA |
165 | # esx is cross compiled and cannot be detect through simple uname calls |
166 | --esx) | |
167 | esx="yes" | |
168 | ;; | |
cb1125b0 JA |
169 | --cc=*) CC="$optarg" |
170 | ;; | |
208e4c8b JA |
171 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
172 | ;; | |
b7c12794 | 173 | --build-32bit-win) build_32bit_win="yes" |
7409711b | 174 | ;; |
a6ab5391 SW |
175 | --target-win-ver=*) target_win_ver="$optarg" |
176 | ;; | |
d2aeedb9 JA |
177 | --build-static) build_static="yes" |
178 | ;; | |
bad7e42c | 179 | --enable-gfio) gfio_check="yes" |
899fab33 | 180 | ;; |
44462517 CF |
181 | --disable-numa) disable_numa="yes" |
182 | ;; | |
f678f8d2 MF |
183 | --disable-rdma) disable_rdma="yes" |
184 | ;; | |
d5f9b0ea IF |
185 | --disable-rados) disable_rados="yes" |
186 | ;; | |
ce18290e TM |
187 | --disable-rbd) disable_rbd="yes" |
188 | ;; | |
c2f6a13d LMB |
189 | --disable-http) disable_http="yes" |
190 | ;; | |
ce18290e TM |
191 | --disable-gfapi) disable_gfapi="yes" |
192 | ;; | |
1b10477b MM |
193 | --enable-libhdfs) libhdfs="yes" |
194 | ;; | |
a655bbc4 JA |
195 | --disable-lex) disable_lex="yes" |
196 | ;; | |
de26b824 JA |
197 | --enable-lex) disable_lex="no" |
198 | ;; | |
61054f0d JA |
199 | --disable-shm) no_shm="yes" |
200 | ;; | |
201 | --disable-optimizations) disable_opt="yes" | |
ba40757e | 202 | ;; |
3ee2a3c1 DJ |
203 | --disable-pmem) disable_pmem="yes" |
204 | ;; | |
03553853 YR |
205 | --enable-cuda) enable_cuda="yes" |
206 | ;; | |
a817dc3b JA |
207 | --disable-native) disable_native="yes" |
208 | ;; | |
a40e7a59 GB |
209 | --with-ime=*) ime_path="$optarg" |
210 | ;; | |
247ef2aa KZ |
211 | --enable-libiscsi) libiscsi="yes" |
212 | ;; | |
d643a1e2 RJ |
213 | --enable-libnbd) libnbd="yes" |
214 | ;; | |
01fe773d JD |
215 | --disable-tcmalloc) disable_tcmalloc="yes" |
216 | ;; | |
e2defc22 JA |
217 | --enable-libaio-uring) libaio_uring="yes" |
218 | ;; | |
5a8a6a03 YK |
219 | --dynamic-libengines) dynamic_engines="yes" |
220 | ;; | |
827da4f5 | 221 | --help) |
47f44635 | 222 | show_help="yes" |
827da4f5 | 223 | ;; |
cb1125b0 JA |
224 | *) |
225 | echo "Bad option $opt" | |
47f44635 JA |
226 | show_help="yes" |
227 | exit_val=1 | |
cb1125b0 JA |
228 | esac |
229 | done | |
230 | ||
47f44635 | 231 | if test "$show_help" = "yes" ; then |
05cef7a0 TK |
232 | echo "--prefix= Use this directory as installation prefix" |
233 | echo "--cpu= Specify target CPU if auto-detect fails" | |
234 | echo "--cc= Specify compiler to use" | |
235 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" | |
236 | echo "--build-32bit-win Enable 32-bit build on Windows" | |
a6ab5391 | 237 | echo "--target-win-ver= Minimum version of Windows to target (XP or 7)" |
05cef7a0 TK |
238 | echo "--build-static Build a static fio" |
239 | echo "--esx Configure build options for esx" | |
240 | echo "--enable-gfio Enable building of gtk gfio" | |
241 | echo "--disable-numa Disable libnuma even if found" | |
03553853 | 242 | echo "--disable-rdma Disable RDMA support even if found" |
e75a6fac JH |
243 | echo "--disable-rados Disable Rados support even if found" |
244 | echo "--disable-rbd Disable Rados Block Device even if found" | |
245 | echo "--disable-http Disable HTTP support even if found" | |
05cef7a0 TK |
246 | echo "--disable-gfapi Disable gfapi" |
247 | echo "--enable-libhdfs Enable hdfs support" | |
248 | echo "--disable-lex Disable use of lex/yacc for math" | |
249 | echo "--disable-pmem Disable pmem based engines even if found" | |
250 | echo "--enable-lex Enable use of lex/yacc for math" | |
251 | echo "--disable-shm Disable SHM support" | |
61054f0d | 252 | echo "--disable-optimizations Don't enable compiler optimizations" |
03553853 | 253 | echo "--enable-cuda Enable GPUDirect RDMA support" |
a817dc3b | 254 | echo "--disable-native Don't build for native host" |
a40e7a59 | 255 | echo "--with-ime= Install path for DDN's Infinite Memory Engine" |
247ef2aa | 256 | echo "--enable-libiscsi Enable iscsi support" |
d643a1e2 | 257 | echo "--enable-libnbd Enable libnbd (NBD engine) support" |
01fe773d | 258 | echo "--disable-tcmalloc Disable tcmalloc support" |
e2defc22 | 259 | echo "--enable-libaio-uring Enable libaio emulated over io_uring" |
5a8a6a03 | 260 | echo "--dynamic-libengines Lib-based ioengines as dynamic libraries" |
b7a99316 | 261 | exit $exit_val |
47f44635 JA |
262 | fi |
263 | ||
47986339 | 264 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
b73af738 SW |
265 | # Preferred compiler (can be overriden later after we know the platform): |
266 | # ${CC} (if set) | |
267 | # ${cross_prefix}gcc (if cross-prefix specified) | |
268 | # gcc if available | |
269 | # clang if available | |
270 | if test -z "${CC}${cross_prefix}"; then | |
271 | if has gcc; then | |
272 | cc=gcc | |
273 | elif has clang; then | |
274 | cc=clang | |
275 | fi | |
276 | else | |
277 | cc="${CC-${cross_prefix}gcc}" | |
278 | fi | |
47986339 | 279 | |
6d0e9f83 AC |
280 | if check_define __ANDROID__ ; then |
281 | targetos="Android" | |
282 | elif check_define __linux__ ; then | |
67bf9823 | 283 | targetos="Linux" |
67bf9823 JA |
284 | elif check_define __OpenBSD__ ; then |
285 | targetos='OpenBSD' | |
89556808 BVA |
286 | elif check_define __NetBSD__ ; then |
287 | targetos='NetBSD' | |
67bf9823 JA |
288 | elif check_define __sun__ ; then |
289 | targetos='SunOS' | |
7cb024f8 | 290 | CFLAGS="$CFLAGS -D_REENTRANT" |
b24f59ab SH |
291 | elif check_define _WIN32 ; then |
292 | targetos='CYGWIN' | |
67bf9823 JA |
293 | else |
294 | targetos=`uname -s` | |
295 | fi | |
296 | ||
53cd4eee AC |
297 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
298 | printf "# Configured with:" >> $config_host_mak | |
299 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
300 | echo >> $config_host_mak | |
301 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak | |
302 | ||
61054f0d JA |
303 | if test "$no_shm" = "yes" ; then |
304 | output_sym "CONFIG_NO_SHM" | |
305 | fi | |
306 | ||
307 | if test "$disable_opt" = "yes" ; then | |
308 | output_sym "CONFIG_FIO_NO_OPT" | |
309 | fi | |
310 | ||
67bf9823 JA |
311 | # Some host OSes need non-standard checks for which CPU to use. |
312 | # Note that these checks are broken for cross-compilation: if you're | |
313 | # cross-compiling to one of these OSes then you'll need to specify | |
314 | # the correct CPU with the --cpu option. | |
315 | case $targetos in | |
26532556 | 316 | AIX|OpenBSD|NetBSD) |
de26b824 | 317 | # Unless explicitly enabled, turn off lex. |
baa78fdc | 318 | # OpenBSD will hit syntax error when enabled. |
de26b824 JA |
319 | if test -z "$disable_lex" ; then |
320 | disable_lex="yes" | |
daf705b5 JA |
321 | else |
322 | force_no_lex_o="yes" | |
de26b824 JA |
323 | fi |
324 | ;; | |
f22dd97a RC |
325 | FreeBSD) |
326 | CFLAGS="$CFLAGS -I/usr/local/include" | |
327 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
328 | ;; | |
67bf9823 JA |
329 | Darwin) |
330 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
331 | # we can run 64-bit userspace code. | |
332 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
333 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
334 | # detection code. | |
335 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
336 | cpu="x86_64" | |
337 | fi | |
ccf2d89d SW |
338 | # Error at compile time linking of weak/partial symbols if possible... |
339 | cat > $TMPC <<EOF | |
340 | int main(void) | |
341 | { | |
342 | return 0; | |
343 | } | |
344 | EOF | |
345 | if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then | |
346 | echo "Disabling weak symbols" | |
347 | LDFLAGS="$LDFLAGS -Wl,-no_weak_imports" | |
348 | fi | |
67bf9823 JA |
349 | ;; |
350 | SunOS) | |
351 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
352 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
353 | cpu="x86_64" | |
354 | fi | |
adaa46d8 | 355 | LIBS="-lnsl -lsocket" |
cfd94f79 JA |
356 | ;; |
357 | CYGWIN*) | |
ca205a75 TK |
358 | # We still force some options, so keep this message here. |
359 | echo "Forcing some known good options on Windows" | |
b73af738 | 360 | if test -z "${CC}${cross_prefix}"; then |
7409711b | 361 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
b73af738 | 362 | cc="i686-w64-mingw32-gcc" |
7409711b | 363 | else |
b73af738 | 364 | cc="x86_64-w64-mingw32-gcc" |
7409711b | 365 | fi |
4578d01f | 366 | fi |
a6ab5391 SW |
367 | |
368 | target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]') | |
369 | if test -z "$target_win_ver"; then | |
370 | # Default Windows API target | |
371 | target_win_ver="7" | |
372 | fi | |
373 | if test "$target_win_ver" = "XP"; then | |
374 | output_sym "CONFIG_WINDOWS_XP" | |
375 | elif test "$target_win_ver" = "7"; then | |
376 | output_sym "CONFIG_WINDOWS_7" | |
377 | CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601" | |
7409711b | 378 | else |
a6ab5391 | 379 | fatal "Unknown target Windows version" |
7409711b | 380 | fi |
a6ab5391 | 381 | |
ca205a75 TK |
382 | # We need this to be output_sym'd here because this is Windows specific. |
383 | # The regular configure path never sets this config. | |
4feafb1e | 384 | output_sym "CONFIG_WINDOWSAIO" |
ca205a75 TK |
385 | # We now take the regular configuration path without having exit 0 here. |
386 | # Flags below are still necessary mostly for MinGW. | |
12ed4fc8 | 387 | build_static="yes" |
ca205a75 TK |
388 | rusage_thread="yes" |
389 | fdatasync="yes" | |
390 | clock_gettime="yes" # clock_monotonic probe has dependency on this | |
391 | clock_monotonic="yes" | |
ca205a75 | 392 | sched_idle="yes" |
6d0e9f83 | 393 | ;; |
67bf9823 JA |
394 | esac |
395 | ||
b73af738 SW |
396 | # Now we know the target platform we can have another guess at the preferred |
397 | # compiler when it wasn't explictly set | |
398 | if test -z "${CC}${cross_prefix}"; then | |
399 | if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then | |
400 | if has clang; then | |
401 | cc=clang | |
402 | fi | |
403 | fi | |
404 | fi | |
405 | if test -z "$cc"; then | |
406 | echo "configure: failed to find compiler" | |
407 | exit 1 | |
408 | fi | |
409 | ||
67bf9823 JA |
410 | if test ! -z "$cpu" ; then |
411 | # command line argument | |
412 | : | |
413 | elif check_define __i386__ ; then | |
414 | cpu="i386" | |
415 | elif check_define __x86_64__ ; then | |
416 | cpu="x86_64" | |
417 | elif check_define __sparc__ ; then | |
418 | if check_define __arch64__ ; then | |
419 | cpu="sparc64" | |
420 | else | |
421 | cpu="sparc" | |
422 | fi | |
423 | elif check_define _ARCH_PPC ; then | |
424 | if check_define _ARCH_PPC64 ; then | |
425 | cpu="ppc64" | |
426 | else | |
427 | cpu="ppc" | |
428 | fi | |
429 | elif check_define __mips__ ; then | |
430 | cpu="mips" | |
431 | elif check_define __ia64__ ; then | |
432 | cpu="ia64" | |
433 | elif check_define __s390__ ; then | |
434 | if check_define __s390x__ ; then | |
435 | cpu="s390x" | |
436 | else | |
437 | cpu="s390" | |
438 | fi | |
439 | elif check_define __arm__ ; then | |
440 | cpu="arm" | |
214e2d56 | 441 | elif check_define __aarch64__ ; then |
442 | cpu="aarch64" | |
67bf9823 JA |
443 | elif check_define __hppa__ ; then |
444 | cpu="hppa" | |
445 | else | |
446 | cpu=`uname -m` | |
447 | fi | |
448 | ||
449 | # Normalise host CPU name and set ARCH. | |
450 | case "$cpu" in | |
451 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
452 | cpu="$cpu" | |
453 | ;; | |
454 | i386|i486|i586|i686|i86pc|BePC) | |
95ef38ab | 455 | cpu="x86" |
67bf9823 JA |
456 | ;; |
457 | x86_64|amd64) | |
458 | cpu="x86_64" | |
459 | ;; | |
460 | armv*b|armv*l|arm) | |
461 | cpu="arm" | |
462 | ;; | |
214e2d56 | 463 | aarch64) |
464 | cpu="arm64" | |
465 | ;; | |
67bf9823 JA |
466 | hppa|parisc|parisc64) |
467 | cpu="hppa" | |
468 | ;; | |
469 | mips*) | |
470 | cpu="mips" | |
471 | ;; | |
472 | sparc|sun4[cdmuv]) | |
473 | cpu="sparc" | |
474 | ;; | |
475 | *) | |
8b156d8e | 476 | echo "Unknown CPU" |
67bf9823 JA |
477 | ;; |
478 | esac | |
479 | ||
1a17cfdb AC |
480 | ########################################## |
481 | # check cross compile | |
482 | ||
ca205a75 TK |
483 | if test "$cross_compile" != "yes" ; then |
484 | cross_compile="no" | |
485 | fi | |
1a17cfdb AC |
486 | cat > $TMPC <<EOF |
487 | int main(void) | |
488 | { | |
489 | return 0; | |
490 | } | |
491 | EOF | |
492 | if compile_prog "" "" "cross"; then | |
493 | $TMPE 2>/dev/null || cross_compile="yes" | |
494 | else | |
495 | fatal "compile test failed" | |
496 | fi | |
497 | ||
0dcebdf4 JA |
498 | ########################################## |
499 | # check endianness | |
ca205a75 TK |
500 | if test "$bigendian" != "yes" ; then |
501 | bigendian="no" | |
502 | fi | |
1a17cfdb AC |
503 | if test "$cross_compile" = "no" ; then |
504 | cat > $TMPC <<EOF | |
0dcebdf4 JA |
505 | #include <inttypes.h> |
506 | int main(void) | |
507 | { | |
508 | volatile uint32_t i=0x01234567; | |
509 | return (*((uint8_t*)(&i))) == 0x67; | |
510 | } | |
511 | EOF | |
1a17cfdb AC |
512 | if compile_prog "" "" "endian"; then |
513 | $TMPE && bigendian="yes" | |
514 | fi | |
515 | else | |
516 | # If we're cross compiling, try our best to work it out and rely on the | |
517 | # run-time check to fail if we get it wrong. | |
518 | cat > $TMPC <<EOF | |
519 | #include <endian.h> | |
520 | int main(void) | |
521 | { | |
522 | #if __BYTE_ORDER != __BIG_ENDIAN | |
523 | # error "Unknown endianness" | |
524 | #endif | |
525 | } | |
526 | EOF | |
527 | compile_prog "" "" "endian" && bigendian="yes" | |
528 | check_define "__ARMEB__" && bigendian="yes" | |
529 | check_define "__MIPSEB__" && bigendian="yes" | |
0dcebdf4 JA |
530 | fi |
531 | ||
532 | ||
484b0b65 TK |
533 | print_config "Operating system" "$targetos" |
534 | print_config "CPU" "$cpu" | |
535 | print_config "Big endian" "$bigendian" | |
a6ab5391 SW |
536 | if test ! -z "$target_win_ver"; then |
537 | print_config "Target Windows version" "$target_win_ver" | |
538 | fi | |
484b0b65 TK |
539 | print_config "Compiler" "$cc" |
540 | print_config "Cross compile" "$cross_compile" | |
67bf9823 JA |
541 | echo |
542 | ||
d2aeedb9 JA |
543 | ########################################## |
544 | # See if we need to build a static build | |
545 | if test "$build_static" = "yes" ; then | |
546 | CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" | |
547 | LDFLAGS="$LDFLAGS -static -Wl,--gc-sections" | |
548 | else | |
549 | build_static="no" | |
550 | fi | |
484b0b65 | 551 | print_config "Static build" "$build_static" |
d2aeedb9 | 552 | |
67bf9823 JA |
553 | ########################################## |
554 | # check for wordsize | |
555 | wordsize="0" | |
556 | cat > $TMPC <<EOF | |
142429e5 AC |
557 | #include <limits.h> |
558 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
67bf9823 JA |
559 | int main(void) |
560 | { | |
142429e5 | 561 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
67bf9823 JA |
562 | return 0; |
563 | } | |
564 | EOF | |
142429e5 AC |
565 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
566 | wordsize="32" | |
567 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then | |
568 | wordsize="64" | |
569 | else | |
570 | fatal "Unknown wordsize" | |
67bf9823 | 571 | fi |
484b0b65 | 572 | print_config "Wordsize" "$wordsize" |
67bf9823 | 573 | |
a9bca4aa JA |
574 | ########################################## |
575 | # zlib probe | |
ca205a75 TK |
576 | if test "$zlib" != "yes" ; then |
577 | zlib="no" | |
578 | fi | |
a9bca4aa | 579 | cat > $TMPC <<EOF |
804a1e05 | 580 | #include <zlib.h> |
a9bca4aa JA |
581 | int main(void) |
582 | { | |
583 | z_stream stream; | |
584 | if (inflateInit(&stream) != Z_OK) | |
585 | return 1; | |
586 | return 0; | |
587 | } | |
588 | EOF | |
589 | if compile_prog "" "-lz" "zlib" ; then | |
590 | zlib=yes | |
591 | LIBS="-lz $LIBS" | |
a9bca4aa | 592 | fi |
484b0b65 | 593 | print_config "zlib" "$zlib" |
a9bca4aa | 594 | |
67bf9823 JA |
595 | ########################################## |
596 | # linux-aio probe | |
ca205a75 TK |
597 | if test "$libaio" != "yes" ; then |
598 | libaio="no" | |
599 | fi | |
7c77ebef | 600 | if test "$esx" != "yes" ; then |
601 | cat > $TMPC <<EOF | |
67bf9823 JA |
602 | #include <libaio.h> |
603 | #include <stddef.h> | |
604 | int main(void) | |
605 | { | |
606 | io_setup(0, NULL); | |
607 | return 0; | |
608 | } | |
609 | EOF | |
e2defc22 JA |
610 | if test "$libaio_uring" = "yes" && compile_prog "" "-luring" "libaio io_uring" ; then |
611 | libaio=yes | |
e2defc22 | 612 | elif compile_prog "" "-laio" "libaio" ; then |
7c77ebef | 613 | libaio=yes |
e2defc22 | 614 | libaio_uring=no |
7c77ebef | 615 | else |
616 | if test "$libaio" = "yes" ; then | |
617 | feature_not_found "linux AIO" "libaio-dev or libaio-devel" | |
618 | fi | |
619 | libaio=no | |
e2defc22 | 620 | libaio_uring=no |
67bf9823 | 621 | fi |
7d42e66e KK |
622 | |
623 | cat > $TMPC <<EOF | |
624 | #include <libaio.h> | |
625 | #include <stddef.h> | |
626 | int main(void) | |
627 | { | |
628 | io_prep_preadv2(NULL, 0, NULL, 0, 0, 0); | |
629 | io_prep_pwritev2(NULL, 0, NULL, 0, 0, 0); | |
630 | return 0; | |
631 | } | |
632 | EOF | |
633 | if compile_prog "" "" "libaio rw flags" ; then | |
634 | libaio_rw_flags=yes | |
635 | else | |
636 | libaio_rw_flags=no | |
637 | fi | |
67bf9823 | 638 | fi |
484b0b65 | 639 | print_config "Linux AIO support" "$libaio" |
7d42e66e | 640 | print_config "Linux AIO support rw flags" "$libaio_rw_flags" |
e2defc22 | 641 | print_config "Linux AIO over io_uring" "$libaio_uring" |
67bf9823 JA |
642 | |
643 | ########################################## | |
644 | # posix aio probe | |
ca205a75 TK |
645 | if test "$posix_aio" != "yes" ; then |
646 | posix_aio="no" | |
647 | fi | |
648 | if test "$posix_aio_lrt" != "yes" ; then | |
649 | posix_aio_lrt="no" | |
650 | fi | |
67bf9823 JA |
651 | cat > $TMPC <<EOF |
652 | #include <aio.h> | |
653 | int main(void) | |
654 | { | |
655 | struct aiocb cb; | |
656 | aio_read(&cb); | |
657 | return 0; | |
658 | } | |
659 | EOF | |
660 | if compile_prog "" "" "posixaio" ; then | |
661 | posix_aio="yes" | |
09c81e13 | 662 | elif compile_prog "" "-lrt" "posixaio -lrt"; then |
67bf9823 JA |
663 | posix_aio="yes" |
664 | posix_aio_lrt="yes" | |
665 | LIBS="-lrt $LIBS" | |
666 | fi | |
484b0b65 TK |
667 | print_config "POSIX AIO support" "$posix_aio" |
668 | print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt" | |
67bf9823 JA |
669 | |
670 | ########################################## | |
671 | # posix aio fsync probe | |
ca205a75 TK |
672 | if test "$posix_aio_fsync" != "yes" ; then |
673 | posix_aio_fsync="no" | |
674 | fi | |
67bf9823 JA |
675 | if test "$posix_aio" = "yes" ; then |
676 | cat > $TMPC <<EOF | |
677 | #include <fcntl.h> | |
678 | #include <aio.h> | |
679 | int main(void) | |
680 | { | |
681 | struct aiocb cb; | |
682 | return aio_fsync(O_SYNC, &cb); | |
683 | return 0; | |
684 | } | |
685 | EOF | |
686 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
687 | posix_aio_fsync=yes | |
688 | fi | |
689 | fi | |
484b0b65 | 690 | print_config "POSIX AIO fsync" "$posix_aio_fsync" |
67bf9823 | 691 | |
06eac6b2 SW |
692 | ########################################## |
693 | # POSIX pshared attribute probe | |
d418fa90 TK |
694 | if test "$posix_pshared" != "yes" ; then |
695 | posix_pshared="no" | |
696 | fi | |
06eac6b2 SW |
697 | cat > $TMPC <<EOF |
698 | #include <unistd.h> | |
699 | int main(void) | |
700 | { | |
701 | #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0) | |
702 | # if defined(__CYGWIN__) | |
703 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin" | |
704 | # elif defined(__APPLE__) | |
705 | # include <AvailabilityMacros.h> | |
706 | # include <TargetConditionals.h> | |
707 | # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | |
708 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7" | |
709 | # endif | |
710 | # endif | |
711 | #else | |
712 | # error "_POSIX_THREAD_PROCESS_SHARED is unsupported" | |
713 | #endif | |
714 | return 0; | |
715 | } | |
716 | EOF | |
717 | if compile_prog "" "$LIBS" "posix_pshared" ; then | |
718 | posix_pshared=yes | |
719 | fi | |
484b0b65 | 720 | print_config "POSIX pshared support" "$posix_pshared" |
06eac6b2 | 721 | |
78b66d32 BVA |
722 | ########################################## |
723 | # POSIX pthread_condattr_setclock() probe | |
724 | if test "$pthread_condattr_setclock" != "yes" ; then | |
725 | pthread_condattr_setclock="no" | |
726 | fi | |
727 | cat > $TMPC <<EOF | |
728 | #include <pthread.h> | |
729 | int main(void) | |
730 | { | |
731 | pthread_condattr_t condattr; | |
732 | pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC); | |
733 | return 0; | |
734 | } | |
735 | EOF | |
736 | if compile_prog "" "$LIBS" "pthread_condattr_setclock" ; then | |
737 | pthread_condattr_setclock=yes | |
a9bf436e BVA |
738 | elif compile_prog "" "$LIBS -lpthread" "pthread_condattr_setclock" ; then |
739 | pthread_condattr_setclock=yes | |
740 | LIBS="$LIBS -lpthread" | |
78b66d32 | 741 | fi |
a9bf436e | 742 | print_config "pthread_condattr_setclock()" "$pthread_condattr_setclock" |
78b66d32 | 743 | |
c31092b8 BVA |
744 | ########################################## |
745 | # pthread_sigmask() probe | |
746 | if test "$pthread_sigmask" != "yes" ; then | |
747 | pthread_sigmask="no" | |
748 | fi | |
749 | cat > $TMPC <<EOF | |
750 | #include <stddef.h> /* NULL */ | |
751 | #include <signal.h> /* pthread_sigmask() */ | |
752 | int main(void) | |
753 | { | |
754 | return pthread_sigmask(0, NULL, NULL); | |
755 | } | |
756 | EOF | |
757 | if compile_prog "" "$LIBS" "pthread_sigmask" ; then | |
758 | pthread_sigmask=yes | |
759 | elif compile_prog "" "$LIBS -lpthread" "pthread_sigmask" ; then | |
760 | pthread_sigmask=yes | |
761 | LIBS="$LIBS -lpthread" | |
762 | fi | |
763 | print_config "pthread_sigmask()" "$pthread_sigmask" | |
764 | ||
67bf9823 JA |
765 | ########################################## |
766 | # solaris aio probe | |
ca205a75 TK |
767 | if test "$solaris_aio" != "yes" ; then |
768 | solaris_aio="no" | |
769 | fi | |
67bf9823 JA |
770 | cat > $TMPC <<EOF |
771 | #include <sys/types.h> | |
772 | #include <sys/asynch.h> | |
773 | #include <unistd.h> | |
774 | int main(void) | |
775 | { | |
776 | aio_result_t res; | |
777 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
778 | return 0; | |
779 | } | |
780 | EOF | |
781 | if compile_prog "" "-laio" "solarisaio" ; then | |
782 | solaris_aio=yes | |
783 | LIBS="-laio $LIBS" | |
784 | fi | |
484b0b65 | 785 | print_config "Solaris AIO support" "$solaris_aio" |
67bf9823 JA |
786 | |
787 | ########################################## | |
f5cd2907 | 788 | # __sync_fetch_and_add test |
ca205a75 TK |
789 | if test "$sfaa" != "yes" ; then |
790 | sfaa="no" | |
791 | fi | |
67bf9823 | 792 | cat > $TMPC << EOF |
958886d8 JA |
793 | #include <inttypes.h> |
794 | static int sfaa(uint64_t *ptr) | |
67bf9823 | 795 | { |
9c639a76 | 796 | return __sync_fetch_and_add(ptr, 0); |
67bf9823 JA |
797 | } |
798 | ||
799 | int main(int argc, char **argv) | |
800 | { | |
958886d8 | 801 | uint64_t val = 42; |
67bf9823 JA |
802 | sfaa(&val); |
803 | return val; | |
804 | } | |
805 | EOF | |
806 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
807 | sfaa="yes" | |
808 | fi | |
484b0b65 | 809 | print_config "__sync_fetch_and_add" "$sfaa" |
67bf9823 | 810 | |
a250edd0 JA |
811 | ########################################## |
812 | # __sync_synchronize() test | |
813 | if test "$sync_sync" != "yes" ; then | |
814 | sync_sync="no" | |
815 | fi | |
816 | cat > $TMPC << EOF | |
817 | #include <inttypes.h> | |
818 | ||
819 | int main(int argc, char **argv) | |
820 | { | |
821 | __sync_synchronize(); | |
822 | return 0; | |
823 | } | |
824 | EOF | |
825 | if compile_prog "" "" "__sync_synchronize()" ; then | |
826 | sync_sync="yes" | |
827 | fi | |
828 | print_config "__sync_synchronize" "$sync_sync" | |
829 | ||
830 | ########################################## | |
831 | # __sync_val_compare_and_swap() test | |
832 | if test "$cmp_swap" != "yes" ; then | |
833 | cmp_swap="no" | |
834 | fi | |
835 | cat > $TMPC << EOF | |
836 | #include <inttypes.h> | |
837 | ||
838 | int main(int argc, char **argv) | |
839 | { | |
840 | int x = 0; | |
841 | return __sync_val_compare_and_swap(&x, 1, 2); | |
842 | } | |
843 | EOF | |
844 | if compile_prog "" "" "__sync_val_compare_and_swap()" ; then | |
845 | cmp_swap="yes" | |
846 | fi | |
847 | print_config "__sync_val_compare_and_swap" "$cmp_swap" | |
848 | ||
67bf9823 JA |
849 | ########################################## |
850 | # libverbs probe | |
ca205a75 TK |
851 | if test "$libverbs" != "yes" ; then |
852 | libverbs="no" | |
853 | fi | |
67bf9823 | 854 | cat > $TMPC << EOF |
eb3bfdd8 | 855 | #include <infiniband/verbs.h> |
67bf9823 JA |
856 | int main(int argc, char **argv) |
857 | { | |
858 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
40dae137 | 859 | return pd != NULL; |
67bf9823 JA |
860 | } |
861 | EOF | |
f678f8d2 | 862 | if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then |
67bf9823 | 863 | libverbs="yes" |
67bf9823 | 864 | fi |
484b0b65 | 865 | print_config "libverbs" "$libverbs" |
67bf9823 JA |
866 | |
867 | ########################################## | |
868 | # rdmacm probe | |
ca205a75 TK |
869 | if test "$rdmacm" != "yes" ; then |
870 | rdmacm="no" | |
871 | fi | |
67bf9823 JA |
872 | cat > $TMPC << EOF |
873 | #include <stdio.h> | |
874 | #include <rdma/rdma_cma.h> | |
875 | int main(int argc, char **argv) | |
876 | { | |
877 | rdma_destroy_qp(NULL); | |
878 | return 0; | |
879 | } | |
880 | EOF | |
f678f8d2 | 881 | if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then |
67bf9823 | 882 | rdmacm="yes" |
67bf9823 | 883 | fi |
484b0b65 | 884 | print_config "rdmacm" "$rdmacm" |
67bf9823 | 885 | |
44e8e956 BVA |
886 | ########################################## |
887 | # asprintf() and vasprintf() probes | |
888 | if test "$have_asprintf" != "yes" ; then | |
889 | have_asprintf="no" | |
890 | fi | |
891 | cat > $TMPC << EOF | |
892 | #include <stdio.h> | |
893 | ||
894 | int main(int argc, char **argv) | |
895 | { | |
896 | return asprintf(NULL, "%s", "str") == 0; | |
897 | } | |
898 | EOF | |
899 | if compile_prog "" "" "have_asprintf"; then | |
900 | have_asprintf="yes" | |
901 | fi | |
902 | print_config "asprintf()" "$have_asprintf" | |
903 | ||
904 | if test "$have_vasprintf" != "yes" ; then | |
905 | have_vasprintf="no" | |
906 | fi | |
907 | cat > $TMPC << EOF | |
908 | #include <stdio.h> | |
909 | ||
910 | int main(int argc, char **argv) | |
911 | { | |
849ac4b2 RP |
912 | va_list ap; |
913 | return vasprintf(NULL, "%s", ap) == 0; | |
44e8e956 BVA |
914 | } |
915 | EOF | |
916 | if compile_prog "" "" "have_vasprintf"; then | |
917 | have_vasprintf="yes" | |
918 | fi | |
919 | print_config "vasprintf()" "$have_vasprintf" | |
920 | ||
67bf9823 JA |
921 | ########################################## |
922 | # Linux fallocate probe | |
ca205a75 TK |
923 | if test "$linux_fallocate" != "yes" ; then |
924 | linux_fallocate="no" | |
925 | fi | |
67bf9823 JA |
926 | cat > $TMPC << EOF |
927 | #include <stdio.h> | |
aa6738a5 | 928 | #include <fcntl.h> |
67bf9823 JA |
929 | #include <linux/falloc.h> |
930 | int main(int argc, char **argv) | |
931 | { | |
932 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
933 | return r; | |
934 | } | |
935 | EOF | |
936 | if compile_prog "" "" "linux_fallocate"; then | |
937 | linux_fallocate="yes" | |
938 | fi | |
484b0b65 | 939 | print_config "Linux fallocate" "$linux_fallocate" |
67bf9823 JA |
940 | |
941 | ########################################## | |
942 | # POSIX fadvise probe | |
ca205a75 TK |
943 | if test "$posix_fadvise" != "yes" ; then |
944 | posix_fadvise="no" | |
945 | fi | |
67bf9823 JA |
946 | cat > $TMPC << EOF |
947 | #include <stdio.h> | |
948 | #include <fcntl.h> | |
949 | int main(int argc, char **argv) | |
950 | { | |
951 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
952 | return r; | |
953 | } | |
954 | EOF | |
955 | if compile_prog "" "" "posix_fadvise"; then | |
956 | posix_fadvise="yes" | |
957 | fi | |
484b0b65 | 958 | print_config "POSIX fadvise" "$posix_fadvise" |
67bf9823 JA |
959 | |
960 | ########################################## | |
961 | # POSIX fallocate probe | |
ca205a75 TK |
962 | if test "$posix_fallocate" != "yes" ; then |
963 | posix_fallocate="no" | |
964 | fi | |
67bf9823 JA |
965 | cat > $TMPC << EOF |
966 | #include <stdio.h> | |
967 | #include <fcntl.h> | |
968 | int main(int argc, char **argv) | |
969 | { | |
970 | int r = posix_fallocate(0, 0, 1024); | |
971 | return r; | |
972 | } | |
973 | EOF | |
974 | if compile_prog "" "" "posix_fallocate"; then | |
975 | posix_fallocate="yes" | |
976 | fi | |
484b0b65 | 977 | print_config "POSIX fallocate" "$posix_fallocate" |
67bf9823 JA |
978 | |
979 | ########################################## | |
980 | # sched_set/getaffinity 2 or 3 argument test | |
ca205a75 TK |
981 | if test "$linux_2arg_affinity" != "yes" ; then |
982 | linux_2arg_affinity="no" | |
983 | fi | |
984 | if test "$linux_3arg_affinity" != "yes" ; then | |
985 | linux_3arg_affinity="no" | |
986 | fi | |
67bf9823 | 987 | cat > $TMPC << EOF |
67bf9823 JA |
988 | #include <sched.h> |
989 | int main(int argc, char **argv) | |
990 | { | |
991 | cpu_set_t mask; | |
992 | return sched_setaffinity(0, sizeof(mask), &mask); | |
993 | } | |
994 | EOF | |
995 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
996 | linux_3arg_affinity="yes" | |
997 | else | |
998 | cat > $TMPC << EOF | |
67bf9823 JA |
999 | #include <sched.h> |
1000 | int main(int argc, char **argv) | |
1001 | { | |
1002 | cpu_set_t mask; | |
1003 | return sched_setaffinity(0, &mask); | |
1004 | } | |
1005 | EOF | |
1006 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
1007 | linux_2arg_affinity="yes" | |
1008 | fi | |
1009 | fi | |
484b0b65 TK |
1010 | print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity" |
1011 | print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity" | |
67bf9823 JA |
1012 | |
1013 | ########################################## | |
1014 | # clock_gettime probe | |
ca205a75 TK |
1015 | if test "$clock_gettime" != "yes" ; then |
1016 | clock_gettime="no" | |
1017 | fi | |
67bf9823 JA |
1018 | cat > $TMPC << EOF |
1019 | #include <stdio.h> | |
1020 | #include <time.h> | |
1021 | int main(int argc, char **argv) | |
1022 | { | |
1023 | return clock_gettime(0, NULL); | |
1024 | } | |
1025 | EOF | |
1026 | if compile_prog "" "" "clock_gettime"; then | |
1027 | clock_gettime="yes" | |
1028 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
1029 | clock_gettime="yes" | |
1030 | LIBS="-lrt $LIBS" | |
1031 | fi | |
484b0b65 | 1032 | print_config "clock_gettime" "$clock_gettime" |
67bf9823 JA |
1033 | |
1034 | ########################################## | |
1035 | # CLOCK_MONOTONIC probe | |
ca205a75 TK |
1036 | if test "$clock_monotonic" != "yes" ; then |
1037 | clock_monotonic="no" | |
1038 | fi | |
67bf9823 JA |
1039 | if test "$clock_gettime" = "yes" ; then |
1040 | cat > $TMPC << EOF | |
1041 | #include <stdio.h> | |
1042 | #include <time.h> | |
1043 | int main(int argc, char **argv) | |
1044 | { | |
1045 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
1046 | } | |
1047 | EOF | |
1048 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
1049 | clock_monotonic="yes" | |
1050 | fi | |
1051 | fi | |
484b0b65 | 1052 | print_config "CLOCK_MONOTONIC" "$clock_monotonic" |
67bf9823 | 1053 | |
c544f604 SN |
1054 | ########################################## |
1055 | # CLOCK_MONOTONIC_RAW probe | |
ca205a75 TK |
1056 | if test "$clock_monotonic_raw" != "yes" ; then |
1057 | clock_monotonic_raw="no" | |
1058 | fi | |
c544f604 SN |
1059 | if test "$clock_gettime" = "yes" ; then |
1060 | cat > $TMPC << EOF | |
1061 | #include <stdio.h> | |
1062 | #include <time.h> | |
1063 | int main(int argc, char **argv) | |
1064 | { | |
1065 | return clock_gettime(CLOCK_MONOTONIC_RAW, NULL); | |
1066 | } | |
1067 | EOF | |
1068 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
1069 | clock_monotonic_raw="yes" | |
1070 | fi | |
1071 | fi | |
484b0b65 | 1072 | print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw" |
c544f604 | 1073 | |
67bf9823 JA |
1074 | ########################################## |
1075 | # CLOCK_MONOTONIC_PRECISE probe | |
ca205a75 TK |
1076 | if test "$clock_monotonic_precise" != "yes" ; then |
1077 | clock_monotonic_precise="no" | |
1078 | fi | |
67bf9823 JA |
1079 | if test "$clock_gettime" = "yes" ; then |
1080 | cat > $TMPC << EOF | |
1081 | #include <stdio.h> | |
1082 | #include <time.h> | |
1083 | int main(int argc, char **argv) | |
1084 | { | |
1085 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
1086 | } | |
1087 | EOF | |
1088 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
1089 | clock_monotonic_precise="yes" | |
1090 | fi | |
1091 | fi | |
484b0b65 | 1092 | print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise" |
67bf9823 | 1093 | |
25f8227d JA |
1094 | ########################################## |
1095 | # clockid_t probe | |
ca205a75 TK |
1096 | if test "$clockid_t" != "yes" ; then |
1097 | clockid_t="no" | |
1098 | fi | |
25f8227d | 1099 | cat > $TMPC << EOF |
25f8227d | 1100 | #include <time.h> |
209c37b4 | 1101 | #include <string.h> |
25f8227d JA |
1102 | int main(int argc, char **argv) |
1103 | { | |
ccf2d89d | 1104 | volatile clockid_t cid; |
7fcad9e1 | 1105 | memset((void*)&cid, 0, sizeof(cid)); |
ccf2d89d | 1106 | return 0; |
25f8227d JA |
1107 | } |
1108 | EOF | |
1109 | if compile_prog "" "$LIBS" "clockid_t"; then | |
1110 | clockid_t="yes" | |
1111 | fi | |
484b0b65 | 1112 | print_config "clockid_t" "$clockid_t" |
25f8227d | 1113 | |
67bf9823 JA |
1114 | ########################################## |
1115 | # gettimeofday() probe | |
ca205a75 TK |
1116 | if test "$gettimeofday" != "yes" ; then |
1117 | gettimeofday="no" | |
1118 | fi | |
67bf9823 JA |
1119 | cat > $TMPC << EOF |
1120 | #include <sys/time.h> | |
1121 | #include <stdio.h> | |
1122 | int main(int argc, char **argv) | |
1123 | { | |
1124 | struct timeval tv; | |
1125 | return gettimeofday(&tv, NULL); | |
1126 | } | |
1127 | EOF | |
1128 | if compile_prog "" "" "gettimeofday"; then | |
1129 | gettimeofday="yes" | |
1130 | fi | |
484b0b65 | 1131 | print_config "gettimeofday" "$gettimeofday" |
67bf9823 JA |
1132 | |
1133 | ########################################## | |
1134 | # fdatasync() probe | |
ca205a75 TK |
1135 | if test "$fdatasync" != "yes" ; then |
1136 | fdatasync="no" | |
1137 | fi | |
67bf9823 JA |
1138 | cat > $TMPC << EOF |
1139 | #include <stdio.h> | |
1140 | #include <unistd.h> | |
1141 | int main(int argc, char **argv) | |
1142 | { | |
1143 | return fdatasync(0); | |
1144 | } | |
1145 | EOF | |
1146 | if compile_prog "" "" "fdatasync"; then | |
1147 | fdatasync="yes" | |
1148 | fi | |
484b0b65 | 1149 | print_config "fdatasync" "$fdatasync" |
67bf9823 | 1150 | |
52a552e2 BVA |
1151 | ########################################## |
1152 | # pipe() probe | |
1153 | if test "$pipe" != "yes" ; then | |
1154 | pipe="no" | |
1155 | fi | |
1156 | cat > $TMPC << EOF | |
1157 | #include <unistd.h> | |
1158 | int main(int argc, char **argv) | |
1159 | { | |
1160 | int fd[2]; | |
1161 | return pipe(fd); | |
1162 | } | |
1163 | EOF | |
1164 | if compile_prog "" "" "pipe"; then | |
1165 | pipe="yes" | |
1166 | fi | |
1167 | print_config "pipe()" "$pipe" | |
1168 | ||
1169 | ########################################## | |
1170 | # pipe2() probe | |
1171 | if test "$pipe2" != "yes" ; then | |
1172 | pipe2="no" | |
1173 | fi | |
1174 | cat > $TMPC << EOF | |
1175 | #include <unistd.h> | |
1176 | int main(int argc, char **argv) | |
1177 | { | |
1178 | int fd[2]; | |
1179 | return pipe2(fd, 0); | |
1180 | } | |
1181 | EOF | |
1182 | if compile_prog "" "" "pipe2"; then | |
1183 | pipe2="yes" | |
1184 | fi | |
1185 | print_config "pipe2()" "$pipe2" | |
1186 | ||
15eca9aa BVA |
1187 | ########################################## |
1188 | # pread() probe | |
1189 | if test "$pread" != "yes" ; then | |
1190 | pread="no" | |
1191 | fi | |
1192 | cat > $TMPC << EOF | |
1193 | #include <unistd.h> | |
1194 | int main(int argc, char **argv) | |
1195 | { | |
1196 | return pread(0, NULL, 0, 0); | |
1197 | } | |
1198 | EOF | |
1199 | if compile_prog "" "" "pread"; then | |
1200 | pread="yes" | |
1201 | fi | |
1202 | print_config "pread()" "$pread" | |
1203 | ||
67bf9823 JA |
1204 | ########################################## |
1205 | # sync_file_range() probe | |
ca205a75 TK |
1206 | if test "$sync_file_range" != "yes" ; then |
1207 | sync_file_range="no" | |
1208 | fi | |
67bf9823 JA |
1209 | cat > $TMPC << EOF |
1210 | #include <stdio.h> | |
1211 | #include <unistd.h> | |
67bf9823 JA |
1212 | #include <fcntl.h> |
1213 | #include <linux/fs.h> | |
1214 | int main(int argc, char **argv) | |
1215 | { | |
1216 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
1217 | SYNC_FILE_RANGE_WAIT_AFTER; | |
1218 | return sync_file_range(0, 0, 0, flags); | |
1219 | } | |
1220 | EOF | |
1221 | if compile_prog "" "" "sync_file_range"; then | |
1222 | sync_file_range="yes" | |
1223 | fi | |
484b0b65 | 1224 | print_config "sync_file_range" "$sync_file_range" |
67bf9823 JA |
1225 | |
1226 | ########################################## | |
1227 | # ext4 move extent probe | |
ca205a75 TK |
1228 | if test "$ext4_me" != "yes" ; then |
1229 | ext4_me="no" | |
1230 | fi | |
67bf9823 JA |
1231 | cat > $TMPC << EOF |
1232 | #include <fcntl.h> | |
1233 | #include <sys/ioctl.h> | |
1234 | int main(int argc, char **argv) | |
1235 | { | |
1236 | struct move_extent me; | |
1237 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
1238 | } | |
1239 | EOF | |
c7165b8d JA |
1240 | if compile_prog "" "" "ext4 move extent" ; then |
1241 | ext4_me="yes" | |
1242 | elif test $targetos = "Linux" ; then | |
1243 | # On Linux, just default to it on and let it error at runtime if we really | |
1244 | # don't have it. None of my updated systems have it defined, but it does | |
1245 | # work. Takes a while to bubble back. | |
67bf9823 JA |
1246 | ext4_me="yes" |
1247 | fi | |
484b0b65 | 1248 | print_config "EXT4 move extent" "$ext4_me" |
67bf9823 JA |
1249 | |
1250 | ########################################## | |
1251 | # splice probe | |
ca205a75 TK |
1252 | if test "$linux_splice" != "yes" ; then |
1253 | linux_splice="no" | |
1254 | fi | |
67bf9823 | 1255 | cat > $TMPC << EOF |
67bf9823 JA |
1256 | #include <stdio.h> |
1257 | #include <fcntl.h> | |
1258 | int main(int argc, char **argv) | |
1259 | { | |
1260 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
1261 | } | |
1262 | EOF | |
1263 | if compile_prog "" "" "linux splice"; then | |
1264 | linux_splice="yes" | |
1265 | fi | |
484b0b65 | 1266 | print_config "Linux splice(2)" "$linux_splice" |
67bf9823 JA |
1267 | |
1268 | ########################################## | |
1269 | # GUASI probe | |
ca205a75 TK |
1270 | if test "$guasi" != "yes" ; then |
1271 | guasi="no" | |
1272 | fi | |
67bf9823 JA |
1273 | cat > $TMPC << EOF |
1274 | #include <guasi.h> | |
1275 | #include <guasi_syscalls.h> | |
1276 | int main(int argc, char **argv) | |
1277 | { | |
1278 | guasi_t ctx = guasi_create(0, 0, 0); | |
1279 | return 0; | |
1280 | } | |
1281 | EOF | |
1282 | if compile_prog "" "" "guasi"; then | |
1283 | guasi="yes" | |
1284 | fi | |
484b0b65 | 1285 | print_config "GUASI" "$guasi" |
67bf9823 | 1286 | |
67bf9823 JA |
1287 | ########################################## |
1288 | # libnuma probe | |
ca205a75 TK |
1289 | if test "$libnuma" != "yes" ; then |
1290 | libnuma="no" | |
1291 | fi | |
67bf9823 JA |
1292 | cat > $TMPC << EOF |
1293 | #include <numa.h> | |
1294 | int main(int argc, char **argv) | |
1295 | { | |
1296 | return numa_available(); | |
1297 | } | |
1298 | EOF | |
44462517 | 1299 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
1300 | libnuma="yes" |
1301 | LIBS="-lnuma $LIBS" | |
1302 | fi | |
484b0b65 | 1303 | print_config "libnuma" "$libnuma" |
67bf9823 | 1304 | |
50206d9b | 1305 | ########################################## |
ca205a75 | 1306 | # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes" |
50206d9b JA |
1307 | if test "$libnuma" = "yes" ; then |
1308 | libnuma_v2="no" | |
1309 | cat > $TMPC << EOF | |
1310 | #include <numa.h> | |
1311 | int main(int argc, char **argv) | |
1312 | { | |
1313 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
61bde962 | 1314 | return mask->size == 0; |
50206d9b JA |
1315 | } |
1316 | EOF | |
1317 | if compile_prog "" "" "libnuma api"; then | |
1318 | libnuma_v2="yes" | |
1319 | fi | |
484b0b65 | 1320 | print_config "libnuma v2" "$libnuma_v2" |
50206d9b JA |
1321 | fi |
1322 | ||
67bf9823 JA |
1323 | ########################################## |
1324 | # strsep() probe | |
ca205a75 TK |
1325 | if test "$strsep" != "yes" ; then |
1326 | strsep="no" | |
1327 | fi | |
67bf9823 JA |
1328 | cat > $TMPC << EOF |
1329 | #include <string.h> | |
1330 | int main(int argc, char **argv) | |
1331 | { | |
ae156be6 JA |
1332 | static char *string = "This is a string"; |
1333 | strsep(&string, "needle"); | |
67bf9823 JA |
1334 | return 0; |
1335 | } | |
1336 | EOF | |
1337 | if compile_prog "" "" "strsep"; then | |
1338 | strsep="yes" | |
1339 | fi | |
484b0b65 | 1340 | print_config "strsep" "$strsep" |
67bf9823 | 1341 | |
9ad8da82 JA |
1342 | ########################################## |
1343 | # strcasestr() probe | |
ca205a75 TK |
1344 | if test "$strcasestr" != "yes" ; then |
1345 | strcasestr="no" | |
1346 | fi | |
9ad8da82 JA |
1347 | cat > $TMPC << EOF |
1348 | #include <string.h> | |
1349 | int main(int argc, char **argv) | |
1350 | { | |
aa6738a5 | 1351 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
1352 | } |
1353 | EOF | |
1354 | if compile_prog "" "" "strcasestr"; then | |
1355 | strcasestr="yes" | |
1356 | fi | |
484b0b65 | 1357 | print_config "strcasestr" "$strcasestr" |
9ad8da82 | 1358 | |
5ad7be56 KD |
1359 | ########################################## |
1360 | # strlcat() probe | |
ca205a75 TK |
1361 | if test "$strlcat" != "yes" ; then |
1362 | strlcat="no" | |
1363 | fi | |
5ad7be56 KD |
1364 | cat > $TMPC << EOF |
1365 | #include <string.h> | |
1366 | int main(int argc, char **argv) | |
1367 | { | |
1368 | static char dst[64]; | |
1369 | static char *string = "This is a string"; | |
1370 | memset(dst, 0, sizeof(dst)); | |
1371 | strlcat(dst, string, sizeof(dst)); | |
1372 | return 0; | |
1373 | } | |
1374 | EOF | |
1375 | if compile_prog "" "" "strlcat"; then | |
1376 | strlcat="yes" | |
1377 | fi | |
484b0b65 | 1378 | print_config "strlcat" "$strlcat" |
5ad7be56 | 1379 | |
67bf9823 JA |
1380 | ########################################## |
1381 | # getopt_long_only() probe | |
ca205a75 TK |
1382 | if test "$getopt_long_only" != "yes" ; then |
1383 | getopt_long_only="no" | |
1384 | fi | |
67bf9823 JA |
1385 | cat > $TMPC << EOF |
1386 | #include <unistd.h> | |
1387 | #include <stdio.h> | |
aa6738a5 | 1388 | #include <getopt.h> |
67bf9823 JA |
1389 | int main(int argc, char **argv) |
1390 | { | |
d24ff97d | 1391 | int c = getopt_long_only(argc, argv, "", NULL, NULL); |
67bf9823 JA |
1392 | return c; |
1393 | } | |
1394 | EOF | |
1395 | if compile_prog "" "" "getopt_long_only"; then | |
1396 | getopt_long_only="yes" | |
1397 | fi | |
484b0b65 | 1398 | print_config "getopt_long_only()" "$getopt_long_only" |
67bf9823 JA |
1399 | |
1400 | ########################################## | |
1401 | # inet_aton() probe | |
ca205a75 TK |
1402 | if test "$inet_aton" != "yes" ; then |
1403 | inet_aton="no" | |
1404 | fi | |
67bf9823 | 1405 | cat > $TMPC << EOF |
a932a2cf BVA |
1406 | #ifdef _WIN32 |
1407 | #include <winsock2.h> | |
1408 | #else | |
67bf9823 JA |
1409 | #include <sys/socket.h> |
1410 | #include <arpa/inet.h> | |
a932a2cf | 1411 | #endif |
67bf9823 JA |
1412 | #include <stdio.h> |
1413 | int main(int argc, char **argv) | |
1414 | { | |
1415 | struct in_addr in; | |
1416 | return inet_aton(NULL, &in); | |
1417 | } | |
1418 | EOF | |
1419 | if compile_prog "" "" "inet_aton"; then | |
1420 | inet_aton="yes" | |
1421 | fi | |
484b0b65 | 1422 | print_config "inet_aton" "$inet_aton" |
67bf9823 JA |
1423 | |
1424 | ########################################## | |
1425 | # socklen_t probe | |
ca205a75 TK |
1426 | if test "$socklen_t" != "yes" ; then |
1427 | socklen_t="no" | |
1428 | fi | |
67bf9823 | 1429 | cat > $TMPC << EOF |
a932a2cf BVA |
1430 | #ifdef _WIN32 |
1431 | #include <winsock2.h> | |
1432 | #include <ws2tcpip.h> | |
1433 | #else | |
f6482613 | 1434 | #include <sys/socket.h> |
a932a2cf | 1435 | #endif |
67bf9823 JA |
1436 | int main(int argc, char **argv) |
1437 | { | |
1438 | socklen_t len = 0; | |
1439 | return len; | |
1440 | } | |
1441 | EOF | |
1442 | if compile_prog "" "" "socklen_t"; then | |
1443 | socklen_t="yes" | |
1444 | fi | |
484b0b65 | 1445 | print_config "socklen_t" "$socklen_t" |
67bf9823 JA |
1446 | |
1447 | ########################################## | |
1448 | # Whether or not __thread is supported for TLS | |
ca205a75 TK |
1449 | if test "$tls_thread" != "yes" ; then |
1450 | tls_thread="no" | |
1451 | fi | |
67bf9823 JA |
1452 | cat > $TMPC << EOF |
1453 | #include <stdio.h> | |
aa6738a5 | 1454 | static __thread int ret; |
67bf9823 JA |
1455 | int main(int argc, char **argv) |
1456 | { | |
1457 | return ret; | |
1458 | } | |
1459 | EOF | |
1460 | if compile_prog "" "" "__thread"; then | |
1461 | tls_thread="yes" | |
1462 | fi | |
484b0b65 | 1463 | print_config "__thread" "$tls_thread" |
67bf9823 | 1464 | |
91f94d5b | 1465 | ########################################## |
2639f056 | 1466 | # Check if we have required gtk/glib support for gfio |
ca205a75 TK |
1467 | if test "$gfio" != "yes" ; then |
1468 | gfio="no" | |
1469 | fi | |
ebec2094 | 1470 | if test "$gfio_check" = "yes" ; then |
91f94d5b JA |
1471 | cat > $TMPC << EOF |
1472 | #include <glib.h> | |
1473 | #include <cairo.h> | |
1474 | #include <gtk/gtk.h> | |
1475 | int main(void) | |
1476 | { | |
1477 | gdk_threads_enter(); | |
91f94d5b | 1478 | gdk_threads_leave(); |
b7a99316 | 1479 | |
ef2b61aa | 1480 | return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */ |
91f94d5b JA |
1481 | } |
1482 | EOF | |
4d1bc43e | 1483 | GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0) |
86719845 JA |
1484 | ORG_LDFLAGS=$LDFLAGS |
1485 | LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g) | |
91f94d5b JA |
1486 | if test "$?" != "0" ; then |
1487 | echo "configure: gtk and gthread not found" | |
1488 | exit 1 | |
1489 | fi | |
4d1bc43e | 1490 | GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0) |
91f94d5b JA |
1491 | if test "$?" != "0" ; then |
1492 | echo "configure: gtk and gthread not found" | |
1493 | exit 1 | |
1494 | fi | |
31ce8438 HG |
1495 | if ! ${cross_prefix}pkg-config --atleast-version 2.18.0 gtk+-2.0; then |
1496 | echo "GTK found, but need version 2.18 or higher" | |
1497 | gfio="no" | |
1498 | else | |
1499 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then | |
b7a99316 | 1500 | gfio="yes" |
86719845 | 1501 | GFIO_LIBS="$LIBS $GTK_LIBS" |
b7a99316 JA |
1502 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1503 | else | |
31ce8438 | 1504 | echo "Please install gtk and gdk libraries" |
b7a99316 JA |
1505 | gfio="no" |
1506 | fi | |
91f94d5b | 1507 | fi |
86719845 | 1508 | LDFLAGS=$ORG_LDFLAGS |
91f94d5b JA |
1509 | fi |
1510 | ||
ebec2094 | 1511 | if test "$gfio_check" = "yes" ; then |
484b0b65 | 1512 | print_config "gtk 2.18 or higher" "$gfio" |
ebec2094 | 1513 | fi |
91f94d5b | 1514 | |
bda92394 | 1515 | ########################################## |
44404c5a | 1516 | # Check whether we have getrusage(RUSAGE_THREAD) |
ca205a75 TK |
1517 | if test "$rusage_thread" != "yes" ; then |
1518 | rusage_thread="no" | |
1519 | fi | |
44404c5a JA |
1520 | cat > $TMPC << EOF |
1521 | #include <sys/time.h> | |
1522 | #include <sys/resource.h> | |
1523 | int main(int argc, char **argv) | |
1524 | { | |
1525 | struct rusage ru; | |
1526 | getrusage(RUSAGE_THREAD, &ru); | |
1527 | return 0; | |
1528 | } | |
1529 | EOF | |
1530 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1531 | rusage_thread="yes" | |
1532 | fi | |
484b0b65 | 1533 | print_config "RUSAGE_THREAD" "$rusage_thread" |
44404c5a | 1534 | |
7e09a9f1 JA |
1535 | ########################################## |
1536 | # Check whether we have SCHED_IDLE | |
ca205a75 TK |
1537 | if test "$sched_idle" != "yes" ; then |
1538 | sched_idle="no" | |
1539 | fi | |
7e09a9f1 JA |
1540 | cat > $TMPC << EOF |
1541 | #include <sched.h> | |
1542 | int main(int argc, char **argv) | |
1543 | { | |
1544 | struct sched_param p; | |
1545 | return sched_setscheduler(0, SCHED_IDLE, &p); | |
1546 | } | |
1547 | EOF | |
1548 | if compile_prog "" "" "SCHED_IDLE"; then | |
1549 | sched_idle="yes" | |
1550 | fi | |
484b0b65 | 1551 | print_config "SCHED_IDLE" "$sched_idle" |
7e09a9f1 | 1552 | |
1eafa37a JA |
1553 | ########################################## |
1554 | # Check whether we have TCP_NODELAY | |
ca205a75 TK |
1555 | if test "$tcp_nodelay" != "yes" ; then |
1556 | tcp_nodelay="no" | |
1557 | fi | |
1eafa37a | 1558 | cat > $TMPC << EOF |
a932a2cf BVA |
1559 | #ifdef _WIN32 |
1560 | #include <winsock2.h> | |
1561 | #else | |
1eafa37a JA |
1562 | #include <stdio.h> |
1563 | #include <sys/types.h> | |
1564 | #include <sys/socket.h> | |
1565 | #include <netinet/tcp.h> | |
a932a2cf | 1566 | #endif |
1eafa37a JA |
1567 | int main(int argc, char **argv) |
1568 | { | |
1569 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1570 | } | |
1571 | EOF | |
1572 | if compile_prog "" "" "TCP_NODELAY"; then | |
1573 | tcp_nodelay="yes" | |
a932a2cf BVA |
1574 | elif compile_prog "" "-lws2_32" "TCP_NODELAY"; then |
1575 | tcp_nodelay="yes" | |
1576 | LIBS="$LIBS -lws2_32" | |
1eafa37a | 1577 | fi |
484b0b65 | 1578 | print_config "TCP_NODELAY" "$tcp_nodelay" |
1eafa37a | 1579 | |
1008602c JA |
1580 | ########################################## |
1581 | # Check whether we have SO_SNDBUF | |
ca205a75 TK |
1582 | if test "$window_size" != "yes" ; then |
1583 | window_size="no" | |
1584 | fi | |
1008602c | 1585 | cat > $TMPC << EOF |
a932a2cf BVA |
1586 | #ifdef _WIN32 |
1587 | #include <winsock2.h> | |
1588 | #else | |
1008602c JA |
1589 | #include <stdio.h> |
1590 | #include <sys/types.h> | |
1591 | #include <sys/socket.h> | |
1592 | #include <netinet/tcp.h> | |
a932a2cf | 1593 | #endif |
1008602c JA |
1594 | int main(int argc, char **argv) |
1595 | { | |
1596 | setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0); | |
1597 | setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0); | |
1598 | } | |
1599 | EOF | |
1600 | if compile_prog "" "" "SO_SNDBUF"; then | |
1601 | window_size="yes" | |
a932a2cf BVA |
1602 | elif compile_prog "" "-lws2_32" "SO_SNDBUF"; then |
1603 | window_size="yes" | |
1604 | LIBS="$LIBS -lws2_32" | |
1008602c | 1605 | fi |
484b0b65 | 1606 | print_config "Net engine window_size" "$window_size" |
1008602c | 1607 | |
e5f34d95 JA |
1608 | ########################################## |
1609 | # Check whether we have TCP_MAXSEG | |
ca205a75 TK |
1610 | if test "$mss" != "yes" ; then |
1611 | mss="no" | |
1612 | fi | |
e5f34d95 | 1613 | cat > $TMPC << EOF |
a932a2cf BVA |
1614 | #ifdef _WIN32 |
1615 | #include <winsock2.h> | |
1616 | #else | |
e5f34d95 JA |
1617 | #include <stdio.h> |
1618 | #include <sys/types.h> | |
1619 | #include <sys/socket.h> | |
1620 | #include <netinet/tcp.h> | |
1621 | #include <arpa/inet.h> | |
1622 | #include <netinet/in.h> | |
a932a2cf | 1623 | #endif |
e5f34d95 JA |
1624 | int main(int argc, char **argv) |
1625 | { | |
1626 | return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0); | |
1627 | } | |
1628 | EOF | |
1629 | if compile_prog "" "" "TCP_MAXSEG"; then | |
1630 | mss="yes" | |
a932a2cf BVA |
1631 | elif compile_prog "" "-lws2_32" "TCP_MAXSEG"; then |
1632 | mss="yes" | |
1633 | LIBS="$LIBS -lws2_32" | |
e5f34d95 | 1634 | fi |
484b0b65 | 1635 | print_config "TCP_MAXSEG" "$mss" |
e5f34d95 | 1636 | |
38b9354a JA |
1637 | ########################################## |
1638 | # Check whether we have RLIMIT_MEMLOCK | |
ca205a75 TK |
1639 | if test "$rlimit_memlock" != "yes" ; then |
1640 | rlimit_memlock="no" | |
1641 | fi | |
38b9354a JA |
1642 | cat > $TMPC << EOF |
1643 | #include <sys/time.h> | |
1644 | #include <sys/resource.h> | |
1645 | int main(int argc, char **argv) | |
1646 | { | |
1647 | struct rlimit rl; | |
1648 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1649 | } | |
1650 | EOF | |
1651 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1652 | rlimit_memlock="yes" | |
1653 | fi | |
484b0b65 | 1654 | print_config "RLIMIT_MEMLOCK" "$rlimit_memlock" |
38b9354a | 1655 | |
07fc0acd JA |
1656 | ########################################## |
1657 | # Check whether we have pwritev/preadv | |
ca205a75 TK |
1658 | if test "$pwritev" != "yes" ; then |
1659 | pwritev="no" | |
1660 | fi | |
07fc0acd JA |
1661 | cat > $TMPC << EOF |
1662 | #include <stdio.h> | |
1663 | #include <sys/uio.h> | |
1664 | int main(int argc, char **argv) | |
1665 | { | |
1666 | return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0); | |
1667 | } | |
1668 | EOF | |
1669 | if compile_prog "" "" "pwritev"; then | |
1670 | pwritev="yes" | |
1671 | fi | |
484b0b65 | 1672 | print_config "pwritev/preadv" "$pwritev" |
07fc0acd | 1673 | |
2cafffbe JA |
1674 | ########################################## |
1675 | # Check whether we have pwritev2/preadv2 | |
ca205a75 TK |
1676 | if test "$pwritev2" != "yes" ; then |
1677 | pwritev2="no" | |
1678 | fi | |
2cafffbe JA |
1679 | cat > $TMPC << EOF |
1680 | #include <stdio.h> | |
1681 | #include <sys/uio.h> | |
1682 | int main(int argc, char **argv) | |
1683 | { | |
1684 | return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0); | |
1685 | } | |
1686 | EOF | |
1687 | if compile_prog "" "" "pwritev2"; then | |
1688 | pwritev2="yes" | |
1689 | fi | |
484b0b65 | 1690 | print_config "pwritev2/preadv2" "$pwritev2" |
2cafffbe | 1691 | |
ecad55e9 JA |
1692 | ########################################## |
1693 | # Check whether we have the required functions for ipv6 | |
ca205a75 TK |
1694 | if test "$ipv6" != "yes" ; then |
1695 | ipv6="no" | |
1696 | fi | |
ecad55e9 | 1697 | cat > $TMPC << EOF |
a932a2cf BVA |
1698 | #ifdef _WIN32 |
1699 | #include <winsock2.h> | |
1700 | #include <ws2tcpip.h> | |
1701 | #else | |
ecad55e9 JA |
1702 | #include <sys/types.h> |
1703 | #include <sys/socket.h> | |
d219028d | 1704 | #include <netinet/in.h> |
ecad55e9 | 1705 | #include <netdb.h> |
a932a2cf | 1706 | #endif |
ecad55e9 JA |
1707 | #include <stdio.h> |
1708 | int main(int argc, char **argv) | |
1709 | { | |
1710 | struct addrinfo hints; | |
1711 | struct in6_addr addr; | |
1712 | int ret; | |
1713 | ||
1714 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1715 | freeaddrinfo(NULL); | |
1716 | printf("%s\n", gai_strerror(ret)); | |
1717 | addr = in6addr_any; | |
1718 | return 0; | |
1719 | } | |
1720 | EOF | |
1721 | if compile_prog "" "" "ipv6"; then | |
1722 | ipv6="yes" | |
1723 | fi | |
484b0b65 | 1724 | print_config "IPv6 helpers" "$ipv6" |
07fc0acd | 1725 | |
c2f6a13d LMB |
1726 | ########################################## |
1727 | # check for http | |
1728 | if test "$http" != "yes" ; then | |
1729 | http="no" | |
1730 | fi | |
9ee669fa DD |
1731 | # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer |
1732 | cat > $TMPC << EOF | |
1733 | #include <curl/curl.h> | |
1734 | #include <openssl/hmac.h> | |
1735 | ||
1736 | int main(int argc, char **argv) | |
1737 | { | |
1738 | CURL *curl; | |
1739 | HMAC_CTX *ctx; | |
1740 | ||
1741 | curl = curl_easy_init(); | |
1742 | curl_easy_cleanup(curl); | |
1743 | ||
1744 | ctx = HMAC_CTX_new(); | |
1745 | HMAC_CTX_reset(ctx); | |
1746 | HMAC_CTX_free(ctx); | |
1747 | return 0; | |
1748 | } | |
1749 | EOF | |
1750 | # openssl < 1.1.0 uses the HMAC_CTX type directly | |
1751 | cat > $TMPC2 << EOF | |
1752 | #include <curl/curl.h> | |
1753 | #include <openssl/hmac.h> | |
1754 | ||
1755 | int main(int argc, char **argv) | |
1756 | { | |
1757 | CURL *curl; | |
1758 | HMAC_CTX ctx; | |
1759 | ||
1760 | curl = curl_easy_init(); | |
1761 | curl_easy_cleanup(curl); | |
1762 | ||
1763 | HMAC_CTX_init(&ctx); | |
1764 | HMAC_CTX_cleanup(&ctx); | |
1765 | return 0; | |
1766 | } | |
1767 | EOF | |
1768 | if test "$disable_http" != "yes"; then | |
1769 | HTTP_LIBS="-lcurl -lssl -lcrypto" | |
1770 | if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then | |
b61a5f46 | 1771 | output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX" |
9ee669fa | 1772 | http="yes" |
9ee669fa DD |
1773 | elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then |
1774 | http="yes" | |
0290c589 | 1775 | fi |
c2f6a13d LMB |
1776 | fi |
1777 | print_config "http engine" "$http" | |
1778 | ||
d5f9b0ea IF |
1779 | ########################################## |
1780 | # check for rados | |
1781 | if test "$rados" != "yes" ; then | |
1782 | rados="no" | |
1783 | fi | |
1784 | cat > $TMPC << EOF | |
1785 | #include <rados/librados.h> | |
1786 | ||
1787 | int main(int argc, char **argv) | |
1788 | { | |
1789 | rados_t cluster; | |
1790 | rados_ioctx_t io_ctx; | |
1791 | const char cluster_name[] = "ceph"; | |
1792 | const char user_name[] = "client.admin"; | |
1793 | const char pool[] = "rados"; | |
1794 | ||
1795 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1796 | rados_create2(&cluster, cluster_name, user_name, 0); | |
1797 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1798 | ||
1799 | return 0; | |
1800 | } | |
1801 | EOF | |
1802 | if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then | |
d5f9b0ea IF |
1803 | rados="yes" |
1804 | fi | |
1805 | print_config "Rados engine" "$rados" | |
1806 | ||
fc5c0345 DG |
1807 | ########################################## |
1808 | # check for rbd | |
ca205a75 TK |
1809 | if test "$rbd" != "yes" ; then |
1810 | rbd="no" | |
1811 | fi | |
fc5c0345 DG |
1812 | cat > $TMPC << EOF |
1813 | #include <rbd/librbd.h> | |
1814 | ||
1815 | int main(int argc, char **argv) | |
1816 | { | |
fc5c0345 DG |
1817 | rados_t cluster; |
1818 | rados_ioctx_t io_ctx; | |
fb9bc6e3 SW |
1819 | const char cluster_name[] = "ceph"; |
1820 | const char user_name[] = "client.admin"; | |
fc5c0345 | 1821 | const char pool[] = "rbd"; |
fc5c0345 | 1822 | int major, minor, extra; |
fc5c0345 | 1823 | |
fb9bc6e3 SW |
1824 | rbd_version(&major, &minor, &extra); |
1825 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1826 | rados_create2(&cluster, cluster_name, user_name, 0); | |
fc5c0345 | 1827 | rados_ioctx_create(cluster, pool, &io_ctx); |
fb9bc6e3 | 1828 | |
fc5c0345 DG |
1829 | return 0; |
1830 | } | |
1831 | EOF | |
ce18290e | 1832 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1833 | rbd="yes" |
1834 | fi | |
484b0b65 | 1835 | print_config "Rados Block Device engine" "$rbd" |
fc5c0345 | 1836 | |
53b6c979 PL |
1837 | ########################################## |
1838 | # check for rbd_poll | |
ca205a75 TK |
1839 | if test "$rbd_poll" != "yes" ; then |
1840 | rbd_poll="no" | |
1841 | fi | |
53b6c979 PL |
1842 | if test "$rbd" = "yes"; then |
1843 | cat > $TMPC << EOF | |
1844 | #include <rbd/librbd.h> | |
1845 | #include <sys/eventfd.h> | |
1846 | ||
1847 | int main(int argc, char **argv) | |
1848 | { | |
1849 | rbd_image_t image; | |
1850 | rbd_completion_t comp; | |
1851 | ||
1852 | int fd = eventfd(0, EFD_NONBLOCK); | |
1853 | rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD); | |
1854 | rbd_poll_io_events(image, comp, 1); | |
1855 | ||
1856 | return 0; | |
1857 | } | |
1858 | EOF | |
1859 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1860 | rbd_poll="yes" | |
1861 | fi | |
484b0b65 | 1862 | print_config "rbd_poll" "$rbd_poll" |
53b6c979 PL |
1863 | fi |
1864 | ||
903b2812 | 1865 | ########################################## |
6266dd72 | 1866 | # check for rbd_invalidate_cache() |
ca205a75 TK |
1867 | if test "$rbd_inval" != "yes" ; then |
1868 | rbd_inval="no" | |
1869 | fi | |
903b2812 JA |
1870 | if test "$rbd" = "yes"; then |
1871 | cat > $TMPC << EOF | |
1872 | #include <rbd/librbd.h> | |
1873 | ||
1874 | int main(int argc, char **argv) | |
1875 | { | |
1876 | rbd_image_t image; | |
1877 | ||
1878 | return rbd_invalidate_cache(image); | |
1879 | } | |
1880 | EOF | |
1881 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1882 | rbd_inval="yes" | |
1883 | fi | |
484b0b65 | 1884 | print_config "rbd_invalidate_cache" "$rbd_inval" |
903b2812 JA |
1885 | fi |
1886 | ||
2e802282 JA |
1887 | ########################################## |
1888 | # Check whether we have setvbuf | |
ca205a75 TK |
1889 | if test "$setvbuf" != "yes" ; then |
1890 | setvbuf="no" | |
1891 | fi | |
2e802282 JA |
1892 | cat > $TMPC << EOF |
1893 | #include <stdio.h> | |
1894 | int main(int argc, char **argv) | |
1895 | { | |
1896 | FILE *f = NULL; | |
1897 | char buf[80]; | |
1898 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
1899 | return 0; | |
1900 | } | |
1901 | EOF | |
1902 | if compile_prog "" "" "setvbuf"; then | |
1903 | setvbuf="yes" | |
1904 | fi | |
484b0b65 | 1905 | print_config "setvbuf" "$setvbuf" |
fc5c0345 | 1906 | |
bda92394 | 1907 | ########################################## |
6e7d7dfb | 1908 | # check for gfapi |
ca205a75 TK |
1909 | if test "$gfapi" != "yes" ; then |
1910 | gfapi="no" | |
1911 | fi | |
6e7d7dfb | 1912 | cat > $TMPC << EOF |
1913 | #include <glusterfs/api/glfs.h> | |
1914 | ||
1915 | int main(int argc, char **argv) | |
1916 | { | |
6e7d7dfb | 1917 | glfs_t *g = glfs_new("foo"); |
1918 | ||
1919 | return 0; | |
1920 | } | |
1921 | EOF | |
ce18290e | 1922 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 1923 | gfapi="yes" |
1924 | fi | |
484b0b65 | 1925 | print_config "Gluster API engine" "$gfapi" |
6e7d7dfb | 1926 | |
6fa14b99 | 1927 | ########################################## |
ca205a75 | 1928 | # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes" |
6876c98c | 1929 | if test "$gfapi" = "yes" ; then |
6fa14b99 | 1930 | gf_fadvise="no" |
1931 | cat > $TMPC << EOF | |
1932 | #include <glusterfs/api/glfs.h> | |
1933 | ||
1934 | int main(int argc, char **argv) | |
1935 | { | |
1936 | struct glfs_fd *fd; | |
1937 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
1938 | ||
1939 | return 0; | |
1940 | } | |
1941 | EOF | |
6fa14b99 | 1942 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
1943 | gf_fadvise="yes" | |
1944 | fi | |
484b0b65 | 1945 | print_config "Gluster API use fadvise" "$gf_fadvise" |
6876c98c JA |
1946 | fi |
1947 | ||
ce4d13ca JA |
1948 | ########################################## |
1949 | # check for newer gfapi | |
1950 | if test "$gfapi" = "yes" ; then | |
1951 | gf_new="no" | |
1952 | cat > $TMPC << EOF | |
1953 | #include <glusterfs/api/glfs.h> | |
1954 | ||
1955 | int main(int argc, char **argv) | |
1956 | { | |
1957 | return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL); | |
1958 | } | |
1959 | EOF | |
1960 | if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then | |
1961 | gf_new="yes" | |
1962 | fi | |
1963 | print_config "Gluster new API" "$gf_new" | |
1964 | fi | |
1965 | ||
6876c98c JA |
1966 | ########################################## |
1967 | # check for gfapi trim support | |
ca205a75 TK |
1968 | if test "$gf_trim" != "yes" ; then |
1969 | gf_trim="no" | |
1970 | fi | |
6876c98c JA |
1971 | if test "$gfapi" = "yes" ; then |
1972 | cat > $TMPC << EOF | |
1973 | #include <glusterfs/api/glfs.h> | |
1974 | ||
1975 | int main(int argc, char **argv) | |
1976 | { | |
1977 | return glfs_discard_async(NULL, 0, 0); | |
1978 | } | |
1979 | EOF | |
1980 | if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then | |
1981 | gf_trim="yes" | |
1982 | fi | |
484b0b65 | 1983 | print_config "Gluster API trim support" "$gf_trim" |
6876c98c | 1984 | fi |
fc5c0345 | 1985 | |
81795ce3 CE |
1986 | ########################################## |
1987 | # Check if we support stckf on s390 | |
ca205a75 TK |
1988 | if test "$s390_z196_facilities" != "yes" ; then |
1989 | s390_z196_facilities="no" | |
1990 | fi | |
81795ce3 CE |
1991 | cat > $TMPC << EOF |
1992 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
1993 | int main(int argc, char **argv) | |
1994 | { | |
1995 | /* We want just 1 double word to be returned. */ | |
1996 | register unsigned long reg0 asm("0") = 0; | |
1997 | unsigned long stfle_bits; | |
1998 | asm volatile(".machine push" "\n\t" | |
1999 | ".machine \"z9-109\"" "\n\t" | |
2000 | "stfle %0" "\n\t" | |
2001 | ".machine pop" "\n" | |
2002 | : "=QS" (stfle_bits), "+d" (reg0) | |
2003 | : : "cc"); | |
2004 | ||
2005 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
2006 | return 0; | |
2007 | else | |
2008 | return -1; | |
2009 | } | |
2010 | EOF | |
2011 | if compile_prog "" "" "s390_z196_facilities"; then | |
2012 | $TMPE | |
6a2c9363 | 2013 | if [ $? -eq 0 ]; then |
81795ce3 CE |
2014 | s390_z196_facilities="yes" |
2015 | fi | |
2016 | fi | |
484b0b65 | 2017 | print_config "s390_z196_facilities" "$s390_z196_facilities" |
1b10477b MM |
2018 | |
2019 | ########################################## | |
2020 | # Check if we have required environment variables configured for libhdfs | |
2021 | if test "$libhdfs" = "yes" ; then | |
2022 | hdfs_conf_error=0 | |
2023 | if test "$JAVA_HOME" = "" ; then | |
2024 | echo "configure: JAVA_HOME should be defined to jdk/jvm path" | |
2025 | hdfs_conf_error=1 | |
2026 | fi | |
2027 | if test "$FIO_LIBHDFS_INCLUDE" = "" ; then | |
2028 | echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path" | |
2029 | hdfs_conf_error=1 | |
2030 | fi | |
2031 | if test "$FIO_LIBHDFS_LIB" = "" ; then | |
2032 | echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path" | |
2033 | hdfs_conf_error=1 | |
2034 | fi | |
2035 | if test "$hdfs_conf_error" = "1" ; then | |
2036 | exit 1 | |
2037 | fi | |
247e5436 JA |
2038 | FIO_HDFS_CPU=$cpu |
2039 | if test "$FIO_HDFS_CPU" = "x86_64" ; then | |
2040 | FIO_HDFS_CPU="amd64" | |
2041 | fi | |
1b10477b | 2042 | fi |
484b0b65 | 2043 | print_config "HDFS engine" "$libhdfs" |
1b10477b | 2044 | |
b8116a87 DE |
2045 | ########################################## |
2046 | # Check whether we have MTD | |
ca205a75 TK |
2047 | if test "$mtd" != "yes" ; then |
2048 | mtd="no" | |
2049 | fi | |
b8116a87 | 2050 | cat > $TMPC << EOF |
0e1c454a | 2051 | #include <string.h> |
b8116a87 DE |
2052 | #include <mtd/mtd-user.h> |
2053 | #include <sys/ioctl.h> | |
2054 | int main(int argc, char **argv) | |
2055 | { | |
0e1c454a | 2056 | struct mtd_write_req ops; |
b8116a87 | 2057 | struct mtd_info_user info; |
0e1c454a | 2058 | memset(&ops, 0, sizeof(ops)); |
400cd0ff | 2059 | info.type = MTD_MLCNANDFLASH; |
b8116a87 DE |
2060 | return ioctl(0, MEMGETINFO, &info); |
2061 | } | |
2062 | EOF | |
2063 | if compile_prog "" "" "mtd"; then | |
2064 | mtd="yes" | |
2065 | fi | |
484b0b65 | 2066 | print_config "MTD" "$mtd" |
b8116a87 | 2067 | |
3ee2a3c1 DJ |
2068 | ########################################## |
2069 | # Check whether we have libpmem | |
ca205a75 TK |
2070 | if test "$libpmem" != "yes" ; then |
2071 | libpmem="no" | |
2072 | fi | |
3ee2a3c1 DJ |
2073 | cat > $TMPC << EOF |
2074 | #include <libpmem.h> | |
2075 | int main(int argc, char **argv) | |
2076 | { | |
2077 | int rc; | |
2078 | rc = pmem_is_pmem(0, 0); | |
2079 | return 0; | |
2080 | } | |
2081 | EOF | |
2082 | if compile_prog "" "-lpmem" "libpmem"; then | |
2083 | libpmem="yes" | |
2084 | fi | |
484b0b65 | 2085 | print_config "libpmem" "$libpmem" |
3ee2a3c1 DJ |
2086 | |
2087 | ########################################## | |
2088 | # Check whether we have libpmemblk | |
cf8775b8 | 2089 | # libpmem is a prerequisite |
ca205a75 TK |
2090 | if test "$libpmemblk" != "yes" ; then |
2091 | libpmemblk="no" | |
2092 | fi | |
cf8775b8 RE |
2093 | if test "$libpmem" = "yes"; then |
2094 | cat > $TMPC << EOF | |
3ee2a3c1 DJ |
2095 | #include <libpmemblk.h> |
2096 | int main(int argc, char **argv) | |
2097 | { | |
cf8775b8 RE |
2098 | PMEMblkpool *pbp; |
2099 | pbp = pmemblk_open("", 0); | |
3ee2a3c1 DJ |
2100 | return 0; |
2101 | } | |
2102 | EOF | |
cf8775b8 RE |
2103 | if compile_prog "" "-lpmemblk" "libpmemblk"; then |
2104 | libpmemblk="yes" | |
cf8775b8 | 2105 | fi |
3ee2a3c1 | 2106 | fi |
484b0b65 | 2107 | print_config "libpmemblk" "$libpmemblk" |
3ee2a3c1 | 2108 | |
cf8775b8 | 2109 | # Choose the ioengines |
3ee2a3c1 | 2110 | if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then |
ae0db592 | 2111 | pmem="yes" |
3ee2a3c1 DJ |
2112 | devdax="yes" |
2113 | if test "$libpmemblk" = "yes"; then | |
2114 | pmemblk="yes" | |
2115 | fi | |
2116 | fi | |
2117 | ||
43f3cec2 BB |
2118 | ########################################## |
2119 | # Report whether pmemblk engine is enabled | |
363a5f65 | 2120 | print_config "PMDK pmemblk engine" "$pmemblk" |
43f3cec2 | 2121 | |
cbb15e42 DJ |
2122 | ########################################## |
2123 | # Report whether dev-dax engine is enabled | |
363a5f65 | 2124 | print_config "PMDK dev-dax engine" "$devdax" |
cbb15e42 | 2125 | |
ae0db592 TI |
2126 | ########################################## |
2127 | # Report whether libpmem engine is enabled | |
363a5f65 | 2128 | print_config "PMDK libpmem engine" "$pmem" |
ae0db592 | 2129 | |
a40e7a59 GB |
2130 | ########################################## |
2131 | # Check whether we support DDN's IME | |
2132 | if test "$libime" != "yes" ; then | |
2133 | libime="no" | |
2134 | fi | |
2135 | cat > $TMPC << EOF | |
2136 | #include <ime_native.h> | |
2137 | int main(int argc, char **argv) | |
2138 | { | |
2139 | int rc; | |
2140 | ime_native_init(); | |
2141 | rc = ime_native_finalize(); | |
2142 | return 0; | |
2143 | } | |
2144 | EOF | |
2145 | if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then | |
2146 | libime="yes" | |
2147 | CFLAGS="-I${ime_path}/include $CFLAGS" | |
2148 | LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS" | |
2149 | LIBS="-lim_client $LIBS" | |
2150 | fi | |
2151 | print_config "DDN's Infinite Memory Engine" "$libime" | |
2152 | ||
247ef2aa KZ |
2153 | ########################################## |
2154 | # Check if we have required environment variables configured for libiscsi | |
2155 | if test "$libiscsi" = "yes" ; then | |
2156 | if $(pkg-config --atleast-version=1.9.0 libiscsi); then | |
2157 | libiscsi="yes" | |
2158 | libiscsi_cflags=$(pkg-config --cflags libiscsi) | |
2159 | libiscsi_libs=$(pkg-config --libs libiscsi) | |
2160 | else | |
2161 | if test "$libiscsi" = "yes" ; then | |
2162 | echo "libiscsi" "Install libiscsi >= 1.9.0" | |
2163 | fi | |
2164 | libiscsi="no" | |
2165 | fi | |
2166 | fi | |
2167 | print_config "iscsi engine" "$libiscsi" | |
2168 | ||
d643a1e2 RJ |
2169 | ########################################## |
2170 | # Check if we have libnbd (for NBD support). | |
4e8c82b4 | 2171 | minimum_libnbd=0.9.8 |
d643a1e2 RJ |
2172 | if test "$libnbd" = "yes" ; then |
2173 | if $(pkg-config --atleast-version=$minimum_libnbd libnbd); then | |
2174 | libnbd="yes" | |
2175 | libnbd_cflags=$(pkg-config --cflags libnbd) | |
2176 | libnbd_libs=$(pkg-config --libs libnbd) | |
2177 | else | |
2178 | if test "$libnbd" = "yes" ; then | |
2179 | echo "libnbd" "Install libnbd >= $minimum_libnbd" | |
2180 | fi | |
2181 | libnbd="no" | |
2182 | fi | |
2183 | fi | |
2184 | print_config "NBD engine" "$libnbd" | |
2185 | ||
bda92394 | 2186 | ########################################## |
b470a02c SC |
2187 | # Check if we have lex/yacc available |
2188 | yacc="no" | |
e7b2c7a3 | 2189 | yacc_is_bison="no" |
b470a02c SC |
2190 | lex="no" |
2191 | arith="no" | |
de26b824 | 2192 | if test "$disable_lex" = "no" || test -z "$disable_lex" ; then |
cf6dd80e | 2193 | if test "$targetos" != "SunOS" ; then |
e7b2c7a3 | 2194 | LEX=$(which lex 2> /dev/null) |
b470a02c SC |
2195 | if test -x "$LEX" ; then |
2196 | lex="yes" | |
2197 | fi | |
7e0049e9 | 2198 | YACC=$(which bison 2> /dev/null) |
b470a02c SC |
2199 | if test -x "$YACC" ; then |
2200 | yacc="yes" | |
7e0049e9 | 2201 | yacc_is_bison="yes" |
e7b2c7a3 | 2202 | else |
7e0049e9 | 2203 | YACC=$(which yacc 2> /dev/null) |
e7b2c7a3 JA |
2204 | if test -x "$YACC" ; then |
2205 | yacc="yes" | |
e7b2c7a3 | 2206 | fi |
b470a02c SC |
2207 | fi |
2208 | if test "$yacc" = "yes" && test "$lex" = "yes" ; then | |
2209 | arith="yes" | |
2210 | fi | |
2211 | ||
2212 | if test "$arith" = "yes" ; then | |
2213 | cat > $TMPC << EOF | |
2214 | extern int yywrap(void); | |
2215 | ||
2216 | int main(int argc, char **argv) | |
2217 | { | |
2218 | yywrap(); | |
2219 | return 0; | |
2220 | } | |
2221 | EOF | |
719cda03 JA |
2222 | if compile_prog "" "-ll" "lex"; then |
2223 | LIBS="-ll $LIBS" | |
b470a02c SC |
2224 | else |
2225 | arith="no" | |
2226 | fi | |
2227 | fi | |
cf6dd80e | 2228 | fi |
a655bbc4 | 2229 | fi |
b470a02c | 2230 | |
63bda378 JA |
2231 | # Check if lex fails using -o |
2232 | if test "$arith" = "yes" ; then | |
daf705b5 JA |
2233 | if test "$force_no_lex_o" = "yes" ; then |
2234 | lex_use_o="no" | |
2235 | else | |
63bda378 JA |
2236 | $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null |
2237 | if test "$?" = "0" ; then | |
2238 | lex_use_o="yes" | |
2239 | else | |
2240 | lex_use_o="no" | |
2241 | fi | |
2242 | fi | |
daf705b5 | 2243 | fi |
63bda378 | 2244 | |
484b0b65 | 2245 | print_config "lex/yacc for arithmetic" "$arith" |
b470a02c | 2246 | |
aae599ba JA |
2247 | ########################################## |
2248 | # Check whether we have setmntent/getmntent | |
ca205a75 TK |
2249 | if test "$getmntent" != "yes" ; then |
2250 | getmntent="no" | |
2251 | fi | |
aae599ba JA |
2252 | cat > $TMPC << EOF |
2253 | #include <stdio.h> | |
2254 | #include <mntent.h> | |
2255 | int main(int argc, char **argv) | |
2256 | { | |
2257 | FILE *mtab = setmntent(NULL, "r"); | |
2258 | struct mntent *mnt = getmntent(mtab); | |
1581b82a | 2259 | endmntent(mtab); |
aae599ba JA |
2260 | return 0; |
2261 | } | |
2262 | EOF | |
2263 | if compile_prog "" "" "getmntent"; then | |
2264 | getmntent="yes" | |
2265 | fi | |
484b0b65 | 2266 | print_config "getmntent" "$getmntent" |
aae599ba | 2267 | |
e7e136da TK |
2268 | ########################################## |
2269 | # Check whether we have getmntinfo | |
b765bec0 TK |
2270 | # These are originally added for BSDs, but may also work |
2271 | # on other operating systems with getmntinfo(3). | |
2272 | ||
2273 | # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD. | |
2274 | # Note that NetBSD needs -Werror to catch warning as error. | |
ca205a75 TK |
2275 | if test "$getmntinfo" != "yes" ; then |
2276 | getmntinfo="no" | |
2277 | fi | |
e7e136da TK |
2278 | cat > $TMPC << EOF |
2279 | #include <stdio.h> | |
2280 | #include <sys/param.h> | |
2281 | #include <sys/mount.h> | |
2282 | int main(int argc, char **argv) | |
2283 | { | |
9ada751d | 2284 | struct statfs *st; |
e7e136da TK |
2285 | return getmntinfo(&st, MNT_NOWAIT); |
2286 | } | |
2287 | EOF | |
b765bec0 | 2288 | if compile_prog "-Werror" "" "getmntinfo"; then |
e7e136da TK |
2289 | getmntinfo="yes" |
2290 | fi | |
484b0b65 | 2291 | print_config "getmntinfo" "$getmntinfo" |
e7e136da | 2292 | |
b765bec0 | 2293 | # getmntinfo(3) for NetBSD. |
ca205a75 TK |
2294 | if test "$getmntinfo_statvfs" != "yes" ; then |
2295 | getmntinfo_statvfs="no" | |
2296 | fi | |
b765bec0 TK |
2297 | cat > $TMPC << EOF |
2298 | #include <stdio.h> | |
2299 | #include <sys/statvfs.h> | |
2300 | int main(int argc, char **argv) | |
2301 | { | |
2302 | struct statvfs *st; | |
2303 | return getmntinfo(&st, MNT_NOWAIT); | |
2304 | } | |
2305 | EOF | |
2306 | # Skip the test if the one with statfs arg is detected. | |
2307 | if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then | |
2308 | getmntinfo_statvfs="yes" | |
484b0b65 | 2309 | print_config "getmntinfo_statvfs" "$getmntinfo_statvfs" |
b765bec0 TK |
2310 | fi |
2311 | ||
5018f79f AH |
2312 | ########################################## |
2313 | # Check whether we have _Static_assert | |
ca205a75 TK |
2314 | if test "$static_assert" != "yes" ; then |
2315 | static_assert="no" | |
2316 | fi | |
5018f79f AH |
2317 | cat > $TMPC << EOF |
2318 | #include <assert.h> | |
94815a5c | 2319 | #include <stdlib.h> |
51b4c81e | 2320 | #include <stddef.h> |
94815a5c JA |
2321 | |
2322 | struct foo { | |
2323 | int a, b; | |
2324 | }; | |
2325 | ||
5018f79f AH |
2326 | int main(int argc, char **argv) |
2327 | { | |
94815a5c | 2328 | _Static_assert(offsetof(struct foo, a) == 0 , "Check"); |
5018f79f AH |
2329 | return 0 ; |
2330 | } | |
2331 | EOF | |
2332 | if compile_prog "" "" "static_assert"; then | |
2333 | static_assert="yes" | |
2334 | fi | |
484b0b65 | 2335 | print_config "Static Assert" "$static_assert" |
e39c0676 JA |
2336 | |
2337 | ########################################## | |
2338 | # Check whether we have bool / stdbool.h | |
ca205a75 TK |
2339 | if test "$have_bool" != "yes" ; then |
2340 | have_bool="no" | |
2341 | fi | |
e39c0676 JA |
2342 | cat > $TMPC << EOF |
2343 | #include <stdbool.h> | |
2344 | int main(int argc, char **argv) | |
2345 | { | |
2346 | bool var = true; | |
2347 | return var != false; | |
2348 | } | |
2349 | EOF | |
2350 | if compile_prog "" "" "bool"; then | |
2351 | have_bool="yes" | |
2352 | fi | |
484b0b65 | 2353 | print_config "bool" "$have_bool" |
e39c0676 | 2354 | |
b29c71c4 JA |
2355 | ########################################## |
2356 | # Check whether we have strndup() | |
107ad008 | 2357 | strndup="no" |
b29c71c4 JA |
2358 | cat > $TMPC << EOF |
2359 | #include <string.h> | |
2360 | #include <stdlib.h> | |
2361 | int main(int argc, char **argv) | |
2362 | { | |
2363 | char *res = strndup("test string", 8); | |
2364 | ||
2365 | free(res); | |
2366 | return 0; | |
2367 | } | |
2368 | EOF | |
2369 | if compile_prog "" "" "strndup"; then | |
2370 | strndup="yes" | |
2371 | fi | |
2372 | print_config "strndup" "$strndup" | |
2373 | ||
214e2d56 | 2374 | ########################################## |
0ffccc21 BVA |
2375 | # <valgrind/drd.h> probe |
2376 | # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is | |
2377 | # also available but not the other way around. | |
2378 | if test "$valgrind_dev" != "yes" ; then | |
2379 | valgrind_dev="no" | |
2380 | fi | |
2381 | cat > $TMPC << EOF | |
2382 | #include <valgrind/drd.h> | |
2383 | int main(int argc, char **argv) | |
2384 | { | |
2385 | return 0; | |
2386 | } | |
2387 | EOF | |
2388 | if compile_prog "" "" "valgrind_dev"; then | |
2389 | valgrind_dev="yes" | |
2390 | fi | |
2391 | print_config "Valgrind headers" "$valgrind_dev" | |
2392 | ||
a76e1995 BVA |
2393 | ########################################## |
2394 | # <linux/blkzoned.h> probe | |
2395 | if test "$linux_blkzoned" != "yes" ; then | |
2396 | linux_blkzoned="no" | |
2397 | fi | |
2398 | cat > $TMPC << EOF | |
2399 | #include <linux/blkzoned.h> | |
2400 | int main(int argc, char **argv) | |
2401 | { | |
2402 | return 0; | |
2403 | } | |
2404 | EOF | |
2405 | if compile_prog "" "" "linux_blkzoned"; then | |
2406 | linux_blkzoned="yes" | |
2407 | fi | |
2408 | print_config "Zoned block device support" "$linux_blkzoned" | |
2409 | ||
56a19325 DF |
2410 | ########################################## |
2411 | # libzbc probe | |
2412 | if test "$libzbc" != "yes" ; then | |
2413 | libzbc="no" | |
2414 | fi | |
2415 | cat > $TMPC << EOF | |
2416 | #include <libzbc/zbc.h> | |
2417 | int main(int argc, char **argv) | |
2418 | { | |
2419 | struct zbc_device *dev = NULL; | |
2420 | ||
2421 | return zbc_open("foo=bar", O_RDONLY, &dev); | |
2422 | } | |
2423 | EOF | |
2424 | if compile_prog "" "-lzbc" "libzbc"; then | |
2425 | libzbcvermaj=$(pkg-config --modversion libzbc | sed 's/\.[0-9]*\.[0-9]*//') | |
2426 | if test "$libzbcvermaj" -ge "5" ; then | |
2427 | libzbc="yes" | |
56a19325 DF |
2428 | else |
2429 | print_config "libzbc engine" "Unsupported libzbc version (version 5 or above required)" | |
2430 | libzbc="no" | |
2431 | fi | |
2432 | else | |
2433 | if test "$libzbc" = "yes" ; then | |
2434 | feature_not_found "libzbc" "libzbc or libzbc/zbc.h" | |
2435 | fi | |
2436 | libzbc="no" | |
2437 | fi | |
2438 | print_config "libzbc engine" "$libzbc" | |
2439 | ||
a76e1995 | 2440 | ########################################## |
214e2d56 | 2441 | # check march=armv8-a+crc+crypto |
ca205a75 TK |
2442 | if test "$march_armv8_a_crc_crypto" != "yes" ; then |
2443 | march_armv8_a_crc_crypto="no" | |
2444 | fi | |
214e2d56 | 2445 | if test "$cpu" = "arm64" ; then |
2446 | cat > $TMPC <<EOF | |
9b153dc2 TT |
2447 | #include <arm_acle.h> |
2448 | #include <arm_neon.h> | |
58828d07 | 2449 | #include <sys/auxv.h> |
9b153dc2 | 2450 | |
214e2d56 | 2451 | int main(void) |
2452 | { | |
58828d07 SW |
2453 | /* Can we also do a runtime probe? */ |
2454 | #if __linux__ | |
2455 | return getauxval(AT_HWCAP); | |
2456 | #else | |
2457 | # error "Don't know how to do runtime probe for ARM CRC32c" | |
2458 | #endif | |
214e2d56 | 2459 | } |
2460 | EOF | |
58828d07 | 2461 | if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then |
214e2d56 | 2462 | march_armv8_a_crc_crypto="yes" |
58828d07 | 2463 | CFLAGS="$CFLAGS -march=armv8-a+crc+crypto" |
9f75af77 | 2464 | march_set="yes" |
214e2d56 | 2465 | fi |
2466 | fi | |
484b0b65 | 2467 | print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto" |
214e2d56 | 2468 | |
03553853 YR |
2469 | ########################################## |
2470 | # cuda probe | |
d418fa90 TK |
2471 | if test "$cuda" != "yes" ; then |
2472 | cuda="no" | |
2473 | fi | |
03553853 YR |
2474 | cat > $TMPC << EOF |
2475 | #include <cuda.h> | |
2476 | int main(int argc, char **argv) | |
2477 | { | |
2478 | return cuInit(0); | |
2479 | } | |
2480 | EOF | |
4bd2c8b9 | 2481 | if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then |
03553853 YR |
2482 | cuda="yes" |
2483 | LIBS="-lcuda $LIBS" | |
2484 | fi | |
484b0b65 | 2485 | print_config "cuda" "$cuda" |
214e2d56 | 2486 | |
a817dc3b JA |
2487 | ########################################## |
2488 | # check for cc -march=native | |
2489 | build_native="no" | |
2490 | cat > $TMPC << EOF | |
2491 | int main(int argc, char **argv) | |
2492 | { | |
2493 | return 0; | |
2494 | } | |
2495 | EOF | |
c922e0b0 SW |
2496 | if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \ |
2497 | compile_prog "-march=native" "" "march=native"; then | |
a817dc3b JA |
2498 | build_native="yes" |
2499 | fi | |
2500 | print_config "Build march=native" "$build_native" | |
2501 | ||
b8b0e1ee TK |
2502 | ########################################## |
2503 | # check for -lcunit | |
2504 | if test "$cunit" != "yes" ; then | |
2505 | cunit="no" | |
2506 | fi | |
2507 | cat > $TMPC << EOF | |
2508 | #include <CUnit/CUnit.h> | |
2509 | #include <CUnit/Basic.h> | |
2510 | int main(void) | |
2511 | { | |
2512 | if (CU_initialize_registry() != CUE_SUCCESS) | |
2513 | return CU_get_error(); | |
2514 | CU_basic_set_mode(CU_BRM_VERBOSE); | |
2515 | CU_basic_run_tests(); | |
2516 | CU_cleanup_registry(); | |
2517 | return CU_get_error(); | |
2518 | } | |
2519 | EOF | |
2520 | if compile_prog "" "-lcunit" "CUnit"; then | |
2521 | cunit="yes" | |
2522 | fi | |
2523 | print_config "CUnit" "$cunit" | |
2524 | ||
57fa61f0 JA |
2525 | ########################################## |
2526 | # check for __kernel_rwf_t | |
2527 | __kernel_rwf_t="no" | |
2528 | cat > $TMPC << EOF | |
2529 | #include <linux/fs.h> | |
2530 | int main(int argc, char **argv) | |
2531 | { | |
2532 | __kernel_rwf_t x; | |
2533 | x = 0; | |
2534 | return x; | |
2535 | } | |
2536 | EOF | |
2537 | if compile_prog "" "" "__kernel_rwf_t"; then | |
2538 | __kernel_rwf_t="yes" | |
2539 | fi | |
2540 | print_config "__kernel_rwf_t" "$__kernel_rwf_t" | |
2541 | ||
71144e67 | 2542 | ########################################## |
5ad91012 | 2543 | # check if gcc has -Wimplicit-fallthrough=2 |
71144e67 JA |
2544 | fallthrough="no" |
2545 | cat > $TMPC << EOF | |
2546 | int main(int argc, char **argv) | |
2547 | { | |
2548 | return 0; | |
2549 | } | |
2550 | EOF | |
5ad91012 | 2551 | if compile_prog "-Wimplicit-fallthrough=2" "" "-Wimplicit-fallthrough=2"; then |
71144e67 JA |
2552 | fallthrough="yes" |
2553 | fi | |
5ad91012 | 2554 | print_config "-Wimplicit-fallthrough=2" "$fallthrough" |
71144e67 | 2555 | |
ff547caa KB |
2556 | ########################################## |
2557 | # check for MADV_HUGEPAGE support | |
2558 | if test "$thp" != "yes" ; then | |
2559 | thp="no" | |
2560 | fi | |
2561 | if test "$esx" != "yes" ; then | |
2562 | cat > $TMPC <<EOF | |
2563 | #include <sys/mman.h> | |
2564 | int main(void) | |
2565 | { | |
2566 | return madvise(0, 0x1000, MADV_HUGEPAGE); | |
2567 | } | |
2568 | EOF | |
2569 | if compile_prog "" "" "thp" ; then | |
2570 | thp=yes | |
2571 | else | |
2572 | if test "$thp" = "yes" ; then | |
2573 | feature_not_found "Transparent Huge Page" "" | |
2574 | fi | |
2575 | thp=no | |
2576 | fi | |
2577 | fi | |
2578 | print_config "MADV_HUGEPAGE" "$thp" | |
2579 | ||
de5ed0e4 JA |
2580 | ########################################## |
2581 | # check for gettid() | |
2582 | gettid="no" | |
2583 | cat > $TMPC << EOF | |
2584 | #include <unistd.h> | |
2585 | int main(int argc, char **argv) | |
2586 | { | |
2587 | return gettid(); | |
2588 | } | |
2589 | EOF | |
2590 | if compile_prog "" "" "gettid"; then | |
2591 | gettid="yes" | |
2592 | fi | |
2593 | print_config "gettid" "$gettid" | |
2594 | ||
95f31f7d TK |
2595 | ########################################## |
2596 | # check for statx(2) support by libc | |
2597 | statx="no" | |
2598 | cat > $TMPC << EOF | |
2599 | #include <unistd.h> | |
2600 | #include <sys/stat.h> | |
2601 | ||
2602 | int main(int argc, char **argv) | |
2603 | { | |
2604 | struct statx st; | |
2605 | return statx(-1, *argv, 0, 0, &st); | |
2606 | } | |
2607 | EOF | |
2608 | if compile_prog "" "" "statx"; then | |
2609 | statx="yes" | |
2610 | fi | |
2611 | print_config "statx(2)/libc" "$statx" | |
2612 | ||
2613 | ########################################## | |
2614 | # check for statx(2) support by kernel | |
2615 | statx_syscall="no" | |
2616 | cat > $TMPC << EOF | |
2617 | #include <unistd.h> | |
2618 | #include <linux/stat.h> | |
2619 | #include <sys/stat.h> | |
2620 | #include <sys/syscall.h> | |
2621 | ||
2622 | static int _statx(int dfd, const char *pathname, int flags, unsigned int mask, | |
2623 | struct statx *buffer) | |
2624 | { | |
2625 | return syscall(__NR_statx, dfd, pathname, flags, mask, buffer); | |
2626 | } | |
2627 | ||
2628 | int main(int argc, char **argv) | |
2629 | { | |
2630 | struct statx st; | |
2631 | return _statx(-1, *argv, 0, 0, &st); | |
2632 | } | |
2633 | EOF | |
2634 | if compile_prog "" "" "statx_syscall"; then | |
2635 | statx_syscall="yes" | |
2636 | fi | |
2637 | print_config "statx(2)/syscall" "$statx_syscall" | |
2638 | ||
67bf9823 JA |
2639 | ############################################################################# |
2640 | ||
67bf9823 | 2641 | if test "$wordsize" = "64" ; then |
4feafb1e | 2642 | output_sym "CONFIG_64BIT" |
67bf9823 | 2643 | elif test "$wordsize" = "32" ; then |
4feafb1e | 2644 | output_sym "CONFIG_32BIT" |
67bf9823 | 2645 | else |
d7145a78 | 2646 | fatal "Unknown wordsize!" |
67bf9823 | 2647 | fi |
0dcebdf4 | 2648 | if test "$bigendian" = "yes" ; then |
4feafb1e | 2649 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 2650 | else |
4feafb1e | 2651 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 2652 | fi |
3989b143 JA |
2653 | if test "$zlib" = "yes" ; then |
2654 | output_sym "CONFIG_ZLIB" | |
2655 | fi | |
67bf9823 | 2656 | if test "$libaio" = "yes" ; then |
4feafb1e | 2657 | output_sym "CONFIG_LIBAIO" |
7d42e66e KK |
2658 | if test "$libaio_rw_flags" = "yes" ; then |
2659 | output_sym "CONFIG_LIBAIO_RW_FLAGS" | |
2660 | fi | |
e2defc22 JA |
2661 | if test "$libaio_uring" = "yes" ; then |
2662 | output_sym "CONFIG_LIBAIO_URING" | |
2663 | fi | |
67bf9823 JA |
2664 | fi |
2665 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 2666 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
2667 | fi |
2668 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 2669 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 | 2670 | fi |
06eac6b2 SW |
2671 | if test "$posix_pshared" = "yes" ; then |
2672 | output_sym "CONFIG_PSHARED" | |
2673 | fi | |
78b66d32 BVA |
2674 | if test "$pthread_condattr_setclock" = "yes" ; then |
2675 | output_sym "CONFIG_PTHREAD_CONDATTR_SETCLOCK" | |
2676 | fi | |
c31092b8 BVA |
2677 | if test "$pthread_sigmask" = "yes" ; then |
2678 | output_sym "CONFIG_PTHREAD_SIGMASK" | |
2679 | fi | |
44e8e956 | 2680 | if test "$have_asprintf" = "yes" ; then |
cb3b6806 | 2681 | output_sym "CONFIG_HAVE_ASPRINTF" |
44e8e956 BVA |
2682 | fi |
2683 | if test "$have_vasprintf" = "yes" ; then | |
cb3b6806 | 2684 | output_sym "CONFIG_HAVE_VASPRINTF" |
44e8e956 | 2685 | fi |
67bf9823 | 2686 | if test "$linux_fallocate" = "yes" ; then |
4feafb1e | 2687 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
2688 | fi |
2689 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 2690 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
2691 | fi |
2692 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 2693 | output_sym "CONFIG_FDATASYNC" |
67bf9823 | 2694 | fi |
52a552e2 BVA |
2695 | if test "$pipe" = "yes" ; then |
2696 | output_sym "CONFIG_PIPE" | |
2697 | fi | |
2698 | if test "$pipe2" = "yes" ; then | |
2699 | output_sym "CONFIG_PIPE2" | |
2700 | fi | |
15eca9aa BVA |
2701 | if test "$pread" = "yes" ; then |
2702 | output_sym "CONFIG_PREAD" | |
2703 | fi | |
67bf9823 | 2704 | if test "$sync_file_range" = "yes" ; then |
4feafb1e | 2705 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 JA |
2706 | fi |
2707 | if test "$sfaa" = "yes" ; then | |
4feafb1e | 2708 | output_sym "CONFIG_SFAA" |
67bf9823 | 2709 | fi |
a250edd0 JA |
2710 | if test "$sync_sync" = "yes" ; then |
2711 | output_sym "CONFIG_SYNC_SYNC" | |
2712 | fi | |
2713 | if test "$cmp_swap" = "yes" ; then | |
2714 | output_sym "CONFIG_CMP_SWAP" | |
2715 | fi | |
954cd73a | 2716 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 2717 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
2718 | fi |
2719 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 2720 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
2721 | fi |
2722 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 2723 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 | 2724 | fi |
c544f604 SN |
2725 | if test "$clock_monotonic_raw" = "yes" ; then |
2726 | output_sym "CONFIG_CLOCK_MONOTONIC_RAW" | |
2727 | fi | |
67bf9823 | 2728 | if test "$clock_monotonic_precise" = "yes" ; then |
4feafb1e | 2729 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
67bf9823 | 2730 | fi |
25f8227d JA |
2731 | if test "$clockid_t" = "yes"; then |
2732 | output_sym "CONFIG_CLOCKID_T" | |
2733 | fi | |
67bf9823 | 2734 | if test "$gettimeofday" = "yes" ; then |
4feafb1e | 2735 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
2736 | fi |
2737 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 2738 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
2739 | fi |
2740 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 2741 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 2742 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 2743 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
2744 | fi |
2745 | if test "$strsep" = "yes" ; then | |
4feafb1e | 2746 | output_sym "CONFIG_STRSEP" |
67bf9823 | 2747 | fi |
9ad8da82 JA |
2748 | if test "$strcasestr" = "yes" ; then |
2749 | output_sym "CONFIG_STRCASESTR" | |
2750 | fi | |
5ad7be56 KD |
2751 | if test "$strlcat" = "yes" ; then |
2752 | output_sym "CONFIG_STRLCAT" | |
2753 | fi | |
67bf9823 | 2754 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 2755 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
2756 | fi |
2757 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 2758 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
2759 | fi |
2760 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 2761 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
2762 | fi |
2763 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 2764 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
2765 | fi |
2766 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 2767 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 JA |
2768 | fi |
2769 | if test "$guasi" = "yes" ; then | |
4feafb1e | 2770 | output_sym "CONFIG_GUASI" |
67bf9823 | 2771 | fi |
50206d9b | 2772 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 2773 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
2774 | fi |
2775 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 2776 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
2777 | fi |
2778 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 2779 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 2780 | fi |
44404c5a | 2781 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 2782 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 2783 | fi |
91f94d5b | 2784 | if test "$gfio" = "yes" ; then |
bad7e42c | 2785 | output_sym "CONFIG_GFIO" |
91f94d5b | 2786 | fi |
c8931876 JA |
2787 | if test "$esx" = "yes" ; then |
2788 | output_sym "CONFIG_ESX" | |
2789 | output_sym "CONFIG_NO_SHM" | |
2790 | fi | |
7e09a9f1 JA |
2791 | if test "$sched_idle" = "yes" ; then |
2792 | output_sym "CONFIG_SCHED_IDLE" | |
2793 | fi | |
1eafa37a JA |
2794 | if test "$tcp_nodelay" = "yes" ; then |
2795 | output_sym "CONFIG_TCP_NODELAY" | |
2796 | fi | |
1008602c JA |
2797 | if test "$window_size" = "yes" ; then |
2798 | output_sym "CONFIG_NET_WINDOWSIZE" | |
2799 | fi | |
e5f34d95 JA |
2800 | if test "$mss" = "yes" ; then |
2801 | output_sym "CONFIG_NET_MSS" | |
2802 | fi | |
38b9354a JA |
2803 | if test "$rlimit_memlock" = "yes" ; then |
2804 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
2805 | fi | |
07fc0acd JA |
2806 | if test "$pwritev" = "yes" ; then |
2807 | output_sym "CONFIG_PWRITEV" | |
2808 | fi | |
2cafffbe JA |
2809 | if test "$pwritev2" = "yes" ; then |
2810 | output_sym "CONFIG_PWRITEV2" | |
2811 | fi | |
ecad55e9 JA |
2812 | if test "$ipv6" = "yes" ; then |
2813 | output_sym "CONFIG_IPV6" | |
2814 | fi | |
c2f6a13d LMB |
2815 | if test "$http" = "yes" ; then |
2816 | output_sym "CONFIG_HTTP" | |
2817 | fi | |
d5f9b0ea IF |
2818 | if test "$rados" = "yes" ; then |
2819 | output_sym "CONFIG_RADOS" | |
2820 | fi | |
fc5c0345 DG |
2821 | if test "$rbd" = "yes" ; then |
2822 | output_sym "CONFIG_RBD" | |
2823 | fi | |
53b6c979 PL |
2824 | if test "$rbd_poll" = "yes" ; then |
2825 | output_sym "CONFIG_RBD_POLL" | |
2826 | fi | |
903b2812 JA |
2827 | if test "$rbd_inval" = "yes" ; then |
2828 | output_sym "CONFIG_RBD_INVAL" | |
2829 | fi | |
2e802282 JA |
2830 | if test "$setvbuf" = "yes" ; then |
2831 | output_sym "CONFIG_SETVBUF" | |
2832 | fi | |
81795ce3 CE |
2833 | if test "$s390_z196_facilities" = "yes" ; then |
2834 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
2835 | CFLAGS="$CFLAGS -march=z9-109" | |
9f75af77 | 2836 | march_set="yes" |
81795ce3 | 2837 | fi |
6e7d7dfb | 2838 | if test "$gfapi" = "yes" ; then |
2839 | output_sym "CONFIG_GFAPI" | |
2840 | fi | |
6fa14b99 | 2841 | if test "$gf_fadvise" = "yes" ; then |
2842 | output_sym "CONFIG_GF_FADVISE" | |
2843 | fi | |
6876c98c JA |
2844 | if test "$gf_trim" = "yes" ; then |
2845 | output_sym "CONFIG_GF_TRIM" | |
2846 | fi | |
ce4d13ca JA |
2847 | if test "$gf_new" = "yes" ; then |
2848 | output_sym "CONFIG_GF_NEW_API" | |
2849 | fi | |
1b10477b MM |
2850 | if test "$libhdfs" = "yes" ; then |
2851 | output_sym "CONFIG_LIBHDFS" | |
247e5436 | 2852 | echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak |
1527dc50 FB |
2853 | echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak |
2854 | echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak | |
2855 | echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak | |
247ef2aa | 2856 | fi |
b8116a87 DE |
2857 | if test "$mtd" = "yes" ; then |
2858 | output_sym "CONFIG_MTD" | |
2859 | fi | |
43f3cec2 BB |
2860 | if test "$pmemblk" = "yes" ; then |
2861 | output_sym "CONFIG_PMEMBLK" | |
2862 | fi | |
cbb15e42 DJ |
2863 | if test "$devdax" = "yes" ; then |
2864 | output_sym "CONFIG_LINUX_DEVDAX" | |
2865 | fi | |
ae0db592 TI |
2866 | if test "$pmem" = "yes" ; then |
2867 | output_sym "CONFIG_LIBPMEM" | |
2868 | fi | |
a40e7a59 GB |
2869 | if test "$libime" = "yes" ; then |
2870 | output_sym "CONFIG_IME" | |
2871 | fi | |
b470a02c SC |
2872 | if test "$arith" = "yes" ; then |
2873 | output_sym "CONFIG_ARITHMETIC" | |
e7b2c7a3 JA |
2874 | if test "$yacc_is_bison" = "yes" ; then |
2875 | echo "YACC=$YACC -y" >> $config_host_mak | |
2876 | else | |
2877 | echo "YACC=$YACC" >> $config_host_mak | |
2878 | fi | |
63bda378 JA |
2879 | if test "$lex_use_o" = "yes" ; then |
2880 | echo "CONFIG_LEX_USE_O=y" >> $config_host_mak | |
2881 | fi | |
b470a02c | 2882 | fi |
aae599ba JA |
2883 | if test "$getmntent" = "yes" ; then |
2884 | output_sym "CONFIG_GETMNTENT" | |
2885 | fi | |
e7e136da TK |
2886 | if test "$getmntinfo" = "yes" ; then |
2887 | output_sym "CONFIG_GETMNTINFO" | |
2888 | fi | |
b765bec0 TK |
2889 | if test "$getmntinfo_statvfs" = "yes" ; then |
2890 | output_sym "CONFIG_GETMNTINFO_STATVFS" | |
2891 | fi | |
5018f79f AH |
2892 | if test "$static_assert" = "yes" ; then |
2893 | output_sym "CONFIG_STATIC_ASSERT" | |
2894 | fi | |
e39c0676 JA |
2895 | if test "$have_bool" = "yes" ; then |
2896 | output_sym "CONFIG_HAVE_BOOL" | |
2897 | fi | |
b29c71c4 JA |
2898 | if test "$strndup" = "yes" ; then |
2899 | output_sym "CONFIG_HAVE_STRNDUP" | |
2900 | fi | |
484817a9 JA |
2901 | if test "$disable_opt" = "yes" ; then |
2902 | output_sym "CONFIG_DISABLE_OPTIMIZATIONS" | |
2903 | fi | |
0ffccc21 BVA |
2904 | if test "$valgrind_dev" = "yes"; then |
2905 | output_sym "CONFIG_VALGRIND_DEV" | |
2906 | fi | |
a76e1995 | 2907 | if test "$linux_blkzoned" = "yes" ; then |
b7694961 | 2908 | output_sym "CONFIG_HAS_BLKZONED" |
a76e1995 | 2909 | fi |
56a19325 DF |
2910 | if test "$libzbc" = "yes" ; then |
2911 | output_sym "CONFIG_LIBZBC" | |
2912 | fi | |
605cf82e | 2913 | if test "$zlib" = "no" ; then |
8f909424 JA |
2914 | echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it." |
2915 | if test "$build_static" = "yes"; then | |
2916 | echo "Note that some distros have separate packages for static libraries." | |
2917 | fi | |
605cf82e | 2918 | fi |
58828d07 SW |
2919 | if test "$march_armv8_a_crc_crypto" = "yes" ; then |
2920 | output_sym "ARCH_HAVE_CRC_CRYPTO" | |
2921 | fi | |
03553853 YR |
2922 | if test "$cuda" = "yes" ; then |
2923 | output_sym "CONFIG_CUDA" | |
2924 | fi | |
9f75af77 | 2925 | if test "$march_set" = "no" && test "$build_native" = "yes" ; then |
a817dc3b JA |
2926 | output_sym "CONFIG_BUILD_NATIVE" |
2927 | fi | |
b8b0e1ee TK |
2928 | if test "$cunit" = "yes" ; then |
2929 | output_sym "CONFIG_HAVE_CUNIT" | |
2930 | fi | |
57fa61f0 JA |
2931 | if test "$__kernel_rwf_t" = "yes"; then |
2932 | output_sym "CONFIG_HAVE_KERNEL_RWF_T" | |
2933 | fi | |
de5ed0e4 JA |
2934 | if test "$gettid" = "yes"; then |
2935 | output_sym "CONFIG_HAVE_GETTID" | |
2936 | fi | |
95f31f7d TK |
2937 | if test "$statx" = "yes"; then |
2938 | output_sym "CONFIG_HAVE_STATX" | |
2939 | fi | |
2940 | if test "$statx_syscall" = "yes"; then | |
2941 | output_sym "CONFIG_HAVE_STATX_SYSCALL" | |
2942 | fi | |
71144e67 JA |
2943 | if test "$fallthrough" = "yes"; then |
2944 | CFLAGS="$CFLAGS -Wimplicit-fallthrough" | |
2945 | fi | |
ff547caa KB |
2946 | if test "$thp" = "yes" ; then |
2947 | output_sym "CONFIG_HAVE_THP" | |
2948 | fi | |
247ef2aa KZ |
2949 | if test "$libiscsi" = "yes" ; then |
2950 | output_sym "CONFIG_LIBISCSI" | |
2951 | echo "CONFIG_LIBISCSI=m" >> $config_host_mak | |
2952 | echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak | |
2953 | echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak | |
2954 | fi | |
d643a1e2 RJ |
2955 | if test "$libnbd" = "yes" ; then |
2956 | output_sym "CONFIG_LIBNBD" | |
2957 | echo "CONFIG_LIBNBD=m" >> $config_host_mak | |
2958 | echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak | |
2959 | echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak | |
2960 | fi | |
5a8a6a03 YK |
2961 | if test "$dynamic_engines" = "yes" ; then |
2962 | output_sym "CONFIG_DYNAMIC_ENGINES" | |
2963 | fi | |
2964 | print_config "Lib-based ioengines dynamic" "$dynamic_engines" | |
01fe773d JD |
2965 | cat > $TMPC << EOF |
2966 | int main(int argc, char **argv) | |
2967 | { | |
2968 | return 0; | |
2969 | } | |
2970 | EOF | |
2971 | if test "$disable_tcmalloc" != "yes" && compile_prog "" "-ltcmalloc" "tcmalloc"; then | |
2972 | LIBS="-ltcmalloc $LIBS" | |
2973 | tcmalloc="yes" | |
2974 | else | |
2975 | tcmalloc="no" | |
2976 | fi | |
2977 | print_config "TCMalloc support" "$tcmalloc" | |
605cf82e | 2978 | |
67bf9823 | 2979 | echo "LIBS+=$LIBS" >> $config_host_mak |
86719845 | 2980 | echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak |
91f94d5b | 2981 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
d2aeedb9 | 2982 | echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak |
67bf9823 | 2983 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 2984 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |
020d54bd | 2985 | echo "INSTALL_PREFIX=$prefix" >> $config_host_mak |
c61a3a44 | 2986 | |
59d8f412 | 2987 | if [ `dirname $0` != "." -a ! -e Makefile ]; then |
c61a3a44 JF |
2988 | cat > Makefile <<EOF |
2989 | SRCDIR:=`dirname $0` | |
2990 | include \$(SRCDIR)/Makefile | |
2991 | EOF | |
2992 | fi |