Merge branch 'master' of ssh://git.kernel.dk/data/git/fio
[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
c544f604
SN
723##########################################
724# CLOCK_MONOTONIC_RAW probe
725clock_monotonic_raw="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_RAW, NULL);
733}
734EOF
735 if compile_prog "" "$LIBS" "clock monotonic"; then
736 clock_monotonic_raw="yes"
737 fi
738fi
739echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
740
67bf9823
JA
741##########################################
742# CLOCK_MONOTONIC_PRECISE probe
743clock_monotonic_precise="no"
744if test "$clock_gettime" = "yes" ; then
745 cat > $TMPC << EOF
746#include <stdio.h>
747#include <time.h>
748int main(int argc, char **argv)
749{
750 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
751}
752EOF
753 if compile_prog "" "$LIBS" "clock monotonic precise"; then
754 clock_monotonic_precise="yes"
755 fi
756fi
757echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
758
759##########################################
760# gettimeofday() probe
761gettimeofday="no"
762cat > $TMPC << EOF
763#include <sys/time.h>
764#include <stdio.h>
765int main(int argc, char **argv)
766{
767 struct timeval tv;
768 return gettimeofday(&tv, NULL);
769}
770EOF
771if compile_prog "" "" "gettimeofday"; then
772 gettimeofday="yes"
773fi
774echo "gettimeofday $gettimeofday"
775
776##########################################
777# fdatasync() probe
778fdatasync="no"
779cat > $TMPC << EOF
780#include <stdio.h>
781#include <unistd.h>
782int main(int argc, char **argv)
783{
784 return fdatasync(0);
785}
786EOF
787if compile_prog "" "" "fdatasync"; then
788 fdatasync="yes"
789fi
790echo "fdatasync $fdatasync"
791
792##########################################
793# sync_file_range() probe
794sync_file_range="no"
795cat > $TMPC << EOF
796#include <stdio.h>
797#include <unistd.h>
67bf9823
JA
798#include <fcntl.h>
799#include <linux/fs.h>
800int main(int argc, char **argv)
801{
802 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
803 SYNC_FILE_RANGE_WAIT_AFTER;
804 return sync_file_range(0, 0, 0, flags);
805}
806EOF
807if compile_prog "" "" "sync_file_range"; then
808 sync_file_range="yes"
809fi
810echo "sync_file_range $sync_file_range"
811
812##########################################
813# ext4 move extent probe
814ext4_me="no"
815cat > $TMPC << EOF
816#include <fcntl.h>
817#include <sys/ioctl.h>
818int main(int argc, char **argv)
819{
820 struct move_extent me;
821 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
822}
823EOF
c7165b8d
JA
824if compile_prog "" "" "ext4 move extent" ; then
825 ext4_me="yes"
826elif test $targetos = "Linux" ; then
827 # On Linux, just default to it on and let it error at runtime if we really
828 # don't have it. None of my updated systems have it defined, but it does
829 # work. Takes a while to bubble back.
67bf9823
JA
830 ext4_me="yes"
831fi
832echo "EXT4 move extent $ext4_me"
833
834##########################################
835# splice probe
836linux_splice="no"
837cat > $TMPC << EOF
67bf9823
JA
838#include <stdio.h>
839#include <fcntl.h>
840int main(int argc, char **argv)
841{
842 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
843}
844EOF
845if compile_prog "" "" "linux splice"; then
846 linux_splice="yes"
847fi
848echo "Linux splice(2) $linux_splice"
849
850##########################################
851# GUASI probe
852guasi="no"
853cat > $TMPC << EOF
854#include <guasi.h>
855#include <guasi_syscalls.h>
856int main(int argc, char **argv)
857{
858 guasi_t ctx = guasi_create(0, 0, 0);
859 return 0;
860}
861EOF
862if compile_prog "" "" "guasi"; then
863 guasi="yes"
864fi
865echo "GUASI $guasi"
866
867##########################################
868# fusion-aw probe
869fusion_aw="no"
870cat > $TMPC << EOF
b2c77c25 871#include <nvm/nvm_primitives.h>
67bf9823
JA
872int main(int argc, char **argv)
873{
b2c77c25
SK
874 nvm_version_t ver_info;
875 nvm_handle_t handle;
876
877 handle = nvm_get_handle(0, &ver_info);
878 return nvm_atomic_write(handle, 0, 0, 0);
67bf9823
JA
879}
880EOF
92aef550
ARJ
881if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
882 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
67bf9823
JA
883 fusion_aw="yes"
884fi
885echo "Fusion-io atomic engine $fusion_aw"
886
887##########################################
888# libnuma probe
889libnuma="no"
890cat > $TMPC << EOF
891#include <numa.h>
892int main(int argc, char **argv)
893{
894 return numa_available();
895}
896EOF
44462517 897if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
67bf9823
JA
898 libnuma="yes"
899 LIBS="-lnuma $LIBS"
900fi
901echo "libnuma $libnuma"
902
50206d9b
JA
903##########################################
904# libnuma 2.x version API
905if test "$libnuma" = "yes" ; then
906libnuma_v2="no"
907cat > $TMPC << EOF
908#include <numa.h>
909int main(int argc, char **argv)
910{
911 struct bitmask *mask = numa_parse_nodestring(NULL);
61bde962 912 return mask->size == 0;
50206d9b
JA
913}
914EOF
915if compile_prog "" "" "libnuma api"; then
916 libnuma_v2="yes"
917fi
918echo "libnuma v2 $libnuma_v2"
919fi
920
67bf9823
JA
921##########################################
922# strsep() probe
923strsep="no"
924cat > $TMPC << EOF
925#include <string.h>
926int main(int argc, char **argv)
927{
928 strsep(NULL, NULL);
929 return 0;
930}
931EOF
932if compile_prog "" "" "strsep"; then
933 strsep="yes"
934fi
935echo "strsep $strsep"
936
9ad8da82
JA
937##########################################
938# strcasestr() probe
939strcasestr="no"
940cat > $TMPC << EOF
941#include <string.h>
942int main(int argc, char **argv)
943{
aa6738a5 944 return strcasestr(argv[0], argv[1]) != NULL;
9ad8da82
JA
945}
946EOF
947if compile_prog "" "" "strcasestr"; then
948 strcasestr="yes"
949fi
950echo "strcasestr $strcasestr"
951
67bf9823
JA
952##########################################
953# getopt_long_only() probe
954getopt_long_only="no"
955cat > $TMPC << EOF
956#include <unistd.h>
957#include <stdio.h>
aa6738a5 958#include <getopt.h>
67bf9823
JA
959int main(int argc, char **argv)
960{
961 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
962 return c;
963}
964EOF
965if compile_prog "" "" "getopt_long_only"; then
966 getopt_long_only="yes"
967fi
968echo "getopt_long_only() $getopt_long_only"
969
970##########################################
971# inet_aton() probe
972inet_aton="no"
973cat > $TMPC << EOF
974#include <sys/socket.h>
975#include <arpa/inet.h>
976#include <stdio.h>
977int main(int argc, char **argv)
978{
979 struct in_addr in;
980 return inet_aton(NULL, &in);
981}
982EOF
983if compile_prog "" "" "inet_aton"; then
984 inet_aton="yes"
985fi
986echo "inet_aton $inet_aton"
987
988##########################################
989# socklen_t probe
990socklen_t="no"
991cat > $TMPC << EOF
f6482613 992#include <sys/socket.h>
67bf9823
JA
993int main(int argc, char **argv)
994{
995 socklen_t len = 0;
996 return len;
997}
998EOF
999if compile_prog "" "" "socklen_t"; then
1000 socklen_t="yes"
1001fi
1002echo "socklen_t $socklen_t"
1003
1004##########################################
1005# Whether or not __thread is supported for TLS
1006tls_thread="no"
1007cat > $TMPC << EOF
1008#include <stdio.h>
aa6738a5 1009static __thread int ret;
67bf9823
JA
1010int main(int argc, char **argv)
1011{
1012 return ret;
1013}
1014EOF
1015if compile_prog "" "" "__thread"; then
1016 tls_thread="yes"
1017fi
1018echo "__thread $tls_thread"
1019
91f94d5b 1020##########################################
2639f056 1021# Check if we have required gtk/glib support for gfio
ebec2094
JA
1022gfio="no"
1023if test "$gfio_check" = "yes" ; then
91f94d5b
JA
1024 cat > $TMPC << EOF
1025#include <glib.h>
1026#include <cairo.h>
1027#include <gtk/gtk.h>
1028int main(void)
1029{
1030 gdk_threads_enter();
91f94d5b 1031 gdk_threads_leave();
b7a99316
JA
1032
1033 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
91f94d5b
JA
1034}
1035EOF
1036GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
86719845
JA
1037ORG_LDFLAGS=$LDFLAGS
1038LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
91f94d5b
JA
1039if test "$?" != "0" ; then
1040 echo "configure: gtk and gthread not found"
1041 exit 1
1042fi
1043GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1044if test "$?" != "0" ; then
1045 echo "configure: gtk and gthread not found"
1046 exit 1
1047fi
b7a99316
JA
1048if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1049 r=$($TMPE)
1050 if test "$r" != "0" ; then
1051 gfio="yes"
86719845 1052 GFIO_LIBS="$LIBS $GTK_LIBS"
b7a99316
JA
1053 CFLAGS="$CFLAGS $GTK_CFLAGS"
1054 else
1055 echo "GTK found, but need version 2.18 or higher"
1056 gfio="no"
1057 fi
91f94d5b
JA
1058else
1059 echo "Please install gtk and gdk libraries"
1060 gfio="no"
1061fi
86719845 1062LDFLAGS=$ORG_LDFLAGS
91f94d5b
JA
1063fi
1064
ebec2094
JA
1065if test "$gfio_check" = "yes" ; then
1066 echo "gtk 2.18 or higher $gfio"
1067fi
91f94d5b 1068
44404c5a
JA
1069# Check whether we have getrusage(RUSAGE_THREAD)
1070rusage_thread="no"
1071cat > $TMPC << EOF
1072#include <sys/time.h>
1073#include <sys/resource.h>
1074int main(int argc, char **argv)
1075{
1076 struct rusage ru;
1077 getrusage(RUSAGE_THREAD, &ru);
1078 return 0;
1079}
1080EOF
1081if compile_prog "" "" "RUSAGE_THREAD"; then
1082 rusage_thread="yes"
1083fi
1084echo "RUSAGE_THREAD $rusage_thread"
1085
7e09a9f1
JA
1086##########################################
1087# Check whether we have SCHED_IDLE
1088sched_idle="no"
1089cat > $TMPC << EOF
1090#include <sched.h>
1091int main(int argc, char **argv)
1092{
1093 struct sched_param p;
1094 return sched_setscheduler(0, SCHED_IDLE, &p);
1095}
1096EOF
1097if compile_prog "" "" "SCHED_IDLE"; then
1098 sched_idle="yes"
1099fi
1100echo "SCHED_IDLE $sched_idle"
1101
1eafa37a
JA
1102##########################################
1103# Check whether we have TCP_NODELAY
1104tcp_nodelay="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 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1113}
1114EOF
1115if compile_prog "" "" "TCP_NODELAY"; then
1116 tcp_nodelay="yes"
1117fi
1118echo "TCP_NODELAY $tcp_nodelay"
1119
1008602c
JA
1120##########################################
1121# Check whether we have SO_SNDBUF
1122window_size="no"
1123cat > $TMPC << EOF
1124#include <stdio.h>
1125#include <sys/types.h>
1126#include <sys/socket.h>
1127#include <netinet/tcp.h>
1128int main(int argc, char **argv)
1129{
1130 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1131 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1132}
1133EOF
1134if compile_prog "" "" "SO_SNDBUF"; then
1135 window_size="yes"
1136fi
1137echo "Net engine window_size $window_size"
1138
e5f34d95
JA
1139##########################################
1140# Check whether we have TCP_MAXSEG
1141mss="no"
1142cat > $TMPC << EOF
1143#include <stdio.h>
1144#include <sys/types.h>
1145#include <sys/socket.h>
1146#include <netinet/tcp.h>
1147#include <arpa/inet.h>
1148#include <netinet/in.h>
1149int main(int argc, char **argv)
1150{
1151 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1152}
1153EOF
1154if compile_prog "" "" "TCP_MAXSEG"; then
1155 mss="yes"
1156fi
1157echo "TCP_MAXSEG $mss"
1158
38b9354a
JA
1159##########################################
1160# Check whether we have RLIMIT_MEMLOCK
1161rlimit_memlock="no"
1162cat > $TMPC << EOF
1163#include <sys/time.h>
1164#include <sys/resource.h>
1165int main(int argc, char **argv)
1166{
1167 struct rlimit rl;
1168 return getrlimit(RLIMIT_MEMLOCK, &rl);
1169}
1170EOF
1171if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1172 rlimit_memlock="yes"
1173fi
1174echo "RLIMIT_MEMLOCK $rlimit_memlock"
1175
07fc0acd
JA
1176##########################################
1177# Check whether we have pwritev/preadv
1178pwritev="no"
1179cat > $TMPC << EOF
1180#include <stdio.h>
1181#include <sys/uio.h>
1182int main(int argc, char **argv)
1183{
1184 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1185}
1186EOF
1187if compile_prog "" "" "pwritev"; then
1188 pwritev="yes"
1189fi
1190echo "pwritev/preadv $pwritev"
1191
ecad55e9
JA
1192##########################################
1193# Check whether we have the required functions for ipv6
1194ipv6="no"
1195cat > $TMPC << EOF
1196#include <sys/types.h>
1197#include <sys/socket.h>
d219028d 1198#include <netinet/in.h>
ecad55e9
JA
1199#include <netdb.h>
1200#include <stdio.h>
1201int main(int argc, char **argv)
1202{
1203 struct addrinfo hints;
1204 struct in6_addr addr;
1205 int ret;
1206
1207 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1208 freeaddrinfo(NULL);
1209 printf("%s\n", gai_strerror(ret));
1210 addr = in6addr_any;
1211 return 0;
1212}
1213EOF
1214if compile_prog "" "" "ipv6"; then
1215 ipv6="yes"
1216fi
1217echo "IPv6 helpers $ipv6"
07fc0acd 1218
fc5c0345
DG
1219##########################################
1220# check for rbd
1221rbd="no"
1222cat > $TMPC << EOF
1223#include <rbd/librbd.h>
1224
1225int main(int argc, char **argv)
1226{
1227
1228 rados_t cluster;
1229 rados_ioctx_t io_ctx;
1230 const char pool[] = "rbd";
1231
1232 int major, minor, extra;
1233 rbd_version(&major, &minor, &extra);
1234
1235 rados_ioctx_create(cluster, pool, &io_ctx);
1236 return 0;
1237}
1238EOF
ce18290e 1239if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
fc5c0345
DG
1240 LIBS="-lrbd -lrados $LIBS"
1241 rbd="yes"
1242fi
1243echo "Rados Block Device engine $rbd"
1244
903b2812
JA
1245##########################################
1246# check for rbd_invaidate_cache()
1247rbd_inval="no"
1248if test "$rbd" = "yes"; then
1249cat > $TMPC << EOF
1250#include <rbd/librbd.h>
1251
1252int main(int argc, char **argv)
1253{
1254 rbd_image_t image;
1255
1256 return rbd_invalidate_cache(image);
1257}
1258EOF
1259if compile_prog "" "-lrbd -lrados" "rbd"; then
1260 rbd_inval="yes"
1261fi
1262echo "rbd_invalidate_cache $rbd_inval"
1263fi
1264
2e802282
JA
1265##########################################
1266# Check whether we have setvbuf
1267setvbuf="no"
1268cat > $TMPC << EOF
1269#include <stdio.h>
1270int main(int argc, char **argv)
1271{
1272 FILE *f = NULL;
1273 char buf[80];
1274 setvbuf(f, buf, _IOFBF, sizeof(buf));
1275 return 0;
1276}
1277EOF
1278if compile_prog "" "" "setvbuf"; then
1279 setvbuf="yes"
1280fi
1281echo "setvbuf $setvbuf"
fc5c0345 1282
6e7d7dfb 1283# check for gfapi
1284gfapi="no"
1285cat > $TMPC << EOF
1286#include <glusterfs/api/glfs.h>
1287
1288int main(int argc, char **argv)
1289{
1290
1291 glfs_t *g = glfs_new("foo");
1292
1293 return 0;
1294}
1295EOF
ce18290e 1296if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
6e7d7dfb 1297 LIBS="-lgfapi -lglusterfs $LIBS"
1298 gfapi="yes"
1299fi
6fa14b99 1300 echo "Gluster API engine $gfapi"
6e7d7dfb 1301
6fa14b99 1302##########################################
1303# check for gfapi fadvise support
6876c98c 1304if test "$gfapi" = "yes" ; then
6fa14b99 1305gf_fadvise="no"
1306cat > $TMPC << EOF
1307#include <glusterfs/api/glfs.h>
1308
1309int main(int argc, char **argv)
1310{
1311 struct glfs_fd *fd;
1312 int ret = glfs_fadvise(fd, 0, 0, 1);
1313
1314 return 0;
1315}
1316EOF
6fa14b99 1317if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1318 gf_fadvise="yes"
1319fi
1320echo "Gluster API use fadvise $gf_fadvise"
6876c98c
JA
1321fi
1322
1323##########################################
1324# check for gfapi trim support
1325gf_trim="no"
1326if test "$gfapi" = "yes" ; then
1327cat > $TMPC << EOF
1328#include <glusterfs/api/glfs.h>
1329
1330int main(int argc, char **argv)
1331{
1332 return glfs_discard_async(NULL, 0, 0);
1333}
1334EOF
1335if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1336 gf_trim="yes"
1337fi
1338echo "Gluster API trim support $gf_trim"
1339fi
fc5c0345 1340
81795ce3
CE
1341##########################################
1342# Check if we support stckf on s390
1343s390_z196_facilities="no"
1344cat > $TMPC << EOF
1345#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1346int main(int argc, char **argv)
1347{
1348 /* We want just 1 double word to be returned. */
1349 register unsigned long reg0 asm("0") = 0;
1350 unsigned long stfle_bits;
1351 asm volatile(".machine push" "\n\t"
1352 ".machine \"z9-109\"" "\n\t"
1353 "stfle %0" "\n\t"
1354 ".machine pop" "\n"
1355 : "=QS" (stfle_bits), "+d" (reg0)
1356 : : "cc");
1357
1358 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1359 return 0;
1360 else
1361 return -1;
1362}
1363EOF
1364if compile_prog "" "" "s390_z196_facilities"; then
1365 $TMPE
1366 if [[ $? -eq 0 ]]; then
1367 s390_z196_facilities="yes"
1368 fi
1369fi
1370echo "s390_z196_facilities $s390_z196_facilities"
1b10477b
MM
1371
1372##########################################
1373# Check if we have required environment variables configured for libhdfs
1374if test "$libhdfs" = "yes" ; then
1375 hdfs_conf_error=0
1376 if test "$JAVA_HOME" = "" ; then
1377 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1378 hdfs_conf_error=1
1379 fi
1380 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1381 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1382 hdfs_conf_error=1
1383 fi
1384 if test "$FIO_LIBHDFS_LIB" = "" ; then
1385 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1386 hdfs_conf_error=1
1387 fi
1388 if test "$hdfs_conf_error" = "1" ; then
1389 exit 1
1390 fi
1391fi
1392echo "HDFS engine $libhdfs"
1393
b8116a87
DE
1394##########################################
1395# Check whether we have MTD
1396mtd="no"
1397cat > $TMPC << EOF
1398#include <mtd/mtd-user.h>
1399#include <sys/ioctl.h>
1400int main(int argc, char **argv)
1401{
1402 struct mtd_info_user info;
400cd0ff 1403 info.type = MTD_MLCNANDFLASH;
b8116a87
DE
1404 return ioctl(0, MEMGETINFO, &info);
1405}
1406EOF
1407if compile_prog "" "" "mtd"; then
1408 mtd="yes"
1409fi
1410echo "MTD $mtd"
1411
b470a02c
SC
1412# Check if we have lex/yacc available
1413yacc="no"
e7b2c7a3 1414yacc_is_bison="no"
b470a02c
SC
1415lex="no"
1416arith="no"
cf6dd80e 1417if test "$targetos" != "SunOS" ; then
e7b2c7a3 1418LEX=$(which lex 2> /dev/null)
b470a02c
SC
1419if test -x "$LEX" ; then
1420 lex="yes"
1421fi
7e0049e9 1422YACC=$(which bison 2> /dev/null)
b470a02c
SC
1423if test -x "$YACC" ; then
1424 yacc="yes"
7e0049e9 1425 yacc_is_bison="yes"
e7b2c7a3 1426else
7e0049e9 1427 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
1428 if test -x "$YACC" ; then
1429 yacc="yes"
e7b2c7a3 1430 fi
b470a02c
SC
1431fi
1432if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1433 arith="yes"
1434fi
1435
1436if test "$arith" = "yes" ; then
1437cat > $TMPC << EOF
1438extern int yywrap(void);
1439
1440int main(int argc, char **argv)
1441{
1442 yywrap();
1443 return 0;
1444}
1445EOF
719cda03
JA
1446if compile_prog "" "-ll" "lex"; then
1447 LIBS="-ll $LIBS"
b470a02c
SC
1448else
1449 arith="no"
1450fi
1451fi
cf6dd80e 1452fi
b470a02c
SC
1453
1454echo "lex/yacc for arithmetic $arith"
1455
67bf9823
JA
1456#############################################################################
1457
67bf9823 1458if test "$wordsize" = "64" ; then
4feafb1e 1459 output_sym "CONFIG_64BIT"
67bf9823 1460elif test "$wordsize" = "32" ; then
4feafb1e 1461 output_sym "CONFIG_32BIT"
67bf9823 1462else
d7145a78 1463 fatal "Unknown wordsize!"
67bf9823 1464fi
0dcebdf4 1465if test "$bigendian" = "yes" ; then
4feafb1e 1466 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 1467else
4feafb1e 1468 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 1469fi
3989b143
JA
1470if test "$zlib" = "yes" ; then
1471 output_sym "CONFIG_ZLIB"
1472fi
67bf9823 1473if test "$libaio" = "yes" ; then
4feafb1e 1474 output_sym "CONFIG_LIBAIO"
67bf9823
JA
1475fi
1476if test "$posix_aio" = "yes" ; then
4feafb1e 1477 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
1478fi
1479if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 1480 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823
JA
1481fi
1482if test "$linux_fallocate" = "yes" ; then
4feafb1e 1483 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
1484fi
1485if test "$posix_fallocate" = "yes" ; then
4feafb1e 1486 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
1487fi
1488if test "$fdatasync" = "yes" ; then
4feafb1e 1489 output_sym "CONFIG_FDATASYNC"
67bf9823
JA
1490fi
1491if test "$sync_file_range" = "yes" ; then
4feafb1e 1492 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
1493fi
1494if test "$sfaa" = "yes" ; then
4feafb1e 1495 output_sym "CONFIG_SFAA"
67bf9823 1496fi
954cd73a 1497if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 1498 output_sym "CONFIG_RDMA"
67bf9823
JA
1499fi
1500if test "$clock_gettime" = "yes" ; then
4feafb1e 1501 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
1502fi
1503if test "$clock_monotonic" = "yes" ; then
4feafb1e 1504 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823 1505fi
c544f604
SN
1506if test "$clock_monotonic_raw" = "yes" ; then
1507 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1508fi
67bf9823 1509if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 1510 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823
JA
1511fi
1512if test "$gettimeofday" = "yes" ; then
4feafb1e 1513 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
1514fi
1515if test "$posix_fadvise" = "yes" ; then
4feafb1e 1516 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
1517fi
1518if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 1519 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 1520elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 1521 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
1522fi
1523if test "$strsep" = "yes" ; then
4feafb1e 1524 output_sym "CONFIG_STRSEP"
67bf9823 1525fi
9ad8da82
JA
1526if test "$strcasestr" = "yes" ; then
1527 output_sym "CONFIG_STRCASESTR"
1528fi
67bf9823 1529if test "$getopt_long_only" = "yes" ; then
4feafb1e 1530 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
1531fi
1532if test "$inet_aton" = "yes" ; then
4feafb1e 1533 output_sym "CONFIG_INET_ATON"
67bf9823
JA
1534fi
1535if test "$socklen_t" = "yes" ; then
4feafb1e 1536 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
1537fi
1538if test "$ext4_me" = "yes" ; then
4feafb1e 1539 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
1540fi
1541if test "$linux_splice" = "yes" ; then
4feafb1e 1542 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
1543fi
1544if test "$guasi" = "yes" ; then
4feafb1e 1545 output_sym "CONFIG_GUASI"
67bf9823
JA
1546fi
1547if test "$fusion_aw" = "yes" ; then
4feafb1e 1548 output_sym "CONFIG_FUSION_AW"
67bf9823 1549fi
50206d9b 1550if test "$libnuma_v2" = "yes" ; then
4feafb1e 1551 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
1552fi
1553if test "$solaris_aio" = "yes" ; then
4feafb1e 1554 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
1555fi
1556if test "$tls_thread" = "yes" ; then
4feafb1e 1557 output_sym "CONFIG_TLS_THREAD"
67bf9823 1558fi
44404c5a 1559if test "$rusage_thread" = "yes" ; then
4feafb1e 1560 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 1561fi
91f94d5b
JA
1562if test "$gfio" = "yes" ; then
1563 echo "CONFIG_GFIO=y" >> $config_host_mak
1564fi
c8931876
JA
1565if test "$esx" = "yes" ; then
1566 output_sym "CONFIG_ESX"
1567 output_sym "CONFIG_NO_SHM"
1568fi
7e09a9f1
JA
1569if test "$sched_idle" = "yes" ; then
1570 output_sym "CONFIG_SCHED_IDLE"
1571fi
1eafa37a
JA
1572if test "$tcp_nodelay" = "yes" ; then
1573 output_sym "CONFIG_TCP_NODELAY"
1574fi
1008602c
JA
1575if test "$window_size" = "yes" ; then
1576 output_sym "CONFIG_NET_WINDOWSIZE"
1577fi
e5f34d95
JA
1578if test "$mss" = "yes" ; then
1579 output_sym "CONFIG_NET_MSS"
1580fi
38b9354a
JA
1581if test "$rlimit_memlock" = "yes" ; then
1582 output_sym "CONFIG_RLIMIT_MEMLOCK"
1583fi
07fc0acd
JA
1584if test "$pwritev" = "yes" ; then
1585 output_sym "CONFIG_PWRITEV"
1586fi
ecad55e9
JA
1587if test "$ipv6" = "yes" ; then
1588 output_sym "CONFIG_IPV6"
1589fi
fc5c0345
DG
1590if test "$rbd" = "yes" ; then
1591 output_sym "CONFIG_RBD"
1592fi
903b2812
JA
1593if test "$rbd_inval" = "yes" ; then
1594 output_sym "CONFIG_RBD_INVAL"
1595fi
2e802282
JA
1596if test "$setvbuf" = "yes" ; then
1597 output_sym "CONFIG_SETVBUF"
1598fi
81795ce3
CE
1599if test "$s390_z196_facilities" = "yes" ; then
1600 output_sym "CONFIG_S390_Z196_FACILITIES"
1601 CFLAGS="$CFLAGS -march=z9-109"
1602fi
6e7d7dfb 1603if test "$gfapi" = "yes" ; then
1604 output_sym "CONFIG_GFAPI"
1605fi
6fa14b99 1606if test "$gf_fadvise" = "yes" ; then
1607 output_sym "CONFIG_GF_FADVISE"
1608fi
6876c98c
JA
1609if test "$gf_trim" = "yes" ; then
1610 output_sym "CONFIG_GF_TRIM"
1611fi
1b10477b
MM
1612if test "$libhdfs" = "yes" ; then
1613 output_sym "CONFIG_LIBHDFS"
1527dc50
FB
1614 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1615 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1616 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1617 fi
b8116a87
DE
1618if test "$mtd" = "yes" ; then
1619 output_sym "CONFIG_MTD"
1620fi
b470a02c
SC
1621if test "$arith" = "yes" ; then
1622 output_sym "CONFIG_ARITHMETIC"
e7b2c7a3
JA
1623 if test "$yacc_is_bison" = "yes" ; then
1624 echo "YACC=$YACC -y" >> $config_host_mak
1625 else
1626 echo "YACC=$YACC" >> $config_host_mak
1627 fi
b470a02c 1628fi
67bf9823 1629
605cf82e
JA
1630if test "$zlib" = "no" ; then
1631 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1632fi
1633
67bf9823 1634echo "LIBS+=$LIBS" >> $config_host_mak
86719845 1635echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 1636echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 1637echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 1638echo "CC=$cc" >> $config_host_mak
af4862b3 1639echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 1640echo "INSTALL_PREFIX=$prefix" >> $config_host_mak