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