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) no_shm="yes"
173 --disable-optimizations) disable_opt="yes"
179 echo "Bad option $opt"
185 if test "$show_help" = "yes" ; then
186 echo "--prefix= Use this directory as installation prefix"
187 echo "--cpu= Specify target CPU if auto-detect fails"
188 echo "--cc= Specify compiler to use"
189 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
190 echo "--build-32bit-win Enable 32-bit build on Windows"
191 echo "--build-static Build a static fio"
192 echo "--esx Configure build options for esx"
193 echo "--enable-gfio Enable building of gtk gfio"
194 echo "--disable-numa Disable libnuma even if found"
195 echo "--disable-gfapi Disable gfapi"
196 echo "--enable-libhdfs Enable hdfs support"
197 echo "--disable-shm Disable SHM support"
198 echo "--disable-optimizations Don't enable compiler optimizations"
202 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
203 cc="${CC-${cross_prefix}gcc}"
205 if check_define __ANDROID__ ; then
207 elif check_define __linux__ ; then
209 elif check_define __OpenBSD__ ; then
211 elif check_define __sun__ ; then
213 CFLAGS="$CFLAGS -D_REENTRANT"
214 elif check_define _WIN32 ; then
220 echo "# Automatically generated by configure - do not modify" > $config_host_mak
221 printf "# Configured with:" >> $config_host_mak
222 printf " '%s'" "$0" "$@" >> $config_host_mak
223 echo >> $config_host_mak
224 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
226 if test "$no_shm" = "yes" ; then
227 output_sym "CONFIG_NO_SHM"
230 if test "$disable_opt" = "yes" ; then
231 output_sym "CONFIG_FIO_NO_OPT"
234 # Some host OSes need non-standard checks for which CPU to use.
235 # Note that these checks are broken for cross-compilation: if you're
236 # cross-compiling to one of these OSes then you'll need to specify
237 # the correct CPU with the --cpu option.
240 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
241 # we can run 64-bit userspace code.
242 # If the user didn't specify a CPU explicitly and the kernel says this is
243 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
245 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
250 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
251 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
254 LIBS="-lnsl -lsocket"
257 echo "Forcing known good options on Windows"
258 if test -z "$CC" ; then
259 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
260 CC="i686-w64-mingw32-gcc"
262 CC="x86_64-w64-mingw32-gcc"
265 output_sym "CONFIG_LITTLE_ENDIAN"
266 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
267 output_sym "CONFIG_32BIT"
269 output_sym "CONFIG_64BIT_LLP64"
271 output_sym "CONFIG_FADVISE"
272 output_sym "CONFIG_SOCKLEN_T"
273 output_sym "CONFIG_FADVISE"
274 output_sym "CONFIG_SFAA"
275 output_sym "CONFIG_RUSAGE_THREAD"
276 output_sym "CONFIG_WINDOWSAIO"
277 output_sym "CONFIG_FDATASYNC"
278 output_sym "CONFIG_CLOCK_MONOTONIC"
279 output_sym "CONFIG_GETTIMEOFDAY"
280 output_sym "CONFIG_CLOCK_GETTIME"
281 output_sym "CONFIG_SCHED_IDLE"
282 output_sym "CONFIG_TCP_NODELAY"
283 output_sym "CONFIG_TLS_THREAD"
284 output_sym "CONFIG_IPV6"
285 echo "CC=$CC" >> $config_host_mak
286 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
291 if test ! -z "$cpu" ; then
292 # command line argument
294 elif check_define __i386__ ; then
296 elif check_define __x86_64__ ; then
298 elif check_define __sparc__ ; then
299 if check_define __arch64__ ; then
304 elif check_define _ARCH_PPC ; then
305 if check_define _ARCH_PPC64 ; then
310 elif check_define __mips__ ; then
312 elif check_define __ia64__ ; then
314 elif check_define __s390__ ; then
315 if check_define __s390x__ ; then
320 elif check_define __arm__ ; then
322 elif check_define __hppa__ ; then
328 # Normalise host CPU name and set ARCH.
330 ia64|ppc|ppc64|s390|s390x|sparc64)
333 i386|i486|i586|i686|i86pc|BePC)
342 hppa|parisc|parisc64)
356 if test -z "$CC" ; then
357 if test "$targetos" = "FreeBSD"; then
366 cc="${CC-${cross_prefix}gcc}"
368 ##########################################
369 # check cross compile
378 if compile_prog "" "" "cross"; then
379 $TMPE 2>/dev/null || cross_compile="yes"
381 fatal "compile test failed"
384 ##########################################
387 if test "$cross_compile" = "no" ; then
389 #include <inttypes.h>
392 volatile uint32_t i=0x01234567;
393 return (*((uint8_t*)(&i))) == 0x67;
396 if compile_prog "" "" "endian"; then
397 $TMPE && bigendian="yes"
400 # If we're cross compiling, try our best to work it out and rely on the
401 # run-time check to fail if we get it wrong.
406 #if __BYTE_ORDER != __BIG_ENDIAN
407 # error "Unknown endianness"
411 compile_prog "" "" "endian" && bigendian="yes"
412 check_define "__ARMEB__" && bigendian="yes"
413 check_define "__MIPSEB__" && bigendian="yes"
417 echo "Operating system $targetos"
419 echo "Big endian $bigendian"
421 echo "Cross compile $cross_compile"
424 ##########################################
425 # See if we need to build a static build
426 if test "$build_static" = "yes" ; then
427 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
428 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
432 echo "Static build $build_static"
434 ##########################################
439 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
442 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
446 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
448 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
451 fatal "Unknown wordsize"
453 echo "Wordsize $wordsize"
455 ##########################################
463 if (inflateInit(&stream) != Z_OK)
468 if compile_prog "" "-lz" "zlib" ; then
474 ##########################################
486 if compile_prog "" "-laio" "libaio" ; then
490 if test "$libaio" = "yes" ; then
491 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
495 echo "Linux AIO support $libaio"
497 ##########################################
510 if compile_prog "" "" "posixaio" ; then
512 elif compile_prog "" "-lrt" "posixaio"; then
517 echo "POSIX AIO support $posix_aio"
518 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
520 ##########################################
521 # posix aio fsync probe
523 if test "$posix_aio" = "yes" ; then
530 return aio_fsync(O_SYNC, &cb);
534 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
538 echo "POSIX AIO fsync $posix_aio_fsync"
540 ##########################################
544 #include <sys/types.h>
545 #include <sys/asynch.h>
550 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
554 if compile_prog "" "-laio" "solarisaio" ; then
558 echo "Solaris AIO support $solaris_aio"
560 ##########################################
561 # __sync_fetch_and_add test
564 #include <inttypes.h>
565 static int sfaa(uint64_t *ptr)
567 return __sync_fetch_and_add(ptr, 0);
570 int main(int argc, char **argv)
577 if compile_prog "" "" "__sync_fetch_and_add()" ; then
580 echo "__sync_fetch_and_add $sfaa"
582 ##########################################
587 #include <infiniband/arch.h>
588 int main(int argc, char **argv)
590 struct ibv_pd *pd = ibv_alloc_pd(NULL);
594 if compile_prog "" "-libverbs" "libverbs" ; then
596 LIBS="-libverbs $LIBS"
598 echo "libverbs $libverbs"
600 ##########################################
605 #include <rdma/rdma_cma.h>
606 int main(int argc, char **argv)
608 rdma_destroy_qp(NULL);
612 if compile_prog "" "-lrdmacm" "rdma"; then
614 LIBS="-lrdmacm $LIBS"
616 echo "rdmacm $rdmacm"
618 ##########################################
619 # Linux fallocate probe
624 #include <linux/falloc.h>
625 int main(int argc, char **argv)
627 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
631 if compile_prog "" "" "linux_fallocate"; then
632 linux_fallocate="yes"
634 echo "Linux fallocate $linux_fallocate"
636 ##########################################
637 # POSIX fadvise probe
642 int main(int argc, char **argv)
644 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
648 if compile_prog "" "" "posix_fadvise"; then
651 echo "POSIX fadvise $posix_fadvise"
653 ##########################################
654 # POSIX fallocate probe
659 int main(int argc, char **argv)
661 int r = posix_fallocate(0, 0, 1024);
665 if compile_prog "" "" "posix_fallocate"; then
666 posix_fallocate="yes"
668 echo "POSIX fallocate $posix_fallocate"
670 ##########################################
671 # sched_set/getaffinity 2 or 3 argument test
672 linux_2arg_affinity="no"
673 linux_3arg_affinity="no"
676 int main(int argc, char **argv)
679 return sched_setaffinity(0, sizeof(mask), &mask);
682 if compile_prog "" "" "sched_setaffinity(,,)"; then
683 linux_3arg_affinity="yes"
687 int main(int argc, char **argv)
690 return sched_setaffinity(0, &mask);
693 if compile_prog "" "" "sched_setaffinity(,)"; then
694 linux_2arg_affinity="yes"
697 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
698 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
700 ##########################################
701 # clock_gettime probe
706 int main(int argc, char **argv)
708 return clock_gettime(0, NULL);
711 if compile_prog "" "" "clock_gettime"; then
713 elif compile_prog "" "-lrt" "clock_gettime"; then
717 echo "clock_gettime $clock_gettime"
719 ##########################################
720 # CLOCK_MONOTONIC probe
722 if test "$clock_gettime" = "yes" ; then
726 int main(int argc, char **argv)
728 return clock_gettime(CLOCK_MONOTONIC, NULL);
731 if compile_prog "" "$LIBS" "clock monotonic"; then
732 clock_monotonic="yes"
735 echo "CLOCK_MONOTONIC $clock_monotonic"
737 ##########################################
738 # CLOCK_MONOTONIC_RAW probe
739 clock_monotonic_raw="no"
740 if test "$clock_gettime" = "yes" ; then
744 int main(int argc, char **argv)
746 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
749 if compile_prog "" "$LIBS" "clock monotonic"; then
750 clock_monotonic_raw="yes"
753 echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
755 ##########################################
756 # CLOCK_MONOTONIC_PRECISE probe
757 clock_monotonic_precise="no"
758 if test "$clock_gettime" = "yes" ; then
762 int main(int argc, char **argv)
764 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
767 if compile_prog "" "$LIBS" "clock monotonic precise"; then
768 clock_monotonic_precise="yes"
771 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
773 ##########################################
774 # gettimeofday() probe
777 #include <sys/time.h>
779 int main(int argc, char **argv)
782 return gettimeofday(&tv, NULL);
785 if compile_prog "" "" "gettimeofday"; then
788 echo "gettimeofday $gettimeofday"
790 ##########################################
796 int main(int argc, char **argv)
801 if compile_prog "" "" "fdatasync"; then
804 echo "fdatasync $fdatasync"
806 ##########################################
807 # sync_file_range() probe
813 #include <linux/fs.h>
814 int main(int argc, char **argv)
816 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
817 SYNC_FILE_RANGE_WAIT_AFTER;
818 return sync_file_range(0, 0, 0, flags);
821 if compile_prog "" "" "sync_file_range"; then
822 sync_file_range="yes"
824 echo "sync_file_range $sync_file_range"
826 ##########################################
827 # ext4 move extent probe
831 #include <sys/ioctl.h>
832 int main(int argc, char **argv)
834 struct move_extent me;
835 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
838 if compile_prog "" "" "ext4 move extent" ; then
840 elif test $targetos = "Linux" ; then
841 # On Linux, just default to it on and let it error at runtime if we really
842 # don't have it. None of my updated systems have it defined, but it does
843 # work. Takes a while to bubble back.
846 echo "EXT4 move extent $ext4_me"
848 ##########################################
854 int main(int argc, char **argv)
856 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
859 if compile_prog "" "" "linux splice"; then
862 echo "Linux splice(2) $linux_splice"
864 ##########################################
869 #include <guasi_syscalls.h>
870 int main(int argc, char **argv)
872 guasi_t ctx = guasi_create(0, 0, 0);
876 if compile_prog "" "" "guasi"; then
881 ##########################################
885 #include <nvm/nvm_primitives.h>
886 int main(int argc, char **argv)
888 nvm_version_t ver_info;
891 handle = nvm_get_handle(0, &ver_info);
892 return nvm_atomic_write(handle, 0, 0, 0);
895 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
896 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
899 echo "Fusion-io atomic engine $fusion_aw"
901 ##########################################
906 int main(int argc, char **argv)
908 return numa_available();
911 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
915 echo "libnuma $libnuma"
917 ##########################################
918 # libnuma 2.x version API
919 if test "$libnuma" = "yes" ; then
923 int main(int argc, char **argv)
925 struct bitmask *mask = numa_parse_nodestring(NULL);
926 return mask->size == 0;
929 if compile_prog "" "" "libnuma api"; then
932 echo "libnuma v2 $libnuma_v2"
935 ##########################################
940 int main(int argc, char **argv)
942 static char *string = "This is a string";
943 strsep(&string, "needle");
947 if compile_prog "" "" "strsep"; then
950 echo "strsep $strsep"
952 ##########################################
957 int main(int argc, char **argv)
959 return strcasestr(argv[0], argv[1]) != NULL;
962 if compile_prog "" "" "strcasestr"; then
965 echo "strcasestr $strcasestr"
967 ##########################################
968 # getopt_long_only() probe
969 getopt_long_only="no"
974 int main(int argc, char **argv)
976 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
980 if compile_prog "" "" "getopt_long_only"; then
981 getopt_long_only="yes"
983 echo "getopt_long_only() $getopt_long_only"
985 ##########################################
989 #include <sys/socket.h>
990 #include <arpa/inet.h>
992 int main(int argc, char **argv)
995 return inet_aton(NULL, &in);
998 if compile_prog "" "" "inet_aton"; then
1001 echo "inet_aton $inet_aton"
1003 ##########################################
1007 #include <sys/socket.h>
1008 int main(int argc, char **argv)
1014 if compile_prog "" "" "socklen_t"; then
1017 echo "socklen_t $socklen_t"
1019 ##########################################
1020 # Whether or not __thread is supported for TLS
1024 static __thread int ret;
1025 int main(int argc, char **argv)
1030 if compile_prog "" "" "__thread"; then
1033 echo "__thread $tls_thread"
1035 ##########################################
1036 # Check if we have required gtk/glib support for gfio
1038 if test "$gfio_check" = "yes" ; then
1042 #include <gtk/gtk.h>
1045 gdk_threads_enter();
1046 gdk_threads_leave();
1048 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1051 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1052 ORG_LDFLAGS=$LDFLAGS
1053 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1054 if test "$?" != "0" ; then
1055 echo "configure: gtk and gthread not found"
1058 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1059 if test "$?" != "0" ; then
1060 echo "configure: gtk and gthread not found"
1063 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1065 if test "$r" != "0" ; then
1067 GFIO_LIBS="$LIBS $GTK_LIBS"
1068 CFLAGS="$CFLAGS $GTK_CFLAGS"
1070 echo "GTK found, but need version 2.18 or higher"
1074 echo "Please install gtk and gdk libraries"
1077 LDFLAGS=$ORG_LDFLAGS
1080 if test "$gfio_check" = "yes" ; then
1081 echo "gtk 2.18 or higher $gfio"
1084 # Check whether we have getrusage(RUSAGE_THREAD)
1087 #include <sys/time.h>
1088 #include <sys/resource.h>
1089 int main(int argc, char **argv)
1092 getrusage(RUSAGE_THREAD, &ru);
1096 if compile_prog "" "" "RUSAGE_THREAD"; then
1099 echo "RUSAGE_THREAD $rusage_thread"
1101 ##########################################
1102 # Check whether we have SCHED_IDLE
1106 int main(int argc, char **argv)
1108 struct sched_param p;
1109 return sched_setscheduler(0, SCHED_IDLE, &p);
1112 if compile_prog "" "" "SCHED_IDLE"; then
1115 echo "SCHED_IDLE $sched_idle"
1117 ##########################################
1118 # Check whether we have TCP_NODELAY
1122 #include <sys/types.h>
1123 #include <sys/socket.h>
1124 #include <netinet/tcp.h>
1125 int main(int argc, char **argv)
1127 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1130 if compile_prog "" "" "TCP_NODELAY"; then
1133 echo "TCP_NODELAY $tcp_nodelay"
1135 ##########################################
1136 # Check whether we have SO_SNDBUF
1140 #include <sys/types.h>
1141 #include <sys/socket.h>
1142 #include <netinet/tcp.h>
1143 int main(int argc, char **argv)
1145 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1146 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1149 if compile_prog "" "" "SO_SNDBUF"; then
1152 echo "Net engine window_size $window_size"
1154 ##########################################
1155 # Check whether we have TCP_MAXSEG
1159 #include <sys/types.h>
1160 #include <sys/socket.h>
1161 #include <netinet/tcp.h>
1162 #include <arpa/inet.h>
1163 #include <netinet/in.h>
1164 int main(int argc, char **argv)
1166 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1169 if compile_prog "" "" "TCP_MAXSEG"; then
1172 echo "TCP_MAXSEG $mss"
1174 ##########################################
1175 # Check whether we have RLIMIT_MEMLOCK
1178 #include <sys/time.h>
1179 #include <sys/resource.h>
1180 int main(int argc, char **argv)
1183 return getrlimit(RLIMIT_MEMLOCK, &rl);
1186 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1187 rlimit_memlock="yes"
1189 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1191 ##########################################
1192 # Check whether we have pwritev/preadv
1196 #include <sys/uio.h>
1197 int main(int argc, char **argv)
1199 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1202 if compile_prog "" "" "pwritev"; then
1205 echo "pwritev/preadv $pwritev"
1207 ##########################################
1208 # Check whether we have the required functions for ipv6
1211 #include <sys/types.h>
1212 #include <sys/socket.h>
1213 #include <netinet/in.h>
1216 int main(int argc, char **argv)
1218 struct addrinfo hints;
1219 struct in6_addr addr;
1222 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1224 printf("%s\n", gai_strerror(ret));
1229 if compile_prog "" "" "ipv6"; then
1232 echo "IPv6 helpers $ipv6"
1234 ##########################################
1238 #include <rbd/librbd.h>
1240 int main(int argc, char **argv)
1244 rados_ioctx_t io_ctx;
1245 const char pool[] = "rbd";
1247 int major, minor, extra;
1248 rbd_version(&major, &minor, &extra);
1250 rados_ioctx_create(cluster, pool, &io_ctx);
1254 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1255 LIBS="-lrbd -lrados $LIBS"
1258 echo "Rados Block Device engine $rbd"
1260 ##########################################
1261 # check for rbd_invaidate_cache()
1263 if test "$rbd" = "yes"; then
1265 #include <rbd/librbd.h>
1267 int main(int argc, char **argv)
1271 return rbd_invalidate_cache(image);
1274 if compile_prog "" "-lrbd -lrados" "rbd"; then
1277 echo "rbd_invalidate_cache $rbd_inval"
1280 ##########################################
1281 # Check whether we have setvbuf
1285 int main(int argc, char **argv)
1289 setvbuf(f, buf, _IOFBF, sizeof(buf));
1293 if compile_prog "" "" "setvbuf"; then
1296 echo "setvbuf $setvbuf"
1301 #include <glusterfs/api/glfs.h>
1303 int main(int argc, char **argv)
1306 glfs_t *g = glfs_new("foo");
1311 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1312 LIBS="-lgfapi -lglusterfs $LIBS"
1315 echo "Gluster API engine $gfapi"
1317 ##########################################
1318 # check for gfapi fadvise support
1319 if test "$gfapi" = "yes" ; then
1322 #include <glusterfs/api/glfs.h>
1324 int main(int argc, char **argv)
1327 int ret = glfs_fadvise(fd, 0, 0, 1);
1332 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1335 echo "Gluster API use fadvise $gf_fadvise"
1338 ##########################################
1339 # check for gfapi trim support
1341 if test "$gfapi" = "yes" ; then
1343 #include <glusterfs/api/glfs.h>
1345 int main(int argc, char **argv)
1347 return glfs_discard_async(NULL, 0, 0);
1350 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1353 echo "Gluster API trim support $gf_trim"
1356 ##########################################
1357 # Check if we support stckf on s390
1358 s390_z196_facilities="no"
1360 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1361 int main(int argc, char **argv)
1363 /* We want just 1 double word to be returned. */
1364 register unsigned long reg0 asm("0") = 0;
1365 unsigned long stfle_bits;
1366 asm volatile(".machine push" "\n\t"
1367 ".machine \"z9-109\"" "\n\t"
1370 : "=QS" (stfle_bits), "+d" (reg0)
1373 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1379 if compile_prog "" "" "s390_z196_facilities"; then
1381 if [[ $? -eq 0 ]]; then
1382 s390_z196_facilities="yes"
1385 echo "s390_z196_facilities $s390_z196_facilities"
1387 ##########################################
1388 # Check if we have required environment variables configured for libhdfs
1389 if test "$libhdfs" = "yes" ; then
1391 if test "$JAVA_HOME" = "" ; then
1392 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1395 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1396 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1399 if test "$FIO_LIBHDFS_LIB" = "" ; then
1400 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1403 if test "$hdfs_conf_error" = "1" ; then
1407 echo "HDFS engine $libhdfs"
1409 ##########################################
1410 # Check whether we have MTD
1414 #include <mtd/mtd-user.h>
1415 #include <sys/ioctl.h>
1416 int main(int argc, char **argv)
1418 struct mtd_write_req ops;
1419 struct mtd_info_user info;
1420 memset(&ops, 0, sizeof(ops));
1421 info.type = MTD_MLCNANDFLASH;
1422 return ioctl(0, MEMGETINFO, &info);
1425 if compile_prog "" "" "mtd"; then
1430 # Check if we have lex/yacc available
1435 if test "$targetos" != "SunOS" ; then
1436 LEX=$(which lex 2> /dev/null)
1437 if test -x "$LEX" ; then
1440 YACC=$(which bison 2> /dev/null)
1441 if test -x "$YACC" ; then
1445 YACC=$(which yacc 2> /dev/null)
1446 if test -x "$YACC" ; then
1450 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1454 if test "$arith" = "yes" ; then
1456 extern int yywrap(void);
1458 int main(int argc, char **argv)
1464 if compile_prog "" "-ll" "lex"; then
1472 echo "lex/yacc for arithmetic $arith"
1474 ##########################################
1475 # Check whether we have setmntent/getmntent
1480 int main(int argc, char **argv)
1482 FILE *mtab = setmntent(NULL, "r");
1483 struct mntent *mnt = getmntent(mtab);
1488 if compile_prog "" "" "getmntent"; then
1491 echo "getmntent $getmntent"
1493 ##########################################
1494 # Check whether we have getmntinfo
1498 #include <sys/param.h>
1499 #include <sys/mount.h>
1500 int main(int argc, char **argv)
1503 return getmntinfo(&st, MNT_NOWAIT);
1506 if compile_prog "" "" "getmntinfo"; then
1509 echo "getmntinfo $getmntinfo"
1511 ##########################################
1512 # Check whether we have _Static_assert
1518 #ifdef __compiler_offsetof
1519 #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1521 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1524 #define container_of(ptr, type, member) ({ \
1525 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
1526 (type *)( (char *)__mptr - offsetof(type,member) );})
1532 int main(int argc, char **argv)
1534 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
1538 if compile_prog "" "" "static_assert"; then
1541 echo "Static Assert $static_assert"
1542 #############################################################################
1544 if test "$wordsize" = "64" ; then
1545 output_sym "CONFIG_64BIT"
1546 elif test "$wordsize" = "32" ; then
1547 output_sym "CONFIG_32BIT"
1549 fatal "Unknown wordsize!"
1551 if test "$bigendian" = "yes" ; then
1552 output_sym "CONFIG_BIG_ENDIAN"
1554 output_sym "CONFIG_LITTLE_ENDIAN"
1556 if test "$zlib" = "yes" ; then
1557 output_sym "CONFIG_ZLIB"
1559 if test "$libaio" = "yes" ; then
1560 output_sym "CONFIG_LIBAIO"
1562 if test "$posix_aio" = "yes" ; then
1563 output_sym "CONFIG_POSIXAIO"
1565 if test "$posix_aio_fsync" = "yes" ; then
1566 output_sym "CONFIG_POSIXAIO_FSYNC"
1568 if test "$linux_fallocate" = "yes" ; then
1569 output_sym "CONFIG_LINUX_FALLOCATE"
1571 if test "$posix_fallocate" = "yes" ; then
1572 output_sym "CONFIG_POSIX_FALLOCATE"
1574 if test "$fdatasync" = "yes" ; then
1575 output_sym "CONFIG_FDATASYNC"
1577 if test "$sync_file_range" = "yes" ; then
1578 output_sym "CONFIG_SYNC_FILE_RANGE"
1580 if test "$sfaa" = "yes" ; then
1581 output_sym "CONFIG_SFAA"
1583 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1584 output_sym "CONFIG_RDMA"
1586 if test "$clock_gettime" = "yes" ; then
1587 output_sym "CONFIG_CLOCK_GETTIME"
1589 if test "$clock_monotonic" = "yes" ; then
1590 output_sym "CONFIG_CLOCK_MONOTONIC"
1592 if test "$clock_monotonic_raw" = "yes" ; then
1593 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1595 if test "$clock_monotonic_precise" = "yes" ; then
1596 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1598 if test "$gettimeofday" = "yes" ; then
1599 output_sym "CONFIG_GETTIMEOFDAY"
1601 if test "$posix_fadvise" = "yes" ; then
1602 output_sym "CONFIG_POSIX_FADVISE"
1604 if test "$linux_3arg_affinity" = "yes" ; then
1605 output_sym "CONFIG_3ARG_AFFINITY"
1606 elif test "$linux_2arg_affinity" = "yes" ; then
1607 output_sym "CONFIG_2ARG_AFFINITY"
1609 if test "$strsep" = "yes" ; then
1610 output_sym "CONFIG_STRSEP"
1612 if test "$strcasestr" = "yes" ; then
1613 output_sym "CONFIG_STRCASESTR"
1615 if test "$getopt_long_only" = "yes" ; then
1616 output_sym "CONFIG_GETOPT_LONG_ONLY"
1618 if test "$inet_aton" = "yes" ; then
1619 output_sym "CONFIG_INET_ATON"
1621 if test "$socklen_t" = "yes" ; then
1622 output_sym "CONFIG_SOCKLEN_T"
1624 if test "$ext4_me" = "yes" ; then
1625 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1627 if test "$linux_splice" = "yes" ; then
1628 output_sym "CONFIG_LINUX_SPLICE"
1630 if test "$guasi" = "yes" ; then
1631 output_sym "CONFIG_GUASI"
1633 if test "$fusion_aw" = "yes" ; then
1634 output_sym "CONFIG_FUSION_AW"
1636 if test "$libnuma_v2" = "yes" ; then
1637 output_sym "CONFIG_LIBNUMA"
1639 if test "$solaris_aio" = "yes" ; then
1640 output_sym "CONFIG_SOLARISAIO"
1642 if test "$tls_thread" = "yes" ; then
1643 output_sym "CONFIG_TLS_THREAD"
1645 if test "$rusage_thread" = "yes" ; then
1646 output_sym "CONFIG_RUSAGE_THREAD"
1648 if test "$gfio" = "yes" ; then
1649 echo "CONFIG_GFIO=y" >> $config_host_mak
1651 if test "$esx" = "yes" ; then
1652 output_sym "CONFIG_ESX"
1653 output_sym "CONFIG_NO_SHM"
1655 if test "$sched_idle" = "yes" ; then
1656 output_sym "CONFIG_SCHED_IDLE"
1658 if test "$tcp_nodelay" = "yes" ; then
1659 output_sym "CONFIG_TCP_NODELAY"
1661 if test "$window_size" = "yes" ; then
1662 output_sym "CONFIG_NET_WINDOWSIZE"
1664 if test "$mss" = "yes" ; then
1665 output_sym "CONFIG_NET_MSS"
1667 if test "$rlimit_memlock" = "yes" ; then
1668 output_sym "CONFIG_RLIMIT_MEMLOCK"
1670 if test "$pwritev" = "yes" ; then
1671 output_sym "CONFIG_PWRITEV"
1673 if test "$ipv6" = "yes" ; then
1674 output_sym "CONFIG_IPV6"
1676 if test "$rbd" = "yes" ; then
1677 output_sym "CONFIG_RBD"
1679 if test "$rbd_inval" = "yes" ; then
1680 output_sym "CONFIG_RBD_INVAL"
1682 if test "$setvbuf" = "yes" ; then
1683 output_sym "CONFIG_SETVBUF"
1685 if test "$s390_z196_facilities" = "yes" ; then
1686 output_sym "CONFIG_S390_Z196_FACILITIES"
1687 CFLAGS="$CFLAGS -march=z9-109"
1689 if test "$gfapi" = "yes" ; then
1690 output_sym "CONFIG_GFAPI"
1692 if test "$gf_fadvise" = "yes" ; then
1693 output_sym "CONFIG_GF_FADVISE"
1695 if test "$gf_trim" = "yes" ; then
1696 output_sym "CONFIG_GF_TRIM"
1698 if test "$libhdfs" = "yes" ; then
1699 output_sym "CONFIG_LIBHDFS"
1700 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1701 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1702 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1704 if test "$mtd" = "yes" ; then
1705 output_sym "CONFIG_MTD"
1707 if test "$arith" = "yes" ; then
1708 output_sym "CONFIG_ARITHMETIC"
1709 if test "$yacc_is_bison" = "yes" ; then
1710 echo "YACC=$YACC -y" >> $config_host_mak
1712 echo "YACC=$YACC" >> $config_host_mak
1715 if test "$getmntent" = "yes" ; then
1716 output_sym "CONFIG_GETMNTENT"
1718 if test "$getmntinfo" = "yes" ; then
1719 output_sym "CONFIG_GETMNTINFO"
1721 if test "$static_assert" = "yes" ; then
1722 output_sym "CONFIG_STATIC_ASSERT"
1725 if test "$zlib" = "no" ; then
1726 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1729 echo "LIBS+=$LIBS" >> $config_host_mak
1730 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1731 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1732 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1733 echo "CC=$cc" >> $config_host_mak
1734 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
1735 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
1737 if [ `dirname $0` != "." -a ! -e Makefile ]; then
1738 cat > Makefile <<EOF
1739 SRCDIR:=`dirname $0`
1740 include \$(SRCDIR)/Makefile