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
120 echo "$1" | grep -E -q "^[0-9]+$"
126 #error $1 not defined
144 #error $1 is not equal $2
151 echo "$1=y" >> $config_host_mak
152 echo "#define $1" >> $config_host_h
155 check_min_lib_version() {
158 if "${cross_prefix}"pkg-config --atleast-version="$2" "$1" > /dev/null 2>&1; then
161 : "${_feature:=${1}}"
162 if "${cross_prefix}"pkg-config --version > /dev/null 2>&1; then
163 if test "$(eval echo \"\$$_feature\")" = "yes" ; then
164 feature_not_found "$_feature" "$1 >= $2"
167 print_config "$1" "missing pkg-config, can't check $_feature version"
202 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
204 --prefix=*) prefix="$optarg"
206 --cpu=*) cpu="$optarg"
208 # esx is cross compiled and cannot be detect through simple uname calls
214 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
216 --build-32bit-win) build_32bit_win="yes"
218 --target-win-ver=*) target_win_ver="$optarg"
220 --enable-pdb) pdb="yes"
222 --build-static) build_static="yes"
224 --enable-gfio) gfio_check="yes"
226 --disable-numa) disable_numa="yes"
228 --disable-rdma) disable_rdma="yes"
230 --disable-rados) disable_rados="yes"
232 --disable-rbd) disable_rbd="yes"
234 --disable-http) disable_http="yes"
236 --disable-gfapi) disable_gfapi="yes"
238 --enable-libhdfs) libhdfs="yes"
240 --disable-lex) disable_lex="yes"
242 --enable-lex) disable_lex="no"
244 --disable-shm) no_shm="yes"
246 --disable-optimizations) disable_opt="yes"
248 --disable-pmem) disable_pmem="yes"
250 --enable-cuda) cuda="yes"
252 --enable-libcufile) libcufile="yes"
254 --disable-native) disable_native="yes"
256 --with-ime=*) ime_path="$optarg"
258 --enable-libiscsi) libiscsi="yes"
260 --enable-libnbd) libnbd="yes"
262 --disable-libzbc) libzbc="no"
264 --disable-xnvme) xnvme="no"
266 --disable-isal) isal="no"
268 --disable-libblkio) libblkio="no"
270 --disable-tcmalloc) disable_tcmalloc="yes"
272 --disable-libnfs) libnfs="no"
274 --enable-libnfs) libnfs="yes"
276 --dynamic-libengines) dynamic_engines="yes"
278 --disable-dfs) dfs="no"
280 --enable-asan) asan="yes"
282 --seed-buckets=*) seed_buckets="$optarg"
284 --disable-tls) tls_check="no"
290 echo "Bad option $opt"
296 if test "$show_help" = "yes" ; then
297 echo "--prefix= Use this directory as installation prefix"
298 echo "--cpu= Specify target CPU if auto-detect fails"
299 echo "--cc= Specify compiler to use"
300 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
301 echo "--build-32bit-win Enable 32-bit build on Windows"
302 echo "--target-win-ver= Minimum version of Windows to target (only accepts 7)"
303 echo "--enable-pdb Enable Windows PDB symbols generation (needs clang/lld)"
304 echo "--build-static Build a static fio"
305 echo "--esx Configure build options for esx"
306 echo "--enable-gfio Enable building of gtk gfio"
307 echo "--disable-numa Disable libnuma even if found"
308 echo "--disable-rdma Disable RDMA support even if found"
309 echo "--disable-rados Disable Rados support even if found"
310 echo "--disable-rbd Disable Rados Block Device even if found"
311 echo "--disable-http Disable HTTP support even if found"
312 echo "--disable-gfapi Disable gfapi"
313 echo "--enable-libhdfs Enable hdfs support"
314 echo "--enable-libnfs Enable nfs support"
315 echo "--disable-libnfs Disable nfs support"
316 echo "--disable-lex Disable use of lex/yacc for math"
317 echo "--disable-pmem Disable pmem based engines even if found"
318 echo "--enable-lex Enable use of lex/yacc for math"
319 echo "--disable-shm Disable SHM support"
320 echo "--disable-optimizations Don't enable compiler optimizations"
321 echo "--enable-cuda Enable GPUDirect RDMA support"
322 echo "--enable-libcufile Enable GPUDirect Storage cuFile support"
323 echo "--disable-native Don't build for native host"
324 echo "--with-ime= Install path for DDN's Infinite Memory Engine"
325 echo "--enable-libiscsi Enable iscsi support"
326 echo "--enable-libnbd Enable libnbd (NBD engine) support"
327 echo "--disable-xnvme Disable xnvme support even if found"
328 echo "--disable-isal Disable isal support even if found"
329 echo "--disable-libblkio Disable libblkio support even if found"
330 echo "--disable-libzbc Disable libzbc even if found"
331 echo "--disable-tcmalloc Disable tcmalloc support"
332 echo "--dynamic-libengines Lib-based ioengines as dynamic libraries"
333 echo "--disable-dfs Disable DAOS File System support even if found"
334 echo "--enable-asan Enable address sanitizer"
335 echo "--seed-buckets= Number of seed buckets for the refill-buffer"
336 echo "--disable-tls Disable __thread local storage"
340 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
341 # Preferred compiler (can be overridden later after we know the platform):
343 # ${cross_prefix}gcc (if cross-prefix specified)
346 if test -z "${CC}${cross_prefix}"; then
353 cc="${CC-${cross_prefix}gcc}"
356 if check_define __ANDROID__ ; then
358 elif check_define __linux__ ; then
360 elif check_define __OpenBSD__ ; then
362 elif check_define __NetBSD__ ; then
364 elif check_define __sun__ ; then
366 CFLAGS="$CFLAGS -D_REENTRANT"
367 elif check_define _WIN32 ; then
373 echo "# Automatically generated by configure - do not modify" > $config_host_mak
374 printf "# Configured with:" >> $config_host_mak
375 printf " '%s'" "$0" "$@" >> $config_host_mak
376 echo >> $config_host_mak
377 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
379 if test "$no_shm" = "yes" ; then
380 output_sym "CONFIG_NO_SHM"
383 if test "$disable_opt" = "yes" ; then
384 output_sym "CONFIG_FIO_NO_OPT"
387 # Some host OSes need non-standard checks for which CPU to use.
388 # Note that these checks are broken for cross-compilation: if you're
389 # cross-compiling to one of these OSes then you'll need to specify
390 # the correct CPU with the --cpu option.
393 # Unless explicitly enabled, turn off lex.
394 # OpenBSD will hit syntax error when enabled.
395 if test -z "$disable_lex" ; then
402 CFLAGS="$CFLAGS -I/usr/local/include"
403 LDFLAGS="$LDFLAGS -L/usr/local/lib"
406 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
407 # we can run 64-bit userspace code.
408 # If the user didn't specify a CPU explicitly and the kernel says this is
409 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
411 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
414 # Avoid configure feature detection of features provided by weak symbols
421 if compile_prog "" "-Werror=partial-availability" "error on weak symbols"; then
422 CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Werror=partial-availability"
426 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
427 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
430 LIBS="-lnsl -lsocket"
433 # We still force some options, so keep this message here.
434 echo "Forcing some known good options on Windows"
435 if test -z "${CC}${cross_prefix}"; then
436 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
437 cc="i686-w64-mingw32-gcc"
439 cc="x86_64-w64-mingw32-gcc"
443 target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]')
444 if test -z "$target_win_ver"; then
445 # Default Windows API target
448 if test "$target_win_ver" = "7"; then
449 output_sym "CONFIG_WINDOWS_7"
450 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601"
452 fatal "Unknown target Windows version"
455 # We need this to be output_sym'd here because this is Windows specific.
456 # The regular configure path never sets this config.
457 output_sym "CONFIG_WINDOWSAIO"
458 # We now take the regular configuration path without having exit 0 here.
459 # Flags below are still necessary mostly for MinGW.
463 clock_gettime="yes" # clock_monotonic probe has dependency on this
464 clock_monotonic="yes"
466 pthread_condattr_setclock="no"
467 pthread_affinity="no"
471 # Now we know the target platform we can have another guess at the preferred
472 # compiler when it wasn't explictly set
473 if test -z "${CC}${cross_prefix}"; then
474 if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
480 if test -z "$cc"; then
481 echo "configure: failed to find compiler"
485 if test ! -z "$cpu" ; then
486 # command line argument
488 elif check_define __i386__ ; then
490 elif check_define __x86_64__ ; then
492 elif check_define __sparc__ ; then
493 if check_define __arch64__ ; then
498 elif check_define _ARCH_PPC ; then
499 if check_define _ARCH_PPC64 ; then
504 elif check_define __mips__ ; then
506 elif check_define __ia64__ ; then
508 elif check_define __s390__ ; then
509 if check_define __s390x__ ; then
514 elif check_define __arm__ ; then
516 elif check_define __aarch64__ ; then
518 elif check_define __hppa__ ; then
520 elif check_define __loongarch64 ; then
522 elif check_define __riscv ; then
523 if check_val __riscv_xlen 32 ; then
525 elif check_val __riscv_xlen 64 ; then
527 elif check_val __riscv_xlen 128 ; then
534 # Normalise host CPU name and set ARCH.
536 ia64|ppc|ppc64|s390|s390x|sparc64|loongarch64|riscv64)
539 i386|i486|i586|i686|i86pc|BePC)
551 hppa|parisc|parisc64)
565 ##########################################
566 # check cross compile
568 if test "$cross_compile" != "yes" ; then
577 if compile_prog "" "" "cross"; then
578 $TMPE 2>/dev/null || cross_compile="yes"
580 fatal "compile test failed"
583 ##########################################
585 if test "$bigendian" != "yes" ; then
588 if test "$cross_compile" = "no" ; then
590 #include <inttypes.h>
593 volatile uint32_t i=0x01234567;
594 return (*((uint8_t*)(&i))) == 0x67;
597 if compile_prog "" "" "endian"; then
598 $TMPE && bigendian="yes"
601 # If we're cross compiling, try our best to work it out and rely on the
602 # run-time check to fail if we get it wrong.
607 #if __BYTE_ORDER != __BIG_ENDIAN
608 # error "Unknown endianness"
612 compile_prog "" "" "endian" && bigendian="yes"
613 check_define "__ARMEB__" && bigendian="yes"
614 check_define "__MIPSEB__" && bigendian="yes"
618 print_config "Operating system" "$targetos"
619 print_config "CPU" "$cpu"
620 print_config "Big endian" "$bigendian"
621 if test ! -z "$target_win_ver"; then
622 print_config "Target Windows version" "$target_win_ver"
624 print_config "Compiler" "$cc"
625 print_config "Cross compile" "$cross_compile"
628 ##########################################
629 # See if we need to build a static build
630 if test "$build_static" = "yes" ; then
631 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
632 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
636 print_config "Static build" "$build_static"
638 ##########################################
639 # check for C11 atomics support
641 #include <stdatomic.h>
649 if ! compile_prog "" "" "C11 atomics"; then
651 echo "Your compiler doesn't support C11 atomics. gcc 4.9/clang 3.6 are the"
652 echo "minimum versions with it - perhaps your compiler is too old?"
653 fatal "C11 atomics support not found"
657 ##########################################
662 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
665 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
669 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
671 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
674 fatal "Unknown wordsize"
676 print_config "Wordsize" "$wordsize"
678 ##########################################
680 if test "$zlib" != "yes" ; then
688 if (inflateInit(&stream) != Z_OK)
693 if compile_prog "" "-lz" "zlib" ; then
697 print_config "zlib" "$zlib"
699 ##########################################
700 # fcntl(F_FULLFSYNC) support
701 if test "$fcntl_sync" != "yes" ; then
708 int main(int argc, char **argv)
710 return fcntl(0, F_FULLFSYNC);
713 if compile_prog "" "" "fcntl(F_FULLFSYNC)" ; then
716 print_config "fcntl(F_FULLFSYNC)" "$fcntl_sync"
718 ##########################################
720 if test "$libaio" != "yes" ; then
723 if test "$esx" != "yes" ; then
733 if compile_prog "" "-laio" "libaio" ; then
736 if test "$libaio" = "yes" ; then
737 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
747 io_prep_preadv2(NULL, 0, NULL, 0, 0, 0);
748 io_prep_pwritev2(NULL, 0, NULL, 0, 0, 0);
752 if compile_prog "" "" "libaio rw flags" ; then
758 print_config "Linux AIO support" "$libaio"
759 print_config "Linux AIO support rw flags" "$libaio_rw_flags"
761 ##########################################
763 if test "$posix_aio" != "yes" ; then
766 if test "$posix_aio_lrt" != "yes" ; then
778 if compile_prog "" "" "posixaio" ; then
780 elif compile_prog "" "-lrt" "posixaio -lrt"; then
785 print_config "POSIX AIO support" "$posix_aio"
786 print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
788 ##########################################
789 # posix aio fsync probe
790 if test "$posix_aio_fsync" != "yes" ; then
793 if test "$posix_aio" = "yes" ; then
800 return aio_fsync(O_SYNC, &cb);
804 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
808 print_config "POSIX AIO fsync" "$posix_aio_fsync"
810 ##########################################
811 # POSIX pshared attribute probe
812 if test "$posix_pshared" != "yes" ; then
819 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
820 # if defined(__CYGWIN__)
821 # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
822 # elif defined(__APPLE__)
823 # include <AvailabilityMacros.h>
824 # include <TargetConditionals.h>
825 # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
826 # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
830 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
835 if compile_prog "" "$LIBS" "posix_pshared" ; then
838 print_config "POSIX pshared support" "$posix_pshared"
840 ##########################################
841 # POSIX pthread_condattr_setclock() probe
842 if test "$pthread_condattr_setclock" != "no" ; then
847 pthread_condattr_t condattr;
848 pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
852 if compile_prog "" "$LIBS" "pthread_condattr_setclock" ; then
853 pthread_condattr_setclock=yes
854 elif compile_prog "" "$LIBS -lpthread" "pthread_condattr_setclock" ; then
855 pthread_condattr_setclock=yes
856 LIBS="$LIBS -lpthread"
859 print_config "pthread_condattr_setclock()" "$pthread_condattr_setclock"
861 ##########################################
862 # pthread_sigmask() probe
863 if test "$pthread_sigmask" != "yes" ; then
867 #include <stddef.h> /* NULL */
868 #include <signal.h> /* pthread_sigmask() */
872 return pthread_sigmask(0, NULL, &sigmask);
875 if compile_prog "" "$LIBS" "pthread_sigmask" ; then
877 elif compile_prog "" "$LIBS -lpthread" "pthread_sigmask" ; then
879 LIBS="$LIBS -lpthread"
881 print_config "pthread_sigmask()" "$pthread_sigmask"
883 ##########################################
884 # pthread_getaffinity_np() probe
885 if test "$pthread_getaffinity" != "yes" ; then
886 pthread_getaffinity="no"
889 #include <stddef.h> /* NULL */
890 #include <signal.h> /* pthread_sigmask() */
895 return pthread_getaffinity_np(pthread_self(), sizeof(set), &set);
898 if compile_prog "" "$LIBS" "pthread_getaffinity" ; then
899 pthread_getaffinity="yes"
900 elif compile_prog "" "$LIBS -lpthread" "pthread_getaffinity" ; then
901 pthread_getaffinity="yes"
902 LIBS="$LIBS -lpthread"
904 print_config "pthread_getaffinity_np()" "$pthread_getaffinity"
906 ##########################################
908 if test "$solaris_aio" != "yes" ; then
912 #include <sys/types.h>
913 #include <sys/asynch.h>
918 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
922 if compile_prog "" "-laio" "solarisaio" ; then
926 print_config "Solaris AIO support" "$solaris_aio"
928 ##########################################
929 # __sync_fetch_and_add test
930 if test "$sfaa" != "yes" ; then
934 #include <inttypes.h>
935 static int sfaa(uint64_t *ptr)
937 return __sync_fetch_and_add(ptr, 0);
940 int main(int argc, char **argv)
947 if compile_prog "" "" "__sync_fetch_and_add()" ; then
950 print_config "__sync_fetch_and_add" "$sfaa"
952 ##########################################
953 # __sync_synchronize() test
954 if test "$sync_sync" != "yes" ; then
958 #include <inttypes.h>
960 int main(int argc, char **argv)
962 __sync_synchronize();
966 if compile_prog "" "" "__sync_synchronize()" ; then
969 print_config "__sync_synchronize" "$sync_sync"
971 ##########################################
972 # __sync_val_compare_and_swap() test
973 if test "$cmp_swap" != "yes" ; then
977 #include <inttypes.h>
979 int main(int argc, char **argv)
982 return __sync_val_compare_and_swap(&x, 1, 2);
985 if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
988 print_config "__sync_val_compare_and_swap" "$cmp_swap"
990 ##########################################
992 if test "$libverbs" != "yes" ; then
996 #include <infiniband/verbs.h>
997 int main(int argc, char **argv)
999 struct ibv_pd *pd = ibv_alloc_pd(NULL);
1003 if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
1006 print_config "libverbs" "$libverbs"
1008 ##########################################
1010 if test "$rdmacm" != "yes" ; then
1015 #include <rdma/rdma_cma.h>
1016 int main(int argc, char **argv)
1018 rdma_destroy_qp(NULL);
1022 if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
1025 print_config "rdmacm" "$rdmacm"
1027 ##########################################
1029 # The librpma engines require librpma>=v0.11.0 with rpma_cq_get_wc().
1030 if test "$librpma" != "yes" ; then
1034 #include <librpma.h>
1037 void *ptr = rpma_cq_get_wc;
1038 (void) ptr; /* unused */
1042 if test "$disable_rdma" != "yes" && compile_prog "" "-lrpma" "rpma"; then
1045 print_config "librpma" "$librpma"
1047 ##########################################
1048 # libprotobuf-c probe
1049 if test "$libprotobuf_c" != "yes" ; then
1054 #include <protobuf-c/protobuf-c.h>
1055 #if !defined(PROTOBUF_C_VERSION_NUMBER)
1056 # error PROTOBUF_C_VERSION_NUMBER is not defined!
1058 int main(int argc, char **argv)
1060 (void)protobuf_c_message_check(NULL);
1064 if compile_prog "" "-lprotobuf-c" "protobuf_c"; then
1067 print_config "libprotobuf_c" "$libprotobuf_c"
1069 ##########################################
1070 # asprintf() and vasprintf() probes
1071 if test "$have_asprintf" != "yes" ; then
1077 int main(int argc, char **argv)
1080 return asprintf(&buf, "%s", "str") == 0;
1083 if compile_prog "" "" "have_asprintf"; then
1086 print_config "asprintf()" "$have_asprintf"
1088 if test "$have_vasprintf" != "yes" ; then
1094 int main(int argc, char **argv)
1098 return vasprintf(&buf, "%s", ap) == 0;
1101 if compile_prog "" "" "have_vasprintf"; then
1102 have_vasprintf="yes"
1104 print_config "vasprintf()" "$have_vasprintf"
1106 ##########################################
1107 # Linux fallocate probe
1108 if test "$linux_fallocate" != "yes" ; then
1109 linux_fallocate="no"
1114 #include <linux/falloc.h>
1115 int main(int argc, char **argv)
1117 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
1121 if compile_prog "" "" "linux_fallocate"; then
1122 linux_fallocate="yes"
1124 print_config "Linux fallocate" "$linux_fallocate"
1126 ##########################################
1127 # POSIX fadvise probe
1128 if test "$posix_fadvise" != "yes" ; then
1134 int main(int argc, char **argv)
1136 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
1140 if compile_prog "" "" "posix_fadvise"; then
1143 print_config "POSIX fadvise" "$posix_fadvise"
1145 ##########################################
1146 # POSIX fallocate probe
1147 if test "$posix_fallocate" != "yes" ; then
1148 posix_fallocate="no"
1153 int main(int argc, char **argv)
1155 int r = posix_fallocate(0, 0, 1024);
1159 if compile_prog "" "" "posix_fallocate"; then
1160 posix_fallocate="yes"
1162 print_config "POSIX fallocate" "$posix_fallocate"
1164 ##########################################
1165 # sched_set/getaffinity 2 or 3 argument test
1166 if test "$linux_2arg_affinity" != "yes" ; then
1167 linux_2arg_affinity="no"
1169 if test "$linux_3arg_affinity" != "yes" ; then
1170 linux_3arg_affinity="no"
1174 int main(int argc, char **argv)
1176 cpu_set_t mask = { };
1178 return sched_setaffinity(0, sizeof(mask), &mask);
1181 if compile_prog "" "" "sched_setaffinity(,,)"; then
1182 linux_3arg_affinity="yes"
1186 int main(int argc, char **argv)
1188 cpu_set_t mask = { };
1190 return sched_setaffinity(0, &mask);
1193 if compile_prog "" "" "sched_setaffinity(,)"; then
1194 linux_2arg_affinity="yes"
1197 print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
1198 print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
1200 ##########################################
1201 # clock_gettime probe
1202 if test "$clock_gettime" != "yes" ; then
1208 int main(int argc, char **argv)
1212 return clock_gettime(0, &ts);
1215 if compile_prog "" "" "clock_gettime"; then
1217 elif compile_prog "" "-lrt" "clock_gettime"; then
1221 print_config "clock_gettime" "$clock_gettime"
1223 ##########################################
1224 # CLOCK_MONOTONIC probe
1225 if test "$clock_monotonic" != "yes" ; then
1226 clock_monotonic="no"
1228 if test "$clock_gettime" = "yes" ; then
1232 int main(int argc, char **argv)
1236 return clock_gettime(CLOCK_MONOTONIC, &ts);
1239 if compile_prog "" "$LIBS" "clock monotonic"; then
1240 clock_monotonic="yes"
1243 print_config "CLOCK_MONOTONIC" "$clock_monotonic"
1245 ##########################################
1247 if test "$clockid_t" != "yes" ; then
1253 int main(int argc, char **argv)
1255 volatile clockid_t cid;
1256 memset((void*)&cid, 0, sizeof(cid));
1260 if compile_prog "" "$LIBS" "clockid_t"; then
1263 print_config "clockid_t" "$clockid_t"
1265 ##########################################
1266 # gettimeofday() probe
1267 if test "$gettimeofday" != "yes" ; then
1271 #include <sys/time.h>
1273 int main(int argc, char **argv)
1276 return gettimeofday(&tv, NULL);
1279 if compile_prog "" "" "gettimeofday"; then
1282 print_config "gettimeofday" "$gettimeofday"
1284 ##########################################
1286 if test "$fdatasync" != "yes" ; then
1292 int main(int argc, char **argv)
1294 return fdatasync(0);
1297 if compile_prog "" "" "fdatasync"; then
1300 print_config "fdatasync" "$fdatasync"
1302 ##########################################
1304 if test "$pipe" != "yes" ; then
1309 int main(int argc, char **argv)
1315 if compile_prog "" "" "pipe"; then
1318 print_config "pipe()" "$pipe"
1320 ##########################################
1322 if test "$pipe2" != "yes" ; then
1327 int main(int argc, char **argv)
1330 return pipe2(fd, 0);
1333 if compile_prog "" "" "pipe2"; then
1336 print_config "pipe2()" "$pipe2"
1338 ##########################################
1340 if test "$pread" != "yes" ; then
1345 int main(int argc, char **argv)
1347 return pread(0, NULL, 0, 0);
1350 if compile_prog "" "" "pread"; then
1353 print_config "pread()" "$pread"
1355 ##########################################
1356 # sync_file_range() probe
1357 if test "$sync_file_range" != "yes" ; then
1358 sync_file_range="no"
1364 #include <linux/fs.h>
1365 int main(int argc, char **argv)
1367 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1368 SYNC_FILE_RANGE_WAIT_AFTER;
1369 return sync_file_range(0, 0, 0, flags);
1372 if compile_prog "" "" "sync_file_range"; then
1373 sync_file_range="yes"
1375 print_config "sync_file_range" "$sync_file_range"
1377 ##########################################
1378 # ASharedMemory_create() probe
1379 if test "$ASharedMemory_create" != "yes" ; then
1380 ASharedMemory_create="no"
1383 #include <android/sharedmem.h>
1384 int main(int argc, char **argv)
1386 return ASharedMemory_create("", 0);
1389 if compile_prog "" "" "ASharedMemory_create"; then
1390 ASharedMemory_create="yes"
1392 print_config "ASharedMemory_create" "$ASharedMemory_create"
1394 ##########################################
1395 # ext4 move extent probe
1396 if test "$ext4_me" != "yes" ; then
1401 #include <sys/ioctl.h>
1402 int main(int argc, char **argv)
1404 struct move_extent me;
1405 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1408 if compile_prog "" "" "ext4 move extent" ; then
1410 elif test $targetos = "Linux" ; then
1411 # On Linux, just default to it on and let it error at runtime if we really
1412 # don't have it. None of my updated systems have it defined, but it does
1413 # work. Takes a while to bubble back.
1416 print_config "EXT4 move extent" "$ext4_me"
1418 ##########################################
1420 if test "$linux_splice" != "yes" ; then
1426 int main(int argc, char **argv)
1428 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1431 if compile_prog "" "" "linux splice"; then
1434 print_config "Linux splice(2)" "$linux_splice"
1436 ##########################################
1438 if test "$libnuma" != "yes" ; then
1443 int main(int argc, char **argv)
1445 return numa_available();
1448 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1452 print_config "libnuma" "$libnuma"
1454 ##########################################
1455 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1456 if test "$libnuma" = "yes" ; then
1460 int main(int argc, char **argv)
1462 struct bitmask *mask = numa_parse_nodestring(NULL);
1463 return mask->size == 0;
1466 if compile_prog "" "" "libnuma api"; then
1469 print_config "libnuma v2" "$libnuma_v2"
1472 ##########################################
1474 if test "$strsep" != "yes" ; then
1479 int main(int argc, char **argv)
1481 static char *string = "This is a string";
1482 strsep(&string, "needle");
1486 if compile_prog "" "" "strsep"; then
1489 print_config "strsep" "$strsep"
1491 ##########################################
1492 # strcasestr() probe
1493 if test "$strcasestr" != "yes" ; then
1498 int main(int argc, char **argv)
1500 return strcasestr(argv[0], argv[1]) != NULL;
1503 if compile_prog "" "" "strcasestr"; then
1506 print_config "strcasestr" "$strcasestr"
1508 ##########################################
1510 if test "$strlcat" != "yes" ; then
1515 int main(int argc, char **argv)
1517 static char dst[64];
1518 static char *string = "This is a string";
1519 memset(dst, 0, sizeof(dst));
1520 strlcat(dst, string, sizeof(dst));
1524 if compile_prog "" "" "strlcat"; then
1527 print_config "strlcat" "$strlcat"
1529 ##########################################
1530 # getopt_long_only() probe
1531 if test "$getopt_long_only" != "yes" ; then
1532 getopt_long_only="no"
1538 int main(int argc, char **argv)
1540 int c = getopt_long_only(argc, argv, "", NULL, NULL);
1544 if compile_prog "" "" "getopt_long_only"; then
1545 getopt_long_only="yes"
1547 print_config "getopt_long_only()" "$getopt_long_only"
1549 ##########################################
1551 if test "$inet_aton" != "yes" ; then
1556 #include <winsock2.h>
1558 #include <sys/socket.h>
1559 #include <arpa/inet.h>
1562 int main(int argc, char **argv)
1565 return inet_aton(NULL, &in);
1568 if compile_prog "" "" "inet_aton"; then
1571 print_config "inet_aton" "$inet_aton"
1573 ##########################################
1575 if test "$socklen_t" != "yes" ; then
1580 #include <winsock2.h>
1581 #include <ws2tcpip.h>
1583 #include <sys/socket.h>
1585 int main(int argc, char **argv)
1591 if compile_prog "" "" "socklen_t"; then
1594 print_config "socklen_t" "$socklen_t"
1596 ##########################################
1597 # Whether or not __thread is supported for TLS
1598 if test "$tls_thread" != "yes" ; then
1601 if test "$tls_check" != "no"; then
1604 static __thread int ret;
1605 int main(int argc, char **argv)
1610 if compile_prog "" "" "__thread"; then
1614 print_config "__thread" "$tls_thread"
1616 ##########################################
1617 # Check if we have required gtk/glib support for gfio
1618 if test "$gfio" != "yes" ; then
1621 if test "$gfio_check" = "yes" ; then
1625 #include <gtk/gtk.h>
1628 gdk_threads_enter();
1629 gdk_threads_leave();
1631 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1634 GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0)
1635 ORG_LDFLAGS=$LDFLAGS
1636 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1637 if test "$?" != "0" ; then
1638 echo "configure: gtk and gthread not found"
1641 GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
1642 if test "$?" != "0" ; then
1643 echo "configure: gtk and gthread not found"
1647 if check_min_lib_version gtk+-2.0 2.18.0 "gfio"; then
1648 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1649 GFIO_LIBS="$LIBS $GTK_LIBS"
1650 CFLAGS="$CFLAGS $GTK_CFLAGS"
1652 echo "Please install gtk and gdk libraries"
1658 LDFLAGS=$ORG_LDFLAGS
1661 if test "$gfio_check" = "yes" ; then
1662 print_config "gtk 2.18 or higher" "$gfio"
1665 ##########################################
1666 # Check whether we have getrusage(RUSAGE_THREAD)
1667 if test "$rusage_thread" != "yes" ; then
1671 #include <sys/time.h>
1672 #include <sys/resource.h>
1673 int main(int argc, char **argv)
1676 getrusage(RUSAGE_THREAD, &ru);
1680 if compile_prog "" "" "RUSAGE_THREAD"; then
1683 print_config "RUSAGE_THREAD" "$rusage_thread"
1685 ##########################################
1686 # Check whether we have SCHED_IDLE
1687 if test "$sched_idle" != "yes" ; then
1692 int main(int argc, char **argv)
1694 struct sched_param p = { };
1696 return sched_setscheduler(0, SCHED_IDLE, &p);
1699 if compile_prog "" "" "SCHED_IDLE"; then
1702 print_config "SCHED_IDLE" "$sched_idle"
1704 ##########################################
1705 # Check whether we have TCP_NODELAY
1706 if test "$tcp_nodelay" != "yes" ; then
1711 #include <winsock2.h>
1714 #include <sys/types.h>
1715 #include <sys/socket.h>
1716 #include <netinet/tcp.h>
1718 int main(int argc, char **argv)
1720 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1723 if compile_prog "" "" "TCP_NODELAY"; then
1725 elif compile_prog "" "-lws2_32" "TCP_NODELAY"; then
1727 LIBS="$LIBS -lws2_32"
1729 print_config "TCP_NODELAY" "$tcp_nodelay"
1731 ##########################################
1732 # Check whether we have SO_SNDBUF
1733 if test "$window_size" != "yes" ; then
1738 #include <winsock2.h>
1741 #include <sys/types.h>
1742 #include <sys/socket.h>
1743 #include <netinet/tcp.h>
1745 int main(int argc, char **argv)
1747 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1748 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1751 if compile_prog "" "" "SO_SNDBUF"; then
1753 elif compile_prog "" "-lws2_32" "SO_SNDBUF"; then
1755 LIBS="$LIBS -lws2_32"
1757 print_config "Net engine window_size" "$window_size"
1759 ##########################################
1760 # Check whether we have TCP_MAXSEG
1761 if test "$mss" != "yes" ; then
1766 #include <winsock2.h>
1769 #include <sys/types.h>
1770 #include <sys/socket.h>
1771 #include <netinet/tcp.h>
1772 #include <arpa/inet.h>
1773 #include <netinet/in.h>
1775 int main(int argc, char **argv)
1777 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1780 if compile_prog "" "" "TCP_MAXSEG"; then
1782 elif compile_prog "" "-lws2_32" "TCP_MAXSEG"; then
1784 LIBS="$LIBS -lws2_32"
1786 print_config "TCP_MAXSEG" "$mss"
1788 ##########################################
1789 # Check whether we have RLIMIT_MEMLOCK
1790 if test "$rlimit_memlock" != "yes" ; then
1794 #include <sys/time.h>
1795 #include <sys/resource.h>
1796 int main(int argc, char **argv)
1799 return getrlimit(RLIMIT_MEMLOCK, &rl);
1802 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1803 rlimit_memlock="yes"
1805 print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1807 ##########################################
1808 # Check whether we have pwritev/preadv
1809 if test "$pwritev" != "yes" ; then
1814 #include <sys/uio.h>
1815 int main(int argc, char **argv)
1817 struct iovec iov[1] = { };
1819 return pwritev(0, iov, 1, 0) + preadv(0, iov, 1, 0);
1822 if compile_prog "" "" "pwritev"; then
1825 print_config "pwritev/preadv" "$pwritev"
1827 ##########################################
1828 # Check whether we have pwritev2/preadv2
1829 if test "$pwritev2" != "yes" ; then
1834 #include <sys/uio.h>
1835 int main(int argc, char **argv)
1837 struct iovec iov[1] = { };
1839 return pwritev2(0, iov, 1, 0, 0) + preadv2(0, iov, 1, 0, 0);
1842 if compile_prog "" "" "pwritev2"; then
1845 print_config "pwritev2/preadv2" "$pwritev2"
1847 ##########################################
1848 # Check whether we have the required functions for ipv6
1849 if test "$ipv6" != "yes" ; then
1854 #include <winsock2.h>
1855 #include <ws2tcpip.h>
1857 #include <sys/types.h>
1858 #include <sys/socket.h>
1859 #include <netinet/in.h>
1863 int main(int argc, char **argv)
1865 struct addrinfo hints = { };
1866 struct in6_addr addr = in6addr_any;
1869 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1871 printf("%s %d\n", gai_strerror(ret), addr.s6_addr[0]);
1876 if compile_prog "" "" "ipv6"; then
1879 print_config "IPv6 helpers" "$ipv6"
1881 ##########################################
1883 if test "$http" != "yes" ; then
1886 # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
1888 #include <curl/curl.h>
1889 #include <openssl/hmac.h>
1891 int main(int argc, char **argv)
1896 curl = curl_easy_init();
1897 curl_easy_cleanup(curl);
1899 ctx = HMAC_CTX_new();
1900 HMAC_CTX_reset(ctx);
1905 # openssl < 1.1.0 uses the HMAC_CTX type directly
1907 #include <curl/curl.h>
1908 #include <openssl/hmac.h>
1910 int main(int argc, char **argv)
1915 curl = curl_easy_init();
1916 curl_easy_cleanup(curl);
1918 HMAC_CTX_init(&ctx);
1919 HMAC_CTX_cleanup(&ctx);
1923 if test "$disable_http" != "yes"; then
1924 HTTP_LIBS="-lcurl -lssl -lcrypto"
1925 if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then
1926 output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
1928 elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
1932 print_config "http engine" "$http"
1934 ##########################################
1936 if test "$rados" != "yes" ; then
1940 #include <rados/librados.h>
1942 int main(int argc, char **argv)
1945 rados_ioctx_t io_ctx;
1946 const char cluster_name[] = "ceph";
1947 const char user_name[] = "client.admin";
1948 const char pool[] = "rados";
1950 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1951 rados_create2(&cluster, cluster_name, user_name, 0);
1952 rados_ioctx_create(cluster, pool, &io_ctx);
1957 if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
1960 print_config "Rados engine" "$rados"
1962 ##########################################
1964 if test "$rbd" != "yes" ; then
1968 #include <rbd/librbd.h>
1970 int main(int argc, char **argv)
1973 rados_ioctx_t io_ctx;
1974 const char cluster_name[] = "ceph";
1975 const char user_name[] = "client.admin";
1976 const char pool[] = "rbd";
1977 int major, minor, extra;
1979 rbd_version(&major, &minor, &extra);
1980 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1981 rados_create2(&cluster, cluster_name, user_name, 0);
1982 rados_ioctx_create(cluster, pool, &io_ctx);
1987 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1990 print_config "Rados Block Device engine" "$rbd"
1992 ##########################################
1993 # check for rbd_poll
1994 if test "$rbd_poll" != "yes" ; then
1997 if test "$rbd" = "yes"; then
1999 #include <rbd/librbd.h>
2000 #include <sys/eventfd.h>
2002 int main(int argc, char **argv)
2005 rbd_completion_t comp;
2007 int fd = eventfd(0, EFD_NONBLOCK);
2008 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
2009 rbd_poll_io_events(image, comp, 1);
2014 if compile_prog "" "-lrbd -lrados" "rbd"; then
2017 print_config "rbd_poll" "$rbd_poll"
2020 ##########################################
2021 # check for rbd_invalidate_cache()
2022 if test "$rbd_inval" != "yes" ; then
2025 if test "$rbd" = "yes"; then
2027 #include <rbd/librbd.h>
2029 int main(int argc, char **argv)
2033 return rbd_invalidate_cache(image);
2036 if compile_prog "" "-lrbd -lrados" "rbd"; then
2039 print_config "rbd_invalidate_cache" "$rbd_inval"
2042 ##########################################
2043 # Check whether we have setvbuf
2044 if test "$setvbuf" != "yes" ; then
2049 int main(int argc, char **argv)
2053 setvbuf(f, buf, _IOFBF, sizeof(buf));
2057 if compile_prog "" "" "setvbuf"; then
2060 print_config "setvbuf" "$setvbuf"
2062 ##########################################
2064 if test "$gfapi" != "yes" ; then
2068 #include <glusterfs/api/glfs.h>
2070 int main(int argc, char **argv)
2072 glfs_t *g = glfs_new("foo");
2077 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
2080 print_config "Gluster API engine" "$gfapi"
2082 ##########################################
2083 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
2084 if test "$gfapi" = "yes" ; then
2087 #include <glusterfs/api/glfs.h>
2089 int main(int argc, char **argv)
2092 int ret = glfs_fadvise(fd, 0, 0, 1);
2097 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
2100 print_config "Gluster API use fadvise" "$gf_fadvise"
2103 ##########################################
2104 # check for newer gfapi
2105 if test "$gfapi" = "yes" ; then
2108 #include <glusterfs/api/glfs.h>
2110 int main(int argc, char **argv)
2112 return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL);
2115 if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then
2118 print_config "Gluster new API" "$gf_new"
2121 ##########################################
2122 # check for gfapi trim support
2123 if test "$gf_trim" != "yes" ; then
2126 if test "$gfapi" = "yes" ; then
2128 #include <glusterfs/api/glfs.h>
2130 int main(int argc, char **argv)
2132 return glfs_discard_async(NULL, 0, 0);
2135 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
2138 print_config "Gluster API trim support" "$gf_trim"
2141 ##########################################
2142 # Check if we support stckf on s390
2143 if test "$s390_z196_facilities" != "yes" ; then
2144 s390_z196_facilities="no"
2147 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
2148 int main(int argc, char **argv)
2150 /* We want just 1 double word to be returned. */
2151 register unsigned long reg0 asm("0") = 0;
2152 unsigned long stfle_bits;
2153 asm volatile(".machine push" "\n\t"
2154 ".machine \"z9-109\"" "\n\t"
2157 : "=QS" (stfle_bits), "+d" (reg0)
2160 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
2166 if compile_prog "" "" "s390_z196_facilities"; then
2168 if [ $? -eq 0 ]; then
2169 s390_z196_facilities="yes"
2172 print_config "s390_z196_facilities" "$s390_z196_facilities"
2174 ##########################################
2175 # Check if we have required environment variables configured for libhdfs
2176 if test "$libhdfs" = "yes" ; then
2178 if test "$JAVA_HOME" = "" ; then
2179 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
2182 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
2183 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs include path"
2186 if test "$FIO_LIBHDFS_LIB" = "" ; then
2187 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
2190 if test "$hdfs_conf_error" = "1" ; then
2191 feature_not_found "libhdfs" ""
2194 if test "$FIO_HDFS_CPU" = "x86_64" ; then
2195 FIO_HDFS_CPU="amd64"
2198 print_config "HDFS engine" "$libhdfs"
2200 ##########################################
2201 # Check whether we have MTD
2202 if test "$mtd" != "yes" ; then
2207 #include <mtd/mtd-user.h>
2208 #include <sys/ioctl.h>
2209 int main(int argc, char **argv)
2211 struct mtd_write_req ops;
2212 struct mtd_info_user info;
2213 memset(&ops, 0, sizeof(ops));
2214 info.type = MTD_MLCNANDFLASH;
2215 return ioctl(0, MEMGETINFO, &info);
2218 if compile_prog "" "" "mtd"; then
2221 print_config "MTD" "$mtd"
2223 ##########################################
2224 # Check whether we have libpmem
2225 if test "$libpmem" != "yes" ; then
2229 #include <libpmem.h>
2231 int main(int argc, char **argv)
2233 return pmem_is_pmem(NULL, 0);
2236 if compile_prog "" "-lpmem" "libpmem"; then
2239 print_config "libpmem" "$libpmem"
2241 ##########################################
2242 # Check whether libpmem's version >= 1.5
2243 if test "$libpmem1_5" != "yes" ; then
2246 if test "$libpmem" = "yes"; then
2248 #include <libpmem.h>
2250 int main(int argc, char **argv)
2252 pmem_memcpy(NULL, NULL, 0, 0);
2256 if compile_prog "" "-lpmem" "libpmem1_5"; then
2260 print_config "libpmem1_5" "$libpmem1_5"
2262 ##########################################
2263 # Check whether we have libpmem2
2264 if test "$libpmem2" != "yes" ; then
2268 #include <libpmem2.h>
2269 int main(int argc, char **argv)
2271 struct pmem2_config *cfg;
2272 pmem2_config_new(&cfg);
2273 pmem2_config_delete(&cfg);
2277 if compile_prog "" "-lpmem2" "libpmem2"; then
2280 print_config "libpmem2" "$libpmem2"
2282 # Choose libpmem-based ioengines
2283 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
2285 if test "$libpmem1_5" = "yes"; then
2290 ##########################################
2291 # Report whether dev-dax engine is enabled
2292 print_config "PMDK dev-dax engine" "$devdax"
2294 ##########################################
2295 # Report whether libpmem engine is enabled
2296 print_config "PMDK libpmem engine" "$pmem"
2298 ##########################################
2299 # Check whether we support DDN's IME
2300 if test "$libime" != "yes" ; then
2304 #include <ime_native.h>
2305 int main(int argc, char **argv)
2309 rc = ime_native_finalize();
2313 if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then
2315 CFLAGS="-I${ime_path}/include $CFLAGS"
2316 LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS"
2317 LIBS="-lim_client $LIBS"
2319 print_config "DDN's Infinite Memory Engine" "$libime"
2321 ##########################################
2322 # Check if we have libiscsi
2323 if test "$libiscsi" != "no" ; then
2324 if check_min_lib_version libiscsi 1.9.0; then
2326 libiscsi_cflags=$(pkg-config --cflags libiscsi)
2327 libiscsi_libs=$(pkg-config --libs libiscsi)
2332 print_config "iscsi engine" "$libiscsi"
2334 ##########################################
2335 # Check if we have libnbd (for NBD support)
2336 if test "$libnbd" != "no" ; then
2337 if check_min_lib_version libnbd 0.9.8; then
2339 libnbd_cflags=$(pkg-config --cflags libnbd)
2340 libnbd_libs=$(pkg-config --libs libnbd)
2345 print_config "NBD engine" "$libnbd"
2347 ##########################################
2348 # check for dfs (DAOS File System)
2349 if test "$dfs" != "no" ; then
2353 #include <daos_fs.h>
2355 int main(int argc, char **argv)
2361 (void) dfs_mount(poh, coh, O_RDWR, &dfs);
2366 if compile_prog "" "-luuid -ldfs -ldaos" "dfs"; then
2372 print_config "DAOS File System (dfs) Engine" "$dfs"
2374 ##########################################
2375 # Check if we have libnfs (for userspace nfs support).
2376 if test "$libnfs" != "no" ; then
2377 if $(pkg-config libnfs > /dev/null 2>&1); then
2379 libnfs_cflags=$(pkg-config --cflags libnfs)
2380 libnfs_libs=$(pkg-config --libs libnfs)
2382 if test "$libnfs" = "yes" ; then
2383 feature_not_found "libnfs" "libnfs"
2388 print_config "NFS engine" "$libnfs"
2390 ##########################################
2391 # Check if we have lex/yacc available
2396 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
2397 if test "$targetos" != "SunOS" ; then
2407 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2411 if test "$arith" = "yes" ; then
2413 extern int yywrap(void);
2415 int main(int argc, char **argv)
2421 if compile_prog "" "-lfl" "flex"; then
2423 elif compile_prog "" "-ll" "lex"; then
2432 # Check if lex fails using -o
2433 if test "$arith" = "yes" ; then
2434 if test "$force_no_lex_o" = "yes" ; then
2437 if lex -o lex.yy.c exp/expression-parser.l 2> /dev/null; then
2445 print_config "lex/yacc for arithmetic" "$arith"
2447 ##########################################
2448 # Check whether we have setmntent/getmntent
2449 if test "$getmntent" != "yes" ; then
2455 int main(int argc, char **argv)
2457 FILE *mtab = setmntent(NULL, "r");
2458 struct mntent *mnt = getmntent(mtab);
2463 if compile_prog "" "" "getmntent"; then
2466 print_config "getmntent" "$getmntent"
2468 ##########################################
2469 # Check whether we have getmntinfo
2470 # These are originally added for BSDs, but may also work
2471 # on other operating systems with getmntinfo(3).
2473 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
2474 # Note that NetBSD needs -Werror to catch warning as error.
2475 if test "$getmntinfo" != "yes" ; then
2480 #include <sys/param.h>
2481 #include <sys/mount.h>
2482 int main(int argc, char **argv)
2485 return getmntinfo(&st, MNT_NOWAIT);
2488 if compile_prog "-Werror" "" "getmntinfo"; then
2491 print_config "getmntinfo" "$getmntinfo"
2493 # getmntinfo(3) for NetBSD.
2494 if test "$getmntinfo_statvfs" != "yes" ; then
2495 getmntinfo_statvfs="no"
2499 #include <sys/statvfs.h>
2500 int main(int argc, char **argv)
2503 return getmntinfo(&st, MNT_NOWAIT);
2506 # Skip the test if the one with statfs arg is detected.
2507 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2508 getmntinfo_statvfs="yes"
2509 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
2512 ##########################################
2513 # Check whether we have _Static_assert
2514 if test "$static_assert" != "yes" ; then
2526 int main(int argc, char **argv)
2528 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2532 if compile_prog "" "" "static_assert"; then
2535 print_config "Static Assert" "$static_assert"
2537 ##########################################
2538 # Check whether we have bool / stdbool.h
2539 if test "$have_bool" != "yes" ; then
2543 #include <stdbool.h>
2544 int main(int argc, char **argv)
2547 return var != false;
2550 if compile_prog "" "" "bool"; then
2553 print_config "bool" "$have_bool"
2555 ##########################################
2556 # Check whether we have strndup()
2561 int main(int argc, char **argv)
2563 char *res = strndup("test string", 8);
2569 if compile_prog "" "" "strndup"; then
2572 print_config "strndup" "$strndup"
2574 ##########################################
2575 # <valgrind/drd.h> probe
2576 # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is
2577 # also available but not the other way around.
2578 if test "$valgrind_dev" != "yes" ; then
2582 #include <valgrind/drd.h>
2583 int main(int argc, char **argv)
2588 if compile_prog "" "" "valgrind_dev"; then
2591 print_config "Valgrind headers" "$valgrind_dev"
2593 if test "$targetos" = "Linux" || test "$targetos" = "Android"; then
2594 ##########################################
2595 # <linux/blkzoned.h> probe
2596 if test "$linux_blkzoned" != "yes" ; then
2600 #include <linux/blkzoned.h>
2601 int main(int argc, char **argv)
2606 if compile_prog "" "" "linux_blkzoned"; then
2607 linux_blkzoned="yes"
2609 print_config "Zoned block device support" "$linux_blkzoned"
2611 ##########################################
2612 # Check BLK_ZONE_REP_CAPACITY
2614 #include <linux/blkzoned.h>
2617 return BLK_ZONE_REP_CAPACITY;
2620 if compile_prog "" "" "blkzoned report capacity"; then
2621 output_sym "CONFIG_HAVE_REP_CAPACITY"
2626 print_config "Zoned block device capacity" "$rep_capacity"
2629 ##########################################
2632 #include <libzbc/zbc.h>
2633 int main(int argc, char **argv)
2635 struct zbc_device *dev = NULL;
2637 return zbc_open("foo=bar", O_RDONLY, &dev);
2640 if test "$libzbc" != "no" ; then
2641 if [ -e /usr/include/libzbc/libzbc ]; then
2643 CFLAGS="$CFLAGS -I/usr/include/libzbc"
2645 if compile_prog "" "-lzbc" "libzbc"; then
2647 if ! check_min_lib_version libzbc 5; then
2651 if test "$libzbc" = "yes" ; then
2652 feature_not_found "libzbc" "libzbc or libzbc/zbc.h"
2657 print_config "libzbc engine" "$libzbc"
2659 if test "$targetos" = "Linux" || test "$targetos" = "Android"; then
2660 ##########################################
2661 # Check NVME_URING_CMD support
2663 #include <linux/nvme_ioctl.h>
2666 return sizeof(struct nvme_uring_cmd);
2669 if compile_prog "" "" "nvme uring cmd"; then
2670 output_sym "CONFIG_NVME_URING_CMD"
2671 nvme_uring_cmd="yes"
2675 print_config "NVMe uring command support" "$nvme_uring_cmd"
2678 ##########################################
2679 # Check if we have xnvme
2680 if test "$xnvme" != "no" ; then
2681 if check_min_lib_version xnvme 0.7.0; then
2683 xnvme_cflags=$(pkg-config --cflags xnvme)
2684 xnvme_libs=$(pkg-config --libs xnvme)
2689 print_config "xnvme engine" "$xnvme"
2691 if test "$targetos" = "Linux" ; then
2692 ##########################################
2693 # Check ISA-L support
2695 #include <isa-l/crc.h>
2699 return crc16_t10dif(0, NULL, 4096);
2702 if test "$isal" != "no" ; then
2703 if compile_prog "" "-lisal" "ISAL"; then
2710 print_config "isal" "$isal"
2713 ##########################################
2714 # Check if we have libblkio
2715 if test "$libblkio" != "no" ; then
2716 if check_min_lib_version blkio 1.0.0; then
2718 libblkio_cflags=$(pkg-config --cflags blkio)
2719 libblkio_libs=$(pkg-config --libs blkio)
2721 if test "$libblkio" = "yes" ; then
2722 feature_not_found "libblkio" "libblkio-dev or libblkio-devel"
2727 print_config "libblkio engine" "$libblkio"
2729 ##########################################
2730 # check march=armv8-a+crc+crypto
2731 march_armv8_a_crc_crypto="no"
2732 if test "$cpu" = "arm64" ; then
2735 #include <arm_acle.h>
2736 #include <arm_neon.h>
2737 #include <sys/auxv.h>
2742 /* Can we also do a runtime probe? */
2744 return getauxval(AT_HWCAP);
2745 #elif defined(__APPLE__)
2748 # error "Don't know how to do runtime probe for ARM CRC32c"
2752 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
2753 march_armv8_a_crc_crypto="yes"
2754 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
2758 print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2760 ##########################################
2762 if test "$cuda" != "no" ; then
2765 int main(int argc, char **argv)
2770 if compile_prog "" "-lcuda" "cuda"; then
2774 if test "$cuda" = "yes" ; then
2775 feature_not_found "cuda" ""
2780 print_config "cuda" "$cuda"
2782 ##########################################
2784 if test "$libcufile" != "no" ; then
2788 int main(int argc, char* argv[]) {
2793 if compile_prog "" "-lcuda -lcudart -lcufile -ldl" "libcufile"; then
2795 LIBS="-lcuda -lcudart -lcufile -ldl $LIBS"
2797 if test "$libcufile" = "yes" ; then
2798 feature_not_found "libcufile" ""
2803 print_config "libcufile" "$libcufile"
2805 ##########################################
2806 # check for cc -march=native
2809 int main(int argc, char **argv)
2814 if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2815 compile_prog "-march=native" "" "march=native"; then
2818 print_config "Build march=native" "$build_native"
2820 ##########################################
2822 if test "$cunit" != "yes" ; then
2826 #include <CUnit/CUnit.h>
2827 #include <CUnit/Basic.h>
2830 if (CU_initialize_registry() != CUE_SUCCESS)
2831 return CU_get_error();
2832 CU_basic_set_mode(CU_BRM_VERBOSE);
2833 CU_basic_run_tests();
2834 CU_cleanup_registry();
2835 return CU_get_error();
2838 if compile_prog "" "-lcunit" "CUnit"; then
2841 print_config "CUnit" "$cunit"
2843 ##########################################
2844 # check for __kernel_rwf_t
2847 #include <linux/fs.h>
2848 int main(int argc, char **argv)
2855 if compile_prog "" "" "__kernel_rwf_t"; then
2856 __kernel_rwf_t="yes"
2858 print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2860 ##########################################
2861 # check if gcc has -Wimplicit-fallthrough=2
2864 int main(int argc, char **argv)
2869 if compile_prog "-Wimplicit-fallthrough=2" "" "-Wimplicit-fallthrough=2"; then
2872 print_config "-Wimplicit-fallthrough=2" "$fallthrough"
2874 ##########################################
2875 # check if the compiler has -Wno-stringop-concatenation
2880 int main(int argc, char **argv)
2882 return printf("%s\n", argv[0]);
2885 if compile_prog "-Wno-stringop-truncation -Werror" "" "no_stringop"; then
2888 print_config "-Wno-stringop-truncation" "$no_stringop"
2890 ##########################################
2891 # check for MADV_HUGEPAGE support
2892 if test "$thp" != "yes" ; then
2895 if test "$esx" != "yes" ; then
2897 #include <sys/mman.h>
2900 return madvise(0, 0x1000, MADV_HUGEPAGE);
2903 if compile_prog "" "" "thp" ; then
2906 if test "$thp" = "yes" ; then
2907 feature_not_found "Transparent Huge Page" ""
2912 print_config "MADV_HUGEPAGE" "$thp"
2914 ##########################################
2915 # check for gettid()
2919 int main(int argc, char **argv)
2924 if compile_prog "" "" "gettid"; then
2927 print_config "gettid" "$gettid"
2929 ##########################################
2930 # check for statx(2) support by libc
2934 #include <sys/stat.h>
2936 int main(int argc, char **argv)
2939 return statx(-1, *argv, 0, 0, &st);
2942 if compile_prog "" "" "statx"; then
2945 print_config "statx(2)/libc" "$statx"
2947 ##########################################
2948 # check for statx(2) support by kernel
2952 #include <linux/stat.h>
2953 #include <sys/stat.h>
2954 #include <sys/syscall.h>
2956 static int _statx(int dfd, const char *pathname, int flags, unsigned int mask,
2957 struct statx *buffer)
2959 return syscall(__NR_statx, dfd, pathname, flags, mask, buffer);
2962 int main(int argc, char **argv)
2965 return _statx(-1, *argv, 0, 0, &st);
2968 if compile_prog "" "" "statx_syscall"; then
2971 print_config "statx(2)/syscall" "$statx_syscall"
2973 ##########################################
2974 # check for Windows PDB generation support
2975 if test "pdb" != "no" ; then
2982 if compile_prog "-g -gcodeview" "-fuse-ld=lld -Wl,-pdb,$TMPO" "pdb"; then
2985 if test "$pdb" = "yes"; then
2986 feature_not_found "PDB" "clang and lld"
2993 print_config "Windows PDB generation" "$pdb"
2995 ##########################################
2996 # check for timerfd support
2998 if test "$esx" != "yes" ; then
3000 #include <sys/time.h>
3001 #include <sys/timerfd.h>
3003 int main(int argc, char **argv)
3005 return timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
3008 if compile_prog "" "" "timerfd_create"; then
3009 timerfd_create="yes"
3012 print_config "timerfd_create" "$timerfd_create"
3014 #############################################################################
3016 if test "$wordsize" = "64" ; then
3017 output_sym "CONFIG_64BIT"
3018 elif test "$wordsize" = "32" ; then
3019 output_sym "CONFIG_32BIT"
3021 fatal "Unknown wordsize!"
3023 if test "$bigendian" = "yes" ; then
3024 output_sym "CONFIG_BIG_ENDIAN"
3026 output_sym "CONFIG_LITTLE_ENDIAN"
3028 if test "$zlib" = "yes" ; then
3029 output_sym "CONFIG_ZLIB"
3031 if test "$libaio" = "yes" ; then
3032 output_sym "CONFIG_LIBAIO"
3033 if test "$libaio_rw_flags" = "yes" ; then
3034 output_sym "CONFIG_LIBAIO_RW_FLAGS"
3037 if test "$posix_aio" = "yes" ; then
3038 output_sym "CONFIG_POSIXAIO"
3040 if test "$posix_aio_fsync" = "yes" ; then
3041 output_sym "CONFIG_POSIXAIO_FSYNC"
3043 if test "$posix_pshared" = "yes" ; then
3044 output_sym "CONFIG_PSHARED"
3046 if test "$pthread_condattr_setclock" = "yes" ; then
3047 output_sym "CONFIG_PTHREAD_CONDATTR_SETCLOCK"
3049 if test "$pthread_sigmask" = "yes" ; then
3050 output_sym "CONFIG_PTHREAD_SIGMASK"
3052 if test "$pthread_getaffinity" = "yes" ; then
3053 output_sym "CONFIG_PTHREAD_GETAFFINITY"
3055 if test "$have_asprintf" = "yes" ; then
3056 output_sym "CONFIG_HAVE_ASPRINTF"
3058 if test "$have_vasprintf" = "yes" ; then
3059 output_sym "CONFIG_HAVE_VASPRINTF"
3061 if test "$linux_fallocate" = "yes" ; then
3062 output_sym "CONFIG_LINUX_FALLOCATE"
3064 if test "$posix_fallocate" = "yes" ; then
3065 output_sym "CONFIG_POSIX_FALLOCATE"
3067 if test "$fdatasync" = "yes" ; then
3068 output_sym "CONFIG_FDATASYNC"
3070 if test "$pipe" = "yes" ; then
3071 output_sym "CONFIG_PIPE"
3073 if test "$pipe2" = "yes" ; then
3074 output_sym "CONFIG_PIPE2"
3076 if test "$pread" = "yes" ; then
3077 output_sym "CONFIG_PREAD"
3079 if test "$sync_file_range" = "yes" ; then
3080 output_sym "CONFIG_SYNC_FILE_RANGE"
3082 if test "$ASharedMemory_create" = "yes" ; then
3083 output_sym "CONFIG_ASHAREDMEMORY_CREATE"
3085 if test "$sfaa" = "yes" ; then
3086 output_sym "CONFIG_SFAA"
3088 if test "$sync_sync" = "yes" ; then
3089 output_sym "CONFIG_SYNC_SYNC"
3091 if test "$cmp_swap" = "yes" ; then
3092 output_sym "CONFIG_CMP_SWAP"
3094 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
3095 output_sym "CONFIG_RDMA"
3097 # librpma is supported on the 'x86_64' architecture for now
3098 if test "$cpu" = "x86_64" -a "$libverbs" = "yes" -a "$rdmacm" = "yes" \
3099 -a "$librpma" = "yes" \
3100 && test "$libpmem" = "yes" -o "$libpmem2" = "yes" ; then
3101 output_sym "CONFIG_LIBRPMA_APM"
3103 if test "$cpu" = "x86_64" -a "$libverbs" = "yes" -a "$rdmacm" = "yes" \
3104 -a "$librpma" = "yes" -a "$libprotobuf_c" = "yes" \
3105 && test "$libpmem" = "yes" -o "$libpmem2" = "yes" ; then
3106 output_sym "CONFIG_LIBRPMA_GPSPM"
3108 if test "$clock_gettime" = "yes" ; then
3109 output_sym "CONFIG_CLOCK_GETTIME"
3111 if test "$clock_monotonic" = "yes" ; then
3112 output_sym "CONFIG_CLOCK_MONOTONIC"
3114 if test "$clockid_t" = "yes"; then
3115 output_sym "CONFIG_CLOCKID_T"
3117 if test "$gettimeofday" = "yes" ; then
3118 output_sym "CONFIG_GETTIMEOFDAY"
3120 if test "$posix_fadvise" = "yes" ; then
3121 output_sym "CONFIG_POSIX_FADVISE"
3123 if test "$linux_3arg_affinity" = "yes" ; then
3124 output_sym "CONFIG_3ARG_AFFINITY"
3125 elif test "$linux_2arg_affinity" = "yes" ; then
3126 output_sym "CONFIG_2ARG_AFFINITY"
3128 if test "$strsep" = "yes" ; then
3129 output_sym "CONFIG_STRSEP"
3131 if test "$strcasestr" = "yes" ; then
3132 output_sym "CONFIG_STRCASESTR"
3134 if test "$strlcat" = "yes" ; then
3135 output_sym "CONFIG_STRLCAT"
3137 if test "$getopt_long_only" = "yes" ; then
3138 output_sym "CONFIG_GETOPT_LONG_ONLY"
3140 if test "$inet_aton" = "yes" ; then
3141 output_sym "CONFIG_INET_ATON"
3143 if test "$socklen_t" = "yes" ; then
3144 output_sym "CONFIG_SOCKLEN_T"
3146 if test "$ext4_me" = "yes" ; then
3147 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
3149 if test "$linux_splice" = "yes" ; then
3150 output_sym "CONFIG_LINUX_SPLICE"
3152 if test "$libnuma_v2" = "yes" ; then
3153 output_sym "CONFIG_LIBNUMA"
3155 if test "$solaris_aio" = "yes" ; then
3156 output_sym "CONFIG_SOLARISAIO"
3158 if test "$tls_thread" = "yes" ; then
3159 output_sym "CONFIG_TLS_THREAD"
3161 if test "$rusage_thread" = "yes" ; then
3162 output_sym "CONFIG_RUSAGE_THREAD"
3164 if test "$gfio" = "yes" ; then
3165 output_sym "CONFIG_GFIO"
3167 if test "$esx" = "yes" ; then
3168 output_sym "CONFIG_ESX"
3169 output_sym "CONFIG_NO_SHM"
3171 if test "$sched_idle" = "yes" ; then
3172 output_sym "CONFIG_SCHED_IDLE"
3174 if test "$tcp_nodelay" = "yes" ; then
3175 output_sym "CONFIG_TCP_NODELAY"
3177 if test "$window_size" = "yes" ; then
3178 output_sym "CONFIG_NET_WINDOWSIZE"
3180 if test "$mss" = "yes" ; then
3181 output_sym "CONFIG_NET_MSS"
3183 if test "$rlimit_memlock" = "yes" ; then
3184 output_sym "CONFIG_RLIMIT_MEMLOCK"
3186 if test "$pwritev" = "yes" ; then
3187 output_sym "CONFIG_PWRITEV"
3189 if test "$pwritev2" = "yes" ; then
3190 output_sym "CONFIG_PWRITEV2"
3192 if test "$ipv6" = "yes" ; then
3193 output_sym "CONFIG_IPV6"
3195 if test "$http" = "yes" ; then
3196 output_sym "CONFIG_HTTP"
3198 if test "$rados" = "yes" ; then
3199 output_sym "CONFIG_RADOS"
3201 if test "$rbd" = "yes" ; then
3202 output_sym "CONFIG_RBD"
3204 if test "$rbd_poll" = "yes" ; then
3205 output_sym "CONFIG_RBD_POLL"
3207 if test "$rbd_inval" = "yes" ; then
3208 output_sym "CONFIG_RBD_INVAL"
3210 if test "$setvbuf" = "yes" ; then
3211 output_sym "CONFIG_SETVBUF"
3213 if test "$s390_z196_facilities" = "yes" ; then
3214 output_sym "CONFIG_S390_Z196_FACILITIES"
3215 CFLAGS="$CFLAGS -march=z9-109"
3218 if test "$gfapi" = "yes" ; then
3219 output_sym "CONFIG_GFAPI"
3221 if test "$gf_fadvise" = "yes" ; then
3222 output_sym "CONFIG_GF_FADVISE"
3224 if test "$gf_trim" = "yes" ; then
3225 output_sym "CONFIG_GF_TRIM"
3227 if test "$gf_new" = "yes" ; then
3228 output_sym "CONFIG_GF_NEW_API"
3230 if test "$libhdfs" = "yes" ; then
3231 output_sym "CONFIG_LIBHDFS"
3232 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
3233 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
3234 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
3235 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
3237 if test "$mtd" = "yes" ; then
3238 output_sym "CONFIG_MTD"
3240 if test "$devdax" = "yes" ; then
3241 output_sym "CONFIG_LINUX_DEVDAX"
3243 if test "$pmem" = "yes" ; then
3244 output_sym "CONFIG_LIBPMEM"
3246 if test "$libpmem2" = "yes" ; then
3247 output_sym "CONFIG_LIBPMEM2_INSTALLED"
3249 if test "$libime" = "yes" ; then
3250 output_sym "CONFIG_IME"
3252 if test "$arith" = "yes" ; then
3253 output_sym "CONFIG_ARITHMETIC"
3254 if test "$yacc_is_bison" = "yes" ; then
3255 echo "YACC=bison -y" >> $config_host_mak
3257 echo "YACC=yacc" >> $config_host_mak
3259 if test "$lex_use_o" = "yes" ; then
3260 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
3263 if test "$getmntent" = "yes" ; then
3264 output_sym "CONFIG_GETMNTENT"
3266 if test "$getmntinfo" = "yes" ; then
3267 output_sym "CONFIG_GETMNTINFO"
3269 if test "$getmntinfo_statvfs" = "yes" ; then
3270 output_sym "CONFIG_GETMNTINFO_STATVFS"
3272 if test "$static_assert" = "yes" ; then
3273 output_sym "CONFIG_STATIC_ASSERT"
3275 if test "$have_bool" = "yes" ; then
3276 output_sym "CONFIG_HAVE_BOOL"
3278 if test "$strndup" = "yes" ; then
3279 output_sym "CONFIG_HAVE_STRNDUP"
3281 if test "$disable_opt" = "yes" ; then
3282 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
3284 if test "$valgrind_dev" = "yes"; then
3285 output_sym "CONFIG_VALGRIND_DEV"
3287 if test "$linux_blkzoned" = "yes" ; then
3288 output_sym "CONFIG_HAS_BLKZONED"
3290 if test "$libzbc" = "yes" ; then
3291 output_sym "CONFIG_LIBZBC"
3293 if test "$zlib" = "no" ; then
3294 echo "Consider installing zlib1g-dev (zlib-devel) as some fio features depend on it."
3295 if test "$build_static" = "yes"; then
3296 echo "Note that some distros have separate packages for static libraries."
3299 if test "$march_armv8_a_crc_crypto" = "yes" ; then
3300 output_sym "ARCH_HAVE_CRC_CRYPTO"
3302 if test "$cuda" = "yes" ; then
3303 output_sym "CONFIG_CUDA"
3305 if test "$libcufile" = "yes" ; then
3306 output_sym "CONFIG_LIBCUFILE"
3308 if test "$dfs" = "yes" ; then
3309 output_sym "CONFIG_DFS"
3311 if test "$march_set" = "no" && test "$build_native" = "yes" ; then
3312 output_sym "CONFIG_BUILD_NATIVE"
3314 if test "$cunit" = "yes" ; then
3315 output_sym "CONFIG_HAVE_CUNIT"
3317 if test "$__kernel_rwf_t" = "yes"; then
3318 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
3320 if test "$gettid" = "yes"; then
3321 output_sym "CONFIG_HAVE_GETTID"
3323 if test "$statx" = "yes"; then
3324 output_sym "CONFIG_HAVE_STATX"
3326 if test "$statx_syscall" = "yes"; then
3327 output_sym "CONFIG_HAVE_STATX_SYSCALL"
3329 if test "$timerfd_create" = "yes"; then
3330 output_sym "CONFIG_HAVE_TIMERFD_CREATE"
3332 if test "$fallthrough" = "yes"; then
3333 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
3335 if test "$no_stringop" = "yes"; then
3336 output_sym "CONFIG_HAVE_NO_STRINGOP"
3338 if test "$thp" = "yes" ; then
3339 output_sym "CONFIG_HAVE_THP"
3341 if test "$libiscsi" = "yes" ; then
3342 output_sym "CONFIG_LIBISCSI"
3343 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
3344 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
3345 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
3347 if test "$libnbd" = "yes" ; then
3348 output_sym "CONFIG_LIBNBD"
3349 echo "CONFIG_LIBNBD=m" >> $config_host_mak
3350 echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak
3351 echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak
3353 if test "$libnfs" = "yes" ; then
3354 output_sym "CONFIG_LIBNFS"
3355 echo "LIBNFS_CFLAGS=$libnfs_cflags" >> $config_host_mak
3356 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
3358 if test "$xnvme" = "yes" ; then
3359 output_sym "CONFIG_LIBXNVME"
3360 echo "LIBXNVME_CFLAGS=$xnvme_cflags" >> $config_host_mak
3361 echo "LIBXNVME_LIBS=$xnvme_libs" >> $config_host_mak
3363 if test "$isal" = "yes" ; then
3364 output_sym "CONFIG_LIBISAL"
3366 if test "$libblkio" = "yes" ; then
3367 output_sym "CONFIG_LIBBLKIO"
3368 echo "LIBBLKIO_CFLAGS=$libblkio_cflags" >> $config_host_mak
3369 echo "LIBBLKIO_LIBS=$libblkio_libs" >> $config_host_mak
3371 if test "$dynamic_engines" = "yes" ; then
3372 output_sym "CONFIG_DYNAMIC_ENGINES"
3374 if test "$pdb" = yes; then
3375 output_sym "CONFIG_PDB"
3377 if test "$fcntl_sync" = "yes" ; then
3378 output_sym "CONFIG_FCNTL_SYNC"
3380 if test "$asan" = "yes"; then
3381 CFLAGS="$CFLAGS -fsanitize=address"
3382 LDFLAGS="$LDFLAGS -fsanitize=address"
3384 print_config "Lib-based ioengines dynamic" "$dynamic_engines"
3386 int main(int argc, char **argv)
3391 if test "$disable_tcmalloc" != "yes"; then
3392 if compile_prog "" "-ltcmalloc" "tcmalloc"; then
3394 LIBS="-ltcmalloc $LIBS"
3395 elif compile_prog "" "-l:libtcmalloc_minimal.so.4" "tcmalloc_minimal4"; then
3397 LIBS="-l:libtcmalloc_minimal.so.4 $LIBS"
3402 print_config "TCMalloc support" "$tcmalloc"
3403 if ! num "$seed_buckets"; then
3405 elif test "$seed_buckets" -lt 2; then
3407 elif test "$seed_buckets" -gt 16; then
3410 echo "#define CONFIG_SEED_BUCKETS $seed_buckets" >> $config_host_h
3411 print_config "seed_buckets" "$seed_buckets"
3413 echo "LIBS+=$LIBS" >> $config_host_mak
3414 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
3415 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
3416 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
3417 echo "CC=$cc" >> $config_host_mak
3418 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
3419 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
3421 if [ `dirname $0` != "." -a ! -e Makefile ]; then
3422 cat > Makefile <<EOF
3423 SRCDIR:=`dirname $0`
3424 include \$(SRCDIR)/Makefile