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 output_sym "CONFIG_SFA"
275 echo "CC=$CC" >> $config_host_mak
276 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
281 if test ! -z "$cpu" ; then
282 # command line argument
284 elif check_define __i386__ ; then
286 elif check_define __x86_64__ ; then
288 elif check_define __sparc__ ; then
289 if check_define __arch64__ ; then
294 elif check_define _ARCH_PPC ; then
295 if check_define _ARCH_PPC64 ; then
300 elif check_define __mips__ ; then
302 elif check_define __ia64__ ; then
304 elif check_define __s390__ ; then
305 if check_define __s390x__ ; then
310 elif check_define __arm__ ; then
312 elif check_define __hppa__ ; then
318 # Normalise host CPU name and set ARCH.
320 ia64|ppc|ppc64|s390|s390x|sparc64)
323 i386|i486|i586|i686|i86pc|BePC)
332 hppa|parisc|parisc64)
346 if test -z "$CC" ; then
347 if test "$targetos" = "FreeBSD"; then
356 cc="${CC-${cross_prefix}gcc}"
358 ##########################################
359 # check cross compile
368 if compile_prog "" "" "cross"; then
369 $TMPE 2>/dev/null || cross_compile="yes"
371 fatal "compile test failed"
374 ##########################################
377 if test "$cross_compile" = "no" ; then
379 #include <inttypes.h>
382 volatile uint32_t i=0x01234567;
383 return (*((uint8_t*)(&i))) == 0x67;
386 if compile_prog "" "" "endian"; then
387 $TMPE && bigendian="yes"
390 # If we're cross compiling, try our best to work it out and rely on the
391 # run-time check to fail if we get it wrong.
396 #if __BYTE_ORDER != __BIG_ENDIAN
397 # error "Unknown endianness"
401 compile_prog "" "" "endian" && bigendian="yes"
402 check_define "__ARMEB__" && bigendian="yes"
403 check_define "__MIPSEB__" && bigendian="yes"
407 echo "Operating system $targetos"
409 echo "Big endian $bigendian"
411 echo "Cross compile $cross_compile"
414 ##########################################
415 # See if we need to build a static build
416 if test "$build_static" = "yes" ; then
417 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
418 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
422 echo "Static build $build_static"
424 ##########################################
429 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
432 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
436 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
438 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
441 fatal "Unknown wordsize"
443 echo "Wordsize $wordsize"
445 ##########################################
453 if (inflateInit(&stream) != Z_OK)
458 if compile_prog "" "-lz" "zlib" ; then
464 ##########################################
476 if compile_prog "" "-laio" "libaio" ; then
480 if test "$libaio" = "yes" ; then
481 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
485 echo "Linux AIO support $libaio"
487 ##########################################
500 if compile_prog "" "" "posixaio" ; then
502 elif compile_prog "" "-lrt" "posixaio"; then
507 echo "POSIX AIO support $posix_aio"
508 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
510 ##########################################
511 # posix aio fsync probe
513 if test "$posix_aio" = "yes" ; then
520 return aio_fsync(O_SYNC, &cb);
524 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
528 echo "POSIX AIO fsync $posix_aio_fsync"
530 ##########################################
534 #include <sys/types.h>
535 #include <sys/asynch.h>
540 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
544 if compile_prog "" "-laio" "solarisaio" ; then
548 echo "Solaris AIO support $solaris_aio"
550 ##########################################
551 # __sync_fetch_and_and test
554 static int sfaa(int *ptr)
556 return __sync_fetch_and_add(ptr, 0);
559 int main(int argc, char **argv)
566 if compile_prog "" "" "__sync_fetch_and_add()" ; then
569 echo "__sync_fetch_and_add $sfaa"
571 ##########################################
576 #include <infiniband/arch.h>
577 int main(int argc, char **argv)
579 struct ibv_pd *pd = ibv_alloc_pd(NULL);
583 if compile_prog "" "-libverbs" "libverbs" ; then
585 LIBS="-libverbs $LIBS"
587 echo "libverbs $libverbs"
589 ##########################################
594 #include <rdma/rdma_cma.h>
595 int main(int argc, char **argv)
597 rdma_destroy_qp(NULL);
601 if compile_prog "" "-lrdmacm" "rdma"; then
603 LIBS="-lrdmacm $LIBS"
605 echo "rdmacm $rdmacm"
607 ##########################################
608 # Linux fallocate probe
613 #include <linux/falloc.h>
614 int main(int argc, char **argv)
616 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
620 if compile_prog "" "" "linux_fallocate"; then
621 linux_fallocate="yes"
623 echo "Linux fallocate $linux_fallocate"
625 ##########################################
626 # POSIX fadvise probe
631 int main(int argc, char **argv)
633 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
637 if compile_prog "" "" "posix_fadvise"; then
640 echo "POSIX fadvise $posix_fadvise"
642 ##########################################
643 # POSIX fallocate probe
648 int main(int argc, char **argv)
650 int r = posix_fallocate(0, 0, 1024);
654 if compile_prog "" "" "posix_fallocate"; then
655 posix_fallocate="yes"
657 echo "POSIX fallocate $posix_fallocate"
659 ##########################################
660 # sched_set/getaffinity 2 or 3 argument test
661 linux_2arg_affinity="no"
662 linux_3arg_affinity="no"
665 int main(int argc, char **argv)
668 return sched_setaffinity(0, sizeof(mask), &mask);
671 if compile_prog "" "" "sched_setaffinity(,,)"; then
672 linux_3arg_affinity="yes"
676 int main(int argc, char **argv)
679 return sched_setaffinity(0, &mask);
682 if compile_prog "" "" "sched_setaffinity(,)"; then
683 linux_2arg_affinity="yes"
686 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
687 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
689 ##########################################
690 # clock_gettime probe
695 int main(int argc, char **argv)
697 return clock_gettime(0, NULL);
700 if compile_prog "" "" "clock_gettime"; then
702 elif compile_prog "" "-lrt" "clock_gettime"; then
706 echo "clock_gettime $clock_gettime"
708 ##########################################
709 # CLOCK_MONOTONIC probe
711 if test "$clock_gettime" = "yes" ; then
715 int main(int argc, char **argv)
717 return clock_gettime(CLOCK_MONOTONIC, NULL);
720 if compile_prog "" "$LIBS" "clock monotonic"; then
721 clock_monotonic="yes"
724 echo "CLOCK_MONOTONIC $clock_monotonic"
726 ##########################################
727 # CLOCK_MONOTONIC_RAW probe
728 clock_monotonic_raw="no"
729 if test "$clock_gettime" = "yes" ; then
733 int main(int argc, char **argv)
735 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
738 if compile_prog "" "$LIBS" "clock monotonic"; then
739 clock_monotonic_raw="yes"
742 echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
744 ##########################################
745 # CLOCK_MONOTONIC_PRECISE probe
746 clock_monotonic_precise="no"
747 if test "$clock_gettime" = "yes" ; then
751 int main(int argc, char **argv)
753 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
756 if compile_prog "" "$LIBS" "clock monotonic precise"; then
757 clock_monotonic_precise="yes"
760 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
762 ##########################################
763 # gettimeofday() probe
766 #include <sys/time.h>
768 int main(int argc, char **argv)
771 return gettimeofday(&tv, NULL);
774 if compile_prog "" "" "gettimeofday"; then
777 echo "gettimeofday $gettimeofday"
779 ##########################################
785 int main(int argc, char **argv)
790 if compile_prog "" "" "fdatasync"; then
793 echo "fdatasync $fdatasync"
795 ##########################################
796 # sync_file_range() probe
802 #include <linux/fs.h>
803 int main(int argc, char **argv)
805 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
806 SYNC_FILE_RANGE_WAIT_AFTER;
807 return sync_file_range(0, 0, 0, flags);
810 if compile_prog "" "" "sync_file_range"; then
811 sync_file_range="yes"
813 echo "sync_file_range $sync_file_range"
815 ##########################################
816 # ext4 move extent probe
820 #include <sys/ioctl.h>
821 int main(int argc, char **argv)
823 struct move_extent me;
824 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
827 if compile_prog "" "" "ext4 move extent" ; then
829 elif test $targetos = "Linux" ; then
830 # On Linux, just default to it on and let it error at runtime if we really
831 # don't have it. None of my updated systems have it defined, but it does
832 # work. Takes a while to bubble back.
835 echo "EXT4 move extent $ext4_me"
837 ##########################################
843 int main(int argc, char **argv)
845 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
848 if compile_prog "" "" "linux splice"; then
851 echo "Linux splice(2) $linux_splice"
853 ##########################################
858 #include <guasi_syscalls.h>
859 int main(int argc, char **argv)
861 guasi_t ctx = guasi_create(0, 0, 0);
865 if compile_prog "" "" "guasi"; then
870 ##########################################
874 #include <nvm/nvm_primitives.h>
875 int main(int argc, char **argv)
877 nvm_version_t ver_info;
880 handle = nvm_get_handle(0, &ver_info);
881 return nvm_atomic_write(handle, 0, 0, 0);
884 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
885 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
888 echo "Fusion-io atomic engine $fusion_aw"
890 ##########################################
895 int main(int argc, char **argv)
897 return numa_available();
900 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
904 echo "libnuma $libnuma"
906 ##########################################
907 # libnuma 2.x version API
908 if test "$libnuma" = "yes" ; then
912 int main(int argc, char **argv)
914 struct bitmask *mask = numa_parse_nodestring(NULL);
915 return mask->size == 0;
918 if compile_prog "" "" "libnuma api"; then
921 echo "libnuma v2 $libnuma_v2"
924 ##########################################
929 int main(int argc, char **argv)
935 if compile_prog "" "" "strsep"; then
938 echo "strsep $strsep"
940 ##########################################
945 int main(int argc, char **argv)
947 return strcasestr(argv[0], argv[1]) != NULL;
950 if compile_prog "" "" "strcasestr"; then
953 echo "strcasestr $strcasestr"
955 ##########################################
956 # getopt_long_only() probe
957 getopt_long_only="no"
962 int main(int argc, char **argv)
964 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
968 if compile_prog "" "" "getopt_long_only"; then
969 getopt_long_only="yes"
971 echo "getopt_long_only() $getopt_long_only"
973 ##########################################
977 #include <sys/socket.h>
978 #include <arpa/inet.h>
980 int main(int argc, char **argv)
983 return inet_aton(NULL, &in);
986 if compile_prog "" "" "inet_aton"; then
989 echo "inet_aton $inet_aton"
991 ##########################################
995 #include <sys/socket.h>
996 int main(int argc, char **argv)
1002 if compile_prog "" "" "socklen_t"; then
1005 echo "socklen_t $socklen_t"
1007 ##########################################
1008 # Whether or not __thread is supported for TLS
1012 static __thread int ret;
1013 int main(int argc, char **argv)
1018 if compile_prog "" "" "__thread"; then
1021 echo "__thread $tls_thread"
1023 ##########################################
1024 # Check if we have required gtk/glib support for gfio
1026 if test "$gfio_check" = "yes" ; then
1030 #include <gtk/gtk.h>
1033 gdk_threads_enter();
1034 gdk_threads_leave();
1036 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1039 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1040 ORG_LDFLAGS=$LDFLAGS
1041 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1042 if test "$?" != "0" ; then
1043 echo "configure: gtk and gthread not found"
1046 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1047 if test "$?" != "0" ; then
1048 echo "configure: gtk and gthread not found"
1051 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1053 if test "$r" != "0" ; then
1055 GFIO_LIBS="$LIBS $GTK_LIBS"
1056 CFLAGS="$CFLAGS $GTK_CFLAGS"
1058 echo "GTK found, but need version 2.18 or higher"
1062 echo "Please install gtk and gdk libraries"
1065 LDFLAGS=$ORG_LDFLAGS
1068 if test "$gfio_check" = "yes" ; then
1069 echo "gtk 2.18 or higher $gfio"
1072 # Check whether we have getrusage(RUSAGE_THREAD)
1075 #include <sys/time.h>
1076 #include <sys/resource.h>
1077 int main(int argc, char **argv)
1080 getrusage(RUSAGE_THREAD, &ru);
1084 if compile_prog "" "" "RUSAGE_THREAD"; then
1087 echo "RUSAGE_THREAD $rusage_thread"
1089 ##########################################
1090 # Check whether we have SCHED_IDLE
1094 int main(int argc, char **argv)
1096 struct sched_param p;
1097 return sched_setscheduler(0, SCHED_IDLE, &p);
1100 if compile_prog "" "" "SCHED_IDLE"; then
1103 echo "SCHED_IDLE $sched_idle"
1105 ##########################################
1106 # Check whether we have TCP_NODELAY
1110 #include <sys/types.h>
1111 #include <sys/socket.h>
1112 #include <netinet/tcp.h>
1113 int main(int argc, char **argv)
1115 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1118 if compile_prog "" "" "TCP_NODELAY"; then
1121 echo "TCP_NODELAY $tcp_nodelay"
1123 ##########################################
1124 # Check whether we have SO_SNDBUF
1128 #include <sys/types.h>
1129 #include <sys/socket.h>
1130 #include <netinet/tcp.h>
1131 int main(int argc, char **argv)
1133 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1134 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1137 if compile_prog "" "" "SO_SNDBUF"; then
1140 echo "Net engine window_size $window_size"
1142 ##########################################
1143 # Check whether we have TCP_MAXSEG
1147 #include <sys/types.h>
1148 #include <sys/socket.h>
1149 #include <netinet/tcp.h>
1150 #include <arpa/inet.h>
1151 #include <netinet/in.h>
1152 int main(int argc, char **argv)
1154 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1157 if compile_prog "" "" "TCP_MAXSEG"; then
1160 echo "TCP_MAXSEG $mss"
1162 ##########################################
1163 # Check whether we have RLIMIT_MEMLOCK
1166 #include <sys/time.h>
1167 #include <sys/resource.h>
1168 int main(int argc, char **argv)
1171 return getrlimit(RLIMIT_MEMLOCK, &rl);
1174 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1175 rlimit_memlock="yes"
1177 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1179 ##########################################
1180 # Check whether we have pwritev/preadv
1184 #include <sys/uio.h>
1185 int main(int argc, char **argv)
1187 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1190 if compile_prog "" "" "pwritev"; then
1193 echo "pwritev/preadv $pwritev"
1195 ##########################################
1196 # Check whether we have the required functions for ipv6
1199 #include <sys/types.h>
1200 #include <sys/socket.h>
1201 #include <netinet/in.h>
1204 int main(int argc, char **argv)
1206 struct addrinfo hints;
1207 struct in6_addr addr;
1210 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1212 printf("%s\n", gai_strerror(ret));
1217 if compile_prog "" "" "ipv6"; then
1220 echo "IPv6 helpers $ipv6"
1222 ##########################################
1226 #include <rbd/librbd.h>
1228 int main(int argc, char **argv)
1232 rados_ioctx_t io_ctx;
1233 const char pool[] = "rbd";
1235 int major, minor, extra;
1236 rbd_version(&major, &minor, &extra);
1238 rados_ioctx_create(cluster, pool, &io_ctx);
1242 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1243 LIBS="-lrbd -lrados $LIBS"
1246 echo "Rados Block Device engine $rbd"
1248 ##########################################
1249 # check for rbd_invaidate_cache()
1251 if test "$rbd" = "yes"; then
1253 #include <rbd/librbd.h>
1255 int main(int argc, char **argv)
1259 return rbd_invalidate_cache(image);
1262 if compile_prog "" "-lrbd -lrados" "rbd"; then
1265 echo "rbd_invalidate_cache $rbd_inval"
1268 ##########################################
1269 # Check whether we have setvbuf
1273 int main(int argc, char **argv)
1277 setvbuf(f, buf, _IOFBF, sizeof(buf));
1281 if compile_prog "" "" "setvbuf"; then
1284 echo "setvbuf $setvbuf"
1289 #include <glusterfs/api/glfs.h>
1291 int main(int argc, char **argv)
1294 glfs_t *g = glfs_new("foo");
1299 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1300 LIBS="-lgfapi -lglusterfs $LIBS"
1303 echo "Gluster API engine $gfapi"
1305 ##########################################
1306 # check for gfapi fadvise support
1307 if test "$gfapi" = "yes" ; then
1310 #include <glusterfs/api/glfs.h>
1312 int main(int argc, char **argv)
1315 int ret = glfs_fadvise(fd, 0, 0, 1);
1320 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1323 echo "Gluster API use fadvise $gf_fadvise"
1326 ##########################################
1327 # check for gfapi trim support
1329 if test "$gfapi" = "yes" ; then
1331 #include <glusterfs/api/glfs.h>
1333 int main(int argc, char **argv)
1335 return glfs_discard_async(NULL, 0, 0);
1338 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1341 echo "Gluster API trim support $gf_trim"
1344 ##########################################
1345 # Check if we support stckf on s390
1346 s390_z196_facilities="no"
1348 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1349 int main(int argc, char **argv)
1351 /* We want just 1 double word to be returned. */
1352 register unsigned long reg0 asm("0") = 0;
1353 unsigned long stfle_bits;
1354 asm volatile(".machine push" "\n\t"
1355 ".machine \"z9-109\"" "\n\t"
1358 : "=QS" (stfle_bits), "+d" (reg0)
1361 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1367 if compile_prog "" "" "s390_z196_facilities"; then
1369 if [[ $? -eq 0 ]]; then
1370 s390_z196_facilities="yes"
1373 echo "s390_z196_facilities $s390_z196_facilities"
1375 ##########################################
1376 # Check if we have required environment variables configured for libhdfs
1377 if test "$libhdfs" = "yes" ; then
1379 if test "$JAVA_HOME" = "" ; then
1380 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1383 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1384 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1387 if test "$FIO_LIBHDFS_LIB" = "" ; then
1388 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1391 if test "$hdfs_conf_error" = "1" ; then
1395 echo "HDFS engine $libhdfs"
1397 ##########################################
1398 # Check whether we have MTD
1401 #include <mtd/mtd-user.h>
1402 #include <sys/ioctl.h>
1403 int main(int argc, char **argv)
1405 struct mtd_info_user info;
1406 info.type = MTD_MLCNANDFLASH;
1407 return ioctl(0, MEMGETINFO, &info);
1410 if compile_prog "" "" "mtd"; then
1415 # Check if we have lex/yacc available
1420 if test "$targetos" != "SunOS" ; then
1421 LEX=$(which lex 2> /dev/null)
1422 if test -x "$LEX" ; then
1425 YACC=$(which bison 2> /dev/null)
1426 if test -x "$YACC" ; then
1430 YACC=$(which yacc 2> /dev/null)
1431 if test -x "$YACC" ; then
1435 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1439 if test "$arith" = "yes" ; then
1441 extern int yywrap(void);
1443 int main(int argc, char **argv)
1449 if compile_prog "" "-ll" "lex"; then
1457 echo "lex/yacc for arithmetic $arith"
1459 ##########################################
1460 # Check whether we have setmntent/getmntent
1465 int main(int argc, char **argv)
1467 FILE *mtab = setmntent(NULL, "r");
1468 struct mntent *mnt = getmntent(mtab);
1473 if compile_prog "" "" "getmntent"; then
1476 echo "getmntent $getmntent"
1478 ##########################################
1479 # Check whether we have getmntinfo
1483 #include <sys/param.h>
1484 #include <sys/mount.h>
1485 int main(int argc, char **argv)
1488 return getmntinfo(&st, MNT_NOWAIT);
1491 if compile_prog "" "" "getmntinfo"; then
1494 echo "getmntinfo $getmntinfo"
1496 ##########################################
1497 # Check whether we have __sync_fetch_and_add()
1502 #include <inttypes.h>
1503 int main(int argc, char **argv)
1505 uint64_t dst = 1, src = 3;
1506 __sync_fetch_and_add(&dst, src);
1509 if compile_prog "" "" "__sync_fetch_and_add"; then
1512 echo "__sync_fetch_and_add $sfa"
1514 #############################################################################
1516 if test "$wordsize" = "64" ; then
1517 output_sym "CONFIG_64BIT"
1518 elif test "$wordsize" = "32" ; then
1519 output_sym "CONFIG_32BIT"
1521 fatal "Unknown wordsize!"
1523 if test "$bigendian" = "yes" ; then
1524 output_sym "CONFIG_BIG_ENDIAN"
1526 output_sym "CONFIG_LITTLE_ENDIAN"
1528 if test "$zlib" = "yes" ; then
1529 output_sym "CONFIG_ZLIB"
1531 if test "$libaio" = "yes" ; then
1532 output_sym "CONFIG_LIBAIO"
1534 if test "$posix_aio" = "yes" ; then
1535 output_sym "CONFIG_POSIXAIO"
1537 if test "$posix_aio_fsync" = "yes" ; then
1538 output_sym "CONFIG_POSIXAIO_FSYNC"
1540 if test "$linux_fallocate" = "yes" ; then
1541 output_sym "CONFIG_LINUX_FALLOCATE"
1543 if test "$posix_fallocate" = "yes" ; then
1544 output_sym "CONFIG_POSIX_FALLOCATE"
1546 if test "$fdatasync" = "yes" ; then
1547 output_sym "CONFIG_FDATASYNC"
1549 if test "$sync_file_range" = "yes" ; then
1550 output_sym "CONFIG_SYNC_FILE_RANGE"
1552 if test "$sfaa" = "yes" ; then
1553 output_sym "CONFIG_SFAA"
1555 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1556 output_sym "CONFIG_RDMA"
1558 if test "$clock_gettime" = "yes" ; then
1559 output_sym "CONFIG_CLOCK_GETTIME"
1561 if test "$clock_monotonic" = "yes" ; then
1562 output_sym "CONFIG_CLOCK_MONOTONIC"
1564 if test "$clock_monotonic_raw" = "yes" ; then
1565 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1567 if test "$clock_monotonic_precise" = "yes" ; then
1568 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1570 if test "$gettimeofday" = "yes" ; then
1571 output_sym "CONFIG_GETTIMEOFDAY"
1573 if test "$posix_fadvise" = "yes" ; then
1574 output_sym "CONFIG_POSIX_FADVISE"
1576 if test "$linux_3arg_affinity" = "yes" ; then
1577 output_sym "CONFIG_3ARG_AFFINITY"
1578 elif test "$linux_2arg_affinity" = "yes" ; then
1579 output_sym "CONFIG_2ARG_AFFINITY"
1581 if test "$strsep" = "yes" ; then
1582 output_sym "CONFIG_STRSEP"
1584 if test "$strcasestr" = "yes" ; then
1585 output_sym "CONFIG_STRCASESTR"
1587 if test "$getopt_long_only" = "yes" ; then
1588 output_sym "CONFIG_GETOPT_LONG_ONLY"
1590 if test "$inet_aton" = "yes" ; then
1591 output_sym "CONFIG_INET_ATON"
1593 if test "$socklen_t" = "yes" ; then
1594 output_sym "CONFIG_SOCKLEN_T"
1596 if test "$ext4_me" = "yes" ; then
1597 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1599 if test "$linux_splice" = "yes" ; then
1600 output_sym "CONFIG_LINUX_SPLICE"
1602 if test "$guasi" = "yes" ; then
1603 output_sym "CONFIG_GUASI"
1605 if test "$fusion_aw" = "yes" ; then
1606 output_sym "CONFIG_FUSION_AW"
1608 if test "$libnuma_v2" = "yes" ; then
1609 output_sym "CONFIG_LIBNUMA"
1611 if test "$solaris_aio" = "yes" ; then
1612 output_sym "CONFIG_SOLARISAIO"
1614 if test "$tls_thread" = "yes" ; then
1615 output_sym "CONFIG_TLS_THREAD"
1617 if test "$rusage_thread" = "yes" ; then
1618 output_sym "CONFIG_RUSAGE_THREAD"
1620 if test "$gfio" = "yes" ; then
1621 echo "CONFIG_GFIO=y" >> $config_host_mak
1623 if test "$esx" = "yes" ; then
1624 output_sym "CONFIG_ESX"
1625 output_sym "CONFIG_NO_SHM"
1627 if test "$sched_idle" = "yes" ; then
1628 output_sym "CONFIG_SCHED_IDLE"
1630 if test "$tcp_nodelay" = "yes" ; then
1631 output_sym "CONFIG_TCP_NODELAY"
1633 if test "$window_size" = "yes" ; then
1634 output_sym "CONFIG_NET_WINDOWSIZE"
1636 if test "$mss" = "yes" ; then
1637 output_sym "CONFIG_NET_MSS"
1639 if test "$rlimit_memlock" = "yes" ; then
1640 output_sym "CONFIG_RLIMIT_MEMLOCK"
1642 if test "$pwritev" = "yes" ; then
1643 output_sym "CONFIG_PWRITEV"
1645 if test "$ipv6" = "yes" ; then
1646 output_sym "CONFIG_IPV6"
1648 if test "$rbd" = "yes" ; then
1649 output_sym "CONFIG_RBD"
1651 if test "$rbd_inval" = "yes" ; then
1652 output_sym "CONFIG_RBD_INVAL"
1654 if test "$setvbuf" = "yes" ; then
1655 output_sym "CONFIG_SETVBUF"
1657 if test "$s390_z196_facilities" = "yes" ; then
1658 output_sym "CONFIG_S390_Z196_FACILITIES"
1659 CFLAGS="$CFLAGS -march=z9-109"
1661 if test "$gfapi" = "yes" ; then
1662 output_sym "CONFIG_GFAPI"
1664 if test "$gf_fadvise" = "yes" ; then
1665 output_sym "CONFIG_GF_FADVISE"
1667 if test "$gf_trim" = "yes" ; then
1668 output_sym "CONFIG_GF_TRIM"
1670 if test "$libhdfs" = "yes" ; then
1671 output_sym "CONFIG_LIBHDFS"
1672 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1673 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1674 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1676 if test "$mtd" = "yes" ; then
1677 output_sym "CONFIG_MTD"
1679 if test "$arith" = "yes" ; then
1680 output_sym "CONFIG_ARITHMETIC"
1681 if test "$yacc_is_bison" = "yes" ; then
1682 echo "YACC=$YACC -y" >> $config_host_mak
1684 echo "YACC=$YACC" >> $config_host_mak
1687 if test "$getmntent" = "yes" ; then
1688 output_sym "CONFIG_GETMNTENT"
1690 if test "$getmntinfo" = "yes" ; then
1691 output_sym "CONFIG_GETMNTINFO"
1693 if test "$sfa" = "yes" ; then
1694 output_sym "CONFIG_SFA"
1697 if test "$zlib" = "no" ; then
1698 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1701 echo "LIBS+=$LIBS" >> $config_host_mak
1702 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1703 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1704 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1705 echo "CC=$cc" >> $config_host_mak
1706 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
1707 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak