configure: Make Cygwin take regular configure path
[fio.git] / configure
CommitLineData
67bf9823
JA
1#!/bin/sh
2#
3# Fio configure script. Heavily influenced by the manual qemu configure
4# script. Sad this this is easier than autoconf and enemies.
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"
17TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
18TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
19
20# NB: do not call "exit" in the trap handler; this is buggy with some shells;
21# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
22trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
23
24rm -rf config.log
25
26config_host_mak="config-host.mak"
4feafb1e
JA
27config_host_h="config-host.h"
28
29rm -rf $config_host_mak
30rm -rf $config_host_h
67bf9823 31
d7145a78
JA
32fatal() {
33 echo $@
34 echo "Configure failed, check config.log and/or the above output"
35 rm -rf $config_host_mak
36 rm -rf $config_host_h
37 exit 1
38}
39
44404c5a 40# Default CFLAGS
af4862b3
JA
41CFLAGS="-D_GNU_SOURCE -include config-host.h"
42BUILD_CFLAGS=""
67bf9823
JA
43
44# Print a helpful header at the top of config.log
45echo "# FIO configure log $(date)" >> config.log
46printf "# Configured with:" >> config.log
47printf " '%s'" "$0" "$@" >> config.log
48echo >> config.log
49echo "#" >> config.log
50
7560fe7c
JA
51# Print configure header at the top of $config_host_h
52echo "/*" > $config_host_h
53echo " * Automatically generated by configure - do not modify" >> $config_host_h
54printf " * Configured with:" >> $config_host_h
55printf " * '%s'" "$0" "$@" >> $config_host_h
56echo "" >> $config_host_h
57echo " */" >> $config_host_h
58
67bf9823
JA
59do_cc() {
60 # Run the compiler, capturing its output to the log.
61 echo $cc "$@" >> config.log
62 $cc "$@" >> config.log 2>&1 || return $?
63 # Test passed. If this is an --enable-werror build, rerun
64 # the test with -Werror and bail out if it fails. This
65 # makes warning-generating-errors in configure test code
66 # obvious to developers.
67 if test "$werror" != "yes"; then
68 return 0
69 fi
70 # Don't bother rerunning the compile if we were already using -Werror
71 case "$*" in
72 *-Werror*)
73 return 0
74 ;;
75 esac
76 echo $cc -Werror "$@" >> config.log
77 $cc -Werror "$@" >> config.log 2>&1 && return $?
78 echo "ERROR: configure test passed without -Werror but failed with -Werror."
79 echo "This is probably a bug in the configure script. The failing command"
80 echo "will be at the bottom of config.log."
d7145a78 81 fatal "You can run configure with --disable-werror to bypass this check."
67bf9823
JA
82}
83
84compile_object() {
85 do_cc $CFLAGS -c -o $TMPO $TMPC
86}
87
88compile_prog() {
89 local_cflags="$1"
adaa46d8 90 local_ldflags="$2 $LIBS"
67bf9823
JA
91 echo "Compiling test case $3" >> config.log
92 do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
93}
94
95feature_not_found() {
96 feature=$1
c55d728b 97 packages=$2
67bf9823
JA
98
99 echo "ERROR"
100 echo "ERROR: User requested feature $feature"
c55d728b
JA
101 if test ! -z "$packages" ; then
102 echo "ERROR: That feature needs $packages installed"
103 fi
67bf9823 104 echo "ERROR: configure was not able to find it"
d7145a78 105 fatal "ERROR"
67bf9823
JA
106}
107
108has() {
109 type "$1" >/dev/null 2>&1
110}
111
112check_define() {
113 cat > $TMPC <<EOF
114#if !defined($1)
115#error $1 not defined
116#endif
117int main(void)
118{
119 return 0;
120}
121EOF
122 compile_object
123}
124
4feafb1e
JA
125output_sym() {
126 echo "$1=y" >> $config_host_mak
127 echo "#define $1" >> $config_host_h
128}
129
67bf9823
JA
130targetos=""
131cpu=""
132
91f94d5b 133# default options
47f44635
JA
134show_help="no"
135exit_val=0
ebec2094 136gfio_check="no"
1b10477b 137libhdfs="no"
43f3cec2 138pmemblk="no"
cbb15e42 139devdax="no"
de26b824 140disable_lex=""
3ee2a3c1 141disable_pmem="no"
020d54bd 142prefix=/usr/local
91f94d5b 143
cb1125b0
JA
144# parse options
145for opt do
146 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
147 case "$opt" in
020d54bd
JA
148 --prefix=*) prefix="$optarg"
149 ;;
8b156d8e
JA
150 --cpu=*) cpu="$optarg"
151 ;;
c8931876
JA
152 # esx is cross compiled and cannot be detect through simple uname calls
153 --esx)
154 esx="yes"
155 ;;
cb1125b0
JA
156 --cc=*) CC="$optarg"
157 ;;
208e4c8b
JA
158 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
159 ;;
b7c12794 160 --build-32bit-win) build_32bit_win="yes"
7409711b 161 ;;
d2aeedb9
JA
162 --build-static) build_static="yes"
163 ;;
91f94d5b 164 --enable-gfio)
ebec2094 165 gfio_check="yes"
899fab33 166 ;;
44462517
CF
167 --disable-numa) disable_numa="yes"
168 ;;
ce18290e
TM
169 --disable-rbd) disable_rbd="yes"
170 ;;
a4c4c346 171 --disable-rbd-blkin) disable_rbd_blkin="yes"
172 ;;
ce18290e
TM
173 --disable-gfapi) disable_gfapi="yes"
174 ;;
1b10477b
MM
175 --enable-libhdfs) libhdfs="yes"
176 ;;
a655bbc4
JA
177 --disable-lex) disable_lex="yes"
178 ;;
de26b824
JA
179 --enable-lex) disable_lex="no"
180 ;;
61054f0d
JA
181 --disable-shm) no_shm="yes"
182 ;;
183 --disable-optimizations) disable_opt="yes"
ba40757e 184 ;;
3ee2a3c1
DJ
185 --disable-pmem) disable_pmem="yes"
186 ;;
827da4f5 187 --help)
47f44635 188 show_help="yes"
827da4f5 189 ;;
cb1125b0
JA
190 *)
191 echo "Bad option $opt"
47f44635
JA
192 show_help="yes"
193 exit_val=1
cb1125b0
JA
194 esac
195done
196
47f44635 197if test "$show_help" = "yes" ; then
05cef7a0
TK
198 echo "--prefix= Use this directory as installation prefix"
199 echo "--cpu= Specify target CPU if auto-detect fails"
200 echo "--cc= Specify compiler to use"
201 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
202 echo "--build-32bit-win Enable 32-bit build on Windows"
203 echo "--build-static Build a static fio"
204 echo "--esx Configure build options for esx"
205 echo "--enable-gfio Enable building of gtk gfio"
206 echo "--disable-numa Disable libnuma even if found"
207 echo "--disable-gfapi Disable gfapi"
208 echo "--enable-libhdfs Enable hdfs support"
209 echo "--disable-lex Disable use of lex/yacc for math"
210 echo "--disable-pmem Disable pmem based engines even if found"
211 echo "--enable-lex Enable use of lex/yacc for math"
212 echo "--disable-shm Disable SHM support"
61054f0d 213 echo "--disable-optimizations Don't enable compiler optimizations"
b7a99316 214 exit $exit_val
47f44635
JA
215fi
216
47986339
SH
217cross_prefix=${cross_prefix-${CROSS_COMPILE}}
218cc="${CC-${cross_prefix}gcc}"
219
6d0e9f83
AC
220if check_define __ANDROID__ ; then
221 targetos="Android"
222elif check_define __linux__ ; then
67bf9823 223 targetos="Linux"
67bf9823
JA
224elif check_define __OpenBSD__ ; then
225 targetos='OpenBSD'
226elif check_define __sun__ ; then
227 targetos='SunOS'
7cb024f8 228 CFLAGS="$CFLAGS -D_REENTRANT"
b24f59ab
SH
229elif check_define _WIN32 ; then
230 targetos='CYGWIN'
67bf9823
JA
231else
232 targetos=`uname -s`
233fi
234
53cd4eee
AC
235echo "# Automatically generated by configure - do not modify" > $config_host_mak
236printf "# Configured with:" >> $config_host_mak
237printf " '%s'" "$0" "$@" >> $config_host_mak
238echo >> $config_host_mak
239echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
240
61054f0d
JA
241if test "$no_shm" = "yes" ; then
242 output_sym "CONFIG_NO_SHM"
243fi
244
245if test "$disable_opt" = "yes" ; then
246 output_sym "CONFIG_FIO_NO_OPT"
247fi
248
67bf9823
JA
249# Some host OSes need non-standard checks for which CPU to use.
250# Note that these checks are broken for cross-compilation: if you're
251# cross-compiling to one of these OSes then you'll need to specify
252# the correct CPU with the --cpu option.
253case $targetos in
de26b824
JA
254AIX)
255 # Unless explicitly enabled, turn off lex.
256 if test -z "$disable_lex" ; then
257 disable_lex="yes"
daf705b5
JA
258 else
259 force_no_lex_o="yes"
de26b824
JA
260 fi
261 ;;
67bf9823
JA
262Darwin)
263 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
264 # we can run 64-bit userspace code.
265 # If the user didn't specify a CPU explicitly and the kernel says this is
266 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
267 # detection code.
268 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
269 cpu="x86_64"
270 fi
ccf2d89d
SW
271 # Error at compile time linking of weak/partial symbols if possible...
272cat > $TMPC <<EOF
273int main(void)
274{
275 return 0;
276}
277EOF
278 if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
279 echo "Disabling weak symbols"
280 LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
281 fi
67bf9823
JA
282 ;;
283SunOS)
284 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
285 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
286 cpu="x86_64"
287 fi
adaa46d8 288 LIBS="-lnsl -lsocket"
cfd94f79
JA
289 ;;
290CYGWIN*)
ca205a75
TK
291 # We still force some options, so keep this message here.
292 echo "Forcing some known good options on Windows"
4578d01f 293 if test -z "$CC" ; then
7409711b
HL
294 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
295 CC="i686-w64-mingw32-gcc"
bc0c01e5
RC
296 if test -e "../zlib/contrib/vstudio/vc14/x86/ZlibStatReleaseWithoutAsm/zlibstat.lib"; then
297 echo "Building with zlib support"
298 output_sym "CONFIG_ZLIB"
299 echo "LIBS=../zlib/contrib/vstudio/vc14/x86/ZlibStatReleaseWithoutAsm/zlibstat.lib" >> $config_host_mak
300 fi
7409711b
HL
301 else
302 CC="x86_64-w64-mingw32-gcc"
bc0c01e5
RC
303 if test -e "../zlib/contrib/vstudio/vc14/x64/ZlibStatReleaseWithoutAsm/zlibstat.lib"; then
304 echo "Building with zlib support"
305 output_sym "CONFIG_ZLIB"
306 echo "LIBS=../zlib/contrib/vstudio/vc14/x64/ZlibStatReleaseWithoutAsm/zlibstat.lib" >> $config_host_mak
307 fi
7409711b 308 fi
4578d01f 309 fi
7409711b
HL
310 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
311 output_sym "CONFIG_32BIT"
312 else
313 output_sym "CONFIG_64BIT_LLP64"
314 fi
ca205a75
TK
315 # We need this to be output_sym'd here because this is Windows specific.
316 # The regular configure path never sets this config.
4feafb1e 317 output_sym "CONFIG_WINDOWSAIO"
ca205a75
TK
318 # We now take the regular configuration path without having exit 0 here.
319 # Flags below are still necessary mostly for MinGW.
320 socklen_t="yes"
321 sfaa="yes"
322 rusage_thread="yes"
323 fdatasync="yes"
324 clock_gettime="yes" # clock_monotonic probe has dependency on this
325 clock_monotonic="yes"
326 gettimeofday="yes"
327 sched_idle="yes"
328 tcp_nodelay="yes"
329 tls_thread="yes"
330 static_assert="yes"
331 ipv6="yes"
4feafb1e 332 echo "CC=$CC" >> $config_host_mak
bc0c01e5 333 echo "BUILD_CFLAGS=$CFLAGS -I../zlib -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
6d0e9f83 334 ;;
67bf9823
JA
335esac
336
337if test ! -z "$cpu" ; then
338 # command line argument
339 :
340elif check_define __i386__ ; then
341 cpu="i386"
342elif check_define __x86_64__ ; then
343 cpu="x86_64"
344elif check_define __sparc__ ; then
345 if check_define __arch64__ ; then
346 cpu="sparc64"
347 else
348 cpu="sparc"
349 fi
350elif check_define _ARCH_PPC ; then
351 if check_define _ARCH_PPC64 ; then
352 cpu="ppc64"
353 else
354 cpu="ppc"
355 fi
356elif check_define __mips__ ; then
357 cpu="mips"
358elif check_define __ia64__ ; then
359 cpu="ia64"
360elif check_define __s390__ ; then
361 if check_define __s390x__ ; then
362 cpu="s390x"
363 else
364 cpu="s390"
365 fi
366elif check_define __arm__ ; then
367 cpu="arm"
214e2d56 368elif check_define __aarch64__ ; then
369 cpu="aarch64"
67bf9823
JA
370elif check_define __hppa__ ; then
371 cpu="hppa"
372else
373 cpu=`uname -m`
374fi
375
376# Normalise host CPU name and set ARCH.
377case "$cpu" in
378 ia64|ppc|ppc64|s390|s390x|sparc64)
379 cpu="$cpu"
380 ;;
381 i386|i486|i586|i686|i86pc|BePC)
95ef38ab 382 cpu="x86"
67bf9823
JA
383 ;;
384 x86_64|amd64)
385 cpu="x86_64"
386 ;;
387 armv*b|armv*l|arm)
388 cpu="arm"
389 ;;
214e2d56 390 aarch64)
391 cpu="arm64"
392 ;;
67bf9823
JA
393 hppa|parisc|parisc64)
394 cpu="hppa"
395 ;;
396 mips*)
397 cpu="mips"
398 ;;
399 sparc|sun4[cdmuv])
400 cpu="sparc"
401 ;;
402 *)
8b156d8e 403 echo "Unknown CPU"
67bf9823
JA
404 ;;
405esac
406
dcbbf5b0 407if test -z "$CC" ; then
67bf9823
JA
408 if test "$targetos" = "FreeBSD"; then
409 if has clang; then
410 CC=clang
411 else
412 CC=gcc
413 fi
67bf9823
JA
414 fi
415fi
416
417cc="${CC-${cross_prefix}gcc}"
418
1a17cfdb
AC
419##########################################
420# check cross compile
421
ca205a75
TK
422if test "$cross_compile" != "yes" ; then
423 cross_compile="no"
424fi
1a17cfdb
AC
425cat > $TMPC <<EOF
426int main(void)
427{
428 return 0;
429}
430EOF
431if compile_prog "" "" "cross"; then
432 $TMPE 2>/dev/null || cross_compile="yes"
433else
434 fatal "compile test failed"
435fi
436
0dcebdf4
JA
437##########################################
438# check endianness
ca205a75
TK
439if test "$bigendian" != "yes" ; then
440 bigendian="no"
441fi
1a17cfdb
AC
442if test "$cross_compile" = "no" ; then
443 cat > $TMPC <<EOF
0dcebdf4
JA
444#include <inttypes.h>
445int main(void)
446{
447 volatile uint32_t i=0x01234567;
448 return (*((uint8_t*)(&i))) == 0x67;
449}
450EOF
1a17cfdb
AC
451 if compile_prog "" "" "endian"; then
452 $TMPE && bigendian="yes"
453 fi
454else
455 # If we're cross compiling, try our best to work it out and rely on the
456 # run-time check to fail if we get it wrong.
457 cat > $TMPC <<EOF
458#include <endian.h>
459int main(void)
460{
461#if __BYTE_ORDER != __BIG_ENDIAN
462# error "Unknown endianness"
463#endif
464}
465EOF
466 compile_prog "" "" "endian" && bigendian="yes"
467 check_define "__ARMEB__" && bigendian="yes"
468 check_define "__MIPSEB__" && bigendian="yes"
0dcebdf4
JA
469fi
470
471
67bf9823
JA
472echo "Operating system $targetos"
473echo "CPU $cpu"
0dcebdf4 474echo "Big endian $bigendian"
67bf9823 475echo "Compiler $cc"
1a17cfdb 476echo "Cross compile $cross_compile"
67bf9823
JA
477echo
478
d2aeedb9
JA
479##########################################
480# See if we need to build a static build
481if test "$build_static" = "yes" ; then
482 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
483 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
484else
485 build_static="no"
486fi
487echo "Static build $build_static"
488
67bf9823
JA
489##########################################
490# check for wordsize
491wordsize="0"
492cat > $TMPC <<EOF
142429e5
AC
493#include <limits.h>
494#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
67bf9823
JA
495int main(void)
496{
142429e5 497 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
67bf9823
JA
498 return 0;
499}
500EOF
142429e5
AC
501if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
502 wordsize="32"
503elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
504 wordsize="64"
505else
506 fatal "Unknown wordsize"
67bf9823
JA
507fi
508echo "Wordsize $wordsize"
509
a9bca4aa
JA
510##########################################
511# zlib probe
ca205a75
TK
512if test "$zlib" != "yes" ; then
513 zlib="no"
514fi
a9bca4aa 515cat > $TMPC <<EOF
804a1e05 516#include <zlib.h>
a9bca4aa
JA
517int main(void)
518{
519 z_stream stream;
520 if (inflateInit(&stream) != Z_OK)
521 return 1;
522 return 0;
523}
524EOF
525if compile_prog "" "-lz" "zlib" ; then
526 zlib=yes
527 LIBS="-lz $LIBS"
a9bca4aa
JA
528fi
529echo "zlib $zlib"
530
67bf9823
JA
531##########################################
532# linux-aio probe
ca205a75
TK
533if test "$libaio" != "yes" ; then
534 libaio="no"
535fi
7c77ebef 536if test "$esx" != "yes" ; then
537 cat > $TMPC <<EOF
67bf9823
JA
538#include <libaio.h>
539#include <stddef.h>
540int main(void)
541{
542 io_setup(0, NULL);
543 return 0;
544}
545EOF
7c77ebef 546 if compile_prog "" "-laio" "libaio" ; then
547 libaio=yes
548 LIBS="-laio $LIBS"
549 else
550 if test "$libaio" = "yes" ; then
551 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
552 fi
553 libaio=no
67bf9823 554 fi
67bf9823
JA
555fi
556echo "Linux AIO support $libaio"
557
558##########################################
559# posix aio probe
ca205a75
TK
560if test "$posix_aio" != "yes" ; then
561 posix_aio="no"
562fi
563if test "$posix_aio_lrt" != "yes" ; then
564 posix_aio_lrt="no"
565fi
67bf9823
JA
566cat > $TMPC <<EOF
567#include <aio.h>
568int main(void)
569{
570 struct aiocb cb;
571 aio_read(&cb);
572 return 0;
573}
574EOF
575if compile_prog "" "" "posixaio" ; then
576 posix_aio="yes"
577elif compile_prog "" "-lrt" "posixaio"; then
578 posix_aio="yes"
579 posix_aio_lrt="yes"
580 LIBS="-lrt $LIBS"
581fi
582echo "POSIX AIO support $posix_aio"
583echo "POSIX AIO support needs -lrt $posix_aio_lrt"
584
585##########################################
586# posix aio fsync probe
ca205a75
TK
587if test "$posix_aio_fsync" != "yes" ; then
588 posix_aio_fsync="no"
589fi
67bf9823
JA
590if test "$posix_aio" = "yes" ; then
591 cat > $TMPC <<EOF
592#include <fcntl.h>
593#include <aio.h>
594int main(void)
595{
596 struct aiocb cb;
597 return aio_fsync(O_SYNC, &cb);
598 return 0;
599}
600EOF
601 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
602 posix_aio_fsync=yes
603 fi
604fi
605echo "POSIX AIO fsync $posix_aio_fsync"
606
607##########################################
608# solaris aio probe
ca205a75
TK
609if test "$solaris_aio" != "yes" ; then
610 solaris_aio="no"
611fi
67bf9823
JA
612cat > $TMPC <<EOF
613#include <sys/types.h>
614#include <sys/asynch.h>
615#include <unistd.h>
616int main(void)
617{
618 aio_result_t res;
619 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
620 return 0;
621}
622EOF
623if compile_prog "" "-laio" "solarisaio" ; then
624 solaris_aio=yes
625 LIBS="-laio $LIBS"
626fi
627echo "Solaris AIO support $solaris_aio"
628
629##########################################
f5cd2907 630# __sync_fetch_and_add test
ca205a75
TK
631if test "$sfaa" != "yes" ; then
632 sfaa="no"
633fi
67bf9823 634cat > $TMPC << EOF
958886d8
JA
635#include <inttypes.h>
636static int sfaa(uint64_t *ptr)
67bf9823 637{
9c639a76 638 return __sync_fetch_and_add(ptr, 0);
67bf9823
JA
639}
640
641int main(int argc, char **argv)
642{
958886d8 643 uint64_t val = 42;
67bf9823
JA
644 sfaa(&val);
645 return val;
646}
647EOF
648if compile_prog "" "" "__sync_fetch_and_add()" ; then
649 sfaa="yes"
650fi
9c639a76 651echo "__sync_fetch_and_add $sfaa"
67bf9823
JA
652
653##########################################
654# libverbs probe
ca205a75
TK
655if test "$libverbs" != "yes" ; then
656 libverbs="no"
657fi
67bf9823
JA
658cat > $TMPC << EOF
659#include <stdio.h>
660#include <infiniband/arch.h>
661int main(int argc, char **argv)
662{
663 struct ibv_pd *pd = ibv_alloc_pd(NULL);
664 return 0;
665}
666EOF
667if compile_prog "" "-libverbs" "libverbs" ; then
668 libverbs="yes"
669 LIBS="-libverbs $LIBS"
670fi
671echo "libverbs $libverbs"
672
673##########################################
674# rdmacm probe
ca205a75
TK
675if test "$rdmacm" != "yes" ; then
676 rdmacm="no"
677fi
67bf9823
JA
678cat > $TMPC << EOF
679#include <stdio.h>
680#include <rdma/rdma_cma.h>
681int main(int argc, char **argv)
682{
683 rdma_destroy_qp(NULL);
684 return 0;
685}
686EOF
687if compile_prog "" "-lrdmacm" "rdma"; then
688 rdmacm="yes"
689 LIBS="-lrdmacm $LIBS"
690fi
691echo "rdmacm $rdmacm"
692
693##########################################
694# Linux fallocate probe
ca205a75
TK
695if test "$linux_fallocate" != "yes" ; then
696 linux_fallocate="no"
697fi
67bf9823
JA
698cat > $TMPC << EOF
699#include <stdio.h>
aa6738a5 700#include <fcntl.h>
67bf9823
JA
701#include <linux/falloc.h>
702int main(int argc, char **argv)
703{
704 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
705 return r;
706}
707EOF
708if compile_prog "" "" "linux_fallocate"; then
709 linux_fallocate="yes"
710fi
711echo "Linux fallocate $linux_fallocate"
712
713##########################################
714# POSIX fadvise probe
ca205a75
TK
715if test "$posix_fadvise" != "yes" ; then
716 posix_fadvise="no"
717fi
67bf9823
JA
718cat > $TMPC << EOF
719#include <stdio.h>
720#include <fcntl.h>
721int main(int argc, char **argv)
722{
723 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
724 return r;
725}
726EOF
727if compile_prog "" "" "posix_fadvise"; then
728 posix_fadvise="yes"
729fi
730echo "POSIX fadvise $posix_fadvise"
731
732##########################################
733# POSIX fallocate probe
ca205a75
TK
734if test "$posix_fallocate" != "yes" ; then
735 posix_fallocate="no"
736fi
67bf9823
JA
737cat > $TMPC << EOF
738#include <stdio.h>
739#include <fcntl.h>
740int main(int argc, char **argv)
741{
742 int r = posix_fallocate(0, 0, 1024);
743 return r;
744}
745EOF
746if compile_prog "" "" "posix_fallocate"; then
747 posix_fallocate="yes"
748fi
749echo "POSIX fallocate $posix_fallocate"
750
751##########################################
752# sched_set/getaffinity 2 or 3 argument test
ca205a75
TK
753if test "$linux_2arg_affinity" != "yes" ; then
754 linux_2arg_affinity="no"
755fi
756if test "$linux_3arg_affinity" != "yes" ; then
757 linux_3arg_affinity="no"
758fi
67bf9823 759cat > $TMPC << EOF
67bf9823
JA
760#include <sched.h>
761int main(int argc, char **argv)
762{
763 cpu_set_t mask;
764 return sched_setaffinity(0, sizeof(mask), &mask);
765}
766EOF
767if compile_prog "" "" "sched_setaffinity(,,)"; then
768 linux_3arg_affinity="yes"
769else
770 cat > $TMPC << EOF
67bf9823
JA
771#include <sched.h>
772int main(int argc, char **argv)
773{
774 cpu_set_t mask;
775 return sched_setaffinity(0, &mask);
776}
777EOF
778 if compile_prog "" "" "sched_setaffinity(,)"; then
779 linux_2arg_affinity="yes"
780 fi
781fi
782echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
783echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
784
785##########################################
786# clock_gettime probe
ca205a75
TK
787if test "$clock_gettime" != "yes" ; then
788 clock_gettime="no"
789fi
67bf9823
JA
790cat > $TMPC << EOF
791#include <stdio.h>
792#include <time.h>
793int main(int argc, char **argv)
794{
795 return clock_gettime(0, NULL);
796}
797EOF
798if compile_prog "" "" "clock_gettime"; then
799 clock_gettime="yes"
800elif compile_prog "" "-lrt" "clock_gettime"; then
801 clock_gettime="yes"
802 LIBS="-lrt $LIBS"
803fi
804echo "clock_gettime $clock_gettime"
805
806##########################################
807# CLOCK_MONOTONIC probe
ca205a75
TK
808if test "$clock_monotonic" != "yes" ; then
809 clock_monotonic="no"
810fi
67bf9823
JA
811if test "$clock_gettime" = "yes" ; then
812 cat > $TMPC << EOF
813#include <stdio.h>
814#include <time.h>
815int main(int argc, char **argv)
816{
817 return clock_gettime(CLOCK_MONOTONIC, NULL);
818}
819EOF
820 if compile_prog "" "$LIBS" "clock monotonic"; then
821 clock_monotonic="yes"
822 fi
823fi
824echo "CLOCK_MONOTONIC $clock_monotonic"
825
c544f604
SN
826##########################################
827# CLOCK_MONOTONIC_RAW probe
ca205a75
TK
828if test "$clock_monotonic_raw" != "yes" ; then
829 clock_monotonic_raw="no"
830fi
c544f604
SN
831if test "$clock_gettime" = "yes" ; then
832 cat > $TMPC << EOF
833#include <stdio.h>
834#include <time.h>
835int main(int argc, char **argv)
836{
837 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
838}
839EOF
840 if compile_prog "" "$LIBS" "clock monotonic"; then
841 clock_monotonic_raw="yes"
842 fi
843fi
844echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
845
67bf9823
JA
846##########################################
847# CLOCK_MONOTONIC_PRECISE probe
ca205a75
TK
848if test "$clock_monotonic_precise" != "yes" ; then
849 clock_monotonic_precise="no"
850fi
67bf9823
JA
851if test "$clock_gettime" = "yes" ; then
852 cat > $TMPC << EOF
853#include <stdio.h>
854#include <time.h>
855int main(int argc, char **argv)
856{
857 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
858}
859EOF
860 if compile_prog "" "$LIBS" "clock monotonic precise"; then
861 clock_monotonic_precise="yes"
862 fi
863fi
864echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
865
25f8227d
JA
866##########################################
867# clockid_t probe
ca205a75
TK
868if test "$clockid_t" != "yes" ; then
869 clockid_t="no"
870fi
25f8227d 871cat > $TMPC << EOF
25f8227d
JA
872#include <time.h>
873int main(int argc, char **argv)
874{
ccf2d89d 875 volatile clockid_t cid;
a214d131 876 memset(&cid, 0, sizeof(cid));
ccf2d89d 877 return 0;
25f8227d
JA
878}
879EOF
880if compile_prog "" "$LIBS" "clockid_t"; then
881 clockid_t="yes"
882fi
883echo "clockid_t $clockid_t"
884
67bf9823
JA
885##########################################
886# gettimeofday() probe
ca205a75
TK
887if test "$gettimeofday" != "yes" ; then
888 gettimeofday="no"
889fi
67bf9823
JA
890cat > $TMPC << EOF
891#include <sys/time.h>
892#include <stdio.h>
893int main(int argc, char **argv)
894{
895 struct timeval tv;
896 return gettimeofday(&tv, NULL);
897}
898EOF
899if compile_prog "" "" "gettimeofday"; then
900 gettimeofday="yes"
901fi
902echo "gettimeofday $gettimeofday"
903
904##########################################
905# fdatasync() probe
ca205a75
TK
906if test "$fdatasync" != "yes" ; then
907 fdatasync="no"
908fi
67bf9823
JA
909cat > $TMPC << EOF
910#include <stdio.h>
911#include <unistd.h>
912int main(int argc, char **argv)
913{
914 return fdatasync(0);
915}
916EOF
917if compile_prog "" "" "fdatasync"; then
918 fdatasync="yes"
919fi
920echo "fdatasync $fdatasync"
921
922##########################################
923# sync_file_range() probe
ca205a75
TK
924if test "$sync_file_range" != "yes" ; then
925 sync_file_range="no"
926fi
67bf9823
JA
927cat > $TMPC << EOF
928#include <stdio.h>
929#include <unistd.h>
67bf9823
JA
930#include <fcntl.h>
931#include <linux/fs.h>
932int main(int argc, char **argv)
933{
934 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
935 SYNC_FILE_RANGE_WAIT_AFTER;
936 return sync_file_range(0, 0, 0, flags);
937}
938EOF
939if compile_prog "" "" "sync_file_range"; then
940 sync_file_range="yes"
941fi
942echo "sync_file_range $sync_file_range"
943
944##########################################
945# ext4 move extent probe
ca205a75
TK
946if test "$ext4_me" != "yes" ; then
947 ext4_me="no"
948fi
67bf9823
JA
949cat > $TMPC << EOF
950#include <fcntl.h>
951#include <sys/ioctl.h>
952int main(int argc, char **argv)
953{
954 struct move_extent me;
955 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
956}
957EOF
c7165b8d
JA
958if compile_prog "" "" "ext4 move extent" ; then
959 ext4_me="yes"
960elif test $targetos = "Linux" ; then
961 # On Linux, just default to it on and let it error at runtime if we really
962 # don't have it. None of my updated systems have it defined, but it does
963 # work. Takes a while to bubble back.
67bf9823
JA
964 ext4_me="yes"
965fi
966echo "EXT4 move extent $ext4_me"
967
968##########################################
969# splice probe
ca205a75
TK
970if test "$linux_splice" != "yes" ; then
971 linux_splice="no"
972fi
67bf9823 973cat > $TMPC << EOF
67bf9823
JA
974#include <stdio.h>
975#include <fcntl.h>
976int main(int argc, char **argv)
977{
978 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
979}
980EOF
981if compile_prog "" "" "linux splice"; then
982 linux_splice="yes"
983fi
984echo "Linux splice(2) $linux_splice"
985
986##########################################
987# GUASI probe
ca205a75
TK
988if test "$guasi" != "yes" ; then
989 guasi="no"
990fi
67bf9823
JA
991cat > $TMPC << EOF
992#include <guasi.h>
993#include <guasi_syscalls.h>
994int main(int argc, char **argv)
995{
996 guasi_t ctx = guasi_create(0, 0, 0);
997 return 0;
998}
999EOF
1000if compile_prog "" "" "guasi"; then
1001 guasi="yes"
1002fi
1003echo "GUASI $guasi"
1004
1005##########################################
1006# fusion-aw probe
ca205a75
TK
1007if test "$fusion_aw" != "yes" ; then
1008 fusion_aw="no"
1009fi
67bf9823 1010cat > $TMPC << EOF
b2c77c25 1011#include <nvm/nvm_primitives.h>
67bf9823
JA
1012int main(int argc, char **argv)
1013{
b2c77c25
SK
1014 nvm_version_t ver_info;
1015 nvm_handle_t handle;
1016
1017 handle = nvm_get_handle(0, &ver_info);
1018 return nvm_atomic_write(handle, 0, 0, 0);
67bf9823
JA
1019}
1020EOF
92aef550
ARJ
1021if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1022 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
67bf9823
JA
1023 fusion_aw="yes"
1024fi
1025echo "Fusion-io atomic engine $fusion_aw"
1026
1027##########################################
1028# libnuma probe
ca205a75
TK
1029if test "$libnuma" != "yes" ; then
1030 libnuma="no"
1031fi
67bf9823
JA
1032cat > $TMPC << EOF
1033#include <numa.h>
1034int main(int argc, char **argv)
1035{
1036 return numa_available();
1037}
1038EOF
44462517 1039if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
67bf9823
JA
1040 libnuma="yes"
1041 LIBS="-lnuma $LIBS"
1042fi
1043echo "libnuma $libnuma"
1044
50206d9b 1045##########################################
ca205a75 1046# libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
50206d9b
JA
1047if test "$libnuma" = "yes" ; then
1048libnuma_v2="no"
1049cat > $TMPC << EOF
1050#include <numa.h>
1051int main(int argc, char **argv)
1052{
1053 struct bitmask *mask = numa_parse_nodestring(NULL);
61bde962 1054 return mask->size == 0;
50206d9b
JA
1055}
1056EOF
1057if compile_prog "" "" "libnuma api"; then
1058 libnuma_v2="yes"
1059fi
1060echo "libnuma v2 $libnuma_v2"
1061fi
1062
67bf9823
JA
1063##########################################
1064# strsep() probe
ca205a75
TK
1065if test "$strsep" != "yes" ; then
1066 strsep="no"
1067fi
67bf9823
JA
1068cat > $TMPC << EOF
1069#include <string.h>
1070int main(int argc, char **argv)
1071{
ae156be6
JA
1072 static char *string = "This is a string";
1073 strsep(&string, "needle");
67bf9823
JA
1074 return 0;
1075}
1076EOF
1077if compile_prog "" "" "strsep"; then
1078 strsep="yes"
1079fi
1080echo "strsep $strsep"
1081
9ad8da82
JA
1082##########################################
1083# strcasestr() probe
ca205a75
TK
1084if test "$strcasestr" != "yes" ; then
1085 strcasestr="no"
1086fi
9ad8da82
JA
1087cat > $TMPC << EOF
1088#include <string.h>
1089int main(int argc, char **argv)
1090{
aa6738a5 1091 return strcasestr(argv[0], argv[1]) != NULL;
9ad8da82
JA
1092}
1093EOF
1094if compile_prog "" "" "strcasestr"; then
1095 strcasestr="yes"
1096fi
1097echo "strcasestr $strcasestr"
1098
5ad7be56
KD
1099##########################################
1100# strlcat() probe
ca205a75
TK
1101if test "$strlcat" != "yes" ; then
1102 strlcat="no"
1103fi
5ad7be56
KD
1104cat > $TMPC << EOF
1105#include <string.h>
1106int main(int argc, char **argv)
1107{
1108 static char dst[64];
1109 static char *string = "This is a string";
1110 memset(dst, 0, sizeof(dst));
1111 strlcat(dst, string, sizeof(dst));
1112 return 0;
1113}
1114EOF
1115if compile_prog "" "" "strlcat"; then
1116 strlcat="yes"
1117fi
1118echo "strlcat $strlcat"
1119
67bf9823
JA
1120##########################################
1121# getopt_long_only() probe
ca205a75
TK
1122if test "$getopt_long_only" != "yes" ; then
1123 getopt_long_only="no"
1124fi
67bf9823
JA
1125cat > $TMPC << EOF
1126#include <unistd.h>
1127#include <stdio.h>
aa6738a5 1128#include <getopt.h>
67bf9823
JA
1129int main(int argc, char **argv)
1130{
1131 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1132 return c;
1133}
1134EOF
1135if compile_prog "" "" "getopt_long_only"; then
1136 getopt_long_only="yes"
1137fi
1138echo "getopt_long_only() $getopt_long_only"
1139
1140##########################################
1141# inet_aton() probe
ca205a75
TK
1142if test "$inet_aton" != "yes" ; then
1143 inet_aton="no"
1144fi
67bf9823
JA
1145cat > $TMPC << EOF
1146#include <sys/socket.h>
1147#include <arpa/inet.h>
1148#include <stdio.h>
1149int main(int argc, char **argv)
1150{
1151 struct in_addr in;
1152 return inet_aton(NULL, &in);
1153}
1154EOF
1155if compile_prog "" "" "inet_aton"; then
1156 inet_aton="yes"
1157fi
1158echo "inet_aton $inet_aton"
1159
1160##########################################
1161# socklen_t probe
ca205a75
TK
1162if test "$socklen_t" != "yes" ; then
1163 socklen_t="no"
1164fi
67bf9823 1165cat > $TMPC << EOF
f6482613 1166#include <sys/socket.h>
67bf9823
JA
1167int main(int argc, char **argv)
1168{
1169 socklen_t len = 0;
1170 return len;
1171}
1172EOF
1173if compile_prog "" "" "socklen_t"; then
1174 socklen_t="yes"
1175fi
1176echo "socklen_t $socklen_t"
1177
1178##########################################
1179# Whether or not __thread is supported for TLS
ca205a75
TK
1180if test "$tls_thread" != "yes" ; then
1181 tls_thread="no"
1182fi
67bf9823
JA
1183cat > $TMPC << EOF
1184#include <stdio.h>
aa6738a5 1185static __thread int ret;
67bf9823
JA
1186int main(int argc, char **argv)
1187{
1188 return ret;
1189}
1190EOF
1191if compile_prog "" "" "__thread"; then
1192 tls_thread="yes"
1193fi
1194echo "__thread $tls_thread"
1195
91f94d5b 1196##########################################
2639f056 1197# Check if we have required gtk/glib support for gfio
ca205a75
TK
1198if test "$gfio" != "yes" ; then
1199 gfio="no"
1200fi
ebec2094 1201if test "$gfio_check" = "yes" ; then
91f94d5b
JA
1202 cat > $TMPC << EOF
1203#include <glib.h>
1204#include <cairo.h>
1205#include <gtk/gtk.h>
1206int main(void)
1207{
1208 gdk_threads_enter();
91f94d5b 1209 gdk_threads_leave();
b7a99316
JA
1210
1211 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
91f94d5b
JA
1212}
1213EOF
1214GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
86719845
JA
1215ORG_LDFLAGS=$LDFLAGS
1216LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
91f94d5b
JA
1217if test "$?" != "0" ; then
1218 echo "configure: gtk and gthread not found"
1219 exit 1
1220fi
1221GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1222if test "$?" != "0" ; then
1223 echo "configure: gtk and gthread not found"
1224 exit 1
1225fi
b7a99316
JA
1226if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1227 r=$($TMPE)
1228 if test "$r" != "0" ; then
1229 gfio="yes"
86719845 1230 GFIO_LIBS="$LIBS $GTK_LIBS"
b7a99316
JA
1231 CFLAGS="$CFLAGS $GTK_CFLAGS"
1232 else
1233 echo "GTK found, but need version 2.18 or higher"
1234 gfio="no"
1235 fi
91f94d5b
JA
1236else
1237 echo "Please install gtk and gdk libraries"
1238 gfio="no"
1239fi
86719845 1240LDFLAGS=$ORG_LDFLAGS
91f94d5b
JA
1241fi
1242
ebec2094
JA
1243if test "$gfio_check" = "yes" ; then
1244 echo "gtk 2.18 or higher $gfio"
1245fi
91f94d5b 1246
44404c5a 1247# Check whether we have getrusage(RUSAGE_THREAD)
ca205a75
TK
1248if test "$rusage_thread" != "yes" ; then
1249 rusage_thread="no"
1250fi
44404c5a
JA
1251cat > $TMPC << EOF
1252#include <sys/time.h>
1253#include <sys/resource.h>
1254int main(int argc, char **argv)
1255{
1256 struct rusage ru;
1257 getrusage(RUSAGE_THREAD, &ru);
1258 return 0;
1259}
1260EOF
1261if compile_prog "" "" "RUSAGE_THREAD"; then
1262 rusage_thread="yes"
1263fi
1264echo "RUSAGE_THREAD $rusage_thread"
1265
7e09a9f1
JA
1266##########################################
1267# Check whether we have SCHED_IDLE
ca205a75
TK
1268if test "$sched_idle" != "yes" ; then
1269 sched_idle="no"
1270fi
7e09a9f1
JA
1271cat > $TMPC << EOF
1272#include <sched.h>
1273int main(int argc, char **argv)
1274{
1275 struct sched_param p;
1276 return sched_setscheduler(0, SCHED_IDLE, &p);
1277}
1278EOF
1279if compile_prog "" "" "SCHED_IDLE"; then
1280 sched_idle="yes"
1281fi
1282echo "SCHED_IDLE $sched_idle"
1283
1eafa37a
JA
1284##########################################
1285# Check whether we have TCP_NODELAY
ca205a75
TK
1286if test "$tcp_nodelay" != "yes" ; then
1287 tcp_nodelay="no"
1288fi
1eafa37a
JA
1289cat > $TMPC << EOF
1290#include <stdio.h>
1291#include <sys/types.h>
1292#include <sys/socket.h>
1293#include <netinet/tcp.h>
1294int main(int argc, char **argv)
1295{
1296 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1297}
1298EOF
1299if compile_prog "" "" "TCP_NODELAY"; then
1300 tcp_nodelay="yes"
1301fi
1302echo "TCP_NODELAY $tcp_nodelay"
1303
1008602c
JA
1304##########################################
1305# Check whether we have SO_SNDBUF
ca205a75
TK
1306if test "$window_size" != "yes" ; then
1307 window_size="no"
1308fi
1008602c
JA
1309cat > $TMPC << EOF
1310#include <stdio.h>
1311#include <sys/types.h>
1312#include <sys/socket.h>
1313#include <netinet/tcp.h>
1314int main(int argc, char **argv)
1315{
1316 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1317 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1318}
1319EOF
1320if compile_prog "" "" "SO_SNDBUF"; then
1321 window_size="yes"
1322fi
1323echo "Net engine window_size $window_size"
1324
e5f34d95
JA
1325##########################################
1326# Check whether we have TCP_MAXSEG
ca205a75
TK
1327if test "$mss" != "yes" ; then
1328 mss="no"
1329fi
e5f34d95
JA
1330cat > $TMPC << EOF
1331#include <stdio.h>
1332#include <sys/types.h>
1333#include <sys/socket.h>
1334#include <netinet/tcp.h>
1335#include <arpa/inet.h>
1336#include <netinet/in.h>
1337int main(int argc, char **argv)
1338{
1339 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1340}
1341EOF
1342if compile_prog "" "" "TCP_MAXSEG"; then
1343 mss="yes"
1344fi
1345echo "TCP_MAXSEG $mss"
1346
38b9354a
JA
1347##########################################
1348# Check whether we have RLIMIT_MEMLOCK
ca205a75
TK
1349if test "$rlimit_memlock" != "yes" ; then
1350 rlimit_memlock="no"
1351fi
38b9354a
JA
1352cat > $TMPC << EOF
1353#include <sys/time.h>
1354#include <sys/resource.h>
1355int main(int argc, char **argv)
1356{
1357 struct rlimit rl;
1358 return getrlimit(RLIMIT_MEMLOCK, &rl);
1359}
1360EOF
1361if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1362 rlimit_memlock="yes"
1363fi
1364echo "RLIMIT_MEMLOCK $rlimit_memlock"
1365
07fc0acd
JA
1366##########################################
1367# Check whether we have pwritev/preadv
ca205a75
TK
1368if test "$pwritev" != "yes" ; then
1369 pwritev="no"
1370fi
07fc0acd
JA
1371cat > $TMPC << EOF
1372#include <stdio.h>
1373#include <sys/uio.h>
1374int main(int argc, char **argv)
1375{
1376 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1377}
1378EOF
1379if compile_prog "" "" "pwritev"; then
1380 pwritev="yes"
1381fi
1382echo "pwritev/preadv $pwritev"
1383
2cafffbe
JA
1384##########################################
1385# Check whether we have pwritev2/preadv2
ca205a75
TK
1386if test "$pwritev2" != "yes" ; then
1387 pwritev2="no"
1388fi
2cafffbe
JA
1389cat > $TMPC << EOF
1390#include <stdio.h>
1391#include <sys/uio.h>
1392int main(int argc, char **argv)
1393{
1394 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1395}
1396EOF
1397if compile_prog "" "" "pwritev2"; then
1398 pwritev2="yes"
1399fi
1400echo "pwritev2/preadv2 $pwritev2"
1401
ecad55e9
JA
1402##########################################
1403# Check whether we have the required functions for ipv6
ca205a75
TK
1404if test "$ipv6" != "yes" ; then
1405 ipv6="no"
1406fi
ecad55e9
JA
1407cat > $TMPC << EOF
1408#include <sys/types.h>
1409#include <sys/socket.h>
d219028d 1410#include <netinet/in.h>
ecad55e9
JA
1411#include <netdb.h>
1412#include <stdio.h>
1413int main(int argc, char **argv)
1414{
1415 struct addrinfo hints;
1416 struct in6_addr addr;
1417 int ret;
1418
1419 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1420 freeaddrinfo(NULL);
1421 printf("%s\n", gai_strerror(ret));
1422 addr = in6addr_any;
1423 return 0;
1424}
1425EOF
1426if compile_prog "" "" "ipv6"; then
1427 ipv6="yes"
1428fi
1429echo "IPv6 helpers $ipv6"
07fc0acd 1430
fc5c0345
DG
1431##########################################
1432# check for rbd
ca205a75
TK
1433if test "$rbd" != "yes" ; then
1434 rbd="no"
1435fi
fc5c0345
DG
1436cat > $TMPC << EOF
1437#include <rbd/librbd.h>
1438
1439int main(int argc, char **argv)
1440{
1441
1442 rados_t cluster;
1443 rados_ioctx_t io_ctx;
1444 const char pool[] = "rbd";
1445
1446 int major, minor, extra;
1447 rbd_version(&major, &minor, &extra);
1448
1449 rados_ioctx_create(cluster, pool, &io_ctx);
1450 return 0;
1451}
1452EOF
ce18290e 1453if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
fc5c0345
DG
1454 LIBS="-lrbd -lrados $LIBS"
1455 rbd="yes"
1456fi
1457echo "Rados Block Device engine $rbd"
1458
53b6c979
PL
1459##########################################
1460# check for rbd_poll
ca205a75
TK
1461if test "$rbd_poll" != "yes" ; then
1462 rbd_poll="no"
1463fi
53b6c979
PL
1464if test "$rbd" = "yes"; then
1465cat > $TMPC << EOF
1466#include <rbd/librbd.h>
1467#include <sys/eventfd.h>
1468
1469int main(int argc, char **argv)
1470{
1471 rbd_image_t image;
1472 rbd_completion_t comp;
1473
1474 int fd = eventfd(0, EFD_NONBLOCK);
1475 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1476 rbd_poll_io_events(image, comp, 1);
1477
1478 return 0;
1479}
1480EOF
1481if compile_prog "" "-lrbd -lrados" "rbd"; then
1482 rbd_poll="yes"
1483fi
1484echo "rbd_poll $rbd_poll"
1485fi
1486
903b2812
JA
1487##########################################
1488# check for rbd_invaidate_cache()
ca205a75
TK
1489if test "$rbd_inval" != "yes" ; then
1490 rbd_inval="no"
1491fi
903b2812
JA
1492if test "$rbd" = "yes"; then
1493cat > $TMPC << EOF
1494#include <rbd/librbd.h>
1495
1496int main(int argc, char **argv)
1497{
1498 rbd_image_t image;
1499
1500 return rbd_invalidate_cache(image);
1501}
1502EOF
1503if compile_prog "" "-lrbd -lrados" "rbd"; then
1504 rbd_inval="yes"
1505fi
1506echo "rbd_invalidate_cache $rbd_inval"
1507fi
1508
a4c4c346 1509##########################################
1510# check for blkin
ca205a75
TK
1511if test "$rbd_blkin" != "yes" ; then
1512 rbd_blkin="no"
1513fi
a4c4c346 1514cat > $TMPC << EOF
1515#include <rbd/librbd.h>
1516#include <zipkin_c.h>
1517
1518int main(int argc, char **argv)
1519{
1520 int r;
1521 struct blkin_trace_info t_info;
1522 blkin_init_trace_info(&t_info);
1523 rbd_completion_t completion;
1524 rbd_image_t image;
1525 uint64_t off;
1526 size_t len;
1527 const char *buf;
1528 r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
1529 return 0;
1530}
1531EOF
1532if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
1533 && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
1534 LIBS="-lblkin $LIBS"
1535 rbd_blkin="yes"
1536fi
1537echo "rbd blkin tracing $rbd_blkin"
1538
2e802282
JA
1539##########################################
1540# Check whether we have setvbuf
ca205a75
TK
1541if test "$setvbuf" != "yes" ; then
1542 setvbuf="no"
1543fi
2e802282
JA
1544cat > $TMPC << EOF
1545#include <stdio.h>
1546int main(int argc, char **argv)
1547{
1548 FILE *f = NULL;
1549 char buf[80];
1550 setvbuf(f, buf, _IOFBF, sizeof(buf));
1551 return 0;
1552}
1553EOF
1554if compile_prog "" "" "setvbuf"; then
1555 setvbuf="yes"
1556fi
1557echo "setvbuf $setvbuf"
fc5c0345 1558
6e7d7dfb 1559# check for gfapi
ca205a75
TK
1560if test "$gfapi" != "yes" ; then
1561 gfapi="no"
1562fi
6e7d7dfb 1563cat > $TMPC << EOF
1564#include <glusterfs/api/glfs.h>
1565
1566int main(int argc, char **argv)
1567{
1568
1569 glfs_t *g = glfs_new("foo");
1570
1571 return 0;
1572}
1573EOF
ce18290e 1574if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
6e7d7dfb 1575 LIBS="-lgfapi -lglusterfs $LIBS"
1576 gfapi="yes"
1577fi
6fa14b99 1578 echo "Gluster API engine $gfapi"
6e7d7dfb 1579
6fa14b99 1580##########################################
ca205a75 1581# check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
6876c98c 1582if test "$gfapi" = "yes" ; then
6fa14b99 1583gf_fadvise="no"
1584cat > $TMPC << EOF
1585#include <glusterfs/api/glfs.h>
1586
1587int main(int argc, char **argv)
1588{
1589 struct glfs_fd *fd;
1590 int ret = glfs_fadvise(fd, 0, 0, 1);
1591
1592 return 0;
1593}
1594EOF
6fa14b99 1595if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1596 gf_fadvise="yes"
1597fi
1598echo "Gluster API use fadvise $gf_fadvise"
6876c98c
JA
1599fi
1600
1601##########################################
1602# check for gfapi trim support
ca205a75
TK
1603if test "$gf_trim" != "yes" ; then
1604 gf_trim="no"
1605fi
6876c98c
JA
1606if test "$gfapi" = "yes" ; then
1607cat > $TMPC << EOF
1608#include <glusterfs/api/glfs.h>
1609
1610int main(int argc, char **argv)
1611{
1612 return glfs_discard_async(NULL, 0, 0);
1613}
1614EOF
1615if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1616 gf_trim="yes"
1617fi
1618echo "Gluster API trim support $gf_trim"
1619fi
fc5c0345 1620
81795ce3
CE
1621##########################################
1622# Check if we support stckf on s390
ca205a75
TK
1623if test "$s390_z196_facilities" != "yes" ; then
1624 s390_z196_facilities="no"
1625fi
81795ce3
CE
1626cat > $TMPC << EOF
1627#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1628int main(int argc, char **argv)
1629{
1630 /* We want just 1 double word to be returned. */
1631 register unsigned long reg0 asm("0") = 0;
1632 unsigned long stfle_bits;
1633 asm volatile(".machine push" "\n\t"
1634 ".machine \"z9-109\"" "\n\t"
1635 "stfle %0" "\n\t"
1636 ".machine pop" "\n"
1637 : "=QS" (stfle_bits), "+d" (reg0)
1638 : : "cc");
1639
1640 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1641 return 0;
1642 else
1643 return -1;
1644}
1645EOF
1646if compile_prog "" "" "s390_z196_facilities"; then
1647 $TMPE
1648 if [[ $? -eq 0 ]]; then
1649 s390_z196_facilities="yes"
1650 fi
1651fi
1652echo "s390_z196_facilities $s390_z196_facilities"
1b10477b
MM
1653
1654##########################################
1655# Check if we have required environment variables configured for libhdfs
1656if test "$libhdfs" = "yes" ; then
1657 hdfs_conf_error=0
1658 if test "$JAVA_HOME" = "" ; then
1659 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1660 hdfs_conf_error=1
1661 fi
1662 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1663 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1664 hdfs_conf_error=1
1665 fi
1666 if test "$FIO_LIBHDFS_LIB" = "" ; then
1667 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1668 hdfs_conf_error=1
1669 fi
1670 if test "$hdfs_conf_error" = "1" ; then
1671 exit 1
1672 fi
247e5436
JA
1673 FIO_HDFS_CPU=$cpu
1674 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1675 FIO_HDFS_CPU="amd64"
1676 fi
1b10477b
MM
1677fi
1678echo "HDFS engine $libhdfs"
1679
b8116a87
DE
1680##########################################
1681# Check whether we have MTD
ca205a75
TK
1682if test "$mtd" != "yes" ; then
1683 mtd="no"
1684fi
b8116a87 1685cat > $TMPC << EOF
0e1c454a 1686#include <string.h>
b8116a87
DE
1687#include <mtd/mtd-user.h>
1688#include <sys/ioctl.h>
1689int main(int argc, char **argv)
1690{
0e1c454a 1691 struct mtd_write_req ops;
b8116a87 1692 struct mtd_info_user info;
0e1c454a 1693 memset(&ops, 0, sizeof(ops));
400cd0ff 1694 info.type = MTD_MLCNANDFLASH;
b8116a87
DE
1695 return ioctl(0, MEMGETINFO, &info);
1696}
1697EOF
1698if compile_prog "" "" "mtd"; then
1699 mtd="yes"
1700fi
1701echo "MTD $mtd"
1702
3ee2a3c1
DJ
1703##########################################
1704# Check whether we have libpmem
ca205a75
TK
1705if test "$libpmem" != "yes" ; then
1706 libpmem="no"
1707fi
3ee2a3c1
DJ
1708cat > $TMPC << EOF
1709#include <libpmem.h>
1710int main(int argc, char **argv)
1711{
1712 int rc;
1713 rc = pmem_is_pmem(0, 0);
1714 return 0;
1715}
1716EOF
1717if compile_prog "" "-lpmem" "libpmem"; then
1718 libpmem="yes"
cf8775b8 1719 LIBS="-lpmem $LIBS"
3ee2a3c1
DJ
1720fi
1721echo "libpmem $libpmem"
1722
1723##########################################
1724# Check whether we have libpmemblk
cf8775b8 1725# libpmem is a prerequisite
ca205a75
TK
1726if test "$libpmemblk" != "yes" ; then
1727 libpmemblk="no"
1728fi
cf8775b8
RE
1729if test "$libpmem" = "yes"; then
1730 cat > $TMPC << EOF
3ee2a3c1
DJ
1731#include <libpmemblk.h>
1732int main(int argc, char **argv)
1733{
cf8775b8
RE
1734 PMEMblkpool *pbp;
1735 pbp = pmemblk_open("", 0);
3ee2a3c1
DJ
1736 return 0;
1737}
1738EOF
cf8775b8
RE
1739 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1740 libpmemblk="yes"
1741 LIBS="-lpmemblk $LIBS"
1742 fi
3ee2a3c1
DJ
1743fi
1744echo "libpmemblk $libpmemblk"
1745
cf8775b8 1746# Choose the ioengines
3ee2a3c1
DJ
1747if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1748 devdax="yes"
1749 if test "$libpmemblk" = "yes"; then
1750 pmemblk="yes"
1751 fi
1752fi
1753
43f3cec2
BB
1754##########################################
1755# Report whether pmemblk engine is enabled
cf8775b8 1756echo "NVML pmemblk engine $pmemblk"
43f3cec2 1757
cbb15e42
DJ
1758##########################################
1759# Report whether dev-dax engine is enabled
cf8775b8 1760echo "NVML dev-dax engine $devdax"
cbb15e42 1761
b470a02c
SC
1762# Check if we have lex/yacc available
1763yacc="no"
e7b2c7a3 1764yacc_is_bison="no"
b470a02c
SC
1765lex="no"
1766arith="no"
de26b824 1767if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
cf6dd80e 1768if test "$targetos" != "SunOS" ; then
e7b2c7a3 1769LEX=$(which lex 2> /dev/null)
b470a02c
SC
1770if test -x "$LEX" ; then
1771 lex="yes"
1772fi
7e0049e9 1773YACC=$(which bison 2> /dev/null)
b470a02c
SC
1774if test -x "$YACC" ; then
1775 yacc="yes"
7e0049e9 1776 yacc_is_bison="yes"
e7b2c7a3 1777else
7e0049e9 1778 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
1779 if test -x "$YACC" ; then
1780 yacc="yes"
e7b2c7a3 1781 fi
b470a02c
SC
1782fi
1783if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1784 arith="yes"
1785fi
1786
1787if test "$arith" = "yes" ; then
1788cat > $TMPC << EOF
1789extern int yywrap(void);
1790
1791int main(int argc, char **argv)
1792{
1793 yywrap();
1794 return 0;
1795}
1796EOF
719cda03
JA
1797if compile_prog "" "-ll" "lex"; then
1798 LIBS="-ll $LIBS"
b470a02c
SC
1799else
1800 arith="no"
1801fi
1802fi
cf6dd80e 1803fi
a655bbc4 1804fi
b470a02c 1805
63bda378
JA
1806# Check if lex fails using -o
1807if test "$arith" = "yes" ; then
daf705b5
JA
1808if test "$force_no_lex_o" = "yes" ; then
1809 lex_use_o="no"
1810else
63bda378
JA
1811$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1812if test "$?" = "0" ; then
1813 lex_use_o="yes"
1814else
1815 lex_use_o="no"
1816fi
1817fi
daf705b5 1818fi
63bda378 1819
b470a02c
SC
1820echo "lex/yacc for arithmetic $arith"
1821
aae599ba
JA
1822##########################################
1823# Check whether we have setmntent/getmntent
ca205a75
TK
1824if test "$getmntent" != "yes" ; then
1825 getmntent="no"
1826fi
aae599ba
JA
1827cat > $TMPC << EOF
1828#include <stdio.h>
1829#include <mntent.h>
1830int main(int argc, char **argv)
1831{
1832 FILE *mtab = setmntent(NULL, "r");
1833 struct mntent *mnt = getmntent(mtab);
1581b82a 1834 endmntent(mtab);
aae599ba
JA
1835 return 0;
1836}
1837EOF
1838if compile_prog "" "" "getmntent"; then
1839 getmntent="yes"
1840fi
1841echo "getmntent $getmntent"
1842
e7e136da
TK
1843##########################################
1844# Check whether we have getmntinfo
b765bec0
TK
1845# These are originally added for BSDs, but may also work
1846# on other operating systems with getmntinfo(3).
1847
1848# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1849# Note that NetBSD needs -Werror to catch warning as error.
ca205a75
TK
1850if test "$getmntinfo" != "yes" ; then
1851 getmntinfo="no"
1852fi
e7e136da
TK
1853cat > $TMPC << EOF
1854#include <stdio.h>
1855#include <sys/param.h>
1856#include <sys/mount.h>
1857int main(int argc, char **argv)
1858{
9ada751d 1859 struct statfs *st;
e7e136da
TK
1860 return getmntinfo(&st, MNT_NOWAIT);
1861}
1862EOF
b765bec0 1863if compile_prog "-Werror" "" "getmntinfo"; then
e7e136da
TK
1864 getmntinfo="yes"
1865fi
1866echo "getmntinfo $getmntinfo"
1867
b765bec0 1868# getmntinfo(3) for NetBSD.
ca205a75
TK
1869if test "$getmntinfo_statvfs" != "yes" ; then
1870 getmntinfo_statvfs="no"
1871fi
b765bec0
TK
1872cat > $TMPC << EOF
1873#include <stdio.h>
1874#include <sys/statvfs.h>
1875int main(int argc, char **argv)
1876{
1877 struct statvfs *st;
1878 return getmntinfo(&st, MNT_NOWAIT);
1879}
1880EOF
1881# Skip the test if the one with statfs arg is detected.
1882if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1883 getmntinfo_statvfs="yes"
1884 echo "getmntinfo_statvfs $getmntinfo_statvfs"
1885fi
1886
5018f79f
AH
1887##########################################
1888# Check whether we have _Static_assert
ca205a75
TK
1889if test "$static_assert" != "yes" ; then
1890 static_assert="no"
1891fi
5018f79f
AH
1892cat > $TMPC << EOF
1893#include <assert.h>
94815a5c
JA
1894#include <stdlib.h>
1895#undef offsetof
1896#ifdef __compiler_offsetof
1897#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1898#else
1899#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1900#endif
1901
1902#define container_of(ptr, type, member) ({ \
1903 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
1904 (type *)( (char *)__mptr - offsetof(type,member) );})
1905
1906struct foo {
1907 int a, b;
1908};
1909
5018f79f
AH
1910int main(int argc, char **argv)
1911{
94815a5c 1912 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
5018f79f
AH
1913 return 0 ;
1914}
1915EOF
1916if compile_prog "" "" "static_assert"; then
1917 static_assert="yes"
1918fi
1919echo "Static Assert $static_assert"
e39c0676
JA
1920
1921##########################################
1922# Check whether we have bool / stdbool.h
ca205a75
TK
1923if test "$have_bool" != "yes" ; then
1924 have_bool="no"
1925fi
e39c0676
JA
1926cat > $TMPC << EOF
1927#include <stdbool.h>
1928int main(int argc, char **argv)
1929{
1930 bool var = true;
1931 return var != false;
1932}
1933EOF
1934if compile_prog "" "" "bool"; then
1935 have_bool="yes"
1936fi
1937echo "bool $have_bool"
1938
214e2d56 1939##########################################
1940# check march=armv8-a+crc+crypto
ca205a75
TK
1941if test "$march_armv8_a_crc_crypto" != "yes" ; then
1942 march_armv8_a_crc_crypto="no"
1943fi
214e2d56 1944if test "$cpu" = "arm64" ; then
1945 cat > $TMPC <<EOF
1946int main(void)
1947{
1948 return 0;
1949}
1950EOF
1951 if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
1952 march_armv8_a_crc_crypto="yes"
1953 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
1954 fi
1955fi
1956echo "march_armv8_a_crc_crypto $march_armv8_a_crc_crypto"
1957
1958
67bf9823
JA
1959#############################################################################
1960
67bf9823 1961if test "$wordsize" = "64" ; then
4feafb1e 1962 output_sym "CONFIG_64BIT"
67bf9823 1963elif test "$wordsize" = "32" ; then
4feafb1e 1964 output_sym "CONFIG_32BIT"
67bf9823 1965else
d7145a78 1966 fatal "Unknown wordsize!"
67bf9823 1967fi
0dcebdf4 1968if test "$bigendian" = "yes" ; then
4feafb1e 1969 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 1970else
4feafb1e 1971 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 1972fi
3989b143
JA
1973if test "$zlib" = "yes" ; then
1974 output_sym "CONFIG_ZLIB"
1975fi
67bf9823 1976if test "$libaio" = "yes" ; then
4feafb1e 1977 output_sym "CONFIG_LIBAIO"
67bf9823
JA
1978fi
1979if test "$posix_aio" = "yes" ; then
4feafb1e 1980 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
1981fi
1982if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 1983 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823
JA
1984fi
1985if test "$linux_fallocate" = "yes" ; then
4feafb1e 1986 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
1987fi
1988if test "$posix_fallocate" = "yes" ; then
4feafb1e 1989 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
1990fi
1991if test "$fdatasync" = "yes" ; then
4feafb1e 1992 output_sym "CONFIG_FDATASYNC"
67bf9823
JA
1993fi
1994if test "$sync_file_range" = "yes" ; then
4feafb1e 1995 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
1996fi
1997if test "$sfaa" = "yes" ; then
4feafb1e 1998 output_sym "CONFIG_SFAA"
67bf9823 1999fi
954cd73a 2000if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 2001 output_sym "CONFIG_RDMA"
67bf9823
JA
2002fi
2003if test "$clock_gettime" = "yes" ; then
4feafb1e 2004 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
2005fi
2006if test "$clock_monotonic" = "yes" ; then
4feafb1e 2007 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823 2008fi
c544f604
SN
2009if test "$clock_monotonic_raw" = "yes" ; then
2010 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2011fi
67bf9823 2012if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 2013 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823 2014fi
25f8227d
JA
2015if test "$clockid_t" = "yes"; then
2016 output_sym "CONFIG_CLOCKID_T"
2017fi
67bf9823 2018if test "$gettimeofday" = "yes" ; then
4feafb1e 2019 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
2020fi
2021if test "$posix_fadvise" = "yes" ; then
4feafb1e 2022 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
2023fi
2024if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 2025 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 2026elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 2027 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
2028fi
2029if test "$strsep" = "yes" ; then
4feafb1e 2030 output_sym "CONFIG_STRSEP"
67bf9823 2031fi
9ad8da82
JA
2032if test "$strcasestr" = "yes" ; then
2033 output_sym "CONFIG_STRCASESTR"
2034fi
5ad7be56
KD
2035if test "$strlcat" = "yes" ; then
2036 output_sym "CONFIG_STRLCAT"
2037fi
67bf9823 2038if test "$getopt_long_only" = "yes" ; then
4feafb1e 2039 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
2040fi
2041if test "$inet_aton" = "yes" ; then
4feafb1e 2042 output_sym "CONFIG_INET_ATON"
67bf9823
JA
2043fi
2044if test "$socklen_t" = "yes" ; then
4feafb1e 2045 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
2046fi
2047if test "$ext4_me" = "yes" ; then
4feafb1e 2048 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
2049fi
2050if test "$linux_splice" = "yes" ; then
4feafb1e 2051 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
2052fi
2053if test "$guasi" = "yes" ; then
4feafb1e 2054 output_sym "CONFIG_GUASI"
67bf9823
JA
2055fi
2056if test "$fusion_aw" = "yes" ; then
4feafb1e 2057 output_sym "CONFIG_FUSION_AW"
67bf9823 2058fi
50206d9b 2059if test "$libnuma_v2" = "yes" ; then
4feafb1e 2060 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
2061fi
2062if test "$solaris_aio" = "yes" ; then
4feafb1e 2063 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
2064fi
2065if test "$tls_thread" = "yes" ; then
4feafb1e 2066 output_sym "CONFIG_TLS_THREAD"
67bf9823 2067fi
44404c5a 2068if test "$rusage_thread" = "yes" ; then
4feafb1e 2069 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 2070fi
91f94d5b
JA
2071if test "$gfio" = "yes" ; then
2072 echo "CONFIG_GFIO=y" >> $config_host_mak
2073fi
c8931876
JA
2074if test "$esx" = "yes" ; then
2075 output_sym "CONFIG_ESX"
2076 output_sym "CONFIG_NO_SHM"
2077fi
7e09a9f1
JA
2078if test "$sched_idle" = "yes" ; then
2079 output_sym "CONFIG_SCHED_IDLE"
2080fi
1eafa37a
JA
2081if test "$tcp_nodelay" = "yes" ; then
2082 output_sym "CONFIG_TCP_NODELAY"
2083fi
1008602c
JA
2084if test "$window_size" = "yes" ; then
2085 output_sym "CONFIG_NET_WINDOWSIZE"
2086fi
e5f34d95
JA
2087if test "$mss" = "yes" ; then
2088 output_sym "CONFIG_NET_MSS"
2089fi
38b9354a
JA
2090if test "$rlimit_memlock" = "yes" ; then
2091 output_sym "CONFIG_RLIMIT_MEMLOCK"
2092fi
07fc0acd
JA
2093if test "$pwritev" = "yes" ; then
2094 output_sym "CONFIG_PWRITEV"
2095fi
2cafffbe
JA
2096if test "$pwritev2" = "yes" ; then
2097 output_sym "CONFIG_PWRITEV2"
2098fi
ecad55e9
JA
2099if test "$ipv6" = "yes" ; then
2100 output_sym "CONFIG_IPV6"
2101fi
fc5c0345
DG
2102if test "$rbd" = "yes" ; then
2103 output_sym "CONFIG_RBD"
2104fi
53b6c979
PL
2105if test "$rbd_poll" = "yes" ; then
2106 output_sym "CONFIG_RBD_POLL"
2107fi
903b2812
JA
2108if test "$rbd_inval" = "yes" ; then
2109 output_sym "CONFIG_RBD_INVAL"
2110fi
a4c4c346 2111if test "$rbd_blkin" = "yes" ; then
2112 output_sym "CONFIG_RBD_BLKIN"
2113fi
2e802282
JA
2114if test "$setvbuf" = "yes" ; then
2115 output_sym "CONFIG_SETVBUF"
2116fi
81795ce3
CE
2117if test "$s390_z196_facilities" = "yes" ; then
2118 output_sym "CONFIG_S390_Z196_FACILITIES"
2119 CFLAGS="$CFLAGS -march=z9-109"
2120fi
6e7d7dfb 2121if test "$gfapi" = "yes" ; then
2122 output_sym "CONFIG_GFAPI"
2123fi
6fa14b99 2124if test "$gf_fadvise" = "yes" ; then
2125 output_sym "CONFIG_GF_FADVISE"
2126fi
6876c98c
JA
2127if test "$gf_trim" = "yes" ; then
2128 output_sym "CONFIG_GF_TRIM"
2129fi
1b10477b
MM
2130if test "$libhdfs" = "yes" ; then
2131 output_sym "CONFIG_LIBHDFS"
247e5436 2132 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
1527dc50
FB
2133 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2134 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2135 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2136 fi
b8116a87
DE
2137if test "$mtd" = "yes" ; then
2138 output_sym "CONFIG_MTD"
2139fi
43f3cec2
BB
2140if test "$pmemblk" = "yes" ; then
2141 output_sym "CONFIG_PMEMBLK"
2142fi
cbb15e42
DJ
2143if test "$devdax" = "yes" ; then
2144 output_sym "CONFIG_LINUX_DEVDAX"
2145fi
b470a02c
SC
2146if test "$arith" = "yes" ; then
2147 output_sym "CONFIG_ARITHMETIC"
e7b2c7a3
JA
2148 if test "$yacc_is_bison" = "yes" ; then
2149 echo "YACC=$YACC -y" >> $config_host_mak
2150 else
2151 echo "YACC=$YACC" >> $config_host_mak
2152 fi
63bda378
JA
2153 if test "$lex_use_o" = "yes" ; then
2154 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2155 fi
b470a02c 2156fi
aae599ba
JA
2157if test "$getmntent" = "yes" ; then
2158 output_sym "CONFIG_GETMNTENT"
2159fi
e7e136da
TK
2160if test "$getmntinfo" = "yes" ; then
2161 output_sym "CONFIG_GETMNTINFO"
2162fi
b765bec0
TK
2163if test "$getmntinfo_statvfs" = "yes" ; then
2164 output_sym "CONFIG_GETMNTINFO_STATVFS"
2165fi
5018f79f
AH
2166if test "$static_assert" = "yes" ; then
2167 output_sym "CONFIG_STATIC_ASSERT"
2168fi
e39c0676
JA
2169if test "$have_bool" = "yes" ; then
2170 output_sym "CONFIG_HAVE_BOOL"
2171fi
484817a9
JA
2172if test "$disable_opt" = "yes" ; then
2173 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2174fi
67bf9823 2175
605cf82e
JA
2176if test "$zlib" = "no" ; then
2177 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
2178fi
2179
67bf9823 2180echo "LIBS+=$LIBS" >> $config_host_mak
86719845 2181echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 2182echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 2183echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 2184echo "CC=$cc" >> $config_host_mak
af4862b3 2185echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 2186echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
c61a3a44 2187
59d8f412 2188if [ `dirname $0` != "." -a ! -e Makefile ]; then
c61a3a44
JF
2189 cat > Makefile <<EOF
2190SRCDIR:=`dirname $0`
2191include \$(SRCDIR)/Makefile
2192EOF
2193fi