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