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