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