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