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
146 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
148 --prefix=*) prefix="$optarg"
150 --cpu=*) cpu="$optarg"
152 # esx is cross compiled and cannot be detect through simple uname calls
158 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
160 --build-32bit-win) build_32bit_win="yes"
162 --build-static) build_static="yes"
167 --disable-numa) disable_numa="yes"
169 --disable-rbd) disable_rbd="yes"
171 --disable-rbd-blkin) disable_rbd_blkin="yes"
173 --disable-gfapi) disable_gfapi="yes"
175 --enable-libhdfs) libhdfs="yes"
177 --disable-lex) disable_lex="yes"
179 --enable-lex) disable_lex="no"
181 --disable-shm) no_shm="yes"
183 --disable-optimizations) disable_opt="yes"
185 --disable-pmem) disable_pmem="yes"
191 echo "Bad option $opt"
197 if test "$show_help" = "yes" ; then
198 echo "--prefix= Use this directory as installation prefix"
199 echo "--cpu= Specify target CPU if auto-detect fails"
200 echo "--cc= Specify compiler to use"
201 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
202 echo "--build-32bit-win Enable 32-bit build on Windows"
203 echo "--build-static Build a static fio"
204 echo "--esx Configure build options for esx"
205 echo "--enable-gfio Enable building of gtk gfio"
206 echo "--disable-numa Disable libnuma even if found"
207 echo "--disable-gfapi Disable gfapi"
208 echo "--enable-libhdfs Enable hdfs support"
209 echo "--disable-lex Disable use of lex/yacc for math"
210 echo "--disable-pmem Disable pmem based engines even if found"
211 echo "--enable-lex Enable use of lex/yacc for math"
212 echo "--disable-shm Disable SHM support"
213 echo "--disable-optimizations Don't enable compiler optimizations"
217 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
218 cc="${CC-${cross_prefix}gcc}"
220 if check_define __ANDROID__ ; then
222 elif check_define __linux__ ; then
224 elif check_define __OpenBSD__ ; then
226 elif check_define __sun__ ; then
228 CFLAGS="$CFLAGS -D_REENTRANT"
229 elif check_define _WIN32 ; then
235 echo "# Automatically generated by configure - do not modify" > $config_host_mak
236 printf "# Configured with:" >> $config_host_mak
237 printf " '%s'" "$0" "$@" >> $config_host_mak
238 echo >> $config_host_mak
239 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
241 if test "$no_shm" = "yes" ; then
242 output_sym "CONFIG_NO_SHM"
245 if test "$disable_opt" = "yes" ; then
246 output_sym "CONFIG_FIO_NO_OPT"
249 # Some host OSes need non-standard checks for which CPU to use.
250 # Note that these checks are broken for cross-compilation: if you're
251 # cross-compiling to one of these OSes then you'll need to specify
252 # the correct CPU with the --cpu option.
255 # Unless explicitly enabled, turn off lex.
256 if test -z "$disable_lex" ; then
263 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
264 # we can run 64-bit userspace code.
265 # If the user didn't specify a CPU explicitly and the kernel says this is
266 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
268 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
273 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
274 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
277 LIBS="-lnsl -lsocket"
280 echo "Forcing known good options on Windows"
281 if test -z "$CC" ; then
282 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
283 CC="i686-w64-mingw32-gcc"
285 CC="x86_64-w64-mingw32-gcc"
288 output_sym "CONFIG_LITTLE_ENDIAN"
289 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
290 output_sym "CONFIG_32BIT"
292 output_sym "CONFIG_64BIT_LLP64"
294 output_sym "CONFIG_FADVISE"
295 output_sym "CONFIG_SOCKLEN_T"
296 output_sym "CONFIG_FADVISE"
297 output_sym "CONFIG_SFAA"
298 output_sym "CONFIG_RUSAGE_THREAD"
299 output_sym "CONFIG_WINDOWSAIO"
300 output_sym "CONFIG_FDATASYNC"
301 output_sym "CONFIG_CLOCK_MONOTONIC"
302 output_sym "CONFIG_GETTIMEOFDAY"
303 output_sym "CONFIG_CLOCK_GETTIME"
304 output_sym "CONFIG_SCHED_IDLE"
305 output_sym "CONFIG_TCP_NODELAY"
306 output_sym "CONFIG_TLS_THREAD"
307 output_sym "CONFIG_IPV6"
308 echo "CC=$CC" >> $config_host_mak
309 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
314 if test ! -z "$cpu" ; then
315 # command line argument
317 elif check_define __i386__ ; then
319 elif check_define __x86_64__ ; then
321 elif check_define __sparc__ ; then
322 if check_define __arch64__ ; then
327 elif check_define _ARCH_PPC ; then
328 if check_define _ARCH_PPC64 ; then
333 elif check_define __mips__ ; then
335 elif check_define __ia64__ ; then
337 elif check_define __s390__ ; then
338 if check_define __s390x__ ; then
343 elif check_define __arm__ ; then
345 elif check_define __hppa__ ; then
351 # Normalise host CPU name and set ARCH.
353 ia64|ppc|ppc64|s390|s390x|sparc64)
356 i386|i486|i586|i686|i86pc|BePC)
365 hppa|parisc|parisc64)
379 if test -z "$CC" ; then
380 if test "$targetos" = "FreeBSD"; then
389 cc="${CC-${cross_prefix}gcc}"
391 ##########################################
392 # check cross compile
401 if compile_prog "" "" "cross"; then
402 $TMPE 2>/dev/null || cross_compile="yes"
404 fatal "compile test failed"
407 ##########################################
410 if test "$cross_compile" = "no" ; then
412 #include <inttypes.h>
415 volatile uint32_t i=0x01234567;
416 return (*((uint8_t*)(&i))) == 0x67;
419 if compile_prog "" "" "endian"; then
420 $TMPE && bigendian="yes"
423 # If we're cross compiling, try our best to work it out and rely on the
424 # run-time check to fail if we get it wrong.
429 #if __BYTE_ORDER != __BIG_ENDIAN
430 # error "Unknown endianness"
434 compile_prog "" "" "endian" && bigendian="yes"
435 check_define "__ARMEB__" && bigendian="yes"
436 check_define "__MIPSEB__" && bigendian="yes"
440 echo "Operating system $targetos"
442 echo "Big endian $bigendian"
444 echo "Cross compile $cross_compile"
447 ##########################################
448 # See if we need to build a static build
449 if test "$build_static" = "yes" ; then
450 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
451 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
455 echo "Static build $build_static"
457 ##########################################
462 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
465 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
469 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
471 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
474 fatal "Unknown wordsize"
476 echo "Wordsize $wordsize"
478 ##########################################
486 if (inflateInit(&stream) != Z_OK)
491 if compile_prog "" "-lz" "zlib" ; then
497 ##########################################
500 if test "$esx" != "yes" ; then
510 if compile_prog "" "-laio" "libaio" ; then
514 if test "$libaio" = "yes" ; then
515 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
520 echo "Linux AIO support $libaio"
522 ##########################################
535 if compile_prog "" "" "posixaio" ; then
537 elif compile_prog "" "-lrt" "posixaio"; then
542 echo "POSIX AIO support $posix_aio"
543 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
545 ##########################################
546 # posix aio fsync probe
548 if test "$posix_aio" = "yes" ; then
555 return aio_fsync(O_SYNC, &cb);
559 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
563 echo "POSIX AIO fsync $posix_aio_fsync"
565 ##########################################
569 #include <sys/types.h>
570 #include <sys/asynch.h>
575 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
579 if compile_prog "" "-laio" "solarisaio" ; then
583 echo "Solaris AIO support $solaris_aio"
585 ##########################################
586 # __sync_fetch_and_add test
589 #include <inttypes.h>
590 static int sfaa(uint64_t *ptr)
592 return __sync_fetch_and_add(ptr, 0);
595 int main(int argc, char **argv)
602 if compile_prog "" "" "__sync_fetch_and_add()" ; then
605 echo "__sync_fetch_and_add $sfaa"
607 ##########################################
612 #include <infiniband/arch.h>
613 int main(int argc, char **argv)
615 struct ibv_pd *pd = ibv_alloc_pd(NULL);
619 if compile_prog "" "-libverbs" "libverbs" ; then
621 LIBS="-libverbs $LIBS"
623 echo "libverbs $libverbs"
625 ##########################################
630 #include <rdma/rdma_cma.h>
631 int main(int argc, char **argv)
633 rdma_destroy_qp(NULL);
637 if compile_prog "" "-lrdmacm" "rdma"; then
639 LIBS="-lrdmacm $LIBS"
641 echo "rdmacm $rdmacm"
643 ##########################################
644 # Linux fallocate probe
649 #include <linux/falloc.h>
650 int main(int argc, char **argv)
652 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
656 if compile_prog "" "" "linux_fallocate"; then
657 linux_fallocate="yes"
659 echo "Linux fallocate $linux_fallocate"
661 ##########################################
662 # POSIX fadvise probe
667 int main(int argc, char **argv)
669 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
673 if compile_prog "" "" "posix_fadvise"; then
676 echo "POSIX fadvise $posix_fadvise"
678 ##########################################
679 # POSIX fallocate probe
684 int main(int argc, char **argv)
686 int r = posix_fallocate(0, 0, 1024);
690 if compile_prog "" "" "posix_fallocate"; then
691 posix_fallocate="yes"
693 echo "POSIX fallocate $posix_fallocate"
695 ##########################################
696 # sched_set/getaffinity 2 or 3 argument test
697 linux_2arg_affinity="no"
698 linux_3arg_affinity="no"
701 int main(int argc, char **argv)
704 return sched_setaffinity(0, sizeof(mask), &mask);
707 if compile_prog "" "" "sched_setaffinity(,,)"; then
708 linux_3arg_affinity="yes"
712 int main(int argc, char **argv)
715 return sched_setaffinity(0, &mask);
718 if compile_prog "" "" "sched_setaffinity(,)"; then
719 linux_2arg_affinity="yes"
722 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
723 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
725 ##########################################
726 # clock_gettime probe
731 int main(int argc, char **argv)
733 return clock_gettime(0, NULL);
736 if compile_prog "" "" "clock_gettime"; then
738 elif compile_prog "" "-lrt" "clock_gettime"; then
742 echo "clock_gettime $clock_gettime"
744 ##########################################
745 # CLOCK_MONOTONIC probe
747 if test "$clock_gettime" = "yes" ; then
751 int main(int argc, char **argv)
753 return clock_gettime(CLOCK_MONOTONIC, NULL);
756 if compile_prog "" "$LIBS" "clock monotonic"; then
757 clock_monotonic="yes"
760 echo "CLOCK_MONOTONIC $clock_monotonic"
762 ##########################################
763 # CLOCK_MONOTONIC_RAW probe
764 clock_monotonic_raw="no"
765 if test "$clock_gettime" = "yes" ; then
769 int main(int argc, char **argv)
771 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
774 if compile_prog "" "$LIBS" "clock monotonic"; then
775 clock_monotonic_raw="yes"
778 echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
780 ##########################################
781 # CLOCK_MONOTONIC_PRECISE probe
782 clock_monotonic_precise="no"
783 if test "$clock_gettime" = "yes" ; then
787 int main(int argc, char **argv)
789 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
792 if compile_prog "" "$LIBS" "clock monotonic precise"; then
793 clock_monotonic_precise="yes"
796 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
798 ##########################################
805 int main(int argc, char **argv)
808 memset(&cid, 0, sizeof(cid));
809 return clock_gettime(cid, NULL);
812 if compile_prog "" "$LIBS" "clockid_t"; then
815 echo "clockid_t $clockid_t"
817 ##########################################
818 # gettimeofday() probe
821 #include <sys/time.h>
823 int main(int argc, char **argv)
826 return gettimeofday(&tv, NULL);
829 if compile_prog "" "" "gettimeofday"; then
832 echo "gettimeofday $gettimeofday"
834 ##########################################
840 int main(int argc, char **argv)
845 if compile_prog "" "" "fdatasync"; then
848 echo "fdatasync $fdatasync"
850 ##########################################
851 # sync_file_range() probe
857 #include <linux/fs.h>
858 int main(int argc, char **argv)
860 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
861 SYNC_FILE_RANGE_WAIT_AFTER;
862 return sync_file_range(0, 0, 0, flags);
865 if compile_prog "" "" "sync_file_range"; then
866 sync_file_range="yes"
868 echo "sync_file_range $sync_file_range"
870 ##########################################
871 # ext4 move extent probe
875 #include <sys/ioctl.h>
876 int main(int argc, char **argv)
878 struct move_extent me;
879 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
882 if compile_prog "" "" "ext4 move extent" ; then
884 elif test $targetos = "Linux" ; then
885 # On Linux, just default to it on and let it error at runtime if we really
886 # don't have it. None of my updated systems have it defined, but it does
887 # work. Takes a while to bubble back.
890 echo "EXT4 move extent $ext4_me"
892 ##########################################
898 int main(int argc, char **argv)
900 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
903 if compile_prog "" "" "linux splice"; then
906 echo "Linux splice(2) $linux_splice"
908 ##########################################
913 #include <guasi_syscalls.h>
914 int main(int argc, char **argv)
916 guasi_t ctx = guasi_create(0, 0, 0);
920 if compile_prog "" "" "guasi"; then
925 ##########################################
929 #include <nvm/nvm_primitives.h>
930 int main(int argc, char **argv)
932 nvm_version_t ver_info;
935 handle = nvm_get_handle(0, &ver_info);
936 return nvm_atomic_write(handle, 0, 0, 0);
939 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
940 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
943 echo "Fusion-io atomic engine $fusion_aw"
945 ##########################################
950 int main(int argc, char **argv)
952 return numa_available();
955 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
959 echo "libnuma $libnuma"
961 ##########################################
962 # libnuma 2.x version API
963 if test "$libnuma" = "yes" ; then
967 int main(int argc, char **argv)
969 struct bitmask *mask = numa_parse_nodestring(NULL);
970 return mask->size == 0;
973 if compile_prog "" "" "libnuma api"; then
976 echo "libnuma v2 $libnuma_v2"
979 ##########################################
984 int main(int argc, char **argv)
986 static char *string = "This is a string";
987 strsep(&string, "needle");
991 if compile_prog "" "" "strsep"; then
994 echo "strsep $strsep"
996 ##########################################
1001 int main(int argc, char **argv)
1003 return strcasestr(argv[0], argv[1]) != NULL;
1006 if compile_prog "" "" "strcasestr"; then
1009 echo "strcasestr $strcasestr"
1011 ##########################################
1016 int main(int argc, char **argv)
1018 static char dst[64];
1019 static char *string = "This is a string";
1020 memset(dst, 0, sizeof(dst));
1021 strlcat(dst, string, sizeof(dst));
1025 if compile_prog "" "" "strlcat"; then
1028 echo "strlcat $strlcat"
1030 ##########################################
1031 # getopt_long_only() probe
1032 getopt_long_only="no"
1037 int main(int argc, char **argv)
1039 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1043 if compile_prog "" "" "getopt_long_only"; then
1044 getopt_long_only="yes"
1046 echo "getopt_long_only() $getopt_long_only"
1048 ##########################################
1052 #include <sys/socket.h>
1053 #include <arpa/inet.h>
1055 int main(int argc, char **argv)
1058 return inet_aton(NULL, &in);
1061 if compile_prog "" "" "inet_aton"; then
1064 echo "inet_aton $inet_aton"
1066 ##########################################
1070 #include <sys/socket.h>
1071 int main(int argc, char **argv)
1077 if compile_prog "" "" "socklen_t"; then
1080 echo "socklen_t $socklen_t"
1082 ##########################################
1083 # Whether or not __thread is supported for TLS
1087 static __thread int ret;
1088 int main(int argc, char **argv)
1093 if compile_prog "" "" "__thread"; then
1096 echo "__thread $tls_thread"
1098 ##########################################
1099 # Check if we have required gtk/glib support for gfio
1101 if test "$gfio_check" = "yes" ; then
1105 #include <gtk/gtk.h>
1108 gdk_threads_enter();
1109 gdk_threads_leave();
1111 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1114 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1115 ORG_LDFLAGS=$LDFLAGS
1116 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1117 if test "$?" != "0" ; then
1118 echo "configure: gtk and gthread not found"
1121 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1122 if test "$?" != "0" ; then
1123 echo "configure: gtk and gthread not found"
1126 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1128 if test "$r" != "0" ; then
1130 GFIO_LIBS="$LIBS $GTK_LIBS"
1131 CFLAGS="$CFLAGS $GTK_CFLAGS"
1133 echo "GTK found, but need version 2.18 or higher"
1137 echo "Please install gtk and gdk libraries"
1140 LDFLAGS=$ORG_LDFLAGS
1143 if test "$gfio_check" = "yes" ; then
1144 echo "gtk 2.18 or higher $gfio"
1147 # Check whether we have getrusage(RUSAGE_THREAD)
1150 #include <sys/time.h>
1151 #include <sys/resource.h>
1152 int main(int argc, char **argv)
1155 getrusage(RUSAGE_THREAD, &ru);
1159 if compile_prog "" "" "RUSAGE_THREAD"; then
1162 echo "RUSAGE_THREAD $rusage_thread"
1164 ##########################################
1165 # Check whether we have SCHED_IDLE
1169 int main(int argc, char **argv)
1171 struct sched_param p;
1172 return sched_setscheduler(0, SCHED_IDLE, &p);
1175 if compile_prog "" "" "SCHED_IDLE"; then
1178 echo "SCHED_IDLE $sched_idle"
1180 ##########################################
1181 # Check whether we have TCP_NODELAY
1185 #include <sys/types.h>
1186 #include <sys/socket.h>
1187 #include <netinet/tcp.h>
1188 int main(int argc, char **argv)
1190 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1193 if compile_prog "" "" "TCP_NODELAY"; then
1196 echo "TCP_NODELAY $tcp_nodelay"
1198 ##########################################
1199 # Check whether we have SO_SNDBUF
1203 #include <sys/types.h>
1204 #include <sys/socket.h>
1205 #include <netinet/tcp.h>
1206 int main(int argc, char **argv)
1208 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1209 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1212 if compile_prog "" "" "SO_SNDBUF"; then
1215 echo "Net engine window_size $window_size"
1217 ##########################################
1218 # Check whether we have TCP_MAXSEG
1222 #include <sys/types.h>
1223 #include <sys/socket.h>
1224 #include <netinet/tcp.h>
1225 #include <arpa/inet.h>
1226 #include <netinet/in.h>
1227 int main(int argc, char **argv)
1229 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1232 if compile_prog "" "" "TCP_MAXSEG"; then
1235 echo "TCP_MAXSEG $mss"
1237 ##########################################
1238 # Check whether we have RLIMIT_MEMLOCK
1241 #include <sys/time.h>
1242 #include <sys/resource.h>
1243 int main(int argc, char **argv)
1246 return getrlimit(RLIMIT_MEMLOCK, &rl);
1249 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1250 rlimit_memlock="yes"
1252 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1254 ##########################################
1255 # Check whether we have pwritev/preadv
1259 #include <sys/uio.h>
1260 int main(int argc, char **argv)
1262 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1265 if compile_prog "" "" "pwritev"; then
1268 echo "pwritev/preadv $pwritev"
1270 ##########################################
1271 # Check whether we have pwritev2/preadv2
1275 #include <sys/uio.h>
1276 int main(int argc, char **argv)
1278 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1281 if compile_prog "" "" "pwritev2"; then
1284 echo "pwritev2/preadv2 $pwritev2"
1286 ##########################################
1287 # Check whether we have the required functions for ipv6
1290 #include <sys/types.h>
1291 #include <sys/socket.h>
1292 #include <netinet/in.h>
1295 int main(int argc, char **argv)
1297 struct addrinfo hints;
1298 struct in6_addr addr;
1301 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1303 printf("%s\n", gai_strerror(ret));
1308 if compile_prog "" "" "ipv6"; then
1311 echo "IPv6 helpers $ipv6"
1313 ##########################################
1317 #include <rbd/librbd.h>
1319 int main(int argc, char **argv)
1323 rados_ioctx_t io_ctx;
1324 const char pool[] = "rbd";
1326 int major, minor, extra;
1327 rbd_version(&major, &minor, &extra);
1329 rados_ioctx_create(cluster, pool, &io_ctx);
1333 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1334 LIBS="-lrbd -lrados $LIBS"
1337 echo "Rados Block Device engine $rbd"
1339 ##########################################
1340 # check for rbd_poll
1342 if test "$rbd" = "yes"; then
1344 #include <rbd/librbd.h>
1345 #include <sys/eventfd.h>
1347 int main(int argc, char **argv)
1350 rbd_completion_t comp;
1352 int fd = eventfd(0, EFD_NONBLOCK);
1353 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1354 rbd_poll_io_events(image, comp, 1);
1359 if compile_prog "" "-lrbd -lrados" "rbd"; then
1362 echo "rbd_poll $rbd_poll"
1365 ##########################################
1366 # check for rbd_invaidate_cache()
1368 if test "$rbd" = "yes"; then
1370 #include <rbd/librbd.h>
1372 int main(int argc, char **argv)
1376 return rbd_invalidate_cache(image);
1379 if compile_prog "" "-lrbd -lrados" "rbd"; then
1382 echo "rbd_invalidate_cache $rbd_inval"
1385 ##########################################
1389 #include <rbd/librbd.h>
1390 #include <zipkin_c.h>
1392 int main(int argc, char **argv)
1395 struct blkin_trace_info t_info;
1396 blkin_init_trace_info(&t_info);
1397 rbd_completion_t completion;
1402 r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
1406 if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
1407 && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
1408 LIBS="-lblkin $LIBS"
1411 echo "rbd blkin tracing $rbd_blkin"
1413 ##########################################
1414 # Check whether we have setvbuf
1418 int main(int argc, char **argv)
1422 setvbuf(f, buf, _IOFBF, sizeof(buf));
1426 if compile_prog "" "" "setvbuf"; then
1429 echo "setvbuf $setvbuf"
1434 #include <glusterfs/api/glfs.h>
1436 int main(int argc, char **argv)
1439 glfs_t *g = glfs_new("foo");
1444 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1445 LIBS="-lgfapi -lglusterfs $LIBS"
1448 echo "Gluster API engine $gfapi"
1450 ##########################################
1451 # check for gfapi fadvise support
1452 if test "$gfapi" = "yes" ; then
1455 #include <glusterfs/api/glfs.h>
1457 int main(int argc, char **argv)
1460 int ret = glfs_fadvise(fd, 0, 0, 1);
1465 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1468 echo "Gluster API use fadvise $gf_fadvise"
1471 ##########################################
1472 # check for gfapi trim support
1474 if test "$gfapi" = "yes" ; then
1476 #include <glusterfs/api/glfs.h>
1478 int main(int argc, char **argv)
1480 return glfs_discard_async(NULL, 0, 0);
1483 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1486 echo "Gluster API trim support $gf_trim"
1489 ##########################################
1490 # Check if we support stckf on s390
1491 s390_z196_facilities="no"
1493 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1494 int main(int argc, char **argv)
1496 /* We want just 1 double word to be returned. */
1497 register unsigned long reg0 asm("0") = 0;
1498 unsigned long stfle_bits;
1499 asm volatile(".machine push" "\n\t"
1500 ".machine \"z9-109\"" "\n\t"
1503 : "=QS" (stfle_bits), "+d" (reg0)
1506 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1512 if compile_prog "" "" "s390_z196_facilities"; then
1514 if [[ $? -eq 0 ]]; then
1515 s390_z196_facilities="yes"
1518 echo "s390_z196_facilities $s390_z196_facilities"
1520 ##########################################
1521 # Check if we have required environment variables configured for libhdfs
1522 if test "$libhdfs" = "yes" ; then
1524 if test "$JAVA_HOME" = "" ; then
1525 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1528 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1529 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1532 if test "$FIO_LIBHDFS_LIB" = "" ; then
1533 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1536 if test "$hdfs_conf_error" = "1" ; then
1540 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1541 FIO_HDFS_CPU="amd64"
1544 echo "HDFS engine $libhdfs"
1546 ##########################################
1547 # Check whether we have MTD
1551 #include <mtd/mtd-user.h>
1552 #include <sys/ioctl.h>
1553 int main(int argc, char **argv)
1555 struct mtd_write_req ops;
1556 struct mtd_info_user info;
1557 memset(&ops, 0, sizeof(ops));
1558 info.type = MTD_MLCNANDFLASH;
1559 return ioctl(0, MEMGETINFO, &info);
1562 if compile_prog "" "" "mtd"; then
1567 ##########################################
1568 # Check whether we have libpmem
1571 #include <libpmem.h>
1572 int main(int argc, char **argv)
1575 rc = pmem_is_pmem(0, 0);
1579 if compile_prog "" "-lpmem" "libpmem"; then
1582 echo "libpmem $libpmem"
1584 ##########################################
1585 # Check whether we have libpmemblk
1588 #include <libpmemblk.h>
1589 int main(int argc, char **argv)
1592 rc = pmemblk_open("", 0);
1596 if compile_prog "" "-lpmemblk -lpmem" "libpmemblk"; then
1599 echo "libpmemblk $libpmemblk"
1601 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1603 if test "$libpmemblk" = "yes"; then
1608 ##########################################
1609 # Report whether pmemblk engine is enabled
1610 echo "NVML libpmemblk engine $pmemblk"
1612 ##########################################
1613 # Report whether dev-dax engine is enabled
1614 echo "NVML Device Dax engine $devdax"
1616 # Check if we have lex/yacc available
1621 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
1622 if test "$targetos" != "SunOS" ; then
1623 LEX=$(which lex 2> /dev/null)
1624 if test -x "$LEX" ; then
1627 YACC=$(which bison 2> /dev/null)
1628 if test -x "$YACC" ; then
1632 YACC=$(which yacc 2> /dev/null)
1633 if test -x "$YACC" ; then
1637 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1641 if test "$arith" = "yes" ; then
1643 extern int yywrap(void);
1645 int main(int argc, char **argv)
1651 if compile_prog "" "-ll" "lex"; then
1660 # Check if lex fails using -o
1661 if test "$arith" = "yes" ; then
1662 if test "$force_no_lex_o" = "yes" ; then
1665 $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1666 if test "$?" = "0" ; then
1674 echo "lex/yacc for arithmetic $arith"
1676 ##########################################
1677 # Check whether we have setmntent/getmntent
1682 int main(int argc, char **argv)
1684 FILE *mtab = setmntent(NULL, "r");
1685 struct mntent *mnt = getmntent(mtab);
1690 if compile_prog "" "" "getmntent"; then
1693 echo "getmntent $getmntent"
1695 ##########################################
1696 # Check whether we have getmntinfo
1697 # These are originally added for BSDs, but may also work
1698 # on other operating systems with getmntinfo(3).
1700 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1701 # Note that NetBSD needs -Werror to catch warning as error.
1705 #include <sys/param.h>
1706 #include <sys/mount.h>
1707 int main(int argc, char **argv)
1710 return getmntinfo(&st, MNT_NOWAIT);
1713 if compile_prog "-Werror" "" "getmntinfo"; then
1716 echo "getmntinfo $getmntinfo"
1718 # getmntinfo(3) for NetBSD.
1719 getmntinfo_statvfs="no"
1722 #include <sys/statvfs.h>
1723 int main(int argc, char **argv)
1726 return getmntinfo(&st, MNT_NOWAIT);
1729 # Skip the test if the one with statfs arg is detected.
1730 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1731 getmntinfo_statvfs="yes"
1732 echo "getmntinfo_statvfs $getmntinfo_statvfs"
1735 ##########################################
1736 # Check whether we have _Static_assert
1742 #ifdef __compiler_offsetof
1743 #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1745 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1748 #define container_of(ptr, type, member) ({ \
1749 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
1750 (type *)( (char *)__mptr - offsetof(type,member) );})
1756 int main(int argc, char **argv)
1758 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
1762 if compile_prog "" "" "static_assert"; then
1765 echo "Static Assert $static_assert"
1767 ##########################################
1768 # Check whether we have bool / stdbool.h
1771 #include <stdbool.h>
1772 int main(int argc, char **argv)
1775 return var != false;
1778 if compile_prog "" "" "bool"; then
1781 echo "bool $have_bool"
1783 #############################################################################
1785 if test "$wordsize" = "64" ; then
1786 output_sym "CONFIG_64BIT"
1787 elif test "$wordsize" = "32" ; then
1788 output_sym "CONFIG_32BIT"
1790 fatal "Unknown wordsize!"
1792 if test "$bigendian" = "yes" ; then
1793 output_sym "CONFIG_BIG_ENDIAN"
1795 output_sym "CONFIG_LITTLE_ENDIAN"
1797 if test "$zlib" = "yes" ; then
1798 output_sym "CONFIG_ZLIB"
1800 if test "$libaio" = "yes" ; then
1801 output_sym "CONFIG_LIBAIO"
1803 if test "$posix_aio" = "yes" ; then
1804 output_sym "CONFIG_POSIXAIO"
1806 if test "$posix_aio_fsync" = "yes" ; then
1807 output_sym "CONFIG_POSIXAIO_FSYNC"
1809 if test "$linux_fallocate" = "yes" ; then
1810 output_sym "CONFIG_LINUX_FALLOCATE"
1812 if test "$posix_fallocate" = "yes" ; then
1813 output_sym "CONFIG_POSIX_FALLOCATE"
1815 if test "$fdatasync" = "yes" ; then
1816 output_sym "CONFIG_FDATASYNC"
1818 if test "$sync_file_range" = "yes" ; then
1819 output_sym "CONFIG_SYNC_FILE_RANGE"
1821 if test "$sfaa" = "yes" ; then
1822 output_sym "CONFIG_SFAA"
1824 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1825 output_sym "CONFIG_RDMA"
1827 if test "$clock_gettime" = "yes" ; then
1828 output_sym "CONFIG_CLOCK_GETTIME"
1830 if test "$clock_monotonic" = "yes" ; then
1831 output_sym "CONFIG_CLOCK_MONOTONIC"
1833 if test "$clock_monotonic_raw" = "yes" ; then
1834 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1836 if test "$clock_monotonic_precise" = "yes" ; then
1837 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1839 if test "$clockid_t" = "yes"; then
1840 output_sym "CONFIG_CLOCKID_T"
1842 if test "$gettimeofday" = "yes" ; then
1843 output_sym "CONFIG_GETTIMEOFDAY"
1845 if test "$posix_fadvise" = "yes" ; then
1846 output_sym "CONFIG_POSIX_FADVISE"
1848 if test "$linux_3arg_affinity" = "yes" ; then
1849 output_sym "CONFIG_3ARG_AFFINITY"
1850 elif test "$linux_2arg_affinity" = "yes" ; then
1851 output_sym "CONFIG_2ARG_AFFINITY"
1853 if test "$strsep" = "yes" ; then
1854 output_sym "CONFIG_STRSEP"
1856 if test "$strcasestr" = "yes" ; then
1857 output_sym "CONFIG_STRCASESTR"
1859 if test "$strlcat" = "yes" ; then
1860 output_sym "CONFIG_STRLCAT"
1862 if test "$getopt_long_only" = "yes" ; then
1863 output_sym "CONFIG_GETOPT_LONG_ONLY"
1865 if test "$inet_aton" = "yes" ; then
1866 output_sym "CONFIG_INET_ATON"
1868 if test "$socklen_t" = "yes" ; then
1869 output_sym "CONFIG_SOCKLEN_T"
1871 if test "$ext4_me" = "yes" ; then
1872 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1874 if test "$linux_splice" = "yes" ; then
1875 output_sym "CONFIG_LINUX_SPLICE"
1877 if test "$guasi" = "yes" ; then
1878 output_sym "CONFIG_GUASI"
1880 if test "$fusion_aw" = "yes" ; then
1881 output_sym "CONFIG_FUSION_AW"
1883 if test "$libnuma_v2" = "yes" ; then
1884 output_sym "CONFIG_LIBNUMA"
1886 if test "$solaris_aio" = "yes" ; then
1887 output_sym "CONFIG_SOLARISAIO"
1889 if test "$tls_thread" = "yes" ; then
1890 output_sym "CONFIG_TLS_THREAD"
1892 if test "$rusage_thread" = "yes" ; then
1893 output_sym "CONFIG_RUSAGE_THREAD"
1895 if test "$gfio" = "yes" ; then
1896 echo "CONFIG_GFIO=y" >> $config_host_mak
1898 if test "$esx" = "yes" ; then
1899 output_sym "CONFIG_ESX"
1900 output_sym "CONFIG_NO_SHM"
1902 if test "$sched_idle" = "yes" ; then
1903 output_sym "CONFIG_SCHED_IDLE"
1905 if test "$tcp_nodelay" = "yes" ; then
1906 output_sym "CONFIG_TCP_NODELAY"
1908 if test "$window_size" = "yes" ; then
1909 output_sym "CONFIG_NET_WINDOWSIZE"
1911 if test "$mss" = "yes" ; then
1912 output_sym "CONFIG_NET_MSS"
1914 if test "$rlimit_memlock" = "yes" ; then
1915 output_sym "CONFIG_RLIMIT_MEMLOCK"
1917 if test "$pwritev" = "yes" ; then
1918 output_sym "CONFIG_PWRITEV"
1920 if test "$pwritev2" = "yes" ; then
1921 output_sym "CONFIG_PWRITEV2"
1923 if test "$ipv6" = "yes" ; then
1924 output_sym "CONFIG_IPV6"
1926 if test "$rbd" = "yes" ; then
1927 output_sym "CONFIG_RBD"
1929 if test "$rbd_poll" = "yes" ; then
1930 output_sym "CONFIG_RBD_POLL"
1932 if test "$rbd_inval" = "yes" ; then
1933 output_sym "CONFIG_RBD_INVAL"
1935 if test "$rbd_blkin" = "yes" ; then
1936 output_sym "CONFIG_RBD_BLKIN"
1938 if test "$setvbuf" = "yes" ; then
1939 output_sym "CONFIG_SETVBUF"
1941 if test "$s390_z196_facilities" = "yes" ; then
1942 output_sym "CONFIG_S390_Z196_FACILITIES"
1943 CFLAGS="$CFLAGS -march=z9-109"
1945 if test "$gfapi" = "yes" ; then
1946 output_sym "CONFIG_GFAPI"
1948 if test "$gf_fadvise" = "yes" ; then
1949 output_sym "CONFIG_GF_FADVISE"
1951 if test "$gf_trim" = "yes" ; then
1952 output_sym "CONFIG_GF_TRIM"
1954 if test "$libhdfs" = "yes" ; then
1955 output_sym "CONFIG_LIBHDFS"
1956 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
1957 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1958 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1959 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1961 if test "$mtd" = "yes" ; then
1962 output_sym "CONFIG_MTD"
1964 if test "$pmemblk" = "yes" ; then
1965 output_sym "CONFIG_PMEMBLK"
1967 if test "$devdax" = "yes" ; then
1968 output_sym "CONFIG_LINUX_DEVDAX"
1970 if test "$arith" = "yes" ; then
1971 output_sym "CONFIG_ARITHMETIC"
1972 if test "$yacc_is_bison" = "yes" ; then
1973 echo "YACC=$YACC -y" >> $config_host_mak
1975 echo "YACC=$YACC" >> $config_host_mak
1977 if test "$lex_use_o" = "yes" ; then
1978 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
1981 if test "$getmntent" = "yes" ; then
1982 output_sym "CONFIG_GETMNTENT"
1984 if test "$getmntinfo" = "yes" ; then
1985 output_sym "CONFIG_GETMNTINFO"
1987 if test "$getmntinfo_statvfs" = "yes" ; then
1988 output_sym "CONFIG_GETMNTINFO_STATVFS"
1990 if test "$static_assert" = "yes" ; then
1991 output_sym "CONFIG_STATIC_ASSERT"
1993 if test "$have_bool" = "yes" ; then
1994 output_sym "CONFIG_HAVE_BOOL"
1997 if test "$zlib" = "no" ; then
1998 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
2001 echo "LIBS+=$LIBS" >> $config_host_mak
2002 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
2003 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
2004 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
2005 echo "CC=$cc" >> $config_host_mak
2006 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
2007 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2009 if [ `dirname $0` != "." -a ! -e Makefile ]; then
2010 cat > Makefile <<EOF
2011 SRCDIR:=`dirname $0`
2012 include \$(SRCDIR)/Makefile