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