Reduce LOG_MSEC_SLACK
[fio.git] / configure
... / ...
CommitLineData
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"
27config_host_h="config-host.h"
28
29rm -rf $config_host_mak
30rm -rf $config_host_h
31
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
40# Print result for each configuration test
41print_config() {
42 printf "%-30s%s\n" "$1" "$2"
43}
44
45# Default CFLAGS
46CFLAGS="-D_GNU_SOURCE -include config-host.h"
47BUILD_CFLAGS=""
48
49# Print a helpful header at the top of config.log
50echo "# FIO configure log $(date)" >> config.log
51printf "# Configured with:" >> config.log
52printf " '%s'" "$0" "$@" >> config.log
53echo >> config.log
54echo "#" >> config.log
55
56# Print configure header at the top of $config_host_h
57echo "/*" > $config_host_h
58echo " * Automatically generated by configure - do not modify" >> $config_host_h
59printf " * Configured with:" >> $config_host_h
60printf " * '%s'" "$0" "$@" >> $config_host_h
61echo "" >> $config_host_h
62echo " */" >> $config_host_h
63
64do_cc() {
65 # Run the compiler, capturing its output to the log.
66 echo $cc "$@" >> config.log
67 $cc "$@" >> config.log 2>&1 || return $?
68 # Test passed. If this is an --enable-werror build, rerun
69 # the test with -Werror and bail out if it fails. This
70 # makes warning-generating-errors in configure test code
71 # obvious to developers.
72 if test "$werror" != "yes"; then
73 return 0
74 fi
75 # Don't bother rerunning the compile if we were already using -Werror
76 case "$*" in
77 *-Werror*)
78 return 0
79 ;;
80 esac
81 echo $cc -Werror "$@" >> config.log
82 $cc -Werror "$@" >> config.log 2>&1 && return $?
83 echo "ERROR: configure test passed without -Werror but failed with -Werror."
84 echo "This is probably a bug in the configure script. The failing command"
85 echo "will be at the bottom of config.log."
86 fatal "You can run configure with --disable-werror to bypass this check."
87}
88
89compile_object() {
90 do_cc $CFLAGS -c -o $TMPO $TMPC
91}
92
93compile_prog() {
94 local_cflags="$1"
95 local_ldflags="$2 $LIBS"
96 echo "Compiling test case $3" >> config.log
97 do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
98}
99
100feature_not_found() {
101 feature=$1
102 packages=$2
103
104 echo "ERROR"
105 echo "ERROR: User requested feature $feature"
106 if test ! -z "$packages" ; then
107 echo "ERROR: That feature needs $packages installed"
108 fi
109 echo "ERROR: configure was not able to find it"
110 fatal "ERROR"
111}
112
113has() {
114 type "$1" >/dev/null 2>&1
115}
116
117check_define() {
118 cat > $TMPC <<EOF
119#if !defined($1)
120#error $1 not defined
121#endif
122int main(void)
123{
124 return 0;
125}
126EOF
127 compile_object
128}
129
130output_sym() {
131 echo "$1=y" >> $config_host_mak
132 echo "#define $1" >> $config_host_h
133}
134
135targetos=""
136cpu=""
137
138# default options
139show_help="no"
140exit_val=0
141gfio_check="no"
142libhdfs="no"
143pmemblk="no"
144devdax="no"
145pmem="no"
146disable_lex=""
147disable_pmem="no"
148disable_native="no"
149prefix=/usr/local
150
151# parse options
152for opt do
153 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
154 case "$opt" in
155 --prefix=*) prefix="$optarg"
156 ;;
157 --cpu=*) cpu="$optarg"
158 ;;
159 # esx is cross compiled and cannot be detect through simple uname calls
160 --esx)
161 esx="yes"
162 ;;
163 --cc=*) CC="$optarg"
164 ;;
165 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
166 ;;
167 --build-32bit-win) build_32bit_win="yes"
168 ;;
169 --build-static) build_static="yes"
170 ;;
171 --enable-gfio) gfio_check="yes"
172 ;;
173 --disable-numa) disable_numa="yes"
174 ;;
175 --disable-rdma) disable_rdma="yes"
176 ;;
177 --disable-rados) disable_rados="yes"
178 ;;
179 --disable-rbd) disable_rbd="yes"
180 ;;
181 --disable-gfapi) disable_gfapi="yes"
182 ;;
183 --enable-libhdfs) libhdfs="yes"
184 ;;
185 --disable-lex) disable_lex="yes"
186 ;;
187 --enable-lex) disable_lex="no"
188 ;;
189 --disable-shm) no_shm="yes"
190 ;;
191 --disable-optimizations) disable_opt="yes"
192 ;;
193 --disable-pmem) disable_pmem="yes"
194 ;;
195 --enable-cuda) enable_cuda="yes"
196 ;;
197 --disable-native) disable_native="yes"
198 ;;
199 --help)
200 show_help="yes"
201 ;;
202 *)
203 echo "Bad option $opt"
204 show_help="yes"
205 exit_val=1
206 esac
207done
208
209if test "$show_help" = "yes" ; then
210 echo "--prefix= Use this directory as installation prefix"
211 echo "--cpu= Specify target CPU if auto-detect fails"
212 echo "--cc= Specify compiler to use"
213 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
214 echo "--build-32bit-win Enable 32-bit build on Windows"
215 echo "--build-static Build a static fio"
216 echo "--esx Configure build options for esx"
217 echo "--enable-gfio Enable building of gtk gfio"
218 echo "--disable-numa Disable libnuma even if found"
219 echo "--disable-rdma Disable RDMA support even if found"
220 echo "--disable-gfapi Disable gfapi"
221 echo "--enable-libhdfs Enable hdfs support"
222 echo "--disable-lex Disable use of lex/yacc for math"
223 echo "--disable-pmem Disable pmem based engines even if found"
224 echo "--enable-lex Enable use of lex/yacc for math"
225 echo "--disable-shm Disable SHM support"
226 echo "--disable-optimizations Don't enable compiler optimizations"
227 echo "--enable-cuda Enable GPUDirect RDMA support"
228 echo "--disable-native Don't build for native host"
229 exit $exit_val
230fi
231
232cross_prefix=${cross_prefix-${CROSS_COMPILE}}
233# Preferred compiler (can be overriden later after we know the platform):
234# ${CC} (if set)
235# ${cross_prefix}gcc (if cross-prefix specified)
236# gcc if available
237# clang if available
238if test -z "${CC}${cross_prefix}"; then
239 if has gcc; then
240 cc=gcc
241 elif has clang; then
242 cc=clang
243 fi
244else
245 cc="${CC-${cross_prefix}gcc}"
246fi
247
248if check_define __ANDROID__ ; then
249 targetos="Android"
250elif check_define __linux__ ; then
251 targetos="Linux"
252elif check_define __OpenBSD__ ; then
253 targetos='OpenBSD'
254elif check_define __sun__ ; then
255 targetos='SunOS'
256 CFLAGS="$CFLAGS -D_REENTRANT"
257elif check_define _WIN32 ; then
258 targetos='CYGWIN'
259else
260 targetos=`uname -s`
261fi
262
263echo "# Automatically generated by configure - do not modify" > $config_host_mak
264printf "# Configured with:" >> $config_host_mak
265printf " '%s'" "$0" "$@" >> $config_host_mak
266echo >> $config_host_mak
267echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
268
269if test "$no_shm" = "yes" ; then
270 output_sym "CONFIG_NO_SHM"
271fi
272
273if test "$disable_opt" = "yes" ; then
274 output_sym "CONFIG_FIO_NO_OPT"
275fi
276
277# Some host OSes need non-standard checks for which CPU to use.
278# Note that these checks are broken for cross-compilation: if you're
279# cross-compiling to one of these OSes then you'll need to specify
280# the correct CPU with the --cpu option.
281case $targetos in
282AIX|OpenBSD)
283 # Unless explicitly enabled, turn off lex.
284 # OpenBSD will hit syntax error when enabled.
285 if test -z "$disable_lex" ; then
286 disable_lex="yes"
287 else
288 force_no_lex_o="yes"
289 fi
290 ;;
291Darwin)
292 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
293 # we can run 64-bit userspace code.
294 # If the user didn't specify a CPU explicitly and the kernel says this is
295 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
296 # detection code.
297 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
298 cpu="x86_64"
299 fi
300 # Error at compile time linking of weak/partial symbols if possible...
301cat > $TMPC <<EOF
302int main(void)
303{
304 return 0;
305}
306EOF
307 if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
308 echo "Disabling weak symbols"
309 LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
310 fi
311 ;;
312SunOS)
313 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
314 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
315 cpu="x86_64"
316 fi
317 LIBS="-lnsl -lsocket"
318 ;;
319CYGWIN*)
320 # We still force some options, so keep this message here.
321 echo "Forcing some known good options on Windows"
322 if test -z "${CC}${cross_prefix}"; then
323 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
324 cc="i686-w64-mingw32-gcc"
325 else
326 cc="x86_64-w64-mingw32-gcc"
327 fi
328 fi
329 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
330 output_sym "CONFIG_32BIT"
331 else
332 output_sym "CONFIG_64BIT_LLP64"
333 fi
334 # We need this to be output_sym'd here because this is Windows specific.
335 # The regular configure path never sets this config.
336 output_sym "CONFIG_WINDOWSAIO"
337 # We now take the regular configuration path without having exit 0 here.
338 # Flags below are still necessary mostly for MinGW.
339 socklen_t="yes"
340 sfaa="yes"
341 sync_sync="yes"
342 cmp_swap="yes"
343 rusage_thread="yes"
344 fdatasync="yes"
345 clock_gettime="yes" # clock_monotonic probe has dependency on this
346 clock_monotonic="yes"
347 gettimeofday="yes"
348 sched_idle="yes"
349 tcp_nodelay="yes"
350 tls_thread="yes"
351 static_assert="yes"
352 ipv6="yes"
353 mkdir_two="no"
354 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
355 ;;
356esac
357
358# Now we know the target platform we can have another guess at the preferred
359# compiler when it wasn't explictly set
360if test -z "${CC}${cross_prefix}"; then
361 if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
362 if has clang; then
363 cc=clang
364 fi
365 fi
366fi
367if test -z "$cc"; then
368 echo "configure: failed to find compiler"
369 exit 1
370fi
371
372if test ! -z "$cpu" ; then
373 # command line argument
374 :
375elif check_define __i386__ ; then
376 cpu="i386"
377elif check_define __x86_64__ ; then
378 cpu="x86_64"
379elif check_define __sparc__ ; then
380 if check_define __arch64__ ; then
381 cpu="sparc64"
382 else
383 cpu="sparc"
384 fi
385elif check_define _ARCH_PPC ; then
386 if check_define _ARCH_PPC64 ; then
387 cpu="ppc64"
388 else
389 cpu="ppc"
390 fi
391elif check_define __mips__ ; then
392 cpu="mips"
393elif check_define __ia64__ ; then
394 cpu="ia64"
395elif check_define __s390__ ; then
396 if check_define __s390x__ ; then
397 cpu="s390x"
398 else
399 cpu="s390"
400 fi
401elif check_define __arm__ ; then
402 cpu="arm"
403elif check_define __aarch64__ ; then
404 cpu="aarch64"
405elif check_define __hppa__ ; then
406 cpu="hppa"
407else
408 cpu=`uname -m`
409fi
410
411# Normalise host CPU name and set ARCH.
412case "$cpu" in
413 ia64|ppc|ppc64|s390|s390x|sparc64)
414 cpu="$cpu"
415 ;;
416 i386|i486|i586|i686|i86pc|BePC)
417 cpu="x86"
418 ;;
419 x86_64|amd64)
420 cpu="x86_64"
421 ;;
422 armv*b|armv*l|arm)
423 cpu="arm"
424 ;;
425 aarch64)
426 cpu="arm64"
427 ;;
428 hppa|parisc|parisc64)
429 cpu="hppa"
430 ;;
431 mips*)
432 cpu="mips"
433 ;;
434 sparc|sun4[cdmuv])
435 cpu="sparc"
436 ;;
437 *)
438 echo "Unknown CPU"
439 ;;
440esac
441
442##########################################
443# check cross compile
444
445if test "$cross_compile" != "yes" ; then
446 cross_compile="no"
447fi
448cat > $TMPC <<EOF
449int main(void)
450{
451 return 0;
452}
453EOF
454if compile_prog "" "" "cross"; then
455 $TMPE 2>/dev/null || cross_compile="yes"
456else
457 fatal "compile test failed"
458fi
459
460##########################################
461# check endianness
462if test "$bigendian" != "yes" ; then
463 bigendian="no"
464fi
465if test "$cross_compile" = "no" ; then
466 cat > $TMPC <<EOF
467#include <inttypes.h>
468int main(void)
469{
470 volatile uint32_t i=0x01234567;
471 return (*((uint8_t*)(&i))) == 0x67;
472}
473EOF
474 if compile_prog "" "" "endian"; then
475 $TMPE && bigendian="yes"
476 fi
477else
478 # If we're cross compiling, try our best to work it out and rely on the
479 # run-time check to fail if we get it wrong.
480 cat > $TMPC <<EOF
481#include <endian.h>
482int main(void)
483{
484#if __BYTE_ORDER != __BIG_ENDIAN
485# error "Unknown endianness"
486#endif
487}
488EOF
489 compile_prog "" "" "endian" && bigendian="yes"
490 check_define "__ARMEB__" && bigendian="yes"
491 check_define "__MIPSEB__" && bigendian="yes"
492fi
493
494
495print_config "Operating system" "$targetos"
496print_config "CPU" "$cpu"
497print_config "Big endian" "$bigendian"
498print_config "Compiler" "$cc"
499print_config "Cross compile" "$cross_compile"
500echo
501
502##########################################
503# See if we need to build a static build
504if test "$build_static" = "yes" ; then
505 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
506 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
507else
508 build_static="no"
509fi
510print_config "Static build" "$build_static"
511
512##########################################
513# check for wordsize
514wordsize="0"
515cat > $TMPC <<EOF
516#include <limits.h>
517#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
518int main(void)
519{
520 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
521 return 0;
522}
523EOF
524if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
525 wordsize="32"
526elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
527 wordsize="64"
528else
529 fatal "Unknown wordsize"
530fi
531print_config "Wordsize" "$wordsize"
532
533##########################################
534# zlib probe
535if test "$zlib" != "yes" ; then
536 zlib="no"
537fi
538cat > $TMPC <<EOF
539#include <zlib.h>
540int main(void)
541{
542 z_stream stream;
543 if (inflateInit(&stream) != Z_OK)
544 return 1;
545 return 0;
546}
547EOF
548if compile_prog "" "-lz" "zlib" ; then
549 zlib=yes
550 LIBS="-lz $LIBS"
551fi
552print_config "zlib" "$zlib"
553
554##########################################
555# linux-aio probe
556if test "$libaio" != "yes" ; then
557 libaio="no"
558fi
559if test "$esx" != "yes" ; then
560 cat > $TMPC <<EOF
561#include <libaio.h>
562#include <stddef.h>
563int main(void)
564{
565 io_setup(0, NULL);
566 return 0;
567}
568EOF
569 if compile_prog "" "-laio" "libaio" ; then
570 libaio=yes
571 LIBS="-laio $LIBS"
572 else
573 if test "$libaio" = "yes" ; then
574 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
575 fi
576 libaio=no
577 fi
578fi
579print_config "Linux AIO support" "$libaio"
580
581##########################################
582# posix aio probe
583if test "$posix_aio" != "yes" ; then
584 posix_aio="no"
585fi
586if test "$posix_aio_lrt" != "yes" ; then
587 posix_aio_lrt="no"
588fi
589cat > $TMPC <<EOF
590#include <aio.h>
591int main(void)
592{
593 struct aiocb cb;
594 aio_read(&cb);
595 return 0;
596}
597EOF
598if compile_prog "" "" "posixaio" ; then
599 posix_aio="yes"
600elif compile_prog "" "-lrt" "posixaio"; then
601 posix_aio="yes"
602 posix_aio_lrt="yes"
603 LIBS="-lrt $LIBS"
604fi
605print_config "POSIX AIO support" "$posix_aio"
606print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
607
608##########################################
609# posix aio fsync probe
610if test "$posix_aio_fsync" != "yes" ; then
611 posix_aio_fsync="no"
612fi
613if test "$posix_aio" = "yes" ; then
614 cat > $TMPC <<EOF
615#include <fcntl.h>
616#include <aio.h>
617int main(void)
618{
619 struct aiocb cb;
620 return aio_fsync(O_SYNC, &cb);
621 return 0;
622}
623EOF
624 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
625 posix_aio_fsync=yes
626 fi
627fi
628print_config "POSIX AIO fsync" "$posix_aio_fsync"
629
630##########################################
631# POSIX pshared attribute probe
632if test "$posix_pshared" != "yes" ; then
633 posix_pshared="no"
634fi
635cat > $TMPC <<EOF
636#include <unistd.h>
637int main(void)
638{
639#if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
640# if defined(__CYGWIN__)
641# error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
642# elif defined(__APPLE__)
643# include <AvailabilityMacros.h>
644# include <TargetConditionals.h>
645# if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
646# error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
647# endif
648# endif
649#else
650# error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
651#endif
652 return 0;
653}
654EOF
655if compile_prog "" "$LIBS" "posix_pshared" ; then
656 posix_pshared=yes
657fi
658print_config "POSIX pshared support" "$posix_pshared"
659
660##########################################
661# solaris aio probe
662if test "$solaris_aio" != "yes" ; then
663 solaris_aio="no"
664fi
665cat > $TMPC <<EOF
666#include <sys/types.h>
667#include <sys/asynch.h>
668#include <unistd.h>
669int main(void)
670{
671 aio_result_t res;
672 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
673 return 0;
674}
675EOF
676if compile_prog "" "-laio" "solarisaio" ; then
677 solaris_aio=yes
678 LIBS="-laio $LIBS"
679fi
680print_config "Solaris AIO support" "$solaris_aio"
681
682##########################################
683# __sync_fetch_and_add test
684if test "$sfaa" != "yes" ; then
685 sfaa="no"
686fi
687cat > $TMPC << EOF
688#include <inttypes.h>
689static int sfaa(uint64_t *ptr)
690{
691 return __sync_fetch_and_add(ptr, 0);
692}
693
694int main(int argc, char **argv)
695{
696 uint64_t val = 42;
697 sfaa(&val);
698 return val;
699}
700EOF
701if compile_prog "" "" "__sync_fetch_and_add()" ; then
702 sfaa="yes"
703fi
704print_config "__sync_fetch_and_add" "$sfaa"
705
706##########################################
707# __sync_synchronize() test
708if test "$sync_sync" != "yes" ; then
709 sync_sync="no"
710fi
711cat > $TMPC << EOF
712#include <inttypes.h>
713
714int main(int argc, char **argv)
715{
716 __sync_synchronize();
717 return 0;
718}
719EOF
720if compile_prog "" "" "__sync_synchronize()" ; then
721 sync_sync="yes"
722fi
723print_config "__sync_synchronize" "$sync_sync"
724
725##########################################
726# __sync_val_compare_and_swap() test
727if test "$cmp_swap" != "yes" ; then
728 cmp_swap="no"
729fi
730cat > $TMPC << EOF
731#include <inttypes.h>
732
733int main(int argc, char **argv)
734{
735 int x = 0;
736 return __sync_val_compare_and_swap(&x, 1, 2);
737}
738EOF
739if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
740 cmp_swap="yes"
741fi
742print_config "__sync_val_compare_and_swap" "$cmp_swap"
743
744##########################################
745# libverbs probe
746if test "$libverbs" != "yes" ; then
747 libverbs="no"
748fi
749cat > $TMPC << EOF
750#include <infiniband/verbs.h>
751int main(int argc, char **argv)
752{
753 struct ibv_pd *pd = ibv_alloc_pd(NULL);
754 return 0;
755}
756EOF
757if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
758 libverbs="yes"
759 LIBS="-libverbs $LIBS"
760fi
761print_config "libverbs" "$libverbs"
762
763##########################################
764# rdmacm probe
765if test "$rdmacm" != "yes" ; then
766 rdmacm="no"
767fi
768cat > $TMPC << EOF
769#include <stdio.h>
770#include <rdma/rdma_cma.h>
771int main(int argc, char **argv)
772{
773 rdma_destroy_qp(NULL);
774 return 0;
775}
776EOF
777if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
778 rdmacm="yes"
779 LIBS="-lrdmacm $LIBS"
780fi
781print_config "rdmacm" "$rdmacm"
782
783##########################################
784# Linux fallocate probe
785if test "$linux_fallocate" != "yes" ; then
786 linux_fallocate="no"
787fi
788cat > $TMPC << EOF
789#include <stdio.h>
790#include <fcntl.h>
791#include <linux/falloc.h>
792int main(int argc, char **argv)
793{
794 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
795 return r;
796}
797EOF
798if compile_prog "" "" "linux_fallocate"; then
799 linux_fallocate="yes"
800fi
801print_config "Linux fallocate" "$linux_fallocate"
802
803##########################################
804# POSIX fadvise probe
805if test "$posix_fadvise" != "yes" ; then
806 posix_fadvise="no"
807fi
808cat > $TMPC << EOF
809#include <stdio.h>
810#include <fcntl.h>
811int main(int argc, char **argv)
812{
813 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
814 return r;
815}
816EOF
817if compile_prog "" "" "posix_fadvise"; then
818 posix_fadvise="yes"
819fi
820print_config "POSIX fadvise" "$posix_fadvise"
821
822##########################################
823# POSIX fallocate probe
824if test "$posix_fallocate" != "yes" ; then
825 posix_fallocate="no"
826fi
827cat > $TMPC << EOF
828#include <stdio.h>
829#include <fcntl.h>
830int main(int argc, char **argv)
831{
832 int r = posix_fallocate(0, 0, 1024);
833 return r;
834}
835EOF
836if compile_prog "" "" "posix_fallocate"; then
837 posix_fallocate="yes"
838fi
839print_config "POSIX fallocate" "$posix_fallocate"
840
841##########################################
842# sched_set/getaffinity 2 or 3 argument test
843if test "$linux_2arg_affinity" != "yes" ; then
844 linux_2arg_affinity="no"
845fi
846if test "$linux_3arg_affinity" != "yes" ; then
847 linux_3arg_affinity="no"
848fi
849cat > $TMPC << EOF
850#include <sched.h>
851int main(int argc, char **argv)
852{
853 cpu_set_t mask;
854 return sched_setaffinity(0, sizeof(mask), &mask);
855}
856EOF
857if compile_prog "" "" "sched_setaffinity(,,)"; then
858 linux_3arg_affinity="yes"
859else
860 cat > $TMPC << EOF
861#include <sched.h>
862int main(int argc, char **argv)
863{
864 cpu_set_t mask;
865 return sched_setaffinity(0, &mask);
866}
867EOF
868 if compile_prog "" "" "sched_setaffinity(,)"; then
869 linux_2arg_affinity="yes"
870 fi
871fi
872print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
873print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
874
875##########################################
876# clock_gettime probe
877if test "$clock_gettime" != "yes" ; then
878 clock_gettime="no"
879fi
880cat > $TMPC << EOF
881#include <stdio.h>
882#include <time.h>
883int main(int argc, char **argv)
884{
885 return clock_gettime(0, NULL);
886}
887EOF
888if compile_prog "" "" "clock_gettime"; then
889 clock_gettime="yes"
890elif compile_prog "" "-lrt" "clock_gettime"; then
891 clock_gettime="yes"
892 LIBS="-lrt $LIBS"
893fi
894print_config "clock_gettime" "$clock_gettime"
895
896##########################################
897# CLOCK_MONOTONIC probe
898if test "$clock_monotonic" != "yes" ; then
899 clock_monotonic="no"
900fi
901if test "$clock_gettime" = "yes" ; then
902 cat > $TMPC << EOF
903#include <stdio.h>
904#include <time.h>
905int main(int argc, char **argv)
906{
907 return clock_gettime(CLOCK_MONOTONIC, NULL);
908}
909EOF
910 if compile_prog "" "$LIBS" "clock monotonic"; then
911 clock_monotonic="yes"
912 fi
913fi
914print_config "CLOCK_MONOTONIC" "$clock_monotonic"
915
916##########################################
917# CLOCK_MONOTONIC_RAW probe
918if test "$clock_monotonic_raw" != "yes" ; then
919 clock_monotonic_raw="no"
920fi
921if test "$clock_gettime" = "yes" ; then
922 cat > $TMPC << EOF
923#include <stdio.h>
924#include <time.h>
925int main(int argc, char **argv)
926{
927 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
928}
929EOF
930 if compile_prog "" "$LIBS" "clock monotonic"; then
931 clock_monotonic_raw="yes"
932 fi
933fi
934print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw"
935
936##########################################
937# CLOCK_MONOTONIC_PRECISE probe
938if test "$clock_monotonic_precise" != "yes" ; then
939 clock_monotonic_precise="no"
940fi
941if test "$clock_gettime" = "yes" ; then
942 cat > $TMPC << EOF
943#include <stdio.h>
944#include <time.h>
945int main(int argc, char **argv)
946{
947 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
948}
949EOF
950 if compile_prog "" "$LIBS" "clock monotonic precise"; then
951 clock_monotonic_precise="yes"
952 fi
953fi
954print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise"
955
956##########################################
957# clockid_t probe
958if test "$clockid_t" != "yes" ; then
959 clockid_t="no"
960fi
961cat > $TMPC << EOF
962#include <time.h>
963#include <string.h>
964int main(int argc, char **argv)
965{
966 volatile clockid_t cid;
967 memset((void*)&cid, 0, sizeof(cid));
968 return 0;
969}
970EOF
971if compile_prog "" "$LIBS" "clockid_t"; then
972 clockid_t="yes"
973fi
974print_config "clockid_t" "$clockid_t"
975
976##########################################
977# gettimeofday() probe
978if test "$gettimeofday" != "yes" ; then
979 gettimeofday="no"
980fi
981cat > $TMPC << EOF
982#include <sys/time.h>
983#include <stdio.h>
984int main(int argc, char **argv)
985{
986 struct timeval tv;
987 return gettimeofday(&tv, NULL);
988}
989EOF
990if compile_prog "" "" "gettimeofday"; then
991 gettimeofday="yes"
992fi
993print_config "gettimeofday" "$gettimeofday"
994
995##########################################
996# fdatasync() probe
997if test "$fdatasync" != "yes" ; then
998 fdatasync="no"
999fi
1000cat > $TMPC << EOF
1001#include <stdio.h>
1002#include <unistd.h>
1003int main(int argc, char **argv)
1004{
1005 return fdatasync(0);
1006}
1007EOF
1008if compile_prog "" "" "fdatasync"; then
1009 fdatasync="yes"
1010fi
1011print_config "fdatasync" "$fdatasync"
1012
1013##########################################
1014# sync_file_range() probe
1015if test "$sync_file_range" != "yes" ; then
1016 sync_file_range="no"
1017fi
1018cat > $TMPC << EOF
1019#include <stdio.h>
1020#include <unistd.h>
1021#include <fcntl.h>
1022#include <linux/fs.h>
1023int main(int argc, char **argv)
1024{
1025 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1026 SYNC_FILE_RANGE_WAIT_AFTER;
1027 return sync_file_range(0, 0, 0, flags);
1028}
1029EOF
1030if compile_prog "" "" "sync_file_range"; then
1031 sync_file_range="yes"
1032fi
1033print_config "sync_file_range" "$sync_file_range"
1034
1035##########################################
1036# ext4 move extent probe
1037if test "$ext4_me" != "yes" ; then
1038 ext4_me="no"
1039fi
1040cat > $TMPC << EOF
1041#include <fcntl.h>
1042#include <sys/ioctl.h>
1043int main(int argc, char **argv)
1044{
1045 struct move_extent me;
1046 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1047}
1048EOF
1049if compile_prog "" "" "ext4 move extent" ; then
1050 ext4_me="yes"
1051elif test $targetos = "Linux" ; then
1052 # On Linux, just default to it on and let it error at runtime if we really
1053 # don't have it. None of my updated systems have it defined, but it does
1054 # work. Takes a while to bubble back.
1055 ext4_me="yes"
1056fi
1057print_config "EXT4 move extent" "$ext4_me"
1058
1059##########################################
1060# splice probe
1061if test "$linux_splice" != "yes" ; then
1062 linux_splice="no"
1063fi
1064cat > $TMPC << EOF
1065#include <stdio.h>
1066#include <fcntl.h>
1067int main(int argc, char **argv)
1068{
1069 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1070}
1071EOF
1072if compile_prog "" "" "linux splice"; then
1073 linux_splice="yes"
1074fi
1075print_config "Linux splice(2)" "$linux_splice"
1076
1077##########################################
1078# GUASI probe
1079if test "$guasi" != "yes" ; then
1080 guasi="no"
1081fi
1082cat > $TMPC << EOF
1083#include <guasi.h>
1084#include <guasi_syscalls.h>
1085int main(int argc, char **argv)
1086{
1087 guasi_t ctx = guasi_create(0, 0, 0);
1088 return 0;
1089}
1090EOF
1091if compile_prog "" "" "guasi"; then
1092 guasi="yes"
1093fi
1094print_config "GUASI" "$guasi"
1095
1096##########################################
1097# fusion-aw probe
1098if test "$fusion_aw" != "yes" ; then
1099 fusion_aw="no"
1100fi
1101cat > $TMPC << EOF
1102#include <nvm/nvm_primitives.h>
1103int main(int argc, char **argv)
1104{
1105 nvm_version_t ver_info;
1106 nvm_handle_t handle;
1107
1108 handle = nvm_get_handle(0, &ver_info);
1109 return nvm_atomic_write(handle, 0, 0, 0);
1110}
1111EOF
1112if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1113 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
1114 fusion_aw="yes"
1115fi
1116print_config "Fusion-io atomic engine" "$fusion_aw"
1117
1118##########################################
1119# libnuma probe
1120if test "$libnuma" != "yes" ; then
1121 libnuma="no"
1122fi
1123cat > $TMPC << EOF
1124#include <numa.h>
1125int main(int argc, char **argv)
1126{
1127 return numa_available();
1128}
1129EOF
1130if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1131 libnuma="yes"
1132 LIBS="-lnuma $LIBS"
1133fi
1134print_config "libnuma" "$libnuma"
1135
1136##########################################
1137# libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1138if test "$libnuma" = "yes" ; then
1139libnuma_v2="no"
1140cat > $TMPC << EOF
1141#include <numa.h>
1142int main(int argc, char **argv)
1143{
1144 struct bitmask *mask = numa_parse_nodestring(NULL);
1145 return mask->size == 0;
1146}
1147EOF
1148if compile_prog "" "" "libnuma api"; then
1149 libnuma_v2="yes"
1150fi
1151print_config "libnuma v2" "$libnuma_v2"
1152fi
1153
1154##########################################
1155# strsep() probe
1156if test "$strsep" != "yes" ; then
1157 strsep="no"
1158fi
1159cat > $TMPC << EOF
1160#include <string.h>
1161int main(int argc, char **argv)
1162{
1163 static char *string = "This is a string";
1164 strsep(&string, "needle");
1165 return 0;
1166}
1167EOF
1168if compile_prog "" "" "strsep"; then
1169 strsep="yes"
1170fi
1171print_config "strsep" "$strsep"
1172
1173##########################################
1174# strcasestr() probe
1175if test "$strcasestr" != "yes" ; then
1176 strcasestr="no"
1177fi
1178cat > $TMPC << EOF
1179#include <string.h>
1180int main(int argc, char **argv)
1181{
1182 return strcasestr(argv[0], argv[1]) != NULL;
1183}
1184EOF
1185if compile_prog "" "" "strcasestr"; then
1186 strcasestr="yes"
1187fi
1188print_config "strcasestr" "$strcasestr"
1189
1190##########################################
1191# strlcat() probe
1192if test "$strlcat" != "yes" ; then
1193 strlcat="no"
1194fi
1195cat > $TMPC << EOF
1196#include <string.h>
1197int main(int argc, char **argv)
1198{
1199 static char dst[64];
1200 static char *string = "This is a string";
1201 memset(dst, 0, sizeof(dst));
1202 strlcat(dst, string, sizeof(dst));
1203 return 0;
1204}
1205EOF
1206if compile_prog "" "" "strlcat"; then
1207 strlcat="yes"
1208fi
1209print_config "strlcat" "$strlcat"
1210
1211##########################################
1212# getopt_long_only() probe
1213if test "$getopt_long_only" != "yes" ; then
1214 getopt_long_only="no"
1215fi
1216cat > $TMPC << EOF
1217#include <unistd.h>
1218#include <stdio.h>
1219#include <getopt.h>
1220int main(int argc, char **argv)
1221{
1222 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1223 return c;
1224}
1225EOF
1226if compile_prog "" "" "getopt_long_only"; then
1227 getopt_long_only="yes"
1228fi
1229print_config "getopt_long_only()" "$getopt_long_only"
1230
1231##########################################
1232# inet_aton() probe
1233if test "$inet_aton" != "yes" ; then
1234 inet_aton="no"
1235fi
1236cat > $TMPC << EOF
1237#include <sys/socket.h>
1238#include <arpa/inet.h>
1239#include <stdio.h>
1240int main(int argc, char **argv)
1241{
1242 struct in_addr in;
1243 return inet_aton(NULL, &in);
1244}
1245EOF
1246if compile_prog "" "" "inet_aton"; then
1247 inet_aton="yes"
1248fi
1249print_config "inet_aton" "$inet_aton"
1250
1251##########################################
1252# socklen_t probe
1253if test "$socklen_t" != "yes" ; then
1254 socklen_t="no"
1255fi
1256cat > $TMPC << EOF
1257#include <sys/socket.h>
1258int main(int argc, char **argv)
1259{
1260 socklen_t len = 0;
1261 return len;
1262}
1263EOF
1264if compile_prog "" "" "socklen_t"; then
1265 socklen_t="yes"
1266fi
1267print_config "socklen_t" "$socklen_t"
1268
1269##########################################
1270# Whether or not __thread is supported for TLS
1271if test "$tls_thread" != "yes" ; then
1272 tls_thread="no"
1273fi
1274cat > $TMPC << EOF
1275#include <stdio.h>
1276static __thread int ret;
1277int main(int argc, char **argv)
1278{
1279 return ret;
1280}
1281EOF
1282if compile_prog "" "" "__thread"; then
1283 tls_thread="yes"
1284fi
1285print_config "__thread" "$tls_thread"
1286
1287##########################################
1288# Check if we have required gtk/glib support for gfio
1289if test "$gfio" != "yes" ; then
1290 gfio="no"
1291fi
1292if test "$gfio_check" = "yes" ; then
1293 cat > $TMPC << EOF
1294#include <glib.h>
1295#include <cairo.h>
1296#include <gtk/gtk.h>
1297int main(void)
1298{
1299 gdk_threads_enter();
1300 gdk_threads_leave();
1301
1302 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1303}
1304EOF
1305GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1306ORG_LDFLAGS=$LDFLAGS
1307LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1308if test "$?" != "0" ; then
1309 echo "configure: gtk and gthread not found"
1310 exit 1
1311fi
1312GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1313if test "$?" != "0" ; then
1314 echo "configure: gtk and gthread not found"
1315 exit 1
1316fi
1317if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1318 $TMPE
1319 if test "$?" = "0" ; then
1320 gfio="yes"
1321 GFIO_LIBS="$LIBS $GTK_LIBS"
1322 CFLAGS="$CFLAGS $GTK_CFLAGS"
1323 else
1324 echo "GTK found, but need version 2.18 or higher"
1325 gfio="no"
1326 fi
1327else
1328 echo "Please install gtk and gdk libraries"
1329 gfio="no"
1330fi
1331LDFLAGS=$ORG_LDFLAGS
1332fi
1333
1334if test "$gfio_check" = "yes" ; then
1335 print_config "gtk 2.18 or higher" "$gfio"
1336fi
1337
1338##########################################
1339# Check whether we have getrusage(RUSAGE_THREAD)
1340if test "$rusage_thread" != "yes" ; then
1341 rusage_thread="no"
1342fi
1343cat > $TMPC << EOF
1344#include <sys/time.h>
1345#include <sys/resource.h>
1346int main(int argc, char **argv)
1347{
1348 struct rusage ru;
1349 getrusage(RUSAGE_THREAD, &ru);
1350 return 0;
1351}
1352EOF
1353if compile_prog "" "" "RUSAGE_THREAD"; then
1354 rusage_thread="yes"
1355fi
1356print_config "RUSAGE_THREAD" "$rusage_thread"
1357
1358##########################################
1359# Check whether we have SCHED_IDLE
1360if test "$sched_idle" != "yes" ; then
1361 sched_idle="no"
1362fi
1363cat > $TMPC << EOF
1364#include <sched.h>
1365int main(int argc, char **argv)
1366{
1367 struct sched_param p;
1368 return sched_setscheduler(0, SCHED_IDLE, &p);
1369}
1370EOF
1371if compile_prog "" "" "SCHED_IDLE"; then
1372 sched_idle="yes"
1373fi
1374print_config "SCHED_IDLE" "$sched_idle"
1375
1376##########################################
1377# Check whether we have TCP_NODELAY
1378if test "$tcp_nodelay" != "yes" ; then
1379 tcp_nodelay="no"
1380fi
1381cat > $TMPC << EOF
1382#include <stdio.h>
1383#include <sys/types.h>
1384#include <sys/socket.h>
1385#include <netinet/tcp.h>
1386int main(int argc, char **argv)
1387{
1388 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1389}
1390EOF
1391if compile_prog "" "" "TCP_NODELAY"; then
1392 tcp_nodelay="yes"
1393fi
1394print_config "TCP_NODELAY" "$tcp_nodelay"
1395
1396##########################################
1397# Check whether we have SO_SNDBUF
1398if test "$window_size" != "yes" ; then
1399 window_size="no"
1400fi
1401cat > $TMPC << EOF
1402#include <stdio.h>
1403#include <sys/types.h>
1404#include <sys/socket.h>
1405#include <netinet/tcp.h>
1406int main(int argc, char **argv)
1407{
1408 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1409 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1410}
1411EOF
1412if compile_prog "" "" "SO_SNDBUF"; then
1413 window_size="yes"
1414fi
1415print_config "Net engine window_size" "$window_size"
1416
1417##########################################
1418# Check whether we have TCP_MAXSEG
1419if test "$mss" != "yes" ; then
1420 mss="no"
1421fi
1422cat > $TMPC << EOF
1423#include <stdio.h>
1424#include <sys/types.h>
1425#include <sys/socket.h>
1426#include <netinet/tcp.h>
1427#include <arpa/inet.h>
1428#include <netinet/in.h>
1429int main(int argc, char **argv)
1430{
1431 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1432}
1433EOF
1434if compile_prog "" "" "TCP_MAXSEG"; then
1435 mss="yes"
1436fi
1437print_config "TCP_MAXSEG" "$mss"
1438
1439##########################################
1440# Check whether we have RLIMIT_MEMLOCK
1441if test "$rlimit_memlock" != "yes" ; then
1442 rlimit_memlock="no"
1443fi
1444cat > $TMPC << EOF
1445#include <sys/time.h>
1446#include <sys/resource.h>
1447int main(int argc, char **argv)
1448{
1449 struct rlimit rl;
1450 return getrlimit(RLIMIT_MEMLOCK, &rl);
1451}
1452EOF
1453if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1454 rlimit_memlock="yes"
1455fi
1456print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1457
1458##########################################
1459# Check whether we have pwritev/preadv
1460if test "$pwritev" != "yes" ; then
1461 pwritev="no"
1462fi
1463cat > $TMPC << EOF
1464#include <stdio.h>
1465#include <sys/uio.h>
1466int main(int argc, char **argv)
1467{
1468 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1469}
1470EOF
1471if compile_prog "" "" "pwritev"; then
1472 pwritev="yes"
1473fi
1474print_config "pwritev/preadv" "$pwritev"
1475
1476##########################################
1477# Check whether we have pwritev2/preadv2
1478if test "$pwritev2" != "yes" ; then
1479 pwritev2="no"
1480fi
1481cat > $TMPC << EOF
1482#include <stdio.h>
1483#include <sys/uio.h>
1484int main(int argc, char **argv)
1485{
1486 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1487}
1488EOF
1489if compile_prog "" "" "pwritev2"; then
1490 pwritev2="yes"
1491fi
1492print_config "pwritev2/preadv2" "$pwritev2"
1493
1494##########################################
1495# Check whether we have the required functions for ipv6
1496if test "$ipv6" != "yes" ; then
1497 ipv6="no"
1498fi
1499cat > $TMPC << EOF
1500#include <sys/types.h>
1501#include <sys/socket.h>
1502#include <netinet/in.h>
1503#include <netdb.h>
1504#include <stdio.h>
1505int main(int argc, char **argv)
1506{
1507 struct addrinfo hints;
1508 struct in6_addr addr;
1509 int ret;
1510
1511 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1512 freeaddrinfo(NULL);
1513 printf("%s\n", gai_strerror(ret));
1514 addr = in6addr_any;
1515 return 0;
1516}
1517EOF
1518if compile_prog "" "" "ipv6"; then
1519 ipv6="yes"
1520fi
1521print_config "IPv6 helpers" "$ipv6"
1522
1523##########################################
1524# check for rados
1525if test "$rados" != "yes" ; then
1526 rados="no"
1527fi
1528cat > $TMPC << EOF
1529#include <rados/librados.h>
1530
1531int main(int argc, char **argv)
1532{
1533 rados_t cluster;
1534 rados_ioctx_t io_ctx;
1535 const char cluster_name[] = "ceph";
1536 const char user_name[] = "client.admin";
1537 const char pool[] = "rados";
1538
1539 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1540 rados_create2(&cluster, cluster_name, user_name, 0);
1541 rados_ioctx_create(cluster, pool, &io_ctx);
1542
1543 return 0;
1544}
1545EOF
1546if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
1547 LIBS="-lrados $LIBS"
1548 rados="yes"
1549fi
1550print_config "Rados engine" "$rados"
1551
1552##########################################
1553# check for rbd
1554if test "$rbd" != "yes" ; then
1555 rbd="no"
1556fi
1557cat > $TMPC << EOF
1558#include <rbd/librbd.h>
1559
1560int main(int argc, char **argv)
1561{
1562 rados_t cluster;
1563 rados_ioctx_t io_ctx;
1564 const char cluster_name[] = "ceph";
1565 const char user_name[] = "client.admin";
1566 const char pool[] = "rbd";
1567 int major, minor, extra;
1568
1569 rbd_version(&major, &minor, &extra);
1570 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1571 rados_create2(&cluster, cluster_name, user_name, 0);
1572 rados_ioctx_create(cluster, pool, &io_ctx);
1573
1574 return 0;
1575}
1576EOF
1577if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1578 LIBS="-lrbd -lrados $LIBS"
1579 rbd="yes"
1580fi
1581print_config "Rados Block Device engine" "$rbd"
1582
1583##########################################
1584# check for rbd_poll
1585if test "$rbd_poll" != "yes" ; then
1586 rbd_poll="no"
1587fi
1588if test "$rbd" = "yes"; then
1589cat > $TMPC << EOF
1590#include <rbd/librbd.h>
1591#include <sys/eventfd.h>
1592
1593int main(int argc, char **argv)
1594{
1595 rbd_image_t image;
1596 rbd_completion_t comp;
1597
1598 int fd = eventfd(0, EFD_NONBLOCK);
1599 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1600 rbd_poll_io_events(image, comp, 1);
1601
1602 return 0;
1603}
1604EOF
1605if compile_prog "" "-lrbd -lrados" "rbd"; then
1606 rbd_poll="yes"
1607fi
1608print_config "rbd_poll" "$rbd_poll"
1609fi
1610
1611##########################################
1612# check for rbd_invalidate_cache()
1613if test "$rbd_inval" != "yes" ; then
1614 rbd_inval="no"
1615fi
1616if test "$rbd" = "yes"; then
1617cat > $TMPC << EOF
1618#include <rbd/librbd.h>
1619
1620int main(int argc, char **argv)
1621{
1622 rbd_image_t image;
1623
1624 return rbd_invalidate_cache(image);
1625}
1626EOF
1627if compile_prog "" "-lrbd -lrados" "rbd"; then
1628 rbd_inval="yes"
1629fi
1630print_config "rbd_invalidate_cache" "$rbd_inval"
1631fi
1632
1633##########################################
1634# Check whether we have setvbuf
1635if test "$setvbuf" != "yes" ; then
1636 setvbuf="no"
1637fi
1638cat > $TMPC << EOF
1639#include <stdio.h>
1640int main(int argc, char **argv)
1641{
1642 FILE *f = NULL;
1643 char buf[80];
1644 setvbuf(f, buf, _IOFBF, sizeof(buf));
1645 return 0;
1646}
1647EOF
1648if compile_prog "" "" "setvbuf"; then
1649 setvbuf="yes"
1650fi
1651print_config "setvbuf" "$setvbuf"
1652
1653##########################################
1654# check for gfapi
1655if test "$gfapi" != "yes" ; then
1656 gfapi="no"
1657fi
1658cat > $TMPC << EOF
1659#include <glusterfs/api/glfs.h>
1660
1661int main(int argc, char **argv)
1662{
1663 glfs_t *g = glfs_new("foo");
1664
1665 return 0;
1666}
1667EOF
1668if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1669 LIBS="-lgfapi -lglusterfs $LIBS"
1670 gfapi="yes"
1671fi
1672print_config "Gluster API engine" "$gfapi"
1673
1674##########################################
1675# check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1676if test "$gfapi" = "yes" ; then
1677gf_fadvise="no"
1678cat > $TMPC << EOF
1679#include <glusterfs/api/glfs.h>
1680
1681int main(int argc, char **argv)
1682{
1683 struct glfs_fd *fd;
1684 int ret = glfs_fadvise(fd, 0, 0, 1);
1685
1686 return 0;
1687}
1688EOF
1689if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1690 gf_fadvise="yes"
1691fi
1692print_config "Gluster API use fadvise" "$gf_fadvise"
1693fi
1694
1695##########################################
1696# check for gfapi trim support
1697if test "$gf_trim" != "yes" ; then
1698 gf_trim="no"
1699fi
1700if test "$gfapi" = "yes" ; then
1701cat > $TMPC << EOF
1702#include <glusterfs/api/glfs.h>
1703
1704int main(int argc, char **argv)
1705{
1706 return glfs_discard_async(NULL, 0, 0);
1707}
1708EOF
1709if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1710 gf_trim="yes"
1711fi
1712print_config "Gluster API trim support" "$gf_trim"
1713fi
1714
1715##########################################
1716# Check if we support stckf on s390
1717if test "$s390_z196_facilities" != "yes" ; then
1718 s390_z196_facilities="no"
1719fi
1720cat > $TMPC << EOF
1721#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1722int main(int argc, char **argv)
1723{
1724 /* We want just 1 double word to be returned. */
1725 register unsigned long reg0 asm("0") = 0;
1726 unsigned long stfle_bits;
1727 asm volatile(".machine push" "\n\t"
1728 ".machine \"z9-109\"" "\n\t"
1729 "stfle %0" "\n\t"
1730 ".machine pop" "\n"
1731 : "=QS" (stfle_bits), "+d" (reg0)
1732 : : "cc");
1733
1734 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1735 return 0;
1736 else
1737 return -1;
1738}
1739EOF
1740if compile_prog "" "" "s390_z196_facilities"; then
1741 $TMPE
1742 if [ $? -eq 0 ]; then
1743 s390_z196_facilities="yes"
1744 fi
1745fi
1746print_config "s390_z196_facilities" "$s390_z196_facilities"
1747
1748##########################################
1749# Check if we have required environment variables configured for libhdfs
1750if test "$libhdfs" = "yes" ; then
1751 hdfs_conf_error=0
1752 if test "$JAVA_HOME" = "" ; then
1753 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1754 hdfs_conf_error=1
1755 fi
1756 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1757 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1758 hdfs_conf_error=1
1759 fi
1760 if test "$FIO_LIBHDFS_LIB" = "" ; then
1761 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1762 hdfs_conf_error=1
1763 fi
1764 if test "$hdfs_conf_error" = "1" ; then
1765 exit 1
1766 fi
1767 FIO_HDFS_CPU=$cpu
1768 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1769 FIO_HDFS_CPU="amd64"
1770 fi
1771fi
1772print_config "HDFS engine" "$libhdfs"
1773
1774##########################################
1775# Check whether we have MTD
1776if test "$mtd" != "yes" ; then
1777 mtd="no"
1778fi
1779cat > $TMPC << EOF
1780#include <string.h>
1781#include <mtd/mtd-user.h>
1782#include <sys/ioctl.h>
1783int main(int argc, char **argv)
1784{
1785 struct mtd_write_req ops;
1786 struct mtd_info_user info;
1787 memset(&ops, 0, sizeof(ops));
1788 info.type = MTD_MLCNANDFLASH;
1789 return ioctl(0, MEMGETINFO, &info);
1790}
1791EOF
1792if compile_prog "" "" "mtd"; then
1793 mtd="yes"
1794fi
1795print_config "MTD" "$mtd"
1796
1797##########################################
1798# Check whether we have libpmem
1799if test "$libpmem" != "yes" ; then
1800 libpmem="no"
1801fi
1802cat > $TMPC << EOF
1803#include <libpmem.h>
1804int main(int argc, char **argv)
1805{
1806 int rc;
1807 rc = pmem_is_pmem(0, 0);
1808 return 0;
1809}
1810EOF
1811if compile_prog "" "-lpmem" "libpmem"; then
1812 libpmem="yes"
1813 LIBS="-lpmem $LIBS"
1814fi
1815print_config "libpmem" "$libpmem"
1816
1817##########################################
1818# Check whether we have libpmemblk
1819# libpmem is a prerequisite
1820if test "$libpmemblk" != "yes" ; then
1821 libpmemblk="no"
1822fi
1823if test "$libpmem" = "yes"; then
1824 cat > $TMPC << EOF
1825#include <libpmemblk.h>
1826int main(int argc, char **argv)
1827{
1828 PMEMblkpool *pbp;
1829 pbp = pmemblk_open("", 0);
1830 return 0;
1831}
1832EOF
1833 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1834 libpmemblk="yes"
1835 LIBS="-lpmemblk $LIBS"
1836 fi
1837fi
1838print_config "libpmemblk" "$libpmemblk"
1839
1840# Choose the ioengines
1841if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1842 pmem="yes"
1843 devdax="yes"
1844 if test "$libpmemblk" = "yes"; then
1845 pmemblk="yes"
1846 fi
1847fi
1848
1849##########################################
1850# Report whether pmemblk engine is enabled
1851print_config "NVML pmemblk engine" "$pmemblk"
1852
1853##########################################
1854# Report whether dev-dax engine is enabled
1855print_config "NVML dev-dax engine" "$devdax"
1856
1857##########################################
1858# Report whether libpmem engine is enabled
1859print_config "NVML libpmem engine" "$pmem"
1860
1861##########################################
1862# Check if we have lex/yacc available
1863yacc="no"
1864yacc_is_bison="no"
1865lex="no"
1866arith="no"
1867if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
1868if test "$targetos" != "SunOS" ; then
1869LEX=$(which lex 2> /dev/null)
1870if test -x "$LEX" ; then
1871 lex="yes"
1872fi
1873YACC=$(which bison 2> /dev/null)
1874if test -x "$YACC" ; then
1875 yacc="yes"
1876 yacc_is_bison="yes"
1877else
1878 YACC=$(which yacc 2> /dev/null)
1879 if test -x "$YACC" ; then
1880 yacc="yes"
1881 fi
1882fi
1883if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1884 arith="yes"
1885fi
1886
1887if test "$arith" = "yes" ; then
1888cat > $TMPC << EOF
1889extern int yywrap(void);
1890
1891int main(int argc, char **argv)
1892{
1893 yywrap();
1894 return 0;
1895}
1896EOF
1897if compile_prog "" "-ll" "lex"; then
1898 LIBS="-ll $LIBS"
1899else
1900 arith="no"
1901fi
1902fi
1903fi
1904fi
1905
1906# Check if lex fails using -o
1907if test "$arith" = "yes" ; then
1908if test "$force_no_lex_o" = "yes" ; then
1909 lex_use_o="no"
1910else
1911$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1912if test "$?" = "0" ; then
1913 lex_use_o="yes"
1914else
1915 lex_use_o="no"
1916fi
1917fi
1918fi
1919
1920print_config "lex/yacc for arithmetic" "$arith"
1921
1922##########################################
1923# Check whether we have setmntent/getmntent
1924if test "$getmntent" != "yes" ; then
1925 getmntent="no"
1926fi
1927cat > $TMPC << EOF
1928#include <stdio.h>
1929#include <mntent.h>
1930int main(int argc, char **argv)
1931{
1932 FILE *mtab = setmntent(NULL, "r");
1933 struct mntent *mnt = getmntent(mtab);
1934 endmntent(mtab);
1935 return 0;
1936}
1937EOF
1938if compile_prog "" "" "getmntent"; then
1939 getmntent="yes"
1940fi
1941print_config "getmntent" "$getmntent"
1942
1943##########################################
1944# Check whether we have getmntinfo
1945# These are originally added for BSDs, but may also work
1946# on other operating systems with getmntinfo(3).
1947
1948# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1949# Note that NetBSD needs -Werror to catch warning as error.
1950if test "$getmntinfo" != "yes" ; then
1951 getmntinfo="no"
1952fi
1953cat > $TMPC << EOF
1954#include <stdio.h>
1955#include <sys/param.h>
1956#include <sys/mount.h>
1957int main(int argc, char **argv)
1958{
1959 struct statfs *st;
1960 return getmntinfo(&st, MNT_NOWAIT);
1961}
1962EOF
1963if compile_prog "-Werror" "" "getmntinfo"; then
1964 getmntinfo="yes"
1965fi
1966print_config "getmntinfo" "$getmntinfo"
1967
1968# getmntinfo(3) for NetBSD.
1969if test "$getmntinfo_statvfs" != "yes" ; then
1970 getmntinfo_statvfs="no"
1971fi
1972cat > $TMPC << EOF
1973#include <stdio.h>
1974#include <sys/statvfs.h>
1975int main(int argc, char **argv)
1976{
1977 struct statvfs *st;
1978 return getmntinfo(&st, MNT_NOWAIT);
1979}
1980EOF
1981# Skip the test if the one with statfs arg is detected.
1982if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1983 getmntinfo_statvfs="yes"
1984 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
1985fi
1986
1987##########################################
1988# Check whether we have _Static_assert
1989if test "$static_assert" != "yes" ; then
1990 static_assert="no"
1991fi
1992cat > $TMPC << EOF
1993#include <assert.h>
1994#include <stdlib.h>
1995#include <stddef.h>
1996
1997struct foo {
1998 int a, b;
1999};
2000
2001int main(int argc, char **argv)
2002{
2003 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2004 return 0 ;
2005}
2006EOF
2007if compile_prog "" "" "static_assert"; then
2008 static_assert="yes"
2009fi
2010print_config "Static Assert" "$static_assert"
2011
2012##########################################
2013# Check whether we have bool / stdbool.h
2014if test "$have_bool" != "yes" ; then
2015 have_bool="no"
2016fi
2017cat > $TMPC << EOF
2018#include <stdbool.h>
2019int main(int argc, char **argv)
2020{
2021 bool var = true;
2022 return var != false;
2023}
2024EOF
2025if compile_prog "" "" "bool"; then
2026 have_bool="yes"
2027fi
2028print_config "bool" "$have_bool"
2029
2030##########################################
2031# Check whether we have strndup()
2032strndup="no"
2033cat > $TMPC << EOF
2034#include <string.h>
2035#include <stdlib.h>
2036int main(int argc, char **argv)
2037{
2038 char *res = strndup("test string", 8);
2039
2040 free(res);
2041 return 0;
2042}
2043EOF
2044if compile_prog "" "" "strndup"; then
2045 strndup="yes"
2046fi
2047print_config "strndup" "$strndup"
2048
2049##########################################
2050# check march=armv8-a+crc+crypto
2051if test "$march_armv8_a_crc_crypto" != "yes" ; then
2052 march_armv8_a_crc_crypto="no"
2053fi
2054if test "$cpu" = "arm64" ; then
2055 cat > $TMPC <<EOF
2056#include <sys/auxv.h>
2057#include <arm_acle.h>
2058#include <arm_neon.h>
2059
2060int main(void)
2061{
2062 return 0;
2063}
2064EOF
2065 if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
2066 march_armv8_a_crc_crypto="yes"
2067 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
2068 fi
2069fi
2070print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2071
2072##########################################
2073# cuda probe
2074if test "$cuda" != "yes" ; then
2075 cuda="no"
2076fi
2077cat > $TMPC << EOF
2078#include <cuda.h>
2079int main(int argc, char **argv)
2080{
2081 return cuInit(0);
2082}
2083EOF
2084if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
2085 cuda="yes"
2086 LIBS="-lcuda $LIBS"
2087fi
2088print_config "cuda" "$cuda"
2089
2090##########################################
2091# mkdir() probe. mingw apparently has a one-argument mkdir :/
2092mkdir_two="no"
2093cat > $TMPC << EOF
2094#include <sys/stat.h>
2095#include <sys/types.h>
2096int main(int argc, char **argv)
2097{
2098 return mkdir("/tmp/bla", 0600);
2099}
2100EOF
2101if compile_prog "" "" "mkdir(a, b)"; then
2102 mkdir_two="yes"
2103fi
2104print_config "mkdir(a, b)" "$mkdir_two"
2105
2106##########################################
2107# check for cc -march=native
2108build_native="no"
2109cat > $TMPC << EOF
2110int main(int argc, char **argv)
2111{
2112 return 0;
2113}
2114EOF
2115if test "$disable_native" = "no" && compile_prog "-march=native" "" "march=native"; then
2116 build_native="yes"
2117fi
2118print_config "Build march=native" "$build_native"
2119
2120#############################################################################
2121
2122if test "$wordsize" = "64" ; then
2123 output_sym "CONFIG_64BIT"
2124elif test "$wordsize" = "32" ; then
2125 output_sym "CONFIG_32BIT"
2126else
2127 fatal "Unknown wordsize!"
2128fi
2129if test "$bigendian" = "yes" ; then
2130 output_sym "CONFIG_BIG_ENDIAN"
2131else
2132 output_sym "CONFIG_LITTLE_ENDIAN"
2133fi
2134if test "$zlib" = "yes" ; then
2135 output_sym "CONFIG_ZLIB"
2136fi
2137if test "$libaio" = "yes" ; then
2138 output_sym "CONFIG_LIBAIO"
2139fi
2140if test "$posix_aio" = "yes" ; then
2141 output_sym "CONFIG_POSIXAIO"
2142fi
2143if test "$posix_aio_fsync" = "yes" ; then
2144 output_sym "CONFIG_POSIXAIO_FSYNC"
2145fi
2146if test "$posix_pshared" = "yes" ; then
2147 output_sym "CONFIG_PSHARED"
2148fi
2149if test "$linux_fallocate" = "yes" ; then
2150 output_sym "CONFIG_LINUX_FALLOCATE"
2151fi
2152if test "$posix_fallocate" = "yes" ; then
2153 output_sym "CONFIG_POSIX_FALLOCATE"
2154fi
2155if test "$fdatasync" = "yes" ; then
2156 output_sym "CONFIG_FDATASYNC"
2157fi
2158if test "$sync_file_range" = "yes" ; then
2159 output_sym "CONFIG_SYNC_FILE_RANGE"
2160fi
2161if test "$sfaa" = "yes" ; then
2162 output_sym "CONFIG_SFAA"
2163fi
2164if test "$sync_sync" = "yes" ; then
2165 output_sym "CONFIG_SYNC_SYNC"
2166fi
2167if test "$cmp_swap" = "yes" ; then
2168 output_sym "CONFIG_CMP_SWAP"
2169fi
2170if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2171 output_sym "CONFIG_RDMA"
2172fi
2173if test "$clock_gettime" = "yes" ; then
2174 output_sym "CONFIG_CLOCK_GETTIME"
2175fi
2176if test "$clock_monotonic" = "yes" ; then
2177 output_sym "CONFIG_CLOCK_MONOTONIC"
2178fi
2179if test "$clock_monotonic_raw" = "yes" ; then
2180 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2181fi
2182if test "$clock_monotonic_precise" = "yes" ; then
2183 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2184fi
2185if test "$clockid_t" = "yes"; then
2186 output_sym "CONFIG_CLOCKID_T"
2187fi
2188if test "$gettimeofday" = "yes" ; then
2189 output_sym "CONFIG_GETTIMEOFDAY"
2190fi
2191if test "$posix_fadvise" = "yes" ; then
2192 output_sym "CONFIG_POSIX_FADVISE"
2193fi
2194if test "$linux_3arg_affinity" = "yes" ; then
2195 output_sym "CONFIG_3ARG_AFFINITY"
2196elif test "$linux_2arg_affinity" = "yes" ; then
2197 output_sym "CONFIG_2ARG_AFFINITY"
2198fi
2199if test "$strsep" = "yes" ; then
2200 output_sym "CONFIG_STRSEP"
2201fi
2202if test "$strcasestr" = "yes" ; then
2203 output_sym "CONFIG_STRCASESTR"
2204fi
2205if test "$strlcat" = "yes" ; then
2206 output_sym "CONFIG_STRLCAT"
2207fi
2208if test "$getopt_long_only" = "yes" ; then
2209 output_sym "CONFIG_GETOPT_LONG_ONLY"
2210fi
2211if test "$inet_aton" = "yes" ; then
2212 output_sym "CONFIG_INET_ATON"
2213fi
2214if test "$socklen_t" = "yes" ; then
2215 output_sym "CONFIG_SOCKLEN_T"
2216fi
2217if test "$ext4_me" = "yes" ; then
2218 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2219fi
2220if test "$linux_splice" = "yes" ; then
2221 output_sym "CONFIG_LINUX_SPLICE"
2222fi
2223if test "$guasi" = "yes" ; then
2224 output_sym "CONFIG_GUASI"
2225fi
2226if test "$fusion_aw" = "yes" ; then
2227 output_sym "CONFIG_FUSION_AW"
2228fi
2229if test "$libnuma_v2" = "yes" ; then
2230 output_sym "CONFIG_LIBNUMA"
2231fi
2232if test "$solaris_aio" = "yes" ; then
2233 output_sym "CONFIG_SOLARISAIO"
2234fi
2235if test "$tls_thread" = "yes" ; then
2236 output_sym "CONFIG_TLS_THREAD"
2237fi
2238if test "$rusage_thread" = "yes" ; then
2239 output_sym "CONFIG_RUSAGE_THREAD"
2240fi
2241if test "$gfio" = "yes" ; then
2242 output_sym "CONFIG_GFIO"
2243fi
2244if test "$esx" = "yes" ; then
2245 output_sym "CONFIG_ESX"
2246 output_sym "CONFIG_NO_SHM"
2247fi
2248if test "$sched_idle" = "yes" ; then
2249 output_sym "CONFIG_SCHED_IDLE"
2250fi
2251if test "$tcp_nodelay" = "yes" ; then
2252 output_sym "CONFIG_TCP_NODELAY"
2253fi
2254if test "$window_size" = "yes" ; then
2255 output_sym "CONFIG_NET_WINDOWSIZE"
2256fi
2257if test "$mss" = "yes" ; then
2258 output_sym "CONFIG_NET_MSS"
2259fi
2260if test "$rlimit_memlock" = "yes" ; then
2261 output_sym "CONFIG_RLIMIT_MEMLOCK"
2262fi
2263if test "$pwritev" = "yes" ; then
2264 output_sym "CONFIG_PWRITEV"
2265fi
2266if test "$pwritev2" = "yes" ; then
2267 output_sym "CONFIG_PWRITEV2"
2268fi
2269if test "$ipv6" = "yes" ; then
2270 output_sym "CONFIG_IPV6"
2271fi
2272if test "$rados" = "yes" ; then
2273 output_sym "CONFIG_RADOS"
2274fi
2275if test "$rbd" = "yes" ; then
2276 output_sym "CONFIG_RBD"
2277fi
2278if test "$rbd_poll" = "yes" ; then
2279 output_sym "CONFIG_RBD_POLL"
2280fi
2281if test "$rbd_inval" = "yes" ; then
2282 output_sym "CONFIG_RBD_INVAL"
2283fi
2284if test "$setvbuf" = "yes" ; then
2285 output_sym "CONFIG_SETVBUF"
2286fi
2287if test "$s390_z196_facilities" = "yes" ; then
2288 output_sym "CONFIG_S390_Z196_FACILITIES"
2289 CFLAGS="$CFLAGS -march=z9-109"
2290fi
2291if test "$gfapi" = "yes" ; then
2292 output_sym "CONFIG_GFAPI"
2293fi
2294if test "$gf_fadvise" = "yes" ; then
2295 output_sym "CONFIG_GF_FADVISE"
2296fi
2297if test "$gf_trim" = "yes" ; then
2298 output_sym "CONFIG_GF_TRIM"
2299fi
2300if test "$libhdfs" = "yes" ; then
2301 output_sym "CONFIG_LIBHDFS"
2302 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2303 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2304 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2305 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2306 fi
2307if test "$mtd" = "yes" ; then
2308 output_sym "CONFIG_MTD"
2309fi
2310if test "$pmemblk" = "yes" ; then
2311 output_sym "CONFIG_PMEMBLK"
2312fi
2313if test "$devdax" = "yes" ; then
2314 output_sym "CONFIG_LINUX_DEVDAX"
2315fi
2316if test "$pmem" = "yes" ; then
2317 output_sym "CONFIG_LIBPMEM"
2318fi
2319if test "$arith" = "yes" ; then
2320 output_sym "CONFIG_ARITHMETIC"
2321 if test "$yacc_is_bison" = "yes" ; then
2322 echo "YACC=$YACC -y" >> $config_host_mak
2323 else
2324 echo "YACC=$YACC" >> $config_host_mak
2325 fi
2326 if test "$lex_use_o" = "yes" ; then
2327 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2328 fi
2329fi
2330if test "$getmntent" = "yes" ; then
2331 output_sym "CONFIG_GETMNTENT"
2332fi
2333if test "$getmntinfo" = "yes" ; then
2334 output_sym "CONFIG_GETMNTINFO"
2335fi
2336if test "$getmntinfo_statvfs" = "yes" ; then
2337 output_sym "CONFIG_GETMNTINFO_STATVFS"
2338fi
2339if test "$static_assert" = "yes" ; then
2340 output_sym "CONFIG_STATIC_ASSERT"
2341fi
2342if test "$have_bool" = "yes" ; then
2343 output_sym "CONFIG_HAVE_BOOL"
2344fi
2345if test "$strndup" = "yes" ; then
2346 output_sym "CONFIG_HAVE_STRNDUP"
2347fi
2348if test "$disable_opt" = "yes" ; then
2349 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2350fi
2351if test "$zlib" = "no" ; then
2352 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2353 if test "$build_static" = "yes"; then
2354 echo "Note that some distros have separate packages for static libraries."
2355 fi
2356fi
2357if test "$cuda" = "yes" ; then
2358 output_sym "CONFIG_CUDA"
2359fi
2360if test "$mkdir_two" = "yes" ; then
2361 output_sym "CONFIG_HAVE_MKDIR_TWO"
2362fi
2363if test "$build_native" = "yes" ; then
2364 output_sym "CONFIG_BUILD_NATIVE"
2365fi
2366
2367echo "LIBS+=$LIBS" >> $config_host_mak
2368echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
2369echo "CFLAGS+=$CFLAGS" >> $config_host_mak
2370echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
2371echo "CC=$cc" >> $config_host_mak
2372echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
2373echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2374
2375if [ `dirname $0` != "." -a ! -e Makefile ]; then
2376 cat > Makefile <<EOF
2377SRCDIR:=`dirname $0`
2378include \$(SRCDIR)/Makefile
2379EOF
2380fi