rdma: adapt to new init_rand_seed()
[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 # Default CFLAGS
41 CFLAGS="-D_GNU_SOURCE -include config-host.h"
42 BUILD_CFLAGS=""
43
44 # Print a helpful header at the top of config.log
45 echo "# FIO configure log $(date)" >> config.log
46 printf "# Configured with:" >> config.log
47 printf " '%s'" "$0" "$@" >> config.log
48 echo >> config.log
49 echo "#" >> config.log
50
51 # Print configure header at the top of $config_host_h
52 echo "/*" > $config_host_h
53 echo " * Automatically generated by configure - do not modify" >> $config_host_h
54 printf " * Configured with:" >> $config_host_h
55 printf " * '%s'" "$0" "$@" >> $config_host_h
56 echo "" >> $config_host_h
57 echo " */" >> $config_host_h
58
59 do_cc() {
60     # Run the compiler, capturing its output to the log.
61     echo $cc "$@" >> config.log
62     $cc "$@" >> config.log 2>&1 || return $?
63     # Test passed. If this is an --enable-werror build, rerun
64     # the test with -Werror and bail out if it fails. This
65     # makes warning-generating-errors in configure test code
66     # obvious to developers.
67     if test "$werror" != "yes"; then
68         return 0
69     fi
70     # Don't bother rerunning the compile if we were already using -Werror
71     case "$*" in
72         *-Werror*)
73            return 0
74         ;;
75     esac
76     echo $cc -Werror "$@" >> config.log
77     $cc -Werror "$@" >> config.log 2>&1 && return $?
78     echo "ERROR: configure test passed without -Werror but failed with -Werror."
79     echo "This is probably a bug in the configure script. The failing command"
80     echo "will be at the bottom of config.log."
81     fatal "You can run configure with --disable-werror to bypass this check."
82 }
83
84 compile_object() {
85   do_cc $CFLAGS -c -o $TMPO $TMPC
86 }
87
88 compile_prog() {
89   local_cflags="$1"
90   local_ldflags="$2 $LIBS"
91   echo "Compiling test case $3" >> config.log
92   do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
93 }
94
95 feature_not_found() {
96   feature=$1
97   packages=$2
98
99   echo "ERROR"
100   echo "ERROR: User requested feature $feature"
101   if test ! -z "$packages" ; then
102     echo "ERROR: That feature needs $packages installed"
103   fi
104   echo "ERROR: configure was not able to find it"
105   fatal "ERROR"
106 }
107
108 has() {
109   type "$1" >/dev/null 2>&1
110 }
111
112 check_define() {
113   cat > $TMPC <<EOF
114 #if !defined($1)
115 #error $1 not defined
116 #endif
117 int main(void)
118 {
119   return 0;
120 }
121 EOF
122   compile_object
123 }
124
125 output_sym() {
126   echo "$1=y" >> $config_host_mak
127   echo "#define $1" >> $config_host_h
128 }
129
130 targetos=""
131 cpu=""
132
133 # default options
134 show_help="no"
135 exit_val=0
136 gfio_check="no"
137 libhdfs="no"
138 prefix=/usr/local
139
140 # parse options
141 for opt do
142   optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
143   case "$opt" in
144   --prefix=*) prefix="$optarg"
145   ;;
146   --cpu=*) cpu="$optarg"
147   ;;
148   #  esx is cross compiled and cannot be detect through simple uname calls
149   --esx)
150   esx="yes"
151   ;;
152   --cc=*) CC="$optarg"
153   ;;
154   --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
155   ;;
156   --build-32bit-win) build_32bit_win="yes"
157   ;;
158   --build-static) build_static="yes"
159   ;;
160   --enable-gfio)
161   gfio_check="yes"
162   ;;
163   --disable-numa) disable_numa="yes"
164   ;;
165   --disable-rbd) disable_rbd="yes"
166   ;;
167   --disable-gfapi) disable_gfapi="yes"
168   ;;
169   --enable-libhdfs) libhdfs="yes"
170   ;;
171   --disable-shm) output_sym "CONFIG_NO_SHM"
172   ;;
173   --help)
174     show_help="yes"
175     ;;
176   *)
177   echo "Bad option $opt"
178   show_help="yes"
179   exit_val=1
180   esac
181 done
182
183 if test "$show_help" = "yes" ; then
184   echo "--prefix=              Use this directory as installation prefix"
185   echo "--cpu=                 Specify target CPU if auto-detect fails"
186   echo "--cc=                  Specify compiler to use"
187   echo "--extra-cflags=        Specify extra CFLAGS to pass to compiler"
188   echo "--build-32bit-win      Enable 32-bit build on Windows"
189   echo "--build-static         Build a static fio"
190   echo "--esx                  Configure build options for esx"
191   echo "--enable-gfio          Enable building of gtk gfio"
192   echo "--disable-numa         Disable libnuma even if found"
193   echo "--enable-libhdfs       Enable hdfs support"
194   exit $exit_val
195 fi
196
197 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
198 cc="${CC-${cross_prefix}gcc}"
199
200 if check_define __ANDROID__ ; then
201   targetos="Android"
202 elif check_define __linux__ ; then
203   targetos="Linux"
204 elif check_define __OpenBSD__ ; then
205   targetos='OpenBSD'
206 elif check_define __sun__ ; then
207   targetos='SunOS'
208   CFLAGS="$CFLAGS -D_REENTRANT"
209 elif check_define _WIN32 ; then
210   targetos='CYGWIN'
211 else
212   targetos=`uname -s`
213 fi
214
215 echo "# Automatically generated by configure - do not modify" > $config_host_mak
216 printf "# Configured with:" >> $config_host_mak
217 printf " '%s'" "$0" "$@" >> $config_host_mak
218 echo >> $config_host_mak
219 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
220
221 # Some host OSes need non-standard checks for which CPU to use.
222 # Note that these checks are broken for cross-compilation: if you're
223 # cross-compiling to one of these OSes then you'll need to specify
224 # the correct CPU with the --cpu option.
225 case $targetos in
226 Darwin)
227   # on Leopard most of the system is 32-bit, so we have to ask the kernel if
228   # we can run 64-bit userspace code.
229   # If the user didn't specify a CPU explicitly and the kernel says this is
230   # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
231   # detection code.
232   if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
233     cpu="x86_64"
234   fi
235   ;;
236 SunOS)
237   # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
238   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
239     cpu="x86_64"
240   fi
241   LIBS="-lnsl -lsocket"
242   ;;
243 CYGWIN*)
244   echo "Forcing known good options on Windows"
245   if test -z "$CC" ; then
246     if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
247       CC="i686-w64-mingw32-gcc"
248     else
249       CC="x86_64-w64-mingw32-gcc"
250     fi
251   fi
252   output_sym "CONFIG_LITTLE_ENDIAN"
253   if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
254     output_sym "CONFIG_32BIT"
255   else
256     output_sym "CONFIG_64BIT_LLP64"
257   fi
258   output_sym "CONFIG_FADVISE"
259   output_sym "CONFIG_SOCKLEN_T"
260   output_sym "CONFIG_FADVISE"
261   output_sym "CONFIG_SFAA"
262   output_sym "CONFIG_RUSAGE_THREAD"
263   output_sym "CONFIG_WINDOWSAIO"
264   output_sym "CONFIG_FDATASYNC"
265   output_sym "CONFIG_CLOCK_MONOTONIC"
266   output_sym "CONFIG_GETTIMEOFDAY"
267   output_sym "CONFIG_CLOCK_GETTIME"
268   output_sym "CONFIG_SCHED_IDLE"
269   output_sym "CONFIG_TCP_NODELAY"
270   output_sym "CONFIG_TLS_THREAD"
271   output_sym "CONFIG_IPV6"
272   echo "CC=$CC" >> $config_host_mak
273   echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
274   exit 0
275   ;;
276 esac
277
278 if test ! -z "$cpu" ; then
279   # command line argument
280   :
281 elif check_define __i386__ ; then
282   cpu="i386"
283 elif check_define __x86_64__ ; then
284   cpu="x86_64"
285 elif check_define __sparc__ ; then
286   if check_define __arch64__ ; then
287     cpu="sparc64"
288   else
289     cpu="sparc"
290   fi
291 elif check_define _ARCH_PPC ; then
292   if check_define _ARCH_PPC64 ; then
293     cpu="ppc64"
294   else
295     cpu="ppc"
296   fi
297 elif check_define __mips__ ; then
298   cpu="mips"
299 elif check_define __ia64__ ; then
300   cpu="ia64"
301 elif check_define __s390__ ; then
302   if check_define __s390x__ ; then
303     cpu="s390x"
304   else
305     cpu="s390"
306   fi
307 elif check_define __arm__ ; then
308   cpu="arm"
309 elif check_define __hppa__ ; then
310   cpu="hppa"
311 else
312   cpu=`uname -m`
313 fi
314
315 # Normalise host CPU name and set ARCH.
316 case "$cpu" in
317   ia64|ppc|ppc64|s390|s390x|sparc64)
318     cpu="$cpu"
319   ;;
320   i386|i486|i586|i686|i86pc|BePC)
321     cpu="i386"
322   ;;
323   x86_64|amd64)
324     cpu="x86_64"
325   ;;
326   armv*b|armv*l|arm)
327     cpu="arm"
328   ;;
329   hppa|parisc|parisc64)
330     cpu="hppa"
331   ;;
332   mips*)
333     cpu="mips"
334   ;;
335   sparc|sun4[cdmuv])
336     cpu="sparc"
337   ;;
338   *)
339   echo "Unknown CPU"
340   ;;
341 esac
342
343 if test -z "$CC" ; then
344   if test "$targetos" = "FreeBSD"; then
345     if has clang; then
346       CC=clang
347     else
348       CC=gcc
349     fi
350   fi
351 fi
352
353 cc="${CC-${cross_prefix}gcc}"
354
355 ##########################################
356 # check cross compile
357
358 cross_compile="no"
359 cat > $TMPC <<EOF
360 int main(void)
361 {
362   return 0;
363 }
364 EOF
365 if compile_prog "" "" "cross"; then
366   $TMPE 2>/dev/null || cross_compile="yes"
367 else
368   fatal "compile test failed"
369 fi
370
371 ##########################################
372 # check endianness
373 bigendian="no"
374 if test "$cross_compile" = "no" ; then
375   cat > $TMPC <<EOF
376 #include <inttypes.h>
377 int main(void)
378 {
379   volatile uint32_t i=0x01234567;
380   return (*((uint8_t*)(&i))) == 0x67;
381 }
382 EOF
383   if compile_prog "" "" "endian"; then
384     $TMPE && bigendian="yes"
385   fi
386 else
387   # If we're cross compiling, try our best to work it out and rely on the
388   # run-time check to fail if we get it wrong.
389   cat > $TMPC <<EOF
390 #include <endian.h>
391 int main(void)
392 {
393 #if __BYTE_ORDER != __BIG_ENDIAN
394 # error "Unknown endianness"
395 #endif
396 }
397 EOF
398   compile_prog "" "" "endian" && bigendian="yes"
399   check_define "__ARMEB__" && bigendian="yes"
400   check_define "__MIPSEB__" && bigendian="yes"
401 fi
402
403
404 echo "Operating system              $targetos"
405 echo "CPU                           $cpu"
406 echo "Big endian                    $bigendian"
407 echo "Compiler                      $cc"
408 echo "Cross compile                 $cross_compile"
409 echo
410
411 ##########################################
412 # See if we need to build a static build
413 if test "$build_static" = "yes" ; then
414   CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
415   LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
416 else
417   build_static="no"
418 fi
419 echo "Static build                  $build_static"
420
421 ##########################################
422 # check for wordsize
423 wordsize="0"
424 cat > $TMPC <<EOF
425 #include <limits.h>
426 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
427 int main(void)
428 {
429   BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
430   return 0;
431 }
432 EOF
433 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
434   wordsize="32"
435 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
436   wordsize="64"
437 else
438   fatal "Unknown wordsize"
439 fi
440 echo "Wordsize                      $wordsize"
441
442 ##########################################
443 # zlib probe
444 zlib="no"
445 cat > $TMPC <<EOF
446 #include <zlib.h>
447 int main(void)
448 {
449   z_stream stream;
450   if (inflateInit(&stream) != Z_OK)
451     return 1;
452   return 0;
453 }
454 EOF
455 if compile_prog "" "-lz" "zlib" ; then
456   zlib=yes
457   LIBS="-lz $LIBS"
458 fi
459 echo "zlib                          $zlib"
460
461 ##########################################
462 # linux-aio probe
463 libaio="no"
464 cat > $TMPC <<EOF
465 #include <libaio.h>
466 #include <stddef.h>
467 int main(void)
468 {
469   io_setup(0, NULL);
470   return 0;
471 }
472 EOF
473 if compile_prog "" "-laio" "libaio" ; then
474   libaio=yes
475   LIBS="-laio $LIBS"
476 else
477   if test "$libaio" = "yes" ; then
478     feature_not_found "linux AIO" "libaio-dev or libaio-devel"
479   fi
480   libaio=no
481 fi
482 echo "Linux AIO support             $libaio"
483
484 ##########################################
485 # posix aio probe
486 posix_aio="no"
487 posix_aio_lrt="no"
488 cat > $TMPC <<EOF
489 #include <aio.h>
490 int main(void)
491 {
492   struct aiocb cb;
493   aio_read(&cb);
494   return 0;
495 }
496 EOF
497 if compile_prog "" "" "posixaio" ; then
498   posix_aio="yes"
499 elif compile_prog "" "-lrt" "posixaio"; then
500   posix_aio="yes"
501   posix_aio_lrt="yes"
502   LIBS="-lrt $LIBS"
503 fi
504 echo "POSIX AIO support             $posix_aio"
505 echo "POSIX AIO support needs -lrt  $posix_aio_lrt"
506
507 ##########################################
508 # posix aio fsync probe
509 posix_aio_fsync="no"
510 if test "$posix_aio" = "yes" ; then
511   cat > $TMPC <<EOF
512 #include <fcntl.h>
513 #include <aio.h>
514 int main(void)
515 {
516   struct aiocb cb;
517   return aio_fsync(O_SYNC, &cb);
518   return 0;
519 }
520 EOF
521   if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
522     posix_aio_fsync=yes
523   fi
524 fi
525 echo "POSIX AIO fsync               $posix_aio_fsync"
526
527 ##########################################
528 # solaris aio probe
529 solaris_aio="no"
530 cat > $TMPC <<EOF
531 #include <sys/types.h>
532 #include <sys/asynch.h>
533 #include <unistd.h>
534 int main(void)
535 {
536   aio_result_t res;
537   return aioread(0, NULL, 0, 0, SEEK_SET, &res);
538   return 0;
539 }
540 EOF
541 if compile_prog "" "-laio" "solarisaio" ; then
542   solaris_aio=yes
543   LIBS="-laio $LIBS"
544 fi
545 echo "Solaris AIO support           $solaris_aio"
546
547 ##########################################
548 # __sync_fetch_and_and test
549 sfaa="no"
550 cat > $TMPC << EOF
551 static int sfaa(int *ptr)
552 {
553   return __sync_fetch_and_add(ptr, 0);
554 }
555
556 int main(int argc, char **argv)
557 {
558   int val = 42;
559   sfaa(&val);
560   return val;
561 }
562 EOF
563 if compile_prog "" "" "__sync_fetch_and_add()" ; then
564     sfaa="yes"
565 fi
566 echo "__sync_fetch_and_add          $sfaa"
567
568 ##########################################
569 # libverbs probe
570 libverbs="no"
571 cat > $TMPC << EOF
572 #include <stdio.h>
573 #include <infiniband/arch.h>
574 int main(int argc, char **argv)
575 {
576   struct ibv_pd *pd = ibv_alloc_pd(NULL);
577   return 0;
578 }
579 EOF
580 if compile_prog "" "-libverbs" "libverbs" ; then
581     libverbs="yes"
582     LIBS="-libverbs $LIBS"
583 fi
584 echo "libverbs                      $libverbs"
585
586 ##########################################
587 # rdmacm probe
588 rdmacm="no"
589 cat > $TMPC << EOF
590 #include <stdio.h>
591 #include <rdma/rdma_cma.h>
592 int main(int argc, char **argv)
593 {
594   rdma_destroy_qp(NULL);
595   return 0;
596 }
597 EOF
598 if compile_prog "" "-lrdmacm" "rdma"; then
599     rdmacm="yes"
600     LIBS="-lrdmacm $LIBS"
601 fi
602 echo "rdmacm                        $rdmacm"
603
604 ##########################################
605 # Linux fallocate probe
606 linux_fallocate="no"
607 cat > $TMPC << EOF
608 #include <stdio.h>
609 #include <fcntl.h>
610 #include <linux/falloc.h>
611 int main(int argc, char **argv)
612 {
613   int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
614   return r;
615 }
616 EOF
617 if compile_prog "" "" "linux_fallocate"; then
618     linux_fallocate="yes"
619 fi
620 echo "Linux fallocate               $linux_fallocate"
621
622 ##########################################
623 # POSIX fadvise probe
624 posix_fadvise="no"
625 cat > $TMPC << EOF
626 #include <stdio.h>
627 #include <fcntl.h>
628 int main(int argc, char **argv)
629 {
630   int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
631   return r;
632 }
633 EOF
634 if compile_prog "" "" "posix_fadvise"; then
635     posix_fadvise="yes"
636 fi
637 echo "POSIX fadvise                 $posix_fadvise"
638
639 ##########################################
640 # POSIX fallocate probe
641 posix_fallocate="no"
642 cat > $TMPC << EOF
643 #include <stdio.h>
644 #include <fcntl.h>
645 int main(int argc, char **argv)
646 {
647   int r = posix_fallocate(0, 0, 1024);
648   return r;
649 }
650 EOF
651 if compile_prog "" "" "posix_fallocate"; then
652     posix_fallocate="yes"
653 fi
654 echo "POSIX fallocate               $posix_fallocate"
655
656 ##########################################
657 # sched_set/getaffinity 2 or 3 argument test
658 linux_2arg_affinity="no"
659 linux_3arg_affinity="no"
660 cat > $TMPC << EOF
661 #include <sched.h>
662 int main(int argc, char **argv)
663 {
664   cpu_set_t mask;
665   return sched_setaffinity(0, sizeof(mask), &mask);
666 }
667 EOF
668 if compile_prog "" "" "sched_setaffinity(,,)"; then
669   linux_3arg_affinity="yes"
670 else
671   cat > $TMPC << EOF
672 #include <sched.h>
673 int main(int argc, char **argv)
674 {
675   cpu_set_t mask;
676   return sched_setaffinity(0, &mask);
677 }
678 EOF
679   if compile_prog "" "" "sched_setaffinity(,)"; then
680     linux_2arg_affinity="yes"
681   fi
682 fi
683 echo "sched_setaffinity(3 arg)      $linux_3arg_affinity"
684 echo "sched_setaffinity(2 arg)      $linux_2arg_affinity"
685
686 ##########################################
687 # clock_gettime probe
688 clock_gettime="no"
689 cat > $TMPC << EOF
690 #include <stdio.h>
691 #include <time.h>
692 int main(int argc, char **argv)
693 {
694   return clock_gettime(0, NULL);
695 }
696 EOF
697 if compile_prog "" "" "clock_gettime"; then
698     clock_gettime="yes"
699 elif compile_prog "" "-lrt" "clock_gettime"; then
700     clock_gettime="yes"
701     LIBS="-lrt $LIBS"
702 fi
703 echo "clock_gettime                 $clock_gettime"
704
705 ##########################################
706 # CLOCK_MONOTONIC probe
707 clock_monotonic="no"
708 if test "$clock_gettime" = "yes" ; then
709   cat > $TMPC << EOF
710 #include <stdio.h>
711 #include <time.h>
712 int main(int argc, char **argv)
713 {
714   return clock_gettime(CLOCK_MONOTONIC, NULL);
715 }
716 EOF
717   if compile_prog "" "$LIBS" "clock monotonic"; then
718       clock_monotonic="yes"
719   fi
720 fi
721 echo "CLOCK_MONOTONIC               $clock_monotonic"
722
723 ##########################################
724 # CLOCK_MONOTONIC_RAW probe
725 clock_monotonic_raw="no"
726 if test "$clock_gettime" = "yes" ; then
727   cat > $TMPC << EOF
728 #include <stdio.h>
729 #include <time.h>
730 int main(int argc, char **argv)
731 {
732   return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
733 }
734 EOF
735   if compile_prog "" "$LIBS" "clock monotonic"; then
736       clock_monotonic_raw="yes"
737   fi
738 fi
739 echo "CLOCK_MONOTONIC_RAW           $clock_monotonic_raw"
740
741 ##########################################
742 # CLOCK_MONOTONIC_PRECISE probe
743 clock_monotonic_precise="no"
744 if test "$clock_gettime" = "yes" ; then
745   cat > $TMPC << EOF
746 #include <stdio.h>
747 #include <time.h>
748 int main(int argc, char **argv)
749 {
750   return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
751 }
752 EOF
753   if compile_prog "" "$LIBS" "clock monotonic precise"; then
754       clock_monotonic_precise="yes"
755   fi
756 fi
757 echo "CLOCK_MONOTONIC_PRECISE       $clock_monotonic_precise"
758
759 ##########################################
760 # gettimeofday() probe
761 gettimeofday="no"
762 cat > $TMPC << EOF
763 #include <sys/time.h>
764 #include <stdio.h>
765 int main(int argc, char **argv)
766 {
767   struct timeval tv;
768   return gettimeofday(&tv, NULL);
769 }
770 EOF
771 if compile_prog "" "" "gettimeofday"; then
772     gettimeofday="yes"
773 fi
774 echo "gettimeofday                  $gettimeofday"
775
776 ##########################################
777 # fdatasync() probe
778 fdatasync="no"
779 cat > $TMPC << EOF
780 #include <stdio.h>
781 #include <unistd.h>
782 int main(int argc, char **argv)
783 {
784   return fdatasync(0);
785 }
786 EOF
787 if compile_prog "" "" "fdatasync"; then
788   fdatasync="yes"
789 fi
790 echo "fdatasync                     $fdatasync"
791
792 ##########################################
793 # sync_file_range() probe
794 sync_file_range="no"
795 cat > $TMPC << EOF
796 #include <stdio.h>
797 #include <unistd.h>
798 #include <fcntl.h>
799 #include <linux/fs.h>
800 int main(int argc, char **argv)
801 {
802   unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
803                         SYNC_FILE_RANGE_WAIT_AFTER;
804   return sync_file_range(0, 0, 0, flags);
805 }
806 EOF
807 if compile_prog "" "" "sync_file_range"; then
808   sync_file_range="yes"
809 fi
810 echo "sync_file_range               $sync_file_range"
811
812 ##########################################
813 # ext4 move extent probe
814 ext4_me="no"
815 cat > $TMPC << EOF
816 #include <fcntl.h>
817 #include <sys/ioctl.h>
818 int main(int argc, char **argv)
819 {
820   struct move_extent me;
821   return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
822 }
823 EOF
824 if compile_prog "" "" "ext4 move extent" ; then
825   ext4_me="yes"
826 elif test $targetos = "Linux" ; then
827   # On Linux, just default to it on and let it error at runtime if we really
828   # don't have it. None of my updated systems have it defined, but it does
829   # work. Takes a while to bubble back.
830   ext4_me="yes"
831 fi
832 echo "EXT4 move extent              $ext4_me"
833
834 ##########################################
835 # splice probe
836 linux_splice="no"
837 cat > $TMPC << EOF
838 #include <stdio.h>
839 #include <fcntl.h>
840 int main(int argc, char **argv)
841 {
842   return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
843 }
844 EOF
845 if compile_prog "" "" "linux splice"; then
846   linux_splice="yes"
847 fi
848 echo "Linux splice(2)               $linux_splice"
849
850 ##########################################
851 # GUASI probe
852 guasi="no"
853 cat > $TMPC << EOF
854 #include <guasi.h>
855 #include <guasi_syscalls.h>
856 int main(int argc, char **argv)
857 {
858   guasi_t ctx = guasi_create(0, 0, 0);
859   return 0;
860 }
861 EOF
862 if compile_prog "" "" "guasi"; then
863   guasi="yes"
864 fi
865 echo "GUASI                         $guasi"
866
867 ##########################################
868 # fusion-aw probe
869 fusion_aw="no"
870 cat > $TMPC << EOF
871 #include <nvm/nvm_primitives.h>
872 int main(int argc, char **argv)
873 {
874   nvm_version_t ver_info;
875   nvm_handle_t handle;
876
877   handle = nvm_get_handle(0, &ver_info);
878   return nvm_atomic_write(handle, 0, 0, 0);
879 }
880 EOF
881 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
882   LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
883   fusion_aw="yes"
884 fi
885 echo "Fusion-io atomic engine       $fusion_aw"
886
887 ##########################################
888 # libnuma probe
889 libnuma="no"
890 cat > $TMPC << EOF
891 #include <numa.h>
892 int main(int argc, char **argv)
893 {
894   return numa_available();
895 }
896 EOF
897 if test "$disable_numa" != "yes"  && compile_prog "" "-lnuma" "libnuma"; then
898   libnuma="yes"
899   LIBS="-lnuma $LIBS"
900 fi
901 echo "libnuma                       $libnuma"
902
903 ##########################################
904 # libnuma 2.x version API
905 if test "$libnuma" = "yes" ; then
906 libnuma_v2="no"
907 cat > $TMPC << EOF
908 #include <numa.h>
909 int main(int argc, char **argv)
910 {
911   struct bitmask *mask = numa_parse_nodestring(NULL);
912   return mask->size == 0;
913 }
914 EOF
915 if compile_prog "" "" "libnuma api"; then
916   libnuma_v2="yes"
917 fi
918 echo "libnuma v2                    $libnuma_v2"
919 fi
920
921 ##########################################
922 # strsep() probe
923 strsep="no"
924 cat > $TMPC << EOF
925 #include <string.h>
926 int main(int argc, char **argv)
927 {
928   strsep(NULL, NULL);
929   return 0;
930 }
931 EOF
932 if compile_prog "" "" "strsep"; then
933   strsep="yes"
934 fi
935 echo "strsep                        $strsep"
936
937 ##########################################
938 # strcasestr() probe
939 strcasestr="no"
940 cat > $TMPC << EOF
941 #include <string.h>
942 int main(int argc, char **argv)
943 {
944   return strcasestr(argv[0], argv[1]) != NULL;
945 }
946 EOF
947 if compile_prog "" "" "strcasestr"; then
948   strcasestr="yes"
949 fi
950 echo "strcasestr                    $strcasestr"
951
952 ##########################################
953 # getopt_long_only() probe
954 getopt_long_only="no"
955 cat > $TMPC << EOF
956 #include <unistd.h>
957 #include <stdio.h>
958 #include <getopt.h>
959 int main(int argc, char **argv)
960 {
961   int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
962   return c;
963 }
964 EOF
965 if compile_prog "" "" "getopt_long_only"; then
966   getopt_long_only="yes"
967 fi
968 echo "getopt_long_only()            $getopt_long_only"
969
970 ##########################################
971 # inet_aton() probe
972 inet_aton="no"
973 cat > $TMPC << EOF
974 #include <sys/socket.h>
975 #include <arpa/inet.h>
976 #include <stdio.h>
977 int main(int argc, char **argv)
978 {
979   struct in_addr in;
980   return inet_aton(NULL, &in);
981 }
982 EOF
983 if compile_prog "" "" "inet_aton"; then
984   inet_aton="yes"
985 fi
986 echo "inet_aton                     $inet_aton"
987
988 ##########################################
989 # socklen_t probe
990 socklen_t="no"
991 cat > $TMPC << EOF
992 #include <sys/socket.h>
993 int main(int argc, char **argv)
994 {
995   socklen_t len = 0;
996   return len;
997 }
998 EOF
999 if compile_prog "" "" "socklen_t"; then
1000   socklen_t="yes"
1001 fi
1002 echo "socklen_t                     $socklen_t"
1003
1004 ##########################################
1005 # Whether or not __thread is supported for TLS
1006 tls_thread="no"
1007 cat > $TMPC << EOF
1008 #include <stdio.h>
1009 static __thread int ret;
1010 int main(int argc, char **argv)
1011 {
1012   return ret;
1013 }
1014 EOF
1015 if compile_prog "" "" "__thread"; then
1016   tls_thread="yes"
1017 fi
1018 echo "__thread                      $tls_thread"
1019
1020 ##########################################
1021 # Check if we have required gtk/glib support for gfio
1022 gfio="no"
1023 if test "$gfio_check" = "yes" ; then
1024   cat > $TMPC << EOF
1025 #include <glib.h>
1026 #include <cairo.h>
1027 #include <gtk/gtk.h>
1028 int main(void)
1029 {
1030   gdk_threads_enter();
1031   gdk_threads_leave();
1032
1033   printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1034 }
1035 EOF
1036 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1037 ORG_LDFLAGS=$LDFLAGS
1038 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1039 if test "$?" != "0" ; then
1040   echo "configure: gtk and gthread not found"
1041   exit 1
1042 fi
1043 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1044 if test "$?" != "0" ; then
1045   echo "configure: gtk and gthread not found"
1046   exit 1
1047 fi
1048 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1049   r=$($TMPE)
1050   if test "$r" != "0" ; then
1051     gfio="yes"
1052     GFIO_LIBS="$LIBS $GTK_LIBS"
1053     CFLAGS="$CFLAGS $GTK_CFLAGS"
1054   else
1055     echo "GTK found, but need version 2.18 or higher"
1056     gfio="no"
1057   fi
1058 else
1059   echo "Please install gtk and gdk libraries"
1060   gfio="no"
1061 fi
1062 LDFLAGS=$ORG_LDFLAGS
1063 fi
1064
1065 if test "$gfio_check" = "yes" ; then
1066   echo "gtk 2.18 or higher            $gfio"
1067 fi
1068
1069 # Check whether we have getrusage(RUSAGE_THREAD)
1070 rusage_thread="no"
1071 cat > $TMPC << EOF
1072 #include <sys/time.h>
1073 #include <sys/resource.h>
1074 int main(int argc, char **argv)
1075 {
1076   struct rusage ru;
1077   getrusage(RUSAGE_THREAD, &ru);
1078   return 0;
1079 }
1080 EOF
1081 if compile_prog "" "" "RUSAGE_THREAD"; then
1082   rusage_thread="yes"
1083 fi
1084 echo "RUSAGE_THREAD                 $rusage_thread"
1085
1086 ##########################################
1087 # Check whether we have SCHED_IDLE
1088 sched_idle="no"
1089 cat > $TMPC << EOF
1090 #include <sched.h>
1091 int main(int argc, char **argv)
1092 {
1093   struct sched_param p;
1094   return sched_setscheduler(0, SCHED_IDLE, &p);
1095 }
1096 EOF
1097 if compile_prog "" "" "SCHED_IDLE"; then
1098   sched_idle="yes"
1099 fi
1100 echo "SCHED_IDLE                    $sched_idle"
1101
1102 ##########################################
1103 # Check whether we have TCP_NODELAY
1104 tcp_nodelay="no"
1105 cat > $TMPC << EOF
1106 #include <stdio.h>
1107 #include <sys/types.h>
1108 #include <sys/socket.h>
1109 #include <netinet/tcp.h>
1110 int main(int argc, char **argv)
1111 {
1112   return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1113 }
1114 EOF
1115 if compile_prog "" "" "TCP_NODELAY"; then
1116   tcp_nodelay="yes"
1117 fi
1118 echo "TCP_NODELAY                   $tcp_nodelay"
1119
1120 ##########################################
1121 # Check whether we have SO_SNDBUF
1122 window_size="no"
1123 cat > $TMPC << EOF
1124 #include <stdio.h>
1125 #include <sys/types.h>
1126 #include <sys/socket.h>
1127 #include <netinet/tcp.h>
1128 int main(int argc, char **argv)
1129 {
1130   setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1131   setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1132 }
1133 EOF
1134 if compile_prog "" "" "SO_SNDBUF"; then
1135   window_size="yes"
1136 fi
1137 echo "Net engine window_size        $window_size"
1138
1139 ##########################################
1140 # Check whether we have TCP_MAXSEG
1141 mss="no"
1142 cat > $TMPC << EOF
1143 #include <stdio.h>
1144 #include <sys/types.h>
1145 #include <sys/socket.h>
1146 #include <netinet/tcp.h>
1147 #include <arpa/inet.h>
1148 #include <netinet/in.h>
1149 int main(int argc, char **argv)
1150 {
1151   return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1152 }
1153 EOF
1154 if compile_prog "" "" "TCP_MAXSEG"; then
1155   mss="yes"
1156 fi
1157 echo "TCP_MAXSEG                    $mss"
1158
1159 ##########################################
1160 # Check whether we have RLIMIT_MEMLOCK
1161 rlimit_memlock="no"
1162 cat > $TMPC << EOF
1163 #include <sys/time.h>
1164 #include <sys/resource.h>
1165 int main(int argc, char **argv)
1166 {
1167   struct rlimit rl;
1168   return getrlimit(RLIMIT_MEMLOCK, &rl);
1169 }
1170 EOF
1171 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1172   rlimit_memlock="yes"
1173 fi
1174 echo "RLIMIT_MEMLOCK                $rlimit_memlock"
1175
1176 ##########################################
1177 # Check whether we have pwritev/preadv
1178 pwritev="no"
1179 cat > $TMPC << EOF
1180 #include <stdio.h>
1181 #include <sys/uio.h>
1182 int main(int argc, char **argv)
1183 {
1184   return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1185 }
1186 EOF
1187 if compile_prog "" "" "pwritev"; then
1188   pwritev="yes"
1189 fi
1190 echo "pwritev/preadv                $pwritev"
1191
1192 ##########################################
1193 # Check whether we have the required functions for ipv6
1194 ipv6="no"
1195 cat > $TMPC << EOF
1196 #include <sys/types.h>
1197 #include <sys/socket.h>
1198 #include <netinet/in.h>
1199 #include <netdb.h>
1200 #include <stdio.h>
1201 int main(int argc, char **argv)
1202 {
1203   struct addrinfo hints;
1204   struct in6_addr addr;
1205   int ret;
1206
1207   ret = getaddrinfo(NULL, NULL, &hints, NULL);
1208   freeaddrinfo(NULL);
1209   printf("%s\n", gai_strerror(ret));
1210   addr = in6addr_any;
1211   return 0;
1212 }
1213 EOF
1214 if compile_prog "" "" "ipv6"; then
1215   ipv6="yes"
1216 fi
1217 echo "IPv6 helpers                  $ipv6"
1218
1219 ##########################################
1220 # check for rbd
1221 rbd="no"
1222 cat > $TMPC << EOF
1223 #include <rbd/librbd.h>
1224
1225 int main(int argc, char **argv)
1226 {
1227
1228   rados_t cluster;
1229   rados_ioctx_t io_ctx;
1230   const char pool[] = "rbd";
1231
1232   int major, minor, extra;
1233   rbd_version(&major, &minor, &extra);
1234
1235   rados_ioctx_create(cluster, pool, &io_ctx);
1236   return 0;
1237 }
1238 EOF
1239 if test "$disable_rbd" != "yes"  && compile_prog "" "-lrbd -lrados" "rbd"; then
1240   LIBS="-lrbd -lrados $LIBS"
1241   rbd="yes"
1242 fi
1243 echo "Rados Block Device engine     $rbd"
1244
1245 ##########################################
1246 # check for rbd_invaidate_cache()
1247 rbd_inval="no"
1248 if test "$rbd" = "yes"; then
1249 cat > $TMPC << EOF
1250 #include <rbd/librbd.h>
1251
1252 int main(int argc, char **argv)
1253 {
1254   rbd_image_t image;
1255
1256   return rbd_invalidate_cache(image);
1257 }
1258 EOF
1259 if compile_prog "" "-lrbd -lrados" "rbd"; then
1260   rbd_inval="yes"
1261 fi
1262 echo "rbd_invalidate_cache          $rbd_inval"
1263 fi
1264
1265 ##########################################
1266 # Check whether we have setvbuf
1267 setvbuf="no"
1268 cat > $TMPC << EOF
1269 #include <stdio.h>
1270 int main(int argc, char **argv)
1271 {
1272   FILE *f = NULL;
1273   char buf[80];
1274   setvbuf(f, buf, _IOFBF, sizeof(buf));
1275   return 0;
1276 }
1277 EOF
1278 if compile_prog "" "" "setvbuf"; then
1279   setvbuf="yes"
1280 fi
1281 echo "setvbuf                       $setvbuf"
1282
1283 # check for gfapi
1284 gfapi="no"
1285 cat > $TMPC << EOF
1286 #include <glusterfs/api/glfs.h>
1287
1288 int main(int argc, char **argv)
1289 {
1290
1291   glfs_t *g = glfs_new("foo");
1292
1293   return 0;
1294 }
1295 EOF
1296 if test "$disable_gfapi" != "yes"  && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1297   LIBS="-lgfapi -lglusterfs $LIBS"
1298   gfapi="yes"
1299 fi
1300  echo "Gluster API engine            $gfapi"
1301
1302 ##########################################
1303 # check for gfapi fadvise support
1304 if test "$gfapi" = "yes" ; then
1305 gf_fadvise="no"
1306 cat > $TMPC << EOF
1307 #include <glusterfs/api/glfs.h>
1308
1309 int main(int argc, char **argv)
1310 {
1311   struct glfs_fd *fd;
1312   int ret = glfs_fadvise(fd, 0, 0, 1);
1313
1314   return 0;
1315 }
1316 EOF
1317 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1318   gf_fadvise="yes"
1319 fi
1320 echo "Gluster API use fadvise       $gf_fadvise"
1321 fi
1322
1323 ##########################################
1324 # check for gfapi trim support
1325 gf_trim="no"
1326 if test "$gfapi" = "yes" ; then
1327 cat > $TMPC << EOF
1328 #include <glusterfs/api/glfs.h>
1329
1330 int main(int argc, char **argv)
1331 {
1332   return glfs_discard_async(NULL, 0, 0);
1333 }
1334 EOF
1335 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1336   gf_trim="yes"
1337 fi
1338 echo "Gluster API trim support      $gf_trim"
1339 fi
1340
1341 ##########################################
1342 # Check if we support stckf on s390
1343 s390_z196_facilities="no"
1344 cat > $TMPC << EOF
1345 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1346 int main(int argc, char **argv)
1347 {
1348     /* We want just 1 double word to be returned.  */
1349     register unsigned long reg0 asm("0") = 0;
1350     unsigned long stfle_bits;
1351     asm volatile(".machine push"        "\n\t"
1352                  ".machine \"z9-109\""  "\n\t"
1353                  "stfle %0"             "\n\t"
1354                  ".machine pop"         "\n"
1355                  : "=QS" (stfle_bits), "+d" (reg0)
1356                  : : "cc");
1357
1358     if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1359       return 0;
1360     else
1361       return -1;
1362 }
1363 EOF
1364 if compile_prog "" "" "s390_z196_facilities"; then
1365   $TMPE
1366   if [[ $? -eq 0 ]]; then
1367         s390_z196_facilities="yes"
1368   fi
1369 fi
1370 echo "s390_z196_facilities          $s390_z196_facilities"
1371
1372 ##########################################
1373 # Check if we have required environment variables configured for libhdfs
1374 if test "$libhdfs" = "yes" ; then
1375   hdfs_conf_error=0
1376   if test "$JAVA_HOME" = "" ; then
1377     echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1378     hdfs_conf_error=1
1379   fi
1380   if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1381     echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1382     hdfs_conf_error=1
1383   fi
1384   if test "$FIO_LIBHDFS_LIB" = "" ; then
1385     echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1386     hdfs_conf_error=1
1387   fi
1388   if test "$hdfs_conf_error" = "1" ; then
1389     exit 1
1390   fi
1391 fi
1392 echo "HDFS engine                   $libhdfs"
1393
1394 ##########################################
1395 # Check whether we have MTD
1396 mtd="no"
1397 cat > $TMPC << EOF
1398 #include <mtd/mtd-user.h>
1399 #include <sys/ioctl.h>
1400 int main(int argc, char **argv)
1401 {
1402   struct mtd_info_user info;
1403   info.type = MTD_MLCNANDFLASH;
1404   return ioctl(0, MEMGETINFO, &info);
1405 }
1406 EOF
1407 if compile_prog "" "" "mtd"; then
1408   mtd="yes"
1409 fi
1410 echo "MTD                           $mtd"
1411
1412 # Check if we have lex/yacc available
1413 yacc="no"
1414 yacc_is_bison="no"
1415 lex="no"
1416 arith="no"
1417 if test "$targetos" != "SunOS" ; then
1418 LEX=$(which lex 2> /dev/null)
1419 if test -x "$LEX" ; then
1420   lex="yes"
1421 fi
1422 YACC=$(which bison 2> /dev/null)
1423 if test -x "$YACC" ; then
1424   yacc="yes"
1425   yacc_is_bison="yes"
1426 else
1427   YACC=$(which yacc 2> /dev/null)
1428   if test -x "$YACC" ; then
1429     yacc="yes"
1430   fi
1431 fi
1432 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1433   arith="yes"
1434 fi
1435
1436 if test "$arith" = "yes" ; then
1437 cat > $TMPC << EOF
1438 extern int yywrap(void);
1439
1440 int main(int argc, char **argv)
1441 {
1442   yywrap();
1443   return 0;
1444 }
1445 EOF
1446 if compile_prog "" "-ll" "lex"; then
1447   LIBS="-ll $LIBS"
1448 else
1449   arith="no"
1450 fi
1451 fi
1452 fi
1453
1454 echo "lex/yacc for arithmetic       $arith"
1455
1456 ##########################################
1457 # Check whether we have setmntent/getmntent
1458 getmntent="no"
1459 cat > $TMPC << EOF
1460 #include <stdio.h>
1461 #include <mntent.h>
1462 int main(int argc, char **argv)
1463 {
1464   FILE *mtab = setmntent(NULL, "r");
1465   struct mntent *mnt = getmntent(mtab);
1466   endmntent(mnt);
1467   return 0;
1468 }
1469 EOF
1470 if compile_prog "" "" "getmntent"; then
1471   getmntent="yes"
1472 fi
1473 echo "getmntent                     $getmntent"
1474
1475 #############################################################################
1476
1477 if test "$wordsize" = "64" ; then
1478   output_sym "CONFIG_64BIT"
1479 elif test "$wordsize" = "32" ; then
1480   output_sym "CONFIG_32BIT"
1481 else
1482   fatal "Unknown wordsize!"
1483 fi
1484 if test "$bigendian" = "yes" ; then
1485   output_sym "CONFIG_BIG_ENDIAN"
1486 else
1487   output_sym "CONFIG_LITTLE_ENDIAN"
1488 fi
1489 if test "$zlib" = "yes" ; then
1490   output_sym "CONFIG_ZLIB"
1491 fi
1492 if test "$libaio" = "yes" ; then
1493   output_sym "CONFIG_LIBAIO"
1494 fi
1495 if test "$posix_aio" = "yes" ; then
1496   output_sym "CONFIG_POSIXAIO"
1497 fi
1498 if test "$posix_aio_fsync" = "yes" ; then
1499   output_sym "CONFIG_POSIXAIO_FSYNC"
1500 fi
1501 if test "$linux_fallocate" = "yes" ; then
1502   output_sym "CONFIG_LINUX_FALLOCATE"
1503 fi
1504 if test "$posix_fallocate" = "yes" ; then
1505   output_sym "CONFIG_POSIX_FALLOCATE"
1506 fi
1507 if test "$fdatasync" = "yes" ; then
1508   output_sym "CONFIG_FDATASYNC"
1509 fi
1510 if test "$sync_file_range" = "yes" ; then
1511   output_sym "CONFIG_SYNC_FILE_RANGE"
1512 fi
1513 if test "$sfaa" = "yes" ; then
1514   output_sym "CONFIG_SFAA"
1515 fi
1516 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1517   output_sym "CONFIG_RDMA"
1518 fi
1519 if test "$clock_gettime" = "yes" ; then
1520   output_sym "CONFIG_CLOCK_GETTIME"
1521 fi
1522 if test "$clock_monotonic" = "yes" ; then
1523   output_sym "CONFIG_CLOCK_MONOTONIC"
1524 fi
1525 if test "$clock_monotonic_raw" = "yes" ; then
1526   output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1527 fi
1528 if test "$clock_monotonic_precise" = "yes" ; then
1529   output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1530 fi
1531 if test "$gettimeofday" = "yes" ; then
1532   output_sym "CONFIG_GETTIMEOFDAY"
1533 fi
1534 if test "$posix_fadvise" = "yes" ; then
1535   output_sym "CONFIG_POSIX_FADVISE"
1536 fi
1537 if test "$linux_3arg_affinity" = "yes" ; then
1538   output_sym "CONFIG_3ARG_AFFINITY"
1539 elif test "$linux_2arg_affinity" = "yes" ; then
1540   output_sym "CONFIG_2ARG_AFFINITY"
1541 fi
1542 if test "$strsep" = "yes" ; then
1543   output_sym "CONFIG_STRSEP"
1544 fi
1545 if test "$strcasestr" = "yes" ; then
1546   output_sym "CONFIG_STRCASESTR"
1547 fi
1548 if test "$getopt_long_only" = "yes" ; then
1549   output_sym "CONFIG_GETOPT_LONG_ONLY"
1550 fi
1551 if test "$inet_aton" = "yes" ; then
1552   output_sym "CONFIG_INET_ATON"
1553 fi
1554 if test "$socklen_t" = "yes" ; then
1555   output_sym "CONFIG_SOCKLEN_T"
1556 fi
1557 if test "$ext4_me" = "yes" ; then
1558   output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1559 fi
1560 if test "$linux_splice" = "yes" ; then
1561   output_sym "CONFIG_LINUX_SPLICE"
1562 fi
1563 if test "$guasi" = "yes" ; then
1564   output_sym "CONFIG_GUASI"
1565 fi
1566 if test "$fusion_aw" = "yes" ; then
1567   output_sym "CONFIG_FUSION_AW"
1568 fi
1569 if test "$libnuma_v2" = "yes" ; then
1570   output_sym "CONFIG_LIBNUMA"
1571 fi
1572 if test "$solaris_aio" = "yes" ; then
1573   output_sym "CONFIG_SOLARISAIO"
1574 fi
1575 if test "$tls_thread" = "yes" ; then
1576   output_sym "CONFIG_TLS_THREAD"
1577 fi
1578 if test "$rusage_thread" = "yes" ; then
1579   output_sym "CONFIG_RUSAGE_THREAD"
1580 fi
1581 if test "$gfio" = "yes" ; then
1582   echo "CONFIG_GFIO=y" >> $config_host_mak
1583 fi
1584 if test "$esx" = "yes" ; then
1585   output_sym "CONFIG_ESX"
1586   output_sym "CONFIG_NO_SHM"
1587 fi
1588 if test "$sched_idle" = "yes" ; then
1589   output_sym "CONFIG_SCHED_IDLE"
1590 fi
1591 if test "$tcp_nodelay" = "yes" ; then
1592   output_sym "CONFIG_TCP_NODELAY"
1593 fi
1594 if test "$window_size" = "yes" ; then
1595   output_sym "CONFIG_NET_WINDOWSIZE"
1596 fi
1597 if test "$mss" = "yes" ; then
1598   output_sym "CONFIG_NET_MSS"
1599 fi
1600 if test "$rlimit_memlock" = "yes" ; then
1601   output_sym "CONFIG_RLIMIT_MEMLOCK"
1602 fi
1603 if test "$pwritev" = "yes" ; then
1604   output_sym "CONFIG_PWRITEV"
1605 fi
1606 if test "$ipv6" = "yes" ; then
1607   output_sym "CONFIG_IPV6"
1608 fi
1609 if test "$rbd" = "yes" ; then
1610   output_sym "CONFIG_RBD"
1611 fi
1612 if test "$rbd_inval" = "yes" ; then
1613   output_sym "CONFIG_RBD_INVAL"
1614 fi
1615 if test "$setvbuf" = "yes" ; then
1616   output_sym "CONFIG_SETVBUF"
1617 fi
1618 if test "$s390_z196_facilities" = "yes" ; then
1619   output_sym "CONFIG_S390_Z196_FACILITIES"
1620   CFLAGS="$CFLAGS -march=z9-109"
1621 fi
1622 if test "$gfapi" = "yes" ; then
1623   output_sym "CONFIG_GFAPI"
1624 fi
1625 if test "$gf_fadvise" = "yes" ; then
1626   output_sym "CONFIG_GF_FADVISE"
1627 fi
1628 if test "$gf_trim" = "yes" ; then
1629   output_sym "CONFIG_GF_TRIM"
1630 fi
1631 if test "$libhdfs" = "yes" ; then
1632   output_sym "CONFIG_LIBHDFS"
1633   echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1634   echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1635   echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1636  fi
1637 if test "$mtd" = "yes" ; then
1638   output_sym "CONFIG_MTD"
1639 fi
1640 if test "$arith" = "yes" ; then
1641   output_sym "CONFIG_ARITHMETIC"
1642   if test "$yacc_is_bison" = "yes" ; then
1643     echo "YACC=$YACC -y" >> $config_host_mak
1644   else
1645     echo "YACC=$YACC" >> $config_host_mak
1646   fi
1647 fi
1648 if test "$getmntent" = "yes" ; then
1649   output_sym "CONFIG_GETMNTENT"
1650 fi
1651
1652 if test "$zlib" = "no" ; then
1653   echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1654 fi
1655
1656 echo "LIBS+=$LIBS" >> $config_host_mak
1657 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1658 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1659 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1660 echo "CC=$cc" >> $config_host_mak
1661 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
1662 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak