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