Replace redundant TD_F_NOIO flag with td->io_ops_init
[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
06eac6b2
SW
607##########################################
608# POSIX pshared attribute probe
609posix_pshared="no"
610cat > $TMPC <<EOF
611#include <unistd.h>
612int main(void)
613{
614#if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
615# if defined(__CYGWIN__)
616# error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
617# elif defined(__APPLE__)
618# include <AvailabilityMacros.h>
619# include <TargetConditionals.h>
620# if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
621# error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
622# endif
623# endif
624#else
625# error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
626#endif
627 return 0;
628}
629EOF
630if compile_prog "" "$LIBS" "posix_pshared" ; then
631 posix_pshared=yes
632fi
633echo "POSIX pshared support $posix_pshared"
634
67bf9823
JA
635##########################################
636# solaris aio probe
ca205a75
TK
637if test "$solaris_aio" != "yes" ; then
638 solaris_aio="no"
639fi
67bf9823
JA
640cat > $TMPC <<EOF
641#include <sys/types.h>
642#include <sys/asynch.h>
643#include <unistd.h>
644int main(void)
645{
646 aio_result_t res;
647 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
648 return 0;
649}
650EOF
651if compile_prog "" "-laio" "solarisaio" ; then
652 solaris_aio=yes
653 LIBS="-laio $LIBS"
654fi
655echo "Solaris AIO support $solaris_aio"
656
657##########################################
f5cd2907 658# __sync_fetch_and_add test
ca205a75
TK
659if test "$sfaa" != "yes" ; then
660 sfaa="no"
661fi
67bf9823 662cat > $TMPC << EOF
958886d8
JA
663#include <inttypes.h>
664static int sfaa(uint64_t *ptr)
67bf9823 665{
9c639a76 666 return __sync_fetch_and_add(ptr, 0);
67bf9823
JA
667}
668
669int main(int argc, char **argv)
670{
958886d8 671 uint64_t val = 42;
67bf9823
JA
672 sfaa(&val);
673 return val;
674}
675EOF
676if compile_prog "" "" "__sync_fetch_and_add()" ; then
677 sfaa="yes"
678fi
9c639a76 679echo "__sync_fetch_and_add $sfaa"
67bf9823
JA
680
681##########################################
682# libverbs probe
ca205a75
TK
683if test "$libverbs" != "yes" ; then
684 libverbs="no"
685fi
67bf9823
JA
686cat > $TMPC << EOF
687#include <stdio.h>
688#include <infiniband/arch.h>
689int main(int argc, char **argv)
690{
691 struct ibv_pd *pd = ibv_alloc_pd(NULL);
692 return 0;
693}
694EOF
695if compile_prog "" "-libverbs" "libverbs" ; then
696 libverbs="yes"
697 LIBS="-libverbs $LIBS"
698fi
699echo "libverbs $libverbs"
700
701##########################################
702# rdmacm probe
ca205a75
TK
703if test "$rdmacm" != "yes" ; then
704 rdmacm="no"
705fi
67bf9823
JA
706cat > $TMPC << EOF
707#include <stdio.h>
708#include <rdma/rdma_cma.h>
709int main(int argc, char **argv)
710{
711 rdma_destroy_qp(NULL);
712 return 0;
713}
714EOF
715if compile_prog "" "-lrdmacm" "rdma"; then
716 rdmacm="yes"
717 LIBS="-lrdmacm $LIBS"
718fi
719echo "rdmacm $rdmacm"
720
721##########################################
722# Linux fallocate probe
ca205a75
TK
723if test "$linux_fallocate" != "yes" ; then
724 linux_fallocate="no"
725fi
67bf9823
JA
726cat > $TMPC << EOF
727#include <stdio.h>
aa6738a5 728#include <fcntl.h>
67bf9823
JA
729#include <linux/falloc.h>
730int main(int argc, char **argv)
731{
732 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
733 return r;
734}
735EOF
736if compile_prog "" "" "linux_fallocate"; then
737 linux_fallocate="yes"
738fi
739echo "Linux fallocate $linux_fallocate"
740
741##########################################
742# POSIX fadvise probe
ca205a75
TK
743if test "$posix_fadvise" != "yes" ; then
744 posix_fadvise="no"
745fi
67bf9823
JA
746cat > $TMPC << EOF
747#include <stdio.h>
748#include <fcntl.h>
749int main(int argc, char **argv)
750{
751 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
752 return r;
753}
754EOF
755if compile_prog "" "" "posix_fadvise"; then
756 posix_fadvise="yes"
757fi
758echo "POSIX fadvise $posix_fadvise"
759
760##########################################
761# POSIX fallocate probe
ca205a75
TK
762if test "$posix_fallocate" != "yes" ; then
763 posix_fallocate="no"
764fi
67bf9823
JA
765cat > $TMPC << EOF
766#include <stdio.h>
767#include <fcntl.h>
768int main(int argc, char **argv)
769{
770 int r = posix_fallocate(0, 0, 1024);
771 return r;
772}
773EOF
774if compile_prog "" "" "posix_fallocate"; then
775 posix_fallocate="yes"
776fi
777echo "POSIX fallocate $posix_fallocate"
778
779##########################################
780# sched_set/getaffinity 2 or 3 argument test
ca205a75
TK
781if test "$linux_2arg_affinity" != "yes" ; then
782 linux_2arg_affinity="no"
783fi
784if test "$linux_3arg_affinity" != "yes" ; then
785 linux_3arg_affinity="no"
786fi
67bf9823 787cat > $TMPC << EOF
67bf9823
JA
788#include <sched.h>
789int main(int argc, char **argv)
790{
791 cpu_set_t mask;
792 return sched_setaffinity(0, sizeof(mask), &mask);
793}
794EOF
795if compile_prog "" "" "sched_setaffinity(,,)"; then
796 linux_3arg_affinity="yes"
797else
798 cat > $TMPC << EOF
67bf9823
JA
799#include <sched.h>
800int main(int argc, char **argv)
801{
802 cpu_set_t mask;
803 return sched_setaffinity(0, &mask);
804}
805EOF
806 if compile_prog "" "" "sched_setaffinity(,)"; then
807 linux_2arg_affinity="yes"
808 fi
809fi
810echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
811echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
812
813##########################################
814# clock_gettime probe
ca205a75
TK
815if test "$clock_gettime" != "yes" ; then
816 clock_gettime="no"
817fi
67bf9823
JA
818cat > $TMPC << EOF
819#include <stdio.h>
820#include <time.h>
821int main(int argc, char **argv)
822{
823 return clock_gettime(0, NULL);
824}
825EOF
826if compile_prog "" "" "clock_gettime"; then
827 clock_gettime="yes"
828elif compile_prog "" "-lrt" "clock_gettime"; then
829 clock_gettime="yes"
830 LIBS="-lrt $LIBS"
831fi
832echo "clock_gettime $clock_gettime"
833
834##########################################
835# CLOCK_MONOTONIC probe
ca205a75
TK
836if test "$clock_monotonic" != "yes" ; then
837 clock_monotonic="no"
838fi
67bf9823
JA
839if test "$clock_gettime" = "yes" ; then
840 cat > $TMPC << EOF
841#include <stdio.h>
842#include <time.h>
843int main(int argc, char **argv)
844{
845 return clock_gettime(CLOCK_MONOTONIC, NULL);
846}
847EOF
848 if compile_prog "" "$LIBS" "clock monotonic"; then
849 clock_monotonic="yes"
850 fi
851fi
852echo "CLOCK_MONOTONIC $clock_monotonic"
853
c544f604
SN
854##########################################
855# CLOCK_MONOTONIC_RAW probe
ca205a75
TK
856if test "$clock_monotonic_raw" != "yes" ; then
857 clock_monotonic_raw="no"
858fi
c544f604
SN
859if test "$clock_gettime" = "yes" ; then
860 cat > $TMPC << EOF
861#include <stdio.h>
862#include <time.h>
863int main(int argc, char **argv)
864{
865 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
866}
867EOF
868 if compile_prog "" "$LIBS" "clock monotonic"; then
869 clock_monotonic_raw="yes"
870 fi
871fi
872echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
873
67bf9823
JA
874##########################################
875# CLOCK_MONOTONIC_PRECISE probe
ca205a75
TK
876if test "$clock_monotonic_precise" != "yes" ; then
877 clock_monotonic_precise="no"
878fi
67bf9823
JA
879if test "$clock_gettime" = "yes" ; then
880 cat > $TMPC << EOF
881#include <stdio.h>
882#include <time.h>
883int main(int argc, char **argv)
884{
885 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
886}
887EOF
888 if compile_prog "" "$LIBS" "clock monotonic precise"; then
889 clock_monotonic_precise="yes"
890 fi
891fi
892echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
893
25f8227d
JA
894##########################################
895# clockid_t probe
ca205a75
TK
896if test "$clockid_t" != "yes" ; then
897 clockid_t="no"
898fi
25f8227d 899cat > $TMPC << EOF
25f8227d
JA
900#include <time.h>
901int main(int argc, char **argv)
902{
ccf2d89d 903 volatile clockid_t cid;
a214d131 904 memset(&cid, 0, sizeof(cid));
ccf2d89d 905 return 0;
25f8227d
JA
906}
907EOF
908if compile_prog "" "$LIBS" "clockid_t"; then
909 clockid_t="yes"
910fi
911echo "clockid_t $clockid_t"
912
67bf9823
JA
913##########################################
914# gettimeofday() probe
ca205a75
TK
915if test "$gettimeofday" != "yes" ; then
916 gettimeofday="no"
917fi
67bf9823
JA
918cat > $TMPC << EOF
919#include <sys/time.h>
920#include <stdio.h>
921int main(int argc, char **argv)
922{
923 struct timeval tv;
924 return gettimeofday(&tv, NULL);
925}
926EOF
927if compile_prog "" "" "gettimeofday"; then
928 gettimeofday="yes"
929fi
930echo "gettimeofday $gettimeofday"
931
932##########################################
933# fdatasync() probe
ca205a75
TK
934if test "$fdatasync" != "yes" ; then
935 fdatasync="no"
936fi
67bf9823
JA
937cat > $TMPC << EOF
938#include <stdio.h>
939#include <unistd.h>
940int main(int argc, char **argv)
941{
942 return fdatasync(0);
943}
944EOF
945if compile_prog "" "" "fdatasync"; then
946 fdatasync="yes"
947fi
948echo "fdatasync $fdatasync"
949
950##########################################
951# sync_file_range() probe
ca205a75
TK
952if test "$sync_file_range" != "yes" ; then
953 sync_file_range="no"
954fi
67bf9823
JA
955cat > $TMPC << EOF
956#include <stdio.h>
957#include <unistd.h>
67bf9823
JA
958#include <fcntl.h>
959#include <linux/fs.h>
960int main(int argc, char **argv)
961{
962 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
963 SYNC_FILE_RANGE_WAIT_AFTER;
964 return sync_file_range(0, 0, 0, flags);
965}
966EOF
967if compile_prog "" "" "sync_file_range"; then
968 sync_file_range="yes"
969fi
970echo "sync_file_range $sync_file_range"
971
972##########################################
973# ext4 move extent probe
ca205a75
TK
974if test "$ext4_me" != "yes" ; then
975 ext4_me="no"
976fi
67bf9823
JA
977cat > $TMPC << EOF
978#include <fcntl.h>
979#include <sys/ioctl.h>
980int main(int argc, char **argv)
981{
982 struct move_extent me;
983 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
984}
985EOF
c7165b8d
JA
986if compile_prog "" "" "ext4 move extent" ; then
987 ext4_me="yes"
988elif test $targetos = "Linux" ; then
989 # On Linux, just default to it on and let it error at runtime if we really
990 # don't have it. None of my updated systems have it defined, but it does
991 # work. Takes a while to bubble back.
67bf9823
JA
992 ext4_me="yes"
993fi
994echo "EXT4 move extent $ext4_me"
995
996##########################################
997# splice probe
ca205a75
TK
998if test "$linux_splice" != "yes" ; then
999 linux_splice="no"
1000fi
67bf9823 1001cat > $TMPC << EOF
67bf9823
JA
1002#include <stdio.h>
1003#include <fcntl.h>
1004int main(int argc, char **argv)
1005{
1006 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1007}
1008EOF
1009if compile_prog "" "" "linux splice"; then
1010 linux_splice="yes"
1011fi
1012echo "Linux splice(2) $linux_splice"
1013
1014##########################################
1015# GUASI probe
ca205a75
TK
1016if test "$guasi" != "yes" ; then
1017 guasi="no"
1018fi
67bf9823
JA
1019cat > $TMPC << EOF
1020#include <guasi.h>
1021#include <guasi_syscalls.h>
1022int main(int argc, char **argv)
1023{
1024 guasi_t ctx = guasi_create(0, 0, 0);
1025 return 0;
1026}
1027EOF
1028if compile_prog "" "" "guasi"; then
1029 guasi="yes"
1030fi
1031echo "GUASI $guasi"
1032
1033##########################################
1034# fusion-aw probe
ca205a75
TK
1035if test "$fusion_aw" != "yes" ; then
1036 fusion_aw="no"
1037fi
67bf9823 1038cat > $TMPC << EOF
b2c77c25 1039#include <nvm/nvm_primitives.h>
67bf9823
JA
1040int main(int argc, char **argv)
1041{
b2c77c25
SK
1042 nvm_version_t ver_info;
1043 nvm_handle_t handle;
1044
1045 handle = nvm_get_handle(0, &ver_info);
1046 return nvm_atomic_write(handle, 0, 0, 0);
67bf9823
JA
1047}
1048EOF
92aef550
ARJ
1049if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1050 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
67bf9823
JA
1051 fusion_aw="yes"
1052fi
1053echo "Fusion-io atomic engine $fusion_aw"
1054
1055##########################################
1056# libnuma probe
ca205a75
TK
1057if test "$libnuma" != "yes" ; then
1058 libnuma="no"
1059fi
67bf9823
JA
1060cat > $TMPC << EOF
1061#include <numa.h>
1062int main(int argc, char **argv)
1063{
1064 return numa_available();
1065}
1066EOF
44462517 1067if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
67bf9823
JA
1068 libnuma="yes"
1069 LIBS="-lnuma $LIBS"
1070fi
1071echo "libnuma $libnuma"
1072
50206d9b 1073##########################################
ca205a75 1074# libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
50206d9b
JA
1075if test "$libnuma" = "yes" ; then
1076libnuma_v2="no"
1077cat > $TMPC << EOF
1078#include <numa.h>
1079int main(int argc, char **argv)
1080{
1081 struct bitmask *mask = numa_parse_nodestring(NULL);
61bde962 1082 return mask->size == 0;
50206d9b
JA
1083}
1084EOF
1085if compile_prog "" "" "libnuma api"; then
1086 libnuma_v2="yes"
1087fi
1088echo "libnuma v2 $libnuma_v2"
1089fi
1090
67bf9823
JA
1091##########################################
1092# strsep() probe
ca205a75
TK
1093if test "$strsep" != "yes" ; then
1094 strsep="no"
1095fi
67bf9823
JA
1096cat > $TMPC << EOF
1097#include <string.h>
1098int main(int argc, char **argv)
1099{
ae156be6
JA
1100 static char *string = "This is a string";
1101 strsep(&string, "needle");
67bf9823
JA
1102 return 0;
1103}
1104EOF
1105if compile_prog "" "" "strsep"; then
1106 strsep="yes"
1107fi
1108echo "strsep $strsep"
1109
9ad8da82
JA
1110##########################################
1111# strcasestr() probe
ca205a75
TK
1112if test "$strcasestr" != "yes" ; then
1113 strcasestr="no"
1114fi
9ad8da82
JA
1115cat > $TMPC << EOF
1116#include <string.h>
1117int main(int argc, char **argv)
1118{
aa6738a5 1119 return strcasestr(argv[0], argv[1]) != NULL;
9ad8da82
JA
1120}
1121EOF
1122if compile_prog "" "" "strcasestr"; then
1123 strcasestr="yes"
1124fi
1125echo "strcasestr $strcasestr"
1126
5ad7be56
KD
1127##########################################
1128# strlcat() probe
ca205a75
TK
1129if test "$strlcat" != "yes" ; then
1130 strlcat="no"
1131fi
5ad7be56
KD
1132cat > $TMPC << EOF
1133#include <string.h>
1134int main(int argc, char **argv)
1135{
1136 static char dst[64];
1137 static char *string = "This is a string";
1138 memset(dst, 0, sizeof(dst));
1139 strlcat(dst, string, sizeof(dst));
1140 return 0;
1141}
1142EOF
1143if compile_prog "" "" "strlcat"; then
1144 strlcat="yes"
1145fi
1146echo "strlcat $strlcat"
1147
67bf9823
JA
1148##########################################
1149# getopt_long_only() probe
ca205a75
TK
1150if test "$getopt_long_only" != "yes" ; then
1151 getopt_long_only="no"
1152fi
67bf9823
JA
1153cat > $TMPC << EOF
1154#include <unistd.h>
1155#include <stdio.h>
aa6738a5 1156#include <getopt.h>
67bf9823
JA
1157int main(int argc, char **argv)
1158{
1159 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1160 return c;
1161}
1162EOF
1163if compile_prog "" "" "getopt_long_only"; then
1164 getopt_long_only="yes"
1165fi
1166echo "getopt_long_only() $getopt_long_only"
1167
1168##########################################
1169# inet_aton() probe
ca205a75
TK
1170if test "$inet_aton" != "yes" ; then
1171 inet_aton="no"
1172fi
67bf9823
JA
1173cat > $TMPC << EOF
1174#include <sys/socket.h>
1175#include <arpa/inet.h>
1176#include <stdio.h>
1177int main(int argc, char **argv)
1178{
1179 struct in_addr in;
1180 return inet_aton(NULL, &in);
1181}
1182EOF
1183if compile_prog "" "" "inet_aton"; then
1184 inet_aton="yes"
1185fi
1186echo "inet_aton $inet_aton"
1187
1188##########################################
1189# socklen_t probe
ca205a75
TK
1190if test "$socklen_t" != "yes" ; then
1191 socklen_t="no"
1192fi
67bf9823 1193cat > $TMPC << EOF
f6482613 1194#include <sys/socket.h>
67bf9823
JA
1195int main(int argc, char **argv)
1196{
1197 socklen_t len = 0;
1198 return len;
1199}
1200EOF
1201if compile_prog "" "" "socklen_t"; then
1202 socklen_t="yes"
1203fi
1204echo "socklen_t $socklen_t"
1205
1206##########################################
1207# Whether or not __thread is supported for TLS
ca205a75
TK
1208if test "$tls_thread" != "yes" ; then
1209 tls_thread="no"
1210fi
67bf9823
JA
1211cat > $TMPC << EOF
1212#include <stdio.h>
aa6738a5 1213static __thread int ret;
67bf9823
JA
1214int main(int argc, char **argv)
1215{
1216 return ret;
1217}
1218EOF
1219if compile_prog "" "" "__thread"; then
1220 tls_thread="yes"
1221fi
1222echo "__thread $tls_thread"
1223
91f94d5b 1224##########################################
2639f056 1225# Check if we have required gtk/glib support for gfio
ca205a75
TK
1226if test "$gfio" != "yes" ; then
1227 gfio="no"
1228fi
ebec2094 1229if test "$gfio_check" = "yes" ; then
91f94d5b
JA
1230 cat > $TMPC << EOF
1231#include <glib.h>
1232#include <cairo.h>
1233#include <gtk/gtk.h>
1234int main(void)
1235{
1236 gdk_threads_enter();
91f94d5b 1237 gdk_threads_leave();
b7a99316
JA
1238
1239 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
91f94d5b
JA
1240}
1241EOF
1242GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
86719845
JA
1243ORG_LDFLAGS=$LDFLAGS
1244LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
91f94d5b
JA
1245if test "$?" != "0" ; then
1246 echo "configure: gtk and gthread not found"
1247 exit 1
1248fi
1249GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1250if test "$?" != "0" ; then
1251 echo "configure: gtk and gthread not found"
1252 exit 1
1253fi
b7a99316
JA
1254if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1255 r=$($TMPE)
1256 if test "$r" != "0" ; then
1257 gfio="yes"
86719845 1258 GFIO_LIBS="$LIBS $GTK_LIBS"
b7a99316
JA
1259 CFLAGS="$CFLAGS $GTK_CFLAGS"
1260 else
1261 echo "GTK found, but need version 2.18 or higher"
1262 gfio="no"
1263 fi
91f94d5b
JA
1264else
1265 echo "Please install gtk and gdk libraries"
1266 gfio="no"
1267fi
86719845 1268LDFLAGS=$ORG_LDFLAGS
91f94d5b
JA
1269fi
1270
ebec2094
JA
1271if test "$gfio_check" = "yes" ; then
1272 echo "gtk 2.18 or higher $gfio"
1273fi
91f94d5b 1274
44404c5a 1275# Check whether we have getrusage(RUSAGE_THREAD)
ca205a75
TK
1276if test "$rusage_thread" != "yes" ; then
1277 rusage_thread="no"
1278fi
44404c5a
JA
1279cat > $TMPC << EOF
1280#include <sys/time.h>
1281#include <sys/resource.h>
1282int main(int argc, char **argv)
1283{
1284 struct rusage ru;
1285 getrusage(RUSAGE_THREAD, &ru);
1286 return 0;
1287}
1288EOF
1289if compile_prog "" "" "RUSAGE_THREAD"; then
1290 rusage_thread="yes"
1291fi
1292echo "RUSAGE_THREAD $rusage_thread"
1293
7e09a9f1
JA
1294##########################################
1295# Check whether we have SCHED_IDLE
ca205a75
TK
1296if test "$sched_idle" != "yes" ; then
1297 sched_idle="no"
1298fi
7e09a9f1
JA
1299cat > $TMPC << EOF
1300#include <sched.h>
1301int main(int argc, char **argv)
1302{
1303 struct sched_param p;
1304 return sched_setscheduler(0, SCHED_IDLE, &p);
1305}
1306EOF
1307if compile_prog "" "" "SCHED_IDLE"; then
1308 sched_idle="yes"
1309fi
1310echo "SCHED_IDLE $sched_idle"
1311
1eafa37a
JA
1312##########################################
1313# Check whether we have TCP_NODELAY
ca205a75
TK
1314if test "$tcp_nodelay" != "yes" ; then
1315 tcp_nodelay="no"
1316fi
1eafa37a
JA
1317cat > $TMPC << EOF
1318#include <stdio.h>
1319#include <sys/types.h>
1320#include <sys/socket.h>
1321#include <netinet/tcp.h>
1322int main(int argc, char **argv)
1323{
1324 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1325}
1326EOF
1327if compile_prog "" "" "TCP_NODELAY"; then
1328 tcp_nodelay="yes"
1329fi
1330echo "TCP_NODELAY $tcp_nodelay"
1331
1008602c
JA
1332##########################################
1333# Check whether we have SO_SNDBUF
ca205a75
TK
1334if test "$window_size" != "yes" ; then
1335 window_size="no"
1336fi
1008602c
JA
1337cat > $TMPC << EOF
1338#include <stdio.h>
1339#include <sys/types.h>
1340#include <sys/socket.h>
1341#include <netinet/tcp.h>
1342int main(int argc, char **argv)
1343{
1344 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1345 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1346}
1347EOF
1348if compile_prog "" "" "SO_SNDBUF"; then
1349 window_size="yes"
1350fi
1351echo "Net engine window_size $window_size"
1352
e5f34d95
JA
1353##########################################
1354# Check whether we have TCP_MAXSEG
ca205a75
TK
1355if test "$mss" != "yes" ; then
1356 mss="no"
1357fi
e5f34d95
JA
1358cat > $TMPC << EOF
1359#include <stdio.h>
1360#include <sys/types.h>
1361#include <sys/socket.h>
1362#include <netinet/tcp.h>
1363#include <arpa/inet.h>
1364#include <netinet/in.h>
1365int main(int argc, char **argv)
1366{
1367 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1368}
1369EOF
1370if compile_prog "" "" "TCP_MAXSEG"; then
1371 mss="yes"
1372fi
1373echo "TCP_MAXSEG $mss"
1374
38b9354a
JA
1375##########################################
1376# Check whether we have RLIMIT_MEMLOCK
ca205a75
TK
1377if test "$rlimit_memlock" != "yes" ; then
1378 rlimit_memlock="no"
1379fi
38b9354a
JA
1380cat > $TMPC << EOF
1381#include <sys/time.h>
1382#include <sys/resource.h>
1383int main(int argc, char **argv)
1384{
1385 struct rlimit rl;
1386 return getrlimit(RLIMIT_MEMLOCK, &rl);
1387}
1388EOF
1389if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1390 rlimit_memlock="yes"
1391fi
1392echo "RLIMIT_MEMLOCK $rlimit_memlock"
1393
07fc0acd
JA
1394##########################################
1395# Check whether we have pwritev/preadv
ca205a75
TK
1396if test "$pwritev" != "yes" ; then
1397 pwritev="no"
1398fi
07fc0acd
JA
1399cat > $TMPC << EOF
1400#include <stdio.h>
1401#include <sys/uio.h>
1402int main(int argc, char **argv)
1403{
1404 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1405}
1406EOF
1407if compile_prog "" "" "pwritev"; then
1408 pwritev="yes"
1409fi
1410echo "pwritev/preadv $pwritev"
1411
2cafffbe
JA
1412##########################################
1413# Check whether we have pwritev2/preadv2
ca205a75
TK
1414if test "$pwritev2" != "yes" ; then
1415 pwritev2="no"
1416fi
2cafffbe
JA
1417cat > $TMPC << EOF
1418#include <stdio.h>
1419#include <sys/uio.h>
1420int main(int argc, char **argv)
1421{
1422 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1423}
1424EOF
1425if compile_prog "" "" "pwritev2"; then
1426 pwritev2="yes"
1427fi
1428echo "pwritev2/preadv2 $pwritev2"
1429
ecad55e9
JA
1430##########################################
1431# Check whether we have the required functions for ipv6
ca205a75
TK
1432if test "$ipv6" != "yes" ; then
1433 ipv6="no"
1434fi
ecad55e9
JA
1435cat > $TMPC << EOF
1436#include <sys/types.h>
1437#include <sys/socket.h>
d219028d 1438#include <netinet/in.h>
ecad55e9
JA
1439#include <netdb.h>
1440#include <stdio.h>
1441int main(int argc, char **argv)
1442{
1443 struct addrinfo hints;
1444 struct in6_addr addr;
1445 int ret;
1446
1447 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1448 freeaddrinfo(NULL);
1449 printf("%s\n", gai_strerror(ret));
1450 addr = in6addr_any;
1451 return 0;
1452}
1453EOF
1454if compile_prog "" "" "ipv6"; then
1455 ipv6="yes"
1456fi
1457echo "IPv6 helpers $ipv6"
07fc0acd 1458
fc5c0345
DG
1459##########################################
1460# check for rbd
ca205a75
TK
1461if test "$rbd" != "yes" ; then
1462 rbd="no"
1463fi
fc5c0345
DG
1464cat > $TMPC << EOF
1465#include <rbd/librbd.h>
1466
1467int main(int argc, char **argv)
1468{
1469
1470 rados_t cluster;
1471 rados_ioctx_t io_ctx;
1472 const char pool[] = "rbd";
1473
1474 int major, minor, extra;
1475 rbd_version(&major, &minor, &extra);
1476
1477 rados_ioctx_create(cluster, pool, &io_ctx);
1478 return 0;
1479}
1480EOF
ce18290e 1481if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
fc5c0345
DG
1482 LIBS="-lrbd -lrados $LIBS"
1483 rbd="yes"
1484fi
1485echo "Rados Block Device engine $rbd"
1486
53b6c979
PL
1487##########################################
1488# check for rbd_poll
ca205a75
TK
1489if test "$rbd_poll" != "yes" ; then
1490 rbd_poll="no"
1491fi
53b6c979
PL
1492if test "$rbd" = "yes"; then
1493cat > $TMPC << EOF
1494#include <rbd/librbd.h>
1495#include <sys/eventfd.h>
1496
1497int main(int argc, char **argv)
1498{
1499 rbd_image_t image;
1500 rbd_completion_t comp;
1501
1502 int fd = eventfd(0, EFD_NONBLOCK);
1503 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1504 rbd_poll_io_events(image, comp, 1);
1505
1506 return 0;
1507}
1508EOF
1509if compile_prog "" "-lrbd -lrados" "rbd"; then
1510 rbd_poll="yes"
1511fi
1512echo "rbd_poll $rbd_poll"
1513fi
1514
903b2812
JA
1515##########################################
1516# check for rbd_invaidate_cache()
ca205a75
TK
1517if test "$rbd_inval" != "yes" ; then
1518 rbd_inval="no"
1519fi
903b2812
JA
1520if test "$rbd" = "yes"; then
1521cat > $TMPC << EOF
1522#include <rbd/librbd.h>
1523
1524int main(int argc, char **argv)
1525{
1526 rbd_image_t image;
1527
1528 return rbd_invalidate_cache(image);
1529}
1530EOF
1531if compile_prog "" "-lrbd -lrados" "rbd"; then
1532 rbd_inval="yes"
1533fi
1534echo "rbd_invalidate_cache $rbd_inval"
1535fi
1536
a4c4c346 1537##########################################
1538# check for blkin
ca205a75
TK
1539if test "$rbd_blkin" != "yes" ; then
1540 rbd_blkin="no"
1541fi
a4c4c346 1542cat > $TMPC << EOF
1543#include <rbd/librbd.h>
1544#include <zipkin_c.h>
1545
1546int main(int argc, char **argv)
1547{
1548 int r;
1549 struct blkin_trace_info t_info;
1550 blkin_init_trace_info(&t_info);
1551 rbd_completion_t completion;
1552 rbd_image_t image;
1553 uint64_t off;
1554 size_t len;
1555 const char *buf;
1556 r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
1557 return 0;
1558}
1559EOF
1560if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
1561 && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
1562 LIBS="-lblkin $LIBS"
1563 rbd_blkin="yes"
1564fi
1565echo "rbd blkin tracing $rbd_blkin"
1566
2e802282
JA
1567##########################################
1568# Check whether we have setvbuf
ca205a75
TK
1569if test "$setvbuf" != "yes" ; then
1570 setvbuf="no"
1571fi
2e802282
JA
1572cat > $TMPC << EOF
1573#include <stdio.h>
1574int main(int argc, char **argv)
1575{
1576 FILE *f = NULL;
1577 char buf[80];
1578 setvbuf(f, buf, _IOFBF, sizeof(buf));
1579 return 0;
1580}
1581EOF
1582if compile_prog "" "" "setvbuf"; then
1583 setvbuf="yes"
1584fi
1585echo "setvbuf $setvbuf"
fc5c0345 1586
6e7d7dfb 1587# check for gfapi
ca205a75
TK
1588if test "$gfapi" != "yes" ; then
1589 gfapi="no"
1590fi
6e7d7dfb 1591cat > $TMPC << EOF
1592#include <glusterfs/api/glfs.h>
1593
1594int main(int argc, char **argv)
1595{
1596
1597 glfs_t *g = glfs_new("foo");
1598
1599 return 0;
1600}
1601EOF
ce18290e 1602if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
6e7d7dfb 1603 LIBS="-lgfapi -lglusterfs $LIBS"
1604 gfapi="yes"
1605fi
6fa14b99 1606 echo "Gluster API engine $gfapi"
6e7d7dfb 1607
6fa14b99 1608##########################################
ca205a75 1609# check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
6876c98c 1610if test "$gfapi" = "yes" ; then
6fa14b99 1611gf_fadvise="no"
1612cat > $TMPC << EOF
1613#include <glusterfs/api/glfs.h>
1614
1615int main(int argc, char **argv)
1616{
1617 struct glfs_fd *fd;
1618 int ret = glfs_fadvise(fd, 0, 0, 1);
1619
1620 return 0;
1621}
1622EOF
6fa14b99 1623if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1624 gf_fadvise="yes"
1625fi
1626echo "Gluster API use fadvise $gf_fadvise"
6876c98c
JA
1627fi
1628
1629##########################################
1630# check for gfapi trim support
ca205a75
TK
1631if test "$gf_trim" != "yes" ; then
1632 gf_trim="no"
1633fi
6876c98c
JA
1634if test "$gfapi" = "yes" ; then
1635cat > $TMPC << EOF
1636#include <glusterfs/api/glfs.h>
1637
1638int main(int argc, char **argv)
1639{
1640 return glfs_discard_async(NULL, 0, 0);
1641}
1642EOF
1643if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1644 gf_trim="yes"
1645fi
1646echo "Gluster API trim support $gf_trim"
1647fi
fc5c0345 1648
81795ce3
CE
1649##########################################
1650# Check if we support stckf on s390
ca205a75
TK
1651if test "$s390_z196_facilities" != "yes" ; then
1652 s390_z196_facilities="no"
1653fi
81795ce3
CE
1654cat > $TMPC << EOF
1655#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1656int main(int argc, char **argv)
1657{
1658 /* We want just 1 double word to be returned. */
1659 register unsigned long reg0 asm("0") = 0;
1660 unsigned long stfle_bits;
1661 asm volatile(".machine push" "\n\t"
1662 ".machine \"z9-109\"" "\n\t"
1663 "stfle %0" "\n\t"
1664 ".machine pop" "\n"
1665 : "=QS" (stfle_bits), "+d" (reg0)
1666 : : "cc");
1667
1668 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1669 return 0;
1670 else
1671 return -1;
1672}
1673EOF
1674if compile_prog "" "" "s390_z196_facilities"; then
1675 $TMPE
1676 if [[ $? -eq 0 ]]; then
1677 s390_z196_facilities="yes"
1678 fi
1679fi
1680echo "s390_z196_facilities $s390_z196_facilities"
1b10477b
MM
1681
1682##########################################
1683# Check if we have required environment variables configured for libhdfs
1684if test "$libhdfs" = "yes" ; then
1685 hdfs_conf_error=0
1686 if test "$JAVA_HOME" = "" ; then
1687 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1688 hdfs_conf_error=1
1689 fi
1690 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1691 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1692 hdfs_conf_error=1
1693 fi
1694 if test "$FIO_LIBHDFS_LIB" = "" ; then
1695 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1696 hdfs_conf_error=1
1697 fi
1698 if test "$hdfs_conf_error" = "1" ; then
1699 exit 1
1700 fi
247e5436
JA
1701 FIO_HDFS_CPU=$cpu
1702 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1703 FIO_HDFS_CPU="amd64"
1704 fi
1b10477b
MM
1705fi
1706echo "HDFS engine $libhdfs"
1707
b8116a87
DE
1708##########################################
1709# Check whether we have MTD
ca205a75
TK
1710if test "$mtd" != "yes" ; then
1711 mtd="no"
1712fi
b8116a87 1713cat > $TMPC << EOF
0e1c454a 1714#include <string.h>
b8116a87
DE
1715#include <mtd/mtd-user.h>
1716#include <sys/ioctl.h>
1717int main(int argc, char **argv)
1718{
0e1c454a 1719 struct mtd_write_req ops;
b8116a87 1720 struct mtd_info_user info;
0e1c454a 1721 memset(&ops, 0, sizeof(ops));
400cd0ff 1722 info.type = MTD_MLCNANDFLASH;
b8116a87
DE
1723 return ioctl(0, MEMGETINFO, &info);
1724}
1725EOF
1726if compile_prog "" "" "mtd"; then
1727 mtd="yes"
1728fi
1729echo "MTD $mtd"
1730
3ee2a3c1
DJ
1731##########################################
1732# Check whether we have libpmem
ca205a75
TK
1733if test "$libpmem" != "yes" ; then
1734 libpmem="no"
1735fi
3ee2a3c1
DJ
1736cat > $TMPC << EOF
1737#include <libpmem.h>
1738int main(int argc, char **argv)
1739{
1740 int rc;
1741 rc = pmem_is_pmem(0, 0);
1742 return 0;
1743}
1744EOF
1745if compile_prog "" "-lpmem" "libpmem"; then
1746 libpmem="yes"
cf8775b8 1747 LIBS="-lpmem $LIBS"
3ee2a3c1
DJ
1748fi
1749echo "libpmem $libpmem"
1750
1751##########################################
1752# Check whether we have libpmemblk
cf8775b8 1753# libpmem is a prerequisite
ca205a75
TK
1754if test "$libpmemblk" != "yes" ; then
1755 libpmemblk="no"
1756fi
cf8775b8
RE
1757if test "$libpmem" = "yes"; then
1758 cat > $TMPC << EOF
3ee2a3c1
DJ
1759#include <libpmemblk.h>
1760int main(int argc, char **argv)
1761{
cf8775b8
RE
1762 PMEMblkpool *pbp;
1763 pbp = pmemblk_open("", 0);
3ee2a3c1
DJ
1764 return 0;
1765}
1766EOF
cf8775b8
RE
1767 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1768 libpmemblk="yes"
1769 LIBS="-lpmemblk $LIBS"
1770 fi
3ee2a3c1
DJ
1771fi
1772echo "libpmemblk $libpmemblk"
1773
cf8775b8 1774# Choose the ioengines
3ee2a3c1
DJ
1775if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1776 devdax="yes"
1777 if test "$libpmemblk" = "yes"; then
1778 pmemblk="yes"
1779 fi
1780fi
1781
43f3cec2
BB
1782##########################################
1783# Report whether pmemblk engine is enabled
cf8775b8 1784echo "NVML pmemblk engine $pmemblk"
43f3cec2 1785
cbb15e42
DJ
1786##########################################
1787# Report whether dev-dax engine is enabled
cf8775b8 1788echo "NVML dev-dax engine $devdax"
cbb15e42 1789
b470a02c
SC
1790# Check if we have lex/yacc available
1791yacc="no"
e7b2c7a3 1792yacc_is_bison="no"
b470a02c
SC
1793lex="no"
1794arith="no"
de26b824 1795if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
cf6dd80e 1796if test "$targetos" != "SunOS" ; then
e7b2c7a3 1797LEX=$(which lex 2> /dev/null)
b470a02c
SC
1798if test -x "$LEX" ; then
1799 lex="yes"
1800fi
7e0049e9 1801YACC=$(which bison 2> /dev/null)
b470a02c
SC
1802if test -x "$YACC" ; then
1803 yacc="yes"
7e0049e9 1804 yacc_is_bison="yes"
e7b2c7a3 1805else
7e0049e9 1806 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
1807 if test -x "$YACC" ; then
1808 yacc="yes"
e7b2c7a3 1809 fi
b470a02c
SC
1810fi
1811if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1812 arith="yes"
1813fi
1814
1815if test "$arith" = "yes" ; then
1816cat > $TMPC << EOF
1817extern int yywrap(void);
1818
1819int main(int argc, char **argv)
1820{
1821 yywrap();
1822 return 0;
1823}
1824EOF
719cda03
JA
1825if compile_prog "" "-ll" "lex"; then
1826 LIBS="-ll $LIBS"
b470a02c
SC
1827else
1828 arith="no"
1829fi
1830fi
cf6dd80e 1831fi
a655bbc4 1832fi
b470a02c 1833
63bda378
JA
1834# Check if lex fails using -o
1835if test "$arith" = "yes" ; then
daf705b5
JA
1836if test "$force_no_lex_o" = "yes" ; then
1837 lex_use_o="no"
1838else
63bda378
JA
1839$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1840if test "$?" = "0" ; then
1841 lex_use_o="yes"
1842else
1843 lex_use_o="no"
1844fi
1845fi
daf705b5 1846fi
63bda378 1847
b470a02c
SC
1848echo "lex/yacc for arithmetic $arith"
1849
aae599ba
JA
1850##########################################
1851# Check whether we have setmntent/getmntent
ca205a75
TK
1852if test "$getmntent" != "yes" ; then
1853 getmntent="no"
1854fi
aae599ba
JA
1855cat > $TMPC << EOF
1856#include <stdio.h>
1857#include <mntent.h>
1858int main(int argc, char **argv)
1859{
1860 FILE *mtab = setmntent(NULL, "r");
1861 struct mntent *mnt = getmntent(mtab);
1581b82a 1862 endmntent(mtab);
aae599ba
JA
1863 return 0;
1864}
1865EOF
1866if compile_prog "" "" "getmntent"; then
1867 getmntent="yes"
1868fi
1869echo "getmntent $getmntent"
1870
e7e136da
TK
1871##########################################
1872# Check whether we have getmntinfo
b765bec0
TK
1873# These are originally added for BSDs, but may also work
1874# on other operating systems with getmntinfo(3).
1875
1876# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1877# Note that NetBSD needs -Werror to catch warning as error.
ca205a75
TK
1878if test "$getmntinfo" != "yes" ; then
1879 getmntinfo="no"
1880fi
e7e136da
TK
1881cat > $TMPC << EOF
1882#include <stdio.h>
1883#include <sys/param.h>
1884#include <sys/mount.h>
1885int main(int argc, char **argv)
1886{
9ada751d 1887 struct statfs *st;
e7e136da
TK
1888 return getmntinfo(&st, MNT_NOWAIT);
1889}
1890EOF
b765bec0 1891if compile_prog "-Werror" "" "getmntinfo"; then
e7e136da
TK
1892 getmntinfo="yes"
1893fi
1894echo "getmntinfo $getmntinfo"
1895
b765bec0 1896# getmntinfo(3) for NetBSD.
ca205a75
TK
1897if test "$getmntinfo_statvfs" != "yes" ; then
1898 getmntinfo_statvfs="no"
1899fi
b765bec0
TK
1900cat > $TMPC << EOF
1901#include <stdio.h>
1902#include <sys/statvfs.h>
1903int main(int argc, char **argv)
1904{
1905 struct statvfs *st;
1906 return getmntinfo(&st, MNT_NOWAIT);
1907}
1908EOF
1909# Skip the test if the one with statfs arg is detected.
1910if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1911 getmntinfo_statvfs="yes"
1912 echo "getmntinfo_statvfs $getmntinfo_statvfs"
1913fi
1914
5018f79f
AH
1915##########################################
1916# Check whether we have _Static_assert
ca205a75
TK
1917if test "$static_assert" != "yes" ; then
1918 static_assert="no"
1919fi
5018f79f
AH
1920cat > $TMPC << EOF
1921#include <assert.h>
94815a5c
JA
1922#include <stdlib.h>
1923#undef offsetof
1924#ifdef __compiler_offsetof
1925#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1926#else
1927#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1928#endif
1929
1930#define container_of(ptr, type, member) ({ \
1931 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
1932 (type *)( (char *)__mptr - offsetof(type,member) );})
1933
1934struct foo {
1935 int a, b;
1936};
1937
5018f79f
AH
1938int main(int argc, char **argv)
1939{
94815a5c 1940 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
5018f79f
AH
1941 return 0 ;
1942}
1943EOF
1944if compile_prog "" "" "static_assert"; then
1945 static_assert="yes"
1946fi
1947echo "Static Assert $static_assert"
e39c0676
JA
1948
1949##########################################
1950# Check whether we have bool / stdbool.h
ca205a75
TK
1951if test "$have_bool" != "yes" ; then
1952 have_bool="no"
1953fi
e39c0676
JA
1954cat > $TMPC << EOF
1955#include <stdbool.h>
1956int main(int argc, char **argv)
1957{
1958 bool var = true;
1959 return var != false;
1960}
1961EOF
1962if compile_prog "" "" "bool"; then
1963 have_bool="yes"
1964fi
1965echo "bool $have_bool"
1966
214e2d56 1967##########################################
1968# check march=armv8-a+crc+crypto
ca205a75
TK
1969if test "$march_armv8_a_crc_crypto" != "yes" ; then
1970 march_armv8_a_crc_crypto="no"
1971fi
214e2d56 1972if test "$cpu" = "arm64" ; then
1973 cat > $TMPC <<EOF
9b153dc2
TT
1974#include <sys/auxv.h>
1975#include <arm_acle.h>
1976#include <arm_neon.h>
1977
214e2d56 1978int main(void)
1979{
1980 return 0;
1981}
1982EOF
1983 if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
1984 march_armv8_a_crc_crypto="yes"
1985 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
1986 fi
1987fi
1988echo "march_armv8_a_crc_crypto $march_armv8_a_crc_crypto"
1989
1990
67bf9823
JA
1991#############################################################################
1992
67bf9823 1993if test "$wordsize" = "64" ; then
4feafb1e 1994 output_sym "CONFIG_64BIT"
67bf9823 1995elif test "$wordsize" = "32" ; then
4feafb1e 1996 output_sym "CONFIG_32BIT"
67bf9823 1997else
d7145a78 1998 fatal "Unknown wordsize!"
67bf9823 1999fi
0dcebdf4 2000if test "$bigendian" = "yes" ; then
4feafb1e 2001 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 2002else
4feafb1e 2003 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 2004fi
3989b143
JA
2005if test "$zlib" = "yes" ; then
2006 output_sym "CONFIG_ZLIB"
2007fi
67bf9823 2008if test "$libaio" = "yes" ; then
4feafb1e 2009 output_sym "CONFIG_LIBAIO"
67bf9823
JA
2010fi
2011if test "$posix_aio" = "yes" ; then
4feafb1e 2012 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
2013fi
2014if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 2015 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823 2016fi
06eac6b2
SW
2017if test "$posix_pshared" = "yes" ; then
2018 output_sym "CONFIG_PSHARED"
2019fi
67bf9823 2020if test "$linux_fallocate" = "yes" ; then
4feafb1e 2021 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
2022fi
2023if test "$posix_fallocate" = "yes" ; then
4feafb1e 2024 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
2025fi
2026if test "$fdatasync" = "yes" ; then
4feafb1e 2027 output_sym "CONFIG_FDATASYNC"
67bf9823
JA
2028fi
2029if test "$sync_file_range" = "yes" ; then
4feafb1e 2030 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
2031fi
2032if test "$sfaa" = "yes" ; then
4feafb1e 2033 output_sym "CONFIG_SFAA"
67bf9823 2034fi
954cd73a 2035if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 2036 output_sym "CONFIG_RDMA"
67bf9823
JA
2037fi
2038if test "$clock_gettime" = "yes" ; then
4feafb1e 2039 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
2040fi
2041if test "$clock_monotonic" = "yes" ; then
4feafb1e 2042 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823 2043fi
c544f604
SN
2044if test "$clock_monotonic_raw" = "yes" ; then
2045 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2046fi
67bf9823 2047if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 2048 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823 2049fi
25f8227d
JA
2050if test "$clockid_t" = "yes"; then
2051 output_sym "CONFIG_CLOCKID_T"
2052fi
67bf9823 2053if test "$gettimeofday" = "yes" ; then
4feafb1e 2054 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
2055fi
2056if test "$posix_fadvise" = "yes" ; then
4feafb1e 2057 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
2058fi
2059if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 2060 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 2061elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 2062 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
2063fi
2064if test "$strsep" = "yes" ; then
4feafb1e 2065 output_sym "CONFIG_STRSEP"
67bf9823 2066fi
9ad8da82
JA
2067if test "$strcasestr" = "yes" ; then
2068 output_sym "CONFIG_STRCASESTR"
2069fi
5ad7be56
KD
2070if test "$strlcat" = "yes" ; then
2071 output_sym "CONFIG_STRLCAT"
2072fi
67bf9823 2073if test "$getopt_long_only" = "yes" ; then
4feafb1e 2074 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
2075fi
2076if test "$inet_aton" = "yes" ; then
4feafb1e 2077 output_sym "CONFIG_INET_ATON"
67bf9823
JA
2078fi
2079if test "$socklen_t" = "yes" ; then
4feafb1e 2080 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
2081fi
2082if test "$ext4_me" = "yes" ; then
4feafb1e 2083 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
2084fi
2085if test "$linux_splice" = "yes" ; then
4feafb1e 2086 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
2087fi
2088if test "$guasi" = "yes" ; then
4feafb1e 2089 output_sym "CONFIG_GUASI"
67bf9823
JA
2090fi
2091if test "$fusion_aw" = "yes" ; then
4feafb1e 2092 output_sym "CONFIG_FUSION_AW"
67bf9823 2093fi
50206d9b 2094if test "$libnuma_v2" = "yes" ; then
4feafb1e 2095 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
2096fi
2097if test "$solaris_aio" = "yes" ; then
4feafb1e 2098 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
2099fi
2100if test "$tls_thread" = "yes" ; then
4feafb1e 2101 output_sym "CONFIG_TLS_THREAD"
67bf9823 2102fi
44404c5a 2103if test "$rusage_thread" = "yes" ; then
4feafb1e 2104 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 2105fi
91f94d5b
JA
2106if test "$gfio" = "yes" ; then
2107 echo "CONFIG_GFIO=y" >> $config_host_mak
2108fi
c8931876
JA
2109if test "$esx" = "yes" ; then
2110 output_sym "CONFIG_ESX"
2111 output_sym "CONFIG_NO_SHM"
2112fi
7e09a9f1
JA
2113if test "$sched_idle" = "yes" ; then
2114 output_sym "CONFIG_SCHED_IDLE"
2115fi
1eafa37a
JA
2116if test "$tcp_nodelay" = "yes" ; then
2117 output_sym "CONFIG_TCP_NODELAY"
2118fi
1008602c
JA
2119if test "$window_size" = "yes" ; then
2120 output_sym "CONFIG_NET_WINDOWSIZE"
2121fi
e5f34d95
JA
2122if test "$mss" = "yes" ; then
2123 output_sym "CONFIG_NET_MSS"
2124fi
38b9354a
JA
2125if test "$rlimit_memlock" = "yes" ; then
2126 output_sym "CONFIG_RLIMIT_MEMLOCK"
2127fi
07fc0acd
JA
2128if test "$pwritev" = "yes" ; then
2129 output_sym "CONFIG_PWRITEV"
2130fi
2cafffbe
JA
2131if test "$pwritev2" = "yes" ; then
2132 output_sym "CONFIG_PWRITEV2"
2133fi
ecad55e9
JA
2134if test "$ipv6" = "yes" ; then
2135 output_sym "CONFIG_IPV6"
2136fi
fc5c0345
DG
2137if test "$rbd" = "yes" ; then
2138 output_sym "CONFIG_RBD"
2139fi
53b6c979
PL
2140if test "$rbd_poll" = "yes" ; then
2141 output_sym "CONFIG_RBD_POLL"
2142fi
903b2812
JA
2143if test "$rbd_inval" = "yes" ; then
2144 output_sym "CONFIG_RBD_INVAL"
2145fi
a4c4c346 2146if test "$rbd_blkin" = "yes" ; then
2147 output_sym "CONFIG_RBD_BLKIN"
2148fi
2e802282
JA
2149if test "$setvbuf" = "yes" ; then
2150 output_sym "CONFIG_SETVBUF"
2151fi
81795ce3
CE
2152if test "$s390_z196_facilities" = "yes" ; then
2153 output_sym "CONFIG_S390_Z196_FACILITIES"
2154 CFLAGS="$CFLAGS -march=z9-109"
2155fi
6e7d7dfb 2156if test "$gfapi" = "yes" ; then
2157 output_sym "CONFIG_GFAPI"
2158fi
6fa14b99 2159if test "$gf_fadvise" = "yes" ; then
2160 output_sym "CONFIG_GF_FADVISE"
2161fi
6876c98c
JA
2162if test "$gf_trim" = "yes" ; then
2163 output_sym "CONFIG_GF_TRIM"
2164fi
1b10477b
MM
2165if test "$libhdfs" = "yes" ; then
2166 output_sym "CONFIG_LIBHDFS"
247e5436 2167 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
1527dc50
FB
2168 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2169 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2170 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2171 fi
b8116a87
DE
2172if test "$mtd" = "yes" ; then
2173 output_sym "CONFIG_MTD"
2174fi
43f3cec2
BB
2175if test "$pmemblk" = "yes" ; then
2176 output_sym "CONFIG_PMEMBLK"
2177fi
cbb15e42
DJ
2178if test "$devdax" = "yes" ; then
2179 output_sym "CONFIG_LINUX_DEVDAX"
2180fi
b470a02c
SC
2181if test "$arith" = "yes" ; then
2182 output_sym "CONFIG_ARITHMETIC"
e7b2c7a3
JA
2183 if test "$yacc_is_bison" = "yes" ; then
2184 echo "YACC=$YACC -y" >> $config_host_mak
2185 else
2186 echo "YACC=$YACC" >> $config_host_mak
2187 fi
63bda378
JA
2188 if test "$lex_use_o" = "yes" ; then
2189 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2190 fi
b470a02c 2191fi
aae599ba
JA
2192if test "$getmntent" = "yes" ; then
2193 output_sym "CONFIG_GETMNTENT"
2194fi
e7e136da
TK
2195if test "$getmntinfo" = "yes" ; then
2196 output_sym "CONFIG_GETMNTINFO"
2197fi
b765bec0
TK
2198if test "$getmntinfo_statvfs" = "yes" ; then
2199 output_sym "CONFIG_GETMNTINFO_STATVFS"
2200fi
5018f79f
AH
2201if test "$static_assert" = "yes" ; then
2202 output_sym "CONFIG_STATIC_ASSERT"
2203fi
e39c0676
JA
2204if test "$have_bool" = "yes" ; then
2205 output_sym "CONFIG_HAVE_BOOL"
2206fi
484817a9
JA
2207if test "$disable_opt" = "yes" ; then
2208 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2209fi
67bf9823 2210
605cf82e
JA
2211if test "$zlib" = "no" ; then
2212 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
2213fi
2214
67bf9823 2215echo "LIBS+=$LIBS" >> $config_host_mak
86719845 2216echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 2217echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 2218echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 2219echo "CC=$cc" >> $config_host_mak
af4862b3 2220echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 2221echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
c61a3a44 2222
59d8f412 2223if [ `dirname $0` != "." -a ! -e Makefile ]; then
c61a3a44
JF
2224 cat > Makefile <<EOF
2225SRCDIR:=`dirname $0`
2226include \$(SRCDIR)/Makefile
2227EOF
2228fi