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
156 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
158 --prefix=*) prefix="$optarg"
160 --cpu=*) cpu="$optarg"
162 # esx is cross compiled and cannot be detect through simple uname calls
168 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
170 --build-32bit-win) build_32bit_win="yes"
172 --target-win-ver=*) target_win_ver="$optarg"
174 --build-static) build_static="yes"
176 --enable-gfio) gfio_check="yes"
178 --disable-numa) disable_numa="yes"
180 --disable-rdma) disable_rdma="yes"
182 --disable-rados) disable_rados="yes"
184 --disable-rbd) disable_rbd="yes"
186 --disable-http) disable_http="yes"
188 --disable-gfapi) disable_gfapi="yes"
190 --enable-libhdfs) libhdfs="yes"
192 --disable-lex) disable_lex="yes"
194 --enable-lex) disable_lex="no"
196 --disable-shm) no_shm="yes"
198 --disable-optimizations) disable_opt="yes"
200 --disable-pmem) disable_pmem="yes"
202 --enable-cuda) enable_cuda="yes"
204 --disable-native) disable_native="yes"
206 --with-ime=*) ime_path="$optarg"
208 --enable-libiscsi) libiscsi="yes"
214 echo "Bad option $opt"
220 if test "$show_help" = "yes" ; then
221 echo "--prefix= Use this directory as installation prefix"
222 echo "--cpu= Specify target CPU if auto-detect fails"
223 echo "--cc= Specify compiler to use"
224 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
225 echo "--build-32bit-win Enable 32-bit build on Windows"
226 echo "--target-win-ver= Minimum version of Windows to target (XP or 7)"
227 echo "--build-static Build a static fio"
228 echo "--esx Configure build options for esx"
229 echo "--enable-gfio Enable building of gtk gfio"
230 echo "--disable-numa Disable libnuma even if found"
231 echo "--disable-rdma Disable RDMA support even if found"
232 echo "--disable-rados Disable Rados support even if found"
233 echo "--disable-rbd Disable Rados Block Device even if found"
234 echo "--disable-http Disable HTTP support even if found"
235 echo "--disable-gfapi Disable gfapi"
236 echo "--enable-libhdfs Enable hdfs support"
237 echo "--disable-lex Disable use of lex/yacc for math"
238 echo "--disable-pmem Disable pmem based engines even if found"
239 echo "--enable-lex Enable use of lex/yacc for math"
240 echo "--disable-shm Disable SHM support"
241 echo "--disable-optimizations Don't enable compiler optimizations"
242 echo "--enable-cuda Enable GPUDirect RDMA support"
243 echo "--disable-native Don't build for native host"
244 echo "--with-ime= Install path for DDN's Infinite Memory Engine"
245 echo "--enable-libiscsi Enable iscsi support"
249 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
250 # Preferred compiler (can be overriden later after we know the platform):
252 # ${cross_prefix}gcc (if cross-prefix specified)
255 if test -z "${CC}${cross_prefix}"; then
262 cc="${CC-${cross_prefix}gcc}"
265 if check_define __ANDROID__ ; then
267 elif check_define __linux__ ; then
269 elif check_define __OpenBSD__ ; then
271 elif check_define __NetBSD__ ; then
273 elif check_define __sun__ ; then
275 CFLAGS="$CFLAGS -D_REENTRANT"
276 elif check_define _WIN32 ; then
282 echo "# Automatically generated by configure - do not modify" > $config_host_mak
283 printf "# Configured with:" >> $config_host_mak
284 printf " '%s'" "$0" "$@" >> $config_host_mak
285 echo >> $config_host_mak
286 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
288 if test "$no_shm" = "yes" ; then
289 output_sym "CONFIG_NO_SHM"
292 if test "$disable_opt" = "yes" ; then
293 output_sym "CONFIG_FIO_NO_OPT"
296 # Some host OSes need non-standard checks for which CPU to use.
297 # Note that these checks are broken for cross-compilation: if you're
298 # cross-compiling to one of these OSes then you'll need to specify
299 # the correct CPU with the --cpu option.
302 # Unless explicitly enabled, turn off lex.
303 # OpenBSD will hit syntax error when enabled.
304 if test -z "$disable_lex" ; then
311 CFLAGS="$CFLAGS -I/usr/local/include"
312 LDFLAGS="$LDFLAGS -L/usr/local/lib"
315 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
316 # we can run 64-bit userspace code.
317 # If the user didn't specify a CPU explicitly and the kernel says this is
318 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
320 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
323 # Error at compile time linking of weak/partial symbols if possible...
330 if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
331 echo "Disabling weak symbols"
332 LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
336 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
337 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
340 LIBS="-lnsl -lsocket"
343 # We still force some options, so keep this message here.
344 echo "Forcing some known good options on Windows"
345 if test -z "${CC}${cross_prefix}"; then
346 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
347 cc="i686-w64-mingw32-gcc"
349 cc="x86_64-w64-mingw32-gcc"
353 target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]')
354 if test -z "$target_win_ver"; then
355 # Default Windows API target
358 if test "$target_win_ver" = "XP"; then
359 output_sym "CONFIG_WINDOWS_XP"
360 elif test "$target_win_ver" = "7"; then
361 output_sym "CONFIG_WINDOWS_7"
362 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601"
364 fatal "Unknown target Windows version"
367 # We need this to be output_sym'd here because this is Windows specific.
368 # The regular configure path never sets this config.
369 output_sym "CONFIG_WINDOWSAIO"
370 # We now take the regular configuration path without having exit 0 here.
371 # Flags below are still necessary mostly for MinGW.
376 clock_gettime="yes" # clock_monotonic probe has dependency on this
377 clock_monotonic="yes"
385 # Now we know the target platform we can have another guess at the preferred
386 # compiler when it wasn't explictly set
387 if test -z "${CC}${cross_prefix}"; then
388 if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
394 if test -z "$cc"; then
395 echo "configure: failed to find compiler"
399 if test ! -z "$cpu" ; then
400 # command line argument
402 elif check_define __i386__ ; then
404 elif check_define __x86_64__ ; then
406 elif check_define __sparc__ ; then
407 if check_define __arch64__ ; then
412 elif check_define _ARCH_PPC ; then
413 if check_define _ARCH_PPC64 ; then
418 elif check_define __mips__ ; then
420 elif check_define __ia64__ ; then
422 elif check_define __s390__ ; then
423 if check_define __s390x__ ; then
428 elif check_define __arm__ ; then
430 elif check_define __aarch64__ ; then
432 elif check_define __hppa__ ; then
438 # Normalise host CPU name and set ARCH.
440 ia64|ppc|ppc64|s390|s390x|sparc64)
443 i386|i486|i586|i686|i86pc|BePC)
455 hppa|parisc|parisc64)
469 ##########################################
470 # check cross compile
472 if test "$cross_compile" != "yes" ; then
481 if compile_prog "" "" "cross"; then
482 $TMPE 2>/dev/null || cross_compile="yes"
484 fatal "compile test failed"
487 ##########################################
489 if test "$bigendian" != "yes" ; then
492 if test "$cross_compile" = "no" ; then
494 #include <inttypes.h>
497 volatile uint32_t i=0x01234567;
498 return (*((uint8_t*)(&i))) == 0x67;
501 if compile_prog "" "" "endian"; then
502 $TMPE && bigendian="yes"
505 # If we're cross compiling, try our best to work it out and rely on the
506 # run-time check to fail if we get it wrong.
511 #if __BYTE_ORDER != __BIG_ENDIAN
512 # error "Unknown endianness"
516 compile_prog "" "" "endian" && bigendian="yes"
517 check_define "__ARMEB__" && bigendian="yes"
518 check_define "__MIPSEB__" && bigendian="yes"
522 print_config "Operating system" "$targetos"
523 print_config "CPU" "$cpu"
524 print_config "Big endian" "$bigendian"
525 if test ! -z "$target_win_ver"; then
526 print_config "Target Windows version" "$target_win_ver"
528 print_config "Compiler" "$cc"
529 print_config "Cross compile" "$cross_compile"
532 ##########################################
533 # See if we need to build a static build
534 if test "$build_static" = "yes" ; then
535 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
536 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
540 print_config "Static build" "$build_static"
542 ##########################################
547 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
550 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
554 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
556 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
559 fatal "Unknown wordsize"
561 print_config "Wordsize" "$wordsize"
563 ##########################################
565 if test "$zlib" != "yes" ; then
573 if (inflateInit(&stream) != Z_OK)
578 if compile_prog "" "-lz" "zlib" ; then
582 print_config "zlib" "$zlib"
584 ##########################################
586 if test "$libaio" != "yes" ; then
589 if test "$esx" != "yes" ; then
599 if compile_prog "" "-laio" "libaio" ; then
603 if test "$libaio" = "yes" ; then
604 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
609 print_config "Linux AIO support" "$libaio"
611 ##########################################
613 if test "$posix_aio" != "yes" ; then
616 if test "$posix_aio_lrt" != "yes" ; then
628 if compile_prog "" "" "posixaio" ; then
630 elif compile_prog "" "-lrt" "posixaio -lrt"; then
635 print_config "POSIX AIO support" "$posix_aio"
636 print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
638 ##########################################
639 # posix aio fsync probe
640 if test "$posix_aio_fsync" != "yes" ; then
643 if test "$posix_aio" = "yes" ; then
650 return aio_fsync(O_SYNC, &cb);
654 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
658 print_config "POSIX AIO fsync" "$posix_aio_fsync"
660 ##########################################
661 # POSIX pshared attribute probe
662 if test "$posix_pshared" != "yes" ; then
669 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
670 # if defined(__CYGWIN__)
671 # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
672 # elif defined(__APPLE__)
673 # include <AvailabilityMacros.h>
674 # include <TargetConditionals.h>
675 # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
676 # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
680 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
685 if compile_prog "" "$LIBS" "posix_pshared" ; then
688 print_config "POSIX pshared support" "$posix_pshared"
690 ##########################################
692 if test "$solaris_aio" != "yes" ; then
696 #include <sys/types.h>
697 #include <sys/asynch.h>
702 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
706 if compile_prog "" "-laio" "solarisaio" ; then
710 print_config "Solaris AIO support" "$solaris_aio"
712 ##########################################
713 # __sync_fetch_and_add test
714 if test "$sfaa" != "yes" ; then
718 #include <inttypes.h>
719 static int sfaa(uint64_t *ptr)
721 return __sync_fetch_and_add(ptr, 0);
724 int main(int argc, char **argv)
731 if compile_prog "" "" "__sync_fetch_and_add()" ; then
734 print_config "__sync_fetch_and_add" "$sfaa"
736 ##########################################
737 # __sync_synchronize() test
738 if test "$sync_sync" != "yes" ; then
742 #include <inttypes.h>
744 int main(int argc, char **argv)
746 __sync_synchronize();
750 if compile_prog "" "" "__sync_synchronize()" ; then
753 print_config "__sync_synchronize" "$sync_sync"
755 ##########################################
756 # __sync_val_compare_and_swap() test
757 if test "$cmp_swap" != "yes" ; then
761 #include <inttypes.h>
763 int main(int argc, char **argv)
766 return __sync_val_compare_and_swap(&x, 1, 2);
769 if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
772 print_config "__sync_val_compare_and_swap" "$cmp_swap"
774 ##########################################
776 if test "$libverbs" != "yes" ; then
780 #include <infiniband/verbs.h>
781 int main(int argc, char **argv)
783 struct ibv_pd *pd = ibv_alloc_pd(NULL);
787 if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
789 LIBS="-libverbs $LIBS"
791 print_config "libverbs" "$libverbs"
793 ##########################################
795 if test "$rdmacm" != "yes" ; then
800 #include <rdma/rdma_cma.h>
801 int main(int argc, char **argv)
803 rdma_destroy_qp(NULL);
807 if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
809 LIBS="-lrdmacm $LIBS"
811 print_config "rdmacm" "$rdmacm"
813 ##########################################
814 # asprintf() and vasprintf() probes
815 if test "$have_asprintf" != "yes" ; then
821 int main(int argc, char **argv)
823 return asprintf(NULL, "%s", "str") == 0;
826 if compile_prog "" "" "have_asprintf"; then
829 print_config "asprintf()" "$have_asprintf"
831 if test "$have_vasprintf" != "yes" ; then
837 int main(int argc, char **argv)
839 return vasprintf(NULL, "%s", NULL) == 0;
842 if compile_prog "" "" "have_vasprintf"; then
845 print_config "vasprintf()" "$have_vasprintf"
847 ##########################################
848 # Linux fallocate probe
849 if test "$linux_fallocate" != "yes" ; then
855 #include <linux/falloc.h>
856 int main(int argc, char **argv)
858 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
862 if compile_prog "" "" "linux_fallocate"; then
863 linux_fallocate="yes"
865 print_config "Linux fallocate" "$linux_fallocate"
867 ##########################################
868 # POSIX fadvise probe
869 if test "$posix_fadvise" != "yes" ; then
875 int main(int argc, char **argv)
877 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
881 if compile_prog "" "" "posix_fadvise"; then
884 print_config "POSIX fadvise" "$posix_fadvise"
886 ##########################################
887 # POSIX fallocate probe
888 if test "$posix_fallocate" != "yes" ; then
894 int main(int argc, char **argv)
896 int r = posix_fallocate(0, 0, 1024);
900 if compile_prog "" "" "posix_fallocate"; then
901 posix_fallocate="yes"
903 print_config "POSIX fallocate" "$posix_fallocate"
905 ##########################################
906 # sched_set/getaffinity 2 or 3 argument test
907 if test "$linux_2arg_affinity" != "yes" ; then
908 linux_2arg_affinity="no"
910 if test "$linux_3arg_affinity" != "yes" ; then
911 linux_3arg_affinity="no"
915 int main(int argc, char **argv)
918 return sched_setaffinity(0, sizeof(mask), &mask);
921 if compile_prog "" "" "sched_setaffinity(,,)"; then
922 linux_3arg_affinity="yes"
926 int main(int argc, char **argv)
929 return sched_setaffinity(0, &mask);
932 if compile_prog "" "" "sched_setaffinity(,)"; then
933 linux_2arg_affinity="yes"
936 print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
937 print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
939 ##########################################
940 # clock_gettime probe
941 if test "$clock_gettime" != "yes" ; then
947 int main(int argc, char **argv)
949 return clock_gettime(0, NULL);
952 if compile_prog "" "" "clock_gettime"; then
954 elif compile_prog "" "-lrt" "clock_gettime"; then
958 print_config "clock_gettime" "$clock_gettime"
960 ##########################################
961 # CLOCK_MONOTONIC probe
962 if test "$clock_monotonic" != "yes" ; then
965 if test "$clock_gettime" = "yes" ; then
969 int main(int argc, char **argv)
971 return clock_gettime(CLOCK_MONOTONIC, NULL);
974 if compile_prog "" "$LIBS" "clock monotonic"; then
975 clock_monotonic="yes"
978 print_config "CLOCK_MONOTONIC" "$clock_monotonic"
980 ##########################################
981 # CLOCK_MONOTONIC_RAW probe
982 if test "$clock_monotonic_raw" != "yes" ; then
983 clock_monotonic_raw="no"
985 if test "$clock_gettime" = "yes" ; then
989 int main(int argc, char **argv)
991 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
994 if compile_prog "" "$LIBS" "clock monotonic"; then
995 clock_monotonic_raw="yes"
998 print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw"
1000 ##########################################
1001 # CLOCK_MONOTONIC_PRECISE probe
1002 if test "$clock_monotonic_precise" != "yes" ; then
1003 clock_monotonic_precise="no"
1005 if test "$clock_gettime" = "yes" ; then
1009 int main(int argc, char **argv)
1011 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
1014 if compile_prog "" "$LIBS" "clock monotonic precise"; then
1015 clock_monotonic_precise="yes"
1018 print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise"
1020 ##########################################
1022 if test "$clockid_t" != "yes" ; then
1028 int main(int argc, char **argv)
1030 volatile clockid_t cid;
1031 memset((void*)&cid, 0, sizeof(cid));
1035 if compile_prog "" "$LIBS" "clockid_t"; then
1038 print_config "clockid_t" "$clockid_t"
1040 ##########################################
1041 # gettimeofday() probe
1042 if test "$gettimeofday" != "yes" ; then
1046 #include <sys/time.h>
1048 int main(int argc, char **argv)
1051 return gettimeofday(&tv, NULL);
1054 if compile_prog "" "" "gettimeofday"; then
1057 print_config "gettimeofday" "$gettimeofday"
1059 ##########################################
1061 if test "$fdatasync" != "yes" ; then
1067 int main(int argc, char **argv)
1069 return fdatasync(0);
1072 if compile_prog "" "" "fdatasync"; then
1075 print_config "fdatasync" "$fdatasync"
1077 ##########################################
1078 # sync_file_range() probe
1079 if test "$sync_file_range" != "yes" ; then
1080 sync_file_range="no"
1086 #include <linux/fs.h>
1087 int main(int argc, char **argv)
1089 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1090 SYNC_FILE_RANGE_WAIT_AFTER;
1091 return sync_file_range(0, 0, 0, flags);
1094 if compile_prog "" "" "sync_file_range"; then
1095 sync_file_range="yes"
1097 print_config "sync_file_range" "$sync_file_range"
1099 ##########################################
1100 # ext4 move extent probe
1101 if test "$ext4_me" != "yes" ; then
1106 #include <sys/ioctl.h>
1107 int main(int argc, char **argv)
1109 struct move_extent me;
1110 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1113 if compile_prog "" "" "ext4 move extent" ; then
1115 elif test $targetos = "Linux" ; then
1116 # On Linux, just default to it on and let it error at runtime if we really
1117 # don't have it. None of my updated systems have it defined, but it does
1118 # work. Takes a while to bubble back.
1121 print_config "EXT4 move extent" "$ext4_me"
1123 ##########################################
1125 if test "$linux_splice" != "yes" ; then
1131 int main(int argc, char **argv)
1133 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1136 if compile_prog "" "" "linux splice"; then
1139 print_config "Linux splice(2)" "$linux_splice"
1141 ##########################################
1143 if test "$guasi" != "yes" ; then
1148 #include <guasi_syscalls.h>
1149 int main(int argc, char **argv)
1151 guasi_t ctx = guasi_create(0, 0, 0);
1155 if compile_prog "" "" "guasi"; then
1158 print_config "GUASI" "$guasi"
1160 ##########################################
1162 if test "$libnuma" != "yes" ; then
1167 int main(int argc, char **argv)
1169 return numa_available();
1172 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1176 print_config "libnuma" "$libnuma"
1178 ##########################################
1179 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1180 if test "$libnuma" = "yes" ; then
1184 int main(int argc, char **argv)
1186 struct bitmask *mask = numa_parse_nodestring(NULL);
1187 return mask->size == 0;
1190 if compile_prog "" "" "libnuma api"; then
1193 print_config "libnuma v2" "$libnuma_v2"
1196 ##########################################
1198 if test "$strsep" != "yes" ; then
1203 int main(int argc, char **argv)
1205 static char *string = "This is a string";
1206 strsep(&string, "needle");
1210 if compile_prog "" "" "strsep"; then
1213 print_config "strsep" "$strsep"
1215 ##########################################
1216 # strcasestr() probe
1217 if test "$strcasestr" != "yes" ; then
1222 int main(int argc, char **argv)
1224 return strcasestr(argv[0], argv[1]) != NULL;
1227 if compile_prog "" "" "strcasestr"; then
1230 print_config "strcasestr" "$strcasestr"
1232 ##########################################
1234 if test "$strlcat" != "yes" ; then
1239 int main(int argc, char **argv)
1241 static char dst[64];
1242 static char *string = "This is a string";
1243 memset(dst, 0, sizeof(dst));
1244 strlcat(dst, string, sizeof(dst));
1248 if compile_prog "" "" "strlcat"; then
1251 print_config "strlcat" "$strlcat"
1253 ##########################################
1254 # getopt_long_only() probe
1255 if test "$getopt_long_only" != "yes" ; then
1256 getopt_long_only="no"
1262 int main(int argc, char **argv)
1264 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1268 if compile_prog "" "" "getopt_long_only"; then
1269 getopt_long_only="yes"
1271 print_config "getopt_long_only()" "$getopt_long_only"
1273 ##########################################
1275 if test "$inet_aton" != "yes" ; then
1279 #include <sys/socket.h>
1280 #include <arpa/inet.h>
1282 int main(int argc, char **argv)
1285 return inet_aton(NULL, &in);
1288 if compile_prog "" "" "inet_aton"; then
1291 print_config "inet_aton" "$inet_aton"
1293 ##########################################
1295 if test "$socklen_t" != "yes" ; then
1299 #include <sys/socket.h>
1300 int main(int argc, char **argv)
1306 if compile_prog "" "" "socklen_t"; then
1309 print_config "socklen_t" "$socklen_t"
1311 ##########################################
1312 # Whether or not __thread is supported for TLS
1313 if test "$tls_thread" != "yes" ; then
1318 static __thread int ret;
1319 int main(int argc, char **argv)
1324 if compile_prog "" "" "__thread"; then
1327 print_config "__thread" "$tls_thread"
1329 ##########################################
1330 # Check if we have required gtk/glib support for gfio
1331 if test "$gfio" != "yes" ; then
1334 if test "$gfio_check" = "yes" ; then
1338 #include <gtk/gtk.h>
1341 gdk_threads_enter();
1342 gdk_threads_leave();
1344 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1347 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1348 ORG_LDFLAGS=$LDFLAGS
1349 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1350 if test "$?" != "0" ; then
1351 echo "configure: gtk and gthread not found"
1354 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1355 if test "$?" != "0" ; then
1356 echo "configure: gtk and gthread not found"
1359 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1361 if test "$?" = "0" ; then
1363 GFIO_LIBS="$LIBS $GTK_LIBS"
1364 CFLAGS="$CFLAGS $GTK_CFLAGS"
1366 echo "GTK found, but need version 2.18 or higher"
1370 echo "Please install gtk and gdk libraries"
1373 LDFLAGS=$ORG_LDFLAGS
1376 if test "$gfio_check" = "yes" ; then
1377 print_config "gtk 2.18 or higher" "$gfio"
1380 ##########################################
1381 # Check whether we have getrusage(RUSAGE_THREAD)
1382 if test "$rusage_thread" != "yes" ; then
1386 #include <sys/time.h>
1387 #include <sys/resource.h>
1388 int main(int argc, char **argv)
1391 getrusage(RUSAGE_THREAD, &ru);
1395 if compile_prog "" "" "RUSAGE_THREAD"; then
1398 print_config "RUSAGE_THREAD" "$rusage_thread"
1400 ##########################################
1401 # Check whether we have SCHED_IDLE
1402 if test "$sched_idle" != "yes" ; then
1407 int main(int argc, char **argv)
1409 struct sched_param p;
1410 return sched_setscheduler(0, SCHED_IDLE, &p);
1413 if compile_prog "" "" "SCHED_IDLE"; then
1416 print_config "SCHED_IDLE" "$sched_idle"
1418 ##########################################
1419 # Check whether we have TCP_NODELAY
1420 if test "$tcp_nodelay" != "yes" ; then
1425 #include <sys/types.h>
1426 #include <sys/socket.h>
1427 #include <netinet/tcp.h>
1428 int main(int argc, char **argv)
1430 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1433 if compile_prog "" "" "TCP_NODELAY"; then
1436 print_config "TCP_NODELAY" "$tcp_nodelay"
1438 ##########################################
1439 # Check whether we have SO_SNDBUF
1440 if test "$window_size" != "yes" ; then
1445 #include <sys/types.h>
1446 #include <sys/socket.h>
1447 #include <netinet/tcp.h>
1448 int main(int argc, char **argv)
1450 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1451 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1454 if compile_prog "" "" "SO_SNDBUF"; then
1457 print_config "Net engine window_size" "$window_size"
1459 ##########################################
1460 # Check whether we have TCP_MAXSEG
1461 if test "$mss" != "yes" ; then
1466 #include <sys/types.h>
1467 #include <sys/socket.h>
1468 #include <netinet/tcp.h>
1469 #include <arpa/inet.h>
1470 #include <netinet/in.h>
1471 int main(int argc, char **argv)
1473 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1476 if compile_prog "" "" "TCP_MAXSEG"; then
1479 print_config "TCP_MAXSEG" "$mss"
1481 ##########################################
1482 # Check whether we have RLIMIT_MEMLOCK
1483 if test "$rlimit_memlock" != "yes" ; then
1487 #include <sys/time.h>
1488 #include <sys/resource.h>
1489 int main(int argc, char **argv)
1492 return getrlimit(RLIMIT_MEMLOCK, &rl);
1495 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1496 rlimit_memlock="yes"
1498 print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1500 ##########################################
1501 # Check whether we have pwritev/preadv
1502 if test "$pwritev" != "yes" ; then
1507 #include <sys/uio.h>
1508 int main(int argc, char **argv)
1510 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1513 if compile_prog "" "" "pwritev"; then
1516 print_config "pwritev/preadv" "$pwritev"
1518 ##########################################
1519 # Check whether we have pwritev2/preadv2
1520 if test "$pwritev2" != "yes" ; then
1525 #include <sys/uio.h>
1526 int main(int argc, char **argv)
1528 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1531 if compile_prog "" "" "pwritev2"; then
1534 print_config "pwritev2/preadv2" "$pwritev2"
1536 ##########################################
1537 # Check whether we have the required functions for ipv6
1538 if test "$ipv6" != "yes" ; then
1542 #include <sys/types.h>
1543 #include <sys/socket.h>
1544 #include <netinet/in.h>
1547 int main(int argc, char **argv)
1549 struct addrinfo hints;
1550 struct in6_addr addr;
1553 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1555 printf("%s\n", gai_strerror(ret));
1560 if compile_prog "" "" "ipv6"; then
1563 print_config "IPv6 helpers" "$ipv6"
1565 ##########################################
1567 if test "$http" != "yes" ; then
1570 # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
1572 #include <curl/curl.h>
1573 #include <openssl/hmac.h>
1575 int main(int argc, char **argv)
1580 curl = curl_easy_init();
1581 curl_easy_cleanup(curl);
1583 ctx = HMAC_CTX_new();
1584 HMAC_CTX_reset(ctx);
1589 # openssl < 1.1.0 uses the HMAC_CTX type directly
1591 #include <curl/curl.h>
1592 #include <openssl/hmac.h>
1594 int main(int argc, char **argv)
1599 curl = curl_easy_init();
1600 curl_easy_cleanup(curl);
1602 HMAC_CTX_init(&ctx);
1603 HMAC_CTX_cleanup(&ctx);
1607 if test "$disable_http" != "yes"; then
1608 HTTP_LIBS="-lcurl -lssl -lcrypto"
1609 if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then
1610 output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
1612 LIBS="$HTTP_LIBS $LIBS"
1613 elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
1615 LIBS="$HTTP_LIBS $LIBS"
1618 print_config "http engine" "$http"
1620 ##########################################
1622 if test "$rados" != "yes" ; then
1626 #include <rados/librados.h>
1628 int main(int argc, char **argv)
1631 rados_ioctx_t io_ctx;
1632 const char cluster_name[] = "ceph";
1633 const char user_name[] = "client.admin";
1634 const char pool[] = "rados";
1636 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1637 rados_create2(&cluster, cluster_name, user_name, 0);
1638 rados_ioctx_create(cluster, pool, &io_ctx);
1643 if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
1644 LIBS="-lrados $LIBS"
1647 print_config "Rados engine" "$rados"
1649 ##########################################
1651 if test "$rbd" != "yes" ; then
1655 #include <rbd/librbd.h>
1657 int main(int argc, char **argv)
1660 rados_ioctx_t io_ctx;
1661 const char cluster_name[] = "ceph";
1662 const char user_name[] = "client.admin";
1663 const char pool[] = "rbd";
1664 int major, minor, extra;
1666 rbd_version(&major, &minor, &extra);
1667 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1668 rados_create2(&cluster, cluster_name, user_name, 0);
1669 rados_ioctx_create(cluster, pool, &io_ctx);
1674 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1675 LIBS="-lrbd -lrados $LIBS"
1678 print_config "Rados Block Device engine" "$rbd"
1680 ##########################################
1681 # check for rbd_poll
1682 if test "$rbd_poll" != "yes" ; then
1685 if test "$rbd" = "yes"; then
1687 #include <rbd/librbd.h>
1688 #include <sys/eventfd.h>
1690 int main(int argc, char **argv)
1693 rbd_completion_t comp;
1695 int fd = eventfd(0, EFD_NONBLOCK);
1696 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1697 rbd_poll_io_events(image, comp, 1);
1702 if compile_prog "" "-lrbd -lrados" "rbd"; then
1705 print_config "rbd_poll" "$rbd_poll"
1708 ##########################################
1709 # check for rbd_invalidate_cache()
1710 if test "$rbd_inval" != "yes" ; then
1713 if test "$rbd" = "yes"; then
1715 #include <rbd/librbd.h>
1717 int main(int argc, char **argv)
1721 return rbd_invalidate_cache(image);
1724 if compile_prog "" "-lrbd -lrados" "rbd"; then
1727 print_config "rbd_invalidate_cache" "$rbd_inval"
1730 ##########################################
1731 # Check whether we have setvbuf
1732 if test "$setvbuf" != "yes" ; then
1737 int main(int argc, char **argv)
1741 setvbuf(f, buf, _IOFBF, sizeof(buf));
1745 if compile_prog "" "" "setvbuf"; then
1748 print_config "setvbuf" "$setvbuf"
1750 ##########################################
1752 if test "$gfapi" != "yes" ; then
1756 #include <glusterfs/api/glfs.h>
1758 int main(int argc, char **argv)
1760 glfs_t *g = glfs_new("foo");
1765 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1766 LIBS="-lgfapi -lglusterfs $LIBS"
1769 print_config "Gluster API engine" "$gfapi"
1771 ##########################################
1772 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1773 if test "$gfapi" = "yes" ; then
1776 #include <glusterfs/api/glfs.h>
1778 int main(int argc, char **argv)
1781 int ret = glfs_fadvise(fd, 0, 0, 1);
1786 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1789 print_config "Gluster API use fadvise" "$gf_fadvise"
1792 ##########################################
1793 # check for gfapi trim support
1794 if test "$gf_trim" != "yes" ; then
1797 if test "$gfapi" = "yes" ; then
1799 #include <glusterfs/api/glfs.h>
1801 int main(int argc, char **argv)
1803 return glfs_discard_async(NULL, 0, 0);
1806 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1809 print_config "Gluster API trim support" "$gf_trim"
1812 ##########################################
1813 # Check if we support stckf on s390
1814 if test "$s390_z196_facilities" != "yes" ; then
1815 s390_z196_facilities="no"
1818 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1819 int main(int argc, char **argv)
1821 /* We want just 1 double word to be returned. */
1822 register unsigned long reg0 asm("0") = 0;
1823 unsigned long stfle_bits;
1824 asm volatile(".machine push" "\n\t"
1825 ".machine \"z9-109\"" "\n\t"
1828 : "=QS" (stfle_bits), "+d" (reg0)
1831 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1837 if compile_prog "" "" "s390_z196_facilities"; then
1839 if [ $? -eq 0 ]; then
1840 s390_z196_facilities="yes"
1843 print_config "s390_z196_facilities" "$s390_z196_facilities"
1845 ##########################################
1846 # Check if we have required environment variables configured for libhdfs
1847 if test "$libhdfs" = "yes" ; then
1849 if test "$JAVA_HOME" = "" ; then
1850 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1853 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1854 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1857 if test "$FIO_LIBHDFS_LIB" = "" ; then
1858 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1861 if test "$hdfs_conf_error" = "1" ; then
1865 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1866 FIO_HDFS_CPU="amd64"
1869 print_config "HDFS engine" "$libhdfs"
1871 ##########################################
1872 # Check whether we have MTD
1873 if test "$mtd" != "yes" ; then
1878 #include <mtd/mtd-user.h>
1879 #include <sys/ioctl.h>
1880 int main(int argc, char **argv)
1882 struct mtd_write_req ops;
1883 struct mtd_info_user info;
1884 memset(&ops, 0, sizeof(ops));
1885 info.type = MTD_MLCNANDFLASH;
1886 return ioctl(0, MEMGETINFO, &info);
1889 if compile_prog "" "" "mtd"; then
1892 print_config "MTD" "$mtd"
1894 ##########################################
1895 # Check whether we have libpmem
1896 if test "$libpmem" != "yes" ; then
1900 #include <libpmem.h>
1901 int main(int argc, char **argv)
1904 rc = pmem_is_pmem(0, 0);
1908 if compile_prog "" "-lpmem" "libpmem"; then
1912 print_config "libpmem" "$libpmem"
1914 ##########################################
1915 # Check whether we have libpmemblk
1916 # libpmem is a prerequisite
1917 if test "$libpmemblk" != "yes" ; then
1920 if test "$libpmem" = "yes"; then
1922 #include <libpmemblk.h>
1923 int main(int argc, char **argv)
1926 pbp = pmemblk_open("", 0);
1930 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1932 LIBS="-lpmemblk $LIBS"
1935 print_config "libpmemblk" "$libpmemblk"
1937 # Choose the ioengines
1938 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1941 if test "$libpmemblk" = "yes"; then
1946 ##########################################
1947 # Report whether pmemblk engine is enabled
1948 print_config "PMDK pmemblk engine" "$pmemblk"
1950 ##########################################
1951 # Report whether dev-dax engine is enabled
1952 print_config "PMDK dev-dax engine" "$devdax"
1954 ##########################################
1955 # Report whether libpmem engine is enabled
1956 print_config "PMDK libpmem engine" "$pmem"
1958 ##########################################
1959 # Check whether we support DDN's IME
1960 if test "$libime" != "yes" ; then
1964 #include <ime_native.h>
1965 int main(int argc, char **argv)
1969 rc = ime_native_finalize();
1973 if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then
1975 CFLAGS="-I${ime_path}/include $CFLAGS"
1976 LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS"
1977 LIBS="-lim_client $LIBS"
1979 print_config "DDN's Infinite Memory Engine" "$libime"
1981 ##########################################
1982 # Check if we have required environment variables configured for libiscsi
1983 if test "$libiscsi" = "yes" ; then
1984 if $(pkg-config --atleast-version=1.9.0 libiscsi); then
1986 libiscsi_cflags=$(pkg-config --cflags libiscsi)
1987 libiscsi_libs=$(pkg-config --libs libiscsi)
1989 if test "$libiscsi" = "yes" ; then
1990 echo "libiscsi" "Install libiscsi >= 1.9.0"
1995 print_config "iscsi engine" "$libiscsi"
1997 ##########################################
1998 # Check if we have lex/yacc available
2003 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
2004 if test "$targetos" != "SunOS" ; then
2005 LEX=$(which lex 2> /dev/null)
2006 if test -x "$LEX" ; then
2009 YACC=$(which bison 2> /dev/null)
2010 if test -x "$YACC" ; then
2014 YACC=$(which yacc 2> /dev/null)
2015 if test -x "$YACC" ; then
2019 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2023 if test "$arith" = "yes" ; then
2025 extern int yywrap(void);
2027 int main(int argc, char **argv)
2033 if compile_prog "" "-ll" "lex"; then
2042 # Check if lex fails using -o
2043 if test "$arith" = "yes" ; then
2044 if test "$force_no_lex_o" = "yes" ; then
2047 $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
2048 if test "$?" = "0" ; then
2056 print_config "lex/yacc for arithmetic" "$arith"
2058 ##########################################
2059 # Check whether we have setmntent/getmntent
2060 if test "$getmntent" != "yes" ; then
2066 int main(int argc, char **argv)
2068 FILE *mtab = setmntent(NULL, "r");
2069 struct mntent *mnt = getmntent(mtab);
2074 if compile_prog "" "" "getmntent"; then
2077 print_config "getmntent" "$getmntent"
2079 ##########################################
2080 # Check whether we have getmntinfo
2081 # These are originally added for BSDs, but may also work
2082 # on other operating systems with getmntinfo(3).
2084 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
2085 # Note that NetBSD needs -Werror to catch warning as error.
2086 if test "$getmntinfo" != "yes" ; then
2091 #include <sys/param.h>
2092 #include <sys/mount.h>
2093 int main(int argc, char **argv)
2096 return getmntinfo(&st, MNT_NOWAIT);
2099 if compile_prog "-Werror" "" "getmntinfo"; then
2102 print_config "getmntinfo" "$getmntinfo"
2104 # getmntinfo(3) for NetBSD.
2105 if test "$getmntinfo_statvfs" != "yes" ; then
2106 getmntinfo_statvfs="no"
2110 #include <sys/statvfs.h>
2111 int main(int argc, char **argv)
2114 return getmntinfo(&st, MNT_NOWAIT);
2117 # Skip the test if the one with statfs arg is detected.
2118 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2119 getmntinfo_statvfs="yes"
2120 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
2123 ##########################################
2124 # Check whether we have _Static_assert
2125 if test "$static_assert" != "yes" ; then
2137 int main(int argc, char **argv)
2139 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2143 if compile_prog "" "" "static_assert"; then
2146 print_config "Static Assert" "$static_assert"
2148 ##########################################
2149 # Check whether we have bool / stdbool.h
2150 if test "$have_bool" != "yes" ; then
2154 #include <stdbool.h>
2155 int main(int argc, char **argv)
2158 return var != false;
2161 if compile_prog "" "" "bool"; then
2164 print_config "bool" "$have_bool"
2166 ##########################################
2167 # Check whether we have strndup()
2172 int main(int argc, char **argv)
2174 char *res = strndup("test string", 8);
2180 if compile_prog "" "" "strndup"; then
2183 print_config "strndup" "$strndup"
2185 ##########################################
2186 # <valgrind/drd.h> probe
2187 # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is
2188 # also available but not the other way around.
2189 if test "$valgrind_dev" != "yes" ; then
2193 #include <valgrind/drd.h>
2194 int main(int argc, char **argv)
2199 if compile_prog "" "" "valgrind_dev"; then
2202 print_config "Valgrind headers" "$valgrind_dev"
2204 ##########################################
2205 # <linux/blkzoned.h> probe
2206 if test "$linux_blkzoned" != "yes" ; then
2210 #include <linux/blkzoned.h>
2211 int main(int argc, char **argv)
2216 if compile_prog "" "" "linux_blkzoned"; then
2217 linux_blkzoned="yes"
2219 print_config "Zoned block device support" "$linux_blkzoned"
2221 ##########################################
2222 # check march=armv8-a+crc+crypto
2223 if test "$march_armv8_a_crc_crypto" != "yes" ; then
2224 march_armv8_a_crc_crypto="no"
2226 if test "$cpu" = "arm64" ; then
2228 #include <arm_acle.h>
2229 #include <arm_neon.h>
2230 #include <sys/auxv.h>
2234 /* Can we also do a runtime probe? */
2236 return getauxval(AT_HWCAP);
2238 # error "Don't know how to do runtime probe for ARM CRC32c"
2242 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
2243 march_armv8_a_crc_crypto="yes"
2244 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
2248 print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2250 ##########################################
2252 if test "$cuda" != "yes" ; then
2257 int main(int argc, char **argv)
2262 if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
2266 print_config "cuda" "$cuda"
2268 ##########################################
2269 # mkdir() probe. mingw apparently has a one-argument mkdir :/
2272 #include <sys/stat.h>
2273 #include <sys/types.h>
2274 int main(int argc, char **argv)
2276 return mkdir("/tmp/bla", 0600);
2279 if compile_prog "" "" "mkdir(a, b)"; then
2282 print_config "mkdir(a, b)" "$mkdir_two"
2284 ##########################################
2285 # check for cc -march=native
2288 int main(int argc, char **argv)
2293 if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2294 compile_prog "-march=native" "" "march=native"; then
2297 print_config "Build march=native" "$build_native"
2299 ##########################################
2301 if test "$cunit" != "yes" ; then
2305 #include <CUnit/CUnit.h>
2306 #include <CUnit/Basic.h>
2309 if (CU_initialize_registry() != CUE_SUCCESS)
2310 return CU_get_error();
2311 CU_basic_set_mode(CU_BRM_VERBOSE);
2312 CU_basic_run_tests();
2313 CU_cleanup_registry();
2314 return CU_get_error();
2317 if compile_prog "" "-lcunit" "CUnit"; then
2320 print_config "CUnit" "$cunit"
2322 ##########################################
2323 # check for __kernel_rwf_t
2326 #include <linux/fs.h>
2327 int main(int argc, char **argv)
2334 if compile_prog "" "" "__kernel_rwf_t"; then
2335 __kernel_rwf_t="yes"
2337 print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2339 ##########################################
2340 # check if gcc has -Wimplicit-fallthrough
2343 int main(int argc, char **argv)
2348 if compile_prog "-Wimplicit-fallthrough" "" "-Wimplicit-fallthrough"; then
2351 print_config "-Wimplicit-fallthrough" "$fallthrough"
2353 ##########################################
2354 # check for MADV_HUGEPAGE support
2355 if test "$thp" != "yes" ; then
2358 if test "$esx" != "yes" ; then
2360 #include <sys/mman.h>
2363 return madvise(0, 0x1000, MADV_HUGEPAGE);
2366 if compile_prog "" "" "thp" ; then
2369 if test "$thp" = "yes" ; then
2370 feature_not_found "Transparent Huge Page" ""
2375 print_config "MADV_HUGEPAGE" "$thp"
2377 #############################################################################
2379 if test "$wordsize" = "64" ; then
2380 output_sym "CONFIG_64BIT"
2381 elif test "$wordsize" = "32" ; then
2382 output_sym "CONFIG_32BIT"
2384 fatal "Unknown wordsize!"
2386 if test "$bigendian" = "yes" ; then
2387 output_sym "CONFIG_BIG_ENDIAN"
2389 output_sym "CONFIG_LITTLE_ENDIAN"
2391 if test "$zlib" = "yes" ; then
2392 output_sym "CONFIG_ZLIB"
2394 if test "$libaio" = "yes" ; then
2395 output_sym "CONFIG_LIBAIO"
2397 if test "$posix_aio" = "yes" ; then
2398 output_sym "CONFIG_POSIXAIO"
2400 if test "$posix_aio_fsync" = "yes" ; then
2401 output_sym "CONFIG_POSIXAIO_FSYNC"
2403 if test "$posix_pshared" = "yes" ; then
2404 output_sym "CONFIG_PSHARED"
2406 if test "$have_asprintf" = "yes" ; then
2407 output_sym "CONFIG_HAVE_ASPRINTF"
2409 if test "$have_vasprintf" = "yes" ; then
2410 output_sym "CONFIG_HAVE_VASPRINTF"
2412 if test "$linux_fallocate" = "yes" ; then
2413 output_sym "CONFIG_LINUX_FALLOCATE"
2415 if test "$posix_fallocate" = "yes" ; then
2416 output_sym "CONFIG_POSIX_FALLOCATE"
2418 if test "$fdatasync" = "yes" ; then
2419 output_sym "CONFIG_FDATASYNC"
2421 if test "$sync_file_range" = "yes" ; then
2422 output_sym "CONFIG_SYNC_FILE_RANGE"
2424 if test "$sfaa" = "yes" ; then
2425 output_sym "CONFIG_SFAA"
2427 if test "$sync_sync" = "yes" ; then
2428 output_sym "CONFIG_SYNC_SYNC"
2430 if test "$cmp_swap" = "yes" ; then
2431 output_sym "CONFIG_CMP_SWAP"
2433 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2434 output_sym "CONFIG_RDMA"
2436 if test "$clock_gettime" = "yes" ; then
2437 output_sym "CONFIG_CLOCK_GETTIME"
2439 if test "$clock_monotonic" = "yes" ; then
2440 output_sym "CONFIG_CLOCK_MONOTONIC"
2442 if test "$clock_monotonic_raw" = "yes" ; then
2443 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2445 if test "$clock_monotonic_precise" = "yes" ; then
2446 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2448 if test "$clockid_t" = "yes"; then
2449 output_sym "CONFIG_CLOCKID_T"
2451 if test "$gettimeofday" = "yes" ; then
2452 output_sym "CONFIG_GETTIMEOFDAY"
2454 if test "$posix_fadvise" = "yes" ; then
2455 output_sym "CONFIG_POSIX_FADVISE"
2457 if test "$linux_3arg_affinity" = "yes" ; then
2458 output_sym "CONFIG_3ARG_AFFINITY"
2459 elif test "$linux_2arg_affinity" = "yes" ; then
2460 output_sym "CONFIG_2ARG_AFFINITY"
2462 if test "$strsep" = "yes" ; then
2463 output_sym "CONFIG_STRSEP"
2465 if test "$strcasestr" = "yes" ; then
2466 output_sym "CONFIG_STRCASESTR"
2468 if test "$strlcat" = "yes" ; then
2469 output_sym "CONFIG_STRLCAT"
2471 if test "$getopt_long_only" = "yes" ; then
2472 output_sym "CONFIG_GETOPT_LONG_ONLY"
2474 if test "$inet_aton" = "yes" ; then
2475 output_sym "CONFIG_INET_ATON"
2477 if test "$socklen_t" = "yes" ; then
2478 output_sym "CONFIG_SOCKLEN_T"
2480 if test "$ext4_me" = "yes" ; then
2481 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2483 if test "$linux_splice" = "yes" ; then
2484 output_sym "CONFIG_LINUX_SPLICE"
2486 if test "$guasi" = "yes" ; then
2487 output_sym "CONFIG_GUASI"
2489 if test "$libnuma_v2" = "yes" ; then
2490 output_sym "CONFIG_LIBNUMA"
2492 if test "$solaris_aio" = "yes" ; then
2493 output_sym "CONFIG_SOLARISAIO"
2495 if test "$tls_thread" = "yes" ; then
2496 output_sym "CONFIG_TLS_THREAD"
2498 if test "$rusage_thread" = "yes" ; then
2499 output_sym "CONFIG_RUSAGE_THREAD"
2501 if test "$gfio" = "yes" ; then
2502 output_sym "CONFIG_GFIO"
2504 if test "$esx" = "yes" ; then
2505 output_sym "CONFIG_ESX"
2506 output_sym "CONFIG_NO_SHM"
2508 if test "$sched_idle" = "yes" ; then
2509 output_sym "CONFIG_SCHED_IDLE"
2511 if test "$tcp_nodelay" = "yes" ; then
2512 output_sym "CONFIG_TCP_NODELAY"
2514 if test "$window_size" = "yes" ; then
2515 output_sym "CONFIG_NET_WINDOWSIZE"
2517 if test "$mss" = "yes" ; then
2518 output_sym "CONFIG_NET_MSS"
2520 if test "$rlimit_memlock" = "yes" ; then
2521 output_sym "CONFIG_RLIMIT_MEMLOCK"
2523 if test "$pwritev" = "yes" ; then
2524 output_sym "CONFIG_PWRITEV"
2526 if test "$pwritev2" = "yes" ; then
2527 output_sym "CONFIG_PWRITEV2"
2529 if test "$ipv6" = "yes" ; then
2530 output_sym "CONFIG_IPV6"
2532 if test "$http" = "yes" ; then
2533 output_sym "CONFIG_HTTP"
2535 if test "$rados" = "yes" ; then
2536 output_sym "CONFIG_RADOS"
2538 if test "$rbd" = "yes" ; then
2539 output_sym "CONFIG_RBD"
2541 if test "$rbd_poll" = "yes" ; then
2542 output_sym "CONFIG_RBD_POLL"
2544 if test "$rbd_inval" = "yes" ; then
2545 output_sym "CONFIG_RBD_INVAL"
2547 if test "$setvbuf" = "yes" ; then
2548 output_sym "CONFIG_SETVBUF"
2550 if test "$s390_z196_facilities" = "yes" ; then
2551 output_sym "CONFIG_S390_Z196_FACILITIES"
2552 CFLAGS="$CFLAGS -march=z9-109"
2555 if test "$gfapi" = "yes" ; then
2556 output_sym "CONFIG_GFAPI"
2558 if test "$gf_fadvise" = "yes" ; then
2559 output_sym "CONFIG_GF_FADVISE"
2561 if test "$gf_trim" = "yes" ; then
2562 output_sym "CONFIG_GF_TRIM"
2564 if test "$libhdfs" = "yes" ; then
2565 output_sym "CONFIG_LIBHDFS"
2566 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2567 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2568 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2569 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2571 if test "$mtd" = "yes" ; then
2572 output_sym "CONFIG_MTD"
2574 if test "$pmemblk" = "yes" ; then
2575 output_sym "CONFIG_PMEMBLK"
2577 if test "$devdax" = "yes" ; then
2578 output_sym "CONFIG_LINUX_DEVDAX"
2580 if test "$pmem" = "yes" ; then
2581 output_sym "CONFIG_LIBPMEM"
2583 if test "$libime" = "yes" ; then
2584 output_sym "CONFIG_IME"
2586 if test "$arith" = "yes" ; then
2587 output_sym "CONFIG_ARITHMETIC"
2588 if test "$yacc_is_bison" = "yes" ; then
2589 echo "YACC=$YACC -y" >> $config_host_mak
2591 echo "YACC=$YACC" >> $config_host_mak
2593 if test "$lex_use_o" = "yes" ; then
2594 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2597 if test "$getmntent" = "yes" ; then
2598 output_sym "CONFIG_GETMNTENT"
2600 if test "$getmntinfo" = "yes" ; then
2601 output_sym "CONFIG_GETMNTINFO"
2603 if test "$getmntinfo_statvfs" = "yes" ; then
2604 output_sym "CONFIG_GETMNTINFO_STATVFS"
2606 if test "$static_assert" = "yes" ; then
2607 output_sym "CONFIG_STATIC_ASSERT"
2609 if test "$have_bool" = "yes" ; then
2610 output_sym "CONFIG_HAVE_BOOL"
2612 if test "$strndup" = "yes" ; then
2613 output_sym "CONFIG_HAVE_STRNDUP"
2615 if test "$disable_opt" = "yes" ; then
2616 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2618 if test "$valgrind_dev" = "yes"; then
2619 output_sym "CONFIG_VALGRIND_DEV"
2621 if test "$linux_blkzoned" = "yes" ; then
2622 output_sym "CONFIG_LINUX_BLKZONED"
2624 if test "$zlib" = "no" ; then
2625 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2626 if test "$build_static" = "yes"; then
2627 echo "Note that some distros have separate packages for static libraries."
2630 if test "$march_armv8_a_crc_crypto" = "yes" ; then
2631 output_sym "ARCH_HAVE_CRC_CRYPTO"
2633 if test "$cuda" = "yes" ; then
2634 output_sym "CONFIG_CUDA"
2636 if test "$mkdir_two" = "yes" ; then
2637 output_sym "CONFIG_HAVE_MKDIR_TWO"
2639 if test "$march_set" = "no" && test "$build_native" = "yes" ; then
2640 output_sym "CONFIG_BUILD_NATIVE"
2642 if test "$cunit" = "yes" ; then
2643 output_sym "CONFIG_HAVE_CUNIT"
2645 if test "$__kernel_rwf_t" = "yes"; then
2646 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
2648 if test "$fallthrough" = "yes"; then
2649 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
2651 if test "$thp" = "yes" ; then
2652 output_sym "CONFIG_HAVE_THP"
2654 if test "$libiscsi" = "yes" ; then
2655 output_sym "CONFIG_LIBISCSI"
2656 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
2657 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
2658 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
2661 echo "LIBS+=$LIBS" >> $config_host_mak
2662 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
2663 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
2664 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
2665 echo "CC=$cc" >> $config_host_mak
2666 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
2667 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2669 if [ `dirname $0` != "." -a ! -e Makefile ]; then
2670 cat > Makefile <<EOF
2671 SRCDIR:=`dirname $0`
2672 include \$(SRCDIR)/Makefile