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"
48 CONFIGURE_CFLAGS="-Werror-implicit-function-declaration"
51 # Print a helpful header at the top of config.log
52 echo "# FIO configure log $(date)" >> config.log
53 printf "# Configured with:" >> config.log
54 printf " '%s'" "$0" "$@" >> config.log
56 echo "#" >> config.log
58 # Print configure header at the top of $config_host_h
59 echo "/*" > $config_host_h
60 echo " * Automatically generated by configure - do not modify" >> $config_host_h
61 printf " * Configured with:" >> $config_host_h
62 printf " * '%s'" "$0" "$@" >> $config_host_h
63 echo "" >> $config_host_h
64 echo " */" >> $config_host_h
67 # Run the compiler, capturing its output to the log.
68 echo $cc "$@" >> config.log
69 $cc "$@" >> config.log 2>&1 || return $?
70 # Test passed. If this is an --enable-werror build, rerun
71 # the test with -Werror and bail out if it fails. This
72 # makes warning-generating-errors in configure test code
73 # obvious to developers.
74 if test "$werror" != "yes"; then
77 # Don't bother rerunning the compile if we were already using -Werror
83 echo $cc -Werror "$@" >> config.log
84 $cc -Werror "$@" >> config.log 2>&1 && return $?
85 echo "ERROR: configure test passed without -Werror but failed with -Werror."
86 echo "This is probably a bug in the configure script. The failing command"
87 echo "will be at the bottom of config.log."
88 fatal "You can run configure with --disable-werror to bypass this check."
92 do_cc $CFLAGS $CONFIGURE_CFLAGS -c -o $TMPO $TMPC
97 local_ldflags="$2 $LIBS"
98 echo "Compiling test case $3" >> config.log
99 do_cc $CFLAGS $CONFIGURE_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
102 feature_not_found() {
107 echo "ERROR: User requested feature $feature"
108 if test ! -z "$packages" ; then
109 echo "ERROR: That feature needs $packages installed"
111 echo "ERROR: configure was not able to find it"
116 type "$1" >/dev/null 2>&1
122 #error $1 not defined
133 echo "$1=y" >> $config_host_mak
134 echo "#define $1" >> $config_host_h
137 check_min_lib_version() {
140 if "${cross_prefix}"pkg-config --atleast-version="$2" "$1" > /dev/null 2>&1; then
143 : "${_feature:=${1}}"
144 if "${cross_prefix}"pkg-config --version > /dev/null 2>&1; then
145 if eval "echo \$$_feature" = "yes" ; then
146 feature_not_found "$_feature" "$1 >= $2"
149 print_config "$1" "missing pkg-config, can't check $_feature version"
179 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
181 --prefix=*) prefix="$optarg"
183 --cpu=*) cpu="$optarg"
185 # esx is cross compiled and cannot be detect through simple uname calls
191 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
193 --build-32bit-win) build_32bit_win="yes"
195 --target-win-ver=*) target_win_ver="$optarg"
197 --enable-pdb) pdb="yes"
199 --build-static) build_static="yes"
201 --enable-gfio) gfio_check="yes"
203 --disable-numa) disable_numa="yes"
205 --disable-rdma) disable_rdma="yes"
207 --disable-rados) disable_rados="yes"
209 --disable-rbd) disable_rbd="yes"
211 --disable-http) disable_http="yes"
213 --disable-gfapi) disable_gfapi="yes"
215 --enable-libhdfs) libhdfs="yes"
217 --disable-lex) disable_lex="yes"
219 --enable-lex) disable_lex="no"
221 --disable-shm) no_shm="yes"
223 --disable-optimizations) disable_opt="yes"
225 --disable-pmem) disable_pmem="yes"
227 --enable-cuda) cuda="yes"
229 --enable-libcufile) libcufile="yes"
231 --disable-native) disable_native="yes"
233 --with-ime=*) ime_path="$optarg"
235 --enable-libiscsi) libiscsi="yes"
237 --enable-libnbd) libnbd="yes"
239 --disable-libzbc) libzbc="no"
241 --disable-tcmalloc) disable_tcmalloc="yes"
243 --dynamic-libengines) dynamic_engines="yes"
249 echo "Bad option $opt"
255 if test "$show_help" = "yes" ; then
256 echo "--prefix= Use this directory as installation prefix"
257 echo "--cpu= Specify target CPU if auto-detect fails"
258 echo "--cc= Specify compiler to use"
259 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
260 echo "--build-32bit-win Enable 32-bit build on Windows"
261 echo "--target-win-ver= Minimum version of Windows to target (only accepts 7)"
262 echo "--enable-pdb Enable Windows PDB symbols generation (needs clang/lld)"
263 echo "--build-static Build a static fio"
264 echo "--esx Configure build options for esx"
265 echo "--enable-gfio Enable building of gtk gfio"
266 echo "--disable-numa Disable libnuma even if found"
267 echo "--disable-rdma Disable RDMA support even if found"
268 echo "--disable-rados Disable Rados support even if found"
269 echo "--disable-rbd Disable Rados Block Device even if found"
270 echo "--disable-http Disable HTTP support even if found"
271 echo "--disable-gfapi Disable gfapi"
272 echo "--enable-libhdfs Enable hdfs support"
273 echo "--disable-lex Disable use of lex/yacc for math"
274 echo "--disable-pmem Disable pmem based engines even if found"
275 echo "--enable-lex Enable use of lex/yacc for math"
276 echo "--disable-shm Disable SHM support"
277 echo "--disable-optimizations Don't enable compiler optimizations"
278 echo "--enable-cuda Enable GPUDirect RDMA support"
279 echo "--enable-libcufile Enable GPUDirect Storage cuFile support"
280 echo "--disable-native Don't build for native host"
281 echo "--with-ime= Install path for DDN's Infinite Memory Engine"
282 echo "--enable-libiscsi Enable iscsi support"
283 echo "--enable-libnbd Enable libnbd (NBD engine) support"
284 echo "--disable-libzbc Disable libzbc even if found"
285 echo "--disable-tcmalloc Disable tcmalloc support"
286 echo "--dynamic-libengines Lib-based ioengines as dynamic libraries"
290 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
291 # Preferred compiler (can be overriden later after we know the platform):
293 # ${cross_prefix}gcc (if cross-prefix specified)
296 if test -z "${CC}${cross_prefix}"; then
303 cc="${CC-${cross_prefix}gcc}"
306 if check_define __ANDROID__ ; then
308 elif check_define __linux__ ; then
310 elif check_define __OpenBSD__ ; then
312 elif check_define __NetBSD__ ; then
314 elif check_define __sun__ ; then
316 CFLAGS="$CFLAGS -D_REENTRANT"
317 elif check_define _WIN32 ; then
323 echo "# Automatically generated by configure - do not modify" > $config_host_mak
324 printf "# Configured with:" >> $config_host_mak
325 printf " '%s'" "$0" "$@" >> $config_host_mak
326 echo >> $config_host_mak
327 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
329 if test "$no_shm" = "yes" ; then
330 output_sym "CONFIG_NO_SHM"
333 if test "$disable_opt" = "yes" ; then
334 output_sym "CONFIG_FIO_NO_OPT"
337 # Some host OSes need non-standard checks for which CPU to use.
338 # Note that these checks are broken for cross-compilation: if you're
339 # cross-compiling to one of these OSes then you'll need to specify
340 # the correct CPU with the --cpu option.
343 # Unless explicitly enabled, turn off lex.
344 # OpenBSD will hit syntax error when enabled.
345 if test -z "$disable_lex" ; then
352 CFLAGS="$CFLAGS -I/usr/local/include"
353 LDFLAGS="$LDFLAGS -L/usr/local/lib"
356 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
357 # we can run 64-bit userspace code.
358 # If the user didn't specify a CPU explicitly and the kernel says this is
359 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
361 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
364 # Avoid configure feature detection of features provided by weak symbols
371 if compile_prog "" "-Werror=partial-availability" "error on weak symbols"; then
372 CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Werror=partial-availability"
376 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
377 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
380 LIBS="-lnsl -lsocket"
383 # We still force some options, so keep this message here.
384 echo "Forcing some known good options on Windows"
385 if test -z "${CC}${cross_prefix}"; then
386 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
387 cc="i686-w64-mingw32-gcc"
389 cc="x86_64-w64-mingw32-gcc"
393 target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]')
394 if test -z "$target_win_ver"; then
395 # Default Windows API target
398 if test "$target_win_ver" = "7"; then
399 output_sym "CONFIG_WINDOWS_7"
400 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601"
402 fatal "Unknown target Windows version"
405 # We need this to be output_sym'd here because this is Windows specific.
406 # The regular configure path never sets this config.
407 output_sym "CONFIG_WINDOWSAIO"
408 # We now take the regular configuration path without having exit 0 here.
409 # Flags below are still necessary mostly for MinGW.
413 clock_gettime="yes" # clock_monotonic probe has dependency on this
414 clock_monotonic="yes"
419 # Now we know the target platform we can have another guess at the preferred
420 # compiler when it wasn't explictly set
421 if test -z "${CC}${cross_prefix}"; then
422 if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
428 if test -z "$cc"; then
429 echo "configure: failed to find compiler"
433 if test ! -z "$cpu" ; then
434 # command line argument
436 elif check_define __i386__ ; then
438 elif check_define __x86_64__ ; then
440 elif check_define __sparc__ ; then
441 if check_define __arch64__ ; then
446 elif check_define _ARCH_PPC ; then
447 if check_define _ARCH_PPC64 ; then
452 elif check_define __mips__ ; then
454 elif check_define __ia64__ ; then
456 elif check_define __s390__ ; then
457 if check_define __s390x__ ; then
462 elif check_define __arm__ ; then
464 elif check_define __aarch64__ ; then
466 elif check_define __hppa__ ; then
472 # Normalise host CPU name and set ARCH.
474 ia64|ppc|ppc64|s390|s390x|sparc64)
477 i386|i486|i586|i686|i86pc|BePC)
489 hppa|parisc|parisc64)
503 ##########################################
504 # check cross compile
506 if test "$cross_compile" != "yes" ; then
515 if compile_prog "" "" "cross"; then
516 $TMPE 2>/dev/null || cross_compile="yes"
518 fatal "compile test failed"
521 ##########################################
523 if test "$bigendian" != "yes" ; then
526 if test "$cross_compile" = "no" ; then
528 #include <inttypes.h>
531 volatile uint32_t i=0x01234567;
532 return (*((uint8_t*)(&i))) == 0x67;
535 if compile_prog "" "" "endian"; then
536 $TMPE && bigendian="yes"
539 # If we're cross compiling, try our best to work it out and rely on the
540 # run-time check to fail if we get it wrong.
545 #if __BYTE_ORDER != __BIG_ENDIAN
546 # error "Unknown endianness"
550 compile_prog "" "" "endian" && bigendian="yes"
551 check_define "__ARMEB__" && bigendian="yes"
552 check_define "__MIPSEB__" && bigendian="yes"
556 print_config "Operating system" "$targetos"
557 print_config "CPU" "$cpu"
558 print_config "Big endian" "$bigendian"
559 if test ! -z "$target_win_ver"; then
560 print_config "Target Windows version" "$target_win_ver"
562 print_config "Compiler" "$cc"
563 print_config "Cross compile" "$cross_compile"
566 ##########################################
567 # See if we need to build a static build
568 if test "$build_static" = "yes" ; then
569 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
570 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
574 print_config "Static build" "$build_static"
576 ##########################################
577 # check for C11 atomics support
579 #include <stdatomic.h>
587 if ! compile_prog "" "" "C11 atomics"; then
589 echo "Your compiler doesn't support C11 atomics. gcc 4.9/clang 3.6 are the"
590 echo "minimum versions with it - perhaps your compiler is too old?"
591 fatal "C11 atomics support not found"
595 ##########################################
600 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
603 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
607 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
609 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
612 fatal "Unknown wordsize"
614 print_config "Wordsize" "$wordsize"
616 ##########################################
618 if test "$zlib" != "yes" ; then
626 if (inflateInit(&stream) != Z_OK)
631 if compile_prog "" "-lz" "zlib" ; then
635 print_config "zlib" "$zlib"
637 ##########################################
639 if test "$libaio" != "yes" ; then
642 if test "$esx" != "yes" ; then
652 if compile_prog "" "-laio" "libaio" ; then
655 if test "$libaio" = "yes" ; then
656 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
666 io_prep_preadv2(NULL, 0, NULL, 0, 0, 0);
667 io_prep_pwritev2(NULL, 0, NULL, 0, 0, 0);
671 if compile_prog "" "" "libaio rw flags" ; then
677 print_config "Linux AIO support" "$libaio"
678 print_config "Linux AIO support rw flags" "$libaio_rw_flags"
680 ##########################################
682 if test "$posix_aio" != "yes" ; then
685 if test "$posix_aio_lrt" != "yes" ; then
697 if compile_prog "" "" "posixaio" ; then
699 elif compile_prog "" "-lrt" "posixaio -lrt"; then
704 print_config "POSIX AIO support" "$posix_aio"
705 print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
707 ##########################################
708 # posix aio fsync probe
709 if test "$posix_aio_fsync" != "yes" ; then
712 if test "$posix_aio" = "yes" ; then
719 return aio_fsync(O_SYNC, &cb);
723 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
727 print_config "POSIX AIO fsync" "$posix_aio_fsync"
729 ##########################################
730 # POSIX pshared attribute probe
731 if test "$posix_pshared" != "yes" ; then
738 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
739 # if defined(__CYGWIN__)
740 # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
741 # elif defined(__APPLE__)
742 # include <AvailabilityMacros.h>
743 # include <TargetConditionals.h>
744 # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
745 # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
749 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
754 if compile_prog "" "$LIBS" "posix_pshared" ; then
757 print_config "POSIX pshared support" "$posix_pshared"
759 ##########################################
760 # POSIX pthread_condattr_setclock() probe
761 if test "$pthread_condattr_setclock" != "yes" ; then
762 pthread_condattr_setclock="no"
768 pthread_condattr_t condattr;
769 pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
773 if compile_prog "" "$LIBS" "pthread_condattr_setclock" ; then
774 pthread_condattr_setclock=yes
775 elif compile_prog "" "$LIBS -lpthread" "pthread_condattr_setclock" ; then
776 pthread_condattr_setclock=yes
777 LIBS="$LIBS -lpthread"
779 print_config "pthread_condattr_setclock()" "$pthread_condattr_setclock"
781 ##########################################
782 # pthread_sigmask() probe
783 if test "$pthread_sigmask" != "yes" ; then
787 #include <stddef.h> /* NULL */
788 #include <signal.h> /* pthread_sigmask() */
791 return pthread_sigmask(0, NULL, NULL);
794 if compile_prog "" "$LIBS" "pthread_sigmask" ; then
796 elif compile_prog "" "$LIBS -lpthread" "pthread_sigmask" ; then
798 LIBS="$LIBS -lpthread"
800 print_config "pthread_sigmask()" "$pthread_sigmask"
802 ##########################################
804 if test "$solaris_aio" != "yes" ; then
808 #include <sys/types.h>
809 #include <sys/asynch.h>
814 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
818 if compile_prog "" "-laio" "solarisaio" ; then
822 print_config "Solaris AIO support" "$solaris_aio"
824 ##########################################
825 # __sync_fetch_and_add test
826 if test "$sfaa" != "yes" ; then
830 #include <inttypes.h>
831 static int sfaa(uint64_t *ptr)
833 return __sync_fetch_and_add(ptr, 0);
836 int main(int argc, char **argv)
843 if compile_prog "" "" "__sync_fetch_and_add()" ; then
846 print_config "__sync_fetch_and_add" "$sfaa"
848 ##########################################
849 # __sync_synchronize() test
850 if test "$sync_sync" != "yes" ; then
854 #include <inttypes.h>
856 int main(int argc, char **argv)
858 __sync_synchronize();
862 if compile_prog "" "" "__sync_synchronize()" ; then
865 print_config "__sync_synchronize" "$sync_sync"
867 ##########################################
868 # __sync_val_compare_and_swap() test
869 if test "$cmp_swap" != "yes" ; then
873 #include <inttypes.h>
875 int main(int argc, char **argv)
878 return __sync_val_compare_and_swap(&x, 1, 2);
881 if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
884 print_config "__sync_val_compare_and_swap" "$cmp_swap"
886 ##########################################
888 if test "$libverbs" != "yes" ; then
892 #include <infiniband/verbs.h>
893 int main(int argc, char **argv)
895 struct ibv_pd *pd = ibv_alloc_pd(NULL);
899 if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
902 print_config "libverbs" "$libverbs"
904 ##########################################
906 if test "$rdmacm" != "yes" ; then
911 #include <rdma/rdma_cma.h>
912 int main(int argc, char **argv)
914 rdma_destroy_qp(NULL);
918 if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
921 print_config "rdmacm" "$rdmacm"
923 ##########################################
924 # asprintf() and vasprintf() probes
925 if test "$have_asprintf" != "yes" ; then
931 int main(int argc, char **argv)
934 return asprintf(&buf, "%s", "str") == 0;
937 if compile_prog "" "" "have_asprintf"; then
940 print_config "asprintf()" "$have_asprintf"
942 if test "$have_vasprintf" != "yes" ; then
948 int main(int argc, char **argv)
952 return vasprintf(&buf, "%s", ap) == 0;
955 if compile_prog "" "" "have_vasprintf"; then
958 print_config "vasprintf()" "$have_vasprintf"
960 ##########################################
961 # Linux fallocate probe
962 if test "$linux_fallocate" != "yes" ; then
968 #include <linux/falloc.h>
969 int main(int argc, char **argv)
971 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
975 if compile_prog "" "" "linux_fallocate"; then
976 linux_fallocate="yes"
978 print_config "Linux fallocate" "$linux_fallocate"
980 ##########################################
981 # POSIX fadvise probe
982 if test "$posix_fadvise" != "yes" ; then
988 int main(int argc, char **argv)
990 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
994 if compile_prog "" "" "posix_fadvise"; then
997 print_config "POSIX fadvise" "$posix_fadvise"
999 ##########################################
1000 # POSIX fallocate probe
1001 if test "$posix_fallocate" != "yes" ; then
1002 posix_fallocate="no"
1007 int main(int argc, char **argv)
1009 int r = posix_fallocate(0, 0, 1024);
1013 if compile_prog "" "" "posix_fallocate"; then
1014 posix_fallocate="yes"
1016 print_config "POSIX fallocate" "$posix_fallocate"
1018 ##########################################
1019 # sched_set/getaffinity 2 or 3 argument test
1020 if test "$linux_2arg_affinity" != "yes" ; then
1021 linux_2arg_affinity="no"
1023 if test "$linux_3arg_affinity" != "yes" ; then
1024 linux_3arg_affinity="no"
1028 int main(int argc, char **argv)
1031 return sched_setaffinity(0, sizeof(mask), &mask);
1034 if compile_prog "" "" "sched_setaffinity(,,)"; then
1035 linux_3arg_affinity="yes"
1039 int main(int argc, char **argv)
1042 return sched_setaffinity(0, &mask);
1045 if compile_prog "" "" "sched_setaffinity(,)"; then
1046 linux_2arg_affinity="yes"
1049 print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
1050 print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
1052 ##########################################
1053 # clock_gettime probe
1054 if test "$clock_gettime" != "yes" ; then
1060 int main(int argc, char **argv)
1062 return clock_gettime(0, NULL);
1065 if compile_prog "" "" "clock_gettime"; then
1067 elif compile_prog "" "-lrt" "clock_gettime"; then
1071 print_config "clock_gettime" "$clock_gettime"
1073 ##########################################
1074 # CLOCK_MONOTONIC probe
1075 if test "$clock_monotonic" != "yes" ; then
1076 clock_monotonic="no"
1078 if test "$clock_gettime" = "yes" ; then
1082 int main(int argc, char **argv)
1084 return clock_gettime(CLOCK_MONOTONIC, NULL);
1087 if compile_prog "" "$LIBS" "clock monotonic"; then
1088 clock_monotonic="yes"
1091 print_config "CLOCK_MONOTONIC" "$clock_monotonic"
1093 ##########################################
1095 if test "$clockid_t" != "yes" ; then
1101 int main(int argc, char **argv)
1103 volatile clockid_t cid;
1104 memset((void*)&cid, 0, sizeof(cid));
1108 if compile_prog "" "$LIBS" "clockid_t"; then
1111 print_config "clockid_t" "$clockid_t"
1113 ##########################################
1114 # gettimeofday() probe
1115 if test "$gettimeofday" != "yes" ; then
1119 #include <sys/time.h>
1121 int main(int argc, char **argv)
1124 return gettimeofday(&tv, NULL);
1127 if compile_prog "" "" "gettimeofday"; then
1130 print_config "gettimeofday" "$gettimeofday"
1132 ##########################################
1134 if test "$fdatasync" != "yes" ; then
1140 int main(int argc, char **argv)
1142 return fdatasync(0);
1145 if compile_prog "" "" "fdatasync"; then
1148 print_config "fdatasync" "$fdatasync"
1150 ##########################################
1152 if test "$pipe" != "yes" ; then
1157 int main(int argc, char **argv)
1163 if compile_prog "" "" "pipe"; then
1166 print_config "pipe()" "$pipe"
1168 ##########################################
1170 if test "$pipe2" != "yes" ; then
1175 int main(int argc, char **argv)
1178 return pipe2(fd, 0);
1181 if compile_prog "" "" "pipe2"; then
1184 print_config "pipe2()" "$pipe2"
1186 ##########################################
1188 if test "$pread" != "yes" ; then
1193 int main(int argc, char **argv)
1195 return pread(0, NULL, 0, 0);
1198 if compile_prog "" "" "pread"; then
1201 print_config "pread()" "$pread"
1203 ##########################################
1204 # sync_file_range() probe
1205 if test "$sync_file_range" != "yes" ; then
1206 sync_file_range="no"
1212 #include <linux/fs.h>
1213 int main(int argc, char **argv)
1215 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1216 SYNC_FILE_RANGE_WAIT_AFTER;
1217 return sync_file_range(0, 0, 0, flags);
1220 if compile_prog "" "" "sync_file_range"; then
1221 sync_file_range="yes"
1223 print_config "sync_file_range" "$sync_file_range"
1225 ##########################################
1226 # ext4 move extent probe
1227 if test "$ext4_me" != "yes" ; then
1232 #include <sys/ioctl.h>
1233 int main(int argc, char **argv)
1235 struct move_extent me;
1236 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1239 if compile_prog "" "" "ext4 move extent" ; then
1241 elif test $targetos = "Linux" ; then
1242 # On Linux, just default to it on and let it error at runtime if we really
1243 # don't have it. None of my updated systems have it defined, but it does
1244 # work. Takes a while to bubble back.
1247 print_config "EXT4 move extent" "$ext4_me"
1249 ##########################################
1251 if test "$linux_splice" != "yes" ; then
1257 int main(int argc, char **argv)
1259 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1262 if compile_prog "" "" "linux splice"; then
1265 print_config "Linux splice(2)" "$linux_splice"
1267 ##########################################
1269 if test "$libnuma" != "yes" ; then
1274 int main(int argc, char **argv)
1276 return numa_available();
1279 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1283 print_config "libnuma" "$libnuma"
1285 ##########################################
1286 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1287 if test "$libnuma" = "yes" ; then
1291 int main(int argc, char **argv)
1293 struct bitmask *mask = numa_parse_nodestring(NULL);
1294 return mask->size == 0;
1297 if compile_prog "" "" "libnuma api"; then
1300 print_config "libnuma v2" "$libnuma_v2"
1303 ##########################################
1305 if test "$strsep" != "yes" ; then
1310 int main(int argc, char **argv)
1312 static char *string = "This is a string";
1313 strsep(&string, "needle");
1317 if compile_prog "" "" "strsep"; then
1320 print_config "strsep" "$strsep"
1322 ##########################################
1323 # strcasestr() probe
1324 if test "$strcasestr" != "yes" ; then
1329 int main(int argc, char **argv)
1331 return strcasestr(argv[0], argv[1]) != NULL;
1334 if compile_prog "" "" "strcasestr"; then
1337 print_config "strcasestr" "$strcasestr"
1339 ##########################################
1341 if test "$strlcat" != "yes" ; then
1346 int main(int argc, char **argv)
1348 static char dst[64];
1349 static char *string = "This is a string";
1350 memset(dst, 0, sizeof(dst));
1351 strlcat(dst, string, sizeof(dst));
1355 if compile_prog "" "" "strlcat"; then
1358 print_config "strlcat" "$strlcat"
1360 ##########################################
1361 # getopt_long_only() probe
1362 if test "$getopt_long_only" != "yes" ; then
1363 getopt_long_only="no"
1369 int main(int argc, char **argv)
1371 int c = getopt_long_only(argc, argv, "", NULL, NULL);
1375 if compile_prog "" "" "getopt_long_only"; then
1376 getopt_long_only="yes"
1378 print_config "getopt_long_only()" "$getopt_long_only"
1380 ##########################################
1382 if test "$inet_aton" != "yes" ; then
1387 #include <winsock2.h>
1389 #include <sys/socket.h>
1390 #include <arpa/inet.h>
1393 int main(int argc, char **argv)
1396 return inet_aton(NULL, &in);
1399 if compile_prog "" "" "inet_aton"; then
1402 print_config "inet_aton" "$inet_aton"
1404 ##########################################
1406 if test "$socklen_t" != "yes" ; then
1411 #include <winsock2.h>
1412 #include <ws2tcpip.h>
1414 #include <sys/socket.h>
1416 int main(int argc, char **argv)
1422 if compile_prog "" "" "socklen_t"; then
1425 print_config "socklen_t" "$socklen_t"
1427 ##########################################
1428 # Whether or not __thread is supported for TLS
1429 if test "$tls_thread" != "yes" ; then
1434 static __thread int ret;
1435 int main(int argc, char **argv)
1440 if compile_prog "" "" "__thread"; then
1443 print_config "__thread" "$tls_thread"
1445 ##########################################
1446 # Check if we have required gtk/glib support for gfio
1447 if test "$gfio" != "yes" ; then
1450 if test "$gfio_check" = "yes" ; then
1454 #include <gtk/gtk.h>
1457 gdk_threads_enter();
1458 gdk_threads_leave();
1460 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1463 GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0)
1464 ORG_LDFLAGS=$LDFLAGS
1465 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1466 if test "$?" != "0" ; then
1467 echo "configure: gtk and gthread not found"
1470 GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
1471 if test "$?" != "0" ; then
1472 echo "configure: gtk and gthread not found"
1476 if check_min_lib_version gtk+-2.0 2.18.0 "gfio"; then
1477 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1478 GFIO_LIBS="$LIBS $GTK_LIBS"
1479 CFLAGS="$CFLAGS $GTK_CFLAGS"
1481 echo "Please install gtk and gdk libraries"
1487 LDFLAGS=$ORG_LDFLAGS
1490 if test "$gfio_check" = "yes" ; then
1491 print_config "gtk 2.18 or higher" "$gfio"
1494 ##########################################
1495 # Check whether we have getrusage(RUSAGE_THREAD)
1496 if test "$rusage_thread" != "yes" ; then
1500 #include <sys/time.h>
1501 #include <sys/resource.h>
1502 int main(int argc, char **argv)
1505 getrusage(RUSAGE_THREAD, &ru);
1509 if compile_prog "" "" "RUSAGE_THREAD"; then
1512 print_config "RUSAGE_THREAD" "$rusage_thread"
1514 ##########################################
1515 # Check whether we have SCHED_IDLE
1516 if test "$sched_idle" != "yes" ; then
1521 int main(int argc, char **argv)
1523 struct sched_param p;
1524 return sched_setscheduler(0, SCHED_IDLE, &p);
1527 if compile_prog "" "" "SCHED_IDLE"; then
1530 print_config "SCHED_IDLE" "$sched_idle"
1532 ##########################################
1533 # Check whether we have TCP_NODELAY
1534 if test "$tcp_nodelay" != "yes" ; then
1539 #include <winsock2.h>
1542 #include <sys/types.h>
1543 #include <sys/socket.h>
1544 #include <netinet/tcp.h>
1546 int main(int argc, char **argv)
1548 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1551 if compile_prog "" "" "TCP_NODELAY"; then
1553 elif compile_prog "" "-lws2_32" "TCP_NODELAY"; then
1555 LIBS="$LIBS -lws2_32"
1557 print_config "TCP_NODELAY" "$tcp_nodelay"
1559 ##########################################
1560 # Check whether we have SO_SNDBUF
1561 if test "$window_size" != "yes" ; then
1566 #include <winsock2.h>
1569 #include <sys/types.h>
1570 #include <sys/socket.h>
1571 #include <netinet/tcp.h>
1573 int main(int argc, char **argv)
1575 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1576 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1579 if compile_prog "" "" "SO_SNDBUF"; then
1581 elif compile_prog "" "-lws2_32" "SO_SNDBUF"; then
1583 LIBS="$LIBS -lws2_32"
1585 print_config "Net engine window_size" "$window_size"
1587 ##########################################
1588 # Check whether we have TCP_MAXSEG
1589 if test "$mss" != "yes" ; then
1594 #include <winsock2.h>
1597 #include <sys/types.h>
1598 #include <sys/socket.h>
1599 #include <netinet/tcp.h>
1600 #include <arpa/inet.h>
1601 #include <netinet/in.h>
1603 int main(int argc, char **argv)
1605 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1608 if compile_prog "" "" "TCP_MAXSEG"; then
1610 elif compile_prog "" "-lws2_32" "TCP_MAXSEG"; then
1612 LIBS="$LIBS -lws2_32"
1614 print_config "TCP_MAXSEG" "$mss"
1616 ##########################################
1617 # Check whether we have RLIMIT_MEMLOCK
1618 if test "$rlimit_memlock" != "yes" ; then
1622 #include <sys/time.h>
1623 #include <sys/resource.h>
1624 int main(int argc, char **argv)
1627 return getrlimit(RLIMIT_MEMLOCK, &rl);
1630 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1631 rlimit_memlock="yes"
1633 print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1635 ##########################################
1636 # Check whether we have pwritev/preadv
1637 if test "$pwritev" != "yes" ; then
1642 #include <sys/uio.h>
1643 int main(int argc, char **argv)
1645 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1648 if compile_prog "" "" "pwritev"; then
1651 print_config "pwritev/preadv" "$pwritev"
1653 ##########################################
1654 # Check whether we have pwritev2/preadv2
1655 if test "$pwritev2" != "yes" ; then
1660 #include <sys/uio.h>
1661 int main(int argc, char **argv)
1663 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1666 if compile_prog "" "" "pwritev2"; then
1669 print_config "pwritev2/preadv2" "$pwritev2"
1671 ##########################################
1672 # Check whether we have the required functions for ipv6
1673 if test "$ipv6" != "yes" ; then
1678 #include <winsock2.h>
1679 #include <ws2tcpip.h>
1681 #include <sys/types.h>
1682 #include <sys/socket.h>
1683 #include <netinet/in.h>
1687 int main(int argc, char **argv)
1689 struct addrinfo hints;
1690 struct in6_addr addr;
1693 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1695 printf("%s\n", gai_strerror(ret));
1700 if compile_prog "" "" "ipv6"; then
1703 print_config "IPv6 helpers" "$ipv6"
1705 ##########################################
1707 if test "$http" != "yes" ; then
1710 # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
1712 #include <curl/curl.h>
1713 #include <openssl/hmac.h>
1715 int main(int argc, char **argv)
1720 curl = curl_easy_init();
1721 curl_easy_cleanup(curl);
1723 ctx = HMAC_CTX_new();
1724 HMAC_CTX_reset(ctx);
1729 # openssl < 1.1.0 uses the HMAC_CTX type directly
1731 #include <curl/curl.h>
1732 #include <openssl/hmac.h>
1734 int main(int argc, char **argv)
1739 curl = curl_easy_init();
1740 curl_easy_cleanup(curl);
1742 HMAC_CTX_init(&ctx);
1743 HMAC_CTX_cleanup(&ctx);
1747 if test "$disable_http" != "yes"; then
1748 HTTP_LIBS="-lcurl -lssl -lcrypto"
1749 if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then
1750 output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
1752 elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
1756 print_config "http engine" "$http"
1758 ##########################################
1760 if test "$rados" != "yes" ; then
1764 #include <rados/librados.h>
1766 int main(int argc, char **argv)
1769 rados_ioctx_t io_ctx;
1770 const char cluster_name[] = "ceph";
1771 const char user_name[] = "client.admin";
1772 const char pool[] = "rados";
1774 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1775 rados_create2(&cluster, cluster_name, user_name, 0);
1776 rados_ioctx_create(cluster, pool, &io_ctx);
1781 if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
1784 print_config "Rados engine" "$rados"
1786 ##########################################
1788 if test "$rbd" != "yes" ; then
1792 #include <rbd/librbd.h>
1794 int main(int argc, char **argv)
1797 rados_ioctx_t io_ctx;
1798 const char cluster_name[] = "ceph";
1799 const char user_name[] = "client.admin";
1800 const char pool[] = "rbd";
1801 int major, minor, extra;
1803 rbd_version(&major, &minor, &extra);
1804 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1805 rados_create2(&cluster, cluster_name, user_name, 0);
1806 rados_ioctx_create(cluster, pool, &io_ctx);
1811 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1814 print_config "Rados Block Device engine" "$rbd"
1816 ##########################################
1817 # check for rbd_poll
1818 if test "$rbd_poll" != "yes" ; then
1821 if test "$rbd" = "yes"; then
1823 #include <rbd/librbd.h>
1824 #include <sys/eventfd.h>
1826 int main(int argc, char **argv)
1829 rbd_completion_t comp;
1831 int fd = eventfd(0, EFD_NONBLOCK);
1832 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1833 rbd_poll_io_events(image, comp, 1);
1838 if compile_prog "" "-lrbd -lrados" "rbd"; then
1841 print_config "rbd_poll" "$rbd_poll"
1844 ##########################################
1845 # check for rbd_invalidate_cache()
1846 if test "$rbd_inval" != "yes" ; then
1849 if test "$rbd" = "yes"; then
1851 #include <rbd/librbd.h>
1853 int main(int argc, char **argv)
1857 return rbd_invalidate_cache(image);
1860 if compile_prog "" "-lrbd -lrados" "rbd"; then
1863 print_config "rbd_invalidate_cache" "$rbd_inval"
1866 ##########################################
1867 # Check whether we have setvbuf
1868 if test "$setvbuf" != "yes" ; then
1873 int main(int argc, char **argv)
1877 setvbuf(f, buf, _IOFBF, sizeof(buf));
1881 if compile_prog "" "" "setvbuf"; then
1884 print_config "setvbuf" "$setvbuf"
1886 ##########################################
1888 if test "$gfapi" != "yes" ; then
1892 #include <glusterfs/api/glfs.h>
1894 int main(int argc, char **argv)
1896 glfs_t *g = glfs_new("foo");
1901 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1904 print_config "Gluster API engine" "$gfapi"
1906 ##########################################
1907 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1908 if test "$gfapi" = "yes" ; then
1911 #include <glusterfs/api/glfs.h>
1913 int main(int argc, char **argv)
1916 int ret = glfs_fadvise(fd, 0, 0, 1);
1921 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1924 print_config "Gluster API use fadvise" "$gf_fadvise"
1927 ##########################################
1928 # check for newer gfapi
1929 if test "$gfapi" = "yes" ; then
1932 #include <glusterfs/api/glfs.h>
1934 int main(int argc, char **argv)
1936 return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL);
1939 if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then
1942 print_config "Gluster new API" "$gf_new"
1945 ##########################################
1946 # check for gfapi trim support
1947 if test "$gf_trim" != "yes" ; then
1950 if test "$gfapi" = "yes" ; then
1952 #include <glusterfs/api/glfs.h>
1954 int main(int argc, char **argv)
1956 return glfs_discard_async(NULL, 0, 0);
1959 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1962 print_config "Gluster API trim support" "$gf_trim"
1965 ##########################################
1966 # Check if we support stckf on s390
1967 if test "$s390_z196_facilities" != "yes" ; then
1968 s390_z196_facilities="no"
1971 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1972 int main(int argc, char **argv)
1974 /* We want just 1 double word to be returned. */
1975 register unsigned long reg0 asm("0") = 0;
1976 unsigned long stfle_bits;
1977 asm volatile(".machine push" "\n\t"
1978 ".machine \"z9-109\"" "\n\t"
1981 : "=QS" (stfle_bits), "+d" (reg0)
1984 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1990 if compile_prog "" "" "s390_z196_facilities"; then
1992 if [ $? -eq 0 ]; then
1993 s390_z196_facilities="yes"
1996 print_config "s390_z196_facilities" "$s390_z196_facilities"
1998 ##########################################
1999 # Check if we have required environment variables configured for libhdfs
2000 if test "$libhdfs" = "yes" ; then
2002 if test "$JAVA_HOME" = "" ; then
2003 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
2006 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
2007 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
2010 if test "$FIO_LIBHDFS_LIB" = "" ; then
2011 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
2014 if test "$hdfs_conf_error" = "1" ; then
2015 feature_not_found "libhdfs" ""
2018 if test "$FIO_HDFS_CPU" = "x86_64" ; then
2019 FIO_HDFS_CPU="amd64"
2022 print_config "HDFS engine" "$libhdfs"
2024 ##########################################
2025 # Check whether we have MTD
2026 if test "$mtd" != "yes" ; then
2031 #include <mtd/mtd-user.h>
2032 #include <sys/ioctl.h>
2033 int main(int argc, char **argv)
2035 struct mtd_write_req ops;
2036 struct mtd_info_user info;
2037 memset(&ops, 0, sizeof(ops));
2038 info.type = MTD_MLCNANDFLASH;
2039 return ioctl(0, MEMGETINFO, &info);
2042 if compile_prog "" "" "mtd"; then
2045 print_config "MTD" "$mtd"
2047 ##########################################
2048 # Check whether we have libpmem
2049 if test "$libpmem" != "yes" ; then
2053 #include <libpmem.h>
2055 int main(int argc, char **argv)
2058 rc = pmem_is_pmem(NULL, NULL);
2062 if compile_prog "" "-lpmem" "libpmem"; then
2065 print_config "libpmem" "$libpmem"
2067 ##########################################
2068 # Check whether libpmem's version >= 1.5
2069 if test "$libpmem1_5" != "yes" ; then
2072 if test "$libpmem" = "yes"; then
2074 #include <libpmem.h>
2076 int main(int argc, char **argv)
2078 pmem_memcpy(NULL, NULL, NULL, NULL);
2082 if compile_prog "" "-lpmem" "libpmem1_5"; then
2086 print_config "libpmem1_5" "$libpmem1_5"
2088 ##########################################
2089 # Check whether we have libpmemblk
2090 # libpmem is a prerequisite
2091 if test "$libpmemblk" != "yes" ; then
2094 if test "$libpmem" = "yes"; then
2096 #include <libpmemblk.h>
2097 int main(int argc, char **argv)
2100 pbp = pmemblk_open("", 0);
2104 if compile_prog "" "-lpmemblk" "libpmemblk"; then
2108 print_config "libpmemblk" "$libpmemblk"
2110 # Choose libpmem-based ioengines
2111 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
2113 if test "$libpmem1_5" = "yes"; then
2116 if test "$libpmemblk" = "yes"; then
2121 ##########################################
2122 # Report whether pmemblk engine is enabled
2123 print_config "PMDK pmemblk engine" "$pmemblk"
2125 ##########################################
2126 # Report whether dev-dax engine is enabled
2127 print_config "PMDK dev-dax engine" "$devdax"
2129 ##########################################
2130 # Report whether libpmem engine is enabled
2131 print_config "PMDK libpmem engine" "$pmem"
2133 ##########################################
2134 # Check whether we support DDN's IME
2135 if test "$libime" != "yes" ; then
2139 #include <ime_native.h>
2140 int main(int argc, char **argv)
2144 rc = ime_native_finalize();
2148 if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then
2150 CFLAGS="-I${ime_path}/include $CFLAGS"
2151 LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS"
2152 LIBS="-lim_client $LIBS"
2154 print_config "DDN's Infinite Memory Engine" "$libime"
2156 ##########################################
2157 # Check if we have libiscsi
2158 if test "$libiscsi" != "no" ; then
2159 if check_min_lib_version libiscsi 1.9.0; then
2161 libiscsi_cflags=$(pkg-config --cflags libiscsi)
2162 libiscsi_libs=$(pkg-config --libs libiscsi)
2167 print_config "iscsi engine" "$libiscsi"
2169 ##########################################
2170 # Check if we have libnbd (for NBD support)
2171 if test "$libnbd" != "no" ; then
2172 if check_min_lib_version libnbd 0.9.8; then
2174 libnbd_cflags=$(pkg-config --cflags libnbd)
2175 libnbd_libs=$(pkg-config --libs libnbd)
2180 print_config "NBD engine" "$libnbd"
2182 ##########################################
2183 # Check if we have lex/yacc available
2188 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
2189 if test "$targetos" != "SunOS" ; then
2199 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2203 if test "$arith" = "yes" ; then
2205 extern int yywrap(void);
2207 int main(int argc, char **argv)
2213 if compile_prog "" "-lfl" "flex"; then
2215 elif compile_prog "" "-ll" "lex"; then
2224 # Check if lex fails using -o
2225 if test "$arith" = "yes" ; then
2226 if test "$force_no_lex_o" = "yes" ; then
2229 if lex -o lex.yy.c exp/expression-parser.l 2> /dev/null; then
2237 print_config "lex/yacc for arithmetic" "$arith"
2239 ##########################################
2240 # Check whether we have setmntent/getmntent
2241 if test "$getmntent" != "yes" ; then
2247 int main(int argc, char **argv)
2249 FILE *mtab = setmntent(NULL, "r");
2250 struct mntent *mnt = getmntent(mtab);
2255 if compile_prog "" "" "getmntent"; then
2258 print_config "getmntent" "$getmntent"
2260 ##########################################
2261 # Check whether we have getmntinfo
2262 # These are originally added for BSDs, but may also work
2263 # on other operating systems with getmntinfo(3).
2265 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
2266 # Note that NetBSD needs -Werror to catch warning as error.
2267 if test "$getmntinfo" != "yes" ; then
2272 #include <sys/param.h>
2273 #include <sys/mount.h>
2274 int main(int argc, char **argv)
2277 return getmntinfo(&st, MNT_NOWAIT);
2280 if compile_prog "-Werror" "" "getmntinfo"; then
2283 print_config "getmntinfo" "$getmntinfo"
2285 # getmntinfo(3) for NetBSD.
2286 if test "$getmntinfo_statvfs" != "yes" ; then
2287 getmntinfo_statvfs="no"
2291 #include <sys/statvfs.h>
2292 int main(int argc, char **argv)
2295 return getmntinfo(&st, MNT_NOWAIT);
2298 # Skip the test if the one with statfs arg is detected.
2299 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2300 getmntinfo_statvfs="yes"
2301 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
2304 ##########################################
2305 # Check whether we have _Static_assert
2306 if test "$static_assert" != "yes" ; then
2318 int main(int argc, char **argv)
2320 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2324 if compile_prog "" "" "static_assert"; then
2327 print_config "Static Assert" "$static_assert"
2329 ##########################################
2330 # Check whether we have bool / stdbool.h
2331 if test "$have_bool" != "yes" ; then
2335 #include <stdbool.h>
2336 int main(int argc, char **argv)
2339 return var != false;
2342 if compile_prog "" "" "bool"; then
2345 print_config "bool" "$have_bool"
2347 ##########################################
2348 # Check whether we have strndup()
2353 int main(int argc, char **argv)
2355 char *res = strndup("test string", 8);
2361 if compile_prog "" "" "strndup"; then
2364 print_config "strndup" "$strndup"
2366 ##########################################
2367 # <valgrind/drd.h> probe
2368 # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is
2369 # also available but not the other way around.
2370 if test "$valgrind_dev" != "yes" ; then
2374 #include <valgrind/drd.h>
2375 int main(int argc, char **argv)
2380 if compile_prog "" "" "valgrind_dev"; then
2383 print_config "Valgrind headers" "$valgrind_dev"
2385 if test "$targetos" = "Linux" ; then
2386 ##########################################
2387 # <linux/blkzoned.h> probe
2388 if test "$linux_blkzoned" != "yes" ; then
2392 #include <linux/blkzoned.h>
2393 int main(int argc, char **argv)
2398 if compile_prog "" "" "linux_blkzoned"; then
2399 linux_blkzoned="yes"
2401 print_config "Zoned block device support" "$linux_blkzoned"
2403 ##########################################
2404 # Check BLK_ZONE_REP_CAPACITY
2406 #include <linux/blkzoned.h>
2409 return BLK_ZONE_REP_CAPACITY;
2412 if compile_prog "" "" "blkzoned report capacity"; then
2413 output_sym "CONFIG_HAVE_REP_CAPACITY"
2418 print_config "Zoned block device capacity" "$rep_capacity"
2421 ##########################################
2424 #include <libzbc/zbc.h>
2425 int main(int argc, char **argv)
2427 struct zbc_device *dev = NULL;
2429 return zbc_open("foo=bar", O_RDONLY, &dev);
2432 if test "$libzbc" != "no" ; then
2433 if compile_prog "" "-lzbc" "libzbc"; then
2435 if ! check_min_lib_version libzbc 5; then
2439 if test "$libzbc" = "yes" ; then
2440 feature_not_found "libzbc" "libzbc or libzbc/zbc.h"
2445 print_config "libzbc engine" "$libzbc"
2447 ##########################################
2448 # check march=armv8-a+crc+crypto
2449 if test "$march_armv8_a_crc_crypto" != "yes" ; then
2450 march_armv8_a_crc_crypto="no"
2452 if test "$cpu" = "arm64" ; then
2454 #include <arm_acle.h>
2455 #include <arm_neon.h>
2456 #include <sys/auxv.h>
2460 /* Can we also do a runtime probe? */
2462 return getauxval(AT_HWCAP);
2464 # error "Don't know how to do runtime probe for ARM CRC32c"
2468 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
2469 march_armv8_a_crc_crypto="yes"
2470 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
2474 print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2476 ##########################################
2478 if test "$cuda" != "no" ; then
2481 int main(int argc, char **argv)
2486 if compile_prog "" "-lcuda" "cuda"; then
2490 if test "$cuda" = "yes" ; then
2491 feature_not_found "cuda" ""
2496 print_config "cuda" "$cuda"
2498 ##########################################
2500 if test "$libcufile" != "no" ; then
2504 int main(int argc, char* argv[]) {
2509 if compile_prog "" "-lcuda -lcudart -lcufile" "libcufile"; then
2511 LIBS="-lcuda -lcudart -lcufile $LIBS"
2513 if test "$libcufile" = "yes" ; then
2514 feature_not_found "libcufile" ""
2519 print_config "libcufile" "$libcufile"
2521 ##########################################
2522 # check for cc -march=native
2525 int main(int argc, char **argv)
2530 if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2531 compile_prog "-march=native" "" "march=native"; then
2534 print_config "Build march=native" "$build_native"
2536 ##########################################
2538 if test "$cunit" != "yes" ; then
2542 #include <CUnit/CUnit.h>
2543 #include <CUnit/Basic.h>
2546 if (CU_initialize_registry() != CUE_SUCCESS)
2547 return CU_get_error();
2548 CU_basic_set_mode(CU_BRM_VERBOSE);
2549 CU_basic_run_tests();
2550 CU_cleanup_registry();
2551 return CU_get_error();
2554 if compile_prog "" "-lcunit" "CUnit"; then
2557 print_config "CUnit" "$cunit"
2559 ##########################################
2560 # check for __kernel_rwf_t
2563 #include <linux/fs.h>
2564 int main(int argc, char **argv)
2571 if compile_prog "" "" "__kernel_rwf_t"; then
2572 __kernel_rwf_t="yes"
2574 print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2576 ##########################################
2577 # check if gcc has -Wimplicit-fallthrough=2
2580 int main(int argc, char **argv)
2585 if compile_prog "-Wimplicit-fallthrough=2" "" "-Wimplicit-fallthrough=2"; then
2588 print_config "-Wimplicit-fallthrough=2" "$fallthrough"
2590 ##########################################
2591 # check for MADV_HUGEPAGE support
2592 if test "$thp" != "yes" ; then
2595 if test "$esx" != "yes" ; then
2597 #include <sys/mman.h>
2600 return madvise(0, 0x1000, MADV_HUGEPAGE);
2603 if compile_prog "" "" "thp" ; then
2606 if test "$thp" = "yes" ; then
2607 feature_not_found "Transparent Huge Page" ""
2612 print_config "MADV_HUGEPAGE" "$thp"
2614 ##########################################
2615 # check for gettid()
2619 int main(int argc, char **argv)
2624 if compile_prog "" "" "gettid"; then
2627 print_config "gettid" "$gettid"
2629 ##########################################
2630 # check for statx(2) support by libc
2634 #include <sys/stat.h>
2636 int main(int argc, char **argv)
2639 return statx(-1, *argv, 0, 0, &st);
2642 if compile_prog "" "" "statx"; then
2645 print_config "statx(2)/libc" "$statx"
2647 ##########################################
2648 # check for statx(2) support by kernel
2652 #include <linux/stat.h>
2653 #include <sys/stat.h>
2654 #include <sys/syscall.h>
2656 static int _statx(int dfd, const char *pathname, int flags, unsigned int mask,
2657 struct statx *buffer)
2659 return syscall(__NR_statx, dfd, pathname, flags, mask, buffer);
2662 int main(int argc, char **argv)
2665 return _statx(-1, *argv, 0, 0, &st);
2668 if compile_prog "" "" "statx_syscall"; then
2671 print_config "statx(2)/syscall" "$statx_syscall"
2673 ##########################################
2674 # check for Windows PDB generation support
2675 if test "pdb" != "no" ; then
2682 if compile_prog "-g -gcodeview" "-fuse-ld=lld -Wl,-pdb,$TMPO" "pdb"; then
2685 if test "$pdb" = "yes"; then
2686 feature_not_found "PDB" "clang and lld"
2693 print_config "Windows PDB generation" "$pdb"
2695 ##########################################
2696 # check for timerfd support
2698 if test "$esx" != "yes" ; then
2700 #include <sys/time.h>
2701 #include <sys/timerfd.h>
2703 int main(int argc, char **argv)
2705 return timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
2708 if compile_prog "" "" "timerfd_create"; then
2709 timerfd_create="yes"
2712 print_config "timerfd_create" "$timerfd_create"
2714 #############################################################################
2716 if test "$wordsize" = "64" ; then
2717 output_sym "CONFIG_64BIT"
2718 elif test "$wordsize" = "32" ; then
2719 output_sym "CONFIG_32BIT"
2721 fatal "Unknown wordsize!"
2723 if test "$bigendian" = "yes" ; then
2724 output_sym "CONFIG_BIG_ENDIAN"
2726 output_sym "CONFIG_LITTLE_ENDIAN"
2728 if test "$zlib" = "yes" ; then
2729 output_sym "CONFIG_ZLIB"
2731 if test "$libaio" = "yes" ; then
2732 output_sym "CONFIG_LIBAIO"
2733 if test "$libaio_rw_flags" = "yes" ; then
2734 output_sym "CONFIG_LIBAIO_RW_FLAGS"
2737 if test "$posix_aio" = "yes" ; then
2738 output_sym "CONFIG_POSIXAIO"
2740 if test "$posix_aio_fsync" = "yes" ; then
2741 output_sym "CONFIG_POSIXAIO_FSYNC"
2743 if test "$posix_pshared" = "yes" ; then
2744 output_sym "CONFIG_PSHARED"
2746 if test "$pthread_condattr_setclock" = "yes" ; then
2747 output_sym "CONFIG_PTHREAD_CONDATTR_SETCLOCK"
2749 if test "$pthread_sigmask" = "yes" ; then
2750 output_sym "CONFIG_PTHREAD_SIGMASK"
2752 if test "$have_asprintf" = "yes" ; then
2753 output_sym "CONFIG_HAVE_ASPRINTF"
2755 if test "$have_vasprintf" = "yes" ; then
2756 output_sym "CONFIG_HAVE_VASPRINTF"
2758 if test "$linux_fallocate" = "yes" ; then
2759 output_sym "CONFIG_LINUX_FALLOCATE"
2761 if test "$posix_fallocate" = "yes" ; then
2762 output_sym "CONFIG_POSIX_FALLOCATE"
2764 if test "$fdatasync" = "yes" ; then
2765 output_sym "CONFIG_FDATASYNC"
2767 if test "$pipe" = "yes" ; then
2768 output_sym "CONFIG_PIPE"
2770 if test "$pipe2" = "yes" ; then
2771 output_sym "CONFIG_PIPE2"
2773 if test "$pread" = "yes" ; then
2774 output_sym "CONFIG_PREAD"
2776 if test "$sync_file_range" = "yes" ; then
2777 output_sym "CONFIG_SYNC_FILE_RANGE"
2779 if test "$sfaa" = "yes" ; then
2780 output_sym "CONFIG_SFAA"
2782 if test "$sync_sync" = "yes" ; then
2783 output_sym "CONFIG_SYNC_SYNC"
2785 if test "$cmp_swap" = "yes" ; then
2786 output_sym "CONFIG_CMP_SWAP"
2788 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2789 output_sym "CONFIG_RDMA"
2791 if test "$clock_gettime" = "yes" ; then
2792 output_sym "CONFIG_CLOCK_GETTIME"
2794 if test "$clock_monotonic" = "yes" ; then
2795 output_sym "CONFIG_CLOCK_MONOTONIC"
2797 if test "$clock_monotonic_raw" = "yes" ; then
2798 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2800 if test "$clock_monotonic_precise" = "yes" ; then
2801 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2803 if test "$clockid_t" = "yes"; then
2804 output_sym "CONFIG_CLOCKID_T"
2806 if test "$gettimeofday" = "yes" ; then
2807 output_sym "CONFIG_GETTIMEOFDAY"
2809 if test "$posix_fadvise" = "yes" ; then
2810 output_sym "CONFIG_POSIX_FADVISE"
2812 if test "$linux_3arg_affinity" = "yes" ; then
2813 output_sym "CONFIG_3ARG_AFFINITY"
2814 elif test "$linux_2arg_affinity" = "yes" ; then
2815 output_sym "CONFIG_2ARG_AFFINITY"
2817 if test "$strsep" = "yes" ; then
2818 output_sym "CONFIG_STRSEP"
2820 if test "$strcasestr" = "yes" ; then
2821 output_sym "CONFIG_STRCASESTR"
2823 if test "$strlcat" = "yes" ; then
2824 output_sym "CONFIG_STRLCAT"
2826 if test "$getopt_long_only" = "yes" ; then
2827 output_sym "CONFIG_GETOPT_LONG_ONLY"
2829 if test "$inet_aton" = "yes" ; then
2830 output_sym "CONFIG_INET_ATON"
2832 if test "$socklen_t" = "yes" ; then
2833 output_sym "CONFIG_SOCKLEN_T"
2835 if test "$ext4_me" = "yes" ; then
2836 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2838 if test "$linux_splice" = "yes" ; then
2839 output_sym "CONFIG_LINUX_SPLICE"
2841 if test "$libnuma_v2" = "yes" ; then
2842 output_sym "CONFIG_LIBNUMA"
2844 if test "$solaris_aio" = "yes" ; then
2845 output_sym "CONFIG_SOLARISAIO"
2847 if test "$tls_thread" = "yes" ; then
2848 output_sym "CONFIG_TLS_THREAD"
2850 if test "$rusage_thread" = "yes" ; then
2851 output_sym "CONFIG_RUSAGE_THREAD"
2853 if test "$gfio" = "yes" ; then
2854 output_sym "CONFIG_GFIO"
2856 if test "$esx" = "yes" ; then
2857 output_sym "CONFIG_ESX"
2858 output_sym "CONFIG_NO_SHM"
2860 if test "$sched_idle" = "yes" ; then
2861 output_sym "CONFIG_SCHED_IDLE"
2863 if test "$tcp_nodelay" = "yes" ; then
2864 output_sym "CONFIG_TCP_NODELAY"
2866 if test "$window_size" = "yes" ; then
2867 output_sym "CONFIG_NET_WINDOWSIZE"
2869 if test "$mss" = "yes" ; then
2870 output_sym "CONFIG_NET_MSS"
2872 if test "$rlimit_memlock" = "yes" ; then
2873 output_sym "CONFIG_RLIMIT_MEMLOCK"
2875 if test "$pwritev" = "yes" ; then
2876 output_sym "CONFIG_PWRITEV"
2878 if test "$pwritev2" = "yes" ; then
2879 output_sym "CONFIG_PWRITEV2"
2881 if test "$ipv6" = "yes" ; then
2882 output_sym "CONFIG_IPV6"
2884 if test "$http" = "yes" ; then
2885 output_sym "CONFIG_HTTP"
2887 if test "$rados" = "yes" ; then
2888 output_sym "CONFIG_RADOS"
2890 if test "$rbd" = "yes" ; then
2891 output_sym "CONFIG_RBD"
2893 if test "$rbd_poll" = "yes" ; then
2894 output_sym "CONFIG_RBD_POLL"
2896 if test "$rbd_inval" = "yes" ; then
2897 output_sym "CONFIG_RBD_INVAL"
2899 if test "$setvbuf" = "yes" ; then
2900 output_sym "CONFIG_SETVBUF"
2902 if test "$s390_z196_facilities" = "yes" ; then
2903 output_sym "CONFIG_S390_Z196_FACILITIES"
2904 CFLAGS="$CFLAGS -march=z9-109"
2907 if test "$gfapi" = "yes" ; then
2908 output_sym "CONFIG_GFAPI"
2910 if test "$gf_fadvise" = "yes" ; then
2911 output_sym "CONFIG_GF_FADVISE"
2913 if test "$gf_trim" = "yes" ; then
2914 output_sym "CONFIG_GF_TRIM"
2916 if test "$gf_new" = "yes" ; then
2917 output_sym "CONFIG_GF_NEW_API"
2919 if test "$libhdfs" = "yes" ; then
2920 output_sym "CONFIG_LIBHDFS"
2921 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2922 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2923 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2924 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2926 if test "$mtd" = "yes" ; then
2927 output_sym "CONFIG_MTD"
2929 if test "$pmemblk" = "yes" ; then
2930 output_sym "CONFIG_PMEMBLK"
2932 if test "$devdax" = "yes" ; then
2933 output_sym "CONFIG_LINUX_DEVDAX"
2935 if test "$pmem" = "yes" ; then
2936 output_sym "CONFIG_LIBPMEM"
2938 if test "$libime" = "yes" ; then
2939 output_sym "CONFIG_IME"
2941 if test "$arith" = "yes" ; then
2942 output_sym "CONFIG_ARITHMETIC"
2943 if test "$yacc_is_bison" = "yes" ; then
2944 echo "YACC=bison -y" >> $config_host_mak
2946 echo "YACC=yacc" >> $config_host_mak
2948 if test "$lex_use_o" = "yes" ; then
2949 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2952 if test "$getmntent" = "yes" ; then
2953 output_sym "CONFIG_GETMNTENT"
2955 if test "$getmntinfo" = "yes" ; then
2956 output_sym "CONFIG_GETMNTINFO"
2958 if test "$getmntinfo_statvfs" = "yes" ; then
2959 output_sym "CONFIG_GETMNTINFO_STATVFS"
2961 if test "$static_assert" = "yes" ; then
2962 output_sym "CONFIG_STATIC_ASSERT"
2964 if test "$have_bool" = "yes" ; then
2965 output_sym "CONFIG_HAVE_BOOL"
2967 if test "$strndup" = "yes" ; then
2968 output_sym "CONFIG_HAVE_STRNDUP"
2970 if test "$disable_opt" = "yes" ; then
2971 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2973 if test "$valgrind_dev" = "yes"; then
2974 output_sym "CONFIG_VALGRIND_DEV"
2976 if test "$linux_blkzoned" = "yes" ; then
2977 output_sym "CONFIG_HAS_BLKZONED"
2979 if test "$libzbc" = "yes" ; then
2980 output_sym "CONFIG_LIBZBC"
2982 if test "$zlib" = "no" ; then
2983 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2984 if test "$build_static" = "yes"; then
2985 echo "Note that some distros have separate packages for static libraries."
2988 if test "$march_armv8_a_crc_crypto" = "yes" ; then
2989 output_sym "ARCH_HAVE_CRC_CRYPTO"
2991 if test "$cuda" = "yes" ; then
2992 output_sym "CONFIG_CUDA"
2994 if test "$libcufile" = "yes" ; then
2995 output_sym "CONFIG_LIBCUFILE"
2997 if test "$march_set" = "no" && test "$build_native" = "yes" ; then
2998 output_sym "CONFIG_BUILD_NATIVE"
3000 if test "$cunit" = "yes" ; then
3001 output_sym "CONFIG_HAVE_CUNIT"
3003 if test "$__kernel_rwf_t" = "yes"; then
3004 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
3006 if test "$gettid" = "yes"; then
3007 output_sym "CONFIG_HAVE_GETTID"
3009 if test "$statx" = "yes"; then
3010 output_sym "CONFIG_HAVE_STATX"
3012 if test "$statx_syscall" = "yes"; then
3013 output_sym "CONFIG_HAVE_STATX_SYSCALL"
3015 if test "$timerfd_create" = "yes"; then
3016 output_sym "CONFIG_HAVE_TIMERFD_CREATE"
3018 if test "$fallthrough" = "yes"; then
3019 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
3021 if test "$thp" = "yes" ; then
3022 output_sym "CONFIG_HAVE_THP"
3024 if test "$libiscsi" = "yes" ; then
3025 output_sym "CONFIG_LIBISCSI"
3026 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
3027 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
3028 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
3030 if test "$libnbd" = "yes" ; then
3031 output_sym "CONFIG_LIBNBD"
3032 echo "CONFIG_LIBNBD=m" >> $config_host_mak
3033 echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak
3034 echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak
3036 if test "$dynamic_engines" = "yes" ; then
3037 output_sym "CONFIG_DYNAMIC_ENGINES"
3039 if test "$pdb" = yes; then
3040 output_sym "CONFIG_PDB"
3043 print_config "Lib-based ioengines dynamic" "$dynamic_engines"
3045 int main(int argc, char **argv)
3050 if test "$disable_tcmalloc" != "yes"; then
3051 if compile_prog "" "-ltcmalloc" "tcmalloc"; then
3053 LIBS="-ltcmalloc $LIBS"
3054 elif compile_prog "" "-l:libtcmalloc_minimal.so.4" "tcmalloc_minimal4"; then
3056 LIBS="-l:libtcmalloc_minimal.so.4 $LIBS"
3061 print_config "TCMalloc support" "$tcmalloc"
3063 echo "LIBS+=$LIBS" >> $config_host_mak
3064 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
3065 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
3066 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
3067 echo "CC=$cc" >> $config_host_mak
3068 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
3069 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
3071 if [ `dirname $0` != "." -a ! -e Makefile ]; then
3072 cat > Makefile <<EOF
3073 SRCDIR:=`dirname $0`
3074 include \$(SRCDIR)/Makefile