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