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
142 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
144 --prefix=*) prefix="$optarg"
146 --cpu=*) cpu="$optarg"
148 # esx is cross compiled and cannot be detect through simple uname calls
154 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
156 --build-32bit-win) build_32bit_win="yes"
158 --build-static) build_static="yes"
163 --disable-numa) disable_numa="yes"
165 --disable-rbd) disable_rbd="yes"
167 --disable-gfapi) disable_gfapi="yes"
169 --enable-libhdfs) libhdfs="yes"
171 --disable-shm) output_sym "CONFIG_NO_SHM"
177 echo "Bad option $opt"
183 if test "$show_help" = "yes" ; then
184 echo "--prefix= Use this directory as installation prefix"
185 echo "--cpu= Specify target CPU if auto-detect fails"
186 echo "--cc= Specify compiler to use"
187 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
188 echo "--build-32bit-win Enable 32-bit build on Windows"
189 echo "--build-static Build a static fio"
190 echo "--esx Configure build options for esx"
191 echo "--enable-gfio Enable building of gtk gfio"
192 echo "--disable-numa Disable libnuma even if found"
193 echo "--enable-libhdfs Enable hdfs support"
197 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
198 cc="${CC-${cross_prefix}gcc}"
200 if check_define __ANDROID__ ; then
202 elif check_define __linux__ ; then
204 elif check_define __OpenBSD__ ; then
206 elif check_define __sun__ ; then
208 CFLAGS="$CFLAGS -D_REENTRANT"
209 elif check_define _WIN32 ; then
215 echo "# Automatically generated by configure - do not modify" > $config_host_mak
216 printf "# Configured with:" >> $config_host_mak
217 printf " '%s'" "$0" "$@" >> $config_host_mak
218 echo >> $config_host_mak
219 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
221 # Some host OSes need non-standard checks for which CPU to use.
222 # Note that these checks are broken for cross-compilation: if you're
223 # cross-compiling to one of these OSes then you'll need to specify
224 # the correct CPU with the --cpu option.
227 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
228 # we can run 64-bit userspace code.
229 # If the user didn't specify a CPU explicitly and the kernel says this is
230 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
232 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
237 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
238 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
241 LIBS="-lnsl -lsocket"
244 echo "Forcing known good options on Windows"
245 if test -z "$CC" ; then
246 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
247 CC="i686-w64-mingw32-gcc"
249 CC="x86_64-w64-mingw32-gcc"
252 output_sym "CONFIG_LITTLE_ENDIAN"
253 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
254 output_sym "CONFIG_32BIT"
256 output_sym "CONFIG_64BIT_LLP64"
258 output_sym "CONFIG_FADVISE"
259 output_sym "CONFIG_SOCKLEN_T"
260 output_sym "CONFIG_FADVISE"
261 output_sym "CONFIG_SFAA"
262 output_sym "CONFIG_RUSAGE_THREAD"
263 output_sym "CONFIG_WINDOWSAIO"
264 output_sym "CONFIG_FDATASYNC"
265 output_sym "CONFIG_CLOCK_MONOTONIC"
266 output_sym "CONFIG_GETTIMEOFDAY"
267 output_sym "CONFIG_CLOCK_GETTIME"
268 output_sym "CONFIG_SCHED_IDLE"
269 output_sym "CONFIG_TCP_NODELAY"
270 output_sym "CONFIG_TLS_THREAD"
271 output_sym "CONFIG_IPV6"
272 echo "CC=$CC" >> $config_host_mak
273 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
278 if test ! -z "$cpu" ; then
279 # command line argument
281 elif check_define __i386__ ; then
283 elif check_define __x86_64__ ; then
285 elif check_define __sparc__ ; then
286 if check_define __arch64__ ; then
291 elif check_define _ARCH_PPC ; then
292 if check_define _ARCH_PPC64 ; then
297 elif check_define __mips__ ; then
299 elif check_define __ia64__ ; then
301 elif check_define __s390__ ; then
302 if check_define __s390x__ ; then
307 elif check_define __arm__ ; then
309 elif check_define __hppa__ ; then
315 # Normalise host CPU name and set ARCH.
317 ia64|ppc|ppc64|s390|s390x|sparc64)
320 i386|i486|i586|i686|i86pc|BePC)
329 hppa|parisc|parisc64)
343 if test -z "$CC" ; then
344 if test "$targetos" = "FreeBSD"; then
353 cc="${CC-${cross_prefix}gcc}"
355 ##########################################
356 # check cross compile
365 if compile_prog "" "" "cross"; then
366 $TMPE 2>/dev/null || cross_compile="yes"
368 fatal "compile test failed"
371 ##########################################
374 if test "$cross_compile" = "no" ; then
376 #include <inttypes.h>
379 volatile uint32_t i=0x01234567;
380 return (*((uint8_t*)(&i))) == 0x67;
383 if compile_prog "" "" "endian"; then
384 $TMPE && bigendian="yes"
387 # If we're cross compiling, try our best to work it out and rely on the
388 # run-time check to fail if we get it wrong.
393 #if __BYTE_ORDER != __BIG_ENDIAN
394 # error "Unknown endianness"
398 compile_prog "" "" "endian" && bigendian="yes"
399 check_define "__ARMEB__" && bigendian="yes"
400 check_define "__MIPSEB__" && bigendian="yes"
404 echo "Operating system $targetos"
406 echo "Big endian $bigendian"
408 echo "Cross compile $cross_compile"
411 ##########################################
412 # See if we need to build a static build
413 if test "$build_static" = "yes" ; then
414 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
415 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
419 echo "Static build $build_static"
421 ##########################################
426 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
429 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
433 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
435 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
438 fatal "Unknown wordsize"
440 echo "Wordsize $wordsize"
442 ##########################################
450 if (inflateInit(&stream) != Z_OK)
455 if compile_prog "" "-lz" "zlib" ; then
461 ##########################################
473 if compile_prog "" "-laio" "libaio" ; then
477 if test "$libaio" = "yes" ; then
478 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
482 echo "Linux AIO support $libaio"
484 ##########################################
497 if compile_prog "" "" "posixaio" ; then
499 elif compile_prog "" "-lrt" "posixaio"; then
504 echo "POSIX AIO support $posix_aio"
505 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
507 ##########################################
508 # posix aio fsync probe
510 if test "$posix_aio" = "yes" ; then
517 return aio_fsync(O_SYNC, &cb);
521 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
525 echo "POSIX AIO fsync $posix_aio_fsync"
527 ##########################################
531 #include <sys/types.h>
532 #include <sys/asynch.h>
537 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
541 if compile_prog "" "-laio" "solarisaio" ; then
545 echo "Solaris AIO support $solaris_aio"
547 ##########################################
548 # __sync_fetch_and_and test
551 static int sfaa(int *ptr)
553 return __sync_fetch_and_add(ptr, 0);
556 int main(int argc, char **argv)
563 if compile_prog "" "" "__sync_fetch_and_add()" ; then
566 echo "__sync_fetch_and_add $sfaa"
568 ##########################################
573 #include <infiniband/arch.h>
574 int main(int argc, char **argv)
576 struct ibv_pd *pd = ibv_alloc_pd(NULL);
580 if compile_prog "" "-libverbs" "libverbs" ; then
582 LIBS="-libverbs $LIBS"
584 echo "libverbs $libverbs"
586 ##########################################
591 #include <rdma/rdma_cma.h>
592 int main(int argc, char **argv)
594 rdma_destroy_qp(NULL);
598 if compile_prog "" "-lrdmacm" "rdma"; then
600 LIBS="-lrdmacm $LIBS"
602 echo "rdmacm $rdmacm"
604 ##########################################
605 # Linux fallocate probe
610 #include <linux/falloc.h>
611 int main(int argc, char **argv)
613 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
617 if compile_prog "" "" "linux_fallocate"; then
618 linux_fallocate="yes"
620 echo "Linux fallocate $linux_fallocate"
622 ##########################################
623 # POSIX fadvise probe
628 int main(int argc, char **argv)
630 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
634 if compile_prog "" "" "posix_fadvise"; then
637 echo "POSIX fadvise $posix_fadvise"
639 ##########################################
640 # POSIX fallocate probe
645 int main(int argc, char **argv)
647 int r = posix_fallocate(0, 0, 1024);
651 if compile_prog "" "" "posix_fallocate"; then
652 posix_fallocate="yes"
654 echo "POSIX fallocate $posix_fallocate"
656 ##########################################
657 # sched_set/getaffinity 2 or 3 argument test
658 linux_2arg_affinity="no"
659 linux_3arg_affinity="no"
662 int main(int argc, char **argv)
665 return sched_setaffinity(0, sizeof(mask), &mask);
668 if compile_prog "" "" "sched_setaffinity(,,)"; then
669 linux_3arg_affinity="yes"
673 int main(int argc, char **argv)
676 return sched_setaffinity(0, &mask);
679 if compile_prog "" "" "sched_setaffinity(,)"; then
680 linux_2arg_affinity="yes"
683 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
684 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
686 ##########################################
687 # clock_gettime probe
692 int main(int argc, char **argv)
694 return clock_gettime(0, NULL);
697 if compile_prog "" "" "clock_gettime"; then
699 elif compile_prog "" "-lrt" "clock_gettime"; then
703 echo "clock_gettime $clock_gettime"
705 ##########################################
706 # CLOCK_MONOTONIC probe
708 if test "$clock_gettime" = "yes" ; then
712 int main(int argc, char **argv)
714 return clock_gettime(CLOCK_MONOTONIC, NULL);
717 if compile_prog "" "$LIBS" "clock monotonic"; then
718 clock_monotonic="yes"
721 echo "CLOCK_MONOTONIC $clock_monotonic"
723 ##########################################
724 # CLOCK_MONOTONIC_RAW probe
725 clock_monotonic_raw="no"
726 if test "$clock_gettime" = "yes" ; then
730 int main(int argc, char **argv)
732 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
735 if compile_prog "" "$LIBS" "clock monotonic"; then
736 clock_monotonic_raw="yes"
739 echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
741 ##########################################
742 # CLOCK_MONOTONIC_PRECISE probe
743 clock_monotonic_precise="no"
744 if test "$clock_gettime" = "yes" ; then
748 int main(int argc, char **argv)
750 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
753 if compile_prog "" "$LIBS" "clock monotonic precise"; then
754 clock_monotonic_precise="yes"
757 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
759 ##########################################
760 # gettimeofday() probe
763 #include <sys/time.h>
765 int main(int argc, char **argv)
768 return gettimeofday(&tv, NULL);
771 if compile_prog "" "" "gettimeofday"; then
774 echo "gettimeofday $gettimeofday"
776 ##########################################
782 int main(int argc, char **argv)
787 if compile_prog "" "" "fdatasync"; then
790 echo "fdatasync $fdatasync"
792 ##########################################
793 # sync_file_range() probe
799 #include <linux/fs.h>
800 int main(int argc, char **argv)
802 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
803 SYNC_FILE_RANGE_WAIT_AFTER;
804 return sync_file_range(0, 0, 0, flags);
807 if compile_prog "" "" "sync_file_range"; then
808 sync_file_range="yes"
810 echo "sync_file_range $sync_file_range"
812 ##########################################
813 # ext4 move extent probe
817 #include <sys/ioctl.h>
818 int main(int argc, char **argv)
820 struct move_extent me;
821 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
824 if compile_prog "" "" "ext4 move extent" ; then
826 elif test $targetos = "Linux" ; then
827 # On Linux, just default to it on and let it error at runtime if we really
828 # don't have it. None of my updated systems have it defined, but it does
829 # work. Takes a while to bubble back.
832 echo "EXT4 move extent $ext4_me"
834 ##########################################
840 int main(int argc, char **argv)
842 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
845 if compile_prog "" "" "linux splice"; then
848 echo "Linux splice(2) $linux_splice"
850 ##########################################
855 #include <guasi_syscalls.h>
856 int main(int argc, char **argv)
858 guasi_t ctx = guasi_create(0, 0, 0);
862 if compile_prog "" "" "guasi"; then
867 ##########################################
871 #include <nvm/nvm_primitives.h>
872 int main(int argc, char **argv)
874 nvm_version_t ver_info;
877 handle = nvm_get_handle(0, &ver_info);
878 return nvm_atomic_write(handle, 0, 0, 0);
881 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
882 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
885 echo "Fusion-io atomic engine $fusion_aw"
887 ##########################################
892 int main(int argc, char **argv)
894 return numa_available();
897 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
901 echo "libnuma $libnuma"
903 ##########################################
904 # libnuma 2.x version API
905 if test "$libnuma" = "yes" ; then
909 int main(int argc, char **argv)
911 struct bitmask *mask = numa_parse_nodestring(NULL);
912 return mask->size == 0;
915 if compile_prog "" "" "libnuma api"; then
918 echo "libnuma v2 $libnuma_v2"
921 ##########################################
926 int main(int argc, char **argv)
932 if compile_prog "" "" "strsep"; then
935 echo "strsep $strsep"
937 ##########################################
942 int main(int argc, char **argv)
944 return strcasestr(argv[0], argv[1]) != NULL;
947 if compile_prog "" "" "strcasestr"; then
950 echo "strcasestr $strcasestr"
952 ##########################################
953 # getopt_long_only() probe
954 getopt_long_only="no"
959 int main(int argc, char **argv)
961 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
965 if compile_prog "" "" "getopt_long_only"; then
966 getopt_long_only="yes"
968 echo "getopt_long_only() $getopt_long_only"
970 ##########################################
974 #include <sys/socket.h>
975 #include <arpa/inet.h>
977 int main(int argc, char **argv)
980 return inet_aton(NULL, &in);
983 if compile_prog "" "" "inet_aton"; then
986 echo "inet_aton $inet_aton"
988 ##########################################
992 #include <sys/socket.h>
993 int main(int argc, char **argv)
999 if compile_prog "" "" "socklen_t"; then
1002 echo "socklen_t $socklen_t"
1004 ##########################################
1005 # Whether or not __thread is supported for TLS
1009 static __thread int ret;
1010 int main(int argc, char **argv)
1015 if compile_prog "" "" "__thread"; then
1018 echo "__thread $tls_thread"
1020 ##########################################
1021 # Check if we have required gtk/glib support for gfio
1023 if test "$gfio_check" = "yes" ; then
1027 #include <gtk/gtk.h>
1030 gdk_threads_enter();
1031 gdk_threads_leave();
1033 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1036 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1037 ORG_LDFLAGS=$LDFLAGS
1038 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1039 if test "$?" != "0" ; then
1040 echo "configure: gtk and gthread not found"
1043 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1044 if test "$?" != "0" ; then
1045 echo "configure: gtk and gthread not found"
1048 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1050 if test "$r" != "0" ; then
1052 GFIO_LIBS="$LIBS $GTK_LIBS"
1053 CFLAGS="$CFLAGS $GTK_CFLAGS"
1055 echo "GTK found, but need version 2.18 or higher"
1059 echo "Please install gtk and gdk libraries"
1062 LDFLAGS=$ORG_LDFLAGS
1065 if test "$gfio_check" = "yes" ; then
1066 echo "gtk 2.18 or higher $gfio"
1069 # Check whether we have getrusage(RUSAGE_THREAD)
1072 #include <sys/time.h>
1073 #include <sys/resource.h>
1074 int main(int argc, char **argv)
1077 getrusage(RUSAGE_THREAD, &ru);
1081 if compile_prog "" "" "RUSAGE_THREAD"; then
1084 echo "RUSAGE_THREAD $rusage_thread"
1086 ##########################################
1087 # Check whether we have SCHED_IDLE
1091 int main(int argc, char **argv)
1093 struct sched_param p;
1094 return sched_setscheduler(0, SCHED_IDLE, &p);
1097 if compile_prog "" "" "SCHED_IDLE"; then
1100 echo "SCHED_IDLE $sched_idle"
1102 ##########################################
1103 # Check whether we have TCP_NODELAY
1107 #include <sys/types.h>
1108 #include <sys/socket.h>
1109 #include <netinet/tcp.h>
1110 int main(int argc, char **argv)
1112 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1115 if compile_prog "" "" "TCP_NODELAY"; then
1118 echo "TCP_NODELAY $tcp_nodelay"
1120 ##########################################
1121 # Check whether we have SO_SNDBUF
1125 #include <sys/types.h>
1126 #include <sys/socket.h>
1127 #include <netinet/tcp.h>
1128 int main(int argc, char **argv)
1130 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1131 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1134 if compile_prog "" "" "SO_SNDBUF"; then
1137 echo "Net engine window_size $window_size"
1139 ##########################################
1140 # Check whether we have TCP_MAXSEG
1144 #include <sys/types.h>
1145 #include <sys/socket.h>
1146 #include <netinet/tcp.h>
1147 #include <arpa/inet.h>
1148 #include <netinet/in.h>
1149 int main(int argc, char **argv)
1151 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1154 if compile_prog "" "" "TCP_MAXSEG"; then
1157 echo "TCP_MAXSEG $mss"
1159 ##########################################
1160 # Check whether we have RLIMIT_MEMLOCK
1163 #include <sys/time.h>
1164 #include <sys/resource.h>
1165 int main(int argc, char **argv)
1168 return getrlimit(RLIMIT_MEMLOCK, &rl);
1171 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1172 rlimit_memlock="yes"
1174 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1176 ##########################################
1177 # Check whether we have pwritev/preadv
1181 #include <sys/uio.h>
1182 int main(int argc, char **argv)
1184 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1187 if compile_prog "" "" "pwritev"; then
1190 echo "pwritev/preadv $pwritev"
1192 ##########################################
1193 # Check whether we have the required functions for ipv6
1196 #include <sys/types.h>
1197 #include <sys/socket.h>
1198 #include <netinet/in.h>
1201 int main(int argc, char **argv)
1203 struct addrinfo hints;
1204 struct in6_addr addr;
1207 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1209 printf("%s\n", gai_strerror(ret));
1214 if compile_prog "" "" "ipv6"; then
1217 echo "IPv6 helpers $ipv6"
1219 ##########################################
1223 #include <rbd/librbd.h>
1225 int main(int argc, char **argv)
1229 rados_ioctx_t io_ctx;
1230 const char pool[] = "rbd";
1232 int major, minor, extra;
1233 rbd_version(&major, &minor, &extra);
1235 rados_ioctx_create(cluster, pool, &io_ctx);
1239 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1240 LIBS="-lrbd -lrados $LIBS"
1243 echo "Rados Block Device engine $rbd"
1245 ##########################################
1246 # check for rbd_invaidate_cache()
1248 if test "$rbd" = "yes"; then
1250 #include <rbd/librbd.h>
1252 int main(int argc, char **argv)
1256 return rbd_invalidate_cache(image);
1259 if compile_prog "" "-lrbd -lrados" "rbd"; then
1262 echo "rbd_invalidate_cache $rbd_inval"
1265 ##########################################
1266 # Check whether we have setvbuf
1270 int main(int argc, char **argv)
1274 setvbuf(f, buf, _IOFBF, sizeof(buf));
1278 if compile_prog "" "" "setvbuf"; then
1281 echo "setvbuf $setvbuf"
1286 #include <glusterfs/api/glfs.h>
1288 int main(int argc, char **argv)
1291 glfs_t *g = glfs_new("foo");
1296 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1297 LIBS="-lgfapi -lglusterfs $LIBS"
1300 echo "Gluster API engine $gfapi"
1302 ##########################################
1303 # check for gfapi fadvise support
1304 if test "$gfapi" = "yes" ; then
1307 #include <glusterfs/api/glfs.h>
1309 int main(int argc, char **argv)
1312 int ret = glfs_fadvise(fd, 0, 0, 1);
1317 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1320 echo "Gluster API use fadvise $gf_fadvise"
1323 ##########################################
1324 # check for gfapi trim support
1326 if test "$gfapi" = "yes" ; then
1328 #include <glusterfs/api/glfs.h>
1330 int main(int argc, char **argv)
1332 return glfs_discard_async(NULL, 0, 0);
1335 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1338 echo "Gluster API trim support $gf_trim"
1341 ##########################################
1342 # Check if we support stckf on s390
1343 s390_z196_facilities="no"
1345 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1346 int main(int argc, char **argv)
1348 /* We want just 1 double word to be returned. */
1349 register unsigned long reg0 asm("0") = 0;
1350 unsigned long stfle_bits;
1351 asm volatile(".machine push" "\n\t"
1352 ".machine \"z9-109\"" "\n\t"
1355 : "=QS" (stfle_bits), "+d" (reg0)
1358 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1364 if compile_prog "" "" "s390_z196_facilities"; then
1366 if [[ $? -eq 0 ]]; then
1367 s390_z196_facilities="yes"
1370 echo "s390_z196_facilities $s390_z196_facilities"
1372 ##########################################
1373 # Check if we have required environment variables configured for libhdfs
1374 if test "$libhdfs" = "yes" ; then
1376 if test "$JAVA_HOME" = "" ; then
1377 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1380 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1381 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1384 if test "$FIO_LIBHDFS_LIB" = "" ; then
1385 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1388 if test "$hdfs_conf_error" = "1" ; then
1392 echo "HDFS engine $libhdfs"
1394 ##########################################
1395 # Check whether we have MTD
1398 #include <mtd/mtd-user.h>
1399 #include <sys/ioctl.h>
1400 int main(int argc, char **argv)
1402 struct mtd_info_user info;
1403 info.type = MTD_MLCNANDFLASH;
1404 return ioctl(0, MEMGETINFO, &info);
1407 if compile_prog "" "" "mtd"; then
1412 # Check if we have lex/yacc available
1417 if test "$targetos" != "SunOS" ; then
1418 LEX=$(which lex 2> /dev/null)
1419 if test -x "$LEX" ; then
1422 YACC=$(which bison 2> /dev/null)
1423 if test -x "$YACC" ; then
1427 YACC=$(which yacc 2> /dev/null)
1428 if test -x "$YACC" ; then
1432 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1436 if test "$arith" = "yes" ; then
1438 extern int yywrap(void);
1440 int main(int argc, char **argv)
1446 if compile_prog "" "-ll" "lex"; then
1454 echo "lex/yacc for arithmetic $arith"
1456 ##########################################
1457 # Check whether we have setmntent/getmntent
1462 int main(int argc, char **argv)
1464 FILE *mtab = setmntent(NULL, "r");
1465 struct mntent *mnt = getmntent(mtab);
1470 if compile_prog "" "" "getmntent"; then
1473 echo "getmntent $getmntent"
1475 #############################################################################
1477 if test "$wordsize" = "64" ; then
1478 output_sym "CONFIG_64BIT"
1479 elif test "$wordsize" = "32" ; then
1480 output_sym "CONFIG_32BIT"
1482 fatal "Unknown wordsize!"
1484 if test "$bigendian" = "yes" ; then
1485 output_sym "CONFIG_BIG_ENDIAN"
1487 output_sym "CONFIG_LITTLE_ENDIAN"
1489 if test "$zlib" = "yes" ; then
1490 output_sym "CONFIG_ZLIB"
1492 if test "$libaio" = "yes" ; then
1493 output_sym "CONFIG_LIBAIO"
1495 if test "$posix_aio" = "yes" ; then
1496 output_sym "CONFIG_POSIXAIO"
1498 if test "$posix_aio_fsync" = "yes" ; then
1499 output_sym "CONFIG_POSIXAIO_FSYNC"
1501 if test "$linux_fallocate" = "yes" ; then
1502 output_sym "CONFIG_LINUX_FALLOCATE"
1504 if test "$posix_fallocate" = "yes" ; then
1505 output_sym "CONFIG_POSIX_FALLOCATE"
1507 if test "$fdatasync" = "yes" ; then
1508 output_sym "CONFIG_FDATASYNC"
1510 if test "$sync_file_range" = "yes" ; then
1511 output_sym "CONFIG_SYNC_FILE_RANGE"
1513 if test "$sfaa" = "yes" ; then
1514 output_sym "CONFIG_SFAA"
1516 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1517 output_sym "CONFIG_RDMA"
1519 if test "$clock_gettime" = "yes" ; then
1520 output_sym "CONFIG_CLOCK_GETTIME"
1522 if test "$clock_monotonic" = "yes" ; then
1523 output_sym "CONFIG_CLOCK_MONOTONIC"
1525 if test "$clock_monotonic_raw" = "yes" ; then
1526 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1528 if test "$clock_monotonic_precise" = "yes" ; then
1529 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1531 if test "$gettimeofday" = "yes" ; then
1532 output_sym "CONFIG_GETTIMEOFDAY"
1534 if test "$posix_fadvise" = "yes" ; then
1535 output_sym "CONFIG_POSIX_FADVISE"
1537 if test "$linux_3arg_affinity" = "yes" ; then
1538 output_sym "CONFIG_3ARG_AFFINITY"
1539 elif test "$linux_2arg_affinity" = "yes" ; then
1540 output_sym "CONFIG_2ARG_AFFINITY"
1542 if test "$strsep" = "yes" ; then
1543 output_sym "CONFIG_STRSEP"
1545 if test "$strcasestr" = "yes" ; then
1546 output_sym "CONFIG_STRCASESTR"
1548 if test "$getopt_long_only" = "yes" ; then
1549 output_sym "CONFIG_GETOPT_LONG_ONLY"
1551 if test "$inet_aton" = "yes" ; then
1552 output_sym "CONFIG_INET_ATON"
1554 if test "$socklen_t" = "yes" ; then
1555 output_sym "CONFIG_SOCKLEN_T"
1557 if test "$ext4_me" = "yes" ; then
1558 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1560 if test "$linux_splice" = "yes" ; then
1561 output_sym "CONFIG_LINUX_SPLICE"
1563 if test "$guasi" = "yes" ; then
1564 output_sym "CONFIG_GUASI"
1566 if test "$fusion_aw" = "yes" ; then
1567 output_sym "CONFIG_FUSION_AW"
1569 if test "$libnuma_v2" = "yes" ; then
1570 output_sym "CONFIG_LIBNUMA"
1572 if test "$solaris_aio" = "yes" ; then
1573 output_sym "CONFIG_SOLARISAIO"
1575 if test "$tls_thread" = "yes" ; then
1576 output_sym "CONFIG_TLS_THREAD"
1578 if test "$rusage_thread" = "yes" ; then
1579 output_sym "CONFIG_RUSAGE_THREAD"
1581 if test "$gfio" = "yes" ; then
1582 echo "CONFIG_GFIO=y" >> $config_host_mak
1584 if test "$esx" = "yes" ; then
1585 output_sym "CONFIG_ESX"
1586 output_sym "CONFIG_NO_SHM"
1588 if test "$sched_idle" = "yes" ; then
1589 output_sym "CONFIG_SCHED_IDLE"
1591 if test "$tcp_nodelay" = "yes" ; then
1592 output_sym "CONFIG_TCP_NODELAY"
1594 if test "$window_size" = "yes" ; then
1595 output_sym "CONFIG_NET_WINDOWSIZE"
1597 if test "$mss" = "yes" ; then
1598 output_sym "CONFIG_NET_MSS"
1600 if test "$rlimit_memlock" = "yes" ; then
1601 output_sym "CONFIG_RLIMIT_MEMLOCK"
1603 if test "$pwritev" = "yes" ; then
1604 output_sym "CONFIG_PWRITEV"
1606 if test "$ipv6" = "yes" ; then
1607 output_sym "CONFIG_IPV6"
1609 if test "$rbd" = "yes" ; then
1610 output_sym "CONFIG_RBD"
1612 if test "$rbd_inval" = "yes" ; then
1613 output_sym "CONFIG_RBD_INVAL"
1615 if test "$setvbuf" = "yes" ; then
1616 output_sym "CONFIG_SETVBUF"
1618 if test "$s390_z196_facilities" = "yes" ; then
1619 output_sym "CONFIG_S390_Z196_FACILITIES"
1620 CFLAGS="$CFLAGS -march=z9-109"
1622 if test "$gfapi" = "yes" ; then
1623 output_sym "CONFIG_GFAPI"
1625 if test "$gf_fadvise" = "yes" ; then
1626 output_sym "CONFIG_GF_FADVISE"
1628 if test "$gf_trim" = "yes" ; then
1629 output_sym "CONFIG_GF_TRIM"
1631 if test "$libhdfs" = "yes" ; then
1632 output_sym "CONFIG_LIBHDFS"
1633 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1634 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1635 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1637 if test "$mtd" = "yes" ; then
1638 output_sym "CONFIG_MTD"
1640 if test "$arith" = "yes" ; then
1641 output_sym "CONFIG_ARITHMETIC"
1642 if test "$yacc_is_bison" = "yes" ; then
1643 echo "YACC=$YACC -y" >> $config_host_mak
1645 echo "YACC=$YACC" >> $config_host_mak
1648 if test "$getmntent" = "yes" ; then
1649 output_sym "CONFIG_GETMNTENT"
1652 if test "$zlib" = "no" ; then
1653 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1656 echo "LIBS+=$LIBS" >> $config_host_mak
1657 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1658 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1659 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1660 echo "CC=$cc" >> $config_host_mak
1661 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
1662 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak