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