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