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