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