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