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