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