configure: add support for --prefix
[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"
020d54bd 138prefix=/usr/local
91f94d5b 139
cb1125b0
JA
140# parse options
141for opt do
142 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
143 case "$opt" in
020d54bd
JA
144 --prefix=*) prefix="$optarg"
145 ;;
8b156d8e
JA
146 --cpu=*) cpu="$optarg"
147 ;;
c8931876
JA
148 # esx is cross compiled and cannot be detect through simple uname calls
149 --esx)
150 esx="yes"
151 ;;
cb1125b0
JA
152 --cc=*) CC="$optarg"
153 ;;
208e4c8b
JA
154 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
155 ;;
b7c12794 156 --build-32bit-win) build_32bit_win="yes"
7409711b 157 ;;
d2aeedb9
JA
158 --build-static) build_static="yes"
159 ;;
91f94d5b 160 --enable-gfio)
ebec2094 161 gfio_check="yes"
899fab33 162 ;;
44462517
CF
163 --disable-numa) disable_numa="yes"
164 ;;
ce18290e
TM
165 --disable-rbd) disable_rbd="yes"
166 ;;
167 --disable-gfapi) disable_gfapi="yes"
168 ;;
1b10477b
MM
169 --enable-libhdfs) libhdfs="yes"
170 ;;
ba40757e
JA
171 --disable-shm) output_sym "CONFIG_NO_SHM"
172 ;;
827da4f5 173 --help)
47f44635 174 show_help="yes"
827da4f5 175 ;;
cb1125b0
JA
176 *)
177 echo "Bad option $opt"
47f44635
JA
178 show_help="yes"
179 exit_val=1
cb1125b0
JA
180 esac
181done
182
47f44635 183if test "$show_help" = "yes" ; then
020d54bd 184 echo "--prefix= Use this directory as installation prefix"
8b156d8e 185 echo "--cpu= Specify target CPU if auto-detect fails"
b7a99316 186 echo "--cc= Specify compiler to use"
899fab33 187 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
b7c12794 188 echo "--build-32bit-win Enable 32-bit build on Windows"
d2aeedb9 189 echo "--build-static Build a static fio"
c8931876 190 echo "--esx Configure build options for esx"
b7a99316 191 echo "--enable-gfio Enable building of gtk gfio"
44462517 192 echo "--disable-numa Disable libnuma even if found"
1b10477b 193 echo "--enable-libhdfs Enable hdfs support"
b7a99316 194 exit $exit_val
47f44635
JA
195fi
196
47986339
SH
197cross_prefix=${cross_prefix-${CROSS_COMPILE}}
198cc="${CC-${cross_prefix}gcc}"
199
6d0e9f83
AC
200if check_define __ANDROID__ ; then
201 targetos="Android"
202elif check_define __linux__ ; then
67bf9823 203 targetos="Linux"
67bf9823
JA
204elif check_define __OpenBSD__ ; then
205 targetos='OpenBSD'
206elif check_define __sun__ ; then
207 targetos='SunOS'
7cb024f8 208 CFLAGS="$CFLAGS -D_REENTRANT"
b24f59ab
SH
209elif check_define _WIN32 ; then
210 targetos='CYGWIN'
67bf9823
JA
211else
212 targetos=`uname -s`
213fi
214
53cd4eee
AC
215echo "# Automatically generated by configure - do not modify" > $config_host_mak
216printf "# Configured with:" >> $config_host_mak
217printf " '%s'" "$0" "$@" >> $config_host_mak
218echo >> $config_host_mak
219echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
220
67bf9823
JA
221# Some host OSes need non-standard checks for which CPU to use.
222# Note that these checks are broken for cross-compilation: if you're
223# cross-compiling to one of these OSes then you'll need to specify
224# the correct CPU with the --cpu option.
225case $targetos in
226Darwin)
227 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
228 # we can run 64-bit userspace code.
229 # If the user didn't specify a CPU explicitly and the kernel says this is
230 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
231 # detection code.
232 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
233 cpu="x86_64"
234 fi
235 ;;
236SunOS)
237 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
238 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
239 cpu="x86_64"
240 fi
adaa46d8 241 LIBS="-lnsl -lsocket"
cfd94f79
JA
242 ;;
243CYGWIN*)
244 echo "Forcing known good options on Windows"
4578d01f 245 if test -z "$CC" ; then
7409711b
HL
246 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
247 CC="i686-w64-mingw32-gcc"
248 else
249 CC="x86_64-w64-mingw32-gcc"
250 fi
4578d01f 251 fi
4feafb1e 252 output_sym "CONFIG_LITTLE_ENDIAN"
7409711b
HL
253 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
254 output_sym "CONFIG_32BIT"
255 else
256 output_sym "CONFIG_64BIT_LLP64"
257 fi
4feafb1e
JA
258 output_sym "CONFIG_FADVISE"
259 output_sym "CONFIG_SOCKLEN_T"
4feafb1e
JA
260 output_sym "CONFIG_FADVISE"
261 output_sym "CONFIG_SFAA"
262 output_sym "CONFIG_RUSAGE_THREAD"
263 output_sym "CONFIG_WINDOWSAIO"
264 output_sym "CONFIG_FDATASYNC"
59308a64 265 output_sym "CONFIG_CLOCK_MONOTONIC"
dc0518ca
BC
266 output_sym "CONFIG_GETTIMEOFDAY"
267 output_sym "CONFIG_CLOCK_GETTIME"
7e09a9f1 268 output_sym "CONFIG_SCHED_IDLE"
1eafa37a 269 output_sym "CONFIG_TCP_NODELAY"
7d6be13a 270 output_sym "CONFIG_TLS_THREAD"
ef07baa1 271 output_sym "CONFIG_IPV6"
4feafb1e 272 echo "CC=$CC" >> $config_host_mak
af4862b3 273 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
cfd94f79 274 exit 0
6d0e9f83 275 ;;
67bf9823
JA
276esac
277
278if test ! -z "$cpu" ; then
279 # command line argument
280 :
281elif check_define __i386__ ; then
282 cpu="i386"
283elif check_define __x86_64__ ; then
284 cpu="x86_64"
285elif check_define __sparc__ ; then
286 if check_define __arch64__ ; then
287 cpu="sparc64"
288 else
289 cpu="sparc"
290 fi
291elif check_define _ARCH_PPC ; then
292 if check_define _ARCH_PPC64 ; then
293 cpu="ppc64"
294 else
295 cpu="ppc"
296 fi
297elif check_define __mips__ ; then
298 cpu="mips"
299elif check_define __ia64__ ; then
300 cpu="ia64"
301elif check_define __s390__ ; then
302 if check_define __s390x__ ; then
303 cpu="s390x"
304 else
305 cpu="s390"
306 fi
307elif check_define __arm__ ; then
308 cpu="arm"
309elif check_define __hppa__ ; then
310 cpu="hppa"
311else
312 cpu=`uname -m`
313fi
314
315# Normalise host CPU name and set ARCH.
316case "$cpu" in
317 ia64|ppc|ppc64|s390|s390x|sparc64)
318 cpu="$cpu"
319 ;;
320 i386|i486|i586|i686|i86pc|BePC)
321 cpu="i386"
322 ;;
323 x86_64|amd64)
324 cpu="x86_64"
325 ;;
326 armv*b|armv*l|arm)
327 cpu="arm"
328 ;;
329 hppa|parisc|parisc64)
330 cpu="hppa"
331 ;;
332 mips*)
333 cpu="mips"
334 ;;
335 sparc|sun4[cdmuv])
336 cpu="sparc"
337 ;;
338 *)
8b156d8e 339 echo "Unknown CPU"
67bf9823
JA
340 ;;
341esac
342
dcbbf5b0 343if test -z "$CC" ; then
67bf9823
JA
344 if test "$targetos" = "FreeBSD"; then
345 if has clang; then
346 CC=clang
347 else
348 CC=gcc
349 fi
67bf9823
JA
350 fi
351fi
352
353cc="${CC-${cross_prefix}gcc}"
354
1a17cfdb
AC
355##########################################
356# check cross compile
357
358cross_compile="no"
359cat > $TMPC <<EOF
360int main(void)
361{
362 return 0;
363}
364EOF
365if compile_prog "" "" "cross"; then
366 $TMPE 2>/dev/null || cross_compile="yes"
367else
368 fatal "compile test failed"
369fi
370
0dcebdf4
JA
371##########################################
372# check endianness
373bigendian="no"
1a17cfdb
AC
374if test "$cross_compile" = "no" ; then
375 cat > $TMPC <<EOF
0dcebdf4
JA
376#include <inttypes.h>
377int main(void)
378{
379 volatile uint32_t i=0x01234567;
380 return (*((uint8_t*)(&i))) == 0x67;
381}
382EOF
1a17cfdb
AC
383 if compile_prog "" "" "endian"; then
384 $TMPE && bigendian="yes"
385 fi
386else
387 # If we're cross compiling, try our best to work it out and rely on the
388 # run-time check to fail if we get it wrong.
389 cat > $TMPC <<EOF
390#include <endian.h>
391int main(void)
392{
393#if __BYTE_ORDER != __BIG_ENDIAN
394# error "Unknown endianness"
395#endif
396}
397EOF
398 compile_prog "" "" "endian" && bigendian="yes"
399 check_define "__ARMEB__" && bigendian="yes"
400 check_define "__MIPSEB__" && bigendian="yes"
0dcebdf4
JA
401fi
402
403
67bf9823
JA
404echo "Operating system $targetos"
405echo "CPU $cpu"
0dcebdf4 406echo "Big endian $bigendian"
67bf9823 407echo "Compiler $cc"
1a17cfdb 408echo "Cross compile $cross_compile"
67bf9823
JA
409echo
410
d2aeedb9
JA
411##########################################
412# See if we need to build a static build
413if test "$build_static" = "yes" ; then
414 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
415 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
416else
417 build_static="no"
418fi
419echo "Static build $build_static"
420
67bf9823
JA
421##########################################
422# check for wordsize
423wordsize="0"
424cat > $TMPC <<EOF
142429e5
AC
425#include <limits.h>
426#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
67bf9823
JA
427int main(void)
428{
142429e5 429 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
67bf9823
JA
430 return 0;
431}
432EOF
142429e5
AC
433if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
434 wordsize="32"
435elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
436 wordsize="64"
437else
438 fatal "Unknown wordsize"
67bf9823
JA
439fi
440echo "Wordsize $wordsize"
441
a9bca4aa
JA
442##########################################
443# zlib probe
444zlib="no"
445cat > $TMPC <<EOF
e0186b6f 446#include <zlib.h>
a9bca4aa
JA
447int main(void)
448{
449 z_stream stream;
450 if (inflateInit(&stream) != Z_OK)
451 return 1;
452 return 0;
453}
454EOF
455if compile_prog "" "-lz" "zlib" ; then
456 zlib=yes
457 LIBS="-lz $LIBS"
a9bca4aa
JA
458fi
459echo "zlib $zlib"
460
67bf9823
JA
461##########################################
462# linux-aio probe
463libaio="no"
464cat > $TMPC <<EOF
465#include <libaio.h>
466#include <stddef.h>
467int main(void)
468{
469 io_setup(0, NULL);
470 return 0;
471}
472EOF
473if compile_prog "" "-laio" "libaio" ; then
474 libaio=yes
475 LIBS="-laio $LIBS"
476else
477 if test "$libaio" = "yes" ; then
c55d728b 478 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
67bf9823
JA
479 fi
480 libaio=no
481fi
482echo "Linux AIO support $libaio"
483
484##########################################
485# posix aio probe
486posix_aio="no"
487posix_aio_lrt="no"
488cat > $TMPC <<EOF
489#include <aio.h>
490int main(void)
491{
492 struct aiocb cb;
493 aio_read(&cb);
494 return 0;
495}
496EOF
497if compile_prog "" "" "posixaio" ; then
498 posix_aio="yes"
499elif compile_prog "" "-lrt" "posixaio"; then
500 posix_aio="yes"
501 posix_aio_lrt="yes"
502 LIBS="-lrt $LIBS"
503fi
504echo "POSIX AIO support $posix_aio"
505echo "POSIX AIO support needs -lrt $posix_aio_lrt"
506
507##########################################
508# posix aio fsync probe
509posix_aio_fsync="no"
510if test "$posix_aio" = "yes" ; then
511 cat > $TMPC <<EOF
512#include <fcntl.h>
513#include <aio.h>
514int main(void)
515{
516 struct aiocb cb;
517 return aio_fsync(O_SYNC, &cb);
518 return 0;
519}
520EOF
521 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
522 posix_aio_fsync=yes
523 fi
524fi
525echo "POSIX AIO fsync $posix_aio_fsync"
526
527##########################################
528# solaris aio probe
529solaris_aio="no"
530cat > $TMPC <<EOF
531#include <sys/types.h>
532#include <sys/asynch.h>
533#include <unistd.h>
534int main(void)
535{
536 aio_result_t res;
537 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
538 return 0;
539}
540EOF
541if compile_prog "" "-laio" "solarisaio" ; then
542 solaris_aio=yes
543 LIBS="-laio $LIBS"
544fi
545echo "Solaris AIO support $solaris_aio"
546
547##########################################
548# __sync_fetch_and_and test
549sfaa="no"
550cat > $TMPC << EOF
551static int sfaa(int *ptr)
552{
9c639a76 553 return __sync_fetch_and_add(ptr, 0);
67bf9823
JA
554}
555
556int main(int argc, char **argv)
557{
558 int val = 42;
559 sfaa(&val);
560 return val;
561}
562EOF
563if compile_prog "" "" "__sync_fetch_and_add()" ; then
564 sfaa="yes"
565fi
9c639a76 566echo "__sync_fetch_and_add $sfaa"
67bf9823
JA
567
568##########################################
569# libverbs probe
570libverbs="no"
571cat > $TMPC << EOF
572#include <stdio.h>
573#include <infiniband/arch.h>
574int main(int argc, char **argv)
575{
576 struct ibv_pd *pd = ibv_alloc_pd(NULL);
577 return 0;
578}
579EOF
580if compile_prog "" "-libverbs" "libverbs" ; then
581 libverbs="yes"
582 LIBS="-libverbs $LIBS"
583fi
584echo "libverbs $libverbs"
585
586##########################################
587# rdmacm probe
588rdmacm="no"
589cat > $TMPC << EOF
590#include <stdio.h>
591#include <rdma/rdma_cma.h>
592int main(int argc, char **argv)
593{
594 rdma_destroy_qp(NULL);
595 return 0;
596}
597EOF
598if compile_prog "" "-lrdmacm" "rdma"; then
599 rdmacm="yes"
600 LIBS="-lrdmacm $LIBS"
601fi
602echo "rdmacm $rdmacm"
603
604##########################################
605# Linux fallocate probe
606linux_fallocate="no"
607cat > $TMPC << EOF
608#include <stdio.h>
aa6738a5 609#include <fcntl.h>
67bf9823
JA
610#include <linux/falloc.h>
611int main(int argc, char **argv)
612{
613 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
614 return r;
615}
616EOF
617if compile_prog "" "" "linux_fallocate"; then
618 linux_fallocate="yes"
619fi
620echo "Linux fallocate $linux_fallocate"
621
622##########################################
623# POSIX fadvise probe
624posix_fadvise="no"
625cat > $TMPC << EOF
626#include <stdio.h>
627#include <fcntl.h>
628int main(int argc, char **argv)
629{
630 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
631 return r;
632}
633EOF
634if compile_prog "" "" "posix_fadvise"; then
635 posix_fadvise="yes"
636fi
637echo "POSIX fadvise $posix_fadvise"
638
639##########################################
640# POSIX fallocate probe
641posix_fallocate="no"
642cat > $TMPC << EOF
643#include <stdio.h>
644#include <fcntl.h>
645int main(int argc, char **argv)
646{
647 int r = posix_fallocate(0, 0, 1024);
648 return r;
649}
650EOF
651if compile_prog "" "" "posix_fallocate"; then
652 posix_fallocate="yes"
653fi
654echo "POSIX fallocate $posix_fallocate"
655
656##########################################
657# sched_set/getaffinity 2 or 3 argument test
658linux_2arg_affinity="no"
659linux_3arg_affinity="no"
660cat > $TMPC << EOF
67bf9823
JA
661#include <sched.h>
662int main(int argc, char **argv)
663{
664 cpu_set_t mask;
665 return sched_setaffinity(0, sizeof(mask), &mask);
666}
667EOF
668if compile_prog "" "" "sched_setaffinity(,,)"; then
669 linux_3arg_affinity="yes"
670else
671 cat > $TMPC << EOF
67bf9823
JA
672#include <sched.h>
673int main(int argc, char **argv)
674{
675 cpu_set_t mask;
676 return sched_setaffinity(0, &mask);
677}
678EOF
679 if compile_prog "" "" "sched_setaffinity(,)"; then
680 linux_2arg_affinity="yes"
681 fi
682fi
683echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
684echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
685
686##########################################
687# clock_gettime probe
688clock_gettime="no"
689cat > $TMPC << EOF
690#include <stdio.h>
691#include <time.h>
692int main(int argc, char **argv)
693{
694 return clock_gettime(0, NULL);
695}
696EOF
697if compile_prog "" "" "clock_gettime"; then
698 clock_gettime="yes"
699elif compile_prog "" "-lrt" "clock_gettime"; then
700 clock_gettime="yes"
701 LIBS="-lrt $LIBS"
702fi
703echo "clock_gettime $clock_gettime"
704
705##########################################
706# CLOCK_MONOTONIC probe
707clock_monotonic="no"
708if test "$clock_gettime" = "yes" ; then
709 cat > $TMPC << EOF
710#include <stdio.h>
711#include <time.h>
712int main(int argc, char **argv)
713{
714 return clock_gettime(CLOCK_MONOTONIC, NULL);
715}
716EOF
717 if compile_prog "" "$LIBS" "clock monotonic"; then
718 clock_monotonic="yes"
719 fi
720fi
721echo "CLOCK_MONOTONIC $clock_monotonic"
722
723##########################################
724# CLOCK_MONOTONIC_PRECISE probe
725clock_monotonic_precise="no"
726if test "$clock_gettime" = "yes" ; then
727 cat > $TMPC << EOF
728#include <stdio.h>
729#include <time.h>
730int main(int argc, char **argv)
731{
732 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
733}
734EOF
735 if compile_prog "" "$LIBS" "clock monotonic precise"; then
736 clock_monotonic_precise="yes"
737 fi
738fi
739echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
740
741##########################################
742# gettimeofday() probe
743gettimeofday="no"
744cat > $TMPC << EOF
745#include <sys/time.h>
746#include <stdio.h>
747int main(int argc, char **argv)
748{
749 struct timeval tv;
750 return gettimeofday(&tv, NULL);
751}
752EOF
753if compile_prog "" "" "gettimeofday"; then
754 gettimeofday="yes"
755fi
756echo "gettimeofday $gettimeofday"
757
758##########################################
759# fdatasync() probe
760fdatasync="no"
761cat > $TMPC << EOF
762#include <stdio.h>
763#include <unistd.h>
764int main(int argc, char **argv)
765{
766 return fdatasync(0);
767}
768EOF
769if compile_prog "" "" "fdatasync"; then
770 fdatasync="yes"
771fi
772echo "fdatasync $fdatasync"
773
774##########################################
775# sync_file_range() probe
776sync_file_range="no"
777cat > $TMPC << EOF
778#include <stdio.h>
779#include <unistd.h>
67bf9823
JA
780#include <fcntl.h>
781#include <linux/fs.h>
782int main(int argc, char **argv)
783{
784 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
785 SYNC_FILE_RANGE_WAIT_AFTER;
786 return sync_file_range(0, 0, 0, flags);
787}
788EOF
789if compile_prog "" "" "sync_file_range"; then
790 sync_file_range="yes"
791fi
792echo "sync_file_range $sync_file_range"
793
794##########################################
795# ext4 move extent probe
796ext4_me="no"
797cat > $TMPC << EOF
798#include <fcntl.h>
799#include <sys/ioctl.h>
800int main(int argc, char **argv)
801{
802 struct move_extent me;
803 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
804}
805EOF
c7165b8d
JA
806if compile_prog "" "" "ext4 move extent" ; then
807 ext4_me="yes"
808elif test $targetos = "Linux" ; then
809 # On Linux, just default to it on and let it error at runtime if we really
810 # don't have it. None of my updated systems have it defined, but it does
811 # work. Takes a while to bubble back.
67bf9823
JA
812 ext4_me="yes"
813fi
814echo "EXT4 move extent $ext4_me"
815
816##########################################
817# splice probe
818linux_splice="no"
819cat > $TMPC << EOF
67bf9823
JA
820#include <stdio.h>
821#include <fcntl.h>
822int main(int argc, char **argv)
823{
824 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
825}
826EOF
827if compile_prog "" "" "linux splice"; then
828 linux_splice="yes"
829fi
830echo "Linux splice(2) $linux_splice"
831
832##########################################
833# GUASI probe
834guasi="no"
835cat > $TMPC << EOF
836#include <guasi.h>
837#include <guasi_syscalls.h>
838int main(int argc, char **argv)
839{
840 guasi_t ctx = guasi_create(0, 0, 0);
841 return 0;
842}
843EOF
844if compile_prog "" "" "guasi"; then
845 guasi="yes"
846fi
847echo "GUASI $guasi"
848
849##########################################
850# fusion-aw probe
851fusion_aw="no"
852cat > $TMPC << EOF
b2c77c25 853#include <nvm/nvm_primitives.h>
67bf9823
JA
854int main(int argc, char **argv)
855{
b2c77c25
SK
856 nvm_version_t ver_info;
857 nvm_handle_t handle;
858
859 handle = nvm_get_handle(0, &ver_info);
860 return nvm_atomic_write(handle, 0, 0, 0);
67bf9823
JA
861}
862EOF
92aef550
ARJ
863if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
864 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
67bf9823
JA
865 fusion_aw="yes"
866fi
867echo "Fusion-io atomic engine $fusion_aw"
868
869##########################################
870# libnuma probe
871libnuma="no"
872cat > $TMPC << EOF
873#include <numa.h>
874int main(int argc, char **argv)
875{
876 return numa_available();
877}
878EOF
44462517 879if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
67bf9823
JA
880 libnuma="yes"
881 LIBS="-lnuma $LIBS"
882fi
883echo "libnuma $libnuma"
884
50206d9b
JA
885##########################################
886# libnuma 2.x version API
887if test "$libnuma" = "yes" ; then
888libnuma_v2="no"
889cat > $TMPC << EOF
890#include <numa.h>
891int main(int argc, char **argv)
892{
893 struct bitmask *mask = numa_parse_nodestring(NULL);
61bde962 894 return mask->size == 0;
50206d9b
JA
895}
896EOF
897if compile_prog "" "" "libnuma api"; then
898 libnuma_v2="yes"
899fi
900echo "libnuma v2 $libnuma_v2"
901fi
902
67bf9823
JA
903##########################################
904# strsep() probe
905strsep="no"
906cat > $TMPC << EOF
907#include <string.h>
908int main(int argc, char **argv)
909{
910 strsep(NULL, NULL);
911 return 0;
912}
913EOF
914if compile_prog "" "" "strsep"; then
915 strsep="yes"
916fi
917echo "strsep $strsep"
918
9ad8da82
JA
919##########################################
920# strcasestr() probe
921strcasestr="no"
922cat > $TMPC << EOF
923#include <string.h>
924int main(int argc, char **argv)
925{
aa6738a5 926 return strcasestr(argv[0], argv[1]) != NULL;
9ad8da82
JA
927}
928EOF
929if compile_prog "" "" "strcasestr"; then
930 strcasestr="yes"
931fi
932echo "strcasestr $strcasestr"
933
67bf9823
JA
934##########################################
935# getopt_long_only() probe
936getopt_long_only="no"
937cat > $TMPC << EOF
938#include <unistd.h>
939#include <stdio.h>
aa6738a5 940#include <getopt.h>
67bf9823
JA
941int main(int argc, char **argv)
942{
943 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
944 return c;
945}
946EOF
947if compile_prog "" "" "getopt_long_only"; then
948 getopt_long_only="yes"
949fi
950echo "getopt_long_only() $getopt_long_only"
951
952##########################################
953# inet_aton() probe
954inet_aton="no"
955cat > $TMPC << EOF
956#include <sys/socket.h>
957#include <arpa/inet.h>
958#include <stdio.h>
959int main(int argc, char **argv)
960{
961 struct in_addr in;
962 return inet_aton(NULL, &in);
963}
964EOF
965if compile_prog "" "" "inet_aton"; then
966 inet_aton="yes"
967fi
968echo "inet_aton $inet_aton"
969
970##########################################
971# socklen_t probe
972socklen_t="no"
973cat > $TMPC << EOF
f6482613 974#include <sys/socket.h>
67bf9823
JA
975int main(int argc, char **argv)
976{
977 socklen_t len = 0;
978 return len;
979}
980EOF
981if compile_prog "" "" "socklen_t"; then
982 socklen_t="yes"
983fi
984echo "socklen_t $socklen_t"
985
986##########################################
987# Whether or not __thread is supported for TLS
988tls_thread="no"
989cat > $TMPC << EOF
990#include <stdio.h>
aa6738a5 991static __thread int ret;
67bf9823
JA
992int main(int argc, char **argv)
993{
994 return ret;
995}
996EOF
997if compile_prog "" "" "__thread"; then
998 tls_thread="yes"
999fi
1000echo "__thread $tls_thread"
1001
91f94d5b 1002##########################################
2639f056 1003# Check if we have required gtk/glib support for gfio
ebec2094
JA
1004gfio="no"
1005if test "$gfio_check" = "yes" ; then
91f94d5b
JA
1006 cat > $TMPC << EOF
1007#include <glib.h>
1008#include <cairo.h>
1009#include <gtk/gtk.h>
1010int main(void)
1011{
1012 gdk_threads_enter();
91f94d5b 1013 gdk_threads_leave();
b7a99316
JA
1014
1015 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
91f94d5b
JA
1016}
1017EOF
1018GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
86719845
JA
1019ORG_LDFLAGS=$LDFLAGS
1020LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
91f94d5b
JA
1021if test "$?" != "0" ; then
1022 echo "configure: gtk and gthread not found"
1023 exit 1
1024fi
1025GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1026if test "$?" != "0" ; then
1027 echo "configure: gtk and gthread not found"
1028 exit 1
1029fi
b7a99316
JA
1030if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1031 r=$($TMPE)
1032 if test "$r" != "0" ; then
1033 gfio="yes"
86719845 1034 GFIO_LIBS="$LIBS $GTK_LIBS"
b7a99316
JA
1035 CFLAGS="$CFLAGS $GTK_CFLAGS"
1036 else
1037 echo "GTK found, but need version 2.18 or higher"
1038 gfio="no"
1039 fi
91f94d5b
JA
1040else
1041 echo "Please install gtk and gdk libraries"
1042 gfio="no"
1043fi
86719845 1044LDFLAGS=$ORG_LDFLAGS
91f94d5b
JA
1045fi
1046
ebec2094
JA
1047if test "$gfio_check" = "yes" ; then
1048 echo "gtk 2.18 or higher $gfio"
1049fi
91f94d5b 1050
44404c5a
JA
1051# Check whether we have getrusage(RUSAGE_THREAD)
1052rusage_thread="no"
1053cat > $TMPC << EOF
1054#include <sys/time.h>
1055#include <sys/resource.h>
1056int main(int argc, char **argv)
1057{
1058 struct rusage ru;
1059 getrusage(RUSAGE_THREAD, &ru);
1060 return 0;
1061}
1062EOF
1063if compile_prog "" "" "RUSAGE_THREAD"; then
1064 rusage_thread="yes"
1065fi
1066echo "RUSAGE_THREAD $rusage_thread"
1067
7e09a9f1
JA
1068##########################################
1069# Check whether we have SCHED_IDLE
1070sched_idle="no"
1071cat > $TMPC << EOF
1072#include <sched.h>
1073int main(int argc, char **argv)
1074{
1075 struct sched_param p;
1076 return sched_setscheduler(0, SCHED_IDLE, &p);
1077}
1078EOF
1079if compile_prog "" "" "SCHED_IDLE"; then
1080 sched_idle="yes"
1081fi
1082echo "SCHED_IDLE $sched_idle"
1083
1eafa37a
JA
1084##########################################
1085# Check whether we have TCP_NODELAY
1086tcp_nodelay="no"
1087cat > $TMPC << EOF
1088#include <stdio.h>
1089#include <sys/types.h>
1090#include <sys/socket.h>
1091#include <netinet/tcp.h>
1092int main(int argc, char **argv)
1093{
1094 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1095}
1096EOF
1097if compile_prog "" "" "TCP_NODELAY"; then
1098 tcp_nodelay="yes"
1099fi
1100echo "TCP_NODELAY $tcp_nodelay"
1101
1008602c
JA
1102##########################################
1103# Check whether we have SO_SNDBUF
1104window_size="no"
1105cat > $TMPC << EOF
1106#include <stdio.h>
1107#include <sys/types.h>
1108#include <sys/socket.h>
1109#include <netinet/tcp.h>
1110int main(int argc, char **argv)
1111{
1112 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1113 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1114}
1115EOF
1116if compile_prog "" "" "SO_SNDBUF"; then
1117 window_size="yes"
1118fi
1119echo "Net engine window_size $window_size"
1120
e5f34d95
JA
1121##########################################
1122# Check whether we have TCP_MAXSEG
1123mss="no"
1124cat > $TMPC << EOF
1125#include <stdio.h>
1126#include <sys/types.h>
1127#include <sys/socket.h>
1128#include <netinet/tcp.h>
1129#include <arpa/inet.h>
1130#include <netinet/in.h>
1131int main(int argc, char **argv)
1132{
1133 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1134}
1135EOF
1136if compile_prog "" "" "TCP_MAXSEG"; then
1137 mss="yes"
1138fi
1139echo "TCP_MAXSEG $mss"
1140
38b9354a
JA
1141##########################################
1142# Check whether we have RLIMIT_MEMLOCK
1143rlimit_memlock="no"
1144cat > $TMPC << EOF
1145#include <sys/time.h>
1146#include <sys/resource.h>
1147int main(int argc, char **argv)
1148{
1149 struct rlimit rl;
1150 return getrlimit(RLIMIT_MEMLOCK, &rl);
1151}
1152EOF
1153if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1154 rlimit_memlock="yes"
1155fi
1156echo "RLIMIT_MEMLOCK $rlimit_memlock"
1157
07fc0acd
JA
1158##########################################
1159# Check whether we have pwritev/preadv
1160pwritev="no"
1161cat > $TMPC << EOF
1162#include <stdio.h>
1163#include <sys/uio.h>
1164int main(int argc, char **argv)
1165{
1166 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1167}
1168EOF
1169if compile_prog "" "" "pwritev"; then
1170 pwritev="yes"
1171fi
1172echo "pwritev/preadv $pwritev"
1173
ecad55e9
JA
1174##########################################
1175# Check whether we have the required functions for ipv6
1176ipv6="no"
1177cat > $TMPC << EOF
1178#include <sys/types.h>
1179#include <sys/socket.h>
d219028d 1180#include <netinet/in.h>
ecad55e9
JA
1181#include <netdb.h>
1182#include <stdio.h>
1183int main(int argc, char **argv)
1184{
1185 struct addrinfo hints;
1186 struct in6_addr addr;
1187 int ret;
1188
1189 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1190 freeaddrinfo(NULL);
1191 printf("%s\n", gai_strerror(ret));
1192 addr = in6addr_any;
1193 return 0;
1194}
1195EOF
1196if compile_prog "" "" "ipv6"; then
1197 ipv6="yes"
1198fi
1199echo "IPv6 helpers $ipv6"
07fc0acd 1200
fc5c0345
DG
1201##########################################
1202# check for rbd
1203rbd="no"
1204cat > $TMPC << EOF
1205#include <rbd/librbd.h>
1206
1207int main(int argc, char **argv)
1208{
1209
1210 rados_t cluster;
1211 rados_ioctx_t io_ctx;
1212 const char pool[] = "rbd";
1213
1214 int major, minor, extra;
1215 rbd_version(&major, &minor, &extra);
1216
1217 rados_ioctx_create(cluster, pool, &io_ctx);
1218 return 0;
1219}
1220EOF
ce18290e 1221if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
fc5c0345
DG
1222 LIBS="-lrbd -lrados $LIBS"
1223 rbd="yes"
1224fi
1225echo "Rados Block Device engine $rbd"
1226
903b2812
JA
1227##########################################
1228# check for rbd_invaidate_cache()
1229rbd_inval="no"
1230if test "$rbd" = "yes"; then
1231cat > $TMPC << EOF
1232#include <rbd/librbd.h>
1233
1234int main(int argc, char **argv)
1235{
1236 rbd_image_t image;
1237
1238 return rbd_invalidate_cache(image);
1239}
1240EOF
1241if compile_prog "" "-lrbd -lrados" "rbd"; then
1242 rbd_inval="yes"
1243fi
1244echo "rbd_invalidate_cache $rbd_inval"
1245fi
1246
2e802282
JA
1247##########################################
1248# Check whether we have setvbuf
1249setvbuf="no"
1250cat > $TMPC << EOF
1251#include <stdio.h>
1252int main(int argc, char **argv)
1253{
1254 FILE *f = NULL;
1255 char buf[80];
1256 setvbuf(f, buf, _IOFBF, sizeof(buf));
1257 return 0;
1258}
1259EOF
1260if compile_prog "" "" "setvbuf"; then
1261 setvbuf="yes"
1262fi
1263echo "setvbuf $setvbuf"
fc5c0345 1264
6e7d7dfb 1265# check for gfapi
1266gfapi="no"
1267cat > $TMPC << EOF
1268#include <glusterfs/api/glfs.h>
1269
1270int main(int argc, char **argv)
1271{
1272
1273 glfs_t *g = glfs_new("foo");
1274
1275 return 0;
1276}
1277EOF
ce18290e 1278if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
6e7d7dfb 1279 LIBS="-lgfapi -lglusterfs $LIBS"
1280 gfapi="yes"
1281fi
6fa14b99 1282 echo "Gluster API engine $gfapi"
6e7d7dfb 1283
6fa14b99 1284##########################################
1285# check for gfapi fadvise support
6876c98c 1286if test "$gfapi" = "yes" ; then
6fa14b99 1287gf_fadvise="no"
1288cat > $TMPC << EOF
1289#include <glusterfs/api/glfs.h>
1290
1291int main(int argc, char **argv)
1292{
1293 struct glfs_fd *fd;
1294 int ret = glfs_fadvise(fd, 0, 0, 1);
1295
1296 return 0;
1297}
1298EOF
6fa14b99 1299if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1300 gf_fadvise="yes"
1301fi
1302echo "Gluster API use fadvise $gf_fadvise"
6876c98c
JA
1303fi
1304
1305##########################################
1306# check for gfapi trim support
1307gf_trim="no"
1308if test "$gfapi" = "yes" ; then
1309cat > $TMPC << EOF
1310#include <glusterfs/api/glfs.h>
1311
1312int main(int argc, char **argv)
1313{
1314 return glfs_discard_async(NULL, 0, 0);
1315}
1316EOF
1317if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1318 gf_trim="yes"
1319fi
1320echo "Gluster API trim support $gf_trim"
1321fi
fc5c0345 1322
81795ce3
CE
1323##########################################
1324# Check if we support stckf on s390
1325s390_z196_facilities="no"
1326cat > $TMPC << EOF
1327#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1328int main(int argc, char **argv)
1329{
1330 /* We want just 1 double word to be returned. */
1331 register unsigned long reg0 asm("0") = 0;
1332 unsigned long stfle_bits;
1333 asm volatile(".machine push" "\n\t"
1334 ".machine \"z9-109\"" "\n\t"
1335 "stfle %0" "\n\t"
1336 ".machine pop" "\n"
1337 : "=QS" (stfle_bits), "+d" (reg0)
1338 : : "cc");
1339
1340 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1341 return 0;
1342 else
1343 return -1;
1344}
1345EOF
1346if compile_prog "" "" "s390_z196_facilities"; then
1347 $TMPE
1348 if [[ $? -eq 0 ]]; then
1349 s390_z196_facilities="yes"
1350 fi
1351fi
1352echo "s390_z196_facilities $s390_z196_facilities"
1b10477b
MM
1353
1354##########################################
1355# Check if we have required environment variables configured for libhdfs
1356if test "$libhdfs" = "yes" ; then
1357 hdfs_conf_error=0
1358 if test "$JAVA_HOME" = "" ; then
1359 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1360 hdfs_conf_error=1
1361 fi
1362 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1363 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1364 hdfs_conf_error=1
1365 fi
1366 if test "$FIO_LIBHDFS_LIB" = "" ; then
1367 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1368 hdfs_conf_error=1
1369 fi
1370 if test "$hdfs_conf_error" = "1" ; then
1371 exit 1
1372 fi
1373fi
1374echo "HDFS engine $libhdfs"
1375
b8116a87
DE
1376##########################################
1377# Check whether we have MTD
1378mtd="no"
1379cat > $TMPC << EOF
1380#include <mtd/mtd-user.h>
1381#include <sys/ioctl.h>
1382int main(int argc, char **argv)
1383{
1384 struct mtd_info_user info;
400cd0ff 1385 info.type = MTD_MLCNANDFLASH;
b8116a87
DE
1386 return ioctl(0, MEMGETINFO, &info);
1387}
1388EOF
1389if compile_prog "" "" "mtd"; then
1390 mtd="yes"
1391fi
1392echo "MTD $mtd"
1393
b470a02c
SC
1394# Check if we have lex/yacc available
1395yacc="no"
e7b2c7a3 1396yacc_is_bison="no"
b470a02c
SC
1397lex="no"
1398arith="no"
cf6dd80e 1399if test "$targetos" != "SunOS" ; then
e7b2c7a3 1400LEX=$(which lex 2> /dev/null)
b470a02c
SC
1401if test -x "$LEX" ; then
1402 lex="yes"
1403fi
7e0049e9 1404YACC=$(which bison 2> /dev/null)
b470a02c
SC
1405if test -x "$YACC" ; then
1406 yacc="yes"
7e0049e9 1407 yacc_is_bison="yes"
e7b2c7a3 1408else
7e0049e9 1409 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
1410 if test -x "$YACC" ; then
1411 yacc="yes"
e7b2c7a3 1412 fi
b470a02c
SC
1413fi
1414if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1415 arith="yes"
1416fi
1417
1418if test "$arith" = "yes" ; then
1419cat > $TMPC << EOF
1420extern int yywrap(void);
1421
1422int main(int argc, char **argv)
1423{
1424 yywrap();
1425 return 0;
1426}
1427EOF
719cda03
JA
1428if compile_prog "" "-ll" "lex"; then
1429 LIBS="-ll $LIBS"
b470a02c
SC
1430else
1431 arith="no"
1432fi
1433fi
cf6dd80e 1434fi
b470a02c
SC
1435
1436echo "lex/yacc for arithmetic $arith"
1437
67bf9823
JA
1438#############################################################################
1439
67bf9823 1440if test "$wordsize" = "64" ; then
4feafb1e 1441 output_sym "CONFIG_64BIT"
67bf9823 1442elif test "$wordsize" = "32" ; then
4feafb1e 1443 output_sym "CONFIG_32BIT"
67bf9823 1444else
d7145a78 1445 fatal "Unknown wordsize!"
67bf9823 1446fi
0dcebdf4 1447if test "$bigendian" = "yes" ; then
4feafb1e 1448 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 1449else
4feafb1e 1450 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 1451fi
3989b143
JA
1452if test "$zlib" = "yes" ; then
1453 output_sym "CONFIG_ZLIB"
1454fi
67bf9823 1455if test "$libaio" = "yes" ; then
4feafb1e 1456 output_sym "CONFIG_LIBAIO"
67bf9823
JA
1457fi
1458if test "$posix_aio" = "yes" ; then
4feafb1e 1459 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
1460fi
1461if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 1462 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823
JA
1463fi
1464if test "$linux_fallocate" = "yes" ; then
4feafb1e 1465 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
1466fi
1467if test "$posix_fallocate" = "yes" ; then
4feafb1e 1468 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
1469fi
1470if test "$fdatasync" = "yes" ; then
4feafb1e 1471 output_sym "CONFIG_FDATASYNC"
67bf9823
JA
1472fi
1473if test "$sync_file_range" = "yes" ; then
4feafb1e 1474 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
1475fi
1476if test "$sfaa" = "yes" ; then
4feafb1e 1477 output_sym "CONFIG_SFAA"
67bf9823 1478fi
954cd73a 1479if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 1480 output_sym "CONFIG_RDMA"
67bf9823
JA
1481fi
1482if test "$clock_gettime" = "yes" ; then
4feafb1e 1483 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
1484fi
1485if test "$clock_monotonic" = "yes" ; then
4feafb1e 1486 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823
JA
1487fi
1488if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 1489 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823
JA
1490fi
1491if test "$gettimeofday" = "yes" ; then
4feafb1e 1492 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
1493fi
1494if test "$posix_fadvise" = "yes" ; then
4feafb1e 1495 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
1496fi
1497if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 1498 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 1499elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 1500 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
1501fi
1502if test "$strsep" = "yes" ; then
4feafb1e 1503 output_sym "CONFIG_STRSEP"
67bf9823 1504fi
9ad8da82
JA
1505if test "$strcasestr" = "yes" ; then
1506 output_sym "CONFIG_STRCASESTR"
1507fi
67bf9823 1508if test "$getopt_long_only" = "yes" ; then
4feafb1e 1509 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
1510fi
1511if test "$inet_aton" = "yes" ; then
4feafb1e 1512 output_sym "CONFIG_INET_ATON"
67bf9823
JA
1513fi
1514if test "$socklen_t" = "yes" ; then
4feafb1e 1515 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
1516fi
1517if test "$ext4_me" = "yes" ; then
4feafb1e 1518 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
1519fi
1520if test "$linux_splice" = "yes" ; then
4feafb1e 1521 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
1522fi
1523if test "$guasi" = "yes" ; then
4feafb1e 1524 output_sym "CONFIG_GUASI"
67bf9823
JA
1525fi
1526if test "$fusion_aw" = "yes" ; then
4feafb1e 1527 output_sym "CONFIG_FUSION_AW"
67bf9823 1528fi
50206d9b 1529if test "$libnuma_v2" = "yes" ; then
4feafb1e 1530 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
1531fi
1532if test "$solaris_aio" = "yes" ; then
4feafb1e 1533 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
1534fi
1535if test "$tls_thread" = "yes" ; then
4feafb1e 1536 output_sym "CONFIG_TLS_THREAD"
67bf9823 1537fi
44404c5a 1538if test "$rusage_thread" = "yes" ; then
4feafb1e 1539 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 1540fi
91f94d5b
JA
1541if test "$gfio" = "yes" ; then
1542 echo "CONFIG_GFIO=y" >> $config_host_mak
1543fi
c8931876
JA
1544if test "$esx" = "yes" ; then
1545 output_sym "CONFIG_ESX"
1546 output_sym "CONFIG_NO_SHM"
1547fi
7e09a9f1
JA
1548if test "$sched_idle" = "yes" ; then
1549 output_sym "CONFIG_SCHED_IDLE"
1550fi
1eafa37a
JA
1551if test "$tcp_nodelay" = "yes" ; then
1552 output_sym "CONFIG_TCP_NODELAY"
1553fi
1008602c
JA
1554if test "$window_size" = "yes" ; then
1555 output_sym "CONFIG_NET_WINDOWSIZE"
1556fi
e5f34d95
JA
1557if test "$mss" = "yes" ; then
1558 output_sym "CONFIG_NET_MSS"
1559fi
38b9354a
JA
1560if test "$rlimit_memlock" = "yes" ; then
1561 output_sym "CONFIG_RLIMIT_MEMLOCK"
1562fi
07fc0acd
JA
1563if test "$pwritev" = "yes" ; then
1564 output_sym "CONFIG_PWRITEV"
1565fi
ecad55e9
JA
1566if test "$ipv6" = "yes" ; then
1567 output_sym "CONFIG_IPV6"
1568fi
fc5c0345
DG
1569if test "$rbd" = "yes" ; then
1570 output_sym "CONFIG_RBD"
1571fi
903b2812
JA
1572if test "$rbd_inval" = "yes" ; then
1573 output_sym "CONFIG_RBD_INVAL"
1574fi
2e802282
JA
1575if test "$setvbuf" = "yes" ; then
1576 output_sym "CONFIG_SETVBUF"
1577fi
81795ce3
CE
1578if test "$s390_z196_facilities" = "yes" ; then
1579 output_sym "CONFIG_S390_Z196_FACILITIES"
1580 CFLAGS="$CFLAGS -march=z9-109"
1581fi
6e7d7dfb 1582if test "$gfapi" = "yes" ; then
1583 output_sym "CONFIG_GFAPI"
1584fi
6fa14b99 1585if test "$gf_fadvise" = "yes" ; then
1586 output_sym "CONFIG_GF_FADVISE"
1587fi
6876c98c
JA
1588if test "$gf_trim" = "yes" ; then
1589 output_sym "CONFIG_GF_TRIM"
1590fi
1b10477b
MM
1591if test "$libhdfs" = "yes" ; then
1592 output_sym "CONFIG_LIBHDFS"
1527dc50
FB
1593 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1594 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1595 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1596 fi
b8116a87
DE
1597if test "$mtd" = "yes" ; then
1598 output_sym "CONFIG_MTD"
1599fi
b470a02c
SC
1600if test "$arith" = "yes" ; then
1601 output_sym "CONFIG_ARITHMETIC"
e7b2c7a3
JA
1602 if test "$yacc_is_bison" = "yes" ; then
1603 echo "YACC=$YACC -y" >> $config_host_mak
1604 else
1605 echo "YACC=$YACC" >> $config_host_mak
1606 fi
b470a02c 1607fi
67bf9823 1608
605cf82e
JA
1609if test "$zlib" = "no" ; then
1610 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1611fi
1612
67bf9823 1613echo "LIBS+=$LIBS" >> $config_host_mak
86719845 1614echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 1615echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 1616echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 1617echo "CC=$cc" >> $config_host_mak
af4862b3 1618echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 1619echo "INSTALL_PREFIX=$prefix" >> $config_host_mak