3 # Fio configure script. Heavily influenced by the manual qemu configure
4 # script. Sad 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 TMPC2="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c"
18 TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
19 TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
21 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
22 # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
23 trap "rm -f $TMPC $TMPC2 $TMPO $TMPE" EXIT INT QUIT TERM
27 config_host_mak="config-host.mak"
28 config_host_h="config-host.h"
30 rm -rf $config_host_mak
35 echo "Configure failed, check config.log and/or the above output"
36 rm -rf $config_host_mak
41 # Print result for each configuration test
43 printf "%-30s%s\n" "$1" "$2"
47 CFLAGS="-D_GNU_SOURCE -include config-host.h"
50 # Print a helpful header at the top of config.log
51 echo "# FIO configure log $(date)" >> config.log
52 printf "# Configured with:" >> config.log
53 printf " '%s'" "$0" "$@" >> config.log
55 echo "#" >> config.log
57 # Print configure header at the top of $config_host_h
58 echo "/*" > $config_host_h
59 echo " * Automatically generated by configure - do not modify" >> $config_host_h
60 printf " * Configured with:" >> $config_host_h
61 printf " * '%s'" "$0" "$@" >> $config_host_h
62 echo "" >> $config_host_h
63 echo " */" >> $config_host_h
66 # Run the compiler, capturing its output to the log.
67 echo $cc "$@" >> config.log
68 $cc "$@" >> config.log 2>&1 || return $?
69 # Test passed. If this is an --enable-werror build, rerun
70 # the test with -Werror and bail out if it fails. This
71 # makes warning-generating-errors in configure test code
72 # obvious to developers.
73 if test "$werror" != "yes"; then
76 # Don't bother rerunning the compile if we were already using -Werror
82 echo $cc -Werror "$@" >> config.log
83 $cc -Werror "$@" >> config.log 2>&1 && return $?
84 echo "ERROR: configure test passed without -Werror but failed with -Werror."
85 echo "This is probably a bug in the configure script. The failing command"
86 echo "will be at the bottom of config.log."
87 fatal "You can run configure with --disable-werror to bypass this check."
91 do_cc $CFLAGS -c -o $TMPO $TMPC
96 local_ldflags="$2 $LIBS"
97 echo "Compiling test case $3" >> config.log
98 do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
101 feature_not_found() {
106 echo "ERROR: User requested feature $feature"
107 if test ! -z "$packages" ; then
108 echo "ERROR: That feature needs $packages installed"
110 echo "ERROR: configure was not able to find it"
115 type "$1" >/dev/null 2>&1
121 #error $1 not defined
132 echo "$1=y" >> $config_host_mak
133 echo "#define $1" >> $config_host_h
157 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
159 --prefix=*) prefix="$optarg"
161 --cpu=*) cpu="$optarg"
163 # esx is cross compiled and cannot be detect through simple uname calls
169 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
171 --build-32bit-win) build_32bit_win="yes"
173 --target-win-ver=*) target_win_ver="$optarg"
175 --build-static) build_static="yes"
177 --enable-gfio) gfio_check="yes"
179 --disable-numa) disable_numa="yes"
181 --disable-rdma) disable_rdma="yes"
183 --disable-rados) disable_rados="yes"
185 --disable-rbd) disable_rbd="yes"
187 --disable-http) disable_http="yes"
189 --disable-gfapi) disable_gfapi="yes"
191 --enable-libhdfs) libhdfs="yes"
193 --disable-lex) disable_lex="yes"
195 --enable-lex) disable_lex="no"
197 --disable-shm) no_shm="yes"
199 --disable-optimizations) disable_opt="yes"
201 --disable-pmem) disable_pmem="yes"
203 --enable-cuda) enable_cuda="yes"
205 --disable-native) disable_native="yes"
207 --with-ime=*) ime_path="$optarg"
209 --enable-libiscsi) libiscsi="yes"
211 --enable-libnbd) libnbd="yes"
213 --disable-tcmalloc) disable_tcmalloc="yes"
219 echo "Bad option $opt"
225 if test "$show_help" = "yes" ; then
226 echo "--prefix= Use this directory as installation prefix"
227 echo "--cpu= Specify target CPU if auto-detect fails"
228 echo "--cc= Specify compiler to use"
229 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
230 echo "--build-32bit-win Enable 32-bit build on Windows"
231 echo "--target-win-ver= Minimum version of Windows to target (XP or 7)"
232 echo "--build-static Build a static fio"
233 echo "--esx Configure build options for esx"
234 echo "--enable-gfio Enable building of gtk gfio"
235 echo "--disable-numa Disable libnuma even if found"
236 echo "--disable-rdma Disable RDMA support even if found"
237 echo "--disable-rados Disable Rados support even if found"
238 echo "--disable-rbd Disable Rados Block Device even if found"
239 echo "--disable-http Disable HTTP support even if found"
240 echo "--disable-gfapi Disable gfapi"
241 echo "--enable-libhdfs Enable hdfs support"
242 echo "--disable-lex Disable use of lex/yacc for math"
243 echo "--disable-pmem Disable pmem based engines even if found"
244 echo "--enable-lex Enable use of lex/yacc for math"
245 echo "--disable-shm Disable SHM support"
246 echo "--disable-optimizations Don't enable compiler optimizations"
247 echo "--enable-cuda Enable GPUDirect RDMA support"
248 echo "--disable-native Don't build for native host"
249 echo "--with-ime= Install path for DDN's Infinite Memory Engine"
250 echo "--enable-libiscsi Enable iscsi support"
251 echo "--enable-libnbd Enable libnbd (NBD engine) support"
252 echo "--disable-tcmalloc Disable tcmalloc support"
256 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
257 # Preferred compiler (can be overriden later after we know the platform):
259 # ${cross_prefix}gcc (if cross-prefix specified)
262 if test -z "${CC}${cross_prefix}"; then
269 cc="${CC-${cross_prefix}gcc}"
272 if check_define __ANDROID__ ; then
274 elif check_define __linux__ ; then
276 elif check_define __OpenBSD__ ; then
278 elif check_define __NetBSD__ ; then
280 elif check_define __sun__ ; then
282 CFLAGS="$CFLAGS -D_REENTRANT"
283 elif check_define _WIN32 ; then
289 echo "# Automatically generated by configure - do not modify" > $config_host_mak
290 printf "# Configured with:" >> $config_host_mak
291 printf " '%s'" "$0" "$@" >> $config_host_mak
292 echo >> $config_host_mak
293 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
295 if test "$no_shm" = "yes" ; then
296 output_sym "CONFIG_NO_SHM"
299 if test "$disable_opt" = "yes" ; then
300 output_sym "CONFIG_FIO_NO_OPT"
303 # Some host OSes need non-standard checks for which CPU to use.
304 # Note that these checks are broken for cross-compilation: if you're
305 # cross-compiling to one of these OSes then you'll need to specify
306 # the correct CPU with the --cpu option.
309 # Unless explicitly enabled, turn off lex.
310 # OpenBSD will hit syntax error when enabled.
311 if test -z "$disable_lex" ; then
318 CFLAGS="$CFLAGS -I/usr/local/include"
319 LDFLAGS="$LDFLAGS -L/usr/local/lib"
322 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
323 # we can run 64-bit userspace code.
324 # If the user didn't specify a CPU explicitly and the kernel says this is
325 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
327 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
330 # Error at compile time linking of weak/partial symbols if possible...
337 if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
338 echo "Disabling weak symbols"
339 LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
343 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
344 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
347 LIBS="-lnsl -lsocket"
350 # We still force some options, so keep this message here.
351 echo "Forcing some known good options on Windows"
352 if test -z "${CC}${cross_prefix}"; then
353 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
354 cc="i686-w64-mingw32-gcc"
356 cc="x86_64-w64-mingw32-gcc"
360 target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]')
361 if test -z "$target_win_ver"; then
362 # Default Windows API target
365 if test "$target_win_ver" = "XP"; then
366 output_sym "CONFIG_WINDOWS_XP"
367 elif test "$target_win_ver" = "7"; then
368 output_sym "CONFIG_WINDOWS_7"
369 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601"
371 fatal "Unknown target Windows version"
374 # We need this to be output_sym'd here because this is Windows specific.
375 # The regular configure path never sets this config.
376 output_sym "CONFIG_WINDOWSAIO"
377 # We now take the regular configuration path without having exit 0 here.
378 # Flags below are still necessary mostly for MinGW.
383 clock_gettime="yes" # clock_monotonic probe has dependency on this
384 clock_monotonic="yes"
392 # Now we know the target platform we can have another guess at the preferred
393 # compiler when it wasn't explictly set
394 if test -z "${CC}${cross_prefix}"; then
395 if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
401 if test -z "$cc"; then
402 echo "configure: failed to find compiler"
406 if test ! -z "$cpu" ; then
407 # command line argument
409 elif check_define __i386__ ; then
411 elif check_define __x86_64__ ; then
413 elif check_define __sparc__ ; then
414 if check_define __arch64__ ; then
419 elif check_define _ARCH_PPC ; then
420 if check_define _ARCH_PPC64 ; then
425 elif check_define __mips__ ; then
427 elif check_define __ia64__ ; then
429 elif check_define __s390__ ; then
430 if check_define __s390x__ ; then
435 elif check_define __arm__ ; then
437 elif check_define __aarch64__ ; then
439 elif check_define __hppa__ ; then
445 # Normalise host CPU name and set ARCH.
447 ia64|ppc|ppc64|s390|s390x|sparc64)
450 i386|i486|i586|i686|i86pc|BePC)
462 hppa|parisc|parisc64)
476 ##########################################
477 # check cross compile
479 if test "$cross_compile" != "yes" ; then
488 if compile_prog "" "" "cross"; then
489 $TMPE 2>/dev/null || cross_compile="yes"
491 fatal "compile test failed"
494 ##########################################
496 if test "$bigendian" != "yes" ; then
499 if test "$cross_compile" = "no" ; then
501 #include <inttypes.h>
504 volatile uint32_t i=0x01234567;
505 return (*((uint8_t*)(&i))) == 0x67;
508 if compile_prog "" "" "endian"; then
509 $TMPE && bigendian="yes"
512 # If we're cross compiling, try our best to work it out and rely on the
513 # run-time check to fail if we get it wrong.
518 #if __BYTE_ORDER != __BIG_ENDIAN
519 # error "Unknown endianness"
523 compile_prog "" "" "endian" && bigendian="yes"
524 check_define "__ARMEB__" && bigendian="yes"
525 check_define "__MIPSEB__" && bigendian="yes"
529 print_config "Operating system" "$targetos"
530 print_config "CPU" "$cpu"
531 print_config "Big endian" "$bigendian"
532 if test ! -z "$target_win_ver"; then
533 print_config "Target Windows version" "$target_win_ver"
535 print_config "Compiler" "$cc"
536 print_config "Cross compile" "$cross_compile"
539 ##########################################
540 # See if we need to build a static build
541 if test "$build_static" = "yes" ; then
542 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
543 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
547 print_config "Static build" "$build_static"
549 ##########################################
554 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
557 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
561 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
563 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
566 fatal "Unknown wordsize"
568 print_config "Wordsize" "$wordsize"
570 ##########################################
572 if test "$zlib" != "yes" ; then
580 if (inflateInit(&stream) != Z_OK)
585 if compile_prog "" "-lz" "zlib" ; then
589 print_config "zlib" "$zlib"
591 ##########################################
593 if test "$libaio" != "yes" ; then
596 if test "$esx" != "yes" ; then
606 if compile_prog "" "-laio" "libaio" ; then
610 if test "$libaio" = "yes" ; then
611 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
616 print_config "Linux AIO support" "$libaio"
618 ##########################################
620 if test "$posix_aio" != "yes" ; then
623 if test "$posix_aio_lrt" != "yes" ; then
635 if compile_prog "" "" "posixaio" ; then
637 elif compile_prog "" "-lrt" "posixaio -lrt"; then
642 print_config "POSIX AIO support" "$posix_aio"
643 print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
645 ##########################################
646 # posix aio fsync probe
647 if test "$posix_aio_fsync" != "yes" ; then
650 if test "$posix_aio" = "yes" ; then
657 return aio_fsync(O_SYNC, &cb);
661 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
665 print_config "POSIX AIO fsync" "$posix_aio_fsync"
667 ##########################################
668 # POSIX pshared attribute probe
669 if test "$posix_pshared" != "yes" ; then
676 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
677 # if defined(__CYGWIN__)
678 # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
679 # elif defined(__APPLE__)
680 # include <AvailabilityMacros.h>
681 # include <TargetConditionals.h>
682 # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
683 # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
687 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
692 if compile_prog "" "$LIBS" "posix_pshared" ; then
695 print_config "POSIX pshared support" "$posix_pshared"
697 ##########################################
699 if test "$solaris_aio" != "yes" ; then
703 #include <sys/types.h>
704 #include <sys/asynch.h>
709 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
713 if compile_prog "" "-laio" "solarisaio" ; then
717 print_config "Solaris AIO support" "$solaris_aio"
719 ##########################################
720 # __sync_fetch_and_add test
721 if test "$sfaa" != "yes" ; then
725 #include <inttypes.h>
726 static int sfaa(uint64_t *ptr)
728 return __sync_fetch_and_add(ptr, 0);
731 int main(int argc, char **argv)
738 if compile_prog "" "" "__sync_fetch_and_add()" ; then
741 print_config "__sync_fetch_and_add" "$sfaa"
743 ##########################################
744 # __sync_synchronize() test
745 if test "$sync_sync" != "yes" ; then
749 #include <inttypes.h>
751 int main(int argc, char **argv)
753 __sync_synchronize();
757 if compile_prog "" "" "__sync_synchronize()" ; then
760 print_config "__sync_synchronize" "$sync_sync"
762 ##########################################
763 # __sync_val_compare_and_swap() test
764 if test "$cmp_swap" != "yes" ; then
768 #include <inttypes.h>
770 int main(int argc, char **argv)
773 return __sync_val_compare_and_swap(&x, 1, 2);
776 if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
779 print_config "__sync_val_compare_and_swap" "$cmp_swap"
781 ##########################################
783 if test "$libverbs" != "yes" ; then
787 #include <infiniband/verbs.h>
788 int main(int argc, char **argv)
790 struct ibv_pd *pd = ibv_alloc_pd(NULL);
794 if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
796 LIBS="-libverbs $LIBS"
798 print_config "libverbs" "$libverbs"
800 ##########################################
802 if test "$rdmacm" != "yes" ; then
807 #include <rdma/rdma_cma.h>
808 int main(int argc, char **argv)
810 rdma_destroy_qp(NULL);
814 if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
816 LIBS="-lrdmacm $LIBS"
818 print_config "rdmacm" "$rdmacm"
820 ##########################################
821 # asprintf() and vasprintf() probes
822 if test "$have_asprintf" != "yes" ; then
828 int main(int argc, char **argv)
830 return asprintf(NULL, "%s", "str") == 0;
833 if compile_prog "" "" "have_asprintf"; then
836 print_config "asprintf()" "$have_asprintf"
838 if test "$have_vasprintf" != "yes" ; then
844 int main(int argc, char **argv)
846 return vasprintf(NULL, "%s", NULL) == 0;
849 if compile_prog "" "" "have_vasprintf"; then
852 print_config "vasprintf()" "$have_vasprintf"
854 ##########################################
855 # Linux fallocate probe
856 if test "$linux_fallocate" != "yes" ; then
862 #include <linux/falloc.h>
863 int main(int argc, char **argv)
865 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
869 if compile_prog "" "" "linux_fallocate"; then
870 linux_fallocate="yes"
872 print_config "Linux fallocate" "$linux_fallocate"
874 ##########################################
875 # POSIX fadvise probe
876 if test "$posix_fadvise" != "yes" ; then
882 int main(int argc, char **argv)
884 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
888 if compile_prog "" "" "posix_fadvise"; then
891 print_config "POSIX fadvise" "$posix_fadvise"
893 ##########################################
894 # POSIX fallocate probe
895 if test "$posix_fallocate" != "yes" ; then
901 int main(int argc, char **argv)
903 int r = posix_fallocate(0, 0, 1024);
907 if compile_prog "" "" "posix_fallocate"; then
908 posix_fallocate="yes"
910 print_config "POSIX fallocate" "$posix_fallocate"
912 ##########################################
913 # sched_set/getaffinity 2 or 3 argument test
914 if test "$linux_2arg_affinity" != "yes" ; then
915 linux_2arg_affinity="no"
917 if test "$linux_3arg_affinity" != "yes" ; then
918 linux_3arg_affinity="no"
922 int main(int argc, char **argv)
925 return sched_setaffinity(0, sizeof(mask), &mask);
928 if compile_prog "" "" "sched_setaffinity(,,)"; then
929 linux_3arg_affinity="yes"
933 int main(int argc, char **argv)
936 return sched_setaffinity(0, &mask);
939 if compile_prog "" "" "sched_setaffinity(,)"; then
940 linux_2arg_affinity="yes"
943 print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
944 print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
946 ##########################################
947 # clock_gettime probe
948 if test "$clock_gettime" != "yes" ; then
954 int main(int argc, char **argv)
956 return clock_gettime(0, NULL);
959 if compile_prog "" "" "clock_gettime"; then
961 elif compile_prog "" "-lrt" "clock_gettime"; then
965 print_config "clock_gettime" "$clock_gettime"
967 ##########################################
968 # CLOCK_MONOTONIC probe
969 if test "$clock_monotonic" != "yes" ; then
972 if test "$clock_gettime" = "yes" ; then
976 int main(int argc, char **argv)
978 return clock_gettime(CLOCK_MONOTONIC, NULL);
981 if compile_prog "" "$LIBS" "clock monotonic"; then
982 clock_monotonic="yes"
985 print_config "CLOCK_MONOTONIC" "$clock_monotonic"
987 ##########################################
988 # CLOCK_MONOTONIC_RAW probe
989 if test "$clock_monotonic_raw" != "yes" ; then
990 clock_monotonic_raw="no"
992 if test "$clock_gettime" = "yes" ; then
996 int main(int argc, char **argv)
998 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
1001 if compile_prog "" "$LIBS" "clock monotonic"; then
1002 clock_monotonic_raw="yes"
1005 print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw"
1007 ##########################################
1008 # CLOCK_MONOTONIC_PRECISE probe
1009 if test "$clock_monotonic_precise" != "yes" ; then
1010 clock_monotonic_precise="no"
1012 if test "$clock_gettime" = "yes" ; then
1016 int main(int argc, char **argv)
1018 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
1021 if compile_prog "" "$LIBS" "clock monotonic precise"; then
1022 clock_monotonic_precise="yes"
1025 print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise"
1027 ##########################################
1029 if test "$clockid_t" != "yes" ; then
1035 int main(int argc, char **argv)
1037 volatile clockid_t cid;
1038 memset((void*)&cid, 0, sizeof(cid));
1042 if compile_prog "" "$LIBS" "clockid_t"; then
1045 print_config "clockid_t" "$clockid_t"
1047 ##########################################
1048 # gettimeofday() probe
1049 if test "$gettimeofday" != "yes" ; then
1053 #include <sys/time.h>
1055 int main(int argc, char **argv)
1058 return gettimeofday(&tv, NULL);
1061 if compile_prog "" "" "gettimeofday"; then
1064 print_config "gettimeofday" "$gettimeofday"
1066 ##########################################
1068 if test "$fdatasync" != "yes" ; then
1074 int main(int argc, char **argv)
1076 return fdatasync(0);
1079 if compile_prog "" "" "fdatasync"; then
1082 print_config "fdatasync" "$fdatasync"
1084 ##########################################
1085 # sync_file_range() probe
1086 if test "$sync_file_range" != "yes" ; then
1087 sync_file_range="no"
1093 #include <linux/fs.h>
1094 int main(int argc, char **argv)
1096 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1097 SYNC_FILE_RANGE_WAIT_AFTER;
1098 return sync_file_range(0, 0, 0, flags);
1101 if compile_prog "" "" "sync_file_range"; then
1102 sync_file_range="yes"
1104 print_config "sync_file_range" "$sync_file_range"
1106 ##########################################
1107 # ext4 move extent probe
1108 if test "$ext4_me" != "yes" ; then
1113 #include <sys/ioctl.h>
1114 int main(int argc, char **argv)
1116 struct move_extent me;
1117 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1120 if compile_prog "" "" "ext4 move extent" ; then
1122 elif test $targetos = "Linux" ; then
1123 # On Linux, just default to it on and let it error at runtime if we really
1124 # don't have it. None of my updated systems have it defined, but it does
1125 # work. Takes a while to bubble back.
1128 print_config "EXT4 move extent" "$ext4_me"
1130 ##########################################
1132 if test "$linux_splice" != "yes" ; then
1138 int main(int argc, char **argv)
1140 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1143 if compile_prog "" "" "linux splice"; then
1146 print_config "Linux splice(2)" "$linux_splice"
1148 ##########################################
1150 if test "$guasi" != "yes" ; then
1155 #include <guasi_syscalls.h>
1156 int main(int argc, char **argv)
1158 guasi_t ctx = guasi_create(0, 0, 0);
1162 if compile_prog "" "" "guasi"; then
1165 print_config "GUASI" "$guasi"
1167 ##########################################
1169 if test "$libnuma" != "yes" ; then
1174 int main(int argc, char **argv)
1176 return numa_available();
1179 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1183 print_config "libnuma" "$libnuma"
1185 ##########################################
1186 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1187 if test "$libnuma" = "yes" ; then
1191 int main(int argc, char **argv)
1193 struct bitmask *mask = numa_parse_nodestring(NULL);
1194 return mask->size == 0;
1197 if compile_prog "" "" "libnuma api"; then
1200 print_config "libnuma v2" "$libnuma_v2"
1203 ##########################################
1205 if test "$strsep" != "yes" ; then
1210 int main(int argc, char **argv)
1212 static char *string = "This is a string";
1213 strsep(&string, "needle");
1217 if compile_prog "" "" "strsep"; then
1220 print_config "strsep" "$strsep"
1222 ##########################################
1223 # strcasestr() probe
1224 if test "$strcasestr" != "yes" ; then
1229 int main(int argc, char **argv)
1231 return strcasestr(argv[0], argv[1]) != NULL;
1234 if compile_prog "" "" "strcasestr"; then
1237 print_config "strcasestr" "$strcasestr"
1239 ##########################################
1241 if test "$strlcat" != "yes" ; then
1246 int main(int argc, char **argv)
1248 static char dst[64];
1249 static char *string = "This is a string";
1250 memset(dst, 0, sizeof(dst));
1251 strlcat(dst, string, sizeof(dst));
1255 if compile_prog "" "" "strlcat"; then
1258 print_config "strlcat" "$strlcat"
1260 ##########################################
1261 # getopt_long_only() probe
1262 if test "$getopt_long_only" != "yes" ; then
1263 getopt_long_only="no"
1269 int main(int argc, char **argv)
1271 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1275 if compile_prog "" "" "getopt_long_only"; then
1276 getopt_long_only="yes"
1278 print_config "getopt_long_only()" "$getopt_long_only"
1280 ##########################################
1282 if test "$inet_aton" != "yes" ; then
1286 #include <sys/socket.h>
1287 #include <arpa/inet.h>
1289 int main(int argc, char **argv)
1292 return inet_aton(NULL, &in);
1295 if compile_prog "" "" "inet_aton"; then
1298 print_config "inet_aton" "$inet_aton"
1300 ##########################################
1302 if test "$socklen_t" != "yes" ; then
1306 #include <sys/socket.h>
1307 int main(int argc, char **argv)
1313 if compile_prog "" "" "socklen_t"; then
1316 print_config "socklen_t" "$socklen_t"
1318 ##########################################
1319 # Whether or not __thread is supported for TLS
1320 if test "$tls_thread" != "yes" ; then
1325 static __thread int ret;
1326 int main(int argc, char **argv)
1331 if compile_prog "" "" "__thread"; then
1334 print_config "__thread" "$tls_thread"
1336 ##########################################
1337 # Check if we have required gtk/glib support for gfio
1338 if test "$gfio" != "yes" ; then
1341 if test "$gfio_check" = "yes" ; then
1345 #include <gtk/gtk.h>
1348 gdk_threads_enter();
1349 gdk_threads_leave();
1351 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1354 GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0)
1355 ORG_LDFLAGS=$LDFLAGS
1356 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1357 if test "$?" != "0" ; then
1358 echo "configure: gtk and gthread not found"
1361 GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
1362 if test "$?" != "0" ; then
1363 echo "configure: gtk and gthread not found"
1366 if ! ${cross_prefix}pkg-config --atleast-version 2.18.0 gtk+-2.0; then
1367 echo "GTK found, but need version 2.18 or higher"
1370 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1372 GFIO_LIBS="$LIBS $GTK_LIBS"
1373 CFLAGS="$CFLAGS $GTK_CFLAGS"
1375 echo "Please install gtk and gdk libraries"
1379 LDFLAGS=$ORG_LDFLAGS
1382 if test "$gfio_check" = "yes" ; then
1383 print_config "gtk 2.18 or higher" "$gfio"
1386 ##########################################
1387 # Check whether we have getrusage(RUSAGE_THREAD)
1388 if test "$rusage_thread" != "yes" ; then
1392 #include <sys/time.h>
1393 #include <sys/resource.h>
1394 int main(int argc, char **argv)
1397 getrusage(RUSAGE_THREAD, &ru);
1401 if compile_prog "" "" "RUSAGE_THREAD"; then
1404 print_config "RUSAGE_THREAD" "$rusage_thread"
1406 ##########################################
1407 # Check whether we have SCHED_IDLE
1408 if test "$sched_idle" != "yes" ; then
1413 int main(int argc, char **argv)
1415 struct sched_param p;
1416 return sched_setscheduler(0, SCHED_IDLE, &p);
1419 if compile_prog "" "" "SCHED_IDLE"; then
1422 print_config "SCHED_IDLE" "$sched_idle"
1424 ##########################################
1425 # Check whether we have TCP_NODELAY
1426 if test "$tcp_nodelay" != "yes" ; then
1431 #include <sys/types.h>
1432 #include <sys/socket.h>
1433 #include <netinet/tcp.h>
1434 int main(int argc, char **argv)
1436 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1439 if compile_prog "" "" "TCP_NODELAY"; then
1442 print_config "TCP_NODELAY" "$tcp_nodelay"
1444 ##########################################
1445 # Check whether we have SO_SNDBUF
1446 if test "$window_size" != "yes" ; then
1451 #include <sys/types.h>
1452 #include <sys/socket.h>
1453 #include <netinet/tcp.h>
1454 int main(int argc, char **argv)
1456 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1457 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1460 if compile_prog "" "" "SO_SNDBUF"; then
1463 print_config "Net engine window_size" "$window_size"
1465 ##########################################
1466 # Check whether we have TCP_MAXSEG
1467 if test "$mss" != "yes" ; then
1472 #include <sys/types.h>
1473 #include <sys/socket.h>
1474 #include <netinet/tcp.h>
1475 #include <arpa/inet.h>
1476 #include <netinet/in.h>
1477 int main(int argc, char **argv)
1479 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1482 if compile_prog "" "" "TCP_MAXSEG"; then
1485 print_config "TCP_MAXSEG" "$mss"
1487 ##########################################
1488 # Check whether we have RLIMIT_MEMLOCK
1489 if test "$rlimit_memlock" != "yes" ; then
1493 #include <sys/time.h>
1494 #include <sys/resource.h>
1495 int main(int argc, char **argv)
1498 return getrlimit(RLIMIT_MEMLOCK, &rl);
1501 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1502 rlimit_memlock="yes"
1504 print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1506 ##########################################
1507 # Check whether we have pwritev/preadv
1508 if test "$pwritev" != "yes" ; then
1513 #include <sys/uio.h>
1514 int main(int argc, char **argv)
1516 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1519 if compile_prog "" "" "pwritev"; then
1522 print_config "pwritev/preadv" "$pwritev"
1524 ##########################################
1525 # Check whether we have pwritev2/preadv2
1526 if test "$pwritev2" != "yes" ; then
1531 #include <sys/uio.h>
1532 int main(int argc, char **argv)
1534 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1537 if compile_prog "" "" "pwritev2"; then
1540 print_config "pwritev2/preadv2" "$pwritev2"
1542 ##########################################
1543 # Check whether we have the required functions for ipv6
1544 if test "$ipv6" != "yes" ; then
1548 #include <sys/types.h>
1549 #include <sys/socket.h>
1550 #include <netinet/in.h>
1553 int main(int argc, char **argv)
1555 struct addrinfo hints;
1556 struct in6_addr addr;
1559 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1561 printf("%s\n", gai_strerror(ret));
1566 if compile_prog "" "" "ipv6"; then
1569 print_config "IPv6 helpers" "$ipv6"
1571 ##########################################
1573 if test "$http" != "yes" ; then
1576 # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
1578 #include <curl/curl.h>
1579 #include <openssl/hmac.h>
1581 int main(int argc, char **argv)
1586 curl = curl_easy_init();
1587 curl_easy_cleanup(curl);
1589 ctx = HMAC_CTX_new();
1590 HMAC_CTX_reset(ctx);
1595 # openssl < 1.1.0 uses the HMAC_CTX type directly
1597 #include <curl/curl.h>
1598 #include <openssl/hmac.h>
1600 int main(int argc, char **argv)
1605 curl = curl_easy_init();
1606 curl_easy_cleanup(curl);
1608 HMAC_CTX_init(&ctx);
1609 HMAC_CTX_cleanup(&ctx);
1613 if test "$disable_http" != "yes"; then
1614 HTTP_LIBS="-lcurl -lssl -lcrypto"
1615 if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then
1616 output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
1618 LIBS="$HTTP_LIBS $LIBS"
1619 elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
1621 LIBS="$HTTP_LIBS $LIBS"
1624 print_config "http engine" "$http"
1626 ##########################################
1628 if test "$rados" != "yes" ; then
1632 #include <rados/librados.h>
1634 int main(int argc, char **argv)
1637 rados_ioctx_t io_ctx;
1638 const char cluster_name[] = "ceph";
1639 const char user_name[] = "client.admin";
1640 const char pool[] = "rados";
1642 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1643 rados_create2(&cluster, cluster_name, user_name, 0);
1644 rados_ioctx_create(cluster, pool, &io_ctx);
1649 if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
1650 LIBS="-lrados $LIBS"
1653 print_config "Rados engine" "$rados"
1655 ##########################################
1657 if test "$rbd" != "yes" ; then
1661 #include <rbd/librbd.h>
1663 int main(int argc, char **argv)
1666 rados_ioctx_t io_ctx;
1667 const char cluster_name[] = "ceph";
1668 const char user_name[] = "client.admin";
1669 const char pool[] = "rbd";
1670 int major, minor, extra;
1672 rbd_version(&major, &minor, &extra);
1673 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1674 rados_create2(&cluster, cluster_name, user_name, 0);
1675 rados_ioctx_create(cluster, pool, &io_ctx);
1680 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1681 LIBS="-lrbd -lrados $LIBS"
1684 print_config "Rados Block Device engine" "$rbd"
1686 ##########################################
1687 # check for rbd_poll
1688 if test "$rbd_poll" != "yes" ; then
1691 if test "$rbd" = "yes"; then
1693 #include <rbd/librbd.h>
1694 #include <sys/eventfd.h>
1696 int main(int argc, char **argv)
1699 rbd_completion_t comp;
1701 int fd = eventfd(0, EFD_NONBLOCK);
1702 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1703 rbd_poll_io_events(image, comp, 1);
1708 if compile_prog "" "-lrbd -lrados" "rbd"; then
1711 print_config "rbd_poll" "$rbd_poll"
1714 ##########################################
1715 # check for rbd_invalidate_cache()
1716 if test "$rbd_inval" != "yes" ; then
1719 if test "$rbd" = "yes"; then
1721 #include <rbd/librbd.h>
1723 int main(int argc, char **argv)
1727 return rbd_invalidate_cache(image);
1730 if compile_prog "" "-lrbd -lrados" "rbd"; then
1733 print_config "rbd_invalidate_cache" "$rbd_inval"
1736 ##########################################
1737 # Check whether we have setvbuf
1738 if test "$setvbuf" != "yes" ; then
1743 int main(int argc, char **argv)
1747 setvbuf(f, buf, _IOFBF, sizeof(buf));
1751 if compile_prog "" "" "setvbuf"; then
1754 print_config "setvbuf" "$setvbuf"
1756 ##########################################
1758 if test "$gfapi" != "yes" ; then
1762 #include <glusterfs/api/glfs.h>
1764 int main(int argc, char **argv)
1766 glfs_t *g = glfs_new("foo");
1771 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1772 LIBS="-lgfapi -lglusterfs $LIBS"
1775 print_config "Gluster API engine" "$gfapi"
1777 ##########################################
1778 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1779 if test "$gfapi" = "yes" ; then
1782 #include <glusterfs/api/glfs.h>
1784 int main(int argc, char **argv)
1787 int ret = glfs_fadvise(fd, 0, 0, 1);
1792 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1795 print_config "Gluster API use fadvise" "$gf_fadvise"
1798 ##########################################
1799 # check for newer gfapi
1800 if test "$gfapi" = "yes" ; then
1803 #include <glusterfs/api/glfs.h>
1805 int main(int argc, char **argv)
1807 return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL);
1810 if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then
1813 print_config "Gluster new API" "$gf_new"
1816 ##########################################
1817 # check for gfapi trim support
1818 if test "$gf_trim" != "yes" ; then
1821 if test "$gfapi" = "yes" ; then
1823 #include <glusterfs/api/glfs.h>
1825 int main(int argc, char **argv)
1827 return glfs_discard_async(NULL, 0, 0);
1830 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1833 print_config "Gluster API trim support" "$gf_trim"
1836 ##########################################
1837 # Check if we support stckf on s390
1838 if test "$s390_z196_facilities" != "yes" ; then
1839 s390_z196_facilities="no"
1842 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1843 int main(int argc, char **argv)
1845 /* We want just 1 double word to be returned. */
1846 register unsigned long reg0 asm("0") = 0;
1847 unsigned long stfle_bits;
1848 asm volatile(".machine push" "\n\t"
1849 ".machine \"z9-109\"" "\n\t"
1852 : "=QS" (stfle_bits), "+d" (reg0)
1855 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1861 if compile_prog "" "" "s390_z196_facilities"; then
1863 if [ $? -eq 0 ]; then
1864 s390_z196_facilities="yes"
1867 print_config "s390_z196_facilities" "$s390_z196_facilities"
1869 ##########################################
1870 # Check if we have required environment variables configured for libhdfs
1871 if test "$libhdfs" = "yes" ; then
1873 if test "$JAVA_HOME" = "" ; then
1874 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1877 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1878 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1881 if test "$FIO_LIBHDFS_LIB" = "" ; then
1882 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1885 if test "$hdfs_conf_error" = "1" ; then
1889 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1890 FIO_HDFS_CPU="amd64"
1893 print_config "HDFS engine" "$libhdfs"
1895 ##########################################
1896 # Check whether we have MTD
1897 if test "$mtd" != "yes" ; then
1902 #include <mtd/mtd-user.h>
1903 #include <sys/ioctl.h>
1904 int main(int argc, char **argv)
1906 struct mtd_write_req ops;
1907 struct mtd_info_user info;
1908 memset(&ops, 0, sizeof(ops));
1909 info.type = MTD_MLCNANDFLASH;
1910 return ioctl(0, MEMGETINFO, &info);
1913 if compile_prog "" "" "mtd"; then
1916 print_config "MTD" "$mtd"
1918 ##########################################
1919 # Check whether we have libpmem
1920 if test "$libpmem" != "yes" ; then
1924 #include <libpmem.h>
1925 int main(int argc, char **argv)
1928 rc = pmem_is_pmem(0, 0);
1932 if compile_prog "" "-lpmem" "libpmem"; then
1936 print_config "libpmem" "$libpmem"
1938 ##########################################
1939 # Check whether we have libpmemblk
1940 # libpmem is a prerequisite
1941 if test "$libpmemblk" != "yes" ; then
1944 if test "$libpmem" = "yes"; then
1946 #include <libpmemblk.h>
1947 int main(int argc, char **argv)
1950 pbp = pmemblk_open("", 0);
1954 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1956 LIBS="-lpmemblk $LIBS"
1959 print_config "libpmemblk" "$libpmemblk"
1961 # Choose the ioengines
1962 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1965 if test "$libpmemblk" = "yes"; then
1970 ##########################################
1971 # Report whether pmemblk engine is enabled
1972 print_config "PMDK pmemblk engine" "$pmemblk"
1974 ##########################################
1975 # Report whether dev-dax engine is enabled
1976 print_config "PMDK dev-dax engine" "$devdax"
1978 ##########################################
1979 # Report whether libpmem engine is enabled
1980 print_config "PMDK libpmem engine" "$pmem"
1982 ##########################################
1983 # Check whether we support DDN's IME
1984 if test "$libime" != "yes" ; then
1988 #include <ime_native.h>
1989 int main(int argc, char **argv)
1993 rc = ime_native_finalize();
1997 if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then
1999 CFLAGS="-I${ime_path}/include $CFLAGS"
2000 LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS"
2001 LIBS="-lim_client $LIBS"
2003 print_config "DDN's Infinite Memory Engine" "$libime"
2005 ##########################################
2006 # Check if we have required environment variables configured for libiscsi
2007 if test "$libiscsi" = "yes" ; then
2008 if $(pkg-config --atleast-version=1.9.0 libiscsi); then
2010 libiscsi_cflags=$(pkg-config --cflags libiscsi)
2011 libiscsi_libs=$(pkg-config --libs libiscsi)
2013 if test "$libiscsi" = "yes" ; then
2014 echo "libiscsi" "Install libiscsi >= 1.9.0"
2019 print_config "iscsi engine" "$libiscsi"
2021 ##########################################
2022 # Check if we have libnbd (for NBD support).
2023 minimum_libnbd=0.9.6
2024 if test "$libnbd" = "yes" ; then
2025 if $(pkg-config --atleast-version=$minimum_libnbd libnbd); then
2027 libnbd_cflags=$(pkg-config --cflags libnbd)
2028 libnbd_libs=$(pkg-config --libs libnbd)
2030 if test "$libnbd" = "yes" ; then
2031 echo "libnbd" "Install libnbd >= $minimum_libnbd"
2036 print_config "NBD engine" "$libnbd"
2038 ##########################################
2039 # Check if we have lex/yacc available
2044 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
2045 if test "$targetos" != "SunOS" ; then
2046 LEX=$(which lex 2> /dev/null)
2047 if test -x "$LEX" ; then
2050 YACC=$(which bison 2> /dev/null)
2051 if test -x "$YACC" ; then
2055 YACC=$(which yacc 2> /dev/null)
2056 if test -x "$YACC" ; then
2060 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2064 if test "$arith" = "yes" ; then
2066 extern int yywrap(void);
2068 int main(int argc, char **argv)
2074 if compile_prog "" "-ll" "lex"; then
2083 # Check if lex fails using -o
2084 if test "$arith" = "yes" ; then
2085 if test "$force_no_lex_o" = "yes" ; then
2088 $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
2089 if test "$?" = "0" ; then
2097 print_config "lex/yacc for arithmetic" "$arith"
2099 ##########################################
2100 # Check whether we have setmntent/getmntent
2101 if test "$getmntent" != "yes" ; then
2107 int main(int argc, char **argv)
2109 FILE *mtab = setmntent(NULL, "r");
2110 struct mntent *mnt = getmntent(mtab);
2115 if compile_prog "" "" "getmntent"; then
2118 print_config "getmntent" "$getmntent"
2120 ##########################################
2121 # Check whether we have getmntinfo
2122 # These are originally added for BSDs, but may also work
2123 # on other operating systems with getmntinfo(3).
2125 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
2126 # Note that NetBSD needs -Werror to catch warning as error.
2127 if test "$getmntinfo" != "yes" ; then
2132 #include <sys/param.h>
2133 #include <sys/mount.h>
2134 int main(int argc, char **argv)
2137 return getmntinfo(&st, MNT_NOWAIT);
2140 if compile_prog "-Werror" "" "getmntinfo"; then
2143 print_config "getmntinfo" "$getmntinfo"
2145 # getmntinfo(3) for NetBSD.
2146 if test "$getmntinfo_statvfs" != "yes" ; then
2147 getmntinfo_statvfs="no"
2151 #include <sys/statvfs.h>
2152 int main(int argc, char **argv)
2155 return getmntinfo(&st, MNT_NOWAIT);
2158 # Skip the test if the one with statfs arg is detected.
2159 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2160 getmntinfo_statvfs="yes"
2161 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
2164 ##########################################
2165 # Check whether we have _Static_assert
2166 if test "$static_assert" != "yes" ; then
2178 int main(int argc, char **argv)
2180 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2184 if compile_prog "" "" "static_assert"; then
2187 print_config "Static Assert" "$static_assert"
2189 ##########################################
2190 # Check whether we have bool / stdbool.h
2191 if test "$have_bool" != "yes" ; then
2195 #include <stdbool.h>
2196 int main(int argc, char **argv)
2199 return var != false;
2202 if compile_prog "" "" "bool"; then
2205 print_config "bool" "$have_bool"
2207 ##########################################
2208 # Check whether we have strndup()
2213 int main(int argc, char **argv)
2215 char *res = strndup("test string", 8);
2221 if compile_prog "" "" "strndup"; then
2224 print_config "strndup" "$strndup"
2226 ##########################################
2227 # <valgrind/drd.h> probe
2228 # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is
2229 # also available but not the other way around.
2230 if test "$valgrind_dev" != "yes" ; then
2234 #include <valgrind/drd.h>
2235 int main(int argc, char **argv)
2240 if compile_prog "" "" "valgrind_dev"; then
2243 print_config "Valgrind headers" "$valgrind_dev"
2245 ##########################################
2246 # <linux/blkzoned.h> probe
2247 if test "$linux_blkzoned" != "yes" ; then
2251 #include <linux/blkzoned.h>
2252 int main(int argc, char **argv)
2257 if compile_prog "" "" "linux_blkzoned"; then
2258 linux_blkzoned="yes"
2260 print_config "Zoned block device support" "$linux_blkzoned"
2262 ##########################################
2263 # check march=armv8-a+crc+crypto
2264 if test "$march_armv8_a_crc_crypto" != "yes" ; then
2265 march_armv8_a_crc_crypto="no"
2267 if test "$cpu" = "arm64" ; then
2269 #include <arm_acle.h>
2270 #include <arm_neon.h>
2271 #include <sys/auxv.h>
2275 /* Can we also do a runtime probe? */
2277 return getauxval(AT_HWCAP);
2279 # error "Don't know how to do runtime probe for ARM CRC32c"
2283 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
2284 march_armv8_a_crc_crypto="yes"
2285 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
2289 print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2291 ##########################################
2293 if test "$cuda" != "yes" ; then
2298 int main(int argc, char **argv)
2303 if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
2307 print_config "cuda" "$cuda"
2309 ##########################################
2310 # mkdir() probe. mingw apparently has a one-argument mkdir :/
2313 #include <sys/stat.h>
2314 #include <sys/types.h>
2315 int main(int argc, char **argv)
2317 return mkdir("/tmp/bla", 0600);
2320 if compile_prog "" "" "mkdir(a, b)"; then
2323 print_config "mkdir(a, b)" "$mkdir_two"
2325 ##########################################
2326 # check for cc -march=native
2329 int main(int argc, char **argv)
2334 if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2335 compile_prog "-march=native" "" "march=native"; then
2338 print_config "Build march=native" "$build_native"
2340 ##########################################
2342 if test "$cunit" != "yes" ; then
2346 #include <CUnit/CUnit.h>
2347 #include <CUnit/Basic.h>
2350 if (CU_initialize_registry() != CUE_SUCCESS)
2351 return CU_get_error();
2352 CU_basic_set_mode(CU_BRM_VERBOSE);
2353 CU_basic_run_tests();
2354 CU_cleanup_registry();
2355 return CU_get_error();
2358 if compile_prog "" "-lcunit" "CUnit"; then
2361 print_config "CUnit" "$cunit"
2363 ##########################################
2364 # check for __kernel_rwf_t
2367 #include <linux/fs.h>
2368 int main(int argc, char **argv)
2375 if compile_prog "" "" "__kernel_rwf_t"; then
2376 __kernel_rwf_t="yes"
2378 print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2380 ##########################################
2381 # check if gcc has -Wimplicit-fallthrough
2384 int main(int argc, char **argv)
2389 if compile_prog "-Wimplicit-fallthrough" "" "-Wimplicit-fallthrough"; then
2392 print_config "-Wimplicit-fallthrough" "$fallthrough"
2394 ##########################################
2395 # check for MADV_HUGEPAGE support
2396 if test "$thp" != "yes" ; then
2399 if test "$esx" != "yes" ; then
2401 #include <sys/mman.h>
2404 return madvise(0, 0x1000, MADV_HUGEPAGE);
2407 if compile_prog "" "" "thp" ; then
2410 if test "$thp" = "yes" ; then
2411 feature_not_found "Transparent Huge Page" ""
2416 print_config "MADV_HUGEPAGE" "$thp"
2418 ##########################################
2419 # check for gettid()
2423 int main(int argc, char **argv)
2428 if compile_prog "" "" "gettid"; then
2431 print_config "gettid" "$gettid"
2433 #############################################################################
2435 if test "$wordsize" = "64" ; then
2436 output_sym "CONFIG_64BIT"
2437 elif test "$wordsize" = "32" ; then
2438 output_sym "CONFIG_32BIT"
2440 fatal "Unknown wordsize!"
2442 if test "$bigendian" = "yes" ; then
2443 output_sym "CONFIG_BIG_ENDIAN"
2445 output_sym "CONFIG_LITTLE_ENDIAN"
2447 if test "$zlib" = "yes" ; then
2448 output_sym "CONFIG_ZLIB"
2450 if test "$libaio" = "yes" ; then
2451 output_sym "CONFIG_LIBAIO"
2453 if test "$posix_aio" = "yes" ; then
2454 output_sym "CONFIG_POSIXAIO"
2456 if test "$posix_aio_fsync" = "yes" ; then
2457 output_sym "CONFIG_POSIXAIO_FSYNC"
2459 if test "$posix_pshared" = "yes" ; then
2460 output_sym "CONFIG_PSHARED"
2462 if test "$have_asprintf" = "yes" ; then
2463 output_sym "CONFIG_HAVE_ASPRINTF"
2465 if test "$have_vasprintf" = "yes" ; then
2466 output_sym "CONFIG_HAVE_VASPRINTF"
2468 if test "$linux_fallocate" = "yes" ; then
2469 output_sym "CONFIG_LINUX_FALLOCATE"
2471 if test "$posix_fallocate" = "yes" ; then
2472 output_sym "CONFIG_POSIX_FALLOCATE"
2474 if test "$fdatasync" = "yes" ; then
2475 output_sym "CONFIG_FDATASYNC"
2477 if test "$sync_file_range" = "yes" ; then
2478 output_sym "CONFIG_SYNC_FILE_RANGE"
2480 if test "$sfaa" = "yes" ; then
2481 output_sym "CONFIG_SFAA"
2483 if test "$sync_sync" = "yes" ; then
2484 output_sym "CONFIG_SYNC_SYNC"
2486 if test "$cmp_swap" = "yes" ; then
2487 output_sym "CONFIG_CMP_SWAP"
2489 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2490 output_sym "CONFIG_RDMA"
2492 if test "$clock_gettime" = "yes" ; then
2493 output_sym "CONFIG_CLOCK_GETTIME"
2495 if test "$clock_monotonic" = "yes" ; then
2496 output_sym "CONFIG_CLOCK_MONOTONIC"
2498 if test "$clock_monotonic_raw" = "yes" ; then
2499 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2501 if test "$clock_monotonic_precise" = "yes" ; then
2502 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2504 if test "$clockid_t" = "yes"; then
2505 output_sym "CONFIG_CLOCKID_T"
2507 if test "$gettimeofday" = "yes" ; then
2508 output_sym "CONFIG_GETTIMEOFDAY"
2510 if test "$posix_fadvise" = "yes" ; then
2511 output_sym "CONFIG_POSIX_FADVISE"
2513 if test "$linux_3arg_affinity" = "yes" ; then
2514 output_sym "CONFIG_3ARG_AFFINITY"
2515 elif test "$linux_2arg_affinity" = "yes" ; then
2516 output_sym "CONFIG_2ARG_AFFINITY"
2518 if test "$strsep" = "yes" ; then
2519 output_sym "CONFIG_STRSEP"
2521 if test "$strcasestr" = "yes" ; then
2522 output_sym "CONFIG_STRCASESTR"
2524 if test "$strlcat" = "yes" ; then
2525 output_sym "CONFIG_STRLCAT"
2527 if test "$getopt_long_only" = "yes" ; then
2528 output_sym "CONFIG_GETOPT_LONG_ONLY"
2530 if test "$inet_aton" = "yes" ; then
2531 output_sym "CONFIG_INET_ATON"
2533 if test "$socklen_t" = "yes" ; then
2534 output_sym "CONFIG_SOCKLEN_T"
2536 if test "$ext4_me" = "yes" ; then
2537 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2539 if test "$linux_splice" = "yes" ; then
2540 output_sym "CONFIG_LINUX_SPLICE"
2542 if test "$guasi" = "yes" ; then
2543 output_sym "CONFIG_GUASI"
2545 if test "$libnuma_v2" = "yes" ; then
2546 output_sym "CONFIG_LIBNUMA"
2548 if test "$solaris_aio" = "yes" ; then
2549 output_sym "CONFIG_SOLARISAIO"
2551 if test "$tls_thread" = "yes" ; then
2552 output_sym "CONFIG_TLS_THREAD"
2554 if test "$rusage_thread" = "yes" ; then
2555 output_sym "CONFIG_RUSAGE_THREAD"
2557 if test "$gfio" = "yes" ; then
2558 output_sym "CONFIG_GFIO"
2560 if test "$esx" = "yes" ; then
2561 output_sym "CONFIG_ESX"
2562 output_sym "CONFIG_NO_SHM"
2564 if test "$sched_idle" = "yes" ; then
2565 output_sym "CONFIG_SCHED_IDLE"
2567 if test "$tcp_nodelay" = "yes" ; then
2568 output_sym "CONFIG_TCP_NODELAY"
2570 if test "$window_size" = "yes" ; then
2571 output_sym "CONFIG_NET_WINDOWSIZE"
2573 if test "$mss" = "yes" ; then
2574 output_sym "CONFIG_NET_MSS"
2576 if test "$rlimit_memlock" = "yes" ; then
2577 output_sym "CONFIG_RLIMIT_MEMLOCK"
2579 if test "$pwritev" = "yes" ; then
2580 output_sym "CONFIG_PWRITEV"
2582 if test "$pwritev2" = "yes" ; then
2583 output_sym "CONFIG_PWRITEV2"
2585 if test "$ipv6" = "yes" ; then
2586 output_sym "CONFIG_IPV6"
2588 if test "$http" = "yes" ; then
2589 output_sym "CONFIG_HTTP"
2591 if test "$rados" = "yes" ; then
2592 output_sym "CONFIG_RADOS"
2594 if test "$rbd" = "yes" ; then
2595 output_sym "CONFIG_RBD"
2597 if test "$rbd_poll" = "yes" ; then
2598 output_sym "CONFIG_RBD_POLL"
2600 if test "$rbd_inval" = "yes" ; then
2601 output_sym "CONFIG_RBD_INVAL"
2603 if test "$setvbuf" = "yes" ; then
2604 output_sym "CONFIG_SETVBUF"
2606 if test "$s390_z196_facilities" = "yes" ; then
2607 output_sym "CONFIG_S390_Z196_FACILITIES"
2608 CFLAGS="$CFLAGS -march=z9-109"
2611 if test "$gfapi" = "yes" ; then
2612 output_sym "CONFIG_GFAPI"
2614 if test "$gf_fadvise" = "yes" ; then
2615 output_sym "CONFIG_GF_FADVISE"
2617 if test "$gf_trim" = "yes" ; then
2618 output_sym "CONFIG_GF_TRIM"
2620 if test "$gf_new" = "yes" ; then
2621 output_sym "CONFIG_GF_NEW_API"
2623 if test "$libhdfs" = "yes" ; then
2624 output_sym "CONFIG_LIBHDFS"
2625 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2626 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2627 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2628 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2630 if test "$mtd" = "yes" ; then
2631 output_sym "CONFIG_MTD"
2633 if test "$pmemblk" = "yes" ; then
2634 output_sym "CONFIG_PMEMBLK"
2636 if test "$devdax" = "yes" ; then
2637 output_sym "CONFIG_LINUX_DEVDAX"
2639 if test "$pmem" = "yes" ; then
2640 output_sym "CONFIG_LIBPMEM"
2642 if test "$libime" = "yes" ; then
2643 output_sym "CONFIG_IME"
2645 if test "$arith" = "yes" ; then
2646 output_sym "CONFIG_ARITHMETIC"
2647 if test "$yacc_is_bison" = "yes" ; then
2648 echo "YACC=$YACC -y" >> $config_host_mak
2650 echo "YACC=$YACC" >> $config_host_mak
2652 if test "$lex_use_o" = "yes" ; then
2653 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2656 if test "$getmntent" = "yes" ; then
2657 output_sym "CONFIG_GETMNTENT"
2659 if test "$getmntinfo" = "yes" ; then
2660 output_sym "CONFIG_GETMNTINFO"
2662 if test "$getmntinfo_statvfs" = "yes" ; then
2663 output_sym "CONFIG_GETMNTINFO_STATVFS"
2665 if test "$static_assert" = "yes" ; then
2666 output_sym "CONFIG_STATIC_ASSERT"
2668 if test "$have_bool" = "yes" ; then
2669 output_sym "CONFIG_HAVE_BOOL"
2671 if test "$strndup" = "yes" ; then
2672 output_sym "CONFIG_HAVE_STRNDUP"
2674 if test "$disable_opt" = "yes" ; then
2675 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2677 if test "$valgrind_dev" = "yes"; then
2678 output_sym "CONFIG_VALGRIND_DEV"
2680 if test "$linux_blkzoned" = "yes" ; then
2681 output_sym "CONFIG_LINUX_BLKZONED"
2683 if test "$zlib" = "no" ; then
2684 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2685 if test "$build_static" = "yes"; then
2686 echo "Note that some distros have separate packages for static libraries."
2689 if test "$march_armv8_a_crc_crypto" = "yes" ; then
2690 output_sym "ARCH_HAVE_CRC_CRYPTO"
2692 if test "$cuda" = "yes" ; then
2693 output_sym "CONFIG_CUDA"
2695 if test "$mkdir_two" = "yes" ; then
2696 output_sym "CONFIG_HAVE_MKDIR_TWO"
2698 if test "$march_set" = "no" && test "$build_native" = "yes" ; then
2699 output_sym "CONFIG_BUILD_NATIVE"
2701 if test "$cunit" = "yes" ; then
2702 output_sym "CONFIG_HAVE_CUNIT"
2704 if test "$__kernel_rwf_t" = "yes"; then
2705 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
2707 if test "$gettid" = "yes"; then
2708 output_sym "CONFIG_HAVE_GETTID"
2710 if test "$fallthrough" = "yes"; then
2711 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
2713 if test "$thp" = "yes" ; then
2714 output_sym "CONFIG_HAVE_THP"
2716 if test "$libiscsi" = "yes" ; then
2717 output_sym "CONFIG_LIBISCSI"
2718 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
2719 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
2720 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
2722 if test "$libnbd" = "yes" ; then
2723 output_sym "CONFIG_LIBNBD"
2724 echo "CONFIG_LIBNBD=m" >> $config_host_mak
2725 echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak
2726 echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak
2729 int main(int argc, char **argv)
2734 if test "$disable_tcmalloc" != "yes" && compile_prog "" "-ltcmalloc" "tcmalloc"; then
2735 LIBS="-ltcmalloc $LIBS"
2740 print_config "TCMalloc support" "$tcmalloc"
2742 echo "LIBS+=$LIBS" >> $config_host_mak
2743 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
2744 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
2745 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
2746 echo "CC=$cc" >> $config_host_mak
2747 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
2748 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2750 if [ `dirname $0` != "." -a ! -e Makefile ]; then
2751 cat > Makefile <<EOF
2752 SRCDIR:=`dirname $0`
2753 include \$(SRCDIR)/Makefile