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 $CFLAGS"
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 -Werror-implicit-function-declaration -c -o $TMPO $TMPC
96 local_ldflags="$2 $LIBS"
97 echo "Compiling test case $3" >> config.log
98 do_cc $CFLAGS -Werror-implicit-function-declaration $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
160 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
162 --prefix=*) prefix="$optarg"
164 --cpu=*) cpu="$optarg"
166 # esx is cross compiled and cannot be detect through simple uname calls
172 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
174 --build-32bit-win) build_32bit_win="yes"
176 --target-win-ver=*) target_win_ver="$optarg"
178 --build-static) build_static="yes"
180 --enable-gfio) gfio_check="yes"
182 --disable-numa) disable_numa="yes"
184 --disable-rdma) disable_rdma="yes"
186 --disable-rados) disable_rados="yes"
188 --disable-rbd) disable_rbd="yes"
190 --disable-http) disable_http="yes"
192 --disable-gfapi) disable_gfapi="yes"
194 --enable-libhdfs) libhdfs="yes"
196 --disable-lex) disable_lex="yes"
198 --enable-lex) disable_lex="no"
200 --disable-shm) no_shm="yes"
202 --disable-optimizations) disable_opt="yes"
204 --disable-pmem) disable_pmem="yes"
206 --enable-cuda) cuda="yes"
208 --disable-native) disable_native="yes"
210 --with-ime=*) ime_path="$optarg"
212 --enable-libiscsi) libiscsi="yes"
214 --enable-libnbd) libnbd="yes"
216 --disable-tcmalloc) disable_tcmalloc="yes"
218 --enable-libaio-uring) libaio_uring="yes"
220 --dynamic-libengines) dynamic_engines="yes"
226 echo "Bad option $opt"
232 if test "$show_help" = "yes" ; then
233 echo "--prefix= Use this directory as installation prefix"
234 echo "--cpu= Specify target CPU if auto-detect fails"
235 echo "--cc= Specify compiler to use"
236 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
237 echo "--build-32bit-win Enable 32-bit build on Windows"
238 echo "--target-win-ver= Minimum version of Windows to target (XP or 7)"
239 echo "--build-static Build a static fio"
240 echo "--esx Configure build options for esx"
241 echo "--enable-gfio Enable building of gtk gfio"
242 echo "--disable-numa Disable libnuma even if found"
243 echo "--disable-rdma Disable RDMA support even if found"
244 echo "--disable-rados Disable Rados support even if found"
245 echo "--disable-rbd Disable Rados Block Device even if found"
246 echo "--disable-http Disable HTTP support even if found"
247 echo "--disable-gfapi Disable gfapi"
248 echo "--enable-libhdfs Enable hdfs support"
249 echo "--disable-lex Disable use of lex/yacc for math"
250 echo "--disable-pmem Disable pmem based engines even if found"
251 echo "--enable-lex Enable use of lex/yacc for math"
252 echo "--disable-shm Disable SHM support"
253 echo "--disable-optimizations Don't enable compiler optimizations"
254 echo "--enable-cuda Enable GPUDirect RDMA support"
255 echo "--disable-native Don't build for native host"
256 echo "--with-ime= Install path for DDN's Infinite Memory Engine"
257 echo "--enable-libiscsi Enable iscsi support"
258 echo "--enable-libnbd Enable libnbd (NBD engine) support"
259 echo "--disable-tcmalloc Disable tcmalloc support"
260 echo "--enable-libaio-uring Enable libaio emulated over io_uring"
261 echo "--dynamic-libengines Lib-based ioengines as dynamic libraries"
265 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
266 # Preferred compiler (can be overriden later after we know the platform):
268 # ${cross_prefix}gcc (if cross-prefix specified)
271 if test -z "${CC}${cross_prefix}"; then
278 cc="${CC-${cross_prefix}gcc}"
281 if check_define __ANDROID__ ; then
283 elif check_define __linux__ ; then
285 elif check_define __OpenBSD__ ; then
287 elif check_define __NetBSD__ ; then
289 elif check_define __sun__ ; then
291 CFLAGS="$CFLAGS -D_REENTRANT"
292 elif check_define _WIN32 ; then
298 echo "# Automatically generated by configure - do not modify" > $config_host_mak
299 printf "# Configured with:" >> $config_host_mak
300 printf " '%s'" "$0" "$@" >> $config_host_mak
301 echo >> $config_host_mak
302 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
304 if test "$no_shm" = "yes" ; then
305 output_sym "CONFIG_NO_SHM"
308 if test "$disable_opt" = "yes" ; then
309 output_sym "CONFIG_FIO_NO_OPT"
312 # Some host OSes need non-standard checks for which CPU to use.
313 # Note that these checks are broken for cross-compilation: if you're
314 # cross-compiling to one of these OSes then you'll need to specify
315 # the correct CPU with the --cpu option.
318 # Unless explicitly enabled, turn off lex.
319 # OpenBSD will hit syntax error when enabled.
320 if test -z "$disable_lex" ; then
327 CFLAGS="$CFLAGS -I/usr/local/include"
328 LDFLAGS="$LDFLAGS -L/usr/local/lib"
331 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
332 # we can run 64-bit userspace code.
333 # If the user didn't specify a CPU explicitly and the kernel says this is
334 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
336 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
339 # Error at compile time linking of weak/partial symbols if possible...
346 if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
347 echo "Disabling weak symbols"
348 LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
352 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
353 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
356 LIBS="-lnsl -lsocket"
359 # We still force some options, so keep this message here.
360 echo "Forcing some known good options on Windows"
361 if test -z "${CC}${cross_prefix}"; then
362 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
363 cc="i686-w64-mingw32-gcc"
365 cc="x86_64-w64-mingw32-gcc"
369 target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]')
370 if test -z "$target_win_ver"; then
371 # Default Windows API target
374 if test "$target_win_ver" = "XP"; then
375 output_sym "CONFIG_WINDOWS_XP"
376 elif test "$target_win_ver" = "7"; then
377 output_sym "CONFIG_WINDOWS_7"
378 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601"
380 fatal "Unknown target Windows version"
383 # We need this to be output_sym'd here because this is Windows specific.
384 # The regular configure path never sets this config.
385 output_sym "CONFIG_WINDOWSAIO"
386 # We now take the regular configuration path without having exit 0 here.
387 # Flags below are still necessary mostly for MinGW.
391 clock_gettime="yes" # clock_monotonic probe has dependency on this
392 clock_monotonic="yes"
397 # Now we know the target platform we can have another guess at the preferred
398 # compiler when it wasn't explictly set
399 if test -z "${CC}${cross_prefix}"; then
400 if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
406 if test -z "$cc"; then
407 echo "configure: failed to find compiler"
411 if test ! -z "$cpu" ; then
412 # command line argument
414 elif check_define __i386__ ; then
416 elif check_define __x86_64__ ; then
418 elif check_define __sparc__ ; then
419 if check_define __arch64__ ; then
424 elif check_define _ARCH_PPC ; then
425 if check_define _ARCH_PPC64 ; then
430 elif check_define __mips__ ; then
432 elif check_define __ia64__ ; then
434 elif check_define __s390__ ; then
435 if check_define __s390x__ ; then
440 elif check_define __arm__ ; then
442 elif check_define __aarch64__ ; then
444 elif check_define __hppa__ ; then
450 # Normalise host CPU name and set ARCH.
452 ia64|ppc|ppc64|s390|s390x|sparc64)
455 i386|i486|i586|i686|i86pc|BePC)
467 hppa|parisc|parisc64)
481 ##########################################
482 # check cross compile
484 if test "$cross_compile" != "yes" ; then
493 if compile_prog "" "" "cross"; then
494 $TMPE 2>/dev/null || cross_compile="yes"
496 fatal "compile test failed"
499 ##########################################
501 if test "$bigendian" != "yes" ; then
504 if test "$cross_compile" = "no" ; then
506 #include <inttypes.h>
509 volatile uint32_t i=0x01234567;
510 return (*((uint8_t*)(&i))) == 0x67;
513 if compile_prog "" "" "endian"; then
514 $TMPE && bigendian="yes"
517 # If we're cross compiling, try our best to work it out and rely on the
518 # run-time check to fail if we get it wrong.
523 #if __BYTE_ORDER != __BIG_ENDIAN
524 # error "Unknown endianness"
528 compile_prog "" "" "endian" && bigendian="yes"
529 check_define "__ARMEB__" && bigendian="yes"
530 check_define "__MIPSEB__" && bigendian="yes"
534 print_config "Operating system" "$targetos"
535 print_config "CPU" "$cpu"
536 print_config "Big endian" "$bigendian"
537 if test ! -z "$target_win_ver"; then
538 print_config "Target Windows version" "$target_win_ver"
540 print_config "Compiler" "$cc"
541 print_config "Cross compile" "$cross_compile"
544 ##########################################
545 # See if we need to build a static build
546 if test "$build_static" = "yes" ; then
547 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
548 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
552 print_config "Static build" "$build_static"
554 ##########################################
555 # check for C11 atomics support
557 #include <stdatomic.h>
565 if ! compile_prog "" "" "C11 atomics"; then
567 echo "Your compiler doesn't support C11 atomics. gcc 4.9/clang 3.6 are the"
568 echo "minimum versions with it - perhaps your compiler is too old?"
569 fatal "C11 atomics support not found"
573 ##########################################
578 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
581 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
585 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
587 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
590 fatal "Unknown wordsize"
592 print_config "Wordsize" "$wordsize"
594 ##########################################
596 if test "$zlib" != "yes" ; then
604 if (inflateInit(&stream) != Z_OK)
609 if compile_prog "" "-lz" "zlib" ; then
613 print_config "zlib" "$zlib"
615 ##########################################
617 if test "$libaio" != "yes" ; then
620 if test "$esx" != "yes" ; then
630 if test "$libaio_uring" = "yes"; then
631 if compile_prog "" "-luring" "libaio io_uring" ; then
635 feature_not_found "libaio io_uring" ""
637 elif compile_prog "" "-laio" "libaio" ; then
641 if test "$libaio" = "yes" ; then
642 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
653 io_prep_preadv2(NULL, 0, NULL, 0, 0, 0);
654 io_prep_pwritev2(NULL, 0, NULL, 0, 0, 0);
658 if compile_prog "" "" "libaio rw flags" ; then
664 print_config "Linux AIO support" "$libaio"
665 print_config "Linux AIO support rw flags" "$libaio_rw_flags"
666 print_config "Linux AIO over io_uring" "$libaio_uring"
668 ##########################################
670 if test "$posix_aio" != "yes" ; then
673 if test "$posix_aio_lrt" != "yes" ; then
685 if compile_prog "" "" "posixaio" ; then
687 elif compile_prog "" "-lrt" "posixaio -lrt"; then
692 print_config "POSIX AIO support" "$posix_aio"
693 print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
695 ##########################################
696 # posix aio fsync probe
697 if test "$posix_aio_fsync" != "yes" ; then
700 if test "$posix_aio" = "yes" ; then
707 return aio_fsync(O_SYNC, &cb);
711 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
715 print_config "POSIX AIO fsync" "$posix_aio_fsync"
717 ##########################################
718 # POSIX pshared attribute probe
719 if test "$posix_pshared" != "yes" ; then
726 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
727 # if defined(__CYGWIN__)
728 # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
729 # elif defined(__APPLE__)
730 # include <AvailabilityMacros.h>
731 # include <TargetConditionals.h>
732 # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
733 # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
737 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
742 if compile_prog "" "$LIBS" "posix_pshared" ; then
745 print_config "POSIX pshared support" "$posix_pshared"
747 ##########################################
748 # POSIX pthread_condattr_setclock() probe
749 if test "$pthread_condattr_setclock" != "yes" ; then
750 pthread_condattr_setclock="no"
756 pthread_condattr_t condattr;
757 pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
761 if compile_prog "" "$LIBS" "pthread_condattr_setclock" ; then
762 pthread_condattr_setclock=yes
763 elif compile_prog "" "$LIBS -lpthread" "pthread_condattr_setclock" ; then
764 pthread_condattr_setclock=yes
765 LIBS="$LIBS -lpthread"
767 print_config "pthread_condattr_setclock()" "$pthread_condattr_setclock"
769 ##########################################
770 # pthread_sigmask() probe
771 if test "$pthread_sigmask" != "yes" ; then
775 #include <stddef.h> /* NULL */
776 #include <signal.h> /* pthread_sigmask() */
779 return pthread_sigmask(0, NULL, NULL);
782 if compile_prog "" "$LIBS" "pthread_sigmask" ; then
784 elif compile_prog "" "$LIBS -lpthread" "pthread_sigmask" ; then
786 LIBS="$LIBS -lpthread"
788 print_config "pthread_sigmask()" "$pthread_sigmask"
790 ##########################################
792 if test "$solaris_aio" != "yes" ; then
796 #include <sys/types.h>
797 #include <sys/asynch.h>
802 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
806 if compile_prog "" "-laio" "solarisaio" ; then
810 print_config "Solaris AIO support" "$solaris_aio"
812 ##########################################
813 # __sync_fetch_and_add test
814 if test "$sfaa" != "yes" ; then
818 #include <inttypes.h>
819 static int sfaa(uint64_t *ptr)
821 return __sync_fetch_and_add(ptr, 0);
824 int main(int argc, char **argv)
831 if compile_prog "" "" "__sync_fetch_and_add()" ; then
834 print_config "__sync_fetch_and_add" "$sfaa"
836 ##########################################
837 # __sync_synchronize() test
838 if test "$sync_sync" != "yes" ; then
842 #include <inttypes.h>
844 int main(int argc, char **argv)
846 __sync_synchronize();
850 if compile_prog "" "" "__sync_synchronize()" ; then
853 print_config "__sync_synchronize" "$sync_sync"
855 ##########################################
856 # __sync_val_compare_and_swap() test
857 if test "$cmp_swap" != "yes" ; then
861 #include <inttypes.h>
863 int main(int argc, char **argv)
866 return __sync_val_compare_and_swap(&x, 1, 2);
869 if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
872 print_config "__sync_val_compare_and_swap" "$cmp_swap"
874 ##########################################
876 if test "$libverbs" != "yes" ; then
880 #include <infiniband/verbs.h>
881 int main(int argc, char **argv)
883 struct ibv_pd *pd = ibv_alloc_pd(NULL);
887 if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
890 print_config "libverbs" "$libverbs"
892 ##########################################
894 if test "$rdmacm" != "yes" ; then
899 #include <rdma/rdma_cma.h>
900 int main(int argc, char **argv)
902 rdma_destroy_qp(NULL);
906 if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
909 print_config "rdmacm" "$rdmacm"
911 ##########################################
912 # asprintf() and vasprintf() probes
913 if test "$have_asprintf" != "yes" ; then
919 int main(int argc, char **argv)
921 return asprintf(NULL, "%s", "str") == 0;
924 if compile_prog "" "" "have_asprintf"; then
927 print_config "asprintf()" "$have_asprintf"
929 if test "$have_vasprintf" != "yes" ; then
935 int main(int argc, char **argv)
938 return vasprintf(NULL, "%s", ap) == 0;
941 if compile_prog "" "" "have_vasprintf"; then
944 print_config "vasprintf()" "$have_vasprintf"
946 ##########################################
947 # Linux fallocate probe
948 if test "$linux_fallocate" != "yes" ; then
954 #include <linux/falloc.h>
955 int main(int argc, char **argv)
957 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
961 if compile_prog "" "" "linux_fallocate"; then
962 linux_fallocate="yes"
964 print_config "Linux fallocate" "$linux_fallocate"
966 ##########################################
967 # POSIX fadvise probe
968 if test "$posix_fadvise" != "yes" ; then
974 int main(int argc, char **argv)
976 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
980 if compile_prog "" "" "posix_fadvise"; then
983 print_config "POSIX fadvise" "$posix_fadvise"
985 ##########################################
986 # POSIX fallocate probe
987 if test "$posix_fallocate" != "yes" ; then
993 int main(int argc, char **argv)
995 int r = posix_fallocate(0, 0, 1024);
999 if compile_prog "" "" "posix_fallocate"; then
1000 posix_fallocate="yes"
1002 print_config "POSIX fallocate" "$posix_fallocate"
1004 ##########################################
1005 # sched_set/getaffinity 2 or 3 argument test
1006 if test "$linux_2arg_affinity" != "yes" ; then
1007 linux_2arg_affinity="no"
1009 if test "$linux_3arg_affinity" != "yes" ; then
1010 linux_3arg_affinity="no"
1014 int main(int argc, char **argv)
1017 return sched_setaffinity(0, sizeof(mask), &mask);
1020 if compile_prog "" "" "sched_setaffinity(,,)"; then
1021 linux_3arg_affinity="yes"
1025 int main(int argc, char **argv)
1028 return sched_setaffinity(0, &mask);
1031 if compile_prog "" "" "sched_setaffinity(,)"; then
1032 linux_2arg_affinity="yes"
1035 print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
1036 print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
1038 ##########################################
1039 # clock_gettime probe
1040 if test "$clock_gettime" != "yes" ; then
1046 int main(int argc, char **argv)
1048 return clock_gettime(0, NULL);
1051 if compile_prog "" "" "clock_gettime"; then
1053 elif compile_prog "" "-lrt" "clock_gettime"; then
1057 print_config "clock_gettime" "$clock_gettime"
1059 ##########################################
1060 # CLOCK_MONOTONIC probe
1061 if test "$clock_monotonic" != "yes" ; then
1062 clock_monotonic="no"
1064 if test "$clock_gettime" = "yes" ; then
1068 int main(int argc, char **argv)
1070 return clock_gettime(CLOCK_MONOTONIC, NULL);
1073 if compile_prog "" "$LIBS" "clock monotonic"; then
1074 clock_monotonic="yes"
1077 print_config "CLOCK_MONOTONIC" "$clock_monotonic"
1079 ##########################################
1080 # CLOCK_MONOTONIC_RAW probe
1081 if test "$clock_monotonic_raw" != "yes" ; then
1082 clock_monotonic_raw="no"
1084 if test "$clock_gettime" = "yes" ; then
1088 int main(int argc, char **argv)
1090 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
1093 if compile_prog "" "$LIBS" "clock monotonic"; then
1094 clock_monotonic_raw="yes"
1097 print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw"
1099 ##########################################
1100 # CLOCK_MONOTONIC_PRECISE probe
1101 if test "$clock_monotonic_precise" != "yes" ; then
1102 clock_monotonic_precise="no"
1104 if test "$clock_gettime" = "yes" ; then
1108 int main(int argc, char **argv)
1110 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
1113 if compile_prog "" "$LIBS" "clock monotonic precise"; then
1114 clock_monotonic_precise="yes"
1117 print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise"
1119 ##########################################
1121 if test "$clockid_t" != "yes" ; then
1127 int main(int argc, char **argv)
1129 volatile clockid_t cid;
1130 memset((void*)&cid, 0, sizeof(cid));
1134 if compile_prog "" "$LIBS" "clockid_t"; then
1137 print_config "clockid_t" "$clockid_t"
1139 ##########################################
1140 # gettimeofday() probe
1141 if test "$gettimeofday" != "yes" ; then
1145 #include <sys/time.h>
1147 int main(int argc, char **argv)
1150 return gettimeofday(&tv, NULL);
1153 if compile_prog "" "" "gettimeofday"; then
1156 print_config "gettimeofday" "$gettimeofday"
1158 ##########################################
1160 if test "$fdatasync" != "yes" ; then
1166 int main(int argc, char **argv)
1168 return fdatasync(0);
1171 if compile_prog "" "" "fdatasync"; then
1174 print_config "fdatasync" "$fdatasync"
1176 ##########################################
1178 if test "$pipe" != "yes" ; then
1183 int main(int argc, char **argv)
1189 if compile_prog "" "" "pipe"; then
1192 print_config "pipe()" "$pipe"
1194 ##########################################
1196 if test "$pipe2" != "yes" ; then
1201 int main(int argc, char **argv)
1204 return pipe2(fd, 0);
1207 if compile_prog "" "" "pipe2"; then
1210 print_config "pipe2()" "$pipe2"
1212 ##########################################
1214 if test "$pread" != "yes" ; then
1219 int main(int argc, char **argv)
1221 return pread(0, NULL, 0, 0);
1224 if compile_prog "" "" "pread"; then
1227 print_config "pread()" "$pread"
1229 ##########################################
1230 # sync_file_range() probe
1231 if test "$sync_file_range" != "yes" ; then
1232 sync_file_range="no"
1238 #include <linux/fs.h>
1239 int main(int argc, char **argv)
1241 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1242 SYNC_FILE_RANGE_WAIT_AFTER;
1243 return sync_file_range(0, 0, 0, flags);
1246 if compile_prog "" "" "sync_file_range"; then
1247 sync_file_range="yes"
1249 print_config "sync_file_range" "$sync_file_range"
1251 ##########################################
1252 # ext4 move extent probe
1253 if test "$ext4_me" != "yes" ; then
1258 #include <sys/ioctl.h>
1259 int main(int argc, char **argv)
1261 struct move_extent me;
1262 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1265 if compile_prog "" "" "ext4 move extent" ; then
1267 elif test $targetos = "Linux" ; then
1268 # On Linux, just default to it on and let it error at runtime if we really
1269 # don't have it. None of my updated systems have it defined, but it does
1270 # work. Takes a while to bubble back.
1273 print_config "EXT4 move extent" "$ext4_me"
1275 ##########################################
1277 if test "$linux_splice" != "yes" ; then
1283 int main(int argc, char **argv)
1285 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1288 if compile_prog "" "" "linux splice"; then
1291 print_config "Linux splice(2)" "$linux_splice"
1293 ##########################################
1295 if test "$guasi" != "yes" ; then
1300 #include <guasi_syscalls.h>
1301 int main(int argc, char **argv)
1303 guasi_t ctx = guasi_create(0, 0, 0);
1307 if compile_prog "" "" "guasi"; then
1310 print_config "GUASI" "$guasi"
1312 ##########################################
1314 if test "$libnuma" != "yes" ; then
1319 int main(int argc, char **argv)
1321 return numa_available();
1324 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1328 print_config "libnuma" "$libnuma"
1330 ##########################################
1331 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1332 if test "$libnuma" = "yes" ; then
1336 int main(int argc, char **argv)
1338 struct bitmask *mask = numa_parse_nodestring(NULL);
1339 return mask->size == 0;
1342 if compile_prog "" "" "libnuma api"; then
1345 print_config "libnuma v2" "$libnuma_v2"
1348 ##########################################
1350 if test "$strsep" != "yes" ; then
1355 int main(int argc, char **argv)
1357 static char *string = "This is a string";
1358 strsep(&string, "needle");
1362 if compile_prog "" "" "strsep"; then
1365 print_config "strsep" "$strsep"
1367 ##########################################
1368 # strcasestr() probe
1369 if test "$strcasestr" != "yes" ; then
1374 int main(int argc, char **argv)
1376 return strcasestr(argv[0], argv[1]) != NULL;
1379 if compile_prog "" "" "strcasestr"; then
1382 print_config "strcasestr" "$strcasestr"
1384 ##########################################
1386 if test "$strlcat" != "yes" ; then
1391 int main(int argc, char **argv)
1393 static char dst[64];
1394 static char *string = "This is a string";
1395 memset(dst, 0, sizeof(dst));
1396 strlcat(dst, string, sizeof(dst));
1400 if compile_prog "" "" "strlcat"; then
1403 print_config "strlcat" "$strlcat"
1405 ##########################################
1406 # getopt_long_only() probe
1407 if test "$getopt_long_only" != "yes" ; then
1408 getopt_long_only="no"
1414 int main(int argc, char **argv)
1416 int c = getopt_long_only(argc, argv, "", NULL, NULL);
1420 if compile_prog "" "" "getopt_long_only"; then
1421 getopt_long_only="yes"
1423 print_config "getopt_long_only()" "$getopt_long_only"
1425 ##########################################
1427 if test "$inet_aton" != "yes" ; then
1432 #include <winsock2.h>
1434 #include <sys/socket.h>
1435 #include <arpa/inet.h>
1438 int main(int argc, char **argv)
1441 return inet_aton(NULL, &in);
1444 if compile_prog "" "" "inet_aton"; then
1447 print_config "inet_aton" "$inet_aton"
1449 ##########################################
1451 if test "$socklen_t" != "yes" ; then
1456 #include <winsock2.h>
1457 #include <ws2tcpip.h>
1459 #include <sys/socket.h>
1461 int main(int argc, char **argv)
1467 if compile_prog "" "" "socklen_t"; then
1470 print_config "socklen_t" "$socklen_t"
1472 ##########################################
1473 # Whether or not __thread is supported for TLS
1474 if test "$tls_thread" != "yes" ; then
1479 static __thread int ret;
1480 int main(int argc, char **argv)
1485 if compile_prog "" "" "__thread"; then
1488 print_config "__thread" "$tls_thread"
1490 ##########################################
1491 # Check if we have required gtk/glib support for gfio
1492 if test "$gfio" != "yes" ; then
1495 if test "$gfio_check" = "yes" ; then
1499 #include <gtk/gtk.h>
1502 gdk_threads_enter();
1503 gdk_threads_leave();
1505 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1508 GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0)
1509 ORG_LDFLAGS=$LDFLAGS
1510 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1511 if test "$?" != "0" ; then
1512 echo "configure: gtk and gthread not found"
1515 GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
1516 if test "$?" != "0" ; then
1517 echo "configure: gtk and gthread not found"
1520 if ! ${cross_prefix}pkg-config --atleast-version 2.18.0 gtk+-2.0; then
1521 echo "GTK found, but need version 2.18 or higher"
1524 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1526 GFIO_LIBS="$LIBS $GTK_LIBS"
1527 CFLAGS="$CFLAGS $GTK_CFLAGS"
1529 echo "Please install gtk and gdk libraries"
1533 LDFLAGS=$ORG_LDFLAGS
1536 if test "$gfio_check" = "yes" ; then
1537 print_config "gtk 2.18 or higher" "$gfio"
1540 ##########################################
1541 # Check whether we have getrusage(RUSAGE_THREAD)
1542 if test "$rusage_thread" != "yes" ; then
1546 #include <sys/time.h>
1547 #include <sys/resource.h>
1548 int main(int argc, char **argv)
1551 getrusage(RUSAGE_THREAD, &ru);
1555 if compile_prog "" "" "RUSAGE_THREAD"; then
1558 print_config "RUSAGE_THREAD" "$rusage_thread"
1560 ##########################################
1561 # Check whether we have SCHED_IDLE
1562 if test "$sched_idle" != "yes" ; then
1567 int main(int argc, char **argv)
1569 struct sched_param p;
1570 return sched_setscheduler(0, SCHED_IDLE, &p);
1573 if compile_prog "" "" "SCHED_IDLE"; then
1576 print_config "SCHED_IDLE" "$sched_idle"
1578 ##########################################
1579 # Check whether we have TCP_NODELAY
1580 if test "$tcp_nodelay" != "yes" ; then
1585 #include <winsock2.h>
1588 #include <sys/types.h>
1589 #include <sys/socket.h>
1590 #include <netinet/tcp.h>
1592 int main(int argc, char **argv)
1594 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1597 if compile_prog "" "" "TCP_NODELAY"; then
1599 elif compile_prog "" "-lws2_32" "TCP_NODELAY"; then
1601 LIBS="$LIBS -lws2_32"
1603 print_config "TCP_NODELAY" "$tcp_nodelay"
1605 ##########################################
1606 # Check whether we have SO_SNDBUF
1607 if test "$window_size" != "yes" ; then
1612 #include <winsock2.h>
1615 #include <sys/types.h>
1616 #include <sys/socket.h>
1617 #include <netinet/tcp.h>
1619 int main(int argc, char **argv)
1621 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1622 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1625 if compile_prog "" "" "SO_SNDBUF"; then
1627 elif compile_prog "" "-lws2_32" "SO_SNDBUF"; then
1629 LIBS="$LIBS -lws2_32"
1631 print_config "Net engine window_size" "$window_size"
1633 ##########################################
1634 # Check whether we have TCP_MAXSEG
1635 if test "$mss" != "yes" ; then
1640 #include <winsock2.h>
1643 #include <sys/types.h>
1644 #include <sys/socket.h>
1645 #include <netinet/tcp.h>
1646 #include <arpa/inet.h>
1647 #include <netinet/in.h>
1649 int main(int argc, char **argv)
1651 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1654 if compile_prog "" "" "TCP_MAXSEG"; then
1656 elif compile_prog "" "-lws2_32" "TCP_MAXSEG"; then
1658 LIBS="$LIBS -lws2_32"
1660 print_config "TCP_MAXSEG" "$mss"
1662 ##########################################
1663 # Check whether we have RLIMIT_MEMLOCK
1664 if test "$rlimit_memlock" != "yes" ; then
1668 #include <sys/time.h>
1669 #include <sys/resource.h>
1670 int main(int argc, char **argv)
1673 return getrlimit(RLIMIT_MEMLOCK, &rl);
1676 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1677 rlimit_memlock="yes"
1679 print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1681 ##########################################
1682 # Check whether we have pwritev/preadv
1683 if test "$pwritev" != "yes" ; then
1688 #include <sys/uio.h>
1689 int main(int argc, char **argv)
1691 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1694 if compile_prog "" "" "pwritev"; then
1697 print_config "pwritev/preadv" "$pwritev"
1699 ##########################################
1700 # Check whether we have pwritev2/preadv2
1701 if test "$pwritev2" != "yes" ; then
1706 #include <sys/uio.h>
1707 int main(int argc, char **argv)
1709 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1712 if compile_prog "" "" "pwritev2"; then
1715 print_config "pwritev2/preadv2" "$pwritev2"
1717 ##########################################
1718 # Check whether we have the required functions for ipv6
1719 if test "$ipv6" != "yes" ; then
1724 #include <winsock2.h>
1725 #include <ws2tcpip.h>
1727 #include <sys/types.h>
1728 #include <sys/socket.h>
1729 #include <netinet/in.h>
1733 int main(int argc, char **argv)
1735 struct addrinfo hints;
1736 struct in6_addr addr;
1739 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1741 printf("%s\n", gai_strerror(ret));
1746 if compile_prog "" "" "ipv6"; then
1749 print_config "IPv6 helpers" "$ipv6"
1751 ##########################################
1753 if test "$http" != "yes" ; then
1756 # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
1758 #include <curl/curl.h>
1759 #include <openssl/hmac.h>
1761 int main(int argc, char **argv)
1766 curl = curl_easy_init();
1767 curl_easy_cleanup(curl);
1769 ctx = HMAC_CTX_new();
1770 HMAC_CTX_reset(ctx);
1775 # openssl < 1.1.0 uses the HMAC_CTX type directly
1777 #include <curl/curl.h>
1778 #include <openssl/hmac.h>
1780 int main(int argc, char **argv)
1785 curl = curl_easy_init();
1786 curl_easy_cleanup(curl);
1788 HMAC_CTX_init(&ctx);
1789 HMAC_CTX_cleanup(&ctx);
1793 if test "$disable_http" != "yes"; then
1794 HTTP_LIBS="-lcurl -lssl -lcrypto"
1795 if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then
1796 output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
1798 elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
1802 print_config "http engine" "$http"
1804 ##########################################
1806 if test "$rados" != "yes" ; then
1810 #include <rados/librados.h>
1812 int main(int argc, char **argv)
1815 rados_ioctx_t io_ctx;
1816 const char cluster_name[] = "ceph";
1817 const char user_name[] = "client.admin";
1818 const char pool[] = "rados";
1820 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1821 rados_create2(&cluster, cluster_name, user_name, 0);
1822 rados_ioctx_create(cluster, pool, &io_ctx);
1827 if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
1830 print_config "Rados engine" "$rados"
1832 ##########################################
1834 if test "$rbd" != "yes" ; then
1838 #include <rbd/librbd.h>
1840 int main(int argc, char **argv)
1843 rados_ioctx_t io_ctx;
1844 const char cluster_name[] = "ceph";
1845 const char user_name[] = "client.admin";
1846 const char pool[] = "rbd";
1847 int major, minor, extra;
1849 rbd_version(&major, &minor, &extra);
1850 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1851 rados_create2(&cluster, cluster_name, user_name, 0);
1852 rados_ioctx_create(cluster, pool, &io_ctx);
1857 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1860 print_config "Rados Block Device engine" "$rbd"
1862 ##########################################
1863 # check for rbd_poll
1864 if test "$rbd_poll" != "yes" ; then
1867 if test "$rbd" = "yes"; then
1869 #include <rbd/librbd.h>
1870 #include <sys/eventfd.h>
1872 int main(int argc, char **argv)
1875 rbd_completion_t comp;
1877 int fd = eventfd(0, EFD_NONBLOCK);
1878 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1879 rbd_poll_io_events(image, comp, 1);
1884 if compile_prog "" "-lrbd -lrados" "rbd"; then
1887 print_config "rbd_poll" "$rbd_poll"
1890 ##########################################
1891 # check for rbd_invalidate_cache()
1892 if test "$rbd_inval" != "yes" ; then
1895 if test "$rbd" = "yes"; then
1897 #include <rbd/librbd.h>
1899 int main(int argc, char **argv)
1903 return rbd_invalidate_cache(image);
1906 if compile_prog "" "-lrbd -lrados" "rbd"; then
1909 print_config "rbd_invalidate_cache" "$rbd_inval"
1912 ##########################################
1913 # Check whether we have setvbuf
1914 if test "$setvbuf" != "yes" ; then
1919 int main(int argc, char **argv)
1923 setvbuf(f, buf, _IOFBF, sizeof(buf));
1927 if compile_prog "" "" "setvbuf"; then
1930 print_config "setvbuf" "$setvbuf"
1932 ##########################################
1934 if test "$gfapi" != "yes" ; then
1938 #include <glusterfs/api/glfs.h>
1940 int main(int argc, char **argv)
1942 glfs_t *g = glfs_new("foo");
1947 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1950 print_config "Gluster API engine" "$gfapi"
1952 ##########################################
1953 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1954 if test "$gfapi" = "yes" ; then
1957 #include <glusterfs/api/glfs.h>
1959 int main(int argc, char **argv)
1962 int ret = glfs_fadvise(fd, 0, 0, 1);
1967 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1970 print_config "Gluster API use fadvise" "$gf_fadvise"
1973 ##########################################
1974 # check for newer gfapi
1975 if test "$gfapi" = "yes" ; then
1978 #include <glusterfs/api/glfs.h>
1980 int main(int argc, char **argv)
1982 return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL);
1985 if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then
1988 print_config "Gluster new API" "$gf_new"
1991 ##########################################
1992 # check for gfapi trim support
1993 if test "$gf_trim" != "yes" ; then
1996 if test "$gfapi" = "yes" ; then
1998 #include <glusterfs/api/glfs.h>
2000 int main(int argc, char **argv)
2002 return glfs_discard_async(NULL, 0, 0);
2005 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
2008 print_config "Gluster API trim support" "$gf_trim"
2011 ##########################################
2012 # Check if we support stckf on s390
2013 if test "$s390_z196_facilities" != "yes" ; then
2014 s390_z196_facilities="no"
2017 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
2018 int main(int argc, char **argv)
2020 /* We want just 1 double word to be returned. */
2021 register unsigned long reg0 asm("0") = 0;
2022 unsigned long stfle_bits;
2023 asm volatile(".machine push" "\n\t"
2024 ".machine \"z9-109\"" "\n\t"
2027 : "=QS" (stfle_bits), "+d" (reg0)
2030 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
2036 if compile_prog "" "" "s390_z196_facilities"; then
2038 if [ $? -eq 0 ]; then
2039 s390_z196_facilities="yes"
2042 print_config "s390_z196_facilities" "$s390_z196_facilities"
2044 ##########################################
2045 # Check if we have required environment variables configured for libhdfs
2046 if test "$libhdfs" = "yes" ; then
2048 if test "$JAVA_HOME" = "" ; then
2049 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
2052 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
2053 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
2056 if test "$FIO_LIBHDFS_LIB" = "" ; then
2057 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
2060 if test "$hdfs_conf_error" = "1" ; then
2061 feature_not_found "libhdfs" ""
2064 if test "$FIO_HDFS_CPU" = "x86_64" ; then
2065 FIO_HDFS_CPU="amd64"
2068 print_config "HDFS engine" "$libhdfs"
2070 ##########################################
2071 # Check whether we have MTD
2072 if test "$mtd" != "yes" ; then
2077 #include <mtd/mtd-user.h>
2078 #include <sys/ioctl.h>
2079 int main(int argc, char **argv)
2081 struct mtd_write_req ops;
2082 struct mtd_info_user info;
2083 memset(&ops, 0, sizeof(ops));
2084 info.type = MTD_MLCNANDFLASH;
2085 return ioctl(0, MEMGETINFO, &info);
2088 if compile_prog "" "" "mtd"; then
2091 print_config "MTD" "$mtd"
2093 ##########################################
2094 # Check whether we have libpmem
2095 if test "$libpmem" != "yes" ; then
2099 #include <libpmem.h>
2100 int main(int argc, char **argv)
2103 rc = pmem_is_pmem(0, 0);
2107 if compile_prog "" "-lpmem" "libpmem"; then
2110 print_config "libpmem" "$libpmem"
2112 ##########################################
2113 # Check whether we have libpmemblk
2114 # libpmem is a prerequisite
2115 if test "$libpmemblk" != "yes" ; then
2118 if test "$libpmem" = "yes"; then
2120 #include <libpmemblk.h>
2121 int main(int argc, char **argv)
2124 pbp = pmemblk_open("", 0);
2128 if compile_prog "" "-lpmemblk" "libpmemblk"; then
2132 print_config "libpmemblk" "$libpmemblk"
2134 # Choose the ioengines
2135 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
2138 if test "$libpmemblk" = "yes"; then
2143 ##########################################
2144 # Report whether pmemblk engine is enabled
2145 print_config "PMDK pmemblk engine" "$pmemblk"
2147 ##########################################
2148 # Report whether dev-dax engine is enabled
2149 print_config "PMDK dev-dax engine" "$devdax"
2151 ##########################################
2152 # Report whether libpmem engine is enabled
2153 print_config "PMDK libpmem engine" "$pmem"
2155 ##########################################
2156 # Check whether we support DDN's IME
2157 if test "$libime" != "yes" ; then
2161 #include <ime_native.h>
2162 int main(int argc, char **argv)
2166 rc = ime_native_finalize();
2170 if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then
2172 CFLAGS="-I${ime_path}/include $CFLAGS"
2173 LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS"
2174 LIBS="-lim_client $LIBS"
2176 print_config "DDN's Infinite Memory Engine" "$libime"
2178 ##########################################
2179 # Check if we have libiscsi
2180 if test "$libiscsi" != "no" ; then
2181 minimum_libiscsi=1.9.0
2182 if $(pkg-config --atleast-version=$minimum_libiscsi libiscsi); then
2184 libiscsi_cflags=$(pkg-config --cflags libiscsi)
2185 libiscsi_libs=$(pkg-config --libs libiscsi)
2187 if test "$libiscsi" = "yes" ; then
2188 feature_not_found "libiscsi" "libiscsi >= $minimum_libiscsi"
2193 print_config "iscsi engine" "$libiscsi"
2195 ##########################################
2196 # Check if we have libnbd (for NBD support)
2197 if test "$libnbd" != "no" ; then
2198 minimum_libnbd=0.9.8
2199 if $(pkg-config --atleast-version=$minimum_libnbd libnbd); then
2201 libnbd_cflags=$(pkg-config --cflags libnbd)
2202 libnbd_libs=$(pkg-config --libs libnbd)
2204 if test "$libnbd" = "yes" ; then
2205 feature_not_found "libnbd" "libnbd >= $minimum_libnbd"
2210 print_config "NBD engine" "$libnbd"
2212 ##########################################
2213 # Check if we have lex/yacc available
2218 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
2219 if test "$targetos" != "SunOS" ; then
2220 LEX=$(which lex 2> /dev/null)
2221 if test -x "$LEX" ; then
2224 YACC=$(which bison 2> /dev/null)
2225 if test -x "$YACC" ; then
2229 YACC=$(which yacc 2> /dev/null)
2230 if test -x "$YACC" ; then
2234 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2238 if test "$arith" = "yes" ; then
2240 extern int yywrap(void);
2242 int main(int argc, char **argv)
2248 if compile_prog "" "-ll" "lex"; then
2257 # Check if lex fails using -o
2258 if test "$arith" = "yes" ; then
2259 if test "$force_no_lex_o" = "yes" ; then
2262 $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
2263 if test "$?" = "0" ; then
2271 print_config "lex/yacc for arithmetic" "$arith"
2273 ##########################################
2274 # Check whether we have setmntent/getmntent
2275 if test "$getmntent" != "yes" ; then
2281 int main(int argc, char **argv)
2283 FILE *mtab = setmntent(NULL, "r");
2284 struct mntent *mnt = getmntent(mtab);
2289 if compile_prog "" "" "getmntent"; then
2292 print_config "getmntent" "$getmntent"
2294 ##########################################
2295 # Check whether we have getmntinfo
2296 # These are originally added for BSDs, but may also work
2297 # on other operating systems with getmntinfo(3).
2299 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
2300 # Note that NetBSD needs -Werror to catch warning as error.
2301 if test "$getmntinfo" != "yes" ; then
2306 #include <sys/param.h>
2307 #include <sys/mount.h>
2308 int main(int argc, char **argv)
2311 return getmntinfo(&st, MNT_NOWAIT);
2314 if compile_prog "-Werror" "" "getmntinfo"; then
2317 print_config "getmntinfo" "$getmntinfo"
2319 # getmntinfo(3) for NetBSD.
2320 if test "$getmntinfo_statvfs" != "yes" ; then
2321 getmntinfo_statvfs="no"
2325 #include <sys/statvfs.h>
2326 int main(int argc, char **argv)
2329 return getmntinfo(&st, MNT_NOWAIT);
2332 # Skip the test if the one with statfs arg is detected.
2333 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2334 getmntinfo_statvfs="yes"
2335 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
2338 ##########################################
2339 # Check whether we have _Static_assert
2340 if test "$static_assert" != "yes" ; then
2352 int main(int argc, char **argv)
2354 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2358 if compile_prog "" "" "static_assert"; then
2361 print_config "Static Assert" "$static_assert"
2363 ##########################################
2364 # Check whether we have bool / stdbool.h
2365 if test "$have_bool" != "yes" ; then
2369 #include <stdbool.h>
2370 int main(int argc, char **argv)
2373 return var != false;
2376 if compile_prog "" "" "bool"; then
2379 print_config "bool" "$have_bool"
2381 ##########################################
2382 # Check whether we have strndup()
2387 int main(int argc, char **argv)
2389 char *res = strndup("test string", 8);
2395 if compile_prog "" "" "strndup"; then
2398 print_config "strndup" "$strndup"
2400 ##########################################
2401 # <valgrind/drd.h> probe
2402 # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is
2403 # also available but not the other way around.
2404 if test "$valgrind_dev" != "yes" ; then
2408 #include <valgrind/drd.h>
2409 int main(int argc, char **argv)
2414 if compile_prog "" "" "valgrind_dev"; then
2417 print_config "Valgrind headers" "$valgrind_dev"
2419 if test "$targetos" = "Linux" ; then
2420 ##########################################
2421 # <linux/blkzoned.h> probe
2422 if test "$linux_blkzoned" != "yes" ; then
2426 #include <linux/blkzoned.h>
2427 int main(int argc, char **argv)
2432 if compile_prog "" "" "linux_blkzoned"; then
2433 linux_blkzoned="yes"
2435 print_config "Zoned block device support" "$linux_blkzoned"
2437 ##########################################
2438 # Check BLK_ZONE_REP_CAPACITY
2440 #include <linux/blkzoned.h>
2443 return BLK_ZONE_REP_CAPACITY;
2446 if compile_prog "" "" "blkzoned report capacity"; then
2447 output_sym "CONFIG_HAVE_REP_CAPACITY"
2452 print_config "Zoned block device capacity" "$rep_capacity"
2455 ##########################################
2457 if test "$libzbc" != "yes" ; then
2461 #include <libzbc/zbc.h>
2462 int main(int argc, char **argv)
2464 struct zbc_device *dev = NULL;
2466 return zbc_open("foo=bar", O_RDONLY, &dev);
2469 if compile_prog "" "-lzbc" "libzbc"; then
2470 libzbcvermaj=$(pkg-config --modversion libzbc | sed 's/\.[0-9]*\.[0-9]*//')
2471 if test "$libzbcvermaj" -ge "5" ; then
2474 print_config "libzbc engine" "Unsupported libzbc version (version 5 or above required)"
2478 if test "$libzbc" = "yes" ; then
2479 feature_not_found "libzbc" "libzbc or libzbc/zbc.h"
2483 print_config "libzbc engine" "$libzbc"
2485 ##########################################
2486 # check march=armv8-a+crc+crypto
2487 if test "$march_armv8_a_crc_crypto" != "yes" ; then
2488 march_armv8_a_crc_crypto="no"
2490 if test "$cpu" = "arm64" ; then
2492 #include <arm_acle.h>
2493 #include <arm_neon.h>
2494 #include <sys/auxv.h>
2498 /* Can we also do a runtime probe? */
2500 return getauxval(AT_HWCAP);
2502 # error "Don't know how to do runtime probe for ARM CRC32c"
2506 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
2507 march_armv8_a_crc_crypto="yes"
2508 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
2512 print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2514 ##########################################
2516 if test "$cuda" != "no" ; then
2519 int main(int argc, char **argv)
2524 if compile_prog "" "-lcuda" "cuda"; then
2528 if test "$cuda" = "yes" ; then
2529 feature_not_found "cuda" ""
2534 print_config "cuda" "$cuda"
2536 ##########################################
2537 # check for cc -march=native
2540 int main(int argc, char **argv)
2545 if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2546 compile_prog "-march=native" "" "march=native"; then
2549 print_config "Build march=native" "$build_native"
2551 ##########################################
2553 if test "$cunit" != "yes" ; then
2557 #include <CUnit/CUnit.h>
2558 #include <CUnit/Basic.h>
2561 if (CU_initialize_registry() != CUE_SUCCESS)
2562 return CU_get_error();
2563 CU_basic_set_mode(CU_BRM_VERBOSE);
2564 CU_basic_run_tests();
2565 CU_cleanup_registry();
2566 return CU_get_error();
2569 if compile_prog "" "-lcunit" "CUnit"; then
2572 print_config "CUnit" "$cunit"
2574 ##########################################
2575 # check for __kernel_rwf_t
2578 #include <linux/fs.h>
2579 int main(int argc, char **argv)
2586 if compile_prog "" "" "__kernel_rwf_t"; then
2587 __kernel_rwf_t="yes"
2589 print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2591 ##########################################
2592 # check if gcc has -Wimplicit-fallthrough=2
2595 int main(int argc, char **argv)
2600 if compile_prog "-Wimplicit-fallthrough=2" "" "-Wimplicit-fallthrough=2"; then
2603 print_config "-Wimplicit-fallthrough=2" "$fallthrough"
2605 ##########################################
2606 # check for MADV_HUGEPAGE support
2607 if test "$thp" != "yes" ; then
2610 if test "$esx" != "yes" ; then
2612 #include <sys/mman.h>
2615 return madvise(0, 0x1000, MADV_HUGEPAGE);
2618 if compile_prog "" "" "thp" ; then
2621 if test "$thp" = "yes" ; then
2622 feature_not_found "Transparent Huge Page" ""
2627 print_config "MADV_HUGEPAGE" "$thp"
2629 ##########################################
2630 # check for gettid()
2634 int main(int argc, char **argv)
2639 if compile_prog "" "" "gettid"; then
2642 print_config "gettid" "$gettid"
2644 ##########################################
2645 # check for statx(2) support by libc
2649 #include <sys/stat.h>
2651 int main(int argc, char **argv)
2654 return statx(-1, *argv, 0, 0, &st);
2657 if compile_prog "" "" "statx"; then
2660 print_config "statx(2)/libc" "$statx"
2662 ##########################################
2663 # check for statx(2) support by kernel
2667 #include <linux/stat.h>
2668 #include <sys/stat.h>
2669 #include <sys/syscall.h>
2671 static int _statx(int dfd, const char *pathname, int flags, unsigned int mask,
2672 struct statx *buffer)
2674 return syscall(__NR_statx, dfd, pathname, flags, mask, buffer);
2677 int main(int argc, char **argv)
2680 return _statx(-1, *argv, 0, 0, &st);
2683 if compile_prog "" "" "statx_syscall"; then
2686 print_config "statx(2)/syscall" "$statx_syscall"
2688 #############################################################################
2690 if test "$wordsize" = "64" ; then
2691 output_sym "CONFIG_64BIT"
2692 elif test "$wordsize" = "32" ; then
2693 output_sym "CONFIG_32BIT"
2695 fatal "Unknown wordsize!"
2697 if test "$bigendian" = "yes" ; then
2698 output_sym "CONFIG_BIG_ENDIAN"
2700 output_sym "CONFIG_LITTLE_ENDIAN"
2702 if test "$zlib" = "yes" ; then
2703 output_sym "CONFIG_ZLIB"
2705 if test "$libaio" = "yes" ; then
2706 output_sym "CONFIG_LIBAIO"
2707 if test "$libaio_rw_flags" = "yes" ; then
2708 output_sym "CONFIG_LIBAIO_RW_FLAGS"
2710 if test "$libaio_uring" = "yes" ; then
2711 output_sym "CONFIG_LIBAIO_URING"
2714 if test "$posix_aio" = "yes" ; then
2715 output_sym "CONFIG_POSIXAIO"
2717 if test "$posix_aio_fsync" = "yes" ; then
2718 output_sym "CONFIG_POSIXAIO_FSYNC"
2720 if test "$posix_pshared" = "yes" ; then
2721 output_sym "CONFIG_PSHARED"
2723 if test "$pthread_condattr_setclock" = "yes" ; then
2724 output_sym "CONFIG_PTHREAD_CONDATTR_SETCLOCK"
2726 if test "$pthread_sigmask" = "yes" ; then
2727 output_sym "CONFIG_PTHREAD_SIGMASK"
2729 if test "$have_asprintf" = "yes" ; then
2730 output_sym "CONFIG_HAVE_ASPRINTF"
2732 if test "$have_vasprintf" = "yes" ; then
2733 output_sym "CONFIG_HAVE_VASPRINTF"
2735 if test "$linux_fallocate" = "yes" ; then
2736 output_sym "CONFIG_LINUX_FALLOCATE"
2738 if test "$posix_fallocate" = "yes" ; then
2739 output_sym "CONFIG_POSIX_FALLOCATE"
2741 if test "$fdatasync" = "yes" ; then
2742 output_sym "CONFIG_FDATASYNC"
2744 if test "$pipe" = "yes" ; then
2745 output_sym "CONFIG_PIPE"
2747 if test "$pipe2" = "yes" ; then
2748 output_sym "CONFIG_PIPE2"
2750 if test "$pread" = "yes" ; then
2751 output_sym "CONFIG_PREAD"
2753 if test "$sync_file_range" = "yes" ; then
2754 output_sym "CONFIG_SYNC_FILE_RANGE"
2756 if test "$sfaa" = "yes" ; then
2757 output_sym "CONFIG_SFAA"
2759 if test "$sync_sync" = "yes" ; then
2760 output_sym "CONFIG_SYNC_SYNC"
2762 if test "$cmp_swap" = "yes" ; then
2763 output_sym "CONFIG_CMP_SWAP"
2765 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2766 output_sym "CONFIG_RDMA"
2768 if test "$clock_gettime" = "yes" ; then
2769 output_sym "CONFIG_CLOCK_GETTIME"
2771 if test "$clock_monotonic" = "yes" ; then
2772 output_sym "CONFIG_CLOCK_MONOTONIC"
2774 if test "$clock_monotonic_raw" = "yes" ; then
2775 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2777 if test "$clock_monotonic_precise" = "yes" ; then
2778 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2780 if test "$clockid_t" = "yes"; then
2781 output_sym "CONFIG_CLOCKID_T"
2783 if test "$gettimeofday" = "yes" ; then
2784 output_sym "CONFIG_GETTIMEOFDAY"
2786 if test "$posix_fadvise" = "yes" ; then
2787 output_sym "CONFIG_POSIX_FADVISE"
2789 if test "$linux_3arg_affinity" = "yes" ; then
2790 output_sym "CONFIG_3ARG_AFFINITY"
2791 elif test "$linux_2arg_affinity" = "yes" ; then
2792 output_sym "CONFIG_2ARG_AFFINITY"
2794 if test "$strsep" = "yes" ; then
2795 output_sym "CONFIG_STRSEP"
2797 if test "$strcasestr" = "yes" ; then
2798 output_sym "CONFIG_STRCASESTR"
2800 if test "$strlcat" = "yes" ; then
2801 output_sym "CONFIG_STRLCAT"
2803 if test "$getopt_long_only" = "yes" ; then
2804 output_sym "CONFIG_GETOPT_LONG_ONLY"
2806 if test "$inet_aton" = "yes" ; then
2807 output_sym "CONFIG_INET_ATON"
2809 if test "$socklen_t" = "yes" ; then
2810 output_sym "CONFIG_SOCKLEN_T"
2812 if test "$ext4_me" = "yes" ; then
2813 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2815 if test "$linux_splice" = "yes" ; then
2816 output_sym "CONFIG_LINUX_SPLICE"
2818 if test "$guasi" = "yes" ; then
2819 output_sym "CONFIG_GUASI"
2821 if test "$libnuma_v2" = "yes" ; then
2822 output_sym "CONFIG_LIBNUMA"
2824 if test "$solaris_aio" = "yes" ; then
2825 output_sym "CONFIG_SOLARISAIO"
2827 if test "$tls_thread" = "yes" ; then
2828 output_sym "CONFIG_TLS_THREAD"
2830 if test "$rusage_thread" = "yes" ; then
2831 output_sym "CONFIG_RUSAGE_THREAD"
2833 if test "$gfio" = "yes" ; then
2834 output_sym "CONFIG_GFIO"
2836 if test "$esx" = "yes" ; then
2837 output_sym "CONFIG_ESX"
2838 output_sym "CONFIG_NO_SHM"
2840 if test "$sched_idle" = "yes" ; then
2841 output_sym "CONFIG_SCHED_IDLE"
2843 if test "$tcp_nodelay" = "yes" ; then
2844 output_sym "CONFIG_TCP_NODELAY"
2846 if test "$window_size" = "yes" ; then
2847 output_sym "CONFIG_NET_WINDOWSIZE"
2849 if test "$mss" = "yes" ; then
2850 output_sym "CONFIG_NET_MSS"
2852 if test "$rlimit_memlock" = "yes" ; then
2853 output_sym "CONFIG_RLIMIT_MEMLOCK"
2855 if test "$pwritev" = "yes" ; then
2856 output_sym "CONFIG_PWRITEV"
2858 if test "$pwritev2" = "yes" ; then
2859 output_sym "CONFIG_PWRITEV2"
2861 if test "$ipv6" = "yes" ; then
2862 output_sym "CONFIG_IPV6"
2864 if test "$http" = "yes" ; then
2865 output_sym "CONFIG_HTTP"
2867 if test "$rados" = "yes" ; then
2868 output_sym "CONFIG_RADOS"
2870 if test "$rbd" = "yes" ; then
2871 output_sym "CONFIG_RBD"
2873 if test "$rbd_poll" = "yes" ; then
2874 output_sym "CONFIG_RBD_POLL"
2876 if test "$rbd_inval" = "yes" ; then
2877 output_sym "CONFIG_RBD_INVAL"
2879 if test "$setvbuf" = "yes" ; then
2880 output_sym "CONFIG_SETVBUF"
2882 if test "$s390_z196_facilities" = "yes" ; then
2883 output_sym "CONFIG_S390_Z196_FACILITIES"
2884 CFLAGS="$CFLAGS -march=z9-109"
2887 if test "$gfapi" = "yes" ; then
2888 output_sym "CONFIG_GFAPI"
2890 if test "$gf_fadvise" = "yes" ; then
2891 output_sym "CONFIG_GF_FADVISE"
2893 if test "$gf_trim" = "yes" ; then
2894 output_sym "CONFIG_GF_TRIM"
2896 if test "$gf_new" = "yes" ; then
2897 output_sym "CONFIG_GF_NEW_API"
2899 if test "$libhdfs" = "yes" ; then
2900 output_sym "CONFIG_LIBHDFS"
2901 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2902 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2903 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2904 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2906 if test "$mtd" = "yes" ; then
2907 output_sym "CONFIG_MTD"
2909 if test "$pmemblk" = "yes" ; then
2910 output_sym "CONFIG_PMEMBLK"
2912 if test "$devdax" = "yes" ; then
2913 output_sym "CONFIG_LINUX_DEVDAX"
2915 if test "$pmem" = "yes" ; then
2916 output_sym "CONFIG_LIBPMEM"
2918 if test "$libime" = "yes" ; then
2919 output_sym "CONFIG_IME"
2921 if test "$arith" = "yes" ; then
2922 output_sym "CONFIG_ARITHMETIC"
2923 if test "$yacc_is_bison" = "yes" ; then
2924 echo "YACC=$YACC -y" >> $config_host_mak
2926 echo "YACC=$YACC" >> $config_host_mak
2928 if test "$lex_use_o" = "yes" ; then
2929 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2932 if test "$getmntent" = "yes" ; then
2933 output_sym "CONFIG_GETMNTENT"
2935 if test "$getmntinfo" = "yes" ; then
2936 output_sym "CONFIG_GETMNTINFO"
2938 if test "$getmntinfo_statvfs" = "yes" ; then
2939 output_sym "CONFIG_GETMNTINFO_STATVFS"
2941 if test "$static_assert" = "yes" ; then
2942 output_sym "CONFIG_STATIC_ASSERT"
2944 if test "$have_bool" = "yes" ; then
2945 output_sym "CONFIG_HAVE_BOOL"
2947 if test "$strndup" = "yes" ; then
2948 output_sym "CONFIG_HAVE_STRNDUP"
2950 if test "$disable_opt" = "yes" ; then
2951 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2953 if test "$valgrind_dev" = "yes"; then
2954 output_sym "CONFIG_VALGRIND_DEV"
2956 if test "$linux_blkzoned" = "yes" ; then
2957 output_sym "CONFIG_HAS_BLKZONED"
2959 if test "$libzbc" = "yes" ; then
2960 output_sym "CONFIG_LIBZBC"
2962 if test "$zlib" = "no" ; then
2963 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2964 if test "$build_static" = "yes"; then
2965 echo "Note that some distros have separate packages for static libraries."
2968 if test "$march_armv8_a_crc_crypto" = "yes" ; then
2969 output_sym "ARCH_HAVE_CRC_CRYPTO"
2971 if test "$cuda" = "yes" ; then
2972 output_sym "CONFIG_CUDA"
2974 if test "$march_set" = "no" && test "$build_native" = "yes" ; then
2975 output_sym "CONFIG_BUILD_NATIVE"
2977 if test "$cunit" = "yes" ; then
2978 output_sym "CONFIG_HAVE_CUNIT"
2980 if test "$__kernel_rwf_t" = "yes"; then
2981 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
2983 if test "$gettid" = "yes"; then
2984 output_sym "CONFIG_HAVE_GETTID"
2986 if test "$statx" = "yes"; then
2987 output_sym "CONFIG_HAVE_STATX"
2989 if test "$statx_syscall" = "yes"; then
2990 output_sym "CONFIG_HAVE_STATX_SYSCALL"
2992 if test "$fallthrough" = "yes"; then
2993 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
2995 if test "$thp" = "yes" ; then
2996 output_sym "CONFIG_HAVE_THP"
2998 if test "$libiscsi" = "yes" ; then
2999 output_sym "CONFIG_LIBISCSI"
3000 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
3001 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
3002 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
3004 if test "$libnbd" = "yes" ; then
3005 output_sym "CONFIG_LIBNBD"
3006 echo "CONFIG_LIBNBD=m" >> $config_host_mak
3007 echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak
3008 echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak
3010 if test "$dynamic_engines" = "yes" ; then
3011 output_sym "CONFIG_DYNAMIC_ENGINES"
3013 print_config "Lib-based ioengines dynamic" "$dynamic_engines"
3015 int main(int argc, char **argv)
3020 if test "$disable_tcmalloc" != "yes"; then
3021 if compile_prog "" "-ltcmalloc" "tcmalloc"; then
3023 LIBS="-ltcmalloc $LIBS"
3024 elif compile_prog "" "-l:libtcmalloc_minimal.so.4" "tcmalloc_minimal4"; then
3026 LIBS="-l:libtcmalloc_minimal.so.4 $LIBS"
3031 print_config "TCMalloc support" "$tcmalloc"
3033 echo "LIBS+=$LIBS" >> $config_host_mak
3034 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
3035 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
3036 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
3037 echo "CC=$cc" >> $config_host_mak
3038 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
3039 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
3041 if [ `dirname $0` != "." -a ! -e Makefile ]; then
3042 cat > Makefile <<EOF
3043 SRCDIR:=`dirname $0`
3044 include \$(SRCDIR)/Makefile