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