configure: Add missing <string.h> to avoid bogus warning
[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 ;;
bad7e42c 164 --enable-gfio) gfio_check="yes"
899fab33 165 ;;
44462517
CF
166 --disable-numa) disable_numa="yes"
167 ;;
f678f8d2
MF
168 --disable-rdma) disable_rdma="yes"
169 ;;
ce18290e
TM
170 --disable-rbd) disable_rbd="yes"
171 ;;
a4c4c346 172 --disable-rbd-blkin) disable_rbd_blkin="yes"
173 ;;
ce18290e
TM
174 --disable-gfapi) disable_gfapi="yes"
175 ;;
1b10477b
MM
176 --enable-libhdfs) libhdfs="yes"
177 ;;
a655bbc4
JA
178 --disable-lex) disable_lex="yes"
179 ;;
de26b824
JA
180 --enable-lex) disable_lex="no"
181 ;;
61054f0d
JA
182 --disable-shm) no_shm="yes"
183 ;;
184 --disable-optimizations) disable_opt="yes"
ba40757e 185 ;;
3ee2a3c1
DJ
186 --disable-pmem) disable_pmem="yes"
187 ;;
03553853
YR
188 --enable-cuda) enable_cuda="yes"
189 ;;
827da4f5 190 --help)
47f44635 191 show_help="yes"
827da4f5 192 ;;
cb1125b0
JA
193 *)
194 echo "Bad option $opt"
47f44635
JA
195 show_help="yes"
196 exit_val=1
cb1125b0
JA
197 esac
198done
199
47f44635 200if test "$show_help" = "yes" ; then
05cef7a0
TK
201 echo "--prefix= Use this directory as installation prefix"
202 echo "--cpu= Specify target CPU if auto-detect fails"
203 echo "--cc= Specify compiler to use"
204 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
205 echo "--build-32bit-win Enable 32-bit build on Windows"
206 echo "--build-static Build a static fio"
207 echo "--esx Configure build options for esx"
208 echo "--enable-gfio Enable building of gtk gfio"
209 echo "--disable-numa Disable libnuma even if found"
03553853 210 echo "--disable-rdma Disable RDMA support even if found"
05cef7a0
TK
211 echo "--disable-gfapi Disable gfapi"
212 echo "--enable-libhdfs Enable hdfs support"
213 echo "--disable-lex Disable use of lex/yacc for math"
214 echo "--disable-pmem Disable pmem based engines even if found"
215 echo "--enable-lex Enable use of lex/yacc for math"
216 echo "--disable-shm Disable SHM support"
61054f0d 217 echo "--disable-optimizations Don't enable compiler optimizations"
03553853 218 echo "--enable-cuda Enable GPUDirect RDMA support"
b7a99316 219 exit $exit_val
47f44635
JA
220fi
221
47986339
SH
222cross_prefix=${cross_prefix-${CROSS_COMPILE}}
223cc="${CC-${cross_prefix}gcc}"
224
6d0e9f83
AC
225if check_define __ANDROID__ ; then
226 targetos="Android"
227elif check_define __linux__ ; then
67bf9823 228 targetos="Linux"
67bf9823
JA
229elif check_define __OpenBSD__ ; then
230 targetos='OpenBSD'
231elif check_define __sun__ ; then
232 targetos='SunOS'
7cb024f8 233 CFLAGS="$CFLAGS -D_REENTRANT"
b24f59ab
SH
234elif check_define _WIN32 ; then
235 targetos='CYGWIN'
67bf9823
JA
236else
237 targetos=`uname -s`
238fi
239
53cd4eee
AC
240echo "# Automatically generated by configure - do not modify" > $config_host_mak
241printf "# Configured with:" >> $config_host_mak
242printf " '%s'" "$0" "$@" >> $config_host_mak
243echo >> $config_host_mak
244echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
245
61054f0d
JA
246if test "$no_shm" = "yes" ; then
247 output_sym "CONFIG_NO_SHM"
248fi
249
250if test "$disable_opt" = "yes" ; then
251 output_sym "CONFIG_FIO_NO_OPT"
252fi
253
67bf9823
JA
254# Some host OSes need non-standard checks for which CPU to use.
255# Note that these checks are broken for cross-compilation: if you're
256# cross-compiling to one of these OSes then you'll need to specify
257# the correct CPU with the --cpu option.
258case $targetos in
baa78fdc 259AIX|OpenBSD)
de26b824 260 # Unless explicitly enabled, turn off lex.
baa78fdc 261 # OpenBSD will hit syntax error when enabled.
de26b824
JA
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 906#include <time.h>
209c37b4 907#include <string.h>
25f8227d
JA
908int main(int argc, char **argv)
909{
ccf2d89d 910 volatile clockid_t cid;
a214d131 911 memset(&cid, 0, sizeof(cid));
ccf2d89d 912 return 0;
25f8227d
JA
913}
914EOF
915if compile_prog "" "$LIBS" "clockid_t"; then
916 clockid_t="yes"
917fi
918echo "clockid_t $clockid_t"
919
67bf9823
JA
920##########################################
921# gettimeofday() probe
ca205a75
TK
922if test "$gettimeofday" != "yes" ; then
923 gettimeofday="no"
924fi
67bf9823
JA
925cat > $TMPC << EOF
926#include <sys/time.h>
927#include <stdio.h>
928int main(int argc, char **argv)
929{
930 struct timeval tv;
931 return gettimeofday(&tv, NULL);
932}
933EOF
934if compile_prog "" "" "gettimeofday"; then
935 gettimeofday="yes"
936fi
937echo "gettimeofday $gettimeofday"
938
939##########################################
940# fdatasync() probe
ca205a75
TK
941if test "$fdatasync" != "yes" ; then
942 fdatasync="no"
943fi
67bf9823
JA
944cat > $TMPC << EOF
945#include <stdio.h>
946#include <unistd.h>
947int main(int argc, char **argv)
948{
949 return fdatasync(0);
950}
951EOF
952if compile_prog "" "" "fdatasync"; then
953 fdatasync="yes"
954fi
955echo "fdatasync $fdatasync"
956
957##########################################
958# sync_file_range() probe
ca205a75
TK
959if test "$sync_file_range" != "yes" ; then
960 sync_file_range="no"
961fi
67bf9823
JA
962cat > $TMPC << EOF
963#include <stdio.h>
964#include <unistd.h>
67bf9823
JA
965#include <fcntl.h>
966#include <linux/fs.h>
967int main(int argc, char **argv)
968{
969 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
970 SYNC_FILE_RANGE_WAIT_AFTER;
971 return sync_file_range(0, 0, 0, flags);
972}
973EOF
974if compile_prog "" "" "sync_file_range"; then
975 sync_file_range="yes"
976fi
977echo "sync_file_range $sync_file_range"
978
979##########################################
980# ext4 move extent probe
ca205a75
TK
981if test "$ext4_me" != "yes" ; then
982 ext4_me="no"
983fi
67bf9823
JA
984cat > $TMPC << EOF
985#include <fcntl.h>
986#include <sys/ioctl.h>
987int main(int argc, char **argv)
988{
989 struct move_extent me;
990 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
991}
992EOF
c7165b8d
JA
993if compile_prog "" "" "ext4 move extent" ; then
994 ext4_me="yes"
995elif test $targetos = "Linux" ; then
996 # On Linux, just default to it on and let it error at runtime if we really
997 # don't have it. None of my updated systems have it defined, but it does
998 # work. Takes a while to bubble back.
67bf9823
JA
999 ext4_me="yes"
1000fi
1001echo "EXT4 move extent $ext4_me"
1002
1003##########################################
1004# splice probe
ca205a75
TK
1005if test "$linux_splice" != "yes" ; then
1006 linux_splice="no"
1007fi
67bf9823 1008cat > $TMPC << EOF
67bf9823
JA
1009#include <stdio.h>
1010#include <fcntl.h>
1011int main(int argc, char **argv)
1012{
1013 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1014}
1015EOF
1016if compile_prog "" "" "linux splice"; then
1017 linux_splice="yes"
1018fi
1019echo "Linux splice(2) $linux_splice"
1020
1021##########################################
1022# GUASI probe
ca205a75
TK
1023if test "$guasi" != "yes" ; then
1024 guasi="no"
1025fi
67bf9823
JA
1026cat > $TMPC << EOF
1027#include <guasi.h>
1028#include <guasi_syscalls.h>
1029int main(int argc, char **argv)
1030{
1031 guasi_t ctx = guasi_create(0, 0, 0);
1032 return 0;
1033}
1034EOF
1035if compile_prog "" "" "guasi"; then
1036 guasi="yes"
1037fi
1038echo "GUASI $guasi"
1039
1040##########################################
1041# fusion-aw probe
ca205a75
TK
1042if test "$fusion_aw" != "yes" ; then
1043 fusion_aw="no"
1044fi
67bf9823 1045cat > $TMPC << EOF
b2c77c25 1046#include <nvm/nvm_primitives.h>
67bf9823
JA
1047int main(int argc, char **argv)
1048{
b2c77c25
SK
1049 nvm_version_t ver_info;
1050 nvm_handle_t handle;
1051
1052 handle = nvm_get_handle(0, &ver_info);
1053 return nvm_atomic_write(handle, 0, 0, 0);
67bf9823
JA
1054}
1055EOF
92aef550
ARJ
1056if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1057 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
67bf9823
JA
1058 fusion_aw="yes"
1059fi
1060echo "Fusion-io atomic engine $fusion_aw"
1061
1062##########################################
1063# libnuma probe
ca205a75
TK
1064if test "$libnuma" != "yes" ; then
1065 libnuma="no"
1066fi
67bf9823
JA
1067cat > $TMPC << EOF
1068#include <numa.h>
1069int main(int argc, char **argv)
1070{
1071 return numa_available();
1072}
1073EOF
44462517 1074if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
67bf9823
JA
1075 libnuma="yes"
1076 LIBS="-lnuma $LIBS"
1077fi
1078echo "libnuma $libnuma"
1079
50206d9b 1080##########################################
ca205a75 1081# libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
50206d9b
JA
1082if test "$libnuma" = "yes" ; then
1083libnuma_v2="no"
1084cat > $TMPC << EOF
1085#include <numa.h>
1086int main(int argc, char **argv)
1087{
1088 struct bitmask *mask = numa_parse_nodestring(NULL);
61bde962 1089 return mask->size == 0;
50206d9b
JA
1090}
1091EOF
1092if compile_prog "" "" "libnuma api"; then
1093 libnuma_v2="yes"
1094fi
1095echo "libnuma v2 $libnuma_v2"
1096fi
1097
67bf9823
JA
1098##########################################
1099# strsep() probe
ca205a75
TK
1100if test "$strsep" != "yes" ; then
1101 strsep="no"
1102fi
67bf9823
JA
1103cat > $TMPC << EOF
1104#include <string.h>
1105int main(int argc, char **argv)
1106{
ae156be6
JA
1107 static char *string = "This is a string";
1108 strsep(&string, "needle");
67bf9823
JA
1109 return 0;
1110}
1111EOF
1112if compile_prog "" "" "strsep"; then
1113 strsep="yes"
1114fi
1115echo "strsep $strsep"
1116
9ad8da82
JA
1117##########################################
1118# strcasestr() probe
ca205a75
TK
1119if test "$strcasestr" != "yes" ; then
1120 strcasestr="no"
1121fi
9ad8da82
JA
1122cat > $TMPC << EOF
1123#include <string.h>
1124int main(int argc, char **argv)
1125{
aa6738a5 1126 return strcasestr(argv[0], argv[1]) != NULL;
9ad8da82
JA
1127}
1128EOF
1129if compile_prog "" "" "strcasestr"; then
1130 strcasestr="yes"
1131fi
1132echo "strcasestr $strcasestr"
1133
5ad7be56
KD
1134##########################################
1135# strlcat() probe
ca205a75
TK
1136if test "$strlcat" != "yes" ; then
1137 strlcat="no"
1138fi
5ad7be56
KD
1139cat > $TMPC << EOF
1140#include <string.h>
1141int main(int argc, char **argv)
1142{
1143 static char dst[64];
1144 static char *string = "This is a string";
1145 memset(dst, 0, sizeof(dst));
1146 strlcat(dst, string, sizeof(dst));
1147 return 0;
1148}
1149EOF
1150if compile_prog "" "" "strlcat"; then
1151 strlcat="yes"
1152fi
1153echo "strlcat $strlcat"
1154
67bf9823
JA
1155##########################################
1156# getopt_long_only() probe
ca205a75
TK
1157if test "$getopt_long_only" != "yes" ; then
1158 getopt_long_only="no"
1159fi
67bf9823
JA
1160cat > $TMPC << EOF
1161#include <unistd.h>
1162#include <stdio.h>
aa6738a5 1163#include <getopt.h>
67bf9823
JA
1164int main(int argc, char **argv)
1165{
1166 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1167 return c;
1168}
1169EOF
1170if compile_prog "" "" "getopt_long_only"; then
1171 getopt_long_only="yes"
1172fi
1173echo "getopt_long_only() $getopt_long_only"
1174
1175##########################################
1176# inet_aton() probe
ca205a75
TK
1177if test "$inet_aton" != "yes" ; then
1178 inet_aton="no"
1179fi
67bf9823
JA
1180cat > $TMPC << EOF
1181#include <sys/socket.h>
1182#include <arpa/inet.h>
1183#include <stdio.h>
1184int main(int argc, char **argv)
1185{
1186 struct in_addr in;
1187 return inet_aton(NULL, &in);
1188}
1189EOF
1190if compile_prog "" "" "inet_aton"; then
1191 inet_aton="yes"
1192fi
1193echo "inet_aton $inet_aton"
1194
1195##########################################
1196# socklen_t probe
ca205a75
TK
1197if test "$socklen_t" != "yes" ; then
1198 socklen_t="no"
1199fi
67bf9823 1200cat > $TMPC << EOF
f6482613 1201#include <sys/socket.h>
67bf9823
JA
1202int main(int argc, char **argv)
1203{
1204 socklen_t len = 0;
1205 return len;
1206}
1207EOF
1208if compile_prog "" "" "socklen_t"; then
1209 socklen_t="yes"
1210fi
1211echo "socklen_t $socklen_t"
1212
1213##########################################
1214# Whether or not __thread is supported for TLS
ca205a75
TK
1215if test "$tls_thread" != "yes" ; then
1216 tls_thread="no"
1217fi
67bf9823
JA
1218cat > $TMPC << EOF
1219#include <stdio.h>
aa6738a5 1220static __thread int ret;
67bf9823
JA
1221int main(int argc, char **argv)
1222{
1223 return ret;
1224}
1225EOF
1226if compile_prog "" "" "__thread"; then
1227 tls_thread="yes"
1228fi
1229echo "__thread $tls_thread"
1230
91f94d5b 1231##########################################
2639f056 1232# Check if we have required gtk/glib support for gfio
ca205a75
TK
1233if test "$gfio" != "yes" ; then
1234 gfio="no"
1235fi
ebec2094 1236if test "$gfio_check" = "yes" ; then
91f94d5b
JA
1237 cat > $TMPC << EOF
1238#include <glib.h>
1239#include <cairo.h>
1240#include <gtk/gtk.h>
1241int main(void)
1242{
1243 gdk_threads_enter();
91f94d5b 1244 gdk_threads_leave();
b7a99316
JA
1245
1246 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
91f94d5b
JA
1247}
1248EOF
1249GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
86719845
JA
1250ORG_LDFLAGS=$LDFLAGS
1251LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
91f94d5b
JA
1252if test "$?" != "0" ; then
1253 echo "configure: gtk and gthread not found"
1254 exit 1
1255fi
1256GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1257if test "$?" != "0" ; then
1258 echo "configure: gtk and gthread not found"
1259 exit 1
1260fi
b7a99316
JA
1261if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1262 r=$($TMPE)
1263 if test "$r" != "0" ; then
1264 gfio="yes"
86719845 1265 GFIO_LIBS="$LIBS $GTK_LIBS"
b7a99316
JA
1266 CFLAGS="$CFLAGS $GTK_CFLAGS"
1267 else
1268 echo "GTK found, but need version 2.18 or higher"
1269 gfio="no"
1270 fi
91f94d5b
JA
1271else
1272 echo "Please install gtk and gdk libraries"
1273 gfio="no"
1274fi
86719845 1275LDFLAGS=$ORG_LDFLAGS
91f94d5b
JA
1276fi
1277
ebec2094
JA
1278if test "$gfio_check" = "yes" ; then
1279 echo "gtk 2.18 or higher $gfio"
1280fi
91f94d5b 1281
44404c5a 1282# Check whether we have getrusage(RUSAGE_THREAD)
ca205a75
TK
1283if test "$rusage_thread" != "yes" ; then
1284 rusage_thread="no"
1285fi
44404c5a
JA
1286cat > $TMPC << EOF
1287#include <sys/time.h>
1288#include <sys/resource.h>
1289int main(int argc, char **argv)
1290{
1291 struct rusage ru;
1292 getrusage(RUSAGE_THREAD, &ru);
1293 return 0;
1294}
1295EOF
1296if compile_prog "" "" "RUSAGE_THREAD"; then
1297 rusage_thread="yes"
1298fi
1299echo "RUSAGE_THREAD $rusage_thread"
1300
7e09a9f1
JA
1301##########################################
1302# Check whether we have SCHED_IDLE
ca205a75
TK
1303if test "$sched_idle" != "yes" ; then
1304 sched_idle="no"
1305fi
7e09a9f1
JA
1306cat > $TMPC << EOF
1307#include <sched.h>
1308int main(int argc, char **argv)
1309{
1310 struct sched_param p;
1311 return sched_setscheduler(0, SCHED_IDLE, &p);
1312}
1313EOF
1314if compile_prog "" "" "SCHED_IDLE"; then
1315 sched_idle="yes"
1316fi
1317echo "SCHED_IDLE $sched_idle"
1318
1eafa37a
JA
1319##########################################
1320# Check whether we have TCP_NODELAY
ca205a75
TK
1321if test "$tcp_nodelay" != "yes" ; then
1322 tcp_nodelay="no"
1323fi
1eafa37a
JA
1324cat > $TMPC << EOF
1325#include <stdio.h>
1326#include <sys/types.h>
1327#include <sys/socket.h>
1328#include <netinet/tcp.h>
1329int main(int argc, char **argv)
1330{
1331 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1332}
1333EOF
1334if compile_prog "" "" "TCP_NODELAY"; then
1335 tcp_nodelay="yes"
1336fi
1337echo "TCP_NODELAY $tcp_nodelay"
1338
1008602c
JA
1339##########################################
1340# Check whether we have SO_SNDBUF
ca205a75
TK
1341if test "$window_size" != "yes" ; then
1342 window_size="no"
1343fi
1008602c
JA
1344cat > $TMPC << EOF
1345#include <stdio.h>
1346#include <sys/types.h>
1347#include <sys/socket.h>
1348#include <netinet/tcp.h>
1349int main(int argc, char **argv)
1350{
1351 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1352 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1353}
1354EOF
1355if compile_prog "" "" "SO_SNDBUF"; then
1356 window_size="yes"
1357fi
1358echo "Net engine window_size $window_size"
1359
e5f34d95
JA
1360##########################################
1361# Check whether we have TCP_MAXSEG
ca205a75
TK
1362if test "$mss" != "yes" ; then
1363 mss="no"
1364fi
e5f34d95
JA
1365cat > $TMPC << EOF
1366#include <stdio.h>
1367#include <sys/types.h>
1368#include <sys/socket.h>
1369#include <netinet/tcp.h>
1370#include <arpa/inet.h>
1371#include <netinet/in.h>
1372int main(int argc, char **argv)
1373{
1374 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1375}
1376EOF
1377if compile_prog "" "" "TCP_MAXSEG"; then
1378 mss="yes"
1379fi
1380echo "TCP_MAXSEG $mss"
1381
38b9354a
JA
1382##########################################
1383# Check whether we have RLIMIT_MEMLOCK
ca205a75
TK
1384if test "$rlimit_memlock" != "yes" ; then
1385 rlimit_memlock="no"
1386fi
38b9354a
JA
1387cat > $TMPC << EOF
1388#include <sys/time.h>
1389#include <sys/resource.h>
1390int main(int argc, char **argv)
1391{
1392 struct rlimit rl;
1393 return getrlimit(RLIMIT_MEMLOCK, &rl);
1394}
1395EOF
1396if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1397 rlimit_memlock="yes"
1398fi
1399echo "RLIMIT_MEMLOCK $rlimit_memlock"
1400
07fc0acd
JA
1401##########################################
1402# Check whether we have pwritev/preadv
ca205a75
TK
1403if test "$pwritev" != "yes" ; then
1404 pwritev="no"
1405fi
07fc0acd
JA
1406cat > $TMPC << EOF
1407#include <stdio.h>
1408#include <sys/uio.h>
1409int main(int argc, char **argv)
1410{
1411 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1412}
1413EOF
1414if compile_prog "" "" "pwritev"; then
1415 pwritev="yes"
1416fi
1417echo "pwritev/preadv $pwritev"
1418
2cafffbe
JA
1419##########################################
1420# Check whether we have pwritev2/preadv2
ca205a75
TK
1421if test "$pwritev2" != "yes" ; then
1422 pwritev2="no"
1423fi
2cafffbe
JA
1424cat > $TMPC << EOF
1425#include <stdio.h>
1426#include <sys/uio.h>
1427int main(int argc, char **argv)
1428{
1429 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1430}
1431EOF
1432if compile_prog "" "" "pwritev2"; then
1433 pwritev2="yes"
1434fi
1435echo "pwritev2/preadv2 $pwritev2"
1436
ecad55e9
JA
1437##########################################
1438# Check whether we have the required functions for ipv6
ca205a75
TK
1439if test "$ipv6" != "yes" ; then
1440 ipv6="no"
1441fi
ecad55e9
JA
1442cat > $TMPC << EOF
1443#include <sys/types.h>
1444#include <sys/socket.h>
d219028d 1445#include <netinet/in.h>
ecad55e9
JA
1446#include <netdb.h>
1447#include <stdio.h>
1448int main(int argc, char **argv)
1449{
1450 struct addrinfo hints;
1451 struct in6_addr addr;
1452 int ret;
1453
1454 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1455 freeaddrinfo(NULL);
1456 printf("%s\n", gai_strerror(ret));
1457 addr = in6addr_any;
1458 return 0;
1459}
1460EOF
1461if compile_prog "" "" "ipv6"; then
1462 ipv6="yes"
1463fi
1464echo "IPv6 helpers $ipv6"
07fc0acd 1465
fc5c0345
DG
1466##########################################
1467# check for rbd
ca205a75
TK
1468if test "$rbd" != "yes" ; then
1469 rbd="no"
1470fi
fc5c0345
DG
1471cat > $TMPC << EOF
1472#include <rbd/librbd.h>
1473
1474int main(int argc, char **argv)
1475{
1476
1477 rados_t cluster;
1478 rados_ioctx_t io_ctx;
1479 const char pool[] = "rbd";
1480
1481 int major, minor, extra;
1482 rbd_version(&major, &minor, &extra);
1483
1484 rados_ioctx_create(cluster, pool, &io_ctx);
1485 return 0;
1486}
1487EOF
ce18290e 1488if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
fc5c0345
DG
1489 LIBS="-lrbd -lrados $LIBS"
1490 rbd="yes"
1491fi
1492echo "Rados Block Device engine $rbd"
1493
53b6c979
PL
1494##########################################
1495# check for rbd_poll
ca205a75
TK
1496if test "$rbd_poll" != "yes" ; then
1497 rbd_poll="no"
1498fi
53b6c979
PL
1499if test "$rbd" = "yes"; then
1500cat > $TMPC << EOF
1501#include <rbd/librbd.h>
1502#include <sys/eventfd.h>
1503
1504int main(int argc, char **argv)
1505{
1506 rbd_image_t image;
1507 rbd_completion_t comp;
1508
1509 int fd = eventfd(0, EFD_NONBLOCK);
1510 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1511 rbd_poll_io_events(image, comp, 1);
1512
1513 return 0;
1514}
1515EOF
1516if compile_prog "" "-lrbd -lrados" "rbd"; then
1517 rbd_poll="yes"
1518fi
1519echo "rbd_poll $rbd_poll"
1520fi
1521
903b2812
JA
1522##########################################
1523# check for rbd_invaidate_cache()
ca205a75
TK
1524if test "$rbd_inval" != "yes" ; then
1525 rbd_inval="no"
1526fi
903b2812
JA
1527if test "$rbd" = "yes"; then
1528cat > $TMPC << EOF
1529#include <rbd/librbd.h>
1530
1531int main(int argc, char **argv)
1532{
1533 rbd_image_t image;
1534
1535 return rbd_invalidate_cache(image);
1536}
1537EOF
1538if compile_prog "" "-lrbd -lrados" "rbd"; then
1539 rbd_inval="yes"
1540fi
1541echo "rbd_invalidate_cache $rbd_inval"
1542fi
1543
a4c4c346 1544##########################################
1545# check for blkin
ca205a75
TK
1546if test "$rbd_blkin" != "yes" ; then
1547 rbd_blkin="no"
1548fi
a4c4c346 1549cat > $TMPC << EOF
1550#include <rbd/librbd.h>
1551#include <zipkin_c.h>
1552
1553int main(int argc, char **argv)
1554{
1555 int r;
1556 struct blkin_trace_info t_info;
1557 blkin_init_trace_info(&t_info);
1558 rbd_completion_t completion;
1559 rbd_image_t image;
1560 uint64_t off;
1561 size_t len;
1562 const char *buf;
1563 r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
1564 return 0;
1565}
1566EOF
1567if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
1568 && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
1569 LIBS="-lblkin $LIBS"
1570 rbd_blkin="yes"
1571fi
1572echo "rbd blkin tracing $rbd_blkin"
1573
2e802282
JA
1574##########################################
1575# Check whether we have setvbuf
ca205a75
TK
1576if test "$setvbuf" != "yes" ; then
1577 setvbuf="no"
1578fi
2e802282
JA
1579cat > $TMPC << EOF
1580#include <stdio.h>
1581int main(int argc, char **argv)
1582{
1583 FILE *f = NULL;
1584 char buf[80];
1585 setvbuf(f, buf, _IOFBF, sizeof(buf));
1586 return 0;
1587}
1588EOF
1589if compile_prog "" "" "setvbuf"; then
1590 setvbuf="yes"
1591fi
1592echo "setvbuf $setvbuf"
fc5c0345 1593
6e7d7dfb 1594# check for gfapi
ca205a75
TK
1595if test "$gfapi" != "yes" ; then
1596 gfapi="no"
1597fi
6e7d7dfb 1598cat > $TMPC << EOF
1599#include <glusterfs/api/glfs.h>
1600
1601int main(int argc, char **argv)
1602{
1603
1604 glfs_t *g = glfs_new("foo");
1605
1606 return 0;
1607}
1608EOF
ce18290e 1609if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
6e7d7dfb 1610 LIBS="-lgfapi -lglusterfs $LIBS"
1611 gfapi="yes"
1612fi
6fa14b99 1613 echo "Gluster API engine $gfapi"
6e7d7dfb 1614
6fa14b99 1615##########################################
ca205a75 1616# check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
6876c98c 1617if test "$gfapi" = "yes" ; then
6fa14b99 1618gf_fadvise="no"
1619cat > $TMPC << EOF
1620#include <glusterfs/api/glfs.h>
1621
1622int main(int argc, char **argv)
1623{
1624 struct glfs_fd *fd;
1625 int ret = glfs_fadvise(fd, 0, 0, 1);
1626
1627 return 0;
1628}
1629EOF
6fa14b99 1630if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1631 gf_fadvise="yes"
1632fi
1633echo "Gluster API use fadvise $gf_fadvise"
6876c98c
JA
1634fi
1635
1636##########################################
1637# check for gfapi trim support
ca205a75
TK
1638if test "$gf_trim" != "yes" ; then
1639 gf_trim="no"
1640fi
6876c98c
JA
1641if test "$gfapi" = "yes" ; then
1642cat > $TMPC << EOF
1643#include <glusterfs/api/glfs.h>
1644
1645int main(int argc, char **argv)
1646{
1647 return glfs_discard_async(NULL, 0, 0);
1648}
1649EOF
1650if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1651 gf_trim="yes"
1652fi
1653echo "Gluster API trim support $gf_trim"
1654fi
fc5c0345 1655
81795ce3
CE
1656##########################################
1657# Check if we support stckf on s390
ca205a75
TK
1658if test "$s390_z196_facilities" != "yes" ; then
1659 s390_z196_facilities="no"
1660fi
81795ce3
CE
1661cat > $TMPC << EOF
1662#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1663int main(int argc, char **argv)
1664{
1665 /* We want just 1 double word to be returned. */
1666 register unsigned long reg0 asm("0") = 0;
1667 unsigned long stfle_bits;
1668 asm volatile(".machine push" "\n\t"
1669 ".machine \"z9-109\"" "\n\t"
1670 "stfle %0" "\n\t"
1671 ".machine pop" "\n"
1672 : "=QS" (stfle_bits), "+d" (reg0)
1673 : : "cc");
1674
1675 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1676 return 0;
1677 else
1678 return -1;
1679}
1680EOF
1681if compile_prog "" "" "s390_z196_facilities"; then
1682 $TMPE
1683 if [[ $? -eq 0 ]]; then
1684 s390_z196_facilities="yes"
1685 fi
1686fi
1687echo "s390_z196_facilities $s390_z196_facilities"
1b10477b
MM
1688
1689##########################################
1690# Check if we have required environment variables configured for libhdfs
1691if test "$libhdfs" = "yes" ; then
1692 hdfs_conf_error=0
1693 if test "$JAVA_HOME" = "" ; then
1694 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1695 hdfs_conf_error=1
1696 fi
1697 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1698 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1699 hdfs_conf_error=1
1700 fi
1701 if test "$FIO_LIBHDFS_LIB" = "" ; then
1702 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1703 hdfs_conf_error=1
1704 fi
1705 if test "$hdfs_conf_error" = "1" ; then
1706 exit 1
1707 fi
247e5436
JA
1708 FIO_HDFS_CPU=$cpu
1709 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1710 FIO_HDFS_CPU="amd64"
1711 fi
1b10477b
MM
1712fi
1713echo "HDFS engine $libhdfs"
1714
b8116a87
DE
1715##########################################
1716# Check whether we have MTD
ca205a75
TK
1717if test "$mtd" != "yes" ; then
1718 mtd="no"
1719fi
b8116a87 1720cat > $TMPC << EOF
0e1c454a 1721#include <string.h>
b8116a87
DE
1722#include <mtd/mtd-user.h>
1723#include <sys/ioctl.h>
1724int main(int argc, char **argv)
1725{
0e1c454a 1726 struct mtd_write_req ops;
b8116a87 1727 struct mtd_info_user info;
0e1c454a 1728 memset(&ops, 0, sizeof(ops));
400cd0ff 1729 info.type = MTD_MLCNANDFLASH;
b8116a87
DE
1730 return ioctl(0, MEMGETINFO, &info);
1731}
1732EOF
1733if compile_prog "" "" "mtd"; then
1734 mtd="yes"
1735fi
1736echo "MTD $mtd"
1737
3ee2a3c1
DJ
1738##########################################
1739# Check whether we have libpmem
ca205a75
TK
1740if test "$libpmem" != "yes" ; then
1741 libpmem="no"
1742fi
3ee2a3c1
DJ
1743cat > $TMPC << EOF
1744#include <libpmem.h>
1745int main(int argc, char **argv)
1746{
1747 int rc;
1748 rc = pmem_is_pmem(0, 0);
1749 return 0;
1750}
1751EOF
1752if compile_prog "" "-lpmem" "libpmem"; then
1753 libpmem="yes"
cf8775b8 1754 LIBS="-lpmem $LIBS"
3ee2a3c1
DJ
1755fi
1756echo "libpmem $libpmem"
1757
1758##########################################
1759# Check whether we have libpmemblk
cf8775b8 1760# libpmem is a prerequisite
ca205a75
TK
1761if test "$libpmemblk" != "yes" ; then
1762 libpmemblk="no"
1763fi
cf8775b8
RE
1764if test "$libpmem" = "yes"; then
1765 cat > $TMPC << EOF
3ee2a3c1
DJ
1766#include <libpmemblk.h>
1767int main(int argc, char **argv)
1768{
cf8775b8
RE
1769 PMEMblkpool *pbp;
1770 pbp = pmemblk_open("", 0);
3ee2a3c1
DJ
1771 return 0;
1772}
1773EOF
cf8775b8
RE
1774 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1775 libpmemblk="yes"
1776 LIBS="-lpmemblk $LIBS"
1777 fi
3ee2a3c1
DJ
1778fi
1779echo "libpmemblk $libpmemblk"
1780
cf8775b8 1781# Choose the ioengines
3ee2a3c1
DJ
1782if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1783 devdax="yes"
1784 if test "$libpmemblk" = "yes"; then
1785 pmemblk="yes"
1786 fi
1787fi
1788
43f3cec2
BB
1789##########################################
1790# Report whether pmemblk engine is enabled
cf8775b8 1791echo "NVML pmemblk engine $pmemblk"
43f3cec2 1792
cbb15e42
DJ
1793##########################################
1794# Report whether dev-dax engine is enabled
cf8775b8 1795echo "NVML dev-dax engine $devdax"
cbb15e42 1796
b470a02c
SC
1797# Check if we have lex/yacc available
1798yacc="no"
e7b2c7a3 1799yacc_is_bison="no"
b470a02c
SC
1800lex="no"
1801arith="no"
de26b824 1802if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
cf6dd80e 1803if test "$targetos" != "SunOS" ; then
e7b2c7a3 1804LEX=$(which lex 2> /dev/null)
b470a02c
SC
1805if test -x "$LEX" ; then
1806 lex="yes"
1807fi
7e0049e9 1808YACC=$(which bison 2> /dev/null)
b470a02c
SC
1809if test -x "$YACC" ; then
1810 yacc="yes"
7e0049e9 1811 yacc_is_bison="yes"
e7b2c7a3 1812else
7e0049e9 1813 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
1814 if test -x "$YACC" ; then
1815 yacc="yes"
e7b2c7a3 1816 fi
b470a02c
SC
1817fi
1818if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1819 arith="yes"
1820fi
1821
1822if test "$arith" = "yes" ; then
1823cat > $TMPC << EOF
1824extern int yywrap(void);
1825
1826int main(int argc, char **argv)
1827{
1828 yywrap();
1829 return 0;
1830}
1831EOF
719cda03
JA
1832if compile_prog "" "-ll" "lex"; then
1833 LIBS="-ll $LIBS"
b470a02c
SC
1834else
1835 arith="no"
1836fi
1837fi
cf6dd80e 1838fi
a655bbc4 1839fi
b470a02c 1840
63bda378
JA
1841# Check if lex fails using -o
1842if test "$arith" = "yes" ; then
daf705b5
JA
1843if test "$force_no_lex_o" = "yes" ; then
1844 lex_use_o="no"
1845else
63bda378
JA
1846$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1847if test "$?" = "0" ; then
1848 lex_use_o="yes"
1849else
1850 lex_use_o="no"
1851fi
1852fi
daf705b5 1853fi
63bda378 1854
b470a02c
SC
1855echo "lex/yacc for arithmetic $arith"
1856
aae599ba
JA
1857##########################################
1858# Check whether we have setmntent/getmntent
ca205a75
TK
1859if test "$getmntent" != "yes" ; then
1860 getmntent="no"
1861fi
aae599ba
JA
1862cat > $TMPC << EOF
1863#include <stdio.h>
1864#include <mntent.h>
1865int main(int argc, char **argv)
1866{
1867 FILE *mtab = setmntent(NULL, "r");
1868 struct mntent *mnt = getmntent(mtab);
1581b82a 1869 endmntent(mtab);
aae599ba
JA
1870 return 0;
1871}
1872EOF
1873if compile_prog "" "" "getmntent"; then
1874 getmntent="yes"
1875fi
1876echo "getmntent $getmntent"
1877
e7e136da
TK
1878##########################################
1879# Check whether we have getmntinfo
b765bec0
TK
1880# These are originally added for BSDs, but may also work
1881# on other operating systems with getmntinfo(3).
1882
1883# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1884# Note that NetBSD needs -Werror to catch warning as error.
ca205a75
TK
1885if test "$getmntinfo" != "yes" ; then
1886 getmntinfo="no"
1887fi
e7e136da
TK
1888cat > $TMPC << EOF
1889#include <stdio.h>
1890#include <sys/param.h>
1891#include <sys/mount.h>
1892int main(int argc, char **argv)
1893{
9ada751d 1894 struct statfs *st;
e7e136da
TK
1895 return getmntinfo(&st, MNT_NOWAIT);
1896}
1897EOF
b765bec0 1898if compile_prog "-Werror" "" "getmntinfo"; then
e7e136da
TK
1899 getmntinfo="yes"
1900fi
1901echo "getmntinfo $getmntinfo"
1902
b765bec0 1903# getmntinfo(3) for NetBSD.
ca205a75
TK
1904if test "$getmntinfo_statvfs" != "yes" ; then
1905 getmntinfo_statvfs="no"
1906fi
b765bec0
TK
1907cat > $TMPC << EOF
1908#include <stdio.h>
1909#include <sys/statvfs.h>
1910int main(int argc, char **argv)
1911{
1912 struct statvfs *st;
1913 return getmntinfo(&st, MNT_NOWAIT);
1914}
1915EOF
1916# Skip the test if the one with statfs arg is detected.
1917if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1918 getmntinfo_statvfs="yes"
1919 echo "getmntinfo_statvfs $getmntinfo_statvfs"
1920fi
1921
5018f79f
AH
1922##########################################
1923# Check whether we have _Static_assert
ca205a75
TK
1924if test "$static_assert" != "yes" ; then
1925 static_assert="no"
1926fi
5018f79f
AH
1927cat > $TMPC << EOF
1928#include <assert.h>
94815a5c
JA
1929#include <stdlib.h>
1930#undef offsetof
1931#ifdef __compiler_offsetof
1932#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1933#else
1934#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1935#endif
1936
1937#define container_of(ptr, type, member) ({ \
1938 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
1939 (type *)( (char *)__mptr - offsetof(type,member) );})
1940
1941struct foo {
1942 int a, b;
1943};
1944
5018f79f
AH
1945int main(int argc, char **argv)
1946{
94815a5c 1947 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
5018f79f
AH
1948 return 0 ;
1949}
1950EOF
1951if compile_prog "" "" "static_assert"; then
1952 static_assert="yes"
1953fi
1954echo "Static Assert $static_assert"
e39c0676
JA
1955
1956##########################################
1957# Check whether we have bool / stdbool.h
ca205a75
TK
1958if test "$have_bool" != "yes" ; then
1959 have_bool="no"
1960fi
e39c0676
JA
1961cat > $TMPC << EOF
1962#include <stdbool.h>
1963int main(int argc, char **argv)
1964{
1965 bool var = true;
1966 return var != false;
1967}
1968EOF
1969if compile_prog "" "" "bool"; then
1970 have_bool="yes"
1971fi
1972echo "bool $have_bool"
1973
214e2d56 1974##########################################
1975# check march=armv8-a+crc+crypto
ca205a75
TK
1976if test "$march_armv8_a_crc_crypto" != "yes" ; then
1977 march_armv8_a_crc_crypto="no"
1978fi
214e2d56 1979if test "$cpu" = "arm64" ; then
1980 cat > $TMPC <<EOF
9b153dc2
TT
1981#include <sys/auxv.h>
1982#include <arm_acle.h>
1983#include <arm_neon.h>
1984
214e2d56 1985int main(void)
1986{
1987 return 0;
1988}
1989EOF
1990 if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
1991 march_armv8_a_crc_crypto="yes"
1992 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
1993 fi
1994fi
1995echo "march_armv8_a_crc_crypto $march_armv8_a_crc_crypto"
1996
03553853
YR
1997##########################################
1998# cuda probe
1999cuda="no"
2000cat > $TMPC << EOF
2001#include <cuda.h>
2002int main(int argc, char **argv)
2003{
2004 return cuInit(0);
2005}
2006EOF
4bd2c8b9 2007if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
03553853
YR
2008 cuda="yes"
2009 LIBS="-lcuda $LIBS"
2010fi
2011echo "cuda $cuda"
214e2d56 2012
67bf9823
JA
2013#############################################################################
2014
67bf9823 2015if test "$wordsize" = "64" ; then
4feafb1e 2016 output_sym "CONFIG_64BIT"
67bf9823 2017elif test "$wordsize" = "32" ; then
4feafb1e 2018 output_sym "CONFIG_32BIT"
67bf9823 2019else
d7145a78 2020 fatal "Unknown wordsize!"
67bf9823 2021fi
0dcebdf4 2022if test "$bigendian" = "yes" ; then
4feafb1e 2023 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 2024else
4feafb1e 2025 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 2026fi
3989b143
JA
2027if test "$zlib" = "yes" ; then
2028 output_sym "CONFIG_ZLIB"
2029fi
67bf9823 2030if test "$libaio" = "yes" ; then
4feafb1e 2031 output_sym "CONFIG_LIBAIO"
67bf9823
JA
2032fi
2033if test "$posix_aio" = "yes" ; then
4feafb1e 2034 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
2035fi
2036if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 2037 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823 2038fi
06eac6b2
SW
2039if test "$posix_pshared" = "yes" ; then
2040 output_sym "CONFIG_PSHARED"
2041fi
67bf9823 2042if test "$linux_fallocate" = "yes" ; then
4feafb1e 2043 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
2044fi
2045if test "$posix_fallocate" = "yes" ; then
4feafb1e 2046 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
2047fi
2048if test "$fdatasync" = "yes" ; then
4feafb1e 2049 output_sym "CONFIG_FDATASYNC"
67bf9823
JA
2050fi
2051if test "$sync_file_range" = "yes" ; then
4feafb1e 2052 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
2053fi
2054if test "$sfaa" = "yes" ; then
4feafb1e 2055 output_sym "CONFIG_SFAA"
67bf9823 2056fi
954cd73a 2057if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 2058 output_sym "CONFIG_RDMA"
67bf9823
JA
2059fi
2060if test "$clock_gettime" = "yes" ; then
4feafb1e 2061 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
2062fi
2063if test "$clock_monotonic" = "yes" ; then
4feafb1e 2064 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823 2065fi
c544f604
SN
2066if test "$clock_monotonic_raw" = "yes" ; then
2067 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2068fi
67bf9823 2069if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 2070 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823 2071fi
25f8227d
JA
2072if test "$clockid_t" = "yes"; then
2073 output_sym "CONFIG_CLOCKID_T"
2074fi
67bf9823 2075if test "$gettimeofday" = "yes" ; then
4feafb1e 2076 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
2077fi
2078if test "$posix_fadvise" = "yes" ; then
4feafb1e 2079 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
2080fi
2081if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 2082 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 2083elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 2084 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
2085fi
2086if test "$strsep" = "yes" ; then
4feafb1e 2087 output_sym "CONFIG_STRSEP"
67bf9823 2088fi
9ad8da82
JA
2089if test "$strcasestr" = "yes" ; then
2090 output_sym "CONFIG_STRCASESTR"
2091fi
5ad7be56
KD
2092if test "$strlcat" = "yes" ; then
2093 output_sym "CONFIG_STRLCAT"
2094fi
67bf9823 2095if test "$getopt_long_only" = "yes" ; then
4feafb1e 2096 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
2097fi
2098if test "$inet_aton" = "yes" ; then
4feafb1e 2099 output_sym "CONFIG_INET_ATON"
67bf9823
JA
2100fi
2101if test "$socklen_t" = "yes" ; then
4feafb1e 2102 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
2103fi
2104if test "$ext4_me" = "yes" ; then
4feafb1e 2105 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
2106fi
2107if test "$linux_splice" = "yes" ; then
4feafb1e 2108 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
2109fi
2110if test "$guasi" = "yes" ; then
4feafb1e 2111 output_sym "CONFIG_GUASI"
67bf9823
JA
2112fi
2113if test "$fusion_aw" = "yes" ; then
4feafb1e 2114 output_sym "CONFIG_FUSION_AW"
67bf9823 2115fi
50206d9b 2116if test "$libnuma_v2" = "yes" ; then
4feafb1e 2117 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
2118fi
2119if test "$solaris_aio" = "yes" ; then
4feafb1e 2120 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
2121fi
2122if test "$tls_thread" = "yes" ; then
4feafb1e 2123 output_sym "CONFIG_TLS_THREAD"
67bf9823 2124fi
44404c5a 2125if test "$rusage_thread" = "yes" ; then
4feafb1e 2126 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 2127fi
91f94d5b 2128if test "$gfio" = "yes" ; then
bad7e42c 2129 output_sym "CONFIG_GFIO"
91f94d5b 2130fi
c8931876
JA
2131if test "$esx" = "yes" ; then
2132 output_sym "CONFIG_ESX"
2133 output_sym "CONFIG_NO_SHM"
2134fi
7e09a9f1
JA
2135if test "$sched_idle" = "yes" ; then
2136 output_sym "CONFIG_SCHED_IDLE"
2137fi
1eafa37a
JA
2138if test "$tcp_nodelay" = "yes" ; then
2139 output_sym "CONFIG_TCP_NODELAY"
2140fi
1008602c
JA
2141if test "$window_size" = "yes" ; then
2142 output_sym "CONFIG_NET_WINDOWSIZE"
2143fi
e5f34d95
JA
2144if test "$mss" = "yes" ; then
2145 output_sym "CONFIG_NET_MSS"
2146fi
38b9354a
JA
2147if test "$rlimit_memlock" = "yes" ; then
2148 output_sym "CONFIG_RLIMIT_MEMLOCK"
2149fi
07fc0acd
JA
2150if test "$pwritev" = "yes" ; then
2151 output_sym "CONFIG_PWRITEV"
2152fi
2cafffbe
JA
2153if test "$pwritev2" = "yes" ; then
2154 output_sym "CONFIG_PWRITEV2"
2155fi
ecad55e9
JA
2156if test "$ipv6" = "yes" ; then
2157 output_sym "CONFIG_IPV6"
2158fi
fc5c0345
DG
2159if test "$rbd" = "yes" ; then
2160 output_sym "CONFIG_RBD"
2161fi
53b6c979
PL
2162if test "$rbd_poll" = "yes" ; then
2163 output_sym "CONFIG_RBD_POLL"
2164fi
903b2812
JA
2165if test "$rbd_inval" = "yes" ; then
2166 output_sym "CONFIG_RBD_INVAL"
2167fi
a4c4c346 2168if test "$rbd_blkin" = "yes" ; then
2169 output_sym "CONFIG_RBD_BLKIN"
2170fi
2e802282
JA
2171if test "$setvbuf" = "yes" ; then
2172 output_sym "CONFIG_SETVBUF"
2173fi
81795ce3
CE
2174if test "$s390_z196_facilities" = "yes" ; then
2175 output_sym "CONFIG_S390_Z196_FACILITIES"
2176 CFLAGS="$CFLAGS -march=z9-109"
2177fi
6e7d7dfb 2178if test "$gfapi" = "yes" ; then
2179 output_sym "CONFIG_GFAPI"
2180fi
6fa14b99 2181if test "$gf_fadvise" = "yes" ; then
2182 output_sym "CONFIG_GF_FADVISE"
2183fi
6876c98c
JA
2184if test "$gf_trim" = "yes" ; then
2185 output_sym "CONFIG_GF_TRIM"
2186fi
1b10477b
MM
2187if test "$libhdfs" = "yes" ; then
2188 output_sym "CONFIG_LIBHDFS"
247e5436 2189 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
1527dc50
FB
2190 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2191 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2192 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2193 fi
b8116a87
DE
2194if test "$mtd" = "yes" ; then
2195 output_sym "CONFIG_MTD"
2196fi
43f3cec2
BB
2197if test "$pmemblk" = "yes" ; then
2198 output_sym "CONFIG_PMEMBLK"
2199fi
cbb15e42
DJ
2200if test "$devdax" = "yes" ; then
2201 output_sym "CONFIG_LINUX_DEVDAX"
2202fi
b470a02c
SC
2203if test "$arith" = "yes" ; then
2204 output_sym "CONFIG_ARITHMETIC"
e7b2c7a3
JA
2205 if test "$yacc_is_bison" = "yes" ; then
2206 echo "YACC=$YACC -y" >> $config_host_mak
2207 else
2208 echo "YACC=$YACC" >> $config_host_mak
2209 fi
63bda378
JA
2210 if test "$lex_use_o" = "yes" ; then
2211 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2212 fi
b470a02c 2213fi
aae599ba
JA
2214if test "$getmntent" = "yes" ; then
2215 output_sym "CONFIG_GETMNTENT"
2216fi
e7e136da
TK
2217if test "$getmntinfo" = "yes" ; then
2218 output_sym "CONFIG_GETMNTINFO"
2219fi
b765bec0
TK
2220if test "$getmntinfo_statvfs" = "yes" ; then
2221 output_sym "CONFIG_GETMNTINFO_STATVFS"
2222fi
5018f79f
AH
2223if test "$static_assert" = "yes" ; then
2224 output_sym "CONFIG_STATIC_ASSERT"
2225fi
e39c0676
JA
2226if test "$have_bool" = "yes" ; then
2227 output_sym "CONFIG_HAVE_BOOL"
2228fi
484817a9
JA
2229if test "$disable_opt" = "yes" ; then
2230 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2231fi
605cf82e
JA
2232if test "$zlib" = "no" ; then
2233 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
2234fi
03553853
YR
2235if test "$cuda" = "yes" ; then
2236 output_sym "CONFIG_CUDA"
2237fi
605cf82e 2238
67bf9823 2239echo "LIBS+=$LIBS" >> $config_host_mak
86719845 2240echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 2241echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 2242echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 2243echo "CC=$cc" >> $config_host_mak
af4862b3 2244echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 2245echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
c61a3a44 2246
59d8f412 2247if [ `dirname $0` != "." -a ! -e Makefile ]; then
c61a3a44
JF
2248 cat > Makefile <<EOF
2249SRCDIR:=`dirname $0`
2250include \$(SRCDIR)/Makefile
2251EOF
2252fi