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
8if test ! -z "$TMPDIR" ; then
9    TMPDIR1="${TMPDIR}"
10elif test ! -z "$TEMPDIR" ; then
11    TMPDIR1="${TEMPDIR}"
12else
13    TMPDIR1="/tmp"
14fi
15
16TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
17TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
18TMPE="${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>
22trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
23
24rm -rf config.log
25
26config_host_mak="config-host.mak"
27config_host_h="config-host.h"
28
29rm -rf $config_host_mak
30rm -rf $config_host_h
31
32fatal() {
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
41CFLAGS="-D_GNU_SOURCE -include config-host.h"
42BUILD_CFLAGS=""
43
44# Print a helpful header at the top of config.log
45echo "# FIO configure log $(date)" >> config.log
46printf "# Configured with:" >> config.log
47printf " '%s'" "$0" "$@" >> config.log
48echo >> config.log
49echo "#" >> config.log
50
51# Print configure header at the top of $config_host_h
52echo "/*" > $config_host_h
53echo " * Automatically generated by configure - do not modify" >> $config_host_h
54printf " * Configured with:" >> $config_host_h
55printf " * '%s'" "$0" "$@" >> $config_host_h
56echo "" >> $config_host_h
57echo " */" >> $config_host_h
58
59do_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
84compile_object() {
85  do_cc $CFLAGS -c -o $TMPO $TMPC
86}
87
88compile_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
95feature_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
108has() {
109  type "$1" >/dev/null 2>&1
110}
111
112check_define() {
113  cat > $TMPC <<EOF
114#if !defined($1)
115#error $1 not defined
116#endif
117int main(void)
118{
119  return 0;
120}
121EOF
122  compile_object
123}
124
125output_sym() {
126  echo "$1=y" >> $config_host_mak
127  echo "#define $1" >> $config_host_h
128}
129
130targetos=""
131cpu=""
132
133# default options
134show_help="no"
135exit_val=0
136gfio_check="no"
137libhdfs="no"
138
139# parse options
140for 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
178done
179
180if 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
191fi
192
193cross_prefix=${cross_prefix-${CROSS_COMPILE}}
194cc="${CC-${cross_prefix}gcc}"
195
196if check_define __ANDROID__ ; then
197  targetos="Android"
198elif check_define __linux__ ; then
199  targetos="Linux"
200elif check_define __OpenBSD__ ; then
201  targetos='OpenBSD'
202elif check_define __sun__ ; then
203  targetos='SunOS'
204  CFLAGS="$CFLAGS -D_REENTRANT"
205elif check_define _WIN32 ; then
206  targetos='CYGWIN'
207else
208  targetos=`uname -s`
209fi
210
211echo "# Automatically generated by configure - do not modify" > $config_host_mak
212printf "# Configured with:" >> $config_host_mak
213printf " '%s'" "$0" "$@" >> $config_host_mak
214echo >> $config_host_mak
215echo "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.
221case $targetos in
222Darwin)
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  ;;
232SunOS)
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  ;;
239CYGWIN*)
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  ;;
272esac
273
274if test ! -z "$cpu" ; then
275  # command line argument
276  :
277elif check_define __i386__ ; then
278  cpu="i386"
279elif check_define __x86_64__ ; then
280  cpu="x86_64"
281elif check_define __sparc__ ; then
282  if check_define __arch64__ ; then
283    cpu="sparc64"
284  else
285    cpu="sparc"
286  fi
287elif check_define _ARCH_PPC ; then
288  if check_define _ARCH_PPC64 ; then
289    cpu="ppc64"
290  else
291    cpu="ppc"
292  fi
293elif check_define __mips__ ; then
294  cpu="mips"
295elif check_define __ia64__ ; then
296  cpu="ia64"
297elif check_define __s390__ ; then
298  if check_define __s390x__ ; then
299    cpu="s390x"
300  else
301    cpu="s390"
302  fi
303elif check_define __arm__ ; then
304  cpu="arm"
305elif check_define __hppa__ ; then
306  cpu="hppa"
307else
308  cpu=`uname -m`
309fi
310
311# Normalise host CPU name and set ARCH.
312case "$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  ;;
337esac
338
339if 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
347fi
348
349cc="${CC-${cross_prefix}gcc}"
350
351##########################################
352# check cross compile
353
354cross_compile="no"
355cat > $TMPC <<EOF
356int main(void)
357{
358  return 0;
359}
360EOF
361if compile_prog "" "" "cross"; then
362  $TMPE 2>/dev/null || cross_compile="yes"
363else
364  fatal "compile test failed"
365fi
366
367##########################################
368# check endianness
369bigendian="no"
370if test "$cross_compile" = "no" ; then
371  cat > $TMPC <<EOF
372#include <inttypes.h>
373int main(void)
374{
375  volatile uint32_t i=0x01234567;
376  return (*((uint8_t*)(&i))) == 0x67;
377}
378EOF
379  if compile_prog "" "" "endian"; then
380    $TMPE && bigendian="yes"
381  fi
382else
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>
387int main(void)
388{
389#if __BYTE_ORDER != __BIG_ENDIAN
390# error "Unknown endianness"
391#endif
392}
393EOF
394  compile_prog "" "" "endian" && bigendian="yes"
395  check_define "__ARMEB__" && bigendian="yes"
396  check_define "__MIPSEB__" && bigendian="yes"
397fi
398
399
400echo "Operating system              $targetos"
401echo "CPU                           $cpu"
402echo "Big endian                    $bigendian"
403echo "Compiler                      $cc"
404echo "Cross compile                 $cross_compile"
405echo
406
407##########################################
408# See if we need to build a static build
409if test "$build_static" = "yes" ; then
410  CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
411  LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
412else
413  build_static="no"
414fi
415echo "Static build                  $build_static"
416
417##########################################
418# check for wordsize
419wordsize="0"
420cat > $TMPC <<EOF
421#include <limits.h>
422#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
423int main(void)
424{
425  BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
426  return 0;
427}
428EOF
429if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
430  wordsize="32"
431elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
432  wordsize="64"
433else
434  fatal "Unknown wordsize"
435fi
436echo "Wordsize                      $wordsize"
437
438##########################################
439# zlib probe
440zlib="no"
441cat > $TMPC <<EOF
442#include <zlib.h>
443int main(void)
444{
445  z_stream stream;
446  if (inflateInit(&stream) != Z_OK)
447    return 1;
448  return 0;
449}
450EOF
451if compile_prog "" "-lz" "zlib" ; then
452  zlib=yes
453  LIBS="-lz $LIBS"
454fi
455echo "zlib                          $zlib"
456
457##########################################
458# linux-aio probe
459libaio="no"
460cat > $TMPC <<EOF
461#include <libaio.h>
462#include <stddef.h>
463int main(void)
464{
465  io_setup(0, NULL);
466  return 0;
467}
468EOF
469if compile_prog "" "-laio" "libaio" ; then
470  libaio=yes
471  LIBS="-laio $LIBS"
472else
473  if test "$libaio" = "yes" ; then
474    feature_not_found "linux AIO" "libaio-dev or libaio-devel"
475  fi
476  libaio=no
477fi
478echo "Linux AIO support             $libaio"
479
480##########################################
481# posix aio probe
482posix_aio="no"
483posix_aio_lrt="no"
484cat > $TMPC <<EOF
485#include <aio.h>
486int main(void)
487{
488  struct aiocb cb;
489  aio_read(&cb);
490  return 0;
491}
492EOF
493if compile_prog "" "" "posixaio" ; then
494  posix_aio="yes"
495elif compile_prog "" "-lrt" "posixaio"; then
496  posix_aio="yes"
497  posix_aio_lrt="yes"
498  LIBS="-lrt $LIBS"
499fi
500echo "POSIX AIO support             $posix_aio"
501echo "POSIX AIO support needs -lrt  $posix_aio_lrt"
502
503##########################################
504# posix aio fsync probe
505posix_aio_fsync="no"
506if test "$posix_aio" = "yes" ; then
507  cat > $TMPC <<EOF
508#include <fcntl.h>
509#include <aio.h>
510int main(void)
511{
512  struct aiocb cb;
513  return aio_fsync(O_SYNC, &cb);
514  return 0;
515}
516EOF
517  if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
518    posix_aio_fsync=yes
519  fi
520fi
521echo "POSIX AIO fsync               $posix_aio_fsync"
522
523##########################################
524# solaris aio probe
525solaris_aio="no"
526cat > $TMPC <<EOF
527#include <sys/types.h>
528#include <sys/asynch.h>
529#include <unistd.h>
530int main(void)
531{
532  aio_result_t res;
533  return aioread(0, NULL, 0, 0, SEEK_SET, &res);
534  return 0;
535}
536EOF
537if compile_prog "" "-laio" "solarisaio" ; then
538  solaris_aio=yes
539  LIBS="-laio $LIBS"
540fi
541echo "Solaris AIO support           $solaris_aio"
542
543##########################################
544# __sync_fetch_and_and test
545sfaa="no"
546cat > $TMPC << EOF
547static int sfaa(int *ptr)
548{
549  return __sync_fetch_and_add(ptr, 0);
550}
551
552int main(int argc, char **argv)
553{
554  int val = 42;
555  sfaa(&val);
556  return val;
557}
558EOF
559if compile_prog "" "" "__sync_fetch_and_add()" ; then
560    sfaa="yes"
561fi
562echo "__sync_fetch_and_add          $sfaa"
563
564##########################################
565# libverbs probe
566libverbs="no"
567cat > $TMPC << EOF
568#include <stdio.h>
569#include <infiniband/arch.h>
570int main(int argc, char **argv)
571{
572  struct ibv_pd *pd = ibv_alloc_pd(NULL);
573  return 0;
574}
575EOF
576if compile_prog "" "-libverbs" "libverbs" ; then
577    libverbs="yes"
578    LIBS="-libverbs $LIBS"
579fi
580echo "libverbs                      $libverbs"
581
582##########################################
583# rdmacm probe
584rdmacm="no"
585cat > $TMPC << EOF
586#include <stdio.h>
587#include <rdma/rdma_cma.h>
588int main(int argc, char **argv)
589{
590  rdma_destroy_qp(NULL);
591  return 0;
592}
593EOF
594if compile_prog "" "-lrdmacm" "rdma"; then
595    rdmacm="yes"
596    LIBS="-lrdmacm $LIBS"
597fi
598echo "rdmacm                        $rdmacm"
599
600##########################################
601# Linux fallocate probe
602linux_fallocate="no"
603cat > $TMPC << EOF
604#include <stdio.h>
605#include <fcntl.h>
606#include <linux/falloc.h>
607int main(int argc, char **argv)
608{
609  int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
610  return r;
611}
612EOF
613if compile_prog "" "" "linux_fallocate"; then
614    linux_fallocate="yes"
615fi
616echo "Linux fallocate               $linux_fallocate"
617
618##########################################
619# POSIX fadvise probe
620posix_fadvise="no"
621cat > $TMPC << EOF
622#include <stdio.h>
623#include <fcntl.h>
624int main(int argc, char **argv)
625{
626  int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
627  return r;
628}
629EOF
630if compile_prog "" "" "posix_fadvise"; then
631    posix_fadvise="yes"
632fi
633echo "POSIX fadvise                 $posix_fadvise"
634
635##########################################
636# POSIX fallocate probe
637posix_fallocate="no"
638cat > $TMPC << EOF
639#include <stdio.h>
640#include <fcntl.h>
641int main(int argc, char **argv)
642{
643  int r = posix_fallocate(0, 0, 1024);
644  return r;
645}
646EOF
647if compile_prog "" "" "posix_fallocate"; then
648    posix_fallocate="yes"
649fi
650echo "POSIX fallocate               $posix_fallocate"
651
652##########################################
653# sched_set/getaffinity 2 or 3 argument test
654linux_2arg_affinity="no"
655linux_3arg_affinity="no"
656cat > $TMPC << EOF
657#include <sched.h>
658int main(int argc, char **argv)
659{
660  cpu_set_t mask;
661  return sched_setaffinity(0, sizeof(mask), &mask);
662}
663EOF
664if compile_prog "" "" "sched_setaffinity(,,)"; then
665  linux_3arg_affinity="yes"
666else
667  cat > $TMPC << EOF
668#include <sched.h>
669int main(int argc, char **argv)
670{
671  cpu_set_t mask;
672  return sched_setaffinity(0, &mask);
673}
674EOF
675  if compile_prog "" "" "sched_setaffinity(,)"; then
676    linux_2arg_affinity="yes"
677  fi
678fi
679echo "sched_setaffinity(3 arg)      $linux_3arg_affinity"
680echo "sched_setaffinity(2 arg)      $linux_2arg_affinity"
681
682##########################################
683# clock_gettime probe
684clock_gettime="no"
685cat > $TMPC << EOF
686#include <stdio.h>
687#include <time.h>
688int main(int argc, char **argv)
689{
690  return clock_gettime(0, NULL);
691}
692EOF
693if compile_prog "" "" "clock_gettime"; then
694    clock_gettime="yes"
695elif compile_prog "" "-lrt" "clock_gettime"; then
696    clock_gettime="yes"
697    LIBS="-lrt $LIBS"
698fi
699echo "clock_gettime                 $clock_gettime"
700
701##########################################
702# CLOCK_MONOTONIC probe
703clock_monotonic="no"
704if test "$clock_gettime" = "yes" ; then
705  cat > $TMPC << EOF
706#include <stdio.h>
707#include <time.h>
708int main(int argc, char **argv)
709{
710  return clock_gettime(CLOCK_MONOTONIC, NULL);
711}
712EOF
713  if compile_prog "" "$LIBS" "clock monotonic"; then
714      clock_monotonic="yes"
715  fi
716fi
717echo "CLOCK_MONOTONIC               $clock_monotonic"
718
719##########################################
720# CLOCK_MONOTONIC_PRECISE probe
721clock_monotonic_precise="no"
722if test "$clock_gettime" = "yes" ; then
723  cat > $TMPC << EOF
724#include <stdio.h>
725#include <time.h>
726int main(int argc, char **argv)
727{
728  return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
729}
730EOF
731  if compile_prog "" "$LIBS" "clock monotonic precise"; then
732      clock_monotonic_precise="yes"
733  fi
734fi
735echo "CLOCK_MONOTONIC_PRECISE       $clock_monotonic_precise"
736
737##########################################
738# gettimeofday() probe
739gettimeofday="no"
740cat > $TMPC << EOF
741#include <sys/time.h>
742#include <stdio.h>
743int main(int argc, char **argv)
744{
745  struct timeval tv;
746  return gettimeofday(&tv, NULL);
747}
748EOF
749if compile_prog "" "" "gettimeofday"; then
750    gettimeofday="yes"
751fi
752echo "gettimeofday                  $gettimeofday"
753
754##########################################
755# fdatasync() probe
756fdatasync="no"
757cat > $TMPC << EOF
758#include <stdio.h>
759#include <unistd.h>
760int main(int argc, char **argv)
761{
762  return fdatasync(0);
763}
764EOF
765if compile_prog "" "" "fdatasync"; then
766  fdatasync="yes"
767fi
768echo "fdatasync                     $fdatasync"
769
770##########################################
771# sync_file_range() probe
772sync_file_range="no"
773cat > $TMPC << EOF
774#include <stdio.h>
775#include <unistd.h>
776#include <fcntl.h>
777#include <linux/fs.h>
778int 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}
784EOF
785if compile_prog "" "" "sync_file_range"; then
786  sync_file_range="yes"
787fi
788echo "sync_file_range               $sync_file_range"
789
790##########################################
791# ext4 move extent probe
792ext4_me="no"
793cat > $TMPC << EOF
794#include <fcntl.h>
795#include <sys/ioctl.h>
796int main(int argc, char **argv)
797{
798  struct move_extent me;
799  return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
800}
801EOF
802if compile_prog "" "" "ext4 move extent" ; then
803  ext4_me="yes"
804elif 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"
809fi
810echo "EXT4 move extent              $ext4_me"
811
812##########################################
813# splice probe
814linux_splice="no"
815cat > $TMPC << EOF
816#include <stdio.h>
817#include <fcntl.h>
818int main(int argc, char **argv)
819{
820  return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
821}
822EOF
823if compile_prog "" "" "linux splice"; then
824  linux_splice="yes"
825fi
826echo "Linux splice(2)               $linux_splice"
827
828##########################################
829# GUASI probe
830guasi="no"
831cat > $TMPC << EOF
832#include <guasi.h>
833#include <guasi_syscalls.h>
834int main(int argc, char **argv)
835{
836  guasi_t ctx = guasi_create(0, 0, 0);
837  return 0;
838}
839EOF
840if compile_prog "" "" "guasi"; then
841  guasi="yes"
842fi
843echo "GUASI                         $guasi"
844
845##########################################
846# fusion-aw probe
847fusion_aw="no"
848cat > $TMPC << EOF
849#include <nvm/nvm_primitives.h>
850int 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}
858EOF
859if 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"
862fi
863echo "Fusion-io atomic engine       $fusion_aw"
864
865##########################################
866# libnuma probe
867libnuma="no"
868cat > $TMPC << EOF
869#include <numa.h>
870int main(int argc, char **argv)
871{
872  return numa_available();
873}
874EOF
875if test "$disable_numa" != "yes"  && compile_prog "" "-lnuma" "libnuma"; then
876  libnuma="yes"
877  LIBS="-lnuma $LIBS"
878fi
879echo "libnuma                       $libnuma"
880
881##########################################
882# libnuma 2.x version API
883if test "$libnuma" = "yes" ; then
884libnuma_v2="no"
885cat > $TMPC << EOF
886#include <numa.h>
887int main(int argc, char **argv)
888{
889  struct bitmask *mask = numa_parse_nodestring(NULL);
890  return mask->size == 0;
891}
892EOF
893if compile_prog "" "" "libnuma api"; then
894  libnuma_v2="yes"
895fi
896echo "libnuma v2                    $libnuma_v2"
897fi
898
899##########################################
900# strsep() probe
901strsep="no"
902cat > $TMPC << EOF
903#include <string.h>
904int main(int argc, char **argv)
905{
906  strsep(NULL, NULL);
907  return 0;
908}
909EOF
910if compile_prog "" "" "strsep"; then
911  strsep="yes"
912fi
913echo "strsep                        $strsep"
914
915##########################################
916# strcasestr() probe
917strcasestr="no"
918cat > $TMPC << EOF
919#include <string.h>
920int main(int argc, char **argv)
921{
922  return strcasestr(argv[0], argv[1]) != NULL;
923}
924EOF
925if compile_prog "" "" "strcasestr"; then
926  strcasestr="yes"
927fi
928echo "strcasestr                    $strcasestr"
929
930##########################################
931# getopt_long_only() probe
932getopt_long_only="no"
933cat > $TMPC << EOF
934#include <unistd.h>
935#include <stdio.h>
936#include <getopt.h>
937int main(int argc, char **argv)
938{
939  int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
940  return c;
941}
942EOF
943if compile_prog "" "" "getopt_long_only"; then
944  getopt_long_only="yes"
945fi
946echo "getopt_long_only()            $getopt_long_only"
947
948##########################################
949# inet_aton() probe
950inet_aton="no"
951cat > $TMPC << EOF
952#include <sys/socket.h>
953#include <arpa/inet.h>
954#include <stdio.h>
955int main(int argc, char **argv)
956{
957  struct in_addr in;
958  return inet_aton(NULL, &in);
959}
960EOF
961if compile_prog "" "" "inet_aton"; then
962  inet_aton="yes"
963fi
964echo "inet_aton                     $inet_aton"
965
966##########################################
967# socklen_t probe
968socklen_t="no"
969cat > $TMPC << EOF
970#include <sys/socket.h>
971int main(int argc, char **argv)
972{
973  socklen_t len = 0;
974  return len;
975}
976EOF
977if compile_prog "" "" "socklen_t"; then
978  socklen_t="yes"
979fi
980echo "socklen_t                     $socklen_t"
981
982##########################################
983# Whether or not __thread is supported for TLS
984tls_thread="no"
985cat > $TMPC << EOF
986#include <stdio.h>
987static __thread int ret;
988int main(int argc, char **argv)
989{
990  return ret;
991}
992EOF
993if compile_prog "" "" "__thread"; then
994  tls_thread="yes"
995fi
996echo "__thread                      $tls_thread"
997
998##########################################
999# Check if we have required gtk/glib support for gfio
1000gfio="no"
1001if test "$gfio_check" = "yes" ; then
1002  cat > $TMPC << EOF
1003#include <glib.h>
1004#include <cairo.h>
1005#include <gtk/gtk.h>
1006int main(void)
1007{
1008  gdk_threads_enter();
1009  gdk_threads_leave();
1010
1011  printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1012}
1013EOF
1014GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1015ORG_LDFLAGS=$LDFLAGS
1016LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1017if test "$?" != "0" ; then
1018  echo "configure: gtk and gthread not found"
1019  exit 1
1020fi
1021GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1022if test "$?" != "0" ; then
1023  echo "configure: gtk and gthread not found"
1024  exit 1
1025fi
1026if 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
1036else
1037  echo "Please install gtk and gdk libraries"
1038  gfio="no"
1039fi
1040LDFLAGS=$ORG_LDFLAGS
1041fi
1042
1043if test "$gfio_check" = "yes" ; then
1044  echo "gtk 2.18 or higher            $gfio"
1045fi
1046
1047# Check whether we have getrusage(RUSAGE_THREAD)
1048rusage_thread="no"
1049cat > $TMPC << EOF
1050#include <sys/time.h>
1051#include <sys/resource.h>
1052int main(int argc, char **argv)
1053{
1054  struct rusage ru;
1055  getrusage(RUSAGE_THREAD, &ru);
1056  return 0;
1057}
1058EOF
1059if compile_prog "" "" "RUSAGE_THREAD"; then
1060  rusage_thread="yes"
1061fi
1062echo "RUSAGE_THREAD                 $rusage_thread"
1063
1064##########################################
1065# Check whether we have SCHED_IDLE
1066sched_idle="no"
1067cat > $TMPC << EOF
1068#include <sched.h>
1069int main(int argc, char **argv)
1070{
1071  struct sched_param p;
1072  return sched_setscheduler(0, SCHED_IDLE, &p);
1073}
1074EOF
1075if compile_prog "" "" "SCHED_IDLE"; then
1076  sched_idle="yes"
1077fi
1078echo "SCHED_IDLE                    $sched_idle"
1079
1080##########################################
1081# Check whether we have TCP_NODELAY
1082tcp_nodelay="no"
1083cat > $TMPC << EOF
1084#include <stdio.h>
1085#include <sys/types.h>
1086#include <sys/socket.h>
1087#include <netinet/tcp.h>
1088int main(int argc, char **argv)
1089{
1090  return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1091}
1092EOF
1093if compile_prog "" "" "TCP_NODELAY"; then
1094  tcp_nodelay="yes"
1095fi
1096echo "TCP_NODELAY                   $tcp_nodelay"
1097
1098##########################################
1099# Check whether we have SO_SNDBUF
1100window_size="no"
1101cat > $TMPC << EOF
1102#include <stdio.h>
1103#include <sys/types.h>
1104#include <sys/socket.h>
1105#include <netinet/tcp.h>
1106int 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}
1111EOF
1112if compile_prog "" "" "SO_SNDBUF"; then
1113  window_size="yes"
1114fi
1115echo "Net engine window_size        $window_size"
1116
1117##########################################
1118# Check whether we have TCP_MAXSEG
1119mss="no"
1120cat > $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>
1127int main(int argc, char **argv)
1128{
1129  return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1130}
1131EOF
1132if compile_prog "" "" "TCP_MAXSEG"; then
1133  mss="yes"
1134fi
1135echo "TCP_MAXSEG                    $mss"
1136
1137##########################################
1138# Check whether we have RLIMIT_MEMLOCK
1139rlimit_memlock="no"
1140cat > $TMPC << EOF
1141#include <sys/time.h>
1142#include <sys/resource.h>
1143int main(int argc, char **argv)
1144{
1145  struct rlimit rl;
1146  return getrlimit(RLIMIT_MEMLOCK, &rl);
1147}
1148EOF
1149if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1150  rlimit_memlock="yes"
1151fi
1152echo "RLIMIT_MEMLOCK                $rlimit_memlock"
1153
1154##########################################
1155# Check whether we have pwritev/preadv
1156pwritev="no"
1157cat > $TMPC << EOF
1158#include <stdio.h>
1159#include <sys/uio.h>
1160int main(int argc, char **argv)
1161{
1162  return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1163}
1164EOF
1165if compile_prog "" "" "pwritev"; then
1166  pwritev="yes"
1167fi
1168echo "pwritev/preadv                $pwritev"
1169
1170##########################################
1171# Check whether we have the required functions for ipv6
1172ipv6="no"
1173cat > $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>
1179int 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}
1191EOF
1192if compile_prog "" "" "ipv6"; then
1193  ipv6="yes"
1194fi
1195echo "IPv6 helpers                  $ipv6"
1196
1197##########################################
1198# check for rbd
1199rbd="no"
1200cat > $TMPC << EOF
1201#include <rbd/librbd.h>
1202
1203int 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}
1216EOF
1217if test "$disable_rbd" != "yes"  && compile_prog "" "-lrbd -lrados" "rbd"; then
1218  LIBS="-lrbd -lrados $LIBS"
1219  rbd="yes"
1220fi
1221echo "Rados Block Device engine     $rbd"
1222
1223##########################################
1224# check for rbd_invaidate_cache()
1225rbd_inval="no"
1226if test "$rbd" = "yes"; then
1227cat > $TMPC << EOF
1228#include <rbd/librbd.h>
1229
1230int main(int argc, char **argv)
1231{
1232  rbd_image_t image;
1233
1234  return rbd_invalidate_cache(image);
1235}
1236EOF
1237if compile_prog "" "-lrbd -lrados" "rbd"; then
1238  rbd_inval="yes"
1239fi
1240echo "rbd_invalidate_cache          $rbd_inval"
1241fi
1242
1243##########################################
1244# Check whether we have setvbuf
1245setvbuf="no"
1246cat > $TMPC << EOF
1247#include <stdio.h>
1248int 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}
1255EOF
1256if compile_prog "" "" "setvbuf"; then
1257  setvbuf="yes"
1258fi
1259echo "setvbuf                       $setvbuf"
1260
1261# check for gfapi
1262gfapi="no"
1263cat > $TMPC << EOF
1264#include <glusterfs/api/glfs.h>
1265
1266int main(int argc, char **argv)
1267{
1268
1269  glfs_t *g = glfs_new("foo");
1270
1271  return 0;
1272}
1273EOF
1274if test "$disable_gfapi" != "yes"  && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1275  LIBS="-lgfapi -lglusterfs $LIBS"
1276  gfapi="yes"
1277fi
1278 echo "Gluster API engine            $gfapi"
1279
1280##########################################
1281# check for gfapi fadvise support
1282if test "$gfapi" = "yes" ; then
1283gf_fadvise="no"
1284cat > $TMPC << EOF
1285#include <glusterfs/api/glfs.h>
1286
1287int 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}
1294EOF
1295if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1296  gf_fadvise="yes"
1297fi
1298echo "Gluster API use fadvise       $gf_fadvise"
1299fi
1300
1301##########################################
1302# check for gfapi trim support
1303gf_trim="no"
1304if test "$gfapi" = "yes" ; then
1305cat > $TMPC << EOF
1306#include <glusterfs/api/glfs.h>
1307
1308int main(int argc, char **argv)
1309{
1310  return glfs_discard_async(NULL, 0, 0);
1311}
1312EOF
1313if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1314  gf_trim="yes"
1315fi
1316echo "Gluster API trim support      $gf_trim"
1317fi
1318
1319##########################################
1320# Check if we support stckf on s390
1321s390_z196_facilities="no"
1322cat > $TMPC << EOF
1323#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1324int 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}
1341EOF
1342if compile_prog "" "" "s390_z196_facilities"; then
1343  $TMPE
1344  if [[ $? -eq 0 ]]; then
1345  	s390_z196_facilities="yes"
1346  fi
1347fi
1348echo "s390_z196_facilities          $s390_z196_facilities"
1349
1350##########################################
1351# Check if we have required environment variables configured for libhdfs
1352if 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
1369fi
1370echo "HDFS engine                   $libhdfs"
1371
1372# Check if we have lex/yacc available
1373yacc="no"
1374yacc_is_bison="no"
1375lex="no"
1376arith="no"
1377if test "$targetos" != "SunOS" ; then
1378LEX=$(which lex 2> /dev/null)
1379if test -x "$LEX" ; then
1380  lex="yes"
1381fi
1382YACC=$(which bison 2> /dev/null)
1383if test -x "$YACC" ; then
1384  yacc="yes"
1385  yacc_is_bison="yes"
1386else
1387  YACC=$(which yacc 2> /dev/null)
1388  if test -x "$YACC" ; then
1389    yacc="yes"
1390  fi
1391fi
1392if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1393  arith="yes"
1394fi
1395
1396if test "$arith" = "yes" ; then
1397cat > $TMPC << EOF
1398extern int yywrap(void);
1399
1400int main(int argc, char **argv)
1401{
1402  yywrap();
1403  return 0;
1404}
1405EOF
1406if compile_prog "" "-ll" "lex"; then
1407  LIBS="-ll $LIBS"
1408else
1409  arith="no"
1410fi
1411fi
1412fi
1413
1414echo "lex/yacc for arithmetic       $arith"
1415
1416#############################################################################
1417
1418if test "$wordsize" = "64" ; then
1419  output_sym "CONFIG_64BIT"
1420elif test "$wordsize" = "32" ; then
1421  output_sym "CONFIG_32BIT"
1422else
1423  fatal "Unknown wordsize!"
1424fi
1425if test "$bigendian" = "yes" ; then
1426  output_sym "CONFIG_BIG_ENDIAN"
1427else
1428  output_sym "CONFIG_LITTLE_ENDIAN"
1429fi
1430if test "$zlib" = "yes" ; then
1431  output_sym "CONFIG_ZLIB"
1432fi
1433if test "$libaio" = "yes" ; then
1434  output_sym "CONFIG_LIBAIO"
1435fi
1436if test "$posix_aio" = "yes" ; then
1437  output_sym "CONFIG_POSIXAIO"
1438fi
1439if test "$posix_aio_fsync" = "yes" ; then
1440  output_sym "CONFIG_POSIXAIO_FSYNC"
1441fi
1442if test "$linux_fallocate" = "yes" ; then
1443  output_sym "CONFIG_LINUX_FALLOCATE"
1444fi
1445if test "$posix_fallocate" = "yes" ; then
1446  output_sym "CONFIG_POSIX_FALLOCATE"
1447fi
1448if test "$fdatasync" = "yes" ; then
1449  output_sym "CONFIG_FDATASYNC"
1450fi
1451if test "$sync_file_range" = "yes" ; then
1452  output_sym "CONFIG_SYNC_FILE_RANGE"
1453fi
1454if test "$sfaa" = "yes" ; then
1455  output_sym "CONFIG_SFAA"
1456fi
1457if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
1458  output_sym "CONFIG_RDMA"
1459fi
1460if test "$clock_gettime" = "yes" ; then
1461  output_sym "CONFIG_CLOCK_GETTIME"
1462fi
1463if test "$clock_monotonic" = "yes" ; then
1464  output_sym "CONFIG_CLOCK_MONOTONIC"
1465fi
1466if test "$clock_monotonic_precise" = "yes" ; then
1467  output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
1468fi
1469if test "$gettimeofday" = "yes" ; then
1470  output_sym "CONFIG_GETTIMEOFDAY"
1471fi
1472if test "$posix_fadvise" = "yes" ; then
1473  output_sym "CONFIG_POSIX_FADVISE"
1474fi
1475if test "$linux_3arg_affinity" = "yes" ; then
1476  output_sym "CONFIG_3ARG_AFFINITY"
1477elif test "$linux_2arg_affinity" = "yes" ; then
1478  output_sym "CONFIG_2ARG_AFFINITY"
1479fi
1480if test "$strsep" = "yes" ; then
1481  output_sym "CONFIG_STRSEP"
1482fi
1483if test "$strcasestr" = "yes" ; then
1484  output_sym "CONFIG_STRCASESTR"
1485fi
1486if test "$getopt_long_only" = "yes" ; then
1487  output_sym "CONFIG_GETOPT_LONG_ONLY"
1488fi
1489if test "$inet_aton" = "yes" ; then
1490  output_sym "CONFIG_INET_ATON"
1491fi
1492if test "$socklen_t" = "yes" ; then
1493  output_sym "CONFIG_SOCKLEN_T"
1494fi
1495if test "$ext4_me" = "yes" ; then
1496  output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
1497fi
1498if test "$linux_splice" = "yes" ; then
1499  output_sym "CONFIG_LINUX_SPLICE"
1500fi
1501if test "$guasi" = "yes" ; then
1502  output_sym "CONFIG_GUASI"
1503fi
1504if test "$fusion_aw" = "yes" ; then
1505  output_sym "CONFIG_FUSION_AW"
1506fi
1507if test "$libnuma_v2" = "yes" ; then
1508  output_sym "CONFIG_LIBNUMA"
1509fi
1510if test "$solaris_aio" = "yes" ; then
1511  output_sym "CONFIG_SOLARISAIO"
1512fi
1513if test "$tls_thread" = "yes" ; then
1514  output_sym "CONFIG_TLS_THREAD"
1515fi
1516if test "$rusage_thread" = "yes" ; then
1517  output_sym "CONFIG_RUSAGE_THREAD"
1518fi
1519if test "$gfio" = "yes" ; then
1520  echo "CONFIG_GFIO=y" >> $config_host_mak
1521fi
1522if test "$esx" = "yes" ; then
1523  output_sym "CONFIG_ESX"
1524  output_sym "CONFIG_NO_SHM"
1525fi
1526if test "$sched_idle" = "yes" ; then
1527  output_sym "CONFIG_SCHED_IDLE"
1528fi
1529if test "$tcp_nodelay" = "yes" ; then
1530  output_sym "CONFIG_TCP_NODELAY"
1531fi
1532if test "$window_size" = "yes" ; then
1533  output_sym "CONFIG_NET_WINDOWSIZE"
1534fi
1535if test "$mss" = "yes" ; then
1536  output_sym "CONFIG_NET_MSS"
1537fi
1538if test "$rlimit_memlock" = "yes" ; then
1539  output_sym "CONFIG_RLIMIT_MEMLOCK"
1540fi
1541if test "$pwritev" = "yes" ; then
1542  output_sym "CONFIG_PWRITEV"
1543fi
1544if test "$ipv6" = "yes" ; then
1545  output_sym "CONFIG_IPV6"
1546fi
1547if test "$rbd" = "yes" ; then
1548  output_sym "CONFIG_RBD"
1549fi
1550if test "$rbd_inval" = "yes" ; then
1551  output_sym "CONFIG_RBD_INVAL"
1552fi
1553if test "$setvbuf" = "yes" ; then
1554  output_sym "CONFIG_SETVBUF"
1555fi
1556if test "$s390_z196_facilities" = "yes" ; then
1557  output_sym "CONFIG_S390_Z196_FACILITIES"
1558  CFLAGS="$CFLAGS -march=z9-109"
1559fi
1560if test "$gfapi" = "yes" ; then
1561  output_sym "CONFIG_GFAPI"
1562fi
1563if test "$gf_fadvise" = "yes" ; then
1564  output_sym "CONFIG_GF_FADVISE"
1565fi
1566if test "$gf_trim" = "yes" ; then
1567  output_sym "CONFIG_GF_TRIM"
1568fi
1569if 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
1575if 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
1582fi
1583
1584if test "$zlib" = "no" ; then
1585  echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
1586fi
1587
1588echo "LIBS+=$LIBS" >> $config_host_mak
1589echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
1590echo "CFLAGS+=$CFLAGS" >> $config_host_mak
1591echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
1592echo "CC=$cc" >> $config_host_mak
1593echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
1594