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