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
141 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
143 --cpu=*) cpu="$optarg"
145 # esx is cross compiled and cannot be detect through simple uname calls
151 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
153 --build-32bit-win) build_32bit_win="yes"
155 --build-static) build_static="yes"
160 --disable-numa) disable_numa="yes"
162 --disable-rbd) disable_rbd="yes"
164 --disable-gfapi) disable_gfapi="yes"
166 --enable-libhdfs) libhdfs="yes"
168 --disable-shm) output_sym "CONFIG_NO_SHM"
174 echo "Bad option $opt"
180 if test "$show_help" = "yes" ; then
181 echo "--cpu= Specify target CPU if auto-detect fails"
182 echo "--cc= Specify compiler to use"
183 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
184 echo "--build-32bit-win Enable 32-bit build on Windows"
185 echo "--build-static Build a static fio"
186 echo "--esx Configure build options for esx"
187 echo "--enable-gfio Enable building of gtk gfio"
188 echo "--disable-numa Disable libnuma even if found"
189 echo "--enable-libhdfs Enable hdfs support"
193 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
194 cc="${CC-${cross_prefix}gcc}"
196 if check_define __ANDROID__ ; then
198 elif check_define __linux__ ; then
200 elif check_define __OpenBSD__ ; then
202 elif check_define __sun__ ; then
204 CFLAGS="$CFLAGS -D_REENTRANT"
205 elif check_define _WIN32 ; then
211 echo "# Automatically generated by configure - do not modify" > $config_host_mak
212 printf "# Configured with:" >> $config_host_mak
213 printf " '%s'" "$0" "$@" >> $config_host_mak
214 echo >> $config_host_mak
215 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
217 # Some host OSes need non-standard checks for which CPU to use.
218 # Note that these checks are broken for cross-compilation: if you're
219 # cross-compiling to one of these OSes then you'll need to specify
220 # the correct CPU with the --cpu option.
223 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
224 # we can run 64-bit userspace code.
225 # If the user didn't specify a CPU explicitly and the kernel says this is
226 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
228 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
233 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
234 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
237 LIBS="-lnsl -lsocket"
240 echo "Forcing known good options on Windows"
241 if test -z "$CC" ; then
242 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
243 CC="i686-w64-mingw32-gcc"
245 CC="x86_64-w64-mingw32-gcc"
248 output_sym "CONFIG_LITTLE_ENDIAN"
249 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
250 output_sym "CONFIG_32BIT"
252 output_sym "CONFIG_64BIT_LLP64"
254 output_sym "CONFIG_FADVISE"
255 output_sym "CONFIG_SOCKLEN_T"
256 output_sym "CONFIG_FADVISE"
257 output_sym "CONFIG_SFAA"
258 output_sym "CONFIG_RUSAGE_THREAD"
259 output_sym "CONFIG_WINDOWSAIO"
260 output_sym "CONFIG_FDATASYNC"
261 output_sym "CONFIG_CLOCK_MONOTONIC"
262 output_sym "CONFIG_GETTIMEOFDAY"
263 output_sym "CONFIG_CLOCK_GETTIME"
264 output_sym "CONFIG_SCHED_IDLE"
265 output_sym "CONFIG_TCP_NODELAY"
266 output_sym "CONFIG_TLS_THREAD"
267 output_sym "CONFIG_IPV6"
268 echo "CC=$CC" >> $config_host_mak
269 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
274 if test ! -z "$cpu" ; then
275 # command line argument
277 elif check_define __i386__ ; then
279 elif check_define __x86_64__ ; then
281 elif check_define __sparc__ ; then
282 if check_define __arch64__ ; then
287 elif check_define _ARCH_PPC ; then
288 if check_define _ARCH_PPC64 ; then
293 elif check_define __mips__ ; then
295 elif check_define __ia64__ ; then
297 elif check_define __s390__ ; then
298 if check_define __s390x__ ; then
303 elif check_define __arm__ ; then
305 elif check_define __hppa__ ; then
311 # Normalise host CPU name and set ARCH.
313 ia64|ppc|ppc64|s390|s390x|sparc64)
316 i386|i486|i586|i686|i86pc|BePC)
325 hppa|parisc|parisc64)
339 if test -z "$CC" ; then
340 if test "$targetos" = "FreeBSD"; then
349 cc="${CC-${cross_prefix}gcc}"
351 ##########################################
352 # check cross compile
361 if compile_prog "" "" "cross"; then
362 $TMPE 2>/dev/null || cross_compile="yes"
364 fatal "compile test failed"
367 ##########################################
370 if test "$cross_compile" = "no" ; then
372 #include <inttypes.h>
375 volatile uint32_t i=0x01234567;
376 return (*((uint8_t*)(&i))) == 0x67;
379 if compile_prog "" "" "endian"; then
380 $TMPE && bigendian="yes"
383 # If we're cross compiling, try our best to work it out and rely on the
384 # run-time check to fail if we get it wrong.
389 #if __BYTE_ORDER != __BIG_ENDIAN
390 # error "Unknown endianness"
394 compile_prog "" "" "endian" && bigendian="yes"
395 check_define "__ARMEB__" && bigendian="yes"
396 check_define "__MIPSEB__" && bigendian="yes"
400 echo "Operating system $targetos"
402 echo "Big endian $bigendian"
404 echo "Cross compile $cross_compile"
407 ##########################################
408 # See if we need to build a static build
409 if test "$build_static" = "yes" ; then
410 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
411 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
415 echo "Static build $build_static"
417 ##########################################
422 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
425 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
429 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
431 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
434 fatal "Unknown wordsize"
436 echo "Wordsize $wordsize"
438 ##########################################
446 if (inflateInit(&stream) != Z_OK)
451 if compile_prog "" "-lz" "zlib" ; then
457 ##########################################
469 if compile_prog "" "-laio" "libaio" ; then
473 if test "$libaio" = "yes" ; then
474 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
478 echo "Linux AIO support $libaio"
480 ##########################################
493 if compile_prog "" "" "posixaio" ; then
495 elif compile_prog "" "-lrt" "posixaio"; then
500 echo "POSIX AIO support $posix_aio"
501 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
503 ##########################################
504 # posix aio fsync probe
506 if test "$posix_aio" = "yes" ; then
513 return aio_fsync(O_SYNC, &cb);
517 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
521 echo "POSIX AIO fsync $posix_aio_fsync"
523 ##########################################
527 #include <sys/types.h>
528 #include <sys/asynch.h>
533 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
537 if compile_prog "" "-laio" "solarisaio" ; then
541 echo "Solaris AIO support $solaris_aio"
543 ##########################################
544 # __sync_fetch_and_and test
547 static int sfaa(int *ptr)
549 return __sync_fetch_and_add(ptr, 0);
552 int main(int argc, char **argv)
559 if compile_prog "" "" "__sync_fetch_and_add()" ; then
562 echo "__sync_fetch_and_add $sfaa"
564 ##########################################
569 #include <infiniband/arch.h>
570 int main(int argc, char **argv)
572 struct ibv_pd *pd = ibv_alloc_pd(NULL);
576 if compile_prog "" "-libverbs" "libverbs" ; then
578 LIBS="-libverbs $LIBS"
580 echo "libverbs $libverbs"
582 ##########################################
587 #include <rdma/rdma_cma.h>
588 int main(int argc, char **argv)
590 rdma_destroy_qp(NULL);
594 if compile_prog "" "-lrdmacm" "rdma"; then
596 LIBS="-lrdmacm $LIBS"
598 echo "rdmacm $rdmacm"
600 ##########################################
601 # Linux fallocate probe
606 #include <linux/falloc.h>
607 int main(int argc, char **argv)
609 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
613 if compile_prog "" "" "linux_fallocate"; then
614 linux_fallocate="yes"
616 echo "Linux fallocate $linux_fallocate"
618 ##########################################
619 # POSIX fadvise probe
624 int main(int argc, char **argv)
626 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
630 if compile_prog "" "" "posix_fadvise"; then
633 echo "POSIX fadvise $posix_fadvise"
635 ##########################################
636 # POSIX fallocate probe
641 int main(int argc, char **argv)
643 int r = posix_fallocate(0, 0, 1024);
647 if compile_prog "" "" "posix_fallocate"; then
648 posix_fallocate="yes"
650 echo "POSIX fallocate $posix_fallocate"
652 ##########################################
653 # sched_set/getaffinity 2 or 3 argument test
654 linux_2arg_affinity="no"
655 linux_3arg_affinity="no"
658 int main(int argc, char **argv)
661 return sched_setaffinity(0, sizeof(mask), &mask);
664 if compile_prog "" "" "sched_setaffinity(,,)"; then
665 linux_3arg_affinity="yes"
669 int main(int argc, char **argv)
672 return sched_setaffinity(0, &mask);
675 if compile_prog "" "" "sched_setaffinity(,)"; then
676 linux_2arg_affinity="yes"
679 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
680 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
682 ##########################################
683 # clock_gettime probe
688 int main(int argc, char **argv)
690 return clock_gettime(0, NULL);
693 if compile_prog "" "" "clock_gettime"; then
695 elif compile_prog "" "-lrt" "clock_gettime"; then
699 echo "clock_gettime $clock_gettime"
701 ##########################################
702 # CLOCK_MONOTONIC probe
704 if test "$clock_gettime" = "yes" ; then
708 int main(int argc, char **argv)
710 return clock_gettime(CLOCK_MONOTONIC, NULL);
713 if compile_prog "" "$LIBS" "clock monotonic"; then
714 clock_monotonic="yes"
717 echo "CLOCK_MONOTONIC $clock_monotonic"
719 ##########################################
720 # CLOCK_MONOTONIC_PRECISE probe
721 clock_monotonic_precise="no"
722 if test "$clock_gettime" = "yes" ; then
726 int main(int argc, char **argv)
728 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
731 if compile_prog "" "$LIBS" "clock monotonic precise"; then
732 clock_monotonic_precise="yes"
735 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
737 ##########################################
738 # gettimeofday() probe
741 #include <sys/time.h>
743 int main(int argc, char **argv)
746 return gettimeofday(&tv, NULL);
749 if compile_prog "" "" "gettimeofday"; then
752 echo "gettimeofday $gettimeofday"
754 ##########################################
760 int main(int argc, char **argv)
765 if compile_prog "" "" "fdatasync"; then
768 echo "fdatasync $fdatasync"
770 ##########################################
771 # sync_file_range() probe
777 #include <linux/fs.h>
778 int main(int argc, char **argv)
780 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
781 SYNC_FILE_RANGE_WAIT_AFTER;
782 return sync_file_range(0, 0, 0, flags);
785 if compile_prog "" "" "sync_file_range"; then
786 sync_file_range="yes"
788 echo "sync_file_range $sync_file_range"
790 ##########################################
791 # ext4 move extent probe
795 #include <sys/ioctl.h>
796 int main(int argc, char **argv)
798 struct move_extent me;
799 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
802 if compile_prog "" "" "ext4 move extent" ; then
804 elif test $targetos = "Linux" ; then
805 # On Linux, just default to it on and let it error at runtime if we really
806 # don't have it. None of my updated systems have it defined, but it does
807 # work. Takes a while to bubble back.
810 echo "EXT4 move extent $ext4_me"
812 ##########################################
818 int main(int argc, char **argv)
820 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
823 if compile_prog "" "" "linux splice"; then
826 echo "Linux splice(2) $linux_splice"
828 ##########################################
833 #include <guasi_syscalls.h>
834 int main(int argc, char **argv)
836 guasi_t ctx = guasi_create(0, 0, 0);
840 if compile_prog "" "" "guasi"; then
845 ##########################################
849 #include <nvm/nvm_primitives.h>
850 int main(int argc, char **argv)
852 nvm_version_t ver_info;
855 handle = nvm_get_handle(0, &ver_info);
856 return nvm_atomic_write(handle, 0, 0, 0);
859 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then
860 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS"
863 echo "Fusion-io atomic engine $fusion_aw"
865 ##########################################
870 int main(int argc, char **argv)
872 return numa_available();
875 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
879 echo "libnuma $libnuma"
881 ##########################################
882 # libnuma 2.x version API
883 if test "$libnuma" = "yes" ; then
887 int main(int argc, char **argv)
889 struct bitmask *mask = numa_parse_nodestring(NULL);
890 return mask->size == 0;
893 if compile_prog "" "" "libnuma api"; then
896 echo "libnuma v2 $libnuma_v2"
899 ##########################################
904 int main(int argc, char **argv)
910 if compile_prog "" "" "strsep"; then
913 echo "strsep $strsep"
915 ##########################################
920 int main(int argc, char **argv)
922 return strcasestr(argv[0], argv[1]) != NULL;
925 if compile_prog "" "" "strcasestr"; then
928 echo "strcasestr $strcasestr"
930 ##########################################
931 # getopt_long_only() probe
932 getopt_long_only="no"
937 int main(int argc, char **argv)
939 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
943 if compile_prog "" "" "getopt_long_only"; then
944 getopt_long_only="yes"
946 echo "getopt_long_only() $getopt_long_only"
948 ##########################################
952 #include <sys/socket.h>
953 #include <arpa/inet.h>
955 int main(int argc, char **argv)
958 return inet_aton(NULL, &in);
961 if compile_prog "" "" "inet_aton"; then
964 echo "inet_aton $inet_aton"
966 ##########################################
970 #include <sys/socket.h>
971 int main(int argc, char **argv)
977 if compile_prog "" "" "socklen_t"; then
980 echo "socklen_t $socklen_t"
982 ##########################################
983 # Whether or not __thread is supported for TLS
987 static __thread int ret;
988 int main(int argc, char **argv)
993 if compile_prog "" "" "__thread"; then
996 echo "__thread $tls_thread"
998 ##########################################
999 # Check if we have required gtk/glib support for gfio
1001 if test "$gfio_check" = "yes" ; then
1005 #include <gtk/gtk.h>
1008 gdk_threads_enter();
1009 gdk_threads_leave();
1011 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1014 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1015 ORG_LDFLAGS=$LDFLAGS
1016 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1017 if test "$?" != "0" ; then
1018 echo "configure: gtk and gthread not found"
1021 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1022 if test "$?" != "0" ; then
1023 echo "configure: gtk and gthread not found"
1026 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1028 if test "$r" != "0" ; then
1030 GFIO_LIBS="$LIBS $GTK_LIBS"
1031 CFLAGS="$CFLAGS $GTK_CFLAGS"
1033 echo "GTK found, but need version 2.18 or higher"
1037 echo "Please install gtk and gdk libraries"
1040 LDFLAGS=$ORG_LDFLAGS
1043 if test "$gfio_check" = "yes" ; then
1044 echo "gtk 2.18 or higher $gfio"
1047 # Check whether we have getrusage(RUSAGE_THREAD)
1050 #include <sys/time.h>
1051 #include <sys/resource.h>
1052 int main(int argc, char **argv)
1055 getrusage(RUSAGE_THREAD, &ru);
1059 if compile_prog "" "" "RUSAGE_THREAD"; then
1062 echo "RUSAGE_THREAD $rusage_thread"
1064 ##########################################
1065 # Check whether we have SCHED_IDLE
1069 int main(int argc, char **argv)
1071 struct sched_param p;
1072 return sched_setscheduler(0, SCHED_IDLE, &p);
1075 if compile_prog "" "" "SCHED_IDLE"; then
1078 echo "SCHED_IDLE $sched_idle"
1080 ##########################################
1081 # Check whether we have TCP_NODELAY
1085 #include <sys/types.h>
1086 #include <sys/socket.h>
1087 #include <netinet/tcp.h>
1088 int main(int argc, char **argv)
1090 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1093 if compile_prog "" "" "TCP_NODELAY"; then
1096 echo "TCP_NODELAY $tcp_nodelay"
1098 ##########################################
1099 # Check whether we have SO_SNDBUF
1103 #include <sys/types.h>
1104 #include <sys/socket.h>
1105 #include <netinet/tcp.h>
1106 int main(int argc, char **argv)
1108 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1109 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1112 if compile_prog "" "" "SO_SNDBUF"; then
1115 echo "Net engine window_size $window_size"
1117 ##########################################
1118 # Check whether we have TCP_MAXSEG
1122 #include <sys/types.h>
1123 #include <sys/socket.h>
1124 #include <netinet/tcp.h>
1125 #include <arpa/inet.h>
1126 #include <netinet/in.h>
1127 int main(int argc, char **argv)
1129 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1132 if compile_prog "" "" "TCP_MAXSEG"; then
1135 echo "TCP_MAXSEG $mss"
1137 ##########################################
1138 # Check whether we have RLIMIT_MEMLOCK
1141 #include <sys/time.h>
1142 #include <sys/resource.h>
1143 int main(int argc, char **argv)
1146 return getrlimit(RLIMIT_MEMLOCK, &rl);
1149 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1150 rlimit_memlock="yes"
1152 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1154 ##########################################
1155 # Check whether we have pwritev/preadv
1159 #include <sys/uio.h>
1160 int main(int argc, char **argv)
1162 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1165 if compile_prog "" "" "pwritev"; then
1168 echo "pwritev/preadv $pwritev"
1170 ##########################################
1171 # Check whether we have the required functions for ipv6
1174 #include <sys/types.h>
1175 #include <sys/socket.h>
1176 #include <netinet/in.h>
1179 int main(int argc, char **argv)
1181 struct addrinfo hints;
1182 struct in6_addr addr;
1185 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1187 printf("%s\n", gai_strerror(ret));
1192 if compile_prog "" "" "ipv6"; then
1195 echo "IPv6 helpers $ipv6"
1197 ##########################################
1201 #include <rbd/librbd.h>
1203 int main(int argc, char **argv)
1207 rados_ioctx_t io_ctx;
1208 const char pool[] = "rbd";
1210 int major, minor, extra;
1211 rbd_version(&major, &minor, &extra);
1213 rados_ioctx_create(cluster, pool, &io_ctx);
1217 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1218 LIBS="-lrbd -lrados $LIBS"
1221 echo "Rados Block Device engine $rbd"
1223 ##########################################
1224 # check for rbd_invaidate_cache()
1226 if test "$rbd" = "yes"; then
1228 #include <rbd/librbd.h>
1230 int main(int argc, char **argv)
1234 return rbd_invalidate_cache(image);
1237 if compile_prog "" "-lrbd -lrados" "rbd"; then
1240 echo "rbd_invalidate_cache $rbd_inval"
1243 ##########################################
1244 # Check whether we have setvbuf
1248 int main(int argc, char **argv)
1252 setvbuf(f, buf, _IOFBF, sizeof(buf));
1256 if compile_prog "" "" "setvbuf"; then
1259 echo "setvbuf $setvbuf"
1264 #include <glusterfs/api/glfs.h>
1266 int main(int argc, char **argv)
1269 glfs_t *g = glfs_new("foo");
1274 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1275 LIBS="-lgfapi -lglusterfs $LIBS"
1278 echo "Gluster API engine $gfapi"
1280 ##########################################
1281 # check for gfapi fadvise support
1282 if test "$gfapi" = "yes" ; then
1285 #include <glusterfs/api/glfs.h>
1287 int main(int argc, char **argv)
1290 int ret = glfs_fadvise(fd, 0, 0, 1);
1295 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1298 echo "Gluster API use fadvise $gf_fadvise"
1301 ##########################################
1302 # check for gfapi trim support
1304 if test "$gfapi" = "yes" ; then
1306 #include <glusterfs/api/glfs.h>
1308 int main(int argc, char **argv)
1310 return glfs_discard_async(NULL, 0, 0);
1313 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1316 echo "Gluster API trim support $gf_trim"
1319 ##########################################
1320 # Check if we support stckf on s390
1321 s390_z196_facilities="no"
1323 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1324 int main(int argc, char **argv)
1326 /* We want just 1 double word to be returned. */
1327 register unsigned long reg0 asm("0") = 0;
1328 unsigned long stfle_bits;
1329 asm volatile(".machine push" "\n\t"
1330 ".machine \"z9-109\"" "\n\t"
1333 : "=QS" (stfle_bits), "+d" (reg0)
1336 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1342 if compile_prog "" "" "s390_z196_facilities"; then
1344 if [[ $? -eq 0 ]]; then
1345 s390_z196_facilities="yes"
1348 echo "s390_z196_facilities $s390_z196_facilities"
1350 ##########################################
1351 # Check if we have required environment variables configured for libhdfs
1352 if test "$libhdfs" = "yes" ; then
1354 if test "$JAVA_HOME" = "" ; then
1355 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1358 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1359 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1362 if test "$FIO_LIBHDFS_LIB" = "" ; then
1363 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1366 if test "$hdfs_conf_error" = "1" ; then
1370 echo "HDFS engine $libhdfs"
1372 # Check if we have lex/yacc available
1377 if test "$targetos" != "SunOS" ; then
1378 LEX=$(which lex 2> /dev/null)
1379 if test -x "$LEX" ; then
1382 YACC=$(which bison 2> /dev/null)
1383 if test -x "$YACC" ; then
1387 YACC=$(which yacc 2> /dev/null)
1388 if test -x "$YACC" ; then
1392 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1396 if test "$arith" = "yes" ; then
1398 extern int yywrap(void);
1400 int main(int argc, char **argv)
1406 if compile_prog "" "-ll" "lex"; then
1414 echo "lex/yacc for arithmetic $arith"
1416 #############################################################################
1418 if test "$wordsize" = "64" ; then
1419 output_sym "CONFIG_64BIT"
1420 elif test "$wordsize" = "32" ; then
1421 output_sym "CONFIG_32BIT"
1423 fatal "Unknown wordsize!"
1425 if test "$bigendian" = "yes" ; then
1426 output_sym "CONFIG_BIG_ENDIAN"
1428 output_sym "CONFIG_LITTLE_ENDIAN"
1430 if test "$zlib" = "yes" ; then
1431 output_sym "CONFIG_ZLIB"
1433 if test "$libaio" = "yes" ; then
1434 output_sym "CONFIG_LIBAIO"
1436 if test "$posix_aio" = "yes" ; then
1437 output_sym "CONFIG_POSIXAIO"
1439 if test "$posix_aio_fsync" = "yes" ; then
1440 output_sym "CONFIG_POSIXAIO_FSYNC"
1442 if test "$linux_fallocate" = "yes" ; then
1443 output_sym "CONFIG_LINUX_FALLOCATE"
1445 if test "$posix_fallocate" = "yes" ; then
1446 output_sym "CONFIG_POSIX_FALLOCATE"
1448 if test "$fdatasync" = "yes" ; then
1449 output_sym "CONFIG_FDATASYNC"
1451 if test "$sync_file_range" = "yes" ; then
1452 output_sym "CONFIG_SYNC_FILE_RANGE"
1454 if test "$sfaa" = "yes" ; then
1455 output_sym "CONFIG_SFAA"
1457 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1458 output_sym "CONFIG_RDMA"
1460 if test "$clock_gettime" = "yes" ; then
1461 output_sym "CONFIG_CLOCK_GETTIME"
1463 if test "$clock_monotonic" = "yes" ; then
1464 output_sym "CONFIG_CLOCK_MONOTONIC"
1466 if test "$clock_monotonic_precise" = "yes" ; then
1467 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1469 if test "$gettimeofday" = "yes" ; then
1470 output_sym "CONFIG_GETTIMEOFDAY"
1472 if test "$posix_fadvise" = "yes" ; then
1473 output_sym "CONFIG_POSIX_FADVISE"
1475 if test "$linux_3arg_affinity" = "yes" ; then
1476 output_sym "CONFIG_3ARG_AFFINITY"
1477 elif test "$linux_2arg_affinity" = "yes" ; then
1478 output_sym "CONFIG_2ARG_AFFINITY"
1480 if test "$strsep" = "yes" ; then
1481 output_sym "CONFIG_STRSEP"
1483 if test "$strcasestr" = "yes" ; then
1484 output_sym "CONFIG_STRCASESTR"
1486 if test "$getopt_long_only" = "yes" ; then
1487 output_sym "CONFIG_GETOPT_LONG_ONLY"
1489 if test "$inet_aton" = "yes" ; then
1490 output_sym "CONFIG_INET_ATON"
1492 if test "$socklen_t" = "yes" ; then
1493 output_sym "CONFIG_SOCKLEN_T"
1495 if test "$ext4_me" = "yes" ; then
1496 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1498 if test "$linux_splice" = "yes" ; then
1499 output_sym "CONFIG_LINUX_SPLICE"
1501 if test "$guasi" = "yes" ; then
1502 output_sym "CONFIG_GUASI"
1504 if test "$fusion_aw" = "yes" ; then
1505 output_sym "CONFIG_FUSION_AW"
1507 if test "$libnuma_v2" = "yes" ; then
1508 output_sym "CONFIG_LIBNUMA"
1510 if test "$solaris_aio" = "yes" ; then
1511 output_sym "CONFIG_SOLARISAIO"
1513 if test "$tls_thread" = "yes" ; then
1514 output_sym "CONFIG_TLS_THREAD"
1516 if test "$rusage_thread" = "yes" ; then
1517 output_sym "CONFIG_RUSAGE_THREAD"
1519 if test "$gfio" = "yes" ; then
1520 echo "CONFIG_GFIO=y" >> $config_host_mak
1522 if test "$esx" = "yes" ; then
1523 output_sym "CONFIG_ESX"
1524 output_sym "CONFIG_NO_SHM"
1526 if test "$sched_idle" = "yes" ; then
1527 output_sym "CONFIG_SCHED_IDLE"
1529 if test "$tcp_nodelay" = "yes" ; then
1530 output_sym "CONFIG_TCP_NODELAY"
1532 if test "$window_size" = "yes" ; then
1533 output_sym "CONFIG_NET_WINDOWSIZE"
1535 if test "$mss" = "yes" ; then
1536 output_sym "CONFIG_NET_MSS"
1538 if test "$rlimit_memlock" = "yes" ; then
1539 output_sym "CONFIG_RLIMIT_MEMLOCK"
1541 if test "$pwritev" = "yes" ; then
1542 output_sym "CONFIG_PWRITEV"
1544 if test "$ipv6" = "yes" ; then
1545 output_sym "CONFIG_IPV6"
1547 if test "$rbd" = "yes" ; then
1548 output_sym "CONFIG_RBD"
1550 if test "$rbd_inval" = "yes" ; then
1551 output_sym "CONFIG_RBD_INVAL"
1553 if test "$setvbuf" = "yes" ; then
1554 output_sym "CONFIG_SETVBUF"
1556 if test "$s390_z196_facilities" = "yes" ; then
1557 output_sym "CONFIG_S390_Z196_FACILITIES"
1558 CFLAGS="$CFLAGS -march=z9-109"
1560 if test "$gfapi" = "yes" ; then
1561 output_sym "CONFIG_GFAPI"
1563 if test "$gf_fadvise" = "yes" ; then
1564 output_sym "CONFIG_GF_FADVISE"
1566 if test "$gf_trim" = "yes" ; then
1567 output_sym "CONFIG_GF_TRIM"
1569 if test "$libhdfs" = "yes" ; then
1570 output_sym "CONFIG_LIBHDFS"
1571 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1572 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1573 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1575 if test "$arith" = "yes" ; then
1576 output_sym "CONFIG_ARITHMETIC"
1577 if test "$yacc_is_bison" = "yes" ; then
1578 echo "YACC=$YACC -y" >> $config_host_mak
1580 echo "YACC=$YACC" >> $config_host_mak
1584 if test "$zlib" = "no" ; then
1585 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1588 echo "LIBS+=$LIBS" >> $config_host_mak
1589 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1590 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1591 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1592 echo "CC=$cc" >> $config_host_mak
1593 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak