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