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