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