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