3 # Fio configure script. Heavily influenced by the manual qemu configure
4 # script. Sad this is easier than autoconf and enemies.
7 # set temporary file name
8 if test ! -z "$TMPDIR" ; then
10 elif test ! -z "$TEMPDIR" ; then
16 TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
17 TMPC2="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c"
18 TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
19 TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
21 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
22 # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
23 trap "rm -f $TMPC $TMPC2 $TMPO $TMPE" EXIT INT QUIT TERM
27 config_host_mak="config-host.mak"
28 config_host_h="config-host.h"
30 rm -rf $config_host_mak
35 echo "Configure failed, check config.log and/or the above output"
36 rm -rf $config_host_mak
41 # Print result for each configuration test
43 printf "%-30s%s\n" "$1" "$2"
47 CFLAGS="-D_GNU_SOURCE -include config-host.h"
50 # Print a helpful header at the top of config.log
51 echo "# FIO configure log $(date)" >> config.log
52 printf "# Configured with:" >> config.log
53 printf " '%s'" "$0" "$@" >> config.log
55 echo "#" >> config.log
57 # Print configure header at the top of $config_host_h
58 echo "/*" > $config_host_h
59 echo " * Automatically generated by configure - do not modify" >> $config_host_h
60 printf " * Configured with:" >> $config_host_h
61 printf " * '%s'" "$0" "$@" >> $config_host_h
62 echo "" >> $config_host_h
63 echo " */" >> $config_host_h
66 # Run the compiler, capturing its output to the log.
67 echo $cc "$@" >> config.log
68 $cc "$@" >> config.log 2>&1 || return $?
69 # Test passed. If this is an --enable-werror build, rerun
70 # the test with -Werror and bail out if it fails. This
71 # makes warning-generating-errors in configure test code
72 # obvious to developers.
73 if test "$werror" != "yes"; then
76 # Don't bother rerunning the compile if we were already using -Werror
82 echo $cc -Werror "$@" >> config.log
83 $cc -Werror "$@" >> config.log 2>&1 && return $?
84 echo "ERROR: configure test passed without -Werror but failed with -Werror."
85 echo "This is probably a bug in the configure script. The failing command"
86 echo "will be at the bottom of config.log."
87 fatal "You can run configure with --disable-werror to bypass this check."
91 do_cc $CFLAGS -c -o $TMPO $TMPC
96 local_ldflags="$2 $LIBS"
97 echo "Compiling test case $3" >> config.log
98 do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
101 feature_not_found() {
106 echo "ERROR: User requested feature $feature"
107 if test ! -z "$packages" ; then
108 echo "ERROR: That feature needs $packages installed"
110 echo "ERROR: configure was not able to find it"
115 type "$1" >/dev/null 2>&1
121 #error $1 not defined
132 echo "$1=y" >> $config_host_mak
133 echo "#define $1" >> $config_host_h
155 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
157 --prefix=*) prefix="$optarg"
159 --cpu=*) cpu="$optarg"
161 # esx is cross compiled and cannot be detect through simple uname calls
167 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
169 --build-32bit-win) build_32bit_win="yes"
171 --target-win-ver=*) target_win_ver="$optarg"
173 --build-static) build_static="yes"
175 --enable-gfio) gfio_check="yes"
177 --disable-numa) disable_numa="yes"
179 --disable-rdma) disable_rdma="yes"
181 --disable-rados) disable_rados="yes"
183 --disable-rbd) disable_rbd="yes"
185 --disable-http) disable_http="yes"
187 --disable-gfapi) disable_gfapi="yes"
189 --enable-libhdfs) libhdfs="yes"
191 --disable-lex) disable_lex="yes"
193 --enable-lex) disable_lex="no"
195 --disable-shm) no_shm="yes"
197 --disable-optimizations) disable_opt="yes"
199 --disable-pmem) disable_pmem="yes"
201 --enable-cuda) enable_cuda="yes"
203 --disable-native) disable_native="yes"
205 --with-ime=*) ime_path="$optarg"
211 echo "Bad option $opt"
217 if test "$show_help" = "yes" ; then
218 echo "--prefix= Use this directory as installation prefix"
219 echo "--cpu= Specify target CPU if auto-detect fails"
220 echo "--cc= Specify compiler to use"
221 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
222 echo "--build-32bit-win Enable 32-bit build on Windows"
223 echo "--target-win-ver= Minimum version of Windows to target (XP or 7)"
224 echo "--build-static Build a static fio"
225 echo "--esx Configure build options for esx"
226 echo "--enable-gfio Enable building of gtk gfio"
227 echo "--disable-numa Disable libnuma even if found"
228 echo "--disable-rdma Disable RDMA support even if found"
229 echo "--disable-gfapi Disable gfapi"
230 echo "--enable-libhdfs Enable hdfs support"
231 echo "--disable-lex Disable use of lex/yacc for math"
232 echo "--disable-pmem Disable pmem based engines even if found"
233 echo "--enable-lex Enable use of lex/yacc for math"
234 echo "--disable-shm Disable SHM support"
235 echo "--disable-optimizations Don't enable compiler optimizations"
236 echo "--enable-cuda Enable GPUDirect RDMA support"
237 echo "--disable-native Don't build for native host"
238 echo "--with-ime= Install path for DDN's Infinite Memory Engine"
242 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
243 # Preferred compiler (can be overriden later after we know the platform):
245 # ${cross_prefix}gcc (if cross-prefix specified)
248 if test -z "${CC}${cross_prefix}"; then
255 cc="${CC-${cross_prefix}gcc}"
258 if check_define __ANDROID__ ; then
260 elif check_define __linux__ ; then
262 elif check_define __OpenBSD__ ; then
264 elif check_define __NetBSD__ ; then
266 elif check_define __sun__ ; then
268 CFLAGS="$CFLAGS -D_REENTRANT"
269 elif check_define _WIN32 ; then
275 echo "# Automatically generated by configure - do not modify" > $config_host_mak
276 printf "# Configured with:" >> $config_host_mak
277 printf " '%s'" "$0" "$@" >> $config_host_mak
278 echo >> $config_host_mak
279 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
281 if test "$no_shm" = "yes" ; then
282 output_sym "CONFIG_NO_SHM"
285 if test "$disable_opt" = "yes" ; then
286 output_sym "CONFIG_FIO_NO_OPT"
289 # Some host OSes need non-standard checks for which CPU to use.
290 # Note that these checks are broken for cross-compilation: if you're
291 # cross-compiling to one of these OSes then you'll need to specify
292 # the correct CPU with the --cpu option.
295 # Unless explicitly enabled, turn off lex.
296 # OpenBSD will hit syntax error when enabled.
297 if test -z "$disable_lex" ; then
304 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
305 # we can run 64-bit userspace code.
306 # If the user didn't specify a CPU explicitly and the kernel says this is
307 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
309 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
312 # Error at compile time linking of weak/partial symbols if possible...
319 if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
320 echo "Disabling weak symbols"
321 LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
325 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
326 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
329 LIBS="-lnsl -lsocket"
332 # We still force some options, so keep this message here.
333 echo "Forcing some known good options on Windows"
334 if test -z "${CC}${cross_prefix}"; then
335 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
336 cc="i686-w64-mingw32-gcc"
338 cc="x86_64-w64-mingw32-gcc"
342 target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]')
343 if test -z "$target_win_ver"; then
344 # Default Windows API target
347 if test "$target_win_ver" = "XP"; then
348 output_sym "CONFIG_WINDOWS_XP"
349 elif test "$target_win_ver" = "7"; then
350 output_sym "CONFIG_WINDOWS_7"
351 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601"
353 fatal "Unknown target Windows version"
356 # We need this to be output_sym'd here because this is Windows specific.
357 # The regular configure path never sets this config.
358 output_sym "CONFIG_WINDOWSAIO"
359 # We now take the regular configuration path without having exit 0 here.
360 # Flags below are still necessary mostly for MinGW.
364 clock_gettime="yes" # clock_monotonic probe has dependency on this
365 clock_monotonic="yes"
373 # Now we know the target platform we can have another guess at the preferred
374 # compiler when it wasn't explictly set
375 if test -z "${CC}${cross_prefix}"; then
376 if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
382 if test -z "$cc"; then
383 echo "configure: failed to find compiler"
387 if test ! -z "$cpu" ; then
388 # command line argument
390 elif check_define __i386__ ; then
392 elif check_define __x86_64__ ; then
394 elif check_define __sparc__ ; then
395 if check_define __arch64__ ; then
400 elif check_define _ARCH_PPC ; then
401 if check_define _ARCH_PPC64 ; then
406 elif check_define __mips__ ; then
408 elif check_define __ia64__ ; then
410 elif check_define __s390__ ; then
411 if check_define __s390x__ ; then
416 elif check_define __arm__ ; then
418 elif check_define __aarch64__ ; then
420 elif check_define __hppa__ ; then
426 # Normalise host CPU name and set ARCH.
428 ia64|ppc|ppc64|s390|s390x|sparc64)
431 i386|i486|i586|i686|i86pc|BePC)
443 hppa|parisc|parisc64)
457 ##########################################
458 # check cross compile
460 if test "$cross_compile" != "yes" ; then
469 if compile_prog "" "" "cross"; then
470 $TMPE 2>/dev/null || cross_compile="yes"
472 fatal "compile test failed"
475 ##########################################
477 if test "$bigendian" != "yes" ; then
480 if test "$cross_compile" = "no" ; then
482 #include <inttypes.h>
485 volatile uint32_t i=0x01234567;
486 return (*((uint8_t*)(&i))) == 0x67;
489 if compile_prog "" "" "endian"; then
490 $TMPE && bigendian="yes"
493 # If we're cross compiling, try our best to work it out and rely on the
494 # run-time check to fail if we get it wrong.
499 #if __BYTE_ORDER != __BIG_ENDIAN
500 # error "Unknown endianness"
504 compile_prog "" "" "endian" && bigendian="yes"
505 check_define "__ARMEB__" && bigendian="yes"
506 check_define "__MIPSEB__" && bigendian="yes"
510 print_config "Operating system" "$targetos"
511 print_config "CPU" "$cpu"
512 print_config "Big endian" "$bigendian"
513 if test ! -z "$target_win_ver"; then
514 print_config "Target Windows version" "$target_win_ver"
516 print_config "Compiler" "$cc"
517 print_config "Cross compile" "$cross_compile"
520 ##########################################
521 # See if we need to build a static build
522 if test "$build_static" = "yes" ; then
523 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
524 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
528 print_config "Static build" "$build_static"
530 ##########################################
535 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
538 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
542 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
544 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
547 fatal "Unknown wordsize"
549 print_config "Wordsize" "$wordsize"
551 ##########################################
553 if test "$zlib" != "yes" ; then
561 if (inflateInit(&stream) != Z_OK)
566 if compile_prog "" "-lz" "zlib" ; then
570 print_config "zlib" "$zlib"
572 ##########################################
574 if test "$libaio" != "yes" ; then
577 if test "$esx" != "yes" ; then
587 if compile_prog "" "-laio" "libaio" ; then
591 if test "$libaio" = "yes" ; then
592 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
597 print_config "Linux AIO support" "$libaio"
599 ##########################################
601 if test "$posix_aio" != "yes" ; then
604 if test "$posix_aio_lrt" != "yes" ; then
616 if compile_prog "" "" "posixaio" ; then
618 elif compile_prog "" "-lrt" "posixaio -lrt"; then
623 print_config "POSIX AIO support" "$posix_aio"
624 print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
626 ##########################################
627 # posix aio fsync probe
628 if test "$posix_aio_fsync" != "yes" ; then
631 if test "$posix_aio" = "yes" ; then
638 return aio_fsync(O_SYNC, &cb);
642 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
646 print_config "POSIX AIO fsync" "$posix_aio_fsync"
648 ##########################################
649 # POSIX pshared attribute probe
650 if test "$posix_pshared" != "yes" ; then
657 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
658 # if defined(__CYGWIN__)
659 # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
660 # elif defined(__APPLE__)
661 # include <AvailabilityMacros.h>
662 # include <TargetConditionals.h>
663 # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
664 # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
668 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
673 if compile_prog "" "$LIBS" "posix_pshared" ; then
676 print_config "POSIX pshared support" "$posix_pshared"
678 ##########################################
680 if test "$solaris_aio" != "yes" ; then
684 #include <sys/types.h>
685 #include <sys/asynch.h>
690 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
694 if compile_prog "" "-laio" "solarisaio" ; then
698 print_config "Solaris AIO support" "$solaris_aio"
700 ##########################################
701 # __sync_fetch_and_add test
702 if test "$sfaa" != "yes" ; then
706 #include <inttypes.h>
707 static int sfaa(uint64_t *ptr)
709 return __sync_fetch_and_add(ptr, 0);
712 int main(int argc, char **argv)
719 if compile_prog "" "" "__sync_fetch_and_add()" ; then
722 print_config "__sync_fetch_and_add" "$sfaa"
724 ##########################################
725 # __sync_synchronize() test
726 if test "$sync_sync" != "yes" ; then
730 #include <inttypes.h>
732 int main(int argc, char **argv)
734 __sync_synchronize();
738 if compile_prog "" "" "__sync_synchronize()" ; then
741 print_config "__sync_synchronize" "$sync_sync"
743 ##########################################
744 # __sync_val_compare_and_swap() test
745 if test "$cmp_swap" != "yes" ; then
749 #include <inttypes.h>
751 int main(int argc, char **argv)
754 return __sync_val_compare_and_swap(&x, 1, 2);
757 if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
760 print_config "__sync_val_compare_and_swap" "$cmp_swap"
762 ##########################################
764 if test "$libverbs" != "yes" ; then
768 #include <infiniband/verbs.h>
769 int main(int argc, char **argv)
771 struct ibv_pd *pd = ibv_alloc_pd(NULL);
775 if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
777 LIBS="-libverbs $LIBS"
779 print_config "libverbs" "$libverbs"
781 ##########################################
783 if test "$rdmacm" != "yes" ; then
788 #include <rdma/rdma_cma.h>
789 int main(int argc, char **argv)
791 rdma_destroy_qp(NULL);
795 if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
797 LIBS="-lrdmacm $LIBS"
799 print_config "rdmacm" "$rdmacm"
801 ##########################################
802 # asprintf() and vasprintf() probes
803 if test "$have_asprintf" != "yes" ; then
809 int main(int argc, char **argv)
811 return asprintf(NULL, "%s", "str") == 0;
814 if compile_prog "" "" "have_asprintf"; then
817 print_config "asprintf()" "$have_asprintf"
819 if test "$have_vasprintf" != "yes" ; then
825 int main(int argc, char **argv)
827 return vasprintf(NULL, "%s", NULL) == 0;
830 if compile_prog "" "" "have_vasprintf"; then
833 print_config "vasprintf()" "$have_vasprintf"
835 ##########################################
836 # Linux fallocate probe
837 if test "$linux_fallocate" != "yes" ; then
843 #include <linux/falloc.h>
844 int main(int argc, char **argv)
846 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
850 if compile_prog "" "" "linux_fallocate"; then
851 linux_fallocate="yes"
853 print_config "Linux fallocate" "$linux_fallocate"
855 ##########################################
856 # POSIX fadvise probe
857 if test "$posix_fadvise" != "yes" ; then
863 int main(int argc, char **argv)
865 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
869 if compile_prog "" "" "posix_fadvise"; then
872 print_config "POSIX fadvise" "$posix_fadvise"
874 ##########################################
875 # POSIX fallocate probe
876 if test "$posix_fallocate" != "yes" ; then
882 int main(int argc, char **argv)
884 int r = posix_fallocate(0, 0, 1024);
888 if compile_prog "" "" "posix_fallocate"; then
889 posix_fallocate="yes"
891 print_config "POSIX fallocate" "$posix_fallocate"
893 ##########################################
894 # sched_set/getaffinity 2 or 3 argument test
895 if test "$linux_2arg_affinity" != "yes" ; then
896 linux_2arg_affinity="no"
898 if test "$linux_3arg_affinity" != "yes" ; then
899 linux_3arg_affinity="no"
903 int main(int argc, char **argv)
906 return sched_setaffinity(0, sizeof(mask), &mask);
909 if compile_prog "" "" "sched_setaffinity(,,)"; then
910 linux_3arg_affinity="yes"
914 int main(int argc, char **argv)
917 return sched_setaffinity(0, &mask);
920 if compile_prog "" "" "sched_setaffinity(,)"; then
921 linux_2arg_affinity="yes"
924 print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
925 print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
927 ##########################################
928 # clock_gettime probe
929 if test "$clock_gettime" != "yes" ; then
935 int main(int argc, char **argv)
937 return clock_gettime(0, NULL);
940 if compile_prog "" "" "clock_gettime"; then
942 elif compile_prog "" "-lrt" "clock_gettime"; then
946 print_config "clock_gettime" "$clock_gettime"
948 ##########################################
949 # CLOCK_MONOTONIC probe
950 if test "$clock_monotonic" != "yes" ; then
953 if test "$clock_gettime" = "yes" ; then
957 int main(int argc, char **argv)
959 return clock_gettime(CLOCK_MONOTONIC, NULL);
962 if compile_prog "" "$LIBS" "clock monotonic"; then
963 clock_monotonic="yes"
966 print_config "CLOCK_MONOTONIC" "$clock_monotonic"
968 ##########################################
969 # CLOCK_MONOTONIC_RAW probe
970 if test "$clock_monotonic_raw" != "yes" ; then
971 clock_monotonic_raw="no"
973 if test "$clock_gettime" = "yes" ; then
977 int main(int argc, char **argv)
979 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
982 if compile_prog "" "$LIBS" "clock monotonic"; then
983 clock_monotonic_raw="yes"
986 print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw"
988 ##########################################
989 # CLOCK_MONOTONIC_PRECISE probe
990 if test "$clock_monotonic_precise" != "yes" ; then
991 clock_monotonic_precise="no"
993 if test "$clock_gettime" = "yes" ; then
997 int main(int argc, char **argv)
999 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
1002 if compile_prog "" "$LIBS" "clock monotonic precise"; then
1003 clock_monotonic_precise="yes"
1006 print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise"
1008 ##########################################
1010 if test "$clockid_t" != "yes" ; then
1016 int main(int argc, char **argv)
1018 volatile clockid_t cid;
1019 memset((void*)&cid, 0, sizeof(cid));
1023 if compile_prog "" "$LIBS" "clockid_t"; then
1026 print_config "clockid_t" "$clockid_t"
1028 ##########################################
1029 # gettimeofday() probe
1030 if test "$gettimeofday" != "yes" ; then
1034 #include <sys/time.h>
1036 int main(int argc, char **argv)
1039 return gettimeofday(&tv, NULL);
1042 if compile_prog "" "" "gettimeofday"; then
1045 print_config "gettimeofday" "$gettimeofday"
1047 ##########################################
1049 if test "$fdatasync" != "yes" ; then
1055 int main(int argc, char **argv)
1057 return fdatasync(0);
1060 if compile_prog "" "" "fdatasync"; then
1063 print_config "fdatasync" "$fdatasync"
1065 ##########################################
1066 # sync_file_range() probe
1067 if test "$sync_file_range" != "yes" ; then
1068 sync_file_range="no"
1074 #include <linux/fs.h>
1075 int main(int argc, char **argv)
1077 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1078 SYNC_FILE_RANGE_WAIT_AFTER;
1079 return sync_file_range(0, 0, 0, flags);
1082 if compile_prog "" "" "sync_file_range"; then
1083 sync_file_range="yes"
1085 print_config "sync_file_range" "$sync_file_range"
1087 ##########################################
1088 # ext4 move extent probe
1089 if test "$ext4_me" != "yes" ; then
1094 #include <sys/ioctl.h>
1095 int main(int argc, char **argv)
1097 struct move_extent me;
1098 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1101 if compile_prog "" "" "ext4 move extent" ; then
1103 elif test $targetos = "Linux" ; then
1104 # On Linux, just default to it on and let it error at runtime if we really
1105 # don't have it. None of my updated systems have it defined, but it does
1106 # work. Takes a while to bubble back.
1109 print_config "EXT4 move extent" "$ext4_me"
1111 ##########################################
1113 if test "$linux_splice" != "yes" ; then
1119 int main(int argc, char **argv)
1121 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1124 if compile_prog "" "" "linux splice"; then
1127 print_config "Linux splice(2)" "$linux_splice"
1129 ##########################################
1131 if test "$guasi" != "yes" ; then
1136 #include <guasi_syscalls.h>
1137 int main(int argc, char **argv)
1139 guasi_t ctx = guasi_create(0, 0, 0);
1143 if compile_prog "" "" "guasi"; then
1146 print_config "GUASI" "$guasi"
1148 ##########################################
1150 if test "$fusion_aw" != "yes" ; then
1154 #include <nvm/nvm_primitives.h>
1155 int main(int argc, char **argv)
1157 nvm_version_t ver_info;
1158 nvm_handle_t handle;
1160 handle = nvm_get_handle(0, &ver_info);
1161 return nvm_atomic_write(handle, 0, 0, 0);
1164 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1165 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
1168 print_config "Fusion-io atomic engine" "$fusion_aw"
1170 ##########################################
1172 if test "$libnuma" != "yes" ; then
1177 int main(int argc, char **argv)
1179 return numa_available();
1182 if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1186 print_config "libnuma" "$libnuma"
1188 ##########################################
1189 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1190 if test "$libnuma" = "yes" ; then
1194 int main(int argc, char **argv)
1196 struct bitmask *mask = numa_parse_nodestring(NULL);
1197 return mask->size == 0;
1200 if compile_prog "" "" "libnuma api"; then
1203 print_config "libnuma v2" "$libnuma_v2"
1206 ##########################################
1208 if test "$strsep" != "yes" ; then
1213 int main(int argc, char **argv)
1215 static char *string = "This is a string";
1216 strsep(&string, "needle");
1220 if compile_prog "" "" "strsep"; then
1223 print_config "strsep" "$strsep"
1225 ##########################################
1226 # strcasestr() probe
1227 if test "$strcasestr" != "yes" ; then
1232 int main(int argc, char **argv)
1234 return strcasestr(argv[0], argv[1]) != NULL;
1237 if compile_prog "" "" "strcasestr"; then
1240 print_config "strcasestr" "$strcasestr"
1242 ##########################################
1244 if test "$strlcat" != "yes" ; then
1249 int main(int argc, char **argv)
1251 static char dst[64];
1252 static char *string = "This is a string";
1253 memset(dst, 0, sizeof(dst));
1254 strlcat(dst, string, sizeof(dst));
1258 if compile_prog "" "" "strlcat"; then
1261 print_config "strlcat" "$strlcat"
1263 ##########################################
1264 # getopt_long_only() probe
1265 if test "$getopt_long_only" != "yes" ; then
1266 getopt_long_only="no"
1272 int main(int argc, char **argv)
1274 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1278 if compile_prog "" "" "getopt_long_only"; then
1279 getopt_long_only="yes"
1281 print_config "getopt_long_only()" "$getopt_long_only"
1283 ##########################################
1285 if test "$inet_aton" != "yes" ; then
1289 #include <sys/socket.h>
1290 #include <arpa/inet.h>
1292 int main(int argc, char **argv)
1295 return inet_aton(NULL, &in);
1298 if compile_prog "" "" "inet_aton"; then
1301 print_config "inet_aton" "$inet_aton"
1303 ##########################################
1305 if test "$socklen_t" != "yes" ; then
1309 #include <sys/socket.h>
1310 int main(int argc, char **argv)
1316 if compile_prog "" "" "socklen_t"; then
1319 print_config "socklen_t" "$socklen_t"
1321 ##########################################
1322 # Whether or not __thread is supported for TLS
1323 if test "$tls_thread" != "yes" ; then
1328 static __thread int ret;
1329 int main(int argc, char **argv)
1334 if compile_prog "" "" "__thread"; then
1337 print_config "__thread" "$tls_thread"
1339 ##########################################
1340 # Check if we have required gtk/glib support for gfio
1341 if test "$gfio" != "yes" ; then
1344 if test "$gfio_check" = "yes" ; then
1348 #include <gtk/gtk.h>
1351 gdk_threads_enter();
1352 gdk_threads_leave();
1354 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1357 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1358 ORG_LDFLAGS=$LDFLAGS
1359 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1360 if test "$?" != "0" ; then
1361 echo "configure: gtk and gthread not found"
1364 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1365 if test "$?" != "0" ; then
1366 echo "configure: gtk and gthread not found"
1369 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1371 if test "$?" = "0" ; then
1373 GFIO_LIBS="$LIBS $GTK_LIBS"
1374 CFLAGS="$CFLAGS $GTK_CFLAGS"
1376 echo "GTK found, but need version 2.18 or higher"
1380 echo "Please install gtk and gdk libraries"
1383 LDFLAGS=$ORG_LDFLAGS
1386 if test "$gfio_check" = "yes" ; then
1387 print_config "gtk 2.18 or higher" "$gfio"
1390 ##########################################
1391 # Check whether we have getrusage(RUSAGE_THREAD)
1392 if test "$rusage_thread" != "yes" ; then
1396 #include <sys/time.h>
1397 #include <sys/resource.h>
1398 int main(int argc, char **argv)
1401 getrusage(RUSAGE_THREAD, &ru);
1405 if compile_prog "" "" "RUSAGE_THREAD"; then
1408 print_config "RUSAGE_THREAD" "$rusage_thread"
1410 ##########################################
1411 # Check whether we have SCHED_IDLE
1412 if test "$sched_idle" != "yes" ; then
1417 int main(int argc, char **argv)
1419 struct sched_param p;
1420 return sched_setscheduler(0, SCHED_IDLE, &p);
1423 if compile_prog "" "" "SCHED_IDLE"; then
1426 print_config "SCHED_IDLE" "$sched_idle"
1428 ##########################################
1429 # Check whether we have TCP_NODELAY
1430 if test "$tcp_nodelay" != "yes" ; then
1435 #include <sys/types.h>
1436 #include <sys/socket.h>
1437 #include <netinet/tcp.h>
1438 int main(int argc, char **argv)
1440 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1443 if compile_prog "" "" "TCP_NODELAY"; then
1446 print_config "TCP_NODELAY" "$tcp_nodelay"
1448 ##########################################
1449 # Check whether we have SO_SNDBUF
1450 if test "$window_size" != "yes" ; then
1455 #include <sys/types.h>
1456 #include <sys/socket.h>
1457 #include <netinet/tcp.h>
1458 int main(int argc, char **argv)
1460 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1461 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1464 if compile_prog "" "" "SO_SNDBUF"; then
1467 print_config "Net engine window_size" "$window_size"
1469 ##########################################
1470 # Check whether we have TCP_MAXSEG
1471 if test "$mss" != "yes" ; then
1476 #include <sys/types.h>
1477 #include <sys/socket.h>
1478 #include <netinet/tcp.h>
1479 #include <arpa/inet.h>
1480 #include <netinet/in.h>
1481 int main(int argc, char **argv)
1483 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1486 if compile_prog "" "" "TCP_MAXSEG"; then
1489 print_config "TCP_MAXSEG" "$mss"
1491 ##########################################
1492 # Check whether we have RLIMIT_MEMLOCK
1493 if test "$rlimit_memlock" != "yes" ; then
1497 #include <sys/time.h>
1498 #include <sys/resource.h>
1499 int main(int argc, char **argv)
1502 return getrlimit(RLIMIT_MEMLOCK, &rl);
1505 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1506 rlimit_memlock="yes"
1508 print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1510 ##########################################
1511 # Check whether we have pwritev/preadv
1512 if test "$pwritev" != "yes" ; then
1517 #include <sys/uio.h>
1518 int main(int argc, char **argv)
1520 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1523 if compile_prog "" "" "pwritev"; then
1526 print_config "pwritev/preadv" "$pwritev"
1528 ##########################################
1529 # Check whether we have pwritev2/preadv2
1530 if test "$pwritev2" != "yes" ; then
1535 #include <sys/uio.h>
1536 int main(int argc, char **argv)
1538 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1541 if compile_prog "" "" "pwritev2"; then
1544 print_config "pwritev2/preadv2" "$pwritev2"
1546 ##########################################
1547 # Check whether we have the required functions for ipv6
1548 if test "$ipv6" != "yes" ; then
1552 #include <sys/types.h>
1553 #include <sys/socket.h>
1554 #include <netinet/in.h>
1557 int main(int argc, char **argv)
1559 struct addrinfo hints;
1560 struct in6_addr addr;
1563 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1565 printf("%s\n", gai_strerror(ret));
1570 if compile_prog "" "" "ipv6"; then
1573 print_config "IPv6 helpers" "$ipv6"
1575 ##########################################
1577 if test "$http" != "yes" ; then
1580 # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
1582 #include <curl/curl.h>
1583 #include <openssl/hmac.h>
1585 int main(int argc, char **argv)
1590 curl = curl_easy_init();
1591 curl_easy_cleanup(curl);
1593 ctx = HMAC_CTX_new();
1594 HMAC_CTX_reset(ctx);
1599 # openssl < 1.1.0 uses the HMAC_CTX type directly
1601 #include <curl/curl.h>
1602 #include <openssl/hmac.h>
1604 int main(int argc, char **argv)
1609 curl = curl_easy_init();
1610 curl_easy_cleanup(curl);
1612 HMAC_CTX_init(&ctx);
1613 HMAC_CTX_cleanup(&ctx);
1617 if test "$disable_http" != "yes"; then
1618 HTTP_LIBS="-lcurl -lssl -lcrypto"
1619 if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then
1620 output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
1622 LIBS="$HTTP_LIBS $LIBS"
1623 elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
1625 LIBS="$HTTP_LIBS $LIBS"
1628 print_config "http engine" "$http"
1630 ##########################################
1632 if test "$rados" != "yes" ; then
1636 #include <rados/librados.h>
1638 int main(int argc, char **argv)
1641 rados_ioctx_t io_ctx;
1642 const char cluster_name[] = "ceph";
1643 const char user_name[] = "client.admin";
1644 const char pool[] = "rados";
1646 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1647 rados_create2(&cluster, cluster_name, user_name, 0);
1648 rados_ioctx_create(cluster, pool, &io_ctx);
1653 if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
1654 LIBS="-lrados $LIBS"
1657 print_config "Rados engine" "$rados"
1659 ##########################################
1661 if test "$rbd" != "yes" ; then
1665 #include <rbd/librbd.h>
1667 int main(int argc, char **argv)
1670 rados_ioctx_t io_ctx;
1671 const char cluster_name[] = "ceph";
1672 const char user_name[] = "client.admin";
1673 const char pool[] = "rbd";
1674 int major, minor, extra;
1676 rbd_version(&major, &minor, &extra);
1677 /* The rados_create2 signature required was only introduced in ceph 0.65 */
1678 rados_create2(&cluster, cluster_name, user_name, 0);
1679 rados_ioctx_create(cluster, pool, &io_ctx);
1684 if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1685 LIBS="-lrbd -lrados $LIBS"
1688 print_config "Rados Block Device engine" "$rbd"
1690 ##########################################
1691 # check for rbd_poll
1692 if test "$rbd_poll" != "yes" ; then
1695 if test "$rbd" = "yes"; then
1697 #include <rbd/librbd.h>
1698 #include <sys/eventfd.h>
1700 int main(int argc, char **argv)
1703 rbd_completion_t comp;
1705 int fd = eventfd(0, EFD_NONBLOCK);
1706 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1707 rbd_poll_io_events(image, comp, 1);
1712 if compile_prog "" "-lrbd -lrados" "rbd"; then
1715 print_config "rbd_poll" "$rbd_poll"
1718 ##########################################
1719 # check for rbd_invalidate_cache()
1720 if test "$rbd_inval" != "yes" ; then
1723 if test "$rbd" = "yes"; then
1725 #include <rbd/librbd.h>
1727 int main(int argc, char **argv)
1731 return rbd_invalidate_cache(image);
1734 if compile_prog "" "-lrbd -lrados" "rbd"; then
1737 print_config "rbd_invalidate_cache" "$rbd_inval"
1740 ##########################################
1741 # Check whether we have setvbuf
1742 if test "$setvbuf" != "yes" ; then
1747 int main(int argc, char **argv)
1751 setvbuf(f, buf, _IOFBF, sizeof(buf));
1755 if compile_prog "" "" "setvbuf"; then
1758 print_config "setvbuf" "$setvbuf"
1760 ##########################################
1762 if test "$gfapi" != "yes" ; then
1766 #include <glusterfs/api/glfs.h>
1768 int main(int argc, char **argv)
1770 glfs_t *g = glfs_new("foo");
1775 if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1776 LIBS="-lgfapi -lglusterfs $LIBS"
1779 print_config "Gluster API engine" "$gfapi"
1781 ##########################################
1782 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1783 if test "$gfapi" = "yes" ; then
1786 #include <glusterfs/api/glfs.h>
1788 int main(int argc, char **argv)
1791 int ret = glfs_fadvise(fd, 0, 0, 1);
1796 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1799 print_config "Gluster API use fadvise" "$gf_fadvise"
1802 ##########################################
1803 # check for gfapi trim support
1804 if test "$gf_trim" != "yes" ; then
1807 if test "$gfapi" = "yes" ; then
1809 #include <glusterfs/api/glfs.h>
1811 int main(int argc, char **argv)
1813 return glfs_discard_async(NULL, 0, 0);
1816 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1819 print_config "Gluster API trim support" "$gf_trim"
1822 ##########################################
1823 # Check if we support stckf on s390
1824 if test "$s390_z196_facilities" != "yes" ; then
1825 s390_z196_facilities="no"
1828 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1829 int main(int argc, char **argv)
1831 /* We want just 1 double word to be returned. */
1832 register unsigned long reg0 asm("0") = 0;
1833 unsigned long stfle_bits;
1834 asm volatile(".machine push" "\n\t"
1835 ".machine \"z9-109\"" "\n\t"
1838 : "=QS" (stfle_bits), "+d" (reg0)
1841 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1847 if compile_prog "" "" "s390_z196_facilities"; then
1849 if [ $? -eq 0 ]; then
1850 s390_z196_facilities="yes"
1853 print_config "s390_z196_facilities" "$s390_z196_facilities"
1855 ##########################################
1856 # Check if we have required environment variables configured for libhdfs
1857 if test "$libhdfs" = "yes" ; then
1859 if test "$JAVA_HOME" = "" ; then
1860 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1863 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1864 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1867 if test "$FIO_LIBHDFS_LIB" = "" ; then
1868 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1871 if test "$hdfs_conf_error" = "1" ; then
1875 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1876 FIO_HDFS_CPU="amd64"
1879 print_config "HDFS engine" "$libhdfs"
1881 ##########################################
1882 # Check whether we have MTD
1883 if test "$mtd" != "yes" ; then
1888 #include <mtd/mtd-user.h>
1889 #include <sys/ioctl.h>
1890 int main(int argc, char **argv)
1892 struct mtd_write_req ops;
1893 struct mtd_info_user info;
1894 memset(&ops, 0, sizeof(ops));
1895 info.type = MTD_MLCNANDFLASH;
1896 return ioctl(0, MEMGETINFO, &info);
1899 if compile_prog "" "" "mtd"; then
1902 print_config "MTD" "$mtd"
1904 ##########################################
1905 # Check whether we have libpmem
1906 if test "$libpmem" != "yes" ; then
1910 #include <libpmem.h>
1911 int main(int argc, char **argv)
1914 rc = pmem_is_pmem(0, 0);
1918 if compile_prog "" "-lpmem" "libpmem"; then
1922 print_config "libpmem" "$libpmem"
1924 ##########################################
1925 # Check whether we have libpmemblk
1926 # libpmem is a prerequisite
1927 if test "$libpmemblk" != "yes" ; then
1930 if test "$libpmem" = "yes"; then
1932 #include <libpmemblk.h>
1933 int main(int argc, char **argv)
1936 pbp = pmemblk_open("", 0);
1940 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1942 LIBS="-lpmemblk $LIBS"
1945 print_config "libpmemblk" "$libpmemblk"
1947 # Choose the ioengines
1948 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1951 if test "$libpmemblk" = "yes"; then
1956 ##########################################
1957 # Report whether pmemblk engine is enabled
1958 print_config "PMDK pmemblk engine" "$pmemblk"
1960 ##########################################
1961 # Report whether dev-dax engine is enabled
1962 print_config "PMDK dev-dax engine" "$devdax"
1964 ##########################################
1965 # Report whether libpmem engine is enabled
1966 print_config "PMDK libpmem engine" "$pmem"
1968 ##########################################
1969 # Check whether we support DDN's IME
1970 if test "$libime" != "yes" ; then
1974 #include <ime_native.h>
1975 int main(int argc, char **argv)
1979 rc = ime_native_finalize();
1983 if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then
1985 CFLAGS="-I${ime_path}/include $CFLAGS"
1986 LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS"
1987 LIBS="-lim_client $LIBS"
1989 print_config "DDN's Infinite Memory Engine" "$libime"
1991 ##########################################
1992 # Check if we have lex/yacc available
1997 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
1998 if test "$targetos" != "SunOS" ; then
1999 LEX=$(which lex 2> /dev/null)
2000 if test -x "$LEX" ; then
2003 YACC=$(which bison 2> /dev/null)
2004 if test -x "$YACC" ; then
2008 YACC=$(which yacc 2> /dev/null)
2009 if test -x "$YACC" ; then
2013 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2017 if test "$arith" = "yes" ; then
2019 extern int yywrap(void);
2021 int main(int argc, char **argv)
2027 if compile_prog "" "-ll" "lex"; then
2036 # Check if lex fails using -o
2037 if test "$arith" = "yes" ; then
2038 if test "$force_no_lex_o" = "yes" ; then
2041 $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
2042 if test "$?" = "0" ; then
2050 print_config "lex/yacc for arithmetic" "$arith"
2052 ##########################################
2053 # Check whether we have setmntent/getmntent
2054 if test "$getmntent" != "yes" ; then
2060 int main(int argc, char **argv)
2062 FILE *mtab = setmntent(NULL, "r");
2063 struct mntent *mnt = getmntent(mtab);
2068 if compile_prog "" "" "getmntent"; then
2071 print_config "getmntent" "$getmntent"
2073 ##########################################
2074 # Check whether we have getmntinfo
2075 # These are originally added for BSDs, but may also work
2076 # on other operating systems with getmntinfo(3).
2078 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
2079 # Note that NetBSD needs -Werror to catch warning as error.
2080 if test "$getmntinfo" != "yes" ; then
2085 #include <sys/param.h>
2086 #include <sys/mount.h>
2087 int main(int argc, char **argv)
2090 return getmntinfo(&st, MNT_NOWAIT);
2093 if compile_prog "-Werror" "" "getmntinfo"; then
2096 print_config "getmntinfo" "$getmntinfo"
2098 # getmntinfo(3) for NetBSD.
2099 if test "$getmntinfo_statvfs" != "yes" ; then
2100 getmntinfo_statvfs="no"
2104 #include <sys/statvfs.h>
2105 int main(int argc, char **argv)
2108 return getmntinfo(&st, MNT_NOWAIT);
2111 # Skip the test if the one with statfs arg is detected.
2112 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2113 getmntinfo_statvfs="yes"
2114 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
2117 ##########################################
2118 # Check whether we have _Static_assert
2119 if test "$static_assert" != "yes" ; then
2131 int main(int argc, char **argv)
2133 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2137 if compile_prog "" "" "static_assert"; then
2140 print_config "Static Assert" "$static_assert"
2142 ##########################################
2143 # Check whether we have bool / stdbool.h
2144 if test "$have_bool" != "yes" ; then
2148 #include <stdbool.h>
2149 int main(int argc, char **argv)
2152 return var != false;
2155 if compile_prog "" "" "bool"; then
2158 print_config "bool" "$have_bool"
2160 ##########################################
2161 # Check whether we have strndup()
2166 int main(int argc, char **argv)
2168 char *res = strndup("test string", 8);
2174 if compile_prog "" "" "strndup"; then
2177 print_config "strndup" "$strndup"
2179 ##########################################
2180 # <valgrind/drd.h> probe
2181 # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is
2182 # also available but not the other way around.
2183 if test "$valgrind_dev" != "yes" ; then
2187 #include <valgrind/drd.h>
2188 int main(int argc, char **argv)
2193 if compile_prog "" "" "valgrind_dev"; then
2196 print_config "Valgrind headers" "$valgrind_dev"
2198 # check march=armv8-a+crc+crypto
2199 if test "$march_armv8_a_crc_crypto" != "yes" ; then
2200 march_armv8_a_crc_crypto="no"
2202 if test "$cpu" = "arm64" ; then
2204 #include <arm_acle.h>
2205 #include <arm_neon.h>
2206 #include <sys/auxv.h>
2210 /* Can we also do a runtime probe? */
2212 return getauxval(AT_HWCAP);
2214 # error "Don't know how to do runtime probe for ARM CRC32c"
2218 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
2219 march_armv8_a_crc_crypto="yes"
2220 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
2224 print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2226 ##########################################
2228 if test "$cuda" != "yes" ; then
2233 int main(int argc, char **argv)
2238 if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
2242 print_config "cuda" "$cuda"
2244 ##########################################
2245 # mkdir() probe. mingw apparently has a one-argument mkdir :/
2248 #include <sys/stat.h>
2249 #include <sys/types.h>
2250 int main(int argc, char **argv)
2252 return mkdir("/tmp/bla", 0600);
2255 if compile_prog "" "" "mkdir(a, b)"; then
2258 print_config "mkdir(a, b)" "$mkdir_two"
2260 ##########################################
2261 # check for cc -march=native
2264 int main(int argc, char **argv)
2269 if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2270 compile_prog "-march=native" "" "march=native"; then
2273 print_config "Build march=native" "$build_native"
2275 #############################################################################
2277 if test "$wordsize" = "64" ; then
2278 output_sym "CONFIG_64BIT"
2279 elif test "$wordsize" = "32" ; then
2280 output_sym "CONFIG_32BIT"
2282 fatal "Unknown wordsize!"
2284 if test "$bigendian" = "yes" ; then
2285 output_sym "CONFIG_BIG_ENDIAN"
2287 output_sym "CONFIG_LITTLE_ENDIAN"
2289 if test "$zlib" = "yes" ; then
2290 output_sym "CONFIG_ZLIB"
2292 if test "$libaio" = "yes" ; then
2293 output_sym "CONFIG_LIBAIO"
2295 if test "$posix_aio" = "yes" ; then
2296 output_sym "CONFIG_POSIXAIO"
2298 if test "$posix_aio_fsync" = "yes" ; then
2299 output_sym "CONFIG_POSIXAIO_FSYNC"
2301 if test "$posix_pshared" = "yes" ; then
2302 output_sym "CONFIG_PSHARED"
2304 if test "$have_asprintf" = "yes" ; then
2305 output_sym "CONFIG_HAVE_ASPRINTF"
2307 if test "$have_vasprintf" = "yes" ; then
2308 output_sym "CONFIG_HAVE_VASPRINTF"
2310 if test "$linux_fallocate" = "yes" ; then
2311 output_sym "CONFIG_LINUX_FALLOCATE"
2313 if test "$posix_fallocate" = "yes" ; then
2314 output_sym "CONFIG_POSIX_FALLOCATE"
2316 if test "$fdatasync" = "yes" ; then
2317 output_sym "CONFIG_FDATASYNC"
2319 if test "$sync_file_range" = "yes" ; then
2320 output_sym "CONFIG_SYNC_FILE_RANGE"
2322 if test "$sfaa" = "yes" ; then
2323 output_sym "CONFIG_SFAA"
2325 if test "$sync_sync" = "yes" ; then
2326 output_sym "CONFIG_SYNC_SYNC"
2328 if test "$cmp_swap" = "yes" ; then
2329 output_sym "CONFIG_CMP_SWAP"
2331 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2332 output_sym "CONFIG_RDMA"
2334 if test "$clock_gettime" = "yes" ; then
2335 output_sym "CONFIG_CLOCK_GETTIME"
2337 if test "$clock_monotonic" = "yes" ; then
2338 output_sym "CONFIG_CLOCK_MONOTONIC"
2340 if test "$clock_monotonic_raw" = "yes" ; then
2341 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2343 if test "$clock_monotonic_precise" = "yes" ; then
2344 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2346 if test "$clockid_t" = "yes"; then
2347 output_sym "CONFIG_CLOCKID_T"
2349 if test "$gettimeofday" = "yes" ; then
2350 output_sym "CONFIG_GETTIMEOFDAY"
2352 if test "$posix_fadvise" = "yes" ; then
2353 output_sym "CONFIG_POSIX_FADVISE"
2355 if test "$linux_3arg_affinity" = "yes" ; then
2356 output_sym "CONFIG_3ARG_AFFINITY"
2357 elif test "$linux_2arg_affinity" = "yes" ; then
2358 output_sym "CONFIG_2ARG_AFFINITY"
2360 if test "$strsep" = "yes" ; then
2361 output_sym "CONFIG_STRSEP"
2363 if test "$strcasestr" = "yes" ; then
2364 output_sym "CONFIG_STRCASESTR"
2366 if test "$strlcat" = "yes" ; then
2367 output_sym "CONFIG_STRLCAT"
2369 if test "$getopt_long_only" = "yes" ; then
2370 output_sym "CONFIG_GETOPT_LONG_ONLY"
2372 if test "$inet_aton" = "yes" ; then
2373 output_sym "CONFIG_INET_ATON"
2375 if test "$socklen_t" = "yes" ; then
2376 output_sym "CONFIG_SOCKLEN_T"
2378 if test "$ext4_me" = "yes" ; then
2379 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2381 if test "$linux_splice" = "yes" ; then
2382 output_sym "CONFIG_LINUX_SPLICE"
2384 if test "$guasi" = "yes" ; then
2385 output_sym "CONFIG_GUASI"
2387 if test "$fusion_aw" = "yes" ; then
2388 output_sym "CONFIG_FUSION_AW"
2390 if test "$libnuma_v2" = "yes" ; then
2391 output_sym "CONFIG_LIBNUMA"
2393 if test "$solaris_aio" = "yes" ; then
2394 output_sym "CONFIG_SOLARISAIO"
2396 if test "$tls_thread" = "yes" ; then
2397 output_sym "CONFIG_TLS_THREAD"
2399 if test "$rusage_thread" = "yes" ; then
2400 output_sym "CONFIG_RUSAGE_THREAD"
2402 if test "$gfio" = "yes" ; then
2403 output_sym "CONFIG_GFIO"
2405 if test "$esx" = "yes" ; then
2406 output_sym "CONFIG_ESX"
2407 output_sym "CONFIG_NO_SHM"
2409 if test "$sched_idle" = "yes" ; then
2410 output_sym "CONFIG_SCHED_IDLE"
2412 if test "$tcp_nodelay" = "yes" ; then
2413 output_sym "CONFIG_TCP_NODELAY"
2415 if test "$window_size" = "yes" ; then
2416 output_sym "CONFIG_NET_WINDOWSIZE"
2418 if test "$mss" = "yes" ; then
2419 output_sym "CONFIG_NET_MSS"
2421 if test "$rlimit_memlock" = "yes" ; then
2422 output_sym "CONFIG_RLIMIT_MEMLOCK"
2424 if test "$pwritev" = "yes" ; then
2425 output_sym "CONFIG_PWRITEV"
2427 if test "$pwritev2" = "yes" ; then
2428 output_sym "CONFIG_PWRITEV2"
2430 if test "$ipv6" = "yes" ; then
2431 output_sym "CONFIG_IPV6"
2433 if test "$http" = "yes" ; then
2434 output_sym "CONFIG_HTTP"
2436 if test "$rados" = "yes" ; then
2437 output_sym "CONFIG_RADOS"
2439 if test "$rbd" = "yes" ; then
2440 output_sym "CONFIG_RBD"
2442 if test "$rbd_poll" = "yes" ; then
2443 output_sym "CONFIG_RBD_POLL"
2445 if test "$rbd_inval" = "yes" ; then
2446 output_sym "CONFIG_RBD_INVAL"
2448 if test "$setvbuf" = "yes" ; then
2449 output_sym "CONFIG_SETVBUF"
2451 if test "$s390_z196_facilities" = "yes" ; then
2452 output_sym "CONFIG_S390_Z196_FACILITIES"
2453 CFLAGS="$CFLAGS -march=z9-109"
2456 if test "$gfapi" = "yes" ; then
2457 output_sym "CONFIG_GFAPI"
2459 if test "$gf_fadvise" = "yes" ; then
2460 output_sym "CONFIG_GF_FADVISE"
2462 if test "$gf_trim" = "yes" ; then
2463 output_sym "CONFIG_GF_TRIM"
2465 if test "$libhdfs" = "yes" ; then
2466 output_sym "CONFIG_LIBHDFS"
2467 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2468 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2469 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2470 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2472 if test "$mtd" = "yes" ; then
2473 output_sym "CONFIG_MTD"
2475 if test "$pmemblk" = "yes" ; then
2476 output_sym "CONFIG_PMEMBLK"
2478 if test "$devdax" = "yes" ; then
2479 output_sym "CONFIG_LINUX_DEVDAX"
2481 if test "$pmem" = "yes" ; then
2482 output_sym "CONFIG_LIBPMEM"
2484 if test "$libime" = "yes" ; then
2485 output_sym "CONFIG_IME"
2487 if test "$arith" = "yes" ; then
2488 output_sym "CONFIG_ARITHMETIC"
2489 if test "$yacc_is_bison" = "yes" ; then
2490 echo "YACC=$YACC -y" >> $config_host_mak
2492 echo "YACC=$YACC" >> $config_host_mak
2494 if test "$lex_use_o" = "yes" ; then
2495 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2498 if test "$getmntent" = "yes" ; then
2499 output_sym "CONFIG_GETMNTENT"
2501 if test "$getmntinfo" = "yes" ; then
2502 output_sym "CONFIG_GETMNTINFO"
2504 if test "$getmntinfo_statvfs" = "yes" ; then
2505 output_sym "CONFIG_GETMNTINFO_STATVFS"
2507 if test "$static_assert" = "yes" ; then
2508 output_sym "CONFIG_STATIC_ASSERT"
2510 if test "$have_bool" = "yes" ; then
2511 output_sym "CONFIG_HAVE_BOOL"
2513 if test "$strndup" = "yes" ; then
2514 output_sym "CONFIG_HAVE_STRNDUP"
2516 if test "$disable_opt" = "yes" ; then
2517 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2519 if test "$valgrind_dev" = "yes"; then
2520 output_sym "CONFIG_VALGRIND_DEV"
2522 if test "$zlib" = "no" ; then
2523 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2524 if test "$build_static" = "yes"; then
2525 echo "Note that some distros have separate packages for static libraries."
2528 if test "$march_armv8_a_crc_crypto" = "yes" ; then
2529 output_sym "ARCH_HAVE_CRC_CRYPTO"
2531 if test "$cuda" = "yes" ; then
2532 output_sym "CONFIG_CUDA"
2534 if test "$mkdir_two" = "yes" ; then
2535 output_sym "CONFIG_HAVE_MKDIR_TWO"
2537 if test "$march_set" = "no" && test "$build_native" = "yes" ; then
2538 output_sym "CONFIG_BUILD_NATIVE"
2541 echo "LIBS+=$LIBS" >> $config_host_mak
2542 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
2543 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
2544 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
2545 echo "CC=$cc" >> $config_host_mak
2546 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
2547 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2549 if [ `dirname $0` != "." -a ! -e Makefile ]; then
2550 cat > Makefile <<EOF
2551 SRCDIR:=`dirname $0`
2552 include \$(SRCDIR)/Makefile