Makefile: Rerun the configure script if it has been modified
[fio.git] / configure
1 #!/bin/sh
2 #
3 # Fio configure script. Heavily influenced by the manual qemu configure
4 # script. Sad this is easier than autoconf and enemies.
5 #
6
7 # set temporary file name
8 if test ! -z "$TMPDIR" ; then
9     TMPDIR1="${TMPDIR}"
10 elif test ! -z "$TEMPDIR" ; then
11     TMPDIR1="${TEMPDIR}"
12 else
13     TMPDIR1="/tmp"
14 fi
15
16 TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
17 TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
18 TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
19
20 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
21 # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
22 trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
23
24 rm -rf config.log
25
26 config_host_mak="config-host.mak"
27 config_host_h="config-host.h"
28
29 rm -rf $config_host_mak
30 rm -rf $config_host_h
31
32 fatal() {
33   echo $@
34   echo "Configure failed, check config.log and/or the above output"
35   rm -rf $config_host_mak
36   rm -rf $config_host_h
37   exit 1
38 }
39
40 # Print result for each configuration test
41 print_config() {
42   printf "%-30s%s\n" "$1" "$2"
43 }
44
45 # Default CFLAGS
46 CFLAGS="-D_GNU_SOURCE -include config-host.h"
47 BUILD_CFLAGS=""
48
49 # Print a helpful header at the top of config.log
50 echo "# FIO configure log $(date)" >> config.log
51 printf "# Configured with:" >> config.log
52 printf " '%s'" "$0" "$@" >> config.log
53 echo >> config.log
54 echo "#" >> config.log
55
56 # Print configure header at the top of $config_host_h
57 echo "/*" > $config_host_h
58 echo " * Automatically generated by configure - do not modify" >> $config_host_h
59 printf " * Configured with:" >> $config_host_h
60 printf " * '%s'" "$0" "$@" >> $config_host_h
61 echo "" >> $config_host_h
62 echo " */" >> $config_host_h
63
64 do_cc() {
65     # Run the compiler, capturing its output to the log.
66     echo $cc "$@" >> config.log
67     $cc "$@" >> config.log 2>&1 || return $?
68     # Test passed. If this is an --enable-werror build, rerun
69     # the test with -Werror and bail out if it fails. This
70     # makes warning-generating-errors in configure test code
71     # obvious to developers.
72     if test "$werror" != "yes"; then
73         return 0
74     fi
75     # Don't bother rerunning the compile if we were already using -Werror
76     case "$*" in
77         *-Werror*)
78            return 0
79         ;;
80     esac
81     echo $cc -Werror "$@" >> config.log
82     $cc -Werror "$@" >> config.log 2>&1 && return $?
83     echo "ERROR: configure test passed without -Werror but failed with -Werror."
84     echo "This is probably a bug in the configure script. The failing command"
85     echo "will be at the bottom of config.log."
86     fatal "You can run configure with --disable-werror to bypass this check."
87 }
88
89 compile_object() {
90   do_cc $CFLAGS -c -o $TMPO $TMPC
91 }
92
93 compile_prog() {
94   local_cflags="$1"
95   local_ldflags="$2 $LIBS"
96   echo "Compiling test case $3" >> config.log
97   do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
98 }
99
100 feature_not_found() {
101   feature=$1
102   packages=$2
103
104   echo "ERROR"
105   echo "ERROR: User requested feature $feature"
106   if test ! -z "$packages" ; then
107     echo "ERROR: That feature needs $packages installed"
108   fi
109   echo "ERROR: configure was not able to find it"
110   fatal "ERROR"
111 }
112
113 has() {
114   type "$1" >/dev/null 2>&1
115 }
116
117 check_define() {
118   cat > $TMPC <<EOF
119 #if !defined($1)
120 #error $1 not defined
121 #endif
122 int main(void)
123 {
124   return 0;
125 }
126 EOF
127   compile_object
128 }
129
130 output_sym() {
131   echo "$1=y" >> $config_host_mak
132   echo "#define $1" >> $config_host_h
133 }
134
135 targetos=""
136 cpu=""
137
138 # default options
139 show_help="no"
140 exit_val=0
141 gfio_check="no"
142 libhdfs="no"
143 pmemblk="no"
144 devdax="no"
145 pmem="no"
146 disable_lex=""
147 disable_pmem="no"
148 disable_native="no"
149 march_set="no"
150 prefix=/usr/local
151
152 # parse options
153 for opt do
154   optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
155   case "$opt" in
156   --prefix=*) prefix="$optarg"
157   ;;
158   --cpu=*) cpu="$optarg"
159   ;;
160   #  esx is cross compiled and cannot be detect through simple uname calls
161   --esx)
162   esx="yes"
163   ;;
164   --cc=*) CC="$optarg"
165   ;;
166   --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
167   ;;
168   --build-32bit-win) build_32bit_win="yes"
169   ;;
170   --build-static) build_static="yes"
171   ;;
172   --enable-gfio) gfio_check="yes"
173   ;;
174   --disable-numa) disable_numa="yes"
175   ;;
176   --disable-rdma) disable_rdma="yes"
177   ;;
178   --disable-rados) disable_rados="yes"
179   ;;
180   --disable-rbd) disable_rbd="yes"
181   ;;
182   --disable-gfapi) disable_gfapi="yes"
183   ;;
184   --enable-libhdfs) libhdfs="yes"
185   ;;
186   --disable-lex) disable_lex="yes"
187   ;;
188   --enable-lex) disable_lex="no"
189   ;;
190   --disable-shm) no_shm="yes"
191   ;;
192   --disable-optimizations) disable_opt="yes"
193   ;;
194   --disable-pmem) disable_pmem="yes"
195   ;;
196   --enable-cuda) enable_cuda="yes"
197   ;;
198   --disable-native) disable_native="yes"
199   ;;
200   --help)
201     show_help="yes"
202     ;;
203   *)
204   echo "Bad option $opt"
205   show_help="yes"
206   exit_val=1
207   esac
208 done
209
210 if test "$show_help" = "yes" ; then
211   echo "--prefix=               Use this directory as installation prefix"
212   echo "--cpu=                  Specify target CPU if auto-detect fails"
213   echo "--cc=                   Specify compiler to use"
214   echo "--extra-cflags=         Specify extra CFLAGS to pass to compiler"
215   echo "--build-32bit-win       Enable 32-bit build on Windows"
216   echo "--build-static          Build a static fio"
217   echo "--esx                   Configure build options for esx"
218   echo "--enable-gfio           Enable building of gtk gfio"
219   echo "--disable-numa          Disable libnuma even if found"
220   echo "--disable-rdma          Disable RDMA support even if found"
221   echo "--disable-gfapi         Disable gfapi"
222   echo "--enable-libhdfs        Enable hdfs support"
223   echo "--disable-lex           Disable use of lex/yacc for math"
224   echo "--disable-pmem          Disable pmem based engines even if found"
225   echo "--enable-lex            Enable use of lex/yacc for math"
226   echo "--disable-shm           Disable SHM support"
227   echo "--disable-optimizations Don't enable compiler optimizations"
228   echo "--enable-cuda           Enable GPUDirect RDMA support"
229   echo "--disable-native        Don't build for native host"
230   exit $exit_val
231 fi
232
233 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
234 # Preferred compiler (can be overriden later after we know the platform):
235 #  ${CC} (if set)
236 #  ${cross_prefix}gcc (if cross-prefix specified)
237 #  gcc if available
238 #  clang if available
239 if test -z "${CC}${cross_prefix}"; then
240   if has gcc; then
241     cc=gcc
242   elif has clang; then
243     cc=clang
244   fi
245 else
246   cc="${CC-${cross_prefix}gcc}"
247 fi
248
249 if check_define __ANDROID__ ; then
250   targetos="Android"
251 elif check_define __linux__ ; then
252   targetos="Linux"
253 elif check_define __OpenBSD__ ; then
254   targetos='OpenBSD'
255 elif check_define __sun__ ; then
256   targetos='SunOS'
257   CFLAGS="$CFLAGS -D_REENTRANT"
258 elif check_define _WIN32 ; then
259   targetos='CYGWIN'
260 else
261   targetos=`uname -s`
262 fi
263
264 echo "# Automatically generated by configure - do not modify" > $config_host_mak
265 printf "# Configured with:" >> $config_host_mak
266 printf " '%s'" "$0" "$@" >> $config_host_mak
267 echo >> $config_host_mak
268 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
269
270 if test "$no_shm" = "yes" ; then
271   output_sym "CONFIG_NO_SHM"
272 fi
273
274 if test "$disable_opt" = "yes" ; then
275   output_sym "CONFIG_FIO_NO_OPT"
276 fi
277
278 # Some host OSes need non-standard checks for which CPU to use.
279 # Note that these checks are broken for cross-compilation: if you're
280 # cross-compiling to one of these OSes then you'll need to specify
281 # the correct CPU with the --cpu option.
282 case $targetos in
283 AIX|OpenBSD)
284   # Unless explicitly enabled, turn off lex.
285   # OpenBSD will hit syntax error when enabled.
286   if test -z "$disable_lex" ; then
287     disable_lex="yes"
288   else
289     force_no_lex_o="yes"
290   fi
291   ;;
292 Darwin)
293   # on Leopard most of the system is 32-bit, so we have to ask the kernel if
294   # we can run 64-bit userspace code.
295   # If the user didn't specify a CPU explicitly and the kernel says this is
296   # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
297   # detection code.
298   if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
299     cpu="x86_64"
300   fi
301   # Error at compile time linking of weak/partial symbols if possible...
302 cat > $TMPC <<EOF
303 int main(void)
304 {
305   return 0;
306 }
307 EOF
308   if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
309     echo "Disabling weak symbols"
310     LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
311   fi
312   ;;
313 SunOS)
314   # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
315   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
316     cpu="x86_64"
317   fi
318   LIBS="-lnsl -lsocket"
319   ;;
320 CYGWIN*)
321   # We still force some options, so keep this message here.
322   echo "Forcing some known good options on Windows"
323   if test -z "${CC}${cross_prefix}"; then
324     if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
325       cc="i686-w64-mingw32-gcc"
326     else
327       cc="x86_64-w64-mingw32-gcc"
328     fi
329   fi
330   if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
331     output_sym "CONFIG_32BIT"
332   else
333     output_sym "CONFIG_64BIT_LLP64"
334   fi
335   # We need this to be output_sym'd here because this is Windows specific.
336   # The regular configure path never sets this config.
337   output_sym "CONFIG_WINDOWSAIO"
338   # We now take the regular configuration path without having exit 0 here.
339   # Flags below are still necessary mostly for MinGW.
340   socklen_t="yes"
341   sfaa="yes"
342   sync_sync="yes"
343   cmp_swap="yes"
344   rusage_thread="yes"
345   fdatasync="yes"
346   clock_gettime="yes" # clock_monotonic probe has dependency on this
347   clock_monotonic="yes"
348   gettimeofday="yes"
349   sched_idle="yes"
350   tcp_nodelay="yes"
351   tls_thread="yes"
352   static_assert="yes"
353   ipv6="yes"
354   mkdir_two="no"
355   echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
356   ;;
357 esac
358
359 # Now we know the target platform we can have another guess at the preferred
360 # compiler when it wasn't explictly set
361 if test -z "${CC}${cross_prefix}"; then
362   if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then
363     if has clang; then
364       cc=clang
365     fi
366   fi
367 fi
368 if test -z "$cc"; then
369     echo "configure: failed to find compiler"
370     exit 1
371 fi
372
373 if test ! -z "$cpu" ; then
374   # command line argument
375   :
376 elif check_define __i386__ ; then
377   cpu="i386"
378 elif check_define __x86_64__ ; then
379   cpu="x86_64"
380 elif check_define __sparc__ ; then
381   if check_define __arch64__ ; then
382     cpu="sparc64"
383   else
384     cpu="sparc"
385   fi
386 elif check_define _ARCH_PPC ; then
387   if check_define _ARCH_PPC64 ; then
388     cpu="ppc64"
389   else
390     cpu="ppc"
391   fi
392 elif check_define __mips__ ; then
393   cpu="mips"
394 elif check_define __ia64__ ; then
395   cpu="ia64"
396 elif check_define __s390__ ; then
397   if check_define __s390x__ ; then
398     cpu="s390x"
399   else
400     cpu="s390"
401   fi
402 elif check_define __arm__ ; then
403   cpu="arm"
404 elif check_define __aarch64__ ; then
405   cpu="aarch64"
406 elif check_define __hppa__ ; then
407   cpu="hppa"
408 else
409   cpu=`uname -m`
410 fi
411
412 # Normalise host CPU name and set ARCH.
413 case "$cpu" in
414   ia64|ppc|ppc64|s390|s390x|sparc64)
415     cpu="$cpu"
416   ;;
417   i386|i486|i586|i686|i86pc|BePC)
418     cpu="x86"
419   ;;
420   x86_64|amd64)
421     cpu="x86_64"
422   ;;
423   armv*b|armv*l|arm)
424     cpu="arm"
425   ;;
426   aarch64)
427     cpu="arm64"
428   ;;
429   hppa|parisc|parisc64)
430     cpu="hppa"
431   ;;
432   mips*)
433     cpu="mips"
434   ;;
435   sparc|sun4[cdmuv])
436     cpu="sparc"
437   ;;
438   *)
439   echo "Unknown CPU"
440   ;;
441 esac
442
443 ##########################################
444 # check cross compile
445
446 if test "$cross_compile" != "yes" ; then
447   cross_compile="no"
448 fi
449 cat > $TMPC <<EOF
450 int main(void)
451 {
452   return 0;
453 }
454 EOF
455 if compile_prog "" "" "cross"; then
456   $TMPE 2>/dev/null || cross_compile="yes"
457 else
458   fatal "compile test failed"
459 fi
460
461 ##########################################
462 # check endianness
463 if test "$bigendian" != "yes" ; then
464   bigendian="no"
465 fi
466 if test "$cross_compile" = "no" ; then
467   cat > $TMPC <<EOF
468 #include <inttypes.h>
469 int main(void)
470 {
471   volatile uint32_t i=0x01234567;
472   return (*((uint8_t*)(&i))) == 0x67;
473 }
474 EOF
475   if compile_prog "" "" "endian"; then
476     $TMPE && bigendian="yes"
477   fi
478 else
479   # If we're cross compiling, try our best to work it out and rely on the
480   # run-time check to fail if we get it wrong.
481   cat > $TMPC <<EOF
482 #include <endian.h>
483 int main(void)
484 {
485 #if __BYTE_ORDER != __BIG_ENDIAN
486 # error "Unknown endianness"
487 #endif
488 }
489 EOF
490   compile_prog "" "" "endian" && bigendian="yes"
491   check_define "__ARMEB__" && bigendian="yes"
492   check_define "__MIPSEB__" && bigendian="yes"
493 fi
494
495
496 print_config "Operating system" "$targetos"
497 print_config "CPU" "$cpu"
498 print_config "Big endian" "$bigendian"
499 print_config "Compiler" "$cc"
500 print_config "Cross compile" "$cross_compile"
501 echo
502
503 ##########################################
504 # See if we need to build a static build
505 if test "$build_static" = "yes" ; then
506   CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
507   LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
508 else
509   build_static="no"
510 fi
511 print_config "Static build" "$build_static"
512
513 ##########################################
514 # check for wordsize
515 wordsize="0"
516 cat > $TMPC <<EOF
517 #include <limits.h>
518 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
519 int main(void)
520 {
521   BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
522   return 0;
523 }
524 EOF
525 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
526   wordsize="32"
527 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
528   wordsize="64"
529 else
530   fatal "Unknown wordsize"
531 fi
532 print_config "Wordsize" "$wordsize"
533
534 ##########################################
535 # zlib probe
536 if test "$zlib" != "yes" ; then
537   zlib="no"
538 fi
539 cat > $TMPC <<EOF
540 #include <zlib.h>
541 int main(void)
542 {
543   z_stream stream;
544   if (inflateInit(&stream) != Z_OK)
545     return 1;
546   return 0;
547 }
548 EOF
549 if compile_prog "" "-lz" "zlib" ; then
550   zlib=yes
551   LIBS="-lz $LIBS"
552 fi
553 print_config "zlib" "$zlib"
554
555 ##########################################
556 # linux-aio probe
557 if test "$libaio" != "yes" ; then
558   libaio="no"
559 fi
560 if test "$esx" != "yes" ; then
561   cat > $TMPC <<EOF
562 #include <libaio.h>
563 #include <stddef.h>
564 int main(void)
565 {
566   io_setup(0, NULL);
567   return 0;
568 }
569 EOF
570   if compile_prog "" "-laio" "libaio" ; then
571     libaio=yes
572     LIBS="-laio $LIBS"
573   else
574     if test "$libaio" = "yes" ; then
575       feature_not_found "linux AIO" "libaio-dev or libaio-devel"
576     fi
577     libaio=no
578   fi
579 fi
580 print_config "Linux AIO support" "$libaio"
581
582 ##########################################
583 # posix aio probe
584 if test "$posix_aio" != "yes" ; then
585   posix_aio="no"
586 fi
587 if test "$posix_aio_lrt" != "yes" ; then
588   posix_aio_lrt="no"
589 fi
590 cat > $TMPC <<EOF
591 #include <aio.h>
592 int main(void)
593 {
594   struct aiocb cb;
595   aio_read(&cb);
596   return 0;
597 }
598 EOF
599 if compile_prog "" "" "posixaio" ; then
600   posix_aio="yes"
601 elif compile_prog "" "-lrt" "posixaio"; then
602   posix_aio="yes"
603   posix_aio_lrt="yes"
604   LIBS="-lrt $LIBS"
605 fi
606 print_config "POSIX AIO support" "$posix_aio"
607 print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
608
609 ##########################################
610 # posix aio fsync probe
611 if test "$posix_aio_fsync" != "yes" ; then
612   posix_aio_fsync="no"
613 fi
614 if test "$posix_aio" = "yes" ; then
615   cat > $TMPC <<EOF
616 #include <fcntl.h>
617 #include <aio.h>
618 int main(void)
619 {
620   struct aiocb cb;
621   return aio_fsync(O_SYNC, &cb);
622   return 0;
623 }
624 EOF
625   if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
626     posix_aio_fsync=yes
627   fi
628 fi
629 print_config "POSIX AIO fsync" "$posix_aio_fsync"
630
631 ##########################################
632 # POSIX pshared attribute probe
633 if test "$posix_pshared" != "yes" ; then
634   posix_pshared="no"
635 fi
636 cat > $TMPC <<EOF
637 #include <unistd.h>
638 int main(void)
639 {
640 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
641 # if defined(__CYGWIN__)
642 #  error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
643 # elif defined(__APPLE__)
644 #  include <AvailabilityMacros.h>
645 #  include <TargetConditionals.h>
646 #  if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
647 #   error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
648 #  endif
649 # endif
650 #else
651 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
652 #endif
653   return 0;
654 }
655 EOF
656 if compile_prog "" "$LIBS" "posix_pshared" ; then
657   posix_pshared=yes
658 fi
659 print_config "POSIX pshared support" "$posix_pshared"
660
661 ##########################################
662 # solaris aio probe
663 if test "$solaris_aio" != "yes" ; then
664   solaris_aio="no"
665 fi
666 cat > $TMPC <<EOF
667 #include <sys/types.h>
668 #include <sys/asynch.h>
669 #include <unistd.h>
670 int main(void)
671 {
672   aio_result_t res;
673   return aioread(0, NULL, 0, 0, SEEK_SET, &res);
674   return 0;
675 }
676 EOF
677 if compile_prog "" "-laio" "solarisaio" ; then
678   solaris_aio=yes
679   LIBS="-laio $LIBS"
680 fi
681 print_config "Solaris AIO support" "$solaris_aio"
682
683 ##########################################
684 # __sync_fetch_and_add test
685 if test "$sfaa" != "yes" ; then
686   sfaa="no"
687 fi
688 cat > $TMPC << EOF
689 #include <inttypes.h>
690 static int sfaa(uint64_t *ptr)
691 {
692   return __sync_fetch_and_add(ptr, 0);
693 }
694
695 int main(int argc, char **argv)
696 {
697   uint64_t val = 42;
698   sfaa(&val);
699   return val;
700 }
701 EOF
702 if compile_prog "" "" "__sync_fetch_and_add()" ; then
703     sfaa="yes"
704 fi
705 print_config "__sync_fetch_and_add" "$sfaa"
706
707 ##########################################
708 # __sync_synchronize() test
709 if test "$sync_sync" != "yes" ; then
710   sync_sync="no"
711 fi
712 cat > $TMPC << EOF
713 #include <inttypes.h>
714
715 int main(int argc, char **argv)
716 {
717   __sync_synchronize();
718   return 0;
719 }
720 EOF
721 if compile_prog "" "" "__sync_synchronize()" ; then
722     sync_sync="yes"
723 fi
724 print_config "__sync_synchronize" "$sync_sync"
725
726 ##########################################
727 # __sync_val_compare_and_swap() test
728 if test "$cmp_swap" != "yes" ; then
729   cmp_swap="no"
730 fi
731 cat > $TMPC << EOF
732 #include <inttypes.h>
733
734 int main(int argc, char **argv)
735 {
736   int x = 0;
737   return __sync_val_compare_and_swap(&x, 1, 2);
738 }
739 EOF
740 if compile_prog "" "" "__sync_val_compare_and_swap()" ; then
741     cmp_swap="yes"
742 fi
743 print_config "__sync_val_compare_and_swap" "$cmp_swap"
744
745 ##########################################
746 # libverbs probe
747 if test "$libverbs" != "yes" ; then
748   libverbs="no"
749 fi
750 cat > $TMPC << EOF
751 #include <infiniband/verbs.h>
752 int main(int argc, char **argv)
753 {
754   struct ibv_pd *pd = ibv_alloc_pd(NULL);
755   return 0;
756 }
757 EOF
758 if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
759     libverbs="yes"
760     LIBS="-libverbs $LIBS"
761 fi
762 print_config "libverbs" "$libverbs"
763
764 ##########################################
765 # rdmacm probe
766 if test "$rdmacm" != "yes" ; then
767   rdmacm="no"
768 fi
769 cat > $TMPC << EOF
770 #include <stdio.h>
771 #include <rdma/rdma_cma.h>
772 int main(int argc, char **argv)
773 {
774   rdma_destroy_qp(NULL);
775   return 0;
776 }
777 EOF
778 if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
779     rdmacm="yes"
780     LIBS="-lrdmacm $LIBS"
781 fi
782 print_config "rdmacm" "$rdmacm"
783
784 ##########################################
785 # Linux fallocate probe
786 if test "$linux_fallocate" != "yes" ; then
787   linux_fallocate="no"
788 fi
789 cat > $TMPC << EOF
790 #include <stdio.h>
791 #include <fcntl.h>
792 #include <linux/falloc.h>
793 int main(int argc, char **argv)
794 {
795   int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
796   return r;
797 }
798 EOF
799 if compile_prog "" "" "linux_fallocate"; then
800     linux_fallocate="yes"
801 fi
802 print_config "Linux fallocate" "$linux_fallocate"
803
804 ##########################################
805 # POSIX fadvise probe
806 if test "$posix_fadvise" != "yes" ; then
807   posix_fadvise="no"
808 fi
809 cat > $TMPC << EOF
810 #include <stdio.h>
811 #include <fcntl.h>
812 int main(int argc, char **argv)
813 {
814   int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
815   return r;
816 }
817 EOF
818 if compile_prog "" "" "posix_fadvise"; then
819     posix_fadvise="yes"
820 fi
821 print_config "POSIX fadvise" "$posix_fadvise"
822
823 ##########################################
824 # POSIX fallocate probe
825 if test "$posix_fallocate" != "yes" ; then
826   posix_fallocate="no"
827 fi
828 cat > $TMPC << EOF
829 #include <stdio.h>
830 #include <fcntl.h>
831 int main(int argc, char **argv)
832 {
833   int r = posix_fallocate(0, 0, 1024);
834   return r;
835 }
836 EOF
837 if compile_prog "" "" "posix_fallocate"; then
838     posix_fallocate="yes"
839 fi
840 print_config "POSIX fallocate" "$posix_fallocate"
841
842 ##########################################
843 # sched_set/getaffinity 2 or 3 argument test
844 if test "$linux_2arg_affinity" != "yes" ; then
845   linux_2arg_affinity="no"
846 fi
847 if test "$linux_3arg_affinity" != "yes" ; then
848   linux_3arg_affinity="no"
849 fi
850 cat > $TMPC << EOF
851 #include <sched.h>
852 int main(int argc, char **argv)
853 {
854   cpu_set_t mask;
855   return sched_setaffinity(0, sizeof(mask), &mask);
856 }
857 EOF
858 if compile_prog "" "" "sched_setaffinity(,,)"; then
859   linux_3arg_affinity="yes"
860 else
861   cat > $TMPC << EOF
862 #include <sched.h>
863 int main(int argc, char **argv)
864 {
865   cpu_set_t mask;
866   return sched_setaffinity(0, &mask);
867 }
868 EOF
869   if compile_prog "" "" "sched_setaffinity(,)"; then
870     linux_2arg_affinity="yes"
871   fi
872 fi
873 print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
874 print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
875
876 ##########################################
877 # clock_gettime probe
878 if test "$clock_gettime" != "yes" ; then
879   clock_gettime="no"
880 fi
881 cat > $TMPC << EOF
882 #include <stdio.h>
883 #include <time.h>
884 int main(int argc, char **argv)
885 {
886   return clock_gettime(0, NULL);
887 }
888 EOF
889 if compile_prog "" "" "clock_gettime"; then
890     clock_gettime="yes"
891 elif compile_prog "" "-lrt" "clock_gettime"; then
892     clock_gettime="yes"
893     LIBS="-lrt $LIBS"
894 fi
895 print_config "clock_gettime" "$clock_gettime"
896
897 ##########################################
898 # CLOCK_MONOTONIC probe
899 if test "$clock_monotonic" != "yes" ; then
900   clock_monotonic="no"
901 fi
902 if test "$clock_gettime" = "yes" ; then
903   cat > $TMPC << EOF
904 #include <stdio.h>
905 #include <time.h>
906 int main(int argc, char **argv)
907 {
908   return clock_gettime(CLOCK_MONOTONIC, NULL);
909 }
910 EOF
911   if compile_prog "" "$LIBS" "clock monotonic"; then
912       clock_monotonic="yes"
913   fi
914 fi
915 print_config "CLOCK_MONOTONIC" "$clock_monotonic"
916
917 ##########################################
918 # CLOCK_MONOTONIC_RAW probe
919 if test "$clock_monotonic_raw" != "yes" ; then
920   clock_monotonic_raw="no"
921 fi
922 if test "$clock_gettime" = "yes" ; then
923   cat > $TMPC << EOF
924 #include <stdio.h>
925 #include <time.h>
926 int main(int argc, char **argv)
927 {
928   return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
929 }
930 EOF
931   if compile_prog "" "$LIBS" "clock monotonic"; then
932       clock_monotonic_raw="yes"
933   fi
934 fi
935 print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw"
936
937 ##########################################
938 # CLOCK_MONOTONIC_PRECISE probe
939 if test "$clock_monotonic_precise" != "yes" ; then
940   clock_monotonic_precise="no"
941 fi
942 if test "$clock_gettime" = "yes" ; then
943   cat > $TMPC << EOF
944 #include <stdio.h>
945 #include <time.h>
946 int main(int argc, char **argv)
947 {
948   return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
949 }
950 EOF
951   if compile_prog "" "$LIBS" "clock monotonic precise"; then
952       clock_monotonic_precise="yes"
953   fi
954 fi
955 print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise"
956
957 ##########################################
958 # clockid_t probe
959 if test "$clockid_t" != "yes" ; then
960   clockid_t="no"
961 fi
962 cat > $TMPC << EOF
963 #include <time.h>
964 #include <string.h>
965 int main(int argc, char **argv)
966 {
967   volatile clockid_t cid;
968   memset((void*)&cid, 0, sizeof(cid));
969   return 0;
970 }
971 EOF
972 if compile_prog "" "$LIBS" "clockid_t"; then
973   clockid_t="yes"
974 fi
975 print_config "clockid_t" "$clockid_t"
976
977 ##########################################
978 # gettimeofday() probe
979 if test "$gettimeofday" != "yes" ; then
980   gettimeofday="no"
981 fi
982 cat > $TMPC << EOF
983 #include <sys/time.h>
984 #include <stdio.h>
985 int main(int argc, char **argv)
986 {
987   struct timeval tv;
988   return gettimeofday(&tv, NULL);
989 }
990 EOF
991 if compile_prog "" "" "gettimeofday"; then
992     gettimeofday="yes"
993 fi
994 print_config "gettimeofday" "$gettimeofday"
995
996 ##########################################
997 # fdatasync() probe
998 if test "$fdatasync" != "yes" ; then
999   fdatasync="no"
1000 fi
1001 cat > $TMPC << EOF
1002 #include <stdio.h>
1003 #include <unistd.h>
1004 int main(int argc, char **argv)
1005 {
1006   return fdatasync(0);
1007 }
1008 EOF
1009 if compile_prog "" "" "fdatasync"; then
1010   fdatasync="yes"
1011 fi
1012 print_config "fdatasync" "$fdatasync"
1013
1014 ##########################################
1015 # sync_file_range() probe
1016 if test "$sync_file_range" != "yes" ; then
1017   sync_file_range="no"
1018 fi
1019 cat > $TMPC << EOF
1020 #include <stdio.h>
1021 #include <unistd.h>
1022 #include <fcntl.h>
1023 #include <linux/fs.h>
1024 int main(int argc, char **argv)
1025 {
1026   unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
1027                         SYNC_FILE_RANGE_WAIT_AFTER;
1028   return sync_file_range(0, 0, 0, flags);
1029 }
1030 EOF
1031 if compile_prog "" "" "sync_file_range"; then
1032   sync_file_range="yes"
1033 fi
1034 print_config "sync_file_range" "$sync_file_range"
1035
1036 ##########################################
1037 # ext4 move extent probe
1038 if test "$ext4_me" != "yes" ; then
1039   ext4_me="no"
1040 fi
1041 cat > $TMPC << EOF
1042 #include <fcntl.h>
1043 #include <sys/ioctl.h>
1044 int main(int argc, char **argv)
1045 {
1046   struct move_extent me;
1047   return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
1048 }
1049 EOF
1050 if compile_prog "" "" "ext4 move extent" ; then
1051   ext4_me="yes"
1052 elif test $targetos = "Linux" ; then
1053   # On Linux, just default to it on and let it error at runtime if we really
1054   # don't have it. None of my updated systems have it defined, but it does
1055   # work. Takes a while to bubble back.
1056   ext4_me="yes"
1057 fi
1058 print_config "EXT4 move extent" "$ext4_me"
1059
1060 ##########################################
1061 # splice probe
1062 if test "$linux_splice" != "yes" ; then
1063   linux_splice="no"
1064 fi
1065 cat > $TMPC << EOF
1066 #include <stdio.h>
1067 #include <fcntl.h>
1068 int main(int argc, char **argv)
1069 {
1070   return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1071 }
1072 EOF
1073 if compile_prog "" "" "linux splice"; then
1074   linux_splice="yes"
1075 fi
1076 print_config "Linux splice(2)" "$linux_splice"
1077
1078 ##########################################
1079 # GUASI probe
1080 if test "$guasi" != "yes" ; then
1081   guasi="no"
1082 fi
1083 cat > $TMPC << EOF
1084 #include <guasi.h>
1085 #include <guasi_syscalls.h>
1086 int main(int argc, char **argv)
1087 {
1088   guasi_t ctx = guasi_create(0, 0, 0);
1089   return 0;
1090 }
1091 EOF
1092 if compile_prog "" "" "guasi"; then
1093   guasi="yes"
1094 fi
1095 print_config "GUASI" "$guasi"
1096
1097 ##########################################
1098 # fusion-aw probe
1099 if test "$fusion_aw" != "yes" ; then
1100   fusion_aw="no"
1101 fi
1102 cat > $TMPC << EOF
1103 #include <nvm/nvm_primitives.h>
1104 int main(int argc, char **argv)
1105 {
1106   nvm_version_t ver_info;
1107   nvm_handle_t handle;
1108
1109   handle = nvm_get_handle(0, &ver_info);
1110   return nvm_atomic_write(handle, 0, 0, 0);
1111 }
1112 EOF
1113 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1114   LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
1115   fusion_aw="yes"
1116 fi
1117 print_config "Fusion-io atomic engine" "$fusion_aw"
1118
1119 ##########################################
1120 # libnuma probe
1121 if test "$libnuma" != "yes" ; then
1122   libnuma="no"
1123 fi
1124 cat > $TMPC << EOF
1125 #include <numa.h>
1126 int main(int argc, char **argv)
1127 {
1128   return numa_available();
1129 }
1130 EOF
1131 if test "$disable_numa" != "yes"  && compile_prog "" "-lnuma" "libnuma"; then
1132   libnuma="yes"
1133   LIBS="-lnuma $LIBS"
1134 fi
1135 print_config "libnuma" "$libnuma"
1136
1137 ##########################################
1138 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1139 if test "$libnuma" = "yes" ; then
1140 libnuma_v2="no"
1141 cat > $TMPC << EOF
1142 #include <numa.h>
1143 int main(int argc, char **argv)
1144 {
1145   struct bitmask *mask = numa_parse_nodestring(NULL);
1146   return mask->size == 0;
1147 }
1148 EOF
1149 if compile_prog "" "" "libnuma api"; then
1150   libnuma_v2="yes"
1151 fi
1152 print_config "libnuma v2" "$libnuma_v2"
1153 fi
1154
1155 ##########################################
1156 # strsep() probe
1157 if test "$strsep" != "yes" ; then
1158   strsep="no"
1159 fi
1160 cat > $TMPC << EOF
1161 #include <string.h>
1162 int main(int argc, char **argv)
1163 {
1164   static char *string = "This is a string";
1165   strsep(&string, "needle");
1166   return 0;
1167 }
1168 EOF
1169 if compile_prog "" "" "strsep"; then
1170   strsep="yes"
1171 fi
1172 print_config "strsep" "$strsep"
1173
1174 ##########################################
1175 # strcasestr() probe
1176 if test "$strcasestr" != "yes" ; then
1177   strcasestr="no"
1178 fi
1179 cat > $TMPC << EOF
1180 #include <string.h>
1181 int main(int argc, char **argv)
1182 {
1183   return strcasestr(argv[0], argv[1]) != NULL;
1184 }
1185 EOF
1186 if compile_prog "" "" "strcasestr"; then
1187   strcasestr="yes"
1188 fi
1189 print_config "strcasestr" "$strcasestr"
1190
1191 ##########################################
1192 # strlcat() probe
1193 if test "$strlcat" != "yes" ; then
1194   strlcat="no"
1195 fi
1196 cat > $TMPC << EOF
1197 #include <string.h>
1198 int main(int argc, char **argv)
1199 {
1200   static char dst[64];
1201   static char *string = "This is a string";
1202   memset(dst, 0, sizeof(dst));
1203   strlcat(dst, string, sizeof(dst));
1204   return 0;
1205 }
1206 EOF
1207 if compile_prog "" "" "strlcat"; then
1208   strlcat="yes"
1209 fi
1210 print_config "strlcat" "$strlcat"
1211
1212 ##########################################
1213 # getopt_long_only() probe
1214 if test "$getopt_long_only" != "yes" ; then
1215   getopt_long_only="no"
1216 fi
1217 cat > $TMPC << EOF
1218 #include <unistd.h>
1219 #include <stdio.h>
1220 #include <getopt.h>
1221 int main(int argc, char **argv)
1222 {
1223   int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1224   return c;
1225 }
1226 EOF
1227 if compile_prog "" "" "getopt_long_only"; then
1228   getopt_long_only="yes"
1229 fi
1230 print_config "getopt_long_only()" "$getopt_long_only"
1231
1232 ##########################################
1233 # inet_aton() probe
1234 if test "$inet_aton" != "yes" ; then
1235   inet_aton="no"
1236 fi
1237 cat > $TMPC << EOF
1238 #include <sys/socket.h>
1239 #include <arpa/inet.h>
1240 #include <stdio.h>
1241 int main(int argc, char **argv)
1242 {
1243   struct in_addr in;
1244   return inet_aton(NULL, &in);
1245 }
1246 EOF
1247 if compile_prog "" "" "inet_aton"; then
1248   inet_aton="yes"
1249 fi
1250 print_config "inet_aton" "$inet_aton"
1251
1252 ##########################################
1253 # socklen_t probe
1254 if test "$socklen_t" != "yes" ; then
1255   socklen_t="no"
1256 fi
1257 cat > $TMPC << EOF
1258 #include <sys/socket.h>
1259 int main(int argc, char **argv)
1260 {
1261   socklen_t len = 0;
1262   return len;
1263 }
1264 EOF
1265 if compile_prog "" "" "socklen_t"; then
1266   socklen_t="yes"
1267 fi
1268 print_config "socklen_t" "$socklen_t"
1269
1270 ##########################################
1271 # Whether or not __thread is supported for TLS
1272 if test "$tls_thread" != "yes" ; then
1273   tls_thread="no"
1274 fi
1275 cat > $TMPC << EOF
1276 #include <stdio.h>
1277 static __thread int ret;
1278 int main(int argc, char **argv)
1279 {
1280   return ret;
1281 }
1282 EOF
1283 if compile_prog "" "" "__thread"; then
1284   tls_thread="yes"
1285 fi
1286 print_config "__thread" "$tls_thread"
1287
1288 ##########################################
1289 # Check if we have required gtk/glib support for gfio
1290 if test "$gfio" != "yes" ; then
1291   gfio="no"
1292 fi
1293 if test "$gfio_check" = "yes" ; then
1294   cat > $TMPC << EOF
1295 #include <glib.h>
1296 #include <cairo.h>
1297 #include <gtk/gtk.h>
1298 int main(void)
1299 {
1300   gdk_threads_enter();
1301   gdk_threads_leave();
1302
1303   return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1304 }
1305 EOF
1306 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1307 ORG_LDFLAGS=$LDFLAGS
1308 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1309 if test "$?" != "0" ; then
1310   echo "configure: gtk and gthread not found"
1311   exit 1
1312 fi
1313 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1314 if test "$?" != "0" ; then
1315   echo "configure: gtk and gthread not found"
1316   exit 1
1317 fi
1318 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1319   $TMPE
1320   if test "$?" = "0" ; then
1321     gfio="yes"
1322     GFIO_LIBS="$LIBS $GTK_LIBS"
1323     CFLAGS="$CFLAGS $GTK_CFLAGS"
1324   else
1325     echo "GTK found, but need version 2.18 or higher"
1326     gfio="no"
1327   fi
1328 else
1329   echo "Please install gtk and gdk libraries"
1330   gfio="no"
1331 fi
1332 LDFLAGS=$ORG_LDFLAGS
1333 fi
1334
1335 if test "$gfio_check" = "yes" ; then
1336   print_config "gtk 2.18 or higher" "$gfio"
1337 fi
1338
1339 ##########################################
1340 # Check whether we have getrusage(RUSAGE_THREAD)
1341 if test "$rusage_thread" != "yes" ; then
1342   rusage_thread="no"
1343 fi
1344 cat > $TMPC << EOF
1345 #include <sys/time.h>
1346 #include <sys/resource.h>
1347 int main(int argc, char **argv)
1348 {
1349   struct rusage ru;
1350   getrusage(RUSAGE_THREAD, &ru);
1351   return 0;
1352 }
1353 EOF
1354 if compile_prog "" "" "RUSAGE_THREAD"; then
1355   rusage_thread="yes"
1356 fi
1357 print_config "RUSAGE_THREAD" "$rusage_thread"
1358
1359 ##########################################
1360 # Check whether we have SCHED_IDLE
1361 if test "$sched_idle" != "yes" ; then
1362   sched_idle="no"
1363 fi
1364 cat > $TMPC << EOF
1365 #include <sched.h>
1366 int main(int argc, char **argv)
1367 {
1368   struct sched_param p;
1369   return sched_setscheduler(0, SCHED_IDLE, &p);
1370 }
1371 EOF
1372 if compile_prog "" "" "SCHED_IDLE"; then
1373   sched_idle="yes"
1374 fi
1375 print_config "SCHED_IDLE" "$sched_idle"
1376
1377 ##########################################
1378 # Check whether we have TCP_NODELAY
1379 if test "$tcp_nodelay" != "yes" ; then
1380   tcp_nodelay="no"
1381 fi
1382 cat > $TMPC << EOF
1383 #include <stdio.h>
1384 #include <sys/types.h>
1385 #include <sys/socket.h>
1386 #include <netinet/tcp.h>
1387 int main(int argc, char **argv)
1388 {
1389   return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1390 }
1391 EOF
1392 if compile_prog "" "" "TCP_NODELAY"; then
1393   tcp_nodelay="yes"
1394 fi
1395 print_config "TCP_NODELAY" "$tcp_nodelay"
1396
1397 ##########################################
1398 # Check whether we have SO_SNDBUF
1399 if test "$window_size" != "yes" ; then
1400   window_size="no"
1401 fi
1402 cat > $TMPC << EOF
1403 #include <stdio.h>
1404 #include <sys/types.h>
1405 #include <sys/socket.h>
1406 #include <netinet/tcp.h>
1407 int main(int argc, char **argv)
1408 {
1409   setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1410   setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1411 }
1412 EOF
1413 if compile_prog "" "" "SO_SNDBUF"; then
1414   window_size="yes"
1415 fi
1416 print_config "Net engine window_size" "$window_size"
1417
1418 ##########################################
1419 # Check whether we have TCP_MAXSEG
1420 if test "$mss" != "yes" ; then
1421   mss="no"
1422 fi
1423 cat > $TMPC << EOF
1424 #include <stdio.h>
1425 #include <sys/types.h>
1426 #include <sys/socket.h>
1427 #include <netinet/tcp.h>
1428 #include <arpa/inet.h>
1429 #include <netinet/in.h>
1430 int main(int argc, char **argv)
1431 {
1432   return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1433 }
1434 EOF
1435 if compile_prog "" "" "TCP_MAXSEG"; then
1436   mss="yes"
1437 fi
1438 print_config "TCP_MAXSEG" "$mss"
1439
1440 ##########################################
1441 # Check whether we have RLIMIT_MEMLOCK
1442 if test "$rlimit_memlock" != "yes" ; then
1443   rlimit_memlock="no"
1444 fi
1445 cat > $TMPC << EOF
1446 #include <sys/time.h>
1447 #include <sys/resource.h>
1448 int main(int argc, char **argv)
1449 {
1450   struct rlimit rl;
1451   return getrlimit(RLIMIT_MEMLOCK, &rl);
1452 }
1453 EOF
1454 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1455   rlimit_memlock="yes"
1456 fi
1457 print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1458
1459 ##########################################
1460 # Check whether we have pwritev/preadv
1461 if test "$pwritev" != "yes" ; then
1462   pwritev="no"
1463 fi
1464 cat > $TMPC << EOF
1465 #include <stdio.h>
1466 #include <sys/uio.h>
1467 int main(int argc, char **argv)
1468 {
1469   return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1470 }
1471 EOF
1472 if compile_prog "" "" "pwritev"; then
1473   pwritev="yes"
1474 fi
1475 print_config "pwritev/preadv" "$pwritev"
1476
1477 ##########################################
1478 # Check whether we have pwritev2/preadv2
1479 if test "$pwritev2" != "yes" ; then
1480   pwritev2="no"
1481 fi
1482 cat > $TMPC << EOF
1483 #include <stdio.h>
1484 #include <sys/uio.h>
1485 int main(int argc, char **argv)
1486 {
1487   return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1488 }
1489 EOF
1490 if compile_prog "" "" "pwritev2"; then
1491   pwritev2="yes"
1492 fi
1493 print_config "pwritev2/preadv2" "$pwritev2"
1494
1495 ##########################################
1496 # Check whether we have the required functions for ipv6
1497 if test "$ipv6" != "yes" ; then
1498   ipv6="no"
1499 fi
1500 cat > $TMPC << EOF
1501 #include <sys/types.h>
1502 #include <sys/socket.h>
1503 #include <netinet/in.h>
1504 #include <netdb.h>
1505 #include <stdio.h>
1506 int main(int argc, char **argv)
1507 {
1508   struct addrinfo hints;
1509   struct in6_addr addr;
1510   int ret;
1511
1512   ret = getaddrinfo(NULL, NULL, &hints, NULL);
1513   freeaddrinfo(NULL);
1514   printf("%s\n", gai_strerror(ret));
1515   addr = in6addr_any;
1516   return 0;
1517 }
1518 EOF
1519 if compile_prog "" "" "ipv6"; then
1520   ipv6="yes"
1521 fi
1522 print_config "IPv6 helpers" "$ipv6"
1523
1524 ##########################################
1525 # check for rados
1526 if test "$rados" != "yes" ; then
1527   rados="no"
1528 fi
1529 cat > $TMPC << EOF
1530 #include <rados/librados.h>
1531
1532 int main(int argc, char **argv)
1533 {
1534   rados_t cluster;
1535   rados_ioctx_t io_ctx;
1536   const char cluster_name[] = "ceph";
1537   const char user_name[] = "client.admin";
1538   const char pool[] = "rados";
1539
1540   /* The rados_create2 signature required was only introduced in ceph 0.65 */
1541   rados_create2(&cluster, cluster_name, user_name, 0);
1542   rados_ioctx_create(cluster, pool, &io_ctx);
1543
1544   return 0;
1545 }
1546 EOF
1547 if test "$disable_rados" != "yes"  && compile_prog "" "-lrados" "rados"; then
1548   LIBS="-lrados $LIBS"
1549   rados="yes"
1550 fi
1551 print_config "Rados engine" "$rados"
1552
1553 ##########################################
1554 # check for rbd
1555 if test "$rbd" != "yes" ; then
1556   rbd="no"
1557 fi
1558 cat > $TMPC << EOF
1559 #include <rbd/librbd.h>
1560
1561 int main(int argc, char **argv)
1562 {
1563   rados_t cluster;
1564   rados_ioctx_t io_ctx;
1565   const char cluster_name[] = "ceph";
1566   const char user_name[] = "client.admin";
1567   const char pool[] = "rbd";
1568   int major, minor, extra;
1569
1570   rbd_version(&major, &minor, &extra);
1571   /* The rados_create2 signature required was only introduced in ceph 0.65 */
1572   rados_create2(&cluster, cluster_name, user_name, 0);
1573   rados_ioctx_create(cluster, pool, &io_ctx);
1574
1575   return 0;
1576 }
1577 EOF
1578 if test "$disable_rbd" != "yes"  && compile_prog "" "-lrbd -lrados" "rbd"; then
1579   LIBS="-lrbd -lrados $LIBS"
1580   rbd="yes"
1581 fi
1582 print_config "Rados Block Device engine" "$rbd"
1583
1584 ##########################################
1585 # check for rbd_poll
1586 if test "$rbd_poll" != "yes" ; then
1587   rbd_poll="no"
1588 fi
1589 if test "$rbd" = "yes"; then
1590 cat > $TMPC << EOF
1591 #include <rbd/librbd.h>
1592 #include <sys/eventfd.h>
1593
1594 int main(int argc, char **argv)
1595 {
1596   rbd_image_t image;
1597   rbd_completion_t comp;
1598
1599   int fd = eventfd(0, EFD_NONBLOCK);
1600   rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1601   rbd_poll_io_events(image, comp, 1);
1602
1603   return 0;
1604 }
1605 EOF
1606 if compile_prog "" "-lrbd -lrados" "rbd"; then
1607   rbd_poll="yes"
1608 fi
1609 print_config "rbd_poll" "$rbd_poll"
1610 fi
1611
1612 ##########################################
1613 # check for rbd_invalidate_cache()
1614 if test "$rbd_inval" != "yes" ; then
1615   rbd_inval="no"
1616 fi
1617 if test "$rbd" = "yes"; then
1618 cat > $TMPC << EOF
1619 #include <rbd/librbd.h>
1620
1621 int main(int argc, char **argv)
1622 {
1623   rbd_image_t image;
1624
1625   return rbd_invalidate_cache(image);
1626 }
1627 EOF
1628 if compile_prog "" "-lrbd -lrados" "rbd"; then
1629   rbd_inval="yes"
1630 fi
1631 print_config "rbd_invalidate_cache" "$rbd_inval"
1632 fi
1633
1634 ##########################################
1635 # Check whether we have setvbuf
1636 if test "$setvbuf" != "yes" ; then
1637   setvbuf="no"
1638 fi
1639 cat > $TMPC << EOF
1640 #include <stdio.h>
1641 int main(int argc, char **argv)
1642 {
1643   FILE *f = NULL;
1644   char buf[80];
1645   setvbuf(f, buf, _IOFBF, sizeof(buf));
1646   return 0;
1647 }
1648 EOF
1649 if compile_prog "" "" "setvbuf"; then
1650   setvbuf="yes"
1651 fi
1652 print_config "setvbuf" "$setvbuf"
1653
1654 ##########################################
1655 # check for gfapi
1656 if test "$gfapi" != "yes" ; then
1657   gfapi="no"
1658 fi
1659 cat > $TMPC << EOF
1660 #include <glusterfs/api/glfs.h>
1661
1662 int main(int argc, char **argv)
1663 {
1664   glfs_t *g = glfs_new("foo");
1665
1666   return 0;
1667 }
1668 EOF
1669 if test "$disable_gfapi" != "yes"  && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1670   LIBS="-lgfapi -lglusterfs $LIBS"
1671   gfapi="yes"
1672 fi
1673 print_config "Gluster API engine" "$gfapi"
1674
1675 ##########################################
1676 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1677 if test "$gfapi" = "yes" ; then
1678 gf_fadvise="no"
1679 cat > $TMPC << EOF
1680 #include <glusterfs/api/glfs.h>
1681
1682 int main(int argc, char **argv)
1683 {
1684   struct glfs_fd *fd;
1685   int ret = glfs_fadvise(fd, 0, 0, 1);
1686
1687   return 0;
1688 }
1689 EOF
1690 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1691   gf_fadvise="yes"
1692 fi
1693 print_config "Gluster API use fadvise" "$gf_fadvise"
1694 fi
1695
1696 ##########################################
1697 # check for gfapi trim support
1698 if test "$gf_trim" != "yes" ; then
1699   gf_trim="no"
1700 fi
1701 if test "$gfapi" = "yes" ; then
1702 cat > $TMPC << EOF
1703 #include <glusterfs/api/glfs.h>
1704
1705 int main(int argc, char **argv)
1706 {
1707   return glfs_discard_async(NULL, 0, 0);
1708 }
1709 EOF
1710 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1711   gf_trim="yes"
1712 fi
1713 print_config "Gluster API trim support" "$gf_trim"
1714 fi
1715
1716 ##########################################
1717 # Check if we support stckf on s390
1718 if test "$s390_z196_facilities" != "yes" ; then
1719   s390_z196_facilities="no"
1720 fi
1721 cat > $TMPC << EOF
1722 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1723 int main(int argc, char **argv)
1724 {
1725     /* We want just 1 double word to be returned.  */
1726     register unsigned long reg0 asm("0") = 0;
1727     unsigned long stfle_bits;
1728     asm volatile(".machine push"        "\n\t"
1729                  ".machine \"z9-109\""  "\n\t"
1730                  "stfle %0"             "\n\t"
1731                  ".machine pop"         "\n"
1732                  : "=QS" (stfle_bits), "+d" (reg0)
1733                  : : "cc");
1734
1735     if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1736       return 0;
1737     else
1738       return -1;
1739 }
1740 EOF
1741 if compile_prog "" "" "s390_z196_facilities"; then
1742   $TMPE
1743   if [ $? -eq 0 ]; then
1744         s390_z196_facilities="yes"
1745   fi
1746 fi
1747 print_config "s390_z196_facilities" "$s390_z196_facilities"
1748
1749 ##########################################
1750 # Check if we have required environment variables configured for libhdfs
1751 if test "$libhdfs" = "yes" ; then
1752   hdfs_conf_error=0
1753   if test "$JAVA_HOME" = "" ; then
1754     echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1755     hdfs_conf_error=1
1756   fi
1757   if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1758     echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1759     hdfs_conf_error=1
1760   fi
1761   if test "$FIO_LIBHDFS_LIB" = "" ; then
1762     echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1763     hdfs_conf_error=1
1764   fi
1765   if test "$hdfs_conf_error" = "1" ; then
1766     exit 1
1767   fi
1768   FIO_HDFS_CPU=$cpu
1769   if test "$FIO_HDFS_CPU" = "x86_64" ; then
1770     FIO_HDFS_CPU="amd64"
1771   fi
1772 fi
1773 print_config "HDFS engine" "$libhdfs"
1774
1775 ##########################################
1776 # Check whether we have MTD
1777 if test "$mtd" != "yes" ; then
1778   mtd="no"
1779 fi
1780 cat > $TMPC << EOF
1781 #include <string.h>
1782 #include <mtd/mtd-user.h>
1783 #include <sys/ioctl.h>
1784 int main(int argc, char **argv)
1785 {
1786   struct mtd_write_req ops;
1787   struct mtd_info_user info;
1788   memset(&ops, 0, sizeof(ops));
1789   info.type = MTD_MLCNANDFLASH;
1790   return ioctl(0, MEMGETINFO, &info);
1791 }
1792 EOF
1793 if compile_prog "" "" "mtd"; then
1794   mtd="yes"
1795 fi
1796 print_config "MTD" "$mtd"
1797
1798 ##########################################
1799 # Check whether we have libpmem
1800 if test "$libpmem" != "yes" ; then
1801   libpmem="no"
1802 fi
1803 cat > $TMPC << EOF
1804 #include <libpmem.h>
1805 int main(int argc, char **argv)
1806 {
1807   int rc;
1808   rc = pmem_is_pmem(0, 0);
1809   return 0;
1810 }
1811 EOF
1812 if compile_prog "" "-lpmem" "libpmem"; then
1813   libpmem="yes"
1814   LIBS="-lpmem $LIBS"
1815 fi
1816 print_config "libpmem" "$libpmem"
1817
1818 ##########################################
1819 # Check whether we have libpmemblk
1820 # libpmem is a prerequisite
1821 if test "$libpmemblk" != "yes" ; then
1822   libpmemblk="no"
1823 fi
1824 if test "$libpmem" = "yes"; then
1825   cat > $TMPC << EOF
1826 #include <libpmemblk.h>
1827 int main(int argc, char **argv)
1828 {
1829   PMEMblkpool *pbp;
1830   pbp = pmemblk_open("", 0);
1831   return 0;
1832 }
1833 EOF
1834   if compile_prog "" "-lpmemblk" "libpmemblk"; then
1835     libpmemblk="yes"
1836     LIBS="-lpmemblk $LIBS"
1837   fi
1838 fi
1839 print_config "libpmemblk" "$libpmemblk"
1840
1841 # Choose the ioengines
1842 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1843   pmem="yes"
1844   devdax="yes"
1845   if test "$libpmemblk" = "yes"; then
1846     pmemblk="yes"
1847   fi
1848 fi
1849
1850 ##########################################
1851 # Report whether pmemblk engine is enabled
1852 print_config "NVML pmemblk engine" "$pmemblk"
1853
1854 ##########################################
1855 # Report whether dev-dax engine is enabled
1856 print_config "NVML dev-dax engine" "$devdax"
1857
1858 ##########################################
1859 # Report whether libpmem engine is enabled
1860 print_config "NVML libpmem engine" "$pmem"
1861
1862 ##########################################
1863 # Check if we have lex/yacc available
1864 yacc="no"
1865 yacc_is_bison="no"
1866 lex="no"
1867 arith="no"
1868 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
1869 if test "$targetos" != "SunOS" ; then
1870 LEX=$(which lex 2> /dev/null)
1871 if test -x "$LEX" ; then
1872   lex="yes"
1873 fi
1874 YACC=$(which bison 2> /dev/null)
1875 if test -x "$YACC" ; then
1876   yacc="yes"
1877   yacc_is_bison="yes"
1878 else
1879   YACC=$(which yacc 2> /dev/null)
1880   if test -x "$YACC" ; then
1881     yacc="yes"
1882   fi
1883 fi
1884 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1885   arith="yes"
1886 fi
1887
1888 if test "$arith" = "yes" ; then
1889 cat > $TMPC << EOF
1890 extern int yywrap(void);
1891
1892 int main(int argc, char **argv)
1893 {
1894   yywrap();
1895   return 0;
1896 }
1897 EOF
1898 if compile_prog "" "-ll" "lex"; then
1899   LIBS="-ll $LIBS"
1900 else
1901   arith="no"
1902 fi
1903 fi
1904 fi
1905 fi
1906
1907 # Check if lex fails using -o
1908 if test "$arith" = "yes" ; then
1909 if test "$force_no_lex_o" = "yes" ; then
1910   lex_use_o="no"
1911 else
1912 $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1913 if test "$?" = "0" ; then
1914   lex_use_o="yes"
1915 else
1916   lex_use_o="no"
1917 fi
1918 fi
1919 fi
1920
1921 print_config "lex/yacc for arithmetic" "$arith"
1922
1923 ##########################################
1924 # Check whether we have setmntent/getmntent
1925 if test "$getmntent" != "yes" ; then
1926   getmntent="no"
1927 fi
1928 cat > $TMPC << EOF
1929 #include <stdio.h>
1930 #include <mntent.h>
1931 int main(int argc, char **argv)
1932 {
1933   FILE *mtab = setmntent(NULL, "r");
1934   struct mntent *mnt = getmntent(mtab);
1935   endmntent(mtab);
1936   return 0;
1937 }
1938 EOF
1939 if compile_prog "" "" "getmntent"; then
1940   getmntent="yes"
1941 fi
1942 print_config "getmntent" "$getmntent"
1943
1944 ##########################################
1945 # Check whether we have getmntinfo
1946 # These are originally added for BSDs, but may also work
1947 # on other operating systems with getmntinfo(3).
1948
1949 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1950 # Note that NetBSD needs -Werror to catch warning as error.
1951 if test "$getmntinfo" != "yes" ; then
1952   getmntinfo="no"
1953 fi
1954 cat > $TMPC << EOF
1955 #include <stdio.h>
1956 #include <sys/param.h>
1957 #include <sys/mount.h>
1958 int main(int argc, char **argv)
1959 {
1960   struct statfs *st;
1961   return getmntinfo(&st, MNT_NOWAIT);
1962 }
1963 EOF
1964 if compile_prog "-Werror" "" "getmntinfo"; then
1965   getmntinfo="yes"
1966 fi
1967 print_config "getmntinfo" "$getmntinfo"
1968
1969 # getmntinfo(3) for NetBSD.
1970 if test "$getmntinfo_statvfs" != "yes" ; then
1971   getmntinfo_statvfs="no"
1972 fi
1973 cat > $TMPC << EOF
1974 #include <stdio.h>
1975 #include <sys/statvfs.h>
1976 int main(int argc, char **argv)
1977 {
1978   struct statvfs *st;
1979   return getmntinfo(&st, MNT_NOWAIT);
1980 }
1981 EOF
1982 # Skip the test if the one with statfs arg is detected.
1983 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1984   getmntinfo_statvfs="yes"
1985   print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
1986 fi
1987
1988 ##########################################
1989 # Check whether we have _Static_assert
1990 if test "$static_assert" != "yes" ; then
1991   static_assert="no"
1992 fi
1993 cat > $TMPC << EOF
1994 #include <assert.h>
1995 #include <stdlib.h>
1996 #include <stddef.h>
1997
1998 struct foo {
1999   int a, b;
2000 };
2001
2002 int main(int argc, char **argv)
2003 {
2004   _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2005   return 0 ;
2006 }
2007 EOF
2008 if compile_prog "" "" "static_assert"; then
2009     static_assert="yes"
2010 fi
2011 print_config "Static Assert" "$static_assert"
2012
2013 ##########################################
2014 # Check whether we have bool / stdbool.h
2015 if test "$have_bool" != "yes" ; then
2016   have_bool="no"
2017 fi
2018 cat > $TMPC << EOF
2019 #include <stdbool.h>
2020 int main(int argc, char **argv)
2021 {
2022   bool var = true;
2023   return var != false;
2024 }
2025 EOF
2026 if compile_prog "" "" "bool"; then
2027   have_bool="yes"
2028 fi
2029 print_config "bool" "$have_bool"
2030
2031 ##########################################
2032 # Check whether we have strndup()
2033 strndup="no"
2034 cat > $TMPC << EOF
2035 #include <string.h>
2036 #include <stdlib.h>
2037 int main(int argc, char **argv)
2038 {
2039   char *res = strndup("test string", 8);
2040
2041   free(res);
2042   return 0;
2043 }
2044 EOF
2045 if compile_prog "" "" "strndup"; then
2046   strndup="yes"
2047 fi
2048 print_config "strndup" "$strndup"
2049
2050 ##########################################
2051 # check march=armv8-a+crc+crypto
2052 if test "$march_armv8_a_crc_crypto" != "yes" ; then
2053   march_armv8_a_crc_crypto="no"
2054 fi
2055 if test "$cpu" = "arm64" ; then
2056   cat > $TMPC <<EOF
2057 #include <sys/auxv.h>
2058 #include <arm_acle.h>
2059 #include <arm_neon.h>
2060
2061 int main(void)
2062 {
2063   return 0;
2064 }
2065 EOF
2066   if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
2067     march_armv8_a_crc_crypto="yes"
2068     CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
2069     march_set="yes"
2070   fi
2071 fi
2072 print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2073
2074 ##########################################
2075 # cuda probe
2076 if test "$cuda" != "yes" ; then
2077   cuda="no"
2078 fi
2079 cat > $TMPC << EOF
2080 #include <cuda.h>
2081 int main(int argc, char **argv)
2082 {
2083   return cuInit(0);
2084 }
2085 EOF
2086 if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
2087   cuda="yes"
2088   LIBS="-lcuda $LIBS"
2089 fi
2090 print_config "cuda" "$cuda"
2091
2092 ##########################################
2093 # mkdir() probe. mingw apparently has a one-argument mkdir :/
2094 mkdir_two="no"
2095 cat > $TMPC << EOF
2096 #include <sys/stat.h>
2097 #include <sys/types.h>
2098 int main(int argc, char **argv)
2099 {
2100   return mkdir("/tmp/bla", 0600);
2101 }
2102 EOF
2103 if compile_prog "" "" "mkdir(a, b)"; then
2104   mkdir_two="yes"
2105 fi
2106 print_config "mkdir(a, b)" "$mkdir_two"
2107
2108 ##########################################
2109 # check for cc -march=native
2110 build_native="no"
2111 cat > $TMPC << EOF
2112 int main(int argc, char **argv)
2113 {
2114   return 0;
2115 }
2116 EOF
2117 if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2118    compile_prog "-march=native" "" "march=native"; then
2119   build_native="yes"
2120 fi
2121 print_config "Build march=native" "$build_native"
2122
2123 #############################################################################
2124
2125 if test "$wordsize" = "64" ; then
2126   output_sym "CONFIG_64BIT"
2127 elif test "$wordsize" = "32" ; then
2128   output_sym "CONFIG_32BIT"
2129 else
2130   fatal "Unknown wordsize!"
2131 fi
2132 if test "$bigendian" = "yes" ; then
2133   output_sym "CONFIG_BIG_ENDIAN"
2134 else
2135   output_sym "CONFIG_LITTLE_ENDIAN"
2136 fi
2137 if test "$zlib" = "yes" ; then
2138   output_sym "CONFIG_ZLIB"
2139 fi
2140 if test "$libaio" = "yes" ; then
2141   output_sym "CONFIG_LIBAIO"
2142 fi
2143 if test "$posix_aio" = "yes" ; then
2144   output_sym "CONFIG_POSIXAIO"
2145 fi
2146 if test "$posix_aio_fsync" = "yes" ; then
2147   output_sym "CONFIG_POSIXAIO_FSYNC"
2148 fi
2149 if test "$posix_pshared" = "yes" ; then
2150   output_sym "CONFIG_PSHARED"
2151 fi
2152 if test "$linux_fallocate" = "yes" ; then
2153   output_sym "CONFIG_LINUX_FALLOCATE"
2154 fi
2155 if test "$posix_fallocate" = "yes" ; then
2156   output_sym "CONFIG_POSIX_FALLOCATE"
2157 fi
2158 if test "$fdatasync" = "yes" ; then
2159   output_sym "CONFIG_FDATASYNC"
2160 fi
2161 if test "$sync_file_range" = "yes" ; then
2162   output_sym "CONFIG_SYNC_FILE_RANGE"
2163 fi
2164 if test "$sfaa" = "yes" ; then
2165   output_sym "CONFIG_SFAA"
2166 fi
2167 if test "$sync_sync" = "yes" ; then
2168   output_sym "CONFIG_SYNC_SYNC"
2169 fi
2170 if test "$cmp_swap" = "yes" ; then
2171   output_sym "CONFIG_CMP_SWAP"
2172 fi
2173 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2174   output_sym "CONFIG_RDMA"
2175 fi
2176 if test "$clock_gettime" = "yes" ; then
2177   output_sym "CONFIG_CLOCK_GETTIME"
2178 fi
2179 if test "$clock_monotonic" = "yes" ; then
2180   output_sym "CONFIG_CLOCK_MONOTONIC"
2181 fi
2182 if test "$clock_monotonic_raw" = "yes" ; then
2183   output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2184 fi
2185 if test "$clock_monotonic_precise" = "yes" ; then
2186   output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2187 fi
2188 if test "$clockid_t" = "yes"; then
2189   output_sym "CONFIG_CLOCKID_T"
2190 fi
2191 if test "$gettimeofday" = "yes" ; then
2192   output_sym "CONFIG_GETTIMEOFDAY"
2193 fi
2194 if test "$posix_fadvise" = "yes" ; then
2195   output_sym "CONFIG_POSIX_FADVISE"
2196 fi
2197 if test "$linux_3arg_affinity" = "yes" ; then
2198   output_sym "CONFIG_3ARG_AFFINITY"
2199 elif test "$linux_2arg_affinity" = "yes" ; then
2200   output_sym "CONFIG_2ARG_AFFINITY"
2201 fi
2202 if test "$strsep" = "yes" ; then
2203   output_sym "CONFIG_STRSEP"
2204 fi
2205 if test "$strcasestr" = "yes" ; then
2206   output_sym "CONFIG_STRCASESTR"
2207 fi
2208 if test "$strlcat" = "yes" ; then
2209   output_sym "CONFIG_STRLCAT"
2210 fi
2211 if test "$getopt_long_only" = "yes" ; then
2212   output_sym "CONFIG_GETOPT_LONG_ONLY"
2213 fi
2214 if test "$inet_aton" = "yes" ; then
2215   output_sym "CONFIG_INET_ATON"
2216 fi
2217 if test "$socklen_t" = "yes" ; then
2218   output_sym "CONFIG_SOCKLEN_T"
2219 fi
2220 if test "$ext4_me" = "yes" ; then
2221   output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2222 fi
2223 if test "$linux_splice" = "yes" ; then
2224   output_sym "CONFIG_LINUX_SPLICE"
2225 fi
2226 if test "$guasi" = "yes" ; then
2227   output_sym "CONFIG_GUASI"
2228 fi
2229 if test "$fusion_aw" = "yes" ; then
2230   output_sym "CONFIG_FUSION_AW"
2231 fi
2232 if test "$libnuma_v2" = "yes" ; then
2233   output_sym "CONFIG_LIBNUMA"
2234 fi
2235 if test "$solaris_aio" = "yes" ; then
2236   output_sym "CONFIG_SOLARISAIO"
2237 fi
2238 if test "$tls_thread" = "yes" ; then
2239   output_sym "CONFIG_TLS_THREAD"
2240 fi
2241 if test "$rusage_thread" = "yes" ; then
2242   output_sym "CONFIG_RUSAGE_THREAD"
2243 fi
2244 if test "$gfio" = "yes" ; then
2245   output_sym "CONFIG_GFIO"
2246 fi
2247 if test "$esx" = "yes" ; then
2248   output_sym "CONFIG_ESX"
2249   output_sym "CONFIG_NO_SHM"
2250 fi
2251 if test "$sched_idle" = "yes" ; then
2252   output_sym "CONFIG_SCHED_IDLE"
2253 fi
2254 if test "$tcp_nodelay" = "yes" ; then
2255   output_sym "CONFIG_TCP_NODELAY"
2256 fi
2257 if test "$window_size" = "yes" ; then
2258   output_sym "CONFIG_NET_WINDOWSIZE"
2259 fi
2260 if test "$mss" = "yes" ; then
2261   output_sym "CONFIG_NET_MSS"
2262 fi
2263 if test "$rlimit_memlock" = "yes" ; then
2264   output_sym "CONFIG_RLIMIT_MEMLOCK"
2265 fi
2266 if test "$pwritev" = "yes" ; then
2267   output_sym "CONFIG_PWRITEV"
2268 fi
2269 if test "$pwritev2" = "yes" ; then
2270   output_sym "CONFIG_PWRITEV2"
2271 fi
2272 if test "$ipv6" = "yes" ; then
2273   output_sym "CONFIG_IPV6"
2274 fi
2275 if test "$rados" = "yes" ; then
2276   output_sym "CONFIG_RADOS"
2277 fi
2278 if test "$rbd" = "yes" ; then
2279   output_sym "CONFIG_RBD"
2280 fi
2281 if test "$rbd_poll" = "yes" ; then
2282   output_sym "CONFIG_RBD_POLL"
2283 fi
2284 if test "$rbd_inval" = "yes" ; then
2285   output_sym "CONFIG_RBD_INVAL"
2286 fi
2287 if test "$setvbuf" = "yes" ; then
2288   output_sym "CONFIG_SETVBUF"
2289 fi
2290 if test "$s390_z196_facilities" = "yes" ; then
2291   output_sym "CONFIG_S390_Z196_FACILITIES"
2292   CFLAGS="$CFLAGS -march=z9-109"
2293   march_set="yes"
2294 fi
2295 if test "$gfapi" = "yes" ; then
2296   output_sym "CONFIG_GFAPI"
2297 fi
2298 if test "$gf_fadvise" = "yes" ; then
2299   output_sym "CONFIG_GF_FADVISE"
2300 fi
2301 if test "$gf_trim" = "yes" ; then
2302   output_sym "CONFIG_GF_TRIM"
2303 fi
2304 if test "$libhdfs" = "yes" ; then
2305   output_sym "CONFIG_LIBHDFS"
2306   echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2307   echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2308   echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2309   echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2310  fi
2311 if test "$mtd" = "yes" ; then
2312   output_sym "CONFIG_MTD"
2313 fi
2314 if test "$pmemblk" = "yes" ; then
2315   output_sym "CONFIG_PMEMBLK"
2316 fi
2317 if test "$devdax" = "yes" ; then
2318   output_sym "CONFIG_LINUX_DEVDAX"
2319 fi
2320 if test "$pmem" = "yes" ; then
2321   output_sym "CONFIG_LIBPMEM"
2322 fi
2323 if test "$arith" = "yes" ; then
2324   output_sym "CONFIG_ARITHMETIC"
2325   if test "$yacc_is_bison" = "yes" ; then
2326     echo "YACC=$YACC -y" >> $config_host_mak
2327   else
2328     echo "YACC=$YACC" >> $config_host_mak
2329   fi
2330   if test "$lex_use_o" = "yes" ; then
2331     echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2332   fi
2333 fi
2334 if test "$getmntent" = "yes" ; then
2335   output_sym "CONFIG_GETMNTENT"
2336 fi
2337 if test "$getmntinfo" = "yes" ; then
2338   output_sym "CONFIG_GETMNTINFO"
2339 fi
2340 if test "$getmntinfo_statvfs" = "yes" ; then
2341   output_sym "CONFIG_GETMNTINFO_STATVFS"
2342 fi
2343 if test "$static_assert" = "yes" ; then
2344   output_sym "CONFIG_STATIC_ASSERT"
2345 fi
2346 if test "$have_bool" = "yes" ; then
2347   output_sym "CONFIG_HAVE_BOOL"
2348 fi
2349 if test "$strndup" = "yes" ; then
2350   output_sym "CONFIG_HAVE_STRNDUP"
2351 fi
2352 if test "$disable_opt" = "yes" ; then
2353   output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2354 fi
2355 if test "$zlib" = "no" ; then
2356   echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2357   if test "$build_static" = "yes"; then
2358     echo "Note that some distros have separate packages for static libraries."
2359   fi
2360 fi
2361 if test "$cuda" = "yes" ; then
2362   output_sym "CONFIG_CUDA"
2363 fi
2364 if test "$mkdir_two" = "yes" ; then
2365   output_sym "CONFIG_HAVE_MKDIR_TWO"
2366 fi
2367 if test "$march_set" = "no" && test "$build_native" = "yes" ; then
2368   output_sym "CONFIG_BUILD_NATIVE"
2369 fi
2370
2371 echo "LIBS+=$LIBS" >> $config_host_mak
2372 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
2373 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
2374 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
2375 echo "CC=$cc" >> $config_host_mak
2376 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
2377 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2378
2379 if [ `dirname $0` != "." -a ! -e Makefile ]; then
2380     cat > Makefile <<EOF
2381 SRCDIR:=`dirname $0`
2382 include \$(SRCDIR)/Makefile
2383 EOF
2384 fi