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