3 # Fio configure script. Heavily influenced by the manual qemu configure
4 # script. Sad this this is easier than autoconf and enemies.
7 # set temporary file name
8 if test ! -z "$TMPDIR" ; then
10 elif test ! -z "$TEMPDIR" ; then
16 TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
17 TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
18 TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
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>
22 trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
26 config_host_mak="config-host.mak"
27 config_host_h="config-host.h"
29 rm -rf $config_host_mak
34 echo "Configure failed, check config.log and/or the above output"
35 rm -rf $config_host_mak
41 CFLAGS="-D_GNU_SOURCE -include config-host.h"
44 # Print a helpful header at the top of config.log
45 echo "# FIO configure log $(date)" >> config.log
46 printf "# Configured with:" >> config.log
47 printf " '%s'" "$0" "$@" >> config.log
49 echo "#" >> config.log
51 # Print configure header at the top of $config_host_h
52 echo "/*" > $config_host_h
53 echo " * Automatically generated by configure - do not modify" >> $config_host_h
54 printf " * Configured with:" >> $config_host_h
55 printf " * '%s'" "$0" "$@" >> $config_host_h
56 echo "" >> $config_host_h
57 echo " */" >> $config_host_h
60 # Run the compiler, capturing its output to the log.
61 echo $cc "$@" >> config.log
62 $cc "$@" >> config.log 2>&1 || return $?
63 # Test passed. If this is an --enable-werror build, rerun
64 # the test with -Werror and bail out if it fails. This
65 # makes warning-generating-errors in configure test code
66 # obvious to developers.
67 if test "$werror" != "yes"; then
70 # Don't bother rerunning the compile if we were already using -Werror
76 echo $cc -Werror "$@" >> config.log
77 $cc -Werror "$@" >> config.log 2>&1 && return $?
78 echo "ERROR: configure test passed without -Werror but failed with -Werror."
79 echo "This is probably a bug in the configure script. The failing command"
80 echo "will be at the bottom of config.log."
81 fatal "You can run configure with --disable-werror to bypass this check."
85 do_cc $CFLAGS -c -o $TMPO $TMPC
90 local_ldflags="$2 $LIBS"
91 echo "Compiling test case $3" >> config.log
92 do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
100 echo "ERROR: User requested feature $feature"
101 if test ! -z "$packages" ; then
102 echo "ERROR: That feature needs $packages installed"
104 echo "ERROR: configure was not able to find it"
109 type "$1" >/dev/null 2>&1
115 #error $1 not defined
126 echo "$1=y" >> $config_host_mak
127 echo "#define $1" >> $config_host_h
141 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
143 --cpu=*) cpu="$optarg"
145 # esx is cross compiled and cannot be detect through simple uname calls
151 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
153 --build-32bit-win) build_32bit_win="yes"
155 --build-static) build_static="yes"
160 --disable-numa) disable_numa="yes"
162 --disable-rbd) disable_rbd="yes"
164 --disable-gfapi) disable_gfapi="yes"
166 --enable-libhdfs) libhdfs="yes"
172 echo "Bad option $opt"
178 if test "$show_help" = "yes" ; then
179 echo "--cpu= Specify target CPU if auto-detect fails"
180 echo "--cc= Specify compiler to use"
181 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
182 echo "--build-32bit-win Enable 32-bit build on Windows"
183 echo "--build-static Build a static fio"
184 echo "--esx Configure build options for esx"
185 echo "--enable-gfio Enable building of gtk gfio"
186 echo "--disable-numa Disable libnuma even if found"
187 echo "--enable-libhdfs Enable hdfs support"
191 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
192 cc="${CC-${cross_prefix}gcc}"
194 if check_define __ANDROID__ ; then
196 elif check_define __linux__ ; then
198 elif check_define __OpenBSD__ ; then
200 elif check_define __sun__ ; then
202 CFLAGS="$CFLAGS -D_REENTRANT"
203 elif check_define _WIN32 ; then
209 echo "# Automatically generated by configure - do not modify" > $config_host_mak
210 printf "# Configured with:" >> $config_host_mak
211 printf " '%s'" "$0" "$@" >> $config_host_mak
212 echo >> $config_host_mak
213 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
215 # Some host OSes need non-standard checks for which CPU to use.
216 # Note that these checks are broken for cross-compilation: if you're
217 # cross-compiling to one of these OSes then you'll need to specify
218 # the correct CPU with the --cpu option.
221 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
222 # we can run 64-bit userspace code.
223 # If the user didn't specify a CPU explicitly and the kernel says this is
224 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
226 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
231 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
232 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
235 LIBS="-lnsl -lsocket"
238 echo "Forcing known good options on Windows"
239 if test -z "$CC" ; then
240 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
241 CC="i686-w64-mingw32-gcc"
243 CC="x86_64-w64-mingw32-gcc"
246 output_sym "CONFIG_LITTLE_ENDIAN"
247 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
248 output_sym "CONFIG_32BIT"
250 output_sym "CONFIG_64BIT_LLP64"
252 output_sym "CONFIG_FADVISE"
253 output_sym "CONFIG_SOCKLEN_T"
254 output_sym "CONFIG_FADVISE"
255 output_sym "CONFIG_SFAA"
256 output_sym "CONFIG_RUSAGE_THREAD"
257 output_sym "CONFIG_WINDOWSAIO"
258 output_sym "CONFIG_FDATASYNC"
259 output_sym "CONFIG_CLOCK_MONOTONIC"
260 output_sym "CONFIG_GETTIMEOFDAY"
261 output_sym "CONFIG_CLOCK_GETTIME"
262 output_sym "CONFIG_SCHED_IDLE"
263 output_sym "CONFIG_TCP_NODELAY"
264 output_sym "CONFIG_TLS_THREAD"
265 output_sym "CONFIG_IPV6"
266 echo "CC=$CC" >> $config_host_mak
267 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
272 if test ! -z "$cpu" ; then
273 # command line argument
275 elif check_define __i386__ ; then
277 elif check_define __x86_64__ ; then
279 elif check_define __sparc__ ; then
280 if check_define __arch64__ ; then
285 elif check_define _ARCH_PPC ; then
286 if check_define _ARCH_PPC64 ; then
291 elif check_define __mips__ ; then
293 elif check_define __ia64__ ; then
295 elif check_define __s390__ ; then
296 if check_define __s390x__ ; then
301 elif check_define __arm__ ; then
303 elif check_define __hppa__ ; then
309 # Normalise host CPU name and set ARCH.
311 ia64|ppc|ppc64|s390|s390x|sparc64)
314 i386|i486|i586|i686|i86pc|BePC)
323 hppa|parisc|parisc64)
337 if test -z "$CC" ; then
338 if test "$targetos" = "FreeBSD"; then
347 cc="${CC-${cross_prefix}gcc}"
349 ##########################################
350 # check cross compile
359 if compile_prog "" "" "cross"; then
360 $TMPE 2>/dev/null || cross_compile="yes"
362 fatal "compile test failed"
365 ##########################################
368 if test "$cross_compile" = "no" ; then
370 #include <inttypes.h>
373 volatile uint32_t i=0x01234567;
374 return (*((uint8_t*)(&i))) == 0x67;
377 if compile_prog "" "" "endian"; then
378 $TMPE && bigendian="yes"
381 # If we're cross compiling, try our best to work it out and rely on the
382 # run-time check to fail if we get it wrong.
387 #if __BYTE_ORDER != __BIG_ENDIAN
388 # error "Unknown endianness"
392 compile_prog "" "" "endian" && bigendian="yes"
393 check_define "__ARMEB__" && bigendian="yes"
394 check_define "__MIPSEB__" && bigendian="yes"
398 echo "Operating system $targetos"
400 echo "Big endian $bigendian"
402 echo "Cross compile $cross_compile"
405 ##########################################
406 # See if we need to build a static build
407 if test "$build_static" = "yes" ; then
408 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
409 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
413 echo "Static build $build_static"
415 ##########################################
420 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
423 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
427 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
429 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
432 fatal "Unknown wordsize"
434 echo "Wordsize $wordsize"
436 ##########################################
444 if (inflateInit(&stream) != Z_OK)
449 if compile_prog "" "-lz" "zlib" ; then
455 ##########################################
467 if compile_prog "" "-laio" "libaio" ; then
471 if test "$libaio" = "yes" ; then
472 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
476 echo "Linux AIO support $libaio"
478 ##########################################
491 if compile_prog "" "" "posixaio" ; then
493 elif compile_prog "" "-lrt" "posixaio"; then
498 echo "POSIX AIO support $posix_aio"
499 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
501 ##########################################
502 # posix aio fsync probe
504 if test "$posix_aio" = "yes" ; then
511 return aio_fsync(O_SYNC, &cb);
515 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
519 echo "POSIX AIO fsync $posix_aio_fsync"
521 ##########################################
525 #include <sys/types.h>
526 #include <sys/asynch.h>
531 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
535 if compile_prog "" "-laio" "solarisaio" ; then
539 echo "Solaris AIO support $solaris_aio"
541 ##########################################
542 # __sync_fetch_and_and test
545 static int sfaa(int *ptr)
547 return __sync_fetch_and_add(ptr, 0);
550 int main(int argc, char **argv)
557 if compile_prog "" "" "__sync_fetch_and_add()" ; then
560 echo "__sync_fetch_and_add $sfaa"
562 ##########################################
567 #include <infiniband/arch.h>
568 int main(int argc, char **argv)
570 struct ibv_pd *pd = ibv_alloc_pd(NULL);
574 if compile_prog "" "-libverbs" "libverbs" ; then
576 LIBS="-libverbs $LIBS"
578 echo "libverbs $libverbs"
580 ##########################################
585 #include <rdma/rdma_cma.h>
586 int main(int argc, char **argv)
588 rdma_destroy_qp(NULL);
592 if compile_prog "" "-lrdmacm" "rdma"; then
594 LIBS="-lrdmacm $LIBS"
596 echo "rdmacm $rdmacm"
598 ##########################################
599 # Linux fallocate probe
604 #include <linux/falloc.h>
605 int main(int argc, char **argv)
607 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
611 if compile_prog "" "" "linux_fallocate"; then
612 linux_fallocate="yes"
614 echo "Linux fallocate $linux_fallocate"
616 ##########################################
617 # POSIX fadvise probe
622 int main(int argc, char **argv)
624 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
628 if compile_prog "" "" "posix_fadvise"; then
631 echo "POSIX fadvise $posix_fadvise"
633 ##########################################
634 # POSIX fallocate probe
639 int main(int argc, char **argv)
641 int r = posix_fallocate(0, 0, 1024);
645 if compile_prog "" "" "posix_fallocate"; then
646 posix_fallocate="yes"
648 echo "POSIX fallocate $posix_fallocate"
650 ##########################################
651 # sched_set/getaffinity 2 or 3 argument test
652 linux_2arg_affinity="no"
653 linux_3arg_affinity="no"
656 int main(int argc, char **argv)
659 return sched_setaffinity(0, sizeof(mask), &mask);
662 if compile_prog "" "" "sched_setaffinity(,,)"; then
663 linux_3arg_affinity="yes"
667 int main(int argc, char **argv)
670 return sched_setaffinity(0, &mask);
673 if compile_prog "" "" "sched_setaffinity(,)"; then
674 linux_2arg_affinity="yes"
677 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
678 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
680 ##########################################
681 # clock_gettime probe
686 int main(int argc, char **argv)
688 return clock_gettime(0, NULL);
691 if compile_prog "" "" "clock_gettime"; then
693 elif compile_prog "" "-lrt" "clock_gettime"; then
697 echo "clock_gettime $clock_gettime"
699 ##########################################
700 # CLOCK_MONOTONIC probe
702 if test "$clock_gettime" = "yes" ; then
706 int main(int argc, char **argv)
708 return clock_gettime(CLOCK_MONOTONIC, NULL);
711 if compile_prog "" "$LIBS" "clock monotonic"; then
712 clock_monotonic="yes"
715 echo "CLOCK_MONOTONIC $clock_monotonic"
717 ##########################################
718 # CLOCK_MONOTONIC_PRECISE probe
719 clock_monotonic_precise="no"
720 if test "$clock_gettime" = "yes" ; then
724 int main(int argc, char **argv)
726 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
729 if compile_prog "" "$LIBS" "clock monotonic precise"; then
730 clock_monotonic_precise="yes"
733 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
735 ##########################################
736 # gettimeofday() probe
739 #include <sys/time.h>
741 int main(int argc, char **argv)
744 return gettimeofday(&tv, NULL);
747 if compile_prog "" "" "gettimeofday"; then
750 echo "gettimeofday $gettimeofday"
752 ##########################################
758 int main(int argc, char **argv)
763 if compile_prog "" "" "fdatasync"; then
766 echo "fdatasync $fdatasync"
768 ##########################################
769 # sync_file_range() probe
775 #include <linux/fs.h>
776 int main(int argc, char **argv)
778 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
779 SYNC_FILE_RANGE_WAIT_AFTER;
780 return sync_file_range(0, 0, 0, flags);
783 if compile_prog "" "" "sync_file_range"; then
784 sync_file_range="yes"
786 echo "sync_file_range $sync_file_range"
788 ##########################################
789 # ext4 move extent probe
793 #include <sys/ioctl.h>
794 int main(int argc, char **argv)
796 struct move_extent me;
797 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
800 if compile_prog "" "" "ext4 move extent" ; then
802 elif test $targetos = "Linux" ; then
803 # On Linux, just default to it on and let it error at runtime if we really
804 # don't have it. None of my updated systems have it defined, but it does
805 # work. Takes a while to bubble back.
808 echo "EXT4 move extent $ext4_me"
810 ##########################################
816 int main(int argc, char **argv)
818 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
821 if compile_prog "" "" "linux splice"; then
824 echo "Linux splice(2) $linux_splice"
826 ##########################################
831 #include <guasi_syscalls.h>
832 int main(int argc, char **argv)
834 guasi_t ctx = guasi_create(0, 0, 0);
838 if compile_prog "" "" "guasi"; then
843 ##########################################
847 #include <nvm/nvm_primitives.h>
848 int main(int argc, char **argv)
850 nvm_version_t ver_info;
853 handle = nvm_get_handle(0, &ver_info);
854 return nvm_atomic_write(handle, 0, 0, 0);
857 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then
858 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS"
861 echo "Fusion-io atomic engine $fusion_aw"
863 ##########################################
868 int main(int argc, char **argv)
870 return numa_available();
873 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
877 echo "libnuma $libnuma"
879 ##########################################
880 # libnuma 2.x version API
881 if test "$libnuma" = "yes" ; then
885 int main(int argc, char **argv)
887 struct bitmask *mask = numa_parse_nodestring(NULL);
891 if compile_prog "" "" "libnuma api"; then
894 echo "libnuma v2 $libnuma_v2"
897 ##########################################
902 int main(int argc, char **argv)
908 if compile_prog "" "" "strsep"; then
911 echo "strsep $strsep"
913 ##########################################
918 int main(int argc, char **argv)
920 return strcasestr(argv[0], argv[1]) != NULL;
923 if compile_prog "" "" "strcasestr"; then
926 echo "strcasestr $strcasestr"
928 ##########################################
929 # getopt_long_only() probe
930 getopt_long_only="no"
935 int main(int argc, char **argv)
937 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
941 if compile_prog "" "" "getopt_long_only"; then
942 getopt_long_only="yes"
944 echo "getopt_long_only() $getopt_long_only"
946 ##########################################
950 #include <sys/socket.h>
951 #include <arpa/inet.h>
953 int main(int argc, char **argv)
956 return inet_aton(NULL, &in);
959 if compile_prog "" "" "inet_aton"; then
962 echo "inet_aton $inet_aton"
964 ##########################################
968 #include <sys/socket.h>
969 int main(int argc, char **argv)
975 if compile_prog "" "" "socklen_t"; then
978 echo "socklen_t $socklen_t"
980 ##########################################
981 # Whether or not __thread is supported for TLS
985 static __thread int ret;
986 int main(int argc, char **argv)
991 if compile_prog "" "" "__thread"; then
994 echo "__thread $tls_thread"
996 ##########################################
997 # Check if we have required gtk/glib support for gfio
999 if test "$gfio_check" = "yes" ; then
1003 #include <gtk/gtk.h>
1006 gdk_threads_enter();
1007 gdk_threads_leave();
1009 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1012 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1013 ORG_LDFLAGS=$LDFLAGS
1014 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1015 if test "$?" != "0" ; then
1016 echo "configure: gtk and gthread not found"
1019 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1020 if test "$?" != "0" ; then
1021 echo "configure: gtk and gthread not found"
1024 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1026 if test "$r" != "0" ; then
1028 GFIO_LIBS="$LIBS $GTK_LIBS"
1029 CFLAGS="$CFLAGS $GTK_CFLAGS"
1031 echo "GTK found, but need version 2.18 or higher"
1035 echo "Please install gtk and gdk libraries"
1038 LDFLAGS=$ORG_LDFLAGS
1041 if test "$gfio_check" = "yes" ; then
1042 echo "gtk 2.18 or higher $gfio"
1045 # Check whether we have getrusage(RUSAGE_THREAD)
1048 #include <sys/time.h>
1049 #include <sys/resource.h>
1050 int main(int argc, char **argv)
1053 getrusage(RUSAGE_THREAD, &ru);
1057 if compile_prog "" "" "RUSAGE_THREAD"; then
1060 echo "RUSAGE_THREAD $rusage_thread"
1062 ##########################################
1063 # Check whether we have SCHED_IDLE
1067 int main(int argc, char **argv)
1069 struct sched_param p;
1070 return sched_setscheduler(0, SCHED_IDLE, &p);
1073 if compile_prog "" "" "SCHED_IDLE"; then
1076 echo "SCHED_IDLE $sched_idle"
1078 ##########################################
1079 # Check whether we have TCP_NODELAY
1083 #include <sys/types.h>
1084 #include <sys/socket.h>
1085 #include <netinet/tcp.h>
1086 int main(int argc, char **argv)
1088 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1091 if compile_prog "" "" "TCP_NODELAY"; then
1094 echo "TCP_NODELAY $tcp_nodelay"
1096 ##########################################
1097 # Check whether we have SO_SNDBUF
1101 #include <sys/types.h>
1102 #include <sys/socket.h>
1103 #include <netinet/tcp.h>
1104 int main(int argc, char **argv)
1106 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1107 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1110 if compile_prog "" "" "SO_SNDBUF"; then
1113 echo "Net engine window_size $window_size"
1115 ##########################################
1116 # Check whether we have TCP_MAXSEG
1120 #include <sys/types.h>
1121 #include <sys/socket.h>
1122 #include <netinet/tcp.h>
1123 #include <arpa/inet.h>
1124 #include <netinet/in.h>
1125 int main(int argc, char **argv)
1127 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1130 if compile_prog "" "" "TCP_MAXSEG"; then
1133 echo "TCP_MAXSEG $mss"
1135 ##########################################
1136 # Check whether we have RLIMIT_MEMLOCK
1139 #include <sys/time.h>
1140 #include <sys/resource.h>
1141 int main(int argc, char **argv)
1144 return getrlimit(RLIMIT_MEMLOCK, &rl);
1147 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1148 rlimit_memlock="yes"
1150 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1152 ##########################################
1153 # Check whether we have pwritev/preadv
1157 #include <sys/uio.h>
1158 int main(int argc, char **argv)
1160 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1163 if compile_prog "" "" "pwritev"; then
1166 echo "pwritev/preadv $pwritev"
1168 ##########################################
1169 # Check whether we have the required functions for ipv6
1172 #include <sys/types.h>
1173 #include <sys/socket.h>
1174 #include <netinet/in.h>
1177 int main(int argc, char **argv)
1179 struct addrinfo hints;
1180 struct in6_addr addr;
1183 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1185 printf("%s\n", gai_strerror(ret));
1190 if compile_prog "" "" "ipv6"; then
1193 echo "IPv6 helpers $ipv6"
1195 ##########################################
1199 #include <rbd/librbd.h>
1201 int main(int argc, char **argv)
1205 rados_ioctx_t io_ctx;
1206 const char pool[] = "rbd";
1208 int major, minor, extra;
1209 rbd_version(&major, &minor, &extra);
1211 rados_ioctx_create(cluster, pool, &io_ctx);
1215 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1216 LIBS="-lrbd -lrados $LIBS"
1219 echo "Rados Block Device engine $rbd"
1221 ##########################################
1222 # check for rbd_invaidate_cache()
1224 if test "$rbd" = "yes"; then
1226 #include <rbd/librbd.h>
1228 int main(int argc, char **argv)
1232 return rbd_invalidate_cache(image);
1235 if compile_prog "" "-lrbd -lrados" "rbd"; then
1238 echo "rbd_invalidate_cache $rbd_inval"
1241 ##########################################
1242 # Check whether we have setvbuf
1246 int main(int argc, char **argv)
1250 setvbuf(f, buf, _IOFBF, sizeof(buf));
1254 if compile_prog "" "" "setvbuf"; then
1257 echo "setvbuf $setvbuf"
1262 #include <glusterfs/api/glfs.h>
1264 int main(int argc, char **argv)
1267 glfs_t *g = glfs_new("foo");
1272 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1273 LIBS="-lgfapi -lglusterfs $LIBS"
1276 echo "Gluster API engine $gfapi"
1278 ##########################################
1279 # check for gfapi fadvise support
1280 if test "$gfapi" = "yes" ; then
1283 #include <glusterfs/api/glfs.h>
1285 int main(int argc, char **argv)
1288 int ret = glfs_fadvise(fd, 0, 0, 1);
1293 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1296 echo "Gluster API use fadvise $gf_fadvise"
1299 ##########################################
1300 # check for gfapi trim support
1302 if test "$gfapi" = "yes" ; then
1304 #include <glusterfs/api/glfs.h>
1306 int main(int argc, char **argv)
1308 return glfs_discard_async(NULL, 0, 0);
1311 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1314 echo "Gluster API trim support $gf_trim"
1317 ##########################################
1318 # Check if we support stckf on s390
1319 s390_z196_facilities="no"
1321 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1322 int main(int argc, char **argv)
1324 /* We want just 1 double word to be returned. */
1325 register unsigned long reg0 asm("0") = 0;
1326 unsigned long stfle_bits;
1327 asm volatile(".machine push" "\n\t"
1328 ".machine \"z9-109\"" "\n\t"
1331 : "=QS" (stfle_bits), "+d" (reg0)
1334 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1340 if compile_prog "" "" "s390_z196_facilities"; then
1342 if [[ $? -eq 0 ]]; then
1343 s390_z196_facilities="yes"
1346 echo "s390_z196_facilities $s390_z196_facilities"
1348 ##########################################
1349 # Check if we have required environment variables configured for libhdfs
1350 if test "$libhdfs" = "yes" ; then
1352 if test "$JAVA_HOME" = "" ; then
1353 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1356 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1357 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1360 if test "$FIO_LIBHDFS_LIB" = "" ; then
1361 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1364 if test "$hdfs_conf_error" = "1" ; then
1368 echo "HDFS engine $libhdfs"
1370 # Check if we have lex/yacc available
1375 if test "$targetos" != "SunOS" ; then
1376 LEX=$(which lex 2> /dev/null)
1377 if test -x "$LEX" ; then
1380 YACC=$(which bison 2> /dev/null)
1381 if test -x "$YACC" ; then
1385 YACC=$(which yacc 2> /dev/null)
1386 if test -x "$YACC" ; then
1390 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1394 if test "$arith" = "yes" ; then
1396 extern int yywrap(void);
1398 int main(int argc, char **argv)
1404 if compile_prog "" "-ll" "lex"; then
1412 echo "lex/yacc for arithmetic $arith"
1414 #############################################################################
1416 if test "$wordsize" = "64" ; then
1417 output_sym "CONFIG_64BIT"
1418 elif test "$wordsize" = "32" ; then
1419 output_sym "CONFIG_32BIT"
1421 fatal "Unknown wordsize!"
1423 if test "$bigendian" = "yes" ; then
1424 output_sym "CONFIG_BIG_ENDIAN"
1426 output_sym "CONFIG_LITTLE_ENDIAN"
1428 if test "$zlib" = "yes" ; then
1429 output_sym "CONFIG_ZLIB"
1431 if test "$libaio" = "yes" ; then
1432 output_sym "CONFIG_LIBAIO"
1434 if test "$posix_aio" = "yes" ; then
1435 output_sym "CONFIG_POSIXAIO"
1437 if test "$posix_aio_fsync" = "yes" ; then
1438 output_sym "CONFIG_POSIXAIO_FSYNC"
1440 if test "$linux_fallocate" = "yes" ; then
1441 output_sym "CONFIG_LINUX_FALLOCATE"
1443 if test "$posix_fallocate" = "yes" ; then
1444 output_sym "CONFIG_POSIX_FALLOCATE"
1446 if test "$fdatasync" = "yes" ; then
1447 output_sym "CONFIG_FDATASYNC"
1449 if test "$sync_file_range" = "yes" ; then
1450 output_sym "CONFIG_SYNC_FILE_RANGE"
1452 if test "$sfaa" = "yes" ; then
1453 output_sym "CONFIG_SFAA"
1455 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1456 output_sym "CONFIG_RDMA"
1458 if test "$clock_gettime" = "yes" ; then
1459 output_sym "CONFIG_CLOCK_GETTIME"
1461 if test "$clock_monotonic" = "yes" ; then
1462 output_sym "CONFIG_CLOCK_MONOTONIC"
1464 if test "$clock_monotonic_precise" = "yes" ; then
1465 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1467 if test "$gettimeofday" = "yes" ; then
1468 output_sym "CONFIG_GETTIMEOFDAY"
1470 if test "$posix_fadvise" = "yes" ; then
1471 output_sym "CONFIG_POSIX_FADVISE"
1473 if test "$linux_3arg_affinity" = "yes" ; then
1474 output_sym "CONFIG_3ARG_AFFINITY"
1475 elif test "$linux_2arg_affinity" = "yes" ; then
1476 output_sym "CONFIG_2ARG_AFFINITY"
1478 if test "$strsep" = "yes" ; then
1479 output_sym "CONFIG_STRSEP"
1481 if test "$strcasestr" = "yes" ; then
1482 output_sym "CONFIG_STRCASESTR"
1484 if test "$getopt_long_only" = "yes" ; then
1485 output_sym "CONFIG_GETOPT_LONG_ONLY"
1487 if test "$inet_aton" = "yes" ; then
1488 output_sym "CONFIG_INET_ATON"
1490 if test "$socklen_t" = "yes" ; then
1491 output_sym "CONFIG_SOCKLEN_T"
1493 if test "$ext4_me" = "yes" ; then
1494 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1496 if test "$linux_splice" = "yes" ; then
1497 output_sym "CONFIG_LINUX_SPLICE"
1499 if test "$guasi" = "yes" ; then
1500 output_sym "CONFIG_GUASI"
1502 if test "$fusion_aw" = "yes" ; then
1503 output_sym "CONFIG_FUSION_AW"
1505 if test "$libnuma_v2" = "yes" ; then
1506 output_sym "CONFIG_LIBNUMA"
1508 if test "$solaris_aio" = "yes" ; then
1509 output_sym "CONFIG_SOLARISAIO"
1511 if test "$tls_thread" = "yes" ; then
1512 output_sym "CONFIG_TLS_THREAD"
1514 if test "$rusage_thread" = "yes" ; then
1515 output_sym "CONFIG_RUSAGE_THREAD"
1517 if test "$gfio" = "yes" ; then
1518 echo "CONFIG_GFIO=y" >> $config_host_mak
1520 if test "$esx" = "yes" ; then
1521 output_sym "CONFIG_ESX"
1522 output_sym "CONFIG_NO_SHM"
1524 if test "$sched_idle" = "yes" ; then
1525 output_sym "CONFIG_SCHED_IDLE"
1527 if test "$tcp_nodelay" = "yes" ; then
1528 output_sym "CONFIG_TCP_NODELAY"
1530 if test "$window_size" = "yes" ; then
1531 output_sym "CONFIG_NET_WINDOWSIZE"
1533 if test "$mss" = "yes" ; then
1534 output_sym "CONFIG_NET_MSS"
1536 if test "$rlimit_memlock" = "yes" ; then
1537 output_sym "CONFIG_RLIMIT_MEMLOCK"
1539 if test "$pwritev" = "yes" ; then
1540 output_sym "CONFIG_PWRITEV"
1542 if test "$ipv6" = "yes" ; then
1543 output_sym "CONFIG_IPV6"
1545 if test "$rbd" = "yes" ; then
1546 output_sym "CONFIG_RBD"
1548 if test "$rbd_inval" = "yes" ; then
1549 output_sym "CONFIG_RBD_INVAL"
1551 if test "$setvbuf" = "yes" ; then
1552 output_sym "CONFIG_SETVBUF"
1554 if test "$s390_z196_facilities" = "yes" ; then
1555 output_sym "CONFIG_S390_Z196_FACILITIES"
1556 CFLAGS="$CFLAGS -march=z9-109"
1558 if test "$gfapi" = "yes" ; then
1559 output_sym "CONFIG_GFAPI"
1561 if test "$gf_fadvise" = "yes" ; then
1562 output_sym "CONFIG_GF_FADVISE"
1564 if test "$gf_trim" = "yes" ; then
1565 output_sym "CONFIG_GF_TRIM"
1567 if test "$libhdfs" = "yes" ; then
1568 output_sym "CONFIG_LIBHDFS"
1569 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1570 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1571 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1573 if test "$arith" = "yes" ; then
1574 output_sym "CONFIG_ARITHMETIC"
1575 if test "$yacc_is_bison" = "yes" ; then
1576 echo "YACC=$YACC -y" >> $config_host_mak
1578 echo "YACC=$YACC" >> $config_host_mak
1582 if test "$zlib" = "no" ; then
1583 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1586 echo "LIBS+=$LIBS" >> $config_host_mak
1587 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1588 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1589 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1590 echo "CC=$cc" >> $config_host_mak
1591 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak