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