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