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