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