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 "--disable-gfapi Disable gfapi"
194 echo "--enable-libhdfs Enable hdfs support"
195 echo "--disable-shm Disable SHM support"
199 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
200 cc="${CC-${cross_prefix}gcc}"
202 if check_define __ANDROID__ ; then
204 elif check_define __linux__ ; then
206 elif check_define __OpenBSD__ ; then
208 elif check_define __sun__ ; then
210 CFLAGS="$CFLAGS -D_REENTRANT"
211 elif check_define _WIN32 ; then
217 echo "# Automatically generated by configure - do not modify" > $config_host_mak
218 printf "# Configured with:" >> $config_host_mak
219 printf " '%s'" "$0" "$@" >> $config_host_mak
220 echo >> $config_host_mak
221 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
223 # Some host OSes need non-standard checks for which CPU to use.
224 # Note that these checks are broken for cross-compilation: if you're
225 # cross-compiling to one of these OSes then you'll need to specify
226 # the correct CPU with the --cpu option.
229 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
230 # we can run 64-bit userspace code.
231 # If the user didn't specify a CPU explicitly and the kernel says this is
232 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
234 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
239 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
240 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
243 LIBS="-lnsl -lsocket"
246 echo "Forcing known good options on Windows"
247 if test -z "$CC" ; then
248 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
249 CC="i686-w64-mingw32-gcc"
251 CC="x86_64-w64-mingw32-gcc"
254 output_sym "CONFIG_LITTLE_ENDIAN"
255 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
256 output_sym "CONFIG_32BIT"
258 output_sym "CONFIG_64BIT_LLP64"
260 output_sym "CONFIG_FADVISE"
261 output_sym "CONFIG_SOCKLEN_T"
262 output_sym "CONFIG_FADVISE"
263 output_sym "CONFIG_SFAA"
264 output_sym "CONFIG_RUSAGE_THREAD"
265 output_sym "CONFIG_WINDOWSAIO"
266 output_sym "CONFIG_FDATASYNC"
267 output_sym "CONFIG_CLOCK_MONOTONIC"
268 output_sym "CONFIG_GETTIMEOFDAY"
269 output_sym "CONFIG_CLOCK_GETTIME"
270 output_sym "CONFIG_SCHED_IDLE"
271 output_sym "CONFIG_TCP_NODELAY"
272 output_sym "CONFIG_TLS_THREAD"
273 output_sym "CONFIG_IPV6"
274 echo "CC=$CC" >> $config_host_mak
275 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
280 if test ! -z "$cpu" ; then
281 # command line argument
283 elif check_define __i386__ ; then
285 elif check_define __x86_64__ ; then
287 elif check_define __sparc__ ; then
288 if check_define __arch64__ ; then
293 elif check_define _ARCH_PPC ; then
294 if check_define _ARCH_PPC64 ; then
299 elif check_define __mips__ ; then
301 elif check_define __ia64__ ; then
303 elif check_define __s390__ ; then
304 if check_define __s390x__ ; then
309 elif check_define __arm__ ; then
311 elif check_define __hppa__ ; then
317 # Normalise host CPU name and set ARCH.
319 ia64|ppc|ppc64|s390|s390x|sparc64)
322 i386|i486|i586|i686|i86pc|BePC)
331 hppa|parisc|parisc64)
345 if test -z "$CC" ; then
346 if test "$targetos" = "FreeBSD"; then
355 cc="${CC-${cross_prefix}gcc}"
357 ##########################################
358 # check cross compile
367 if compile_prog "" "" "cross"; then
368 $TMPE 2>/dev/null || cross_compile="yes"
370 fatal "compile test failed"
373 ##########################################
376 if test "$cross_compile" = "no" ; then
378 #include <inttypes.h>
381 volatile uint32_t i=0x01234567;
382 return (*((uint8_t*)(&i))) == 0x67;
385 if compile_prog "" "" "endian"; then
386 $TMPE && bigendian="yes"
389 # If we're cross compiling, try our best to work it out and rely on the
390 # run-time check to fail if we get it wrong.
395 #if __BYTE_ORDER != __BIG_ENDIAN
396 # error "Unknown endianness"
400 compile_prog "" "" "endian" && bigendian="yes"
401 check_define "__ARMEB__" && bigendian="yes"
402 check_define "__MIPSEB__" && bigendian="yes"
406 echo "Operating system $targetos"
408 echo "Big endian $bigendian"
410 echo "Cross compile $cross_compile"
413 ##########################################
414 # See if we need to build a static build
415 if test "$build_static" = "yes" ; then
416 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
417 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
421 echo "Static build $build_static"
423 ##########################################
428 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
431 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
435 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
437 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
440 fatal "Unknown wordsize"
442 echo "Wordsize $wordsize"
444 ##########################################
452 if (inflateInit(&stream) != Z_OK)
457 if compile_prog "" "-lz" "zlib" ; then
463 ##########################################
475 if compile_prog "" "-laio" "libaio" ; then
479 if test "$libaio" = "yes" ; then
480 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
484 echo "Linux AIO support $libaio"
486 ##########################################
499 if compile_prog "" "" "posixaio" ; then
501 elif compile_prog "" "-lrt" "posixaio"; then
506 echo "POSIX AIO support $posix_aio"
507 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
509 ##########################################
510 # posix aio fsync probe
512 if test "$posix_aio" = "yes" ; then
519 return aio_fsync(O_SYNC, &cb);
523 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
527 echo "POSIX AIO fsync $posix_aio_fsync"
529 ##########################################
533 #include <sys/types.h>
534 #include <sys/asynch.h>
539 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
543 if compile_prog "" "-laio" "solarisaio" ; then
547 echo "Solaris AIO support $solaris_aio"
549 ##########################################
550 # __sync_fetch_and_and test
553 static int sfaa(int *ptr)
555 return __sync_fetch_and_add(ptr, 0);
558 int main(int argc, char **argv)
565 if compile_prog "" "" "__sync_fetch_and_add()" ; then
568 echo "__sync_fetch_and_add $sfaa"
570 ##########################################
575 #include <infiniband/arch.h>
576 int main(int argc, char **argv)
578 struct ibv_pd *pd = ibv_alloc_pd(NULL);
582 if compile_prog "" "-libverbs" "libverbs" ; then
584 LIBS="-libverbs $LIBS"
586 echo "libverbs $libverbs"
588 ##########################################
593 #include <rdma/rdma_cma.h>
594 int main(int argc, char **argv)
596 rdma_destroy_qp(NULL);
600 if compile_prog "" "-lrdmacm" "rdma"; then
602 LIBS="-lrdmacm $LIBS"
604 echo "rdmacm $rdmacm"
606 ##########################################
607 # Linux fallocate probe
612 #include <linux/falloc.h>
613 int main(int argc, char **argv)
615 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
619 if compile_prog "" "" "linux_fallocate"; then
620 linux_fallocate="yes"
622 echo "Linux fallocate $linux_fallocate"
624 ##########################################
625 # POSIX fadvise probe
630 int main(int argc, char **argv)
632 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
636 if compile_prog "" "" "posix_fadvise"; then
639 echo "POSIX fadvise $posix_fadvise"
641 ##########################################
642 # POSIX fallocate probe
647 int main(int argc, char **argv)
649 int r = posix_fallocate(0, 0, 1024);
653 if compile_prog "" "" "posix_fallocate"; then
654 posix_fallocate="yes"
656 echo "POSIX fallocate $posix_fallocate"
658 ##########################################
659 # sched_set/getaffinity 2 or 3 argument test
660 linux_2arg_affinity="no"
661 linux_3arg_affinity="no"
664 int main(int argc, char **argv)
667 return sched_setaffinity(0, sizeof(mask), &mask);
670 if compile_prog "" "" "sched_setaffinity(,,)"; then
671 linux_3arg_affinity="yes"
675 int main(int argc, char **argv)
678 return sched_setaffinity(0, &mask);
681 if compile_prog "" "" "sched_setaffinity(,)"; then
682 linux_2arg_affinity="yes"
685 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
686 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
688 ##########################################
689 # clock_gettime probe
694 int main(int argc, char **argv)
696 return clock_gettime(0, NULL);
699 if compile_prog "" "" "clock_gettime"; then
701 elif compile_prog "" "-lrt" "clock_gettime"; then
705 echo "clock_gettime $clock_gettime"
707 ##########################################
708 # CLOCK_MONOTONIC probe
710 if test "$clock_gettime" = "yes" ; then
714 int main(int argc, char **argv)
716 return clock_gettime(CLOCK_MONOTONIC, NULL);
719 if compile_prog "" "$LIBS" "clock monotonic"; then
720 clock_monotonic="yes"
723 echo "CLOCK_MONOTONIC $clock_monotonic"
725 ##########################################
726 # CLOCK_MONOTONIC_RAW probe
727 clock_monotonic_raw="no"
728 if test "$clock_gettime" = "yes" ; then
732 int main(int argc, char **argv)
734 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
737 if compile_prog "" "$LIBS" "clock monotonic"; then
738 clock_monotonic_raw="yes"
741 echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
743 ##########################################
744 # CLOCK_MONOTONIC_PRECISE probe
745 clock_monotonic_precise="no"
746 if test "$clock_gettime" = "yes" ; then
750 int main(int argc, char **argv)
752 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
755 if compile_prog "" "$LIBS" "clock monotonic precise"; then
756 clock_monotonic_precise="yes"
759 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
761 ##########################################
762 # gettimeofday() probe
765 #include <sys/time.h>
767 int main(int argc, char **argv)
770 return gettimeofday(&tv, NULL);
773 if compile_prog "" "" "gettimeofday"; then
776 echo "gettimeofday $gettimeofday"
778 ##########################################
784 int main(int argc, char **argv)
789 if compile_prog "" "" "fdatasync"; then
792 echo "fdatasync $fdatasync"
794 ##########################################
795 # sync_file_range() probe
801 #include <linux/fs.h>
802 int main(int argc, char **argv)
804 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
805 SYNC_FILE_RANGE_WAIT_AFTER;
806 return sync_file_range(0, 0, 0, flags);
809 if compile_prog "" "" "sync_file_range"; then
810 sync_file_range="yes"
812 echo "sync_file_range $sync_file_range"
814 ##########################################
815 # ext4 move extent probe
819 #include <sys/ioctl.h>
820 int main(int argc, char **argv)
822 struct move_extent me;
823 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
826 if compile_prog "" "" "ext4 move extent" ; then
828 elif test $targetos = "Linux" ; then
829 # On Linux, just default to it on and let it error at runtime if we really
830 # don't have it. None of my updated systems have it defined, but it does
831 # work. Takes a while to bubble back.
834 echo "EXT4 move extent $ext4_me"
836 ##########################################
842 int main(int argc, char **argv)
844 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
847 if compile_prog "" "" "linux splice"; then
850 echo "Linux splice(2) $linux_splice"
852 ##########################################
857 #include <guasi_syscalls.h>
858 int main(int argc, char **argv)
860 guasi_t ctx = guasi_create(0, 0, 0);
864 if compile_prog "" "" "guasi"; then
869 ##########################################
873 #include <nvm/nvm_primitives.h>
874 int main(int argc, char **argv)
876 nvm_version_t ver_info;
879 handle = nvm_get_handle(0, &ver_info);
880 return nvm_atomic_write(handle, 0, 0, 0);
883 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
884 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
887 echo "Fusion-io atomic engine $fusion_aw"
889 ##########################################
894 int main(int argc, char **argv)
896 return numa_available();
899 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
903 echo "libnuma $libnuma"
905 ##########################################
906 # libnuma 2.x version API
907 if test "$libnuma" = "yes" ; then
911 int main(int argc, char **argv)
913 struct bitmask *mask = numa_parse_nodestring(NULL);
914 return mask->size == 0;
917 if compile_prog "" "" "libnuma api"; then
920 echo "libnuma v2 $libnuma_v2"
923 ##########################################
928 int main(int argc, char **argv)
934 if compile_prog "" "" "strsep"; then
937 echo "strsep $strsep"
939 ##########################################
944 int main(int argc, char **argv)
946 return strcasestr(argv[0], argv[1]) != NULL;
949 if compile_prog "" "" "strcasestr"; then
952 echo "strcasestr $strcasestr"
954 ##########################################
955 # getopt_long_only() probe
956 getopt_long_only="no"
961 int main(int argc, char **argv)
963 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
967 if compile_prog "" "" "getopt_long_only"; then
968 getopt_long_only="yes"
970 echo "getopt_long_only() $getopt_long_only"
972 ##########################################
976 #include <sys/socket.h>
977 #include <arpa/inet.h>
979 int main(int argc, char **argv)
982 return inet_aton(NULL, &in);
985 if compile_prog "" "" "inet_aton"; then
988 echo "inet_aton $inet_aton"
990 ##########################################
994 #include <sys/socket.h>
995 int main(int argc, char **argv)
1001 if compile_prog "" "" "socklen_t"; then
1004 echo "socklen_t $socklen_t"
1006 ##########################################
1007 # Whether or not __thread is supported for TLS
1011 static __thread int ret;
1012 int main(int argc, char **argv)
1017 if compile_prog "" "" "__thread"; then
1020 echo "__thread $tls_thread"
1022 ##########################################
1023 # Check if we have required gtk/glib support for gfio
1025 if test "$gfio_check" = "yes" ; then
1029 #include <gtk/gtk.h>
1032 gdk_threads_enter();
1033 gdk_threads_leave();
1035 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1038 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1039 ORG_LDFLAGS=$LDFLAGS
1040 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1041 if test "$?" != "0" ; then
1042 echo "configure: gtk and gthread not found"
1045 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1046 if test "$?" != "0" ; then
1047 echo "configure: gtk and gthread not found"
1050 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1052 if test "$r" != "0" ; then
1054 GFIO_LIBS="$LIBS $GTK_LIBS"
1055 CFLAGS="$CFLAGS $GTK_CFLAGS"
1057 echo "GTK found, but need version 2.18 or higher"
1061 echo "Please install gtk and gdk libraries"
1064 LDFLAGS=$ORG_LDFLAGS
1067 if test "$gfio_check" = "yes" ; then
1068 echo "gtk 2.18 or higher $gfio"
1071 # Check whether we have getrusage(RUSAGE_THREAD)
1074 #include <sys/time.h>
1075 #include <sys/resource.h>
1076 int main(int argc, char **argv)
1079 getrusage(RUSAGE_THREAD, &ru);
1083 if compile_prog "" "" "RUSAGE_THREAD"; then
1086 echo "RUSAGE_THREAD $rusage_thread"
1088 ##########################################
1089 # Check whether we have SCHED_IDLE
1093 int main(int argc, char **argv)
1095 struct sched_param p;
1096 return sched_setscheduler(0, SCHED_IDLE, &p);
1099 if compile_prog "" "" "SCHED_IDLE"; then
1102 echo "SCHED_IDLE $sched_idle"
1104 ##########################################
1105 # Check whether we have TCP_NODELAY
1109 #include <sys/types.h>
1110 #include <sys/socket.h>
1111 #include <netinet/tcp.h>
1112 int main(int argc, char **argv)
1114 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1117 if compile_prog "" "" "TCP_NODELAY"; then
1120 echo "TCP_NODELAY $tcp_nodelay"
1122 ##########################################
1123 # Check whether we have SO_SNDBUF
1127 #include <sys/types.h>
1128 #include <sys/socket.h>
1129 #include <netinet/tcp.h>
1130 int main(int argc, char **argv)
1132 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1133 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1136 if compile_prog "" "" "SO_SNDBUF"; then
1139 echo "Net engine window_size $window_size"
1141 ##########################################
1142 # Check whether we have TCP_MAXSEG
1146 #include <sys/types.h>
1147 #include <sys/socket.h>
1148 #include <netinet/tcp.h>
1149 #include <arpa/inet.h>
1150 #include <netinet/in.h>
1151 int main(int argc, char **argv)
1153 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1156 if compile_prog "" "" "TCP_MAXSEG"; then
1159 echo "TCP_MAXSEG $mss"
1161 ##########################################
1162 # Check whether we have RLIMIT_MEMLOCK
1165 #include <sys/time.h>
1166 #include <sys/resource.h>
1167 int main(int argc, char **argv)
1170 return getrlimit(RLIMIT_MEMLOCK, &rl);
1173 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1174 rlimit_memlock="yes"
1176 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1178 ##########################################
1179 # Check whether we have pwritev/preadv
1183 #include <sys/uio.h>
1184 int main(int argc, char **argv)
1186 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1189 if compile_prog "" "" "pwritev"; then
1192 echo "pwritev/preadv $pwritev"
1194 ##########################################
1195 # Check whether we have the required functions for ipv6
1198 #include <sys/types.h>
1199 #include <sys/socket.h>
1200 #include <netinet/in.h>
1203 int main(int argc, char **argv)
1205 struct addrinfo hints;
1206 struct in6_addr addr;
1209 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1211 printf("%s\n", gai_strerror(ret));
1216 if compile_prog "" "" "ipv6"; then
1219 echo "IPv6 helpers $ipv6"
1221 ##########################################
1225 #include <rbd/librbd.h>
1227 int main(int argc, char **argv)
1231 rados_ioctx_t io_ctx;
1232 const char pool[] = "rbd";
1234 int major, minor, extra;
1235 rbd_version(&major, &minor, &extra);
1237 rados_ioctx_create(cluster, pool, &io_ctx);
1241 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1242 LIBS="-lrbd -lrados $LIBS"
1245 echo "Rados Block Device engine $rbd"
1247 ##########################################
1248 # check for rbd_invaidate_cache()
1250 if test "$rbd" = "yes"; then
1252 #include <rbd/librbd.h>
1254 int main(int argc, char **argv)
1258 return rbd_invalidate_cache(image);
1261 if compile_prog "" "-lrbd -lrados" "rbd"; then
1264 echo "rbd_invalidate_cache $rbd_inval"
1267 ##########################################
1268 # Check whether we have setvbuf
1272 int main(int argc, char **argv)
1276 setvbuf(f, buf, _IOFBF, sizeof(buf));
1280 if compile_prog "" "" "setvbuf"; then
1283 echo "setvbuf $setvbuf"
1288 #include <glusterfs/api/glfs.h>
1290 int main(int argc, char **argv)
1293 glfs_t *g = glfs_new("foo");
1298 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1299 LIBS="-lgfapi -lglusterfs $LIBS"
1302 echo "Gluster API engine $gfapi"
1304 ##########################################
1305 # check for gfapi fadvise support
1306 if test "$gfapi" = "yes" ; then
1309 #include <glusterfs/api/glfs.h>
1311 int main(int argc, char **argv)
1314 int ret = glfs_fadvise(fd, 0, 0, 1);
1319 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1322 echo "Gluster API use fadvise $gf_fadvise"
1325 ##########################################
1326 # check for gfapi trim support
1328 if test "$gfapi" = "yes" ; then
1330 #include <glusterfs/api/glfs.h>
1332 int main(int argc, char **argv)
1334 return glfs_discard_async(NULL, 0, 0);
1337 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1340 echo "Gluster API trim support $gf_trim"
1343 ##########################################
1344 # Check if we support stckf on s390
1345 s390_z196_facilities="no"
1347 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1348 int main(int argc, char **argv)
1350 /* We want just 1 double word to be returned. */
1351 register unsigned long reg0 asm("0") = 0;
1352 unsigned long stfle_bits;
1353 asm volatile(".machine push" "\n\t"
1354 ".machine \"z9-109\"" "\n\t"
1357 : "=QS" (stfle_bits), "+d" (reg0)
1360 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1366 if compile_prog "" "" "s390_z196_facilities"; then
1368 if [[ $? -eq 0 ]]; then
1369 s390_z196_facilities="yes"
1372 echo "s390_z196_facilities $s390_z196_facilities"
1374 ##########################################
1375 # Check if we have required environment variables configured for libhdfs
1376 if test "$libhdfs" = "yes" ; then
1378 if test "$JAVA_HOME" = "" ; then
1379 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1382 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1383 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1386 if test "$FIO_LIBHDFS_LIB" = "" ; then
1387 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1390 if test "$hdfs_conf_error" = "1" ; then
1394 echo "HDFS engine $libhdfs"
1396 ##########################################
1397 # Check whether we have MTD
1400 #include <mtd/mtd-user.h>
1401 #include <sys/ioctl.h>
1402 int main(int argc, char **argv)
1404 struct mtd_info_user info;
1405 info.type = MTD_MLCNANDFLASH;
1406 return ioctl(0, MEMGETINFO, &info);
1409 if compile_prog "" "" "mtd"; then
1414 # Check if we have lex/yacc available
1419 if test "$targetos" != "SunOS" ; then
1420 LEX=$(which lex 2> /dev/null)
1421 if test -x "$LEX" ; then
1424 YACC=$(which bison 2> /dev/null)
1425 if test -x "$YACC" ; then
1429 YACC=$(which yacc 2> /dev/null)
1430 if test -x "$YACC" ; then
1434 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1438 if test "$arith" = "yes" ; then
1440 extern int yywrap(void);
1442 int main(int argc, char **argv)
1448 if compile_prog "" "-ll" "lex"; then
1456 echo "lex/yacc for arithmetic $arith"
1458 ##########################################
1459 # Check whether we have setmntent/getmntent
1464 int main(int argc, char **argv)
1466 FILE *mtab = setmntent(NULL, "r");
1467 struct mntent *mnt = getmntent(mtab);
1472 if compile_prog "" "" "getmntent"; then
1475 echo "getmntent $getmntent"
1477 ##########################################
1478 # Check whether we have getmntinfo
1482 #include <sys/param.h>
1483 #include <sys/mount.h>
1484 int main(int argc, char **argv)
1487 return getmntinfo(&st, MNT_NOWAIT);
1490 if compile_prog "" "" "getmntinfo"; then
1493 echo "getmntinfo $getmntinfo"
1495 #############################################################################
1497 if test "$wordsize" = "64" ; then
1498 output_sym "CONFIG_64BIT"
1499 elif test "$wordsize" = "32" ; then
1500 output_sym "CONFIG_32BIT"
1502 fatal "Unknown wordsize!"
1504 if test "$bigendian" = "yes" ; then
1505 output_sym "CONFIG_BIG_ENDIAN"
1507 output_sym "CONFIG_LITTLE_ENDIAN"
1509 if test "$zlib" = "yes" ; then
1510 output_sym "CONFIG_ZLIB"
1512 if test "$libaio" = "yes" ; then
1513 output_sym "CONFIG_LIBAIO"
1515 if test "$posix_aio" = "yes" ; then
1516 output_sym "CONFIG_POSIXAIO"
1518 if test "$posix_aio_fsync" = "yes" ; then
1519 output_sym "CONFIG_POSIXAIO_FSYNC"
1521 if test "$linux_fallocate" = "yes" ; then
1522 output_sym "CONFIG_LINUX_FALLOCATE"
1524 if test "$posix_fallocate" = "yes" ; then
1525 output_sym "CONFIG_POSIX_FALLOCATE"
1527 if test "$fdatasync" = "yes" ; then
1528 output_sym "CONFIG_FDATASYNC"
1530 if test "$sync_file_range" = "yes" ; then
1531 output_sym "CONFIG_SYNC_FILE_RANGE"
1533 if test "$sfaa" = "yes" ; then
1534 output_sym "CONFIG_SFAA"
1536 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1537 output_sym "CONFIG_RDMA"
1539 if test "$clock_gettime" = "yes" ; then
1540 output_sym "CONFIG_CLOCK_GETTIME"
1542 if test "$clock_monotonic" = "yes" ; then
1543 output_sym "CONFIG_CLOCK_MONOTONIC"
1545 if test "$clock_monotonic_raw" = "yes" ; then
1546 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1548 if test "$clock_monotonic_precise" = "yes" ; then
1549 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1551 if test "$gettimeofday" = "yes" ; then
1552 output_sym "CONFIG_GETTIMEOFDAY"
1554 if test "$posix_fadvise" = "yes" ; then
1555 output_sym "CONFIG_POSIX_FADVISE"
1557 if test "$linux_3arg_affinity" = "yes" ; then
1558 output_sym "CONFIG_3ARG_AFFINITY"
1559 elif test "$linux_2arg_affinity" = "yes" ; then
1560 output_sym "CONFIG_2ARG_AFFINITY"
1562 if test "$strsep" = "yes" ; then
1563 output_sym "CONFIG_STRSEP"
1565 if test "$strcasestr" = "yes" ; then
1566 output_sym "CONFIG_STRCASESTR"
1568 if test "$getopt_long_only" = "yes" ; then
1569 output_sym "CONFIG_GETOPT_LONG_ONLY"
1571 if test "$inet_aton" = "yes" ; then
1572 output_sym "CONFIG_INET_ATON"
1574 if test "$socklen_t" = "yes" ; then
1575 output_sym "CONFIG_SOCKLEN_T"
1577 if test "$ext4_me" = "yes" ; then
1578 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1580 if test "$linux_splice" = "yes" ; then
1581 output_sym "CONFIG_LINUX_SPLICE"
1583 if test "$guasi" = "yes" ; then
1584 output_sym "CONFIG_GUASI"
1586 if test "$fusion_aw" = "yes" ; then
1587 output_sym "CONFIG_FUSION_AW"
1589 if test "$libnuma_v2" = "yes" ; then
1590 output_sym "CONFIG_LIBNUMA"
1592 if test "$solaris_aio" = "yes" ; then
1593 output_sym "CONFIG_SOLARISAIO"
1595 if test "$tls_thread" = "yes" ; then
1596 output_sym "CONFIG_TLS_THREAD"
1598 if test "$rusage_thread" = "yes" ; then
1599 output_sym "CONFIG_RUSAGE_THREAD"
1601 if test "$gfio" = "yes" ; then
1602 echo "CONFIG_GFIO=y" >> $config_host_mak
1604 if test "$esx" = "yes" ; then
1605 output_sym "CONFIG_ESX"
1606 output_sym "CONFIG_NO_SHM"
1608 if test "$sched_idle" = "yes" ; then
1609 output_sym "CONFIG_SCHED_IDLE"
1611 if test "$tcp_nodelay" = "yes" ; then
1612 output_sym "CONFIG_TCP_NODELAY"
1614 if test "$window_size" = "yes" ; then
1615 output_sym "CONFIG_NET_WINDOWSIZE"
1617 if test "$mss" = "yes" ; then
1618 output_sym "CONFIG_NET_MSS"
1620 if test "$rlimit_memlock" = "yes" ; then
1621 output_sym "CONFIG_RLIMIT_MEMLOCK"
1623 if test "$pwritev" = "yes" ; then
1624 output_sym "CONFIG_PWRITEV"
1626 if test "$ipv6" = "yes" ; then
1627 output_sym "CONFIG_IPV6"
1629 if test "$rbd" = "yes" ; then
1630 output_sym "CONFIG_RBD"
1632 if test "$rbd_inval" = "yes" ; then
1633 output_sym "CONFIG_RBD_INVAL"
1635 if test "$setvbuf" = "yes" ; then
1636 output_sym "CONFIG_SETVBUF"
1638 if test "$s390_z196_facilities" = "yes" ; then
1639 output_sym "CONFIG_S390_Z196_FACILITIES"
1640 CFLAGS="$CFLAGS -march=z9-109"
1642 if test "$gfapi" = "yes" ; then
1643 output_sym "CONFIG_GFAPI"
1645 if test "$gf_fadvise" = "yes" ; then
1646 output_sym "CONFIG_GF_FADVISE"
1648 if test "$gf_trim" = "yes" ; then
1649 output_sym "CONFIG_GF_TRIM"
1651 if test "$libhdfs" = "yes" ; then
1652 output_sym "CONFIG_LIBHDFS"
1653 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1654 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1655 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1657 if test "$mtd" = "yes" ; then
1658 output_sym "CONFIG_MTD"
1660 if test "$arith" = "yes" ; then
1661 output_sym "CONFIG_ARITHMETIC"
1662 if test "$yacc_is_bison" = "yes" ; then
1663 echo "YACC=$YACC -y" >> $config_host_mak
1665 echo "YACC=$YACC" >> $config_host_mak
1668 if test "$getmntent" = "yes" ; then
1669 output_sym "CONFIG_GETMNTENT"
1671 if test "$getmntinfo" = "yes" ; then
1672 output_sym "CONFIG_GETMNTINFO"
1675 if test "$zlib" = "no" ; then
1676 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1679 echo "LIBS+=$LIBS" >> $config_host_mak
1680 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1681 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1682 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1683 echo "CC=$cc" >> $config_host_mak
1684 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
1685 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak