configure: fix bad indentation
[fio.git] / configure
CommitLineData
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
8if test ! -z "$TMPDIR" ; then
9 TMPDIR1="${TMPDIR}"
10elif test ! -z "$TEMPDIR" ; then
11 TMPDIR1="${TEMPDIR}"
12else
13 TMPDIR1="/tmp"
14fi
15
16TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
9ee669fa 17TMPC2="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c"
67bf9823
JA
18TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
19TMPE="${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 23trap "rm -f $TMPC $TMPC2 $TMPO $TMPE" EXIT INT QUIT TERM
67bf9823
JA
24
25rm -rf config.log
26
27config_host_mak="config-host.mak"
4feafb1e
JA
28config_host_h="config-host.h"
29
30rm -rf $config_host_mak
31rm -rf $config_host_h
67bf9823 32
d7145a78
JA
33fatal() {
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
42print_config() {
43 printf "%-30s%s\n" "$1" "$2"
44}
45
44404c5a 46# Default CFLAGS
4c0b3d98 47CFLAGS="-D_GNU_SOURCE -include config-host.h $CFLAGS"
af4862b3 48BUILD_CFLAGS=""
67bf9823
JA
49
50# Print a helpful header at the top of config.log
51echo "# FIO configure log $(date)" >> config.log
52printf "# Configured with:" >> config.log
53printf " '%s'" "$0" "$@" >> config.log
54echo >> config.log
55echo "#" >> config.log
56
7560fe7c
JA
57# Print configure header at the top of $config_host_h
58echo "/*" > $config_host_h
59echo " * Automatically generated by configure - do not modify" >> $config_host_h
60printf " * Configured with:" >> $config_host_h
61printf " * '%s'" "$0" "$@" >> $config_host_h
62echo "" >> $config_host_h
63echo " */" >> $config_host_h
64
67bf9823
JA
65do_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
90compile_object() {
44f668d7 91 do_cc $CFLAGS -Werror-implicit-function-declaration -c -o $TMPO $TMPC
67bf9823
JA
92}
93
94compile_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
101feature_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
114has() {
115 type "$1" >/dev/null 2>&1
116}
117
118check_define() {
119 cat > $TMPC <<EOF
120#if !defined($1)
121#error $1 not defined
122#endif
123int main(void)
124{
125 return 0;
126}
127EOF
128 compile_object
129}
130
4feafb1e
JA
131output_sym() {
132 echo "$1=y" >> $config_host_mak
133 echo "#define $1" >> $config_host_h
134}
135
67bf9823
JA
136targetos=""
137cpu=""
138
91f94d5b 139# default options
47f44635
JA
140show_help="no"
141exit_val=0
ebec2094 142gfio_check="no"
1b10477b 143libhdfs="no"
43f3cec2 144pmemblk="no"
cbb15e42 145devdax="no"
ae0db592 146pmem="no"
de26b824 147disable_lex=""
3ee2a3c1 148disable_pmem="no"
a817dc3b 149disable_native="no"
9f75af77 150march_set="no"
247ef2aa 151libiscsi="no"
d643a1e2 152libnbd="no"
e2defc22 153libaio_uring="no"
5a8a6a03 154dynamic_engines="no"
020d54bd 155prefix=/usr/local
91f94d5b 156
cb1125b0
JA
157# parse options
158for 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
229done
230
47f44635 231if 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
262fi
263
47986339 264cross_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
270if test -z "${CC}${cross_prefix}"; then
271 if has gcc; then
272 cc=gcc
273 elif has clang; then
274 cc=clang
275 fi
276else
277 cc="${CC-${cross_prefix}gcc}"
278fi
47986339 279
6d0e9f83
AC
280if check_define __ANDROID__ ; then
281 targetos="Android"
282elif check_define __linux__ ; then
67bf9823 283 targetos="Linux"
67bf9823
JA
284elif check_define __OpenBSD__ ; then
285 targetos='OpenBSD'
89556808
BVA
286elif check_define __NetBSD__ ; then
287 targetos='NetBSD'
67bf9823
JA
288elif check_define __sun__ ; then
289 targetos='SunOS'
7cb024f8 290 CFLAGS="$CFLAGS -D_REENTRANT"
b24f59ab
SH
291elif check_define _WIN32 ; then
292 targetos='CYGWIN'
67bf9823
JA
293else
294 targetos=`uname -s`
295fi
296
53cd4eee
AC
297echo "# Automatically generated by configure - do not modify" > $config_host_mak
298printf "# Configured with:" >> $config_host_mak
299printf " '%s'" "$0" "$@" >> $config_host_mak
300echo >> $config_host_mak
301echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
302
61054f0d
JA
303if test "$no_shm" = "yes" ; then
304 output_sym "CONFIG_NO_SHM"
305fi
306
307if test "$disable_opt" = "yes" ; then
308 output_sym "CONFIG_FIO_NO_OPT"
309fi
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.
315case $targetos in
26532556 316AIX|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
325FreeBSD)
326 CFLAGS="$CFLAGS -I/usr/local/include"
327 LDFLAGS="$LDFLAGS -L/usr/local/lib"
328 ;;
67bf9823
JA
329Darwin)
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...
339cat > $TMPC <<EOF
340int main(void)
341{
342 return 0;
343}
344EOF
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 ;;
350SunOS)
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 ;;
357CYGWIN*)
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
394esac
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
398if 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
404fi
405if test -z "$cc"; then
406 echo "configure: failed to find compiler"
407 exit 1
408fi
409
67bf9823
JA
410if test ! -z "$cpu" ; then
411 # command line argument
412 :
413elif check_define __i386__ ; then
414 cpu="i386"
415elif check_define __x86_64__ ; then
416 cpu="x86_64"
417elif check_define __sparc__ ; then
418 if check_define __arch64__ ; then
419 cpu="sparc64"
420 else
421 cpu="sparc"
422 fi
423elif check_define _ARCH_PPC ; then
424 if check_define _ARCH_PPC64 ; then
425 cpu="ppc64"
426 else
427 cpu="ppc"
428 fi
429elif check_define __mips__ ; then
430 cpu="mips"
431elif check_define __ia64__ ; then
432 cpu="ia64"
433elif check_define __s390__ ; then
434 if check_define __s390x__ ; then
435 cpu="s390x"
436 else
437 cpu="s390"
438 fi
439elif check_define __arm__ ; then
440 cpu="arm"
214e2d56 441elif check_define __aarch64__ ; then
442 cpu="aarch64"
67bf9823
JA
443elif check_define __hppa__ ; then
444 cpu="hppa"
445else
446 cpu=`uname -m`
447fi
448
449# Normalise host CPU name and set ARCH.
450case "$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 ;;
478esac
479
1a17cfdb
AC
480##########################################
481# check cross compile
482
ca205a75
TK
483if test "$cross_compile" != "yes" ; then
484 cross_compile="no"
485fi
1a17cfdb
AC
486cat > $TMPC <<EOF
487int main(void)
488{
489 return 0;
490}
491EOF
492if compile_prog "" "" "cross"; then
493 $TMPE 2>/dev/null || cross_compile="yes"
494else
495 fatal "compile test failed"
496fi
497
0dcebdf4
JA
498##########################################
499# check endianness
ca205a75
TK
500if test "$bigendian" != "yes" ; then
501 bigendian="no"
502fi
1a17cfdb
AC
503if test "$cross_compile" = "no" ; then
504 cat > $TMPC <<EOF
0dcebdf4
JA
505#include <inttypes.h>
506int main(void)
507{
508 volatile uint32_t i=0x01234567;
509 return (*((uint8_t*)(&i))) == 0x67;
510}
511EOF
1a17cfdb
AC
512 if compile_prog "" "" "endian"; then
513 $TMPE && bigendian="yes"
514 fi
515else
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>
520int main(void)
521{
522#if __BYTE_ORDER != __BIG_ENDIAN
523# error "Unknown endianness"
524#endif
525}
526EOF
527 compile_prog "" "" "endian" && bigendian="yes"
528 check_define "__ARMEB__" && bigendian="yes"
529 check_define "__MIPSEB__" && bigendian="yes"
0dcebdf4
JA
530fi
531
532
484b0b65
TK
533print_config "Operating system" "$targetos"
534print_config "CPU" "$cpu"
535print_config "Big endian" "$bigendian"
a6ab5391
SW
536if test ! -z "$target_win_ver"; then
537 print_config "Target Windows version" "$target_win_ver"
538fi
484b0b65
TK
539print_config "Compiler" "$cc"
540print_config "Cross compile" "$cross_compile"
67bf9823
JA
541echo
542
d2aeedb9
JA
543##########################################
544# See if we need to build a static build
545if test "$build_static" = "yes" ; then
546 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
547 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
548else
549 build_static="no"
550fi
484b0b65 551print_config "Static build" "$build_static"
d2aeedb9 552
67bf9823
JA
553##########################################
554# check for wordsize
555wordsize="0"
556cat > $TMPC <<EOF
142429e5
AC
557#include <limits.h>
558#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
67bf9823
JA
559int main(void)
560{
142429e5 561 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
67bf9823
JA
562 return 0;
563}
564EOF
142429e5
AC
565if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
566 wordsize="32"
567elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
568 wordsize="64"
569else
570 fatal "Unknown wordsize"
67bf9823 571fi
484b0b65 572print_config "Wordsize" "$wordsize"
67bf9823 573
a9bca4aa
JA
574##########################################
575# zlib probe
ca205a75
TK
576if test "$zlib" != "yes" ; then
577 zlib="no"
578fi
a9bca4aa 579cat > $TMPC <<EOF
804a1e05 580#include <zlib.h>
a9bca4aa
JA
581int main(void)
582{
583 z_stream stream;
584 if (inflateInit(&stream) != Z_OK)
585 return 1;
586 return 0;
587}
588EOF
589if compile_prog "" "-lz" "zlib" ; then
590 zlib=yes
591 LIBS="-lz $LIBS"
a9bca4aa 592fi
484b0b65 593print_config "zlib" "$zlib"
a9bca4aa 594
67bf9823
JA
595##########################################
596# linux-aio probe
ca205a75
TK
597if test "$libaio" != "yes" ; then
598 libaio="no"
599fi
7c77ebef 600if test "$esx" != "yes" ; then
601 cat > $TMPC <<EOF
67bf9823
JA
602#include <libaio.h>
603#include <stddef.h>
604int main(void)
605{
606 io_setup(0, NULL);
607 return 0;
608}
609EOF
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>
626int 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}
632EOF
633 if compile_prog "" "" "libaio rw flags" ; then
634 libaio_rw_flags=yes
635 else
636 libaio_rw_flags=no
637 fi
67bf9823 638fi
484b0b65 639print_config "Linux AIO support" "$libaio"
7d42e66e 640print_config "Linux AIO support rw flags" "$libaio_rw_flags"
e2defc22 641print_config "Linux AIO over io_uring" "$libaio_uring"
67bf9823
JA
642
643##########################################
644# posix aio probe
ca205a75
TK
645if test "$posix_aio" != "yes" ; then
646 posix_aio="no"
647fi
648if test "$posix_aio_lrt" != "yes" ; then
649 posix_aio_lrt="no"
650fi
67bf9823
JA
651cat > $TMPC <<EOF
652#include <aio.h>
653int main(void)
654{
655 struct aiocb cb;
656 aio_read(&cb);
657 return 0;
658}
659EOF
660if compile_prog "" "" "posixaio" ; then
661 posix_aio="yes"
09c81e13 662elif compile_prog "" "-lrt" "posixaio -lrt"; then
67bf9823
JA
663 posix_aio="yes"
664 posix_aio_lrt="yes"
665 LIBS="-lrt $LIBS"
666fi
484b0b65
TK
667print_config "POSIX AIO support" "$posix_aio"
668print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
67bf9823
JA
669
670##########################################
671# posix aio fsync probe
ca205a75
TK
672if test "$posix_aio_fsync" != "yes" ; then
673 posix_aio_fsync="no"
674fi
67bf9823
JA
675if test "$posix_aio" = "yes" ; then
676 cat > $TMPC <<EOF
677#include <fcntl.h>
678#include <aio.h>
679int main(void)
680{
681 struct aiocb cb;
682 return aio_fsync(O_SYNC, &cb);
683 return 0;
684}
685EOF
686 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
687 posix_aio_fsync=yes
688 fi
689fi
484b0b65 690print_config "POSIX AIO fsync" "$posix_aio_fsync"
67bf9823 691
06eac6b2
SW
692##########################################
693# POSIX pshared attribute probe
d418fa90
TK
694if test "$posix_pshared" != "yes" ; then
695 posix_pshared="no"
696fi
06eac6b2
SW
697cat > $TMPC <<EOF
698#include <unistd.h>
699int 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}
716EOF
717if compile_prog "" "$LIBS" "posix_pshared" ; then
718 posix_pshared=yes
719fi
484b0b65 720print_config "POSIX pshared support" "$posix_pshared"
06eac6b2 721
78b66d32
BVA
722##########################################
723# POSIX pthread_condattr_setclock() probe
724if test "$pthread_condattr_setclock" != "yes" ; then
725 pthread_condattr_setclock="no"
726fi
727cat > $TMPC <<EOF
728#include <pthread.h>
729int main(void)
730{
731 pthread_condattr_t condattr;
732 pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
733 return 0;
734}
735EOF
736if compile_prog "" "$LIBS" "pthread_condattr_setclock" ; then
737 pthread_condattr_setclock=yes
a9bf436e
BVA
738elif compile_prog "" "$LIBS -lpthread" "pthread_condattr_setclock" ; then
739 pthread_condattr_setclock=yes
740 LIBS="$LIBS -lpthread"
78b66d32 741fi
a9bf436e 742print_config "pthread_condattr_setclock()" "$pthread_condattr_setclock"
78b66d32 743
c31092b8
BVA
744##########################################
745# pthread_sigmask() probe
746if test "$pthread_sigmask" != "yes" ; then
747 pthread_sigmask="no"
748fi
749cat > $TMPC <<EOF
750#include <stddef.h> /* NULL */
751#include <signal.h> /* pthread_sigmask() */
752int main(void)
753{
754 return pthread_sigmask(0, NULL, NULL);
755}
756EOF
757if compile_prog "" "$LIBS" "pthread_sigmask" ; then
758 pthread_sigmask=yes
759elif compile_prog "" "$LIBS -lpthread" "pthread_sigmask" ; then
760 pthread_sigmask=yes
761 LIBS="$LIBS -lpthread"
762fi
763print_config "pthread_sigmask()" "$pthread_sigmask"
764
67bf9823
JA
765##########################################
766# solaris aio probe
ca205a75
TK
767if test "$solaris_aio" != "yes" ; then
768 solaris_aio="no"
769fi
67bf9823
JA
770cat > $TMPC <<EOF
771#include <sys/types.h>
772#include <sys/asynch.h>
773#include <unistd.h>
774int main(void)
775{
776 aio_result_t res;
777 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
778 return 0;
779}
780EOF
781if compile_prog "" "-laio" "solarisaio" ; then
782 solaris_aio=yes
783 LIBS="-laio $LIBS"
784fi
484b0b65 785print_config "Solaris AIO support" "$solaris_aio"
67bf9823
JA
786
787##########################################
f5cd2907 788# __sync_fetch_and_add test
ca205a75
TK
789if test "$sfaa" != "yes" ; then
790 sfaa="no"
791fi
67bf9823 792cat > $TMPC << EOF
958886d8
JA
793#include <inttypes.h>
794static int sfaa(uint64_t *ptr)
67bf9823 795{
9c639a76 796 return __sync_fetch_and_add(ptr, 0);
67bf9823
JA
797}
798
799int main(int argc, char **argv)
800{
958886d8 801 uint64_t val = 42;
67bf9823
JA
802 sfaa(&val);
803 return val;
804}
805EOF
806if compile_prog "" "" "__sync_fetch_and_add()" ; then
807 sfaa="yes"
808fi
484b0b65 809print_config "__sync_fetch_and_add" "$sfaa"
67bf9823 810
a250edd0
JA
811##########################################
812# __sync_synchronize() test
813if test "$sync_sync" != "yes" ; then
814 sync_sync="no"
815fi
816cat > $TMPC << EOF
817#include <inttypes.h>
818
819int main(int argc, char **argv)
820{
821 __sync_synchronize();
822 return 0;
823}
824EOF
825if compile_prog "" "" "__sync_synchronize()" ; then
826 sync_sync="yes"
827fi
828print_config "__sync_synchronize" "$sync_sync"
829
830##########################################
831# __sync_val_compare_and_swap() test
832if test "$cmp_swap" != "yes" ; then
833 cmp_swap="no"
834fi
835cat > $TMPC << EOF
836#include <inttypes.h>
837
838int main(int argc, char **argv)
839{
840 int x = 0;
841 return __sync_val_compare_and_swap(&x, 1, 2);
842}
843EOF
844if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
845 cmp_swap="yes"
846fi
847print_config "__sync_val_compare_and_swap" "$cmp_swap"
848
67bf9823
JA
849##########################################
850# libverbs probe
ca205a75
TK
851if test "$libverbs" != "yes" ; then
852 libverbs="no"
853fi
67bf9823 854cat > $TMPC << EOF
eb3bfdd8 855#include <infiniband/verbs.h>
67bf9823
JA
856int main(int argc, char **argv)
857{
858 struct ibv_pd *pd = ibv_alloc_pd(NULL);
40dae137 859 return pd != NULL;
67bf9823
JA
860}
861EOF
f678f8d2 862if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
67bf9823 863 libverbs="yes"
67bf9823 864fi
484b0b65 865print_config "libverbs" "$libverbs"
67bf9823
JA
866
867##########################################
868# rdmacm probe
ca205a75
TK
869if test "$rdmacm" != "yes" ; then
870 rdmacm="no"
871fi
67bf9823
JA
872cat > $TMPC << EOF
873#include <stdio.h>
874#include <rdma/rdma_cma.h>
875int main(int argc, char **argv)
876{
877 rdma_destroy_qp(NULL);
878 return 0;
879}
880EOF
f678f8d2 881if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
67bf9823 882 rdmacm="yes"
67bf9823 883fi
484b0b65 884print_config "rdmacm" "$rdmacm"
67bf9823 885
44e8e956
BVA
886##########################################
887# asprintf() and vasprintf() probes
888if test "$have_asprintf" != "yes" ; then
889 have_asprintf="no"
890fi
891cat > $TMPC << EOF
892#include <stdio.h>
893
894int main(int argc, char **argv)
895{
896 return asprintf(NULL, "%s", "str") == 0;
897}
898EOF
899if compile_prog "" "" "have_asprintf"; then
900 have_asprintf="yes"
901fi
902print_config "asprintf()" "$have_asprintf"
903
904if test "$have_vasprintf" != "yes" ; then
905 have_vasprintf="no"
906fi
907cat > $TMPC << EOF
908#include <stdio.h>
909
910int main(int argc, char **argv)
911{
849ac4b2
RP
912 va_list ap;
913 return vasprintf(NULL, "%s", ap) == 0;
44e8e956
BVA
914}
915EOF
916if compile_prog "" "" "have_vasprintf"; then
917 have_vasprintf="yes"
918fi
919print_config "vasprintf()" "$have_vasprintf"
920
67bf9823
JA
921##########################################
922# Linux fallocate probe
ca205a75
TK
923if test "$linux_fallocate" != "yes" ; then
924 linux_fallocate="no"
925fi
67bf9823
JA
926cat > $TMPC << EOF
927#include <stdio.h>
aa6738a5 928#include <fcntl.h>
67bf9823
JA
929#include <linux/falloc.h>
930int main(int argc, char **argv)
931{
932 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
933 return r;
934}
935EOF
936if compile_prog "" "" "linux_fallocate"; then
937 linux_fallocate="yes"
938fi
484b0b65 939print_config "Linux fallocate" "$linux_fallocate"
67bf9823
JA
940
941##########################################
942# POSIX fadvise probe
ca205a75
TK
943if test "$posix_fadvise" != "yes" ; then
944 posix_fadvise="no"
945fi
67bf9823
JA
946cat > $TMPC << EOF
947#include <stdio.h>
948#include <fcntl.h>
949int main(int argc, char **argv)
950{
951 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
952 return r;
953}
954EOF
955if compile_prog "" "" "posix_fadvise"; then
956 posix_fadvise="yes"
957fi
484b0b65 958print_config "POSIX fadvise" "$posix_fadvise"
67bf9823
JA
959
960##########################################
961# POSIX fallocate probe
ca205a75
TK
962if test "$posix_fallocate" != "yes" ; then
963 posix_fallocate="no"
964fi
67bf9823
JA
965cat > $TMPC << EOF
966#include <stdio.h>
967#include <fcntl.h>
968int main(int argc, char **argv)
969{
970 int r = posix_fallocate(0, 0, 1024);
971 return r;
972}
973EOF
974if compile_prog "" "" "posix_fallocate"; then
975 posix_fallocate="yes"
976fi
484b0b65 977print_config "POSIX fallocate" "$posix_fallocate"
67bf9823
JA
978
979##########################################
980# sched_set/getaffinity 2 or 3 argument test
ca205a75
TK
981if test "$linux_2arg_affinity" != "yes" ; then
982 linux_2arg_affinity="no"
983fi
984if test "$linux_3arg_affinity" != "yes" ; then
985 linux_3arg_affinity="no"
986fi
67bf9823 987cat > $TMPC << EOF
67bf9823
JA
988#include <sched.h>
989int main(int argc, char **argv)
990{
991 cpu_set_t mask;
992 return sched_setaffinity(0, sizeof(mask), &mask);
993}
994EOF
995if compile_prog "" "" "sched_setaffinity(,,)"; then
996 linux_3arg_affinity="yes"
997else
998 cat > $TMPC << EOF
67bf9823
JA
999#include <sched.h>
1000int main(int argc, char **argv)
1001{
1002 cpu_set_t mask;
1003 return sched_setaffinity(0, &mask);
1004}
1005EOF
1006 if compile_prog "" "" "sched_setaffinity(,)"; then
1007 linux_2arg_affinity="yes"
1008 fi
1009fi
484b0b65
TK
1010print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
1011print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
67bf9823
JA
1012
1013##########################################
1014# clock_gettime probe
ca205a75
TK
1015if test "$clock_gettime" != "yes" ; then
1016 clock_gettime="no"
1017fi
67bf9823
JA
1018cat > $TMPC << EOF
1019#include <stdio.h>
1020#include <time.h>
1021int main(int argc, char **argv)
1022{
1023 return clock_gettime(0, NULL);
1024}
1025EOF
1026if compile_prog "" "" "clock_gettime"; then
1027 clock_gettime="yes"
1028elif compile_prog "" "-lrt" "clock_gettime"; then
1029 clock_gettime="yes"
1030 LIBS="-lrt $LIBS"
1031fi
484b0b65 1032print_config "clock_gettime" "$clock_gettime"
67bf9823
JA
1033
1034##########################################
1035# CLOCK_MONOTONIC probe
ca205a75
TK
1036if test "$clock_monotonic" != "yes" ; then
1037 clock_monotonic="no"
1038fi
67bf9823
JA
1039if test "$clock_gettime" = "yes" ; then
1040 cat > $TMPC << EOF
1041#include <stdio.h>
1042#include <time.h>
1043int main(int argc, char **argv)
1044{
1045 return clock_gettime(CLOCK_MONOTONIC, NULL);
1046}
1047EOF
1048 if compile_prog "" "$LIBS" "clock monotonic"; then
1049 clock_monotonic="yes"
1050 fi
1051fi
484b0b65 1052print_config "CLOCK_MONOTONIC" "$clock_monotonic"
67bf9823 1053
c544f604
SN
1054##########################################
1055# CLOCK_MONOTONIC_RAW probe
ca205a75
TK
1056if test "$clock_monotonic_raw" != "yes" ; then
1057 clock_monotonic_raw="no"
1058fi
c544f604
SN
1059if test "$clock_gettime" = "yes" ; then
1060 cat > $TMPC << EOF
1061#include <stdio.h>
1062#include <time.h>
1063int main(int argc, char **argv)
1064{
1065 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
1066}
1067EOF
1068 if compile_prog "" "$LIBS" "clock monotonic"; then
1069 clock_monotonic_raw="yes"
1070 fi
1071fi
484b0b65 1072print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw"
c544f604 1073
67bf9823
JA
1074##########################################
1075# CLOCK_MONOTONIC_PRECISE probe
ca205a75
TK
1076if test "$clock_monotonic_precise" != "yes" ; then
1077 clock_monotonic_precise="no"
1078fi
67bf9823
JA
1079if test "$clock_gettime" = "yes" ; then
1080 cat > $TMPC << EOF
1081#include <stdio.h>
1082#include <time.h>
1083int main(int argc, char **argv)
1084{
1085 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
1086}
1087EOF
1088 if compile_prog "" "$LIBS" "clock monotonic precise"; then
1089 clock_monotonic_precise="yes"
1090 fi
1091fi
484b0b65 1092print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise"
67bf9823 1093
25f8227d
JA
1094##########################################
1095# clockid_t probe
ca205a75
TK
1096if test "$clockid_t" != "yes" ; then
1097 clockid_t="no"
1098fi
25f8227d 1099cat > $TMPC << EOF
25f8227d 1100#include <time.h>
209c37b4 1101#include <string.h>
25f8227d
JA
1102int 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}
1108EOF
1109if compile_prog "" "$LIBS" "clockid_t"; then
1110 clockid_t="yes"
1111fi
484b0b65 1112print_config "clockid_t" "$clockid_t"
25f8227d 1113
67bf9823
JA
1114##########################################
1115# gettimeofday() probe
ca205a75
TK
1116if test "$gettimeofday" != "yes" ; then
1117 gettimeofday="no"
1118fi
67bf9823
JA
1119cat > $TMPC << EOF
1120#include <sys/time.h>
1121#include <stdio.h>
1122int main(int argc, char **argv)
1123{
1124 struct timeval tv;
1125 return gettimeofday(&tv, NULL);
1126}
1127EOF
1128if compile_prog "" "" "gettimeofday"; then
1129 gettimeofday="yes"
1130fi
484b0b65 1131print_config "gettimeofday" "$gettimeofday"
67bf9823
JA
1132
1133##########################################
1134# fdatasync() probe
ca205a75
TK
1135if test "$fdatasync" != "yes" ; then
1136 fdatasync="no"
1137fi
67bf9823
JA
1138cat > $TMPC << EOF
1139#include <stdio.h>
1140#include <unistd.h>
1141int main(int argc, char **argv)
1142{
1143 return fdatasync(0);
1144}
1145EOF
1146if compile_prog "" "" "fdatasync"; then
1147 fdatasync="yes"
1148fi
484b0b65 1149print_config "fdatasync" "$fdatasync"
67bf9823 1150
52a552e2
BVA
1151##########################################
1152# pipe() probe
1153if test "$pipe" != "yes" ; then
1154 pipe="no"
1155fi
1156cat > $TMPC << EOF
1157#include <unistd.h>
1158int main(int argc, char **argv)
1159{
1160 int fd[2];
1161 return pipe(fd);
1162}
1163EOF
1164if compile_prog "" "" "pipe"; then
1165 pipe="yes"
1166fi
1167print_config "pipe()" "$pipe"
1168
1169##########################################
1170# pipe2() probe
1171if test "$pipe2" != "yes" ; then
1172 pipe2="no"
1173fi
1174cat > $TMPC << EOF
1175#include <unistd.h>
1176int main(int argc, char **argv)
1177{
1178 int fd[2];
1179 return pipe2(fd, 0);
1180}
1181EOF
1182if compile_prog "" "" "pipe2"; then
1183 pipe2="yes"
1184fi
1185print_config "pipe2()" "$pipe2"
1186
15eca9aa
BVA
1187##########################################
1188# pread() probe
1189if test "$pread" != "yes" ; then
1190 pread="no"
1191fi
1192cat > $TMPC << EOF
1193#include <unistd.h>
1194int main(int argc, char **argv)
1195{
1196 return pread(0, NULL, 0, 0);
1197}
1198EOF
1199if compile_prog "" "" "pread"; then
1200 pread="yes"
1201fi
1202print_config "pread()" "$pread"
1203
67bf9823
JA
1204##########################################
1205# sync_file_range() probe
ca205a75
TK
1206if test "$sync_file_range" != "yes" ; then
1207 sync_file_range="no"
1208fi
67bf9823
JA
1209cat > $TMPC << EOF
1210#include <stdio.h>
1211#include <unistd.h>
67bf9823
JA
1212#include <fcntl.h>
1213#include <linux/fs.h>
1214int 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}
1220EOF
1221if compile_prog "" "" "sync_file_range"; then
1222 sync_file_range="yes"
1223fi
484b0b65 1224print_config "sync_file_range" "$sync_file_range"
67bf9823
JA
1225
1226##########################################
1227# ext4 move extent probe
ca205a75
TK
1228if test "$ext4_me" != "yes" ; then
1229 ext4_me="no"
1230fi
67bf9823
JA
1231cat > $TMPC << EOF
1232#include <fcntl.h>
1233#include <sys/ioctl.h>
1234int main(int argc, char **argv)
1235{
1236 struct move_extent me;
1237 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1238}
1239EOF
c7165b8d
JA
1240if compile_prog "" "" "ext4 move extent" ; then
1241 ext4_me="yes"
1242elif 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"
1247fi
484b0b65 1248print_config "EXT4 move extent" "$ext4_me"
67bf9823
JA
1249
1250##########################################
1251# splice probe
ca205a75
TK
1252if test "$linux_splice" != "yes" ; then
1253 linux_splice="no"
1254fi
67bf9823 1255cat > $TMPC << EOF
67bf9823
JA
1256#include <stdio.h>
1257#include <fcntl.h>
1258int main(int argc, char **argv)
1259{
1260 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1261}
1262EOF
1263if compile_prog "" "" "linux splice"; then
1264 linux_splice="yes"
1265fi
484b0b65 1266print_config "Linux splice(2)" "$linux_splice"
67bf9823
JA
1267
1268##########################################
1269# GUASI probe
ca205a75
TK
1270if test "$guasi" != "yes" ; then
1271 guasi="no"
1272fi
67bf9823
JA
1273cat > $TMPC << EOF
1274#include <guasi.h>
1275#include <guasi_syscalls.h>
1276int main(int argc, char **argv)
1277{
1278 guasi_t ctx = guasi_create(0, 0, 0);
1279 return 0;
1280}
1281EOF
1282if compile_prog "" "" "guasi"; then
1283 guasi="yes"
1284fi
484b0b65 1285print_config "GUASI" "$guasi"
67bf9823 1286
67bf9823
JA
1287##########################################
1288# libnuma probe
ca205a75
TK
1289if test "$libnuma" != "yes" ; then
1290 libnuma="no"
1291fi
67bf9823
JA
1292cat > $TMPC << EOF
1293#include <numa.h>
1294int main(int argc, char **argv)
1295{
1296 return numa_available();
1297}
1298EOF
44462517 1299if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
67bf9823
JA
1300 libnuma="yes"
1301 LIBS="-lnuma $LIBS"
1302fi
484b0b65 1303print_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
1307if test "$libnuma" = "yes" ; then
1308libnuma_v2="no"
1309cat > $TMPC << EOF
1310#include <numa.h>
1311int main(int argc, char **argv)
1312{
1313 struct bitmask *mask = numa_parse_nodestring(NULL);
61bde962 1314 return mask->size == 0;
50206d9b
JA
1315}
1316EOF
1317if compile_prog "" "" "libnuma api"; then
1318 libnuma_v2="yes"
1319fi
484b0b65 1320print_config "libnuma v2" "$libnuma_v2"
50206d9b
JA
1321fi
1322
67bf9823
JA
1323##########################################
1324# strsep() probe
ca205a75
TK
1325if test "$strsep" != "yes" ; then
1326 strsep="no"
1327fi
67bf9823
JA
1328cat > $TMPC << EOF
1329#include <string.h>
1330int 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}
1336EOF
1337if compile_prog "" "" "strsep"; then
1338 strsep="yes"
1339fi
484b0b65 1340print_config "strsep" "$strsep"
67bf9823 1341
9ad8da82
JA
1342##########################################
1343# strcasestr() probe
ca205a75
TK
1344if test "$strcasestr" != "yes" ; then
1345 strcasestr="no"
1346fi
9ad8da82
JA
1347cat > $TMPC << EOF
1348#include <string.h>
1349int main(int argc, char **argv)
1350{
aa6738a5 1351 return strcasestr(argv[0], argv[1]) != NULL;
9ad8da82
JA
1352}
1353EOF
1354if compile_prog "" "" "strcasestr"; then
1355 strcasestr="yes"
1356fi
484b0b65 1357print_config "strcasestr" "$strcasestr"
9ad8da82 1358
5ad7be56
KD
1359##########################################
1360# strlcat() probe
ca205a75
TK
1361if test "$strlcat" != "yes" ; then
1362 strlcat="no"
1363fi
5ad7be56
KD
1364cat > $TMPC << EOF
1365#include <string.h>
1366int 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}
1374EOF
1375if compile_prog "" "" "strlcat"; then
1376 strlcat="yes"
1377fi
484b0b65 1378print_config "strlcat" "$strlcat"
5ad7be56 1379
67bf9823
JA
1380##########################################
1381# getopt_long_only() probe
ca205a75
TK
1382if test "$getopt_long_only" != "yes" ; then
1383 getopt_long_only="no"
1384fi
67bf9823
JA
1385cat > $TMPC << EOF
1386#include <unistd.h>
1387#include <stdio.h>
aa6738a5 1388#include <getopt.h>
67bf9823
JA
1389int main(int argc, char **argv)
1390{
d24ff97d 1391 int c = getopt_long_only(argc, argv, "", NULL, NULL);
67bf9823
JA
1392 return c;
1393}
1394EOF
1395if compile_prog "" "" "getopt_long_only"; then
1396 getopt_long_only="yes"
1397fi
484b0b65 1398print_config "getopt_long_only()" "$getopt_long_only"
67bf9823
JA
1399
1400##########################################
1401# inet_aton() probe
ca205a75
TK
1402if test "$inet_aton" != "yes" ; then
1403 inet_aton="no"
1404fi
67bf9823 1405cat > $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>
1413int main(int argc, char **argv)
1414{
1415 struct in_addr in;
1416 return inet_aton(NULL, &in);
1417}
1418EOF
1419if compile_prog "" "" "inet_aton"; then
1420 inet_aton="yes"
1421fi
484b0b65 1422print_config "inet_aton" "$inet_aton"
67bf9823
JA
1423
1424##########################################
1425# socklen_t probe
ca205a75
TK
1426if test "$socklen_t" != "yes" ; then
1427 socklen_t="no"
1428fi
67bf9823 1429cat > $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
1436int main(int argc, char **argv)
1437{
1438 socklen_t len = 0;
1439 return len;
1440}
1441EOF
1442if compile_prog "" "" "socklen_t"; then
1443 socklen_t="yes"
1444fi
484b0b65 1445print_config "socklen_t" "$socklen_t"
67bf9823
JA
1446
1447##########################################
1448# Whether or not __thread is supported for TLS
ca205a75
TK
1449if test "$tls_thread" != "yes" ; then
1450 tls_thread="no"
1451fi
67bf9823
JA
1452cat > $TMPC << EOF
1453#include <stdio.h>
aa6738a5 1454static __thread int ret;
67bf9823
JA
1455int main(int argc, char **argv)
1456{
1457 return ret;
1458}
1459EOF
1460if compile_prog "" "" "__thread"; then
1461 tls_thread="yes"
1462fi
484b0b65 1463print_config "__thread" "$tls_thread"
67bf9823 1464
91f94d5b 1465##########################################
2639f056 1466# Check if we have required gtk/glib support for gfio
ca205a75
TK
1467if test "$gfio" != "yes" ; then
1468 gfio="no"
1469fi
ebec2094 1470if test "$gfio_check" = "yes" ; then
91f94d5b
JA
1471 cat > $TMPC << EOF
1472#include <glib.h>
1473#include <cairo.h>
1474#include <gtk/gtk.h>
1475int 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}
1482EOF
4d1bc43e 1483GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0)
86719845
JA
1484ORG_LDFLAGS=$LDFLAGS
1485LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
91f94d5b
JA
1486if test "$?" != "0" ; then
1487 echo "configure: gtk and gthread not found"
1488 exit 1
1489fi
4d1bc43e 1490GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
91f94d5b
JA
1491if test "$?" != "0" ; then
1492 echo "configure: gtk and gthread not found"
1493 exit 1
1494fi
31ce8438
HG
1495if ! ${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"
1498else
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 1507fi
86719845 1508LDFLAGS=$ORG_LDFLAGS
91f94d5b
JA
1509fi
1510
ebec2094 1511if test "$gfio_check" = "yes" ; then
484b0b65 1512 print_config "gtk 2.18 or higher" "$gfio"
ebec2094 1513fi
91f94d5b 1514
bda92394 1515##########################################
44404c5a 1516# Check whether we have getrusage(RUSAGE_THREAD)
ca205a75
TK
1517if test "$rusage_thread" != "yes" ; then
1518 rusage_thread="no"
1519fi
44404c5a
JA
1520cat > $TMPC << EOF
1521#include <sys/time.h>
1522#include <sys/resource.h>
1523int main(int argc, char **argv)
1524{
1525 struct rusage ru;
1526 getrusage(RUSAGE_THREAD, &ru);
1527 return 0;
1528}
1529EOF
1530if compile_prog "" "" "RUSAGE_THREAD"; then
1531 rusage_thread="yes"
1532fi
484b0b65 1533print_config "RUSAGE_THREAD" "$rusage_thread"
44404c5a 1534
7e09a9f1
JA
1535##########################################
1536# Check whether we have SCHED_IDLE
ca205a75
TK
1537if test "$sched_idle" != "yes" ; then
1538 sched_idle="no"
1539fi
7e09a9f1
JA
1540cat > $TMPC << EOF
1541#include <sched.h>
1542int main(int argc, char **argv)
1543{
1544 struct sched_param p;
1545 return sched_setscheduler(0, SCHED_IDLE, &p);
1546}
1547EOF
1548if compile_prog "" "" "SCHED_IDLE"; then
1549 sched_idle="yes"
1550fi
484b0b65 1551print_config "SCHED_IDLE" "$sched_idle"
7e09a9f1 1552
1eafa37a
JA
1553##########################################
1554# Check whether we have TCP_NODELAY
ca205a75
TK
1555if test "$tcp_nodelay" != "yes" ; then
1556 tcp_nodelay="no"
1557fi
1eafa37a 1558cat > $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
1567int main(int argc, char **argv)
1568{
1569 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1570}
1571EOF
1572if compile_prog "" "" "TCP_NODELAY"; then
1573 tcp_nodelay="yes"
a932a2cf
BVA
1574elif compile_prog "" "-lws2_32" "TCP_NODELAY"; then
1575 tcp_nodelay="yes"
1576 LIBS="$LIBS -lws2_32"
1eafa37a 1577fi
484b0b65 1578print_config "TCP_NODELAY" "$tcp_nodelay"
1eafa37a 1579
1008602c
JA
1580##########################################
1581# Check whether we have SO_SNDBUF
ca205a75
TK
1582if test "$window_size" != "yes" ; then
1583 window_size="no"
1584fi
1008602c 1585cat > $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
1594int 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}
1599EOF
1600if compile_prog "" "" "SO_SNDBUF"; then
1601 window_size="yes"
a932a2cf
BVA
1602elif compile_prog "" "-lws2_32" "SO_SNDBUF"; then
1603 window_size="yes"
1604 LIBS="$LIBS -lws2_32"
1008602c 1605fi
484b0b65 1606print_config "Net engine window_size" "$window_size"
1008602c 1607
e5f34d95
JA
1608##########################################
1609# Check whether we have TCP_MAXSEG
ca205a75
TK
1610if test "$mss" != "yes" ; then
1611 mss="no"
1612fi
e5f34d95 1613cat > $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
1624int main(int argc, char **argv)
1625{
1626 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1627}
1628EOF
1629if compile_prog "" "" "TCP_MAXSEG"; then
1630 mss="yes"
a932a2cf
BVA
1631elif compile_prog "" "-lws2_32" "TCP_MAXSEG"; then
1632 mss="yes"
1633 LIBS="$LIBS -lws2_32"
e5f34d95 1634fi
484b0b65 1635print_config "TCP_MAXSEG" "$mss"
e5f34d95 1636
38b9354a
JA
1637##########################################
1638# Check whether we have RLIMIT_MEMLOCK
ca205a75
TK
1639if test "$rlimit_memlock" != "yes" ; then
1640 rlimit_memlock="no"
1641fi
38b9354a
JA
1642cat > $TMPC << EOF
1643#include <sys/time.h>
1644#include <sys/resource.h>
1645int main(int argc, char **argv)
1646{
1647 struct rlimit rl;
1648 return getrlimit(RLIMIT_MEMLOCK, &rl);
1649}
1650EOF
1651if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1652 rlimit_memlock="yes"
1653fi
484b0b65 1654print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
38b9354a 1655
07fc0acd
JA
1656##########################################
1657# Check whether we have pwritev/preadv
ca205a75
TK
1658if test "$pwritev" != "yes" ; then
1659 pwritev="no"
1660fi
07fc0acd
JA
1661cat > $TMPC << EOF
1662#include <stdio.h>
1663#include <sys/uio.h>
1664int main(int argc, char **argv)
1665{
1666 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1667}
1668EOF
1669if compile_prog "" "" "pwritev"; then
1670 pwritev="yes"
1671fi
484b0b65 1672print_config "pwritev/preadv" "$pwritev"
07fc0acd 1673
2cafffbe
JA
1674##########################################
1675# Check whether we have pwritev2/preadv2
ca205a75
TK
1676if test "$pwritev2" != "yes" ; then
1677 pwritev2="no"
1678fi
2cafffbe
JA
1679cat > $TMPC << EOF
1680#include <stdio.h>
1681#include <sys/uio.h>
1682int main(int argc, char **argv)
1683{
1684 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1685}
1686EOF
1687if compile_prog "" "" "pwritev2"; then
1688 pwritev2="yes"
1689fi
484b0b65 1690print_config "pwritev2/preadv2" "$pwritev2"
2cafffbe 1691
ecad55e9
JA
1692##########################################
1693# Check whether we have the required functions for ipv6
ca205a75
TK
1694if test "$ipv6" != "yes" ; then
1695 ipv6="no"
1696fi
ecad55e9 1697cat > $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>
1708int 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}
1720EOF
1721if compile_prog "" "" "ipv6"; then
1722 ipv6="yes"
1723fi
484b0b65 1724print_config "IPv6 helpers" "$ipv6"
07fc0acd 1725
c2f6a13d
LMB
1726##########################################
1727# check for http
1728if test "$http" != "yes" ; then
1729 http="no"
1730fi
9ee669fa
DD
1731# check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
1732cat > $TMPC << EOF
1733#include <curl/curl.h>
1734#include <openssl/hmac.h>
1735
1736int 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}
1749EOF
1750# openssl < 1.1.0 uses the HMAC_CTX type directly
1751cat > $TMPC2 << EOF
1752#include <curl/curl.h>
1753#include <openssl/hmac.h>
1754
1755int 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}
1767EOF
1768if 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
1776fi
1777print_config "http engine" "$http"
1778
d5f9b0ea
IF
1779##########################################
1780# check for rados
1781if test "$rados" != "yes" ; then
1782 rados="no"
1783fi
1784cat > $TMPC << EOF
1785#include <rados/librados.h>
1786
1787int 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}
1801EOF
1802if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
d5f9b0ea
IF
1803 rados="yes"
1804fi
1805print_config "Rados engine" "$rados"
1806
fc5c0345
DG
1807##########################################
1808# check for rbd
ca205a75
TK
1809if test "$rbd" != "yes" ; then
1810 rbd="no"
1811fi
fc5c0345
DG
1812cat > $TMPC << EOF
1813#include <rbd/librbd.h>
1814
1815int 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}
1831EOF
ce18290e 1832if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
fc5c0345
DG
1833 rbd="yes"
1834fi
484b0b65 1835print_config "Rados Block Device engine" "$rbd"
fc5c0345 1836
53b6c979
PL
1837##########################################
1838# check for rbd_poll
ca205a75
TK
1839if test "$rbd_poll" != "yes" ; then
1840 rbd_poll="no"
1841fi
53b6c979
PL
1842if test "$rbd" = "yes"; then
1843cat > $TMPC << EOF
1844#include <rbd/librbd.h>
1845#include <sys/eventfd.h>
1846
1847int 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}
1858EOF
1859if compile_prog "" "-lrbd -lrados" "rbd"; then
1860 rbd_poll="yes"
1861fi
484b0b65 1862print_config "rbd_poll" "$rbd_poll"
53b6c979
PL
1863fi
1864
903b2812 1865##########################################
6266dd72 1866# check for rbd_invalidate_cache()
ca205a75
TK
1867if test "$rbd_inval" != "yes" ; then
1868 rbd_inval="no"
1869fi
903b2812
JA
1870if test "$rbd" = "yes"; then
1871cat > $TMPC << EOF
1872#include <rbd/librbd.h>
1873
1874int main(int argc, char **argv)
1875{
1876 rbd_image_t image;
1877
1878 return rbd_invalidate_cache(image);
1879}
1880EOF
1881if compile_prog "" "-lrbd -lrados" "rbd"; then
1882 rbd_inval="yes"
1883fi
484b0b65 1884print_config "rbd_invalidate_cache" "$rbd_inval"
903b2812
JA
1885fi
1886
2e802282
JA
1887##########################################
1888# Check whether we have setvbuf
ca205a75
TK
1889if test "$setvbuf" != "yes" ; then
1890 setvbuf="no"
1891fi
2e802282
JA
1892cat > $TMPC << EOF
1893#include <stdio.h>
1894int 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}
1901EOF
1902if compile_prog "" "" "setvbuf"; then
1903 setvbuf="yes"
1904fi
484b0b65 1905print_config "setvbuf" "$setvbuf"
fc5c0345 1906
bda92394 1907##########################################
6e7d7dfb 1908# check for gfapi
ca205a75
TK
1909if test "$gfapi" != "yes" ; then
1910 gfapi="no"
1911fi
6e7d7dfb 1912cat > $TMPC << EOF
1913#include <glusterfs/api/glfs.h>
1914
1915int main(int argc, char **argv)
1916{
6e7d7dfb 1917 glfs_t *g = glfs_new("foo");
1918
1919 return 0;
1920}
1921EOF
ce18290e 1922if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
6e7d7dfb 1923 gfapi="yes"
1924fi
484b0b65 1925print_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 1929if test "$gfapi" = "yes" ; then
6fa14b99 1930gf_fadvise="no"
1931cat > $TMPC << EOF
1932#include <glusterfs/api/glfs.h>
1933
1934int 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}
1941EOF
6fa14b99 1942if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1943 gf_fadvise="yes"
1944fi
484b0b65 1945print_config "Gluster API use fadvise" "$gf_fadvise"
6876c98c
JA
1946fi
1947
ce4d13ca
JA
1948##########################################
1949# check for newer gfapi
1950if test "$gfapi" = "yes" ; then
1951gf_new="no"
1952cat > $TMPC << EOF
1953#include <glusterfs/api/glfs.h>
1954
1955int main(int argc, char **argv)
1956{
1957 return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL);
1958}
1959EOF
1960if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then
1961 gf_new="yes"
1962fi
1963print_config "Gluster new API" "$gf_new"
1964fi
1965
6876c98c
JA
1966##########################################
1967# check for gfapi trim support
ca205a75
TK
1968if test "$gf_trim" != "yes" ; then
1969 gf_trim="no"
1970fi
6876c98c
JA
1971if test "$gfapi" = "yes" ; then
1972cat > $TMPC << EOF
1973#include <glusterfs/api/glfs.h>
1974
1975int main(int argc, char **argv)
1976{
1977 return glfs_discard_async(NULL, 0, 0);
1978}
1979EOF
1980if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1981 gf_trim="yes"
1982fi
484b0b65 1983print_config "Gluster API trim support" "$gf_trim"
6876c98c 1984fi
fc5c0345 1985
81795ce3
CE
1986##########################################
1987# Check if we support stckf on s390
ca205a75
TK
1988if test "$s390_z196_facilities" != "yes" ; then
1989 s390_z196_facilities="no"
1990fi
81795ce3
CE
1991cat > $TMPC << EOF
1992#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1993int 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}
2010EOF
2011if compile_prog "" "" "s390_z196_facilities"; then
2012 $TMPE
6a2c9363 2013 if [ $? -eq 0 ]; then
81795ce3
CE
2014 s390_z196_facilities="yes"
2015 fi
2016fi
484b0b65 2017print_config "s390_z196_facilities" "$s390_z196_facilities"
1b10477b
MM
2018
2019##########################################
2020# Check if we have required environment variables configured for libhdfs
2021if 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 2042fi
484b0b65 2043print_config "HDFS engine" "$libhdfs"
1b10477b 2044
b8116a87
DE
2045##########################################
2046# Check whether we have MTD
ca205a75
TK
2047if test "$mtd" != "yes" ; then
2048 mtd="no"
2049fi
b8116a87 2050cat > $TMPC << EOF
0e1c454a 2051#include <string.h>
b8116a87
DE
2052#include <mtd/mtd-user.h>
2053#include <sys/ioctl.h>
2054int 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}
2062EOF
2063if compile_prog "" "" "mtd"; then
2064 mtd="yes"
2065fi
484b0b65 2066print_config "MTD" "$mtd"
b8116a87 2067
3ee2a3c1
DJ
2068##########################################
2069# Check whether we have libpmem
ca205a75
TK
2070if test "$libpmem" != "yes" ; then
2071 libpmem="no"
2072fi
3ee2a3c1
DJ
2073cat > $TMPC << EOF
2074#include <libpmem.h>
2075int main(int argc, char **argv)
2076{
2077 int rc;
2078 rc = pmem_is_pmem(0, 0);
2079 return 0;
2080}
2081EOF
2082if compile_prog "" "-lpmem" "libpmem"; then
2083 libpmem="yes"
2084fi
484b0b65 2085print_config "libpmem" "$libpmem"
3ee2a3c1
DJ
2086
2087##########################################
2088# Check whether we have libpmemblk
cf8775b8 2089# libpmem is a prerequisite
ca205a75
TK
2090if test "$libpmemblk" != "yes" ; then
2091 libpmemblk="no"
2092fi
cf8775b8
RE
2093if test "$libpmem" = "yes"; then
2094 cat > $TMPC << EOF
3ee2a3c1
DJ
2095#include <libpmemblk.h>
2096int main(int argc, char **argv)
2097{
cf8775b8
RE
2098 PMEMblkpool *pbp;
2099 pbp = pmemblk_open("", 0);
3ee2a3c1
DJ
2100 return 0;
2101}
2102EOF
cf8775b8
RE
2103 if compile_prog "" "-lpmemblk" "libpmemblk"; then
2104 libpmemblk="yes"
cf8775b8 2105 fi
3ee2a3c1 2106fi
484b0b65 2107print_config "libpmemblk" "$libpmemblk"
3ee2a3c1 2108
cf8775b8 2109# Choose the ioengines
3ee2a3c1 2110if 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
2116fi
2117
43f3cec2
BB
2118##########################################
2119# Report whether pmemblk engine is enabled
363a5f65 2120print_config "PMDK pmemblk engine" "$pmemblk"
43f3cec2 2121
cbb15e42
DJ
2122##########################################
2123# Report whether dev-dax engine is enabled
363a5f65 2124print_config "PMDK dev-dax engine" "$devdax"
cbb15e42 2125
ae0db592
TI
2126##########################################
2127# Report whether libpmem engine is enabled
363a5f65 2128print_config "PMDK libpmem engine" "$pmem"
ae0db592 2129
a40e7a59
GB
2130##########################################
2131# Check whether we support DDN's IME
2132if test "$libime" != "yes" ; then
2133 libime="no"
2134fi
2135cat > $TMPC << EOF
2136#include <ime_native.h>
2137int main(int argc, char **argv)
2138{
2139 int rc;
2140 ime_native_init();
2141 rc = ime_native_finalize();
2142 return 0;
2143}
2144EOF
2145if 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"
2150fi
2151print_config "DDN's Infinite Memory Engine" "$libime"
2152
247ef2aa
KZ
2153##########################################
2154# Check if we have required environment variables configured for libiscsi
2155if 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
2166fi
2167print_config "iscsi engine" "$libiscsi"
2168
d643a1e2
RJ
2169##########################################
2170# Check if we have libnbd (for NBD support).
4e8c82b4 2171minimum_libnbd=0.9.8
d643a1e2
RJ
2172if 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
2183fi
2184print_config "NBD engine" "$libnbd"
2185
bda92394 2186##########################################
b470a02c
SC
2187# Check if we have lex/yacc available
2188yacc="no"
e7b2c7a3 2189yacc_is_bison="no"
b470a02c
SC
2190lex="no"
2191arith="no"
de26b824 2192if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
cf6dd80e 2193if test "$targetos" != "SunOS" ; then
e7b2c7a3 2194LEX=$(which lex 2> /dev/null)
b470a02c
SC
2195if test -x "$LEX" ; then
2196 lex="yes"
2197fi
7e0049e9 2198YACC=$(which bison 2> /dev/null)
b470a02c
SC
2199if test -x "$YACC" ; then
2200 yacc="yes"
7e0049e9 2201 yacc_is_bison="yes"
e7b2c7a3 2202else
7e0049e9 2203 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
2204 if test -x "$YACC" ; then
2205 yacc="yes"
e7b2c7a3 2206 fi
b470a02c
SC
2207fi
2208if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2209 arith="yes"
2210fi
2211
2212if test "$arith" = "yes" ; then
2213cat > $TMPC << EOF
2214extern int yywrap(void);
2215
2216int main(int argc, char **argv)
2217{
2218 yywrap();
2219 return 0;
2220}
2221EOF
719cda03
JA
2222if compile_prog "" "-ll" "lex"; then
2223 LIBS="-ll $LIBS"
b470a02c
SC
2224else
2225 arith="no"
2226fi
2227fi
cf6dd80e 2228fi
a655bbc4 2229fi
b470a02c 2230
63bda378
JA
2231# Check if lex fails using -o
2232if test "$arith" = "yes" ; then
daf705b5
JA
2233if test "$force_no_lex_o" = "yes" ; then
2234 lex_use_o="no"
2235else
63bda378
JA
2236$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
2237if test "$?" = "0" ; then
2238 lex_use_o="yes"
2239else
2240 lex_use_o="no"
2241fi
2242fi
daf705b5 2243fi
63bda378 2244
484b0b65 2245print_config "lex/yacc for arithmetic" "$arith"
b470a02c 2246
aae599ba
JA
2247##########################################
2248# Check whether we have setmntent/getmntent
ca205a75
TK
2249if test "$getmntent" != "yes" ; then
2250 getmntent="no"
2251fi
aae599ba
JA
2252cat > $TMPC << EOF
2253#include <stdio.h>
2254#include <mntent.h>
2255int 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}
2262EOF
2263if compile_prog "" "" "getmntent"; then
2264 getmntent="yes"
2265fi
484b0b65 2266print_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
2275if test "$getmntinfo" != "yes" ; then
2276 getmntinfo="no"
2277fi
e7e136da
TK
2278cat > $TMPC << EOF
2279#include <stdio.h>
2280#include <sys/param.h>
2281#include <sys/mount.h>
2282int main(int argc, char **argv)
2283{
9ada751d 2284 struct statfs *st;
e7e136da
TK
2285 return getmntinfo(&st, MNT_NOWAIT);
2286}
2287EOF
b765bec0 2288if compile_prog "-Werror" "" "getmntinfo"; then
e7e136da
TK
2289 getmntinfo="yes"
2290fi
484b0b65 2291print_config "getmntinfo" "$getmntinfo"
e7e136da 2292
b765bec0 2293# getmntinfo(3) for NetBSD.
ca205a75
TK
2294if test "$getmntinfo_statvfs" != "yes" ; then
2295 getmntinfo_statvfs="no"
2296fi
b765bec0
TK
2297cat > $TMPC << EOF
2298#include <stdio.h>
2299#include <sys/statvfs.h>
2300int main(int argc, char **argv)
2301{
2302 struct statvfs *st;
2303 return getmntinfo(&st, MNT_NOWAIT);
2304}
2305EOF
2306# Skip the test if the one with statfs arg is detected.
2307if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2308 getmntinfo_statvfs="yes"
484b0b65 2309 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
b765bec0
TK
2310fi
2311
5018f79f
AH
2312##########################################
2313# Check whether we have _Static_assert
ca205a75
TK
2314if test "$static_assert" != "yes" ; then
2315 static_assert="no"
2316fi
5018f79f
AH
2317cat > $TMPC << EOF
2318#include <assert.h>
94815a5c 2319#include <stdlib.h>
51b4c81e 2320#include <stddef.h>
94815a5c
JA
2321
2322struct foo {
2323 int a, b;
2324};
2325
5018f79f
AH
2326int main(int argc, char **argv)
2327{
94815a5c 2328 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
5018f79f
AH
2329 return 0 ;
2330}
2331EOF
2332if compile_prog "" "" "static_assert"; then
2333 static_assert="yes"
2334fi
484b0b65 2335print_config "Static Assert" "$static_assert"
e39c0676
JA
2336
2337##########################################
2338# Check whether we have bool / stdbool.h
ca205a75
TK
2339if test "$have_bool" != "yes" ; then
2340 have_bool="no"
2341fi
e39c0676
JA
2342cat > $TMPC << EOF
2343#include <stdbool.h>
2344int main(int argc, char **argv)
2345{
2346 bool var = true;
2347 return var != false;
2348}
2349EOF
2350if compile_prog "" "" "bool"; then
2351 have_bool="yes"
2352fi
484b0b65 2353print_config "bool" "$have_bool"
e39c0676 2354
b29c71c4
JA
2355##########################################
2356# Check whether we have strndup()
107ad008 2357strndup="no"
b29c71c4
JA
2358cat > $TMPC << EOF
2359#include <string.h>
2360#include <stdlib.h>
2361int main(int argc, char **argv)
2362{
2363 char *res = strndup("test string", 8);
2364
2365 free(res);
2366 return 0;
2367}
2368EOF
2369if compile_prog "" "" "strndup"; then
2370 strndup="yes"
2371fi
2372print_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.
2378if test "$valgrind_dev" != "yes" ; then
2379 valgrind_dev="no"
2380fi
2381cat > $TMPC << EOF
2382#include <valgrind/drd.h>
2383int main(int argc, char **argv)
2384{
2385 return 0;
2386}
2387EOF
2388if compile_prog "" "" "valgrind_dev"; then
2389 valgrind_dev="yes"
2390fi
2391print_config "Valgrind headers" "$valgrind_dev"
2392
a76e1995
BVA
2393##########################################
2394# <linux/blkzoned.h> probe
2395if test "$linux_blkzoned" != "yes" ; then
2396 linux_blkzoned="no"
2397fi
2398cat > $TMPC << EOF
2399#include <linux/blkzoned.h>
2400int main(int argc, char **argv)
2401{
2402 return 0;
2403}
2404EOF
2405if compile_prog "" "" "linux_blkzoned"; then
2406 linux_blkzoned="yes"
2407fi
2408print_config "Zoned block device support" "$linux_blkzoned"
2409
56a19325
DF
2410##########################################
2411# libzbc probe
2412if test "$libzbc" != "yes" ; then
2413 libzbc="no"
2414fi
2415cat > $TMPC << EOF
2416#include <libzbc/zbc.h>
2417int main(int argc, char **argv)
2418{
2419 struct zbc_device *dev = NULL;
2420
2421 return zbc_open("foo=bar", O_RDONLY, &dev);
2422}
2423EOF
2424if 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
2432else
2433 if test "$libzbc" = "yes" ; then
2434 feature_not_found "libzbc" "libzbc or libzbc/zbc.h"
2435 fi
2436 libzbc="no"
2437fi
2438print_config "libzbc engine" "$libzbc"
2439
a76e1995 2440##########################################
214e2d56 2441# check march=armv8-a+crc+crypto
ca205a75
TK
2442if test "$march_armv8_a_crc_crypto" != "yes" ; then
2443 march_armv8_a_crc_crypto="no"
2444fi
214e2d56 2445if 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 2451int 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}
2460EOF
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
2466fi
484b0b65 2467print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
214e2d56 2468
03553853
YR
2469##########################################
2470# cuda probe
d418fa90
TK
2471if test "$cuda" != "yes" ; then
2472 cuda="no"
2473fi
03553853
YR
2474cat > $TMPC << EOF
2475#include <cuda.h>
2476int main(int argc, char **argv)
2477{
2478 return cuInit(0);
2479}
2480EOF
4bd2c8b9 2481if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
03553853
YR
2482 cuda="yes"
2483 LIBS="-lcuda $LIBS"
2484fi
484b0b65 2485print_config "cuda" "$cuda"
214e2d56 2486
a817dc3b
JA
2487##########################################
2488# check for cc -march=native
2489build_native="no"
2490cat > $TMPC << EOF
2491int main(int argc, char **argv)
2492{
2493 return 0;
2494}
2495EOF
c922e0b0
SW
2496if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2497 compile_prog "-march=native" "" "march=native"; then
a817dc3b
JA
2498 build_native="yes"
2499fi
2500print_config "Build march=native" "$build_native"
2501
b8b0e1ee
TK
2502##########################################
2503# check for -lcunit
2504if test "$cunit" != "yes" ; then
2505 cunit="no"
2506fi
2507cat > $TMPC << EOF
2508#include <CUnit/CUnit.h>
2509#include <CUnit/Basic.h>
2510int 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}
2519EOF
2520if compile_prog "" "-lcunit" "CUnit"; then
2521 cunit="yes"
2522fi
2523print_config "CUnit" "$cunit"
2524
57fa61f0
JA
2525##########################################
2526# check for __kernel_rwf_t
2527__kernel_rwf_t="no"
2528cat > $TMPC << EOF
2529#include <linux/fs.h>
2530int main(int argc, char **argv)
2531{
2532 __kernel_rwf_t x;
2533 x = 0;
2534 return x;
2535}
2536EOF
2537if compile_prog "" "" "__kernel_rwf_t"; then
2538 __kernel_rwf_t="yes"
2539fi
2540print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2541
71144e67 2542##########################################
5ad91012 2543# check if gcc has -Wimplicit-fallthrough=2
71144e67
JA
2544fallthrough="no"
2545cat > $TMPC << EOF
2546int main(int argc, char **argv)
2547{
2548 return 0;
2549}
2550EOF
5ad91012 2551if compile_prog "-Wimplicit-fallthrough=2" "" "-Wimplicit-fallthrough=2"; then
71144e67
JA
2552 fallthrough="yes"
2553fi
5ad91012 2554print_config "-Wimplicit-fallthrough=2" "$fallthrough"
71144e67 2555
ff547caa
KB
2556##########################################
2557# check for MADV_HUGEPAGE support
2558if test "$thp" != "yes" ; then
2559 thp="no"
2560fi
2561if test "$esx" != "yes" ; then
2562 cat > $TMPC <<EOF
2563#include <sys/mman.h>
2564int main(void)
2565{
2566 return madvise(0, 0x1000, MADV_HUGEPAGE);
2567}
2568EOF
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
2577fi
2578print_config "MADV_HUGEPAGE" "$thp"
2579
de5ed0e4
JA
2580##########################################
2581# check for gettid()
2582gettid="no"
2583cat > $TMPC << EOF
2584#include <unistd.h>
2585int main(int argc, char **argv)
2586{
2587 return gettid();
2588}
2589EOF
2590if compile_prog "" "" "gettid"; then
2591 gettid="yes"
2592fi
2593print_config "gettid" "$gettid"
2594
95f31f7d
TK
2595##########################################
2596# check for statx(2) support by libc
2597statx="no"
2598cat > $TMPC << EOF
2599#include <unistd.h>
2600#include <sys/stat.h>
2601
2602int main(int argc, char **argv)
2603{
2604 struct statx st;
2605 return statx(-1, *argv, 0, 0, &st);
2606}
2607EOF
2608if compile_prog "" "" "statx"; then
2609 statx="yes"
2610fi
2611print_config "statx(2)/libc" "$statx"
2612
2613##########################################
2614# check for statx(2) support by kernel
2615statx_syscall="no"
2616cat > $TMPC << EOF
2617#include <unistd.h>
2618#include <linux/stat.h>
2619#include <sys/stat.h>
2620#include <sys/syscall.h>
2621
2622static 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
2628int main(int argc, char **argv)
2629{
2630 struct statx st;
2631 return _statx(-1, *argv, 0, 0, &st);
2632}
2633EOF
2634if compile_prog "" "" "statx_syscall"; then
2635 statx_syscall="yes"
2636fi
2637print_config "statx(2)/syscall" "$statx_syscall"
2638
67bf9823
JA
2639#############################################################################
2640
67bf9823 2641if test "$wordsize" = "64" ; then
4feafb1e 2642 output_sym "CONFIG_64BIT"
67bf9823 2643elif test "$wordsize" = "32" ; then
4feafb1e 2644 output_sym "CONFIG_32BIT"
67bf9823 2645else
d7145a78 2646 fatal "Unknown wordsize!"
67bf9823 2647fi
0dcebdf4 2648if test "$bigendian" = "yes" ; then
4feafb1e 2649 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 2650else
4feafb1e 2651 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 2652fi
3989b143
JA
2653if test "$zlib" = "yes" ; then
2654 output_sym "CONFIG_ZLIB"
2655fi
67bf9823 2656if 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
2664fi
2665if test "$posix_aio" = "yes" ; then
4feafb1e 2666 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
2667fi
2668if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 2669 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823 2670fi
06eac6b2
SW
2671if test "$posix_pshared" = "yes" ; then
2672 output_sym "CONFIG_PSHARED"
2673fi
78b66d32
BVA
2674if test "$pthread_condattr_setclock" = "yes" ; then
2675 output_sym "CONFIG_PTHREAD_CONDATTR_SETCLOCK"
2676fi
c31092b8
BVA
2677if test "$pthread_sigmask" = "yes" ; then
2678 output_sym "CONFIG_PTHREAD_SIGMASK"
2679fi
44e8e956 2680if test "$have_asprintf" = "yes" ; then
cb3b6806 2681 output_sym "CONFIG_HAVE_ASPRINTF"
44e8e956
BVA
2682fi
2683if test "$have_vasprintf" = "yes" ; then
cb3b6806 2684 output_sym "CONFIG_HAVE_VASPRINTF"
44e8e956 2685fi
67bf9823 2686if test "$linux_fallocate" = "yes" ; then
4feafb1e 2687 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
2688fi
2689if test "$posix_fallocate" = "yes" ; then
4feafb1e 2690 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
2691fi
2692if test "$fdatasync" = "yes" ; then
4feafb1e 2693 output_sym "CONFIG_FDATASYNC"
67bf9823 2694fi
52a552e2
BVA
2695if test "$pipe" = "yes" ; then
2696 output_sym "CONFIG_PIPE"
2697fi
2698if test "$pipe2" = "yes" ; then
2699 output_sym "CONFIG_PIPE2"
2700fi
15eca9aa
BVA
2701if test "$pread" = "yes" ; then
2702 output_sym "CONFIG_PREAD"
2703fi
67bf9823 2704if test "$sync_file_range" = "yes" ; then
4feafb1e 2705 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
2706fi
2707if test "$sfaa" = "yes" ; then
4feafb1e 2708 output_sym "CONFIG_SFAA"
67bf9823 2709fi
a250edd0
JA
2710if test "$sync_sync" = "yes" ; then
2711 output_sym "CONFIG_SYNC_SYNC"
2712fi
2713if test "$cmp_swap" = "yes" ; then
2714 output_sym "CONFIG_CMP_SWAP"
2715fi
954cd73a 2716if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 2717 output_sym "CONFIG_RDMA"
67bf9823
JA
2718fi
2719if test "$clock_gettime" = "yes" ; then
4feafb1e 2720 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
2721fi
2722if test "$clock_monotonic" = "yes" ; then
4feafb1e 2723 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823 2724fi
c544f604
SN
2725if test "$clock_monotonic_raw" = "yes" ; then
2726 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2727fi
67bf9823 2728if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 2729 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823 2730fi
25f8227d
JA
2731if test "$clockid_t" = "yes"; then
2732 output_sym "CONFIG_CLOCKID_T"
2733fi
67bf9823 2734if test "$gettimeofday" = "yes" ; then
4feafb1e 2735 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
2736fi
2737if test "$posix_fadvise" = "yes" ; then
4feafb1e 2738 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
2739fi
2740if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 2741 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 2742elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 2743 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
2744fi
2745if test "$strsep" = "yes" ; then
4feafb1e 2746 output_sym "CONFIG_STRSEP"
67bf9823 2747fi
9ad8da82
JA
2748if test "$strcasestr" = "yes" ; then
2749 output_sym "CONFIG_STRCASESTR"
2750fi
5ad7be56
KD
2751if test "$strlcat" = "yes" ; then
2752 output_sym "CONFIG_STRLCAT"
2753fi
67bf9823 2754if test "$getopt_long_only" = "yes" ; then
4feafb1e 2755 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
2756fi
2757if test "$inet_aton" = "yes" ; then
4feafb1e 2758 output_sym "CONFIG_INET_ATON"
67bf9823
JA
2759fi
2760if test "$socklen_t" = "yes" ; then
4feafb1e 2761 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
2762fi
2763if test "$ext4_me" = "yes" ; then
4feafb1e 2764 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
2765fi
2766if test "$linux_splice" = "yes" ; then
4feafb1e 2767 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
2768fi
2769if test "$guasi" = "yes" ; then
4feafb1e 2770 output_sym "CONFIG_GUASI"
67bf9823 2771fi
50206d9b 2772if test "$libnuma_v2" = "yes" ; then
4feafb1e 2773 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
2774fi
2775if test "$solaris_aio" = "yes" ; then
4feafb1e 2776 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
2777fi
2778if test "$tls_thread" = "yes" ; then
4feafb1e 2779 output_sym "CONFIG_TLS_THREAD"
67bf9823 2780fi
44404c5a 2781if test "$rusage_thread" = "yes" ; then
4feafb1e 2782 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 2783fi
91f94d5b 2784if test "$gfio" = "yes" ; then
bad7e42c 2785 output_sym "CONFIG_GFIO"
91f94d5b 2786fi
c8931876
JA
2787if test "$esx" = "yes" ; then
2788 output_sym "CONFIG_ESX"
2789 output_sym "CONFIG_NO_SHM"
2790fi
7e09a9f1
JA
2791if test "$sched_idle" = "yes" ; then
2792 output_sym "CONFIG_SCHED_IDLE"
2793fi
1eafa37a
JA
2794if test "$tcp_nodelay" = "yes" ; then
2795 output_sym "CONFIG_TCP_NODELAY"
2796fi
1008602c
JA
2797if test "$window_size" = "yes" ; then
2798 output_sym "CONFIG_NET_WINDOWSIZE"
2799fi
e5f34d95
JA
2800if test "$mss" = "yes" ; then
2801 output_sym "CONFIG_NET_MSS"
2802fi
38b9354a
JA
2803if test "$rlimit_memlock" = "yes" ; then
2804 output_sym "CONFIG_RLIMIT_MEMLOCK"
2805fi
07fc0acd
JA
2806if test "$pwritev" = "yes" ; then
2807 output_sym "CONFIG_PWRITEV"
2808fi
2cafffbe
JA
2809if test "$pwritev2" = "yes" ; then
2810 output_sym "CONFIG_PWRITEV2"
2811fi
ecad55e9
JA
2812if test "$ipv6" = "yes" ; then
2813 output_sym "CONFIG_IPV6"
2814fi
c2f6a13d
LMB
2815if test "$http" = "yes" ; then
2816 output_sym "CONFIG_HTTP"
2817fi
d5f9b0ea
IF
2818if test "$rados" = "yes" ; then
2819 output_sym "CONFIG_RADOS"
2820fi
fc5c0345
DG
2821if test "$rbd" = "yes" ; then
2822 output_sym "CONFIG_RBD"
2823fi
53b6c979
PL
2824if test "$rbd_poll" = "yes" ; then
2825 output_sym "CONFIG_RBD_POLL"
2826fi
903b2812
JA
2827if test "$rbd_inval" = "yes" ; then
2828 output_sym "CONFIG_RBD_INVAL"
2829fi
2e802282
JA
2830if test "$setvbuf" = "yes" ; then
2831 output_sym "CONFIG_SETVBUF"
2832fi
81795ce3
CE
2833if 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 2837fi
6e7d7dfb 2838if test "$gfapi" = "yes" ; then
2839 output_sym "CONFIG_GFAPI"
2840fi
6fa14b99 2841if test "$gf_fadvise" = "yes" ; then
2842 output_sym "CONFIG_GF_FADVISE"
2843fi
6876c98c
JA
2844if test "$gf_trim" = "yes" ; then
2845 output_sym "CONFIG_GF_TRIM"
2846fi
ce4d13ca
JA
2847if test "$gf_new" = "yes" ; then
2848 output_sym "CONFIG_GF_NEW_API"
2849fi
1b10477b
MM
2850if 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 2856fi
b8116a87
DE
2857if test "$mtd" = "yes" ; then
2858 output_sym "CONFIG_MTD"
2859fi
43f3cec2
BB
2860if test "$pmemblk" = "yes" ; then
2861 output_sym "CONFIG_PMEMBLK"
2862fi
cbb15e42
DJ
2863if test "$devdax" = "yes" ; then
2864 output_sym "CONFIG_LINUX_DEVDAX"
2865fi
ae0db592
TI
2866if test "$pmem" = "yes" ; then
2867 output_sym "CONFIG_LIBPMEM"
2868fi
a40e7a59
GB
2869if test "$libime" = "yes" ; then
2870 output_sym "CONFIG_IME"
2871fi
b470a02c
SC
2872if 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 2882fi
aae599ba
JA
2883if test "$getmntent" = "yes" ; then
2884 output_sym "CONFIG_GETMNTENT"
2885fi
e7e136da
TK
2886if test "$getmntinfo" = "yes" ; then
2887 output_sym "CONFIG_GETMNTINFO"
2888fi
b765bec0
TK
2889if test "$getmntinfo_statvfs" = "yes" ; then
2890 output_sym "CONFIG_GETMNTINFO_STATVFS"
2891fi
5018f79f
AH
2892if test "$static_assert" = "yes" ; then
2893 output_sym "CONFIG_STATIC_ASSERT"
2894fi
e39c0676
JA
2895if test "$have_bool" = "yes" ; then
2896 output_sym "CONFIG_HAVE_BOOL"
2897fi
b29c71c4
JA
2898if test "$strndup" = "yes" ; then
2899 output_sym "CONFIG_HAVE_STRNDUP"
2900fi
484817a9
JA
2901if test "$disable_opt" = "yes" ; then
2902 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2903fi
0ffccc21
BVA
2904if test "$valgrind_dev" = "yes"; then
2905 output_sym "CONFIG_VALGRIND_DEV"
2906fi
a76e1995 2907if test "$linux_blkzoned" = "yes" ; then
b7694961 2908 output_sym "CONFIG_HAS_BLKZONED"
a76e1995 2909fi
56a19325
DF
2910if test "$libzbc" = "yes" ; then
2911 output_sym "CONFIG_LIBZBC"
2912fi
605cf82e 2913if 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 2918fi
58828d07
SW
2919if test "$march_armv8_a_crc_crypto" = "yes" ; then
2920 output_sym "ARCH_HAVE_CRC_CRYPTO"
2921fi
03553853
YR
2922if test "$cuda" = "yes" ; then
2923 output_sym "CONFIG_CUDA"
2924fi
9f75af77 2925if test "$march_set" = "no" && test "$build_native" = "yes" ; then
a817dc3b
JA
2926 output_sym "CONFIG_BUILD_NATIVE"
2927fi
b8b0e1ee
TK
2928if test "$cunit" = "yes" ; then
2929 output_sym "CONFIG_HAVE_CUNIT"
2930fi
57fa61f0
JA
2931if test "$__kernel_rwf_t" = "yes"; then
2932 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
2933fi
de5ed0e4
JA
2934if test "$gettid" = "yes"; then
2935 output_sym "CONFIG_HAVE_GETTID"
2936fi
95f31f7d
TK
2937if test "$statx" = "yes"; then
2938 output_sym "CONFIG_HAVE_STATX"
2939fi
2940if test "$statx_syscall" = "yes"; then
2941 output_sym "CONFIG_HAVE_STATX_SYSCALL"
2942fi
71144e67
JA
2943if test "$fallthrough" = "yes"; then
2944 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
2945fi
ff547caa
KB
2946if test "$thp" = "yes" ; then
2947 output_sym "CONFIG_HAVE_THP"
2948fi
247ef2aa
KZ
2949if 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
2954fi
d643a1e2
RJ
2955if 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
2960fi
5a8a6a03 2961if test "$dynamic_engines" = "yes" ; then
a504a390 2962 output_sym "CONFIG_DYNAMIC_ENGINES"
5a8a6a03
YK
2963fi
2964print_config "Lib-based ioengines dynamic" "$dynamic_engines"
01fe773d
JD
2965cat > $TMPC << EOF
2966int main(int argc, char **argv)
2967{
2968 return 0;
2969}
2970EOF
2971if test "$disable_tcmalloc" != "yes" && compile_prog "" "-ltcmalloc" "tcmalloc"; then
2972 LIBS="-ltcmalloc $LIBS"
2973 tcmalloc="yes"
2974else
2975 tcmalloc="no"
2976fi
2977print_config "TCMalloc support" "$tcmalloc"
605cf82e 2978
67bf9823 2979echo "LIBS+=$LIBS" >> $config_host_mak
86719845 2980echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 2981echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 2982echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 2983echo "CC=$cc" >> $config_host_mak
af4862b3 2984echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 2985echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
c61a3a44 2986
59d8f412 2987if [ `dirname $0` != "." -a ! -e Makefile ]; then
c61a3a44
JF
2988 cat > Makefile <<EOF
2989SRCDIR:=`dirname $0`
2990include \$(SRCDIR)/Makefile
2991EOF
2992fi