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"
158 --disable-numa) disable_numa="yes"
160 --disable-rbd) disable_rbd="yes"
162 --disable-gfapi) disable_gfapi="yes"
164 --enable-libhdfs) libhdfs="yes"
170 echo "Bad option $opt"
176 if test "$show_help" = "yes" ; then
177 echo "--cpu= Specify target CPU if auto-detect fails"
178 echo "--cc= Specify compiler to use"
179 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
180 echo "--build-32bit-win Enable 32-bit build on Windows"
181 echo "--esx Configure build options for esx"
182 echo "--enable-gfio Enable building of gtk gfio"
183 echo "--disable-numa Disable libnuma even if found"
184 echo "--enable-libhdfs Enable hdfs support"
188 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
189 cc="${CC-${cross_prefix}gcc}"
191 if check_define __ANDROID__ ; then
193 elif check_define __linux__ ; then
195 elif check_define __OpenBSD__ ; then
197 elif check_define __sun__ ; then
199 CFLAGS="$CFLAGS -D_REENTRANT"
200 elif check_define _WIN32 ; then
206 echo "# Automatically generated by configure - do not modify" > $config_host_mak
207 printf "# Configured with:" >> $config_host_mak
208 printf " '%s'" "$0" "$@" >> $config_host_mak
209 echo >> $config_host_mak
210 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
212 # Some host OSes need non-standard checks for which CPU to use.
213 # Note that these checks are broken for cross-compilation: if you're
214 # cross-compiling to one of these OSes then you'll need to specify
215 # the correct CPU with the --cpu option.
218 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
219 # we can run 64-bit userspace code.
220 # If the user didn't specify a CPU explicitly and the kernel says this is
221 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
223 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
228 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
229 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
232 LIBS="-lnsl -lsocket"
235 echo "Forcing known good options on Windows"
236 if test -z "$CC" ; then
237 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
238 CC="i686-w64-mingw32-gcc"
240 CC="x86_64-w64-mingw32-gcc"
243 output_sym "CONFIG_LITTLE_ENDIAN"
244 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
245 output_sym "CONFIG_32BIT"
247 output_sym "CONFIG_64BIT_LLP64"
249 output_sym "CONFIG_FADVISE"
250 output_sym "CONFIG_SOCKLEN_T"
251 output_sym "CONFIG_FADVISE"
252 output_sym "CONFIG_SFAA"
253 output_sym "CONFIG_RUSAGE_THREAD"
254 output_sym "CONFIG_WINDOWSAIO"
255 output_sym "CONFIG_FDATASYNC"
256 output_sym "CONFIG_CLOCK_MONOTONIC"
257 output_sym "CONFIG_GETTIMEOFDAY"
258 output_sym "CONFIG_CLOCK_GETTIME"
259 output_sym "CONFIG_SCHED_IDLE"
260 output_sym "CONFIG_TCP_NODELAY"
261 output_sym "CONFIG_TLS_THREAD"
262 output_sym "CONFIG_IPV6"
263 echo "CC=$CC" >> $config_host_mak
264 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
269 if test ! -z "$cpu" ; then
270 # command line argument
272 elif check_define __i386__ ; then
274 elif check_define __x86_64__ ; then
276 elif check_define __sparc__ ; then
277 if check_define __arch64__ ; then
282 elif check_define _ARCH_PPC ; then
283 if check_define _ARCH_PPC64 ; then
288 elif check_define __mips__ ; then
290 elif check_define __ia64__ ; then
292 elif check_define __s390__ ; then
293 if check_define __s390x__ ; then
298 elif check_define __arm__ ; then
300 elif check_define __hppa__ ; then
306 # Normalise host CPU name and set ARCH.
308 ia64|ppc|ppc64|s390|s390x|sparc64)
311 i386|i486|i586|i686|i86pc|BePC)
320 hppa|parisc|parisc64)
334 if test -z "$CC" ; then
335 if test "$targetos" = "FreeBSD"; then
344 cc="${CC-${cross_prefix}gcc}"
346 ##########################################
347 # check cross compile
356 if compile_prog "" "" "cross"; then
357 $TMPE 2>/dev/null || cross_compile="yes"
359 fatal "compile test failed"
362 ##########################################
365 if test "$cross_compile" = "no" ; then
367 #include <inttypes.h>
370 volatile uint32_t i=0x01234567;
371 return (*((uint8_t*)(&i))) == 0x67;
374 if compile_prog "" "" "endian"; then
375 $TMPE && bigendian="yes"
378 # If we're cross compiling, try our best to work it out and rely on the
379 # run-time check to fail if we get it wrong.
384 #if __BYTE_ORDER != __BIG_ENDIAN
385 # error "Unknown endianness"
389 compile_prog "" "" "endian" && bigendian="yes"
390 check_define "__ARMEB__" && bigendian="yes"
391 check_define "__MIPSEB__" && bigendian="yes"
395 echo "Operating system $targetos"
397 echo "Big endian $bigendian"
399 echo "Cross compile $cross_compile"
402 ##########################################
407 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
410 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
414 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
416 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
419 fatal "Unknown wordsize"
421 echo "Wordsize $wordsize"
423 ##########################################
431 if (inflateInit(&stream) != Z_OK)
436 if compile_prog "" "-lz" "zlib" ; then
442 ##########################################
454 if compile_prog "" "-laio" "libaio" ; then
458 if test "$libaio" = "yes" ; then
459 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
463 echo "Linux AIO support $libaio"
465 ##########################################
478 if compile_prog "" "" "posixaio" ; then
480 elif compile_prog "" "-lrt" "posixaio"; then
485 echo "POSIX AIO support $posix_aio"
486 echo "POSIX AIO support needs -lrt $posix_aio_lrt"
488 ##########################################
489 # posix aio fsync probe
491 if test "$posix_aio" = "yes" ; then
498 return aio_fsync(O_SYNC, &cb);
502 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
506 echo "POSIX AIO fsync $posix_aio_fsync"
508 ##########################################
512 #include <sys/types.h>
513 #include <sys/asynch.h>
518 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
522 if compile_prog "" "-laio" "solarisaio" ; then
526 echo "Solaris AIO support $solaris_aio"
528 ##########################################
529 # __sync_fetch_and_and test
532 static int sfaa(int *ptr)
534 return __sync_fetch_and_add(ptr, 0);
537 int main(int argc, char **argv)
544 if compile_prog "" "" "__sync_fetch_and_add()" ; then
547 echo "__sync_fetch_and_add $sfaa"
549 ##########################################
554 #include <infiniband/arch.h>
555 int main(int argc, char **argv)
557 struct ibv_pd *pd = ibv_alloc_pd(NULL);
561 if compile_prog "" "-libverbs" "libverbs" ; then
563 LIBS="-libverbs $LIBS"
565 echo "libverbs $libverbs"
567 ##########################################
572 #include <rdma/rdma_cma.h>
573 int main(int argc, char **argv)
575 rdma_destroy_qp(NULL);
579 if compile_prog "" "-lrdmacm" "rdma"; then
581 LIBS="-lrdmacm $LIBS"
583 echo "rdmacm $rdmacm"
585 ##########################################
586 # Linux fallocate probe
591 #include <linux/falloc.h>
592 int main(int argc, char **argv)
594 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
598 if compile_prog "" "" "linux_fallocate"; then
599 linux_fallocate="yes"
601 echo "Linux fallocate $linux_fallocate"
603 ##########################################
604 # POSIX fadvise probe
609 int main(int argc, char **argv)
611 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
615 if compile_prog "" "" "posix_fadvise"; then
618 echo "POSIX fadvise $posix_fadvise"
620 ##########################################
621 # POSIX fallocate probe
626 int main(int argc, char **argv)
628 int r = posix_fallocate(0, 0, 1024);
632 if compile_prog "" "" "posix_fallocate"; then
633 posix_fallocate="yes"
635 echo "POSIX fallocate $posix_fallocate"
637 ##########################################
638 # sched_set/getaffinity 2 or 3 argument test
639 linux_2arg_affinity="no"
640 linux_3arg_affinity="no"
643 int main(int argc, char **argv)
646 return sched_setaffinity(0, sizeof(mask), &mask);
649 if compile_prog "" "" "sched_setaffinity(,,)"; then
650 linux_3arg_affinity="yes"
654 int main(int argc, char **argv)
657 return sched_setaffinity(0, &mask);
660 if compile_prog "" "" "sched_setaffinity(,)"; then
661 linux_2arg_affinity="yes"
664 echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
665 echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
667 ##########################################
668 # clock_gettime probe
673 int main(int argc, char **argv)
675 return clock_gettime(0, NULL);
678 if compile_prog "" "" "clock_gettime"; then
680 elif compile_prog "" "-lrt" "clock_gettime"; then
684 echo "clock_gettime $clock_gettime"
686 ##########################################
687 # CLOCK_MONOTONIC probe
689 if test "$clock_gettime" = "yes" ; then
693 int main(int argc, char **argv)
695 return clock_gettime(CLOCK_MONOTONIC, NULL);
698 if compile_prog "" "$LIBS" "clock monotonic"; then
699 clock_monotonic="yes"
702 echo "CLOCK_MONOTONIC $clock_monotonic"
704 ##########################################
705 # CLOCK_MONOTONIC_PRECISE probe
706 clock_monotonic_precise="no"
707 if test "$clock_gettime" = "yes" ; then
711 int main(int argc, char **argv)
713 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
716 if compile_prog "" "$LIBS" "clock monotonic precise"; then
717 clock_monotonic_precise="yes"
720 echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
722 ##########################################
723 # gettimeofday() probe
726 #include <sys/time.h>
728 int main(int argc, char **argv)
731 return gettimeofday(&tv, NULL);
734 if compile_prog "" "" "gettimeofday"; then
737 echo "gettimeofday $gettimeofday"
739 ##########################################
745 int main(int argc, char **argv)
750 if compile_prog "" "" "fdatasync"; then
753 echo "fdatasync $fdatasync"
755 ##########################################
756 # sync_file_range() probe
762 #include <linux/fs.h>
763 int main(int argc, char **argv)
765 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
766 SYNC_FILE_RANGE_WAIT_AFTER;
767 return sync_file_range(0, 0, 0, flags);
770 if compile_prog "" "" "sync_file_range"; then
771 sync_file_range="yes"
773 echo "sync_file_range $sync_file_range"
775 ##########################################
776 # ext4 move extent probe
780 #include <sys/ioctl.h>
781 int main(int argc, char **argv)
783 struct move_extent me;
784 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
787 if compile_prog "" "" "ext4 move extent" ; then
789 elif test $targetos = "Linux" ; then
790 # On Linux, just default to it on and let it error at runtime if we really
791 # don't have it. None of my updated systems have it defined, but it does
792 # work. Takes a while to bubble back.
795 echo "EXT4 move extent $ext4_me"
797 ##########################################
803 int main(int argc, char **argv)
805 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
808 if compile_prog "" "" "linux splice"; then
811 echo "Linux splice(2) $linux_splice"
813 ##########################################
818 #include <guasi_syscalls.h>
819 int main(int argc, char **argv)
821 guasi_t ctx = guasi_create(0, 0, 0);
825 if compile_prog "" "" "guasi"; then
830 ##########################################
834 #include <nvm/nvm_primitives.h>
835 int main(int argc, char **argv)
837 nvm_version_t ver_info;
840 handle = nvm_get_handle(0, &ver_info);
841 return nvm_atomic_write(handle, 0, 0, 0);
844 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then
845 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS"
848 echo "Fusion-io atomic engine $fusion_aw"
850 ##########################################
855 int main(int argc, char **argv)
857 return numa_available();
860 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
864 echo "libnuma $libnuma"
866 ##########################################
867 # libnuma 2.x version API
868 if test "$libnuma" = "yes" ; then
872 int main(int argc, char **argv)
874 struct bitmask *mask = numa_parse_nodestring(NULL);
878 if compile_prog "" "" "libnuma api"; then
881 echo "libnuma v2 $libnuma_v2"
884 ##########################################
889 int main(int argc, char **argv)
895 if compile_prog "" "" "strsep"; then
898 echo "strsep $strsep"
900 ##########################################
905 int main(int argc, char **argv)
907 return strcasestr(argv[0], argv[1]) != NULL;
910 if compile_prog "" "" "strcasestr"; then
913 echo "strcasestr $strcasestr"
915 ##########################################
916 # getopt_long_only() probe
917 getopt_long_only="no"
922 int main(int argc, char **argv)
924 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
928 if compile_prog "" "" "getopt_long_only"; then
929 getopt_long_only="yes"
931 echo "getopt_long_only() $getopt_long_only"
933 ##########################################
937 #include <sys/socket.h>
938 #include <arpa/inet.h>
940 int main(int argc, char **argv)
943 return inet_aton(NULL, &in);
946 if compile_prog "" "" "inet_aton"; then
949 echo "inet_aton $inet_aton"
951 ##########################################
955 #include <sys/socket.h>
956 int main(int argc, char **argv)
962 if compile_prog "" "" "socklen_t"; then
965 echo "socklen_t $socklen_t"
967 ##########################################
968 # Whether or not __thread is supported for TLS
972 static __thread int ret;
973 int main(int argc, char **argv)
978 if compile_prog "" "" "__thread"; then
981 echo "__thread $tls_thread"
983 ##########################################
984 # Check if we have required gtk/glib support for gfio
986 if test "$gfio_check" = "yes" ; then
996 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
999 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1000 if test "$?" != "0" ; then
1001 echo "configure: gtk and gthread not found"
1004 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1005 if test "$?" != "0" ; then
1006 echo "configure: gtk and gthread not found"
1009 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1011 if test "$r" != "0" ; then
1013 LIBS="$LIBS $GTK_LIBS"
1014 CFLAGS="$CFLAGS $GTK_CFLAGS"
1016 echo "GTK found, but need version 2.18 or higher"
1020 echo "Please install gtk and gdk libraries"
1025 if test "$gfio_check" = "yes" ; then
1026 echo "gtk 2.18 or higher $gfio"
1029 # Check whether we have getrusage(RUSAGE_THREAD)
1032 #include <sys/time.h>
1033 #include <sys/resource.h>
1034 int main(int argc, char **argv)
1037 getrusage(RUSAGE_THREAD, &ru);
1041 if compile_prog "" "" "RUSAGE_THREAD"; then
1044 echo "RUSAGE_THREAD $rusage_thread"
1046 ##########################################
1047 # Check whether we have SCHED_IDLE
1051 int main(int argc, char **argv)
1053 struct sched_param p;
1054 return sched_setscheduler(0, SCHED_IDLE, &p);
1057 if compile_prog "" "" "SCHED_IDLE"; then
1060 echo "SCHED_IDLE $sched_idle"
1062 ##########################################
1063 # Check whether we have TCP_NODELAY
1067 #include <sys/types.h>
1068 #include <sys/socket.h>
1069 #include <netinet/tcp.h>
1070 int main(int argc, char **argv)
1072 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1075 if compile_prog "" "" "TCP_NODELAY"; then
1078 echo "TCP_NODELAY $tcp_nodelay"
1080 ##########################################
1081 # Check whether we have SO_SNDBUF
1085 #include <sys/types.h>
1086 #include <sys/socket.h>
1087 #include <netinet/tcp.h>
1088 int main(int argc, char **argv)
1090 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1091 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1094 if compile_prog "" "" "SO_SNDBUF"; then
1097 echo "Net engine window_size $window_size"
1099 ##########################################
1100 # Check whether we have TCP_MAXSEG
1104 #include <sys/types.h>
1105 #include <sys/socket.h>
1106 #include <netinet/tcp.h>
1107 #include <arpa/inet.h>
1108 #include <netinet/in.h>
1109 int main(int argc, char **argv)
1111 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1114 if compile_prog "" "" "TCP_MAXSEG"; then
1117 echo "TCP_MAXSEG $mss"
1119 ##########################################
1120 # Check whether we have RLIMIT_MEMLOCK
1123 #include <sys/time.h>
1124 #include <sys/resource.h>
1125 int main(int argc, char **argv)
1128 return getrlimit(RLIMIT_MEMLOCK, &rl);
1131 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1132 rlimit_memlock="yes"
1134 echo "RLIMIT_MEMLOCK $rlimit_memlock"
1136 ##########################################
1137 # Check whether we have pwritev/preadv
1141 #include <sys/uio.h>
1142 int main(int argc, char **argv)
1144 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1147 if compile_prog "" "" "pwritev"; then
1150 echo "pwritev/preadv $pwritev"
1152 ##########################################
1153 # Check whether we have the required functions for ipv6
1156 #include <sys/types.h>
1157 #include <sys/socket.h>
1158 #include <netinet/in.h>
1161 int main(int argc, char **argv)
1163 struct addrinfo hints;
1164 struct in6_addr addr;
1167 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1169 printf("%s\n", gai_strerror(ret));
1174 if compile_prog "" "" "ipv6"; then
1177 echo "IPv6 helpers $ipv6"
1179 ##########################################
1183 #include <rbd/librbd.h>
1185 int main(int argc, char **argv)
1189 rados_ioctx_t io_ctx;
1190 const char pool[] = "rbd";
1192 int major, minor, extra;
1193 rbd_version(&major, &minor, &extra);
1195 rados_ioctx_create(cluster, pool, &io_ctx);
1199 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1200 LIBS="-lrbd -lrados $LIBS"
1203 echo "Rados Block Device engine $rbd"
1205 ##########################################
1206 # Check whether we have setvbuf
1210 int main(int argc, char **argv)
1214 setvbuf(f, buf, _IOFBF, sizeof(buf));
1218 if compile_prog "" "" "setvbuf"; then
1221 echo "setvbuf $setvbuf"
1226 #include <glusterfs/api/glfs.h>
1228 int main(int argc, char **argv)
1231 glfs_t *g = glfs_new("foo");
1236 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1237 LIBS="-lgfapi -lglusterfs $LIBS"
1240 echo "Gluster API engine $gfapi"
1242 ##########################################
1243 # check for gfapi fadvise support
1246 #include <glusterfs/api/glfs.h>
1248 int main(int argc, char **argv)
1251 int ret = glfs_fadvise(fd, 0, 0, 1);
1257 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1260 echo "Gluster API use fadvise $gf_fadvise"
1262 ##########################################
1263 # Check if we support stckf on s390
1264 s390_z196_facilities="no"
1266 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1267 int main(int argc, char **argv)
1269 /* We want just 1 double word to be returned. */
1270 register unsigned long reg0 asm("0") = 0;
1271 unsigned long stfle_bits;
1272 asm volatile(".machine push" "\n\t"
1273 ".machine \"z9-109\"" "\n\t"
1276 : "=QS" (stfle_bits), "+d" (reg0)
1279 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1285 if compile_prog "" "" "s390_z196_facilities"; then
1287 if [[ $? -eq 0 ]]; then
1288 s390_z196_facilities="yes"
1291 echo "s390_z196_facilities $s390_z196_facilities"
1293 ##########################################
1294 # Check if we have required environment variables configured for libhdfs
1295 if test "$libhdfs" = "yes" ; then
1297 if test "$JAVA_HOME" = "" ; then
1298 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1301 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1302 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1305 if test "$FIO_LIBHDFS_LIB" = "" ; then
1306 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1309 if test "$hdfs_conf_error" = "1" ; then
1313 echo "HDFS engine $libhdfs"
1315 # Check if we have lex/yacc available
1320 LEX=$(which lex 2> /dev/null)
1321 if test -x "$LEX" ; then
1324 YACC=$(which bison 2> /dev/null)
1325 if test -x "$YACC" ; then
1329 YACC=$(which yacc 2> /dev/null)
1330 if test -x "$YACC" ; then
1334 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1338 if test "$arith" = "yes" ; then
1340 extern int yywrap(void);
1342 int main(int argc, char **argv)
1349 if compile_prog "" "-ll" "lex"; then
1356 echo "lex/yacc for arithmetic $arith"
1358 #############################################################################
1360 if test "$wordsize" = "64" ; then
1361 output_sym "CONFIG_64BIT"
1362 elif test "$wordsize" = "32" ; then
1363 output_sym "CONFIG_32BIT"
1365 fatal "Unknown wordsize!"
1367 if test "$bigendian" = "yes" ; then
1368 output_sym "CONFIG_BIG_ENDIAN"
1370 output_sym "CONFIG_LITTLE_ENDIAN"
1372 if test "$zlib" = "yes" ; then
1373 output_sym "CONFIG_ZLIB"
1375 if test "$libaio" = "yes" ; then
1376 output_sym "CONFIG_LIBAIO"
1378 if test "$posix_aio" = "yes" ; then
1379 output_sym "CONFIG_POSIXAIO"
1381 if test "$posix_aio_fsync" = "yes" ; then
1382 output_sym "CONFIG_POSIXAIO_FSYNC"
1384 if test "$linux_fallocate" = "yes" ; then
1385 output_sym "CONFIG_LINUX_FALLOCATE"
1387 if test "$posix_fallocate" = "yes" ; then
1388 output_sym "CONFIG_POSIX_FALLOCATE"
1390 if test "$fdatasync" = "yes" ; then
1391 output_sym "CONFIG_FDATASYNC"
1393 if test "$sync_file_range" = "yes" ; then
1394 output_sym "CONFIG_SYNC_FILE_RANGE"
1396 if test "$sfaa" = "yes" ; then
1397 output_sym "CONFIG_SFAA"
1399 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1400 output_sym "CONFIG_RDMA"
1402 if test "$clock_gettime" = "yes" ; then
1403 output_sym "CONFIG_CLOCK_GETTIME"
1405 if test "$clock_monotonic" = "yes" ; then
1406 output_sym "CONFIG_CLOCK_MONOTONIC"
1408 if test "$clock_monotonic_precise" = "yes" ; then
1409 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1411 if test "$gettimeofday" = "yes" ; then
1412 output_sym "CONFIG_GETTIMEOFDAY"
1414 if test "$posix_fadvise" = "yes" ; then
1415 output_sym "CONFIG_POSIX_FADVISE"
1417 if test "$linux_3arg_affinity" = "yes" ; then
1418 output_sym "CONFIG_3ARG_AFFINITY"
1419 elif test "$linux_2arg_affinity" = "yes" ; then
1420 output_sym "CONFIG_2ARG_AFFINITY"
1422 if test "$strsep" = "yes" ; then
1423 output_sym "CONFIG_STRSEP"
1425 if test "$strcasestr" = "yes" ; then
1426 output_sym "CONFIG_STRCASESTR"
1428 if test "$getopt_long_only" = "yes" ; then
1429 output_sym "CONFIG_GETOPT_LONG_ONLY"
1431 if test "$inet_aton" = "yes" ; then
1432 output_sym "CONFIG_INET_ATON"
1434 if test "$socklen_t" = "yes" ; then
1435 output_sym "CONFIG_SOCKLEN_T"
1437 if test "$ext4_me" = "yes" ; then
1438 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1440 if test "$linux_splice" = "yes" ; then
1441 output_sym "CONFIG_LINUX_SPLICE"
1443 if test "$guasi" = "yes" ; then
1444 output_sym "CONFIG_GUASI"
1446 if test "$fusion_aw" = "yes" ; then
1447 output_sym "CONFIG_FUSION_AW"
1449 if test "$libnuma_v2" = "yes" ; then
1450 output_sym "CONFIG_LIBNUMA"
1452 if test "$solaris_aio" = "yes" ; then
1453 output_sym "CONFIG_SOLARISAIO"
1455 if test "$tls_thread" = "yes" ; then
1456 output_sym "CONFIG_TLS_THREAD"
1458 if test "$rusage_thread" = "yes" ; then
1459 output_sym "CONFIG_RUSAGE_THREAD"
1461 if test "$gfio" = "yes" ; then
1462 echo "CONFIG_GFIO=y" >> $config_host_mak
1464 if test "$esx" = "yes" ; then
1465 output_sym "CONFIG_ESX"
1466 output_sym "CONFIG_NO_SHM"
1468 if test "$sched_idle" = "yes" ; then
1469 output_sym "CONFIG_SCHED_IDLE"
1471 if test "$tcp_nodelay" = "yes" ; then
1472 output_sym "CONFIG_TCP_NODELAY"
1474 if test "$window_size" = "yes" ; then
1475 output_sym "CONFIG_NET_WINDOWSIZE"
1477 if test "$mss" = "yes" ; then
1478 output_sym "CONFIG_NET_MSS"
1480 if test "$rlimit_memlock" = "yes" ; then
1481 output_sym "CONFIG_RLIMIT_MEMLOCK"
1483 if test "$pwritev" = "yes" ; then
1484 output_sym "CONFIG_PWRITEV"
1486 if test "$ipv6" = "yes" ; then
1487 output_sym "CONFIG_IPV6"
1489 if test "$rbd" = "yes" ; then
1490 output_sym "CONFIG_RBD"
1492 if test "$setvbuf" = "yes" ; then
1493 output_sym "CONFIG_SETVBUF"
1495 if test "$s390_z196_facilities" = "yes" ; then
1496 output_sym "CONFIG_S390_Z196_FACILITIES"
1497 CFLAGS="$CFLAGS -march=z9-109"
1499 if test "$gfapi" = "yes" ; then
1500 output_sym "CONFIG_GFAPI"
1502 if test "$gf_fadvise" = "yes" ; then
1503 output_sym "CONFIG_GF_FADVISE"
1505 if test "$libhdfs" = "yes" ; then
1506 output_sym "CONFIG_LIBHDFS"
1508 if test "$arith" = "yes" ; then
1509 output_sym "CONFIG_ARITHMETIC"
1510 if test "$yacc_is_bison" = "yes" ; then
1511 echo "YACC=$YACC -y" >> $config_host_mak
1513 echo "YACC=$YACC" >> $config_host_mak
1517 if test "$zlib" = "no" ; then
1518 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1521 echo "LIBS+=$LIBS" >> $config_host_mak
1522 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1523 echo "CC=$cc" >> $config_host_mak
1524 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak