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