93351242a5c5e30b1e9459e14c09fb9d4f240c89
[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 pmemblk="no"
139 devdax="no"
140 disable_lex=""
141 disable_pmem="no"
142 prefix=/usr/local
143
144 # parse options
145 for opt do
146   optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
147   case "$opt" in
148   --prefix=*) prefix="$optarg"
149   ;;
150   --cpu=*) cpu="$optarg"
151   ;;
152   #  esx is cross compiled and cannot be detect through simple uname calls
153   --esx)
154   esx="yes"
155   ;;
156   --cc=*) CC="$optarg"
157   ;;
158   --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
159   ;;
160   --build-32bit-win) build_32bit_win="yes"
161   ;;
162   --build-static) build_static="yes"
163   ;;
164   --enable-gfio)
165   gfio_check="yes"
166   ;;
167   --disable-numa) disable_numa="yes"
168   ;;
169   --disable-rbd) disable_rbd="yes"
170   ;;
171   --disable-rbd-blkin) disable_rbd_blkin="yes"
172   ;;
173   --disable-gfapi) disable_gfapi="yes"
174   ;;
175   --enable-libhdfs) libhdfs="yes"
176   ;;
177   --disable-lex) disable_lex="yes"
178   ;;
179   --enable-lex) disable_lex="no"
180   ;;
181   --disable-shm) no_shm="yes"
182   ;;
183   --disable-optimizations) disable_opt="yes"
184   ;;
185   --disable-pmem) disable_pmem="yes"
186   ;;
187   --help)
188     show_help="yes"
189     ;;
190   *)
191   echo "Bad option $opt"
192   show_help="yes"
193   exit_val=1
194   esac
195 done
196
197 if test "$show_help" = "yes" ; then
198   echo "--prefix=               Use this directory as installation prefix"
199   echo "--cpu=                  Specify target CPU if auto-detect fails"
200   echo "--cc=                   Specify compiler to use"
201   echo "--extra-cflags=         Specify extra CFLAGS to pass to compiler"
202   echo "--build-32bit-win       Enable 32-bit build on Windows"
203   echo "--build-static          Build a static fio"
204   echo "--esx                   Configure build options for esx"
205   echo "--enable-gfio           Enable building of gtk gfio"
206   echo "--disable-numa          Disable libnuma even if found"
207   echo "--disable-gfapi         Disable gfapi"
208   echo "--enable-libhdfs        Enable hdfs support"
209   echo "--disable-lex           Disable use of lex/yacc for math"
210   echo "--disable-pmem          Disable pmem based engines even if found"
211   echo "--enable-lex            Enable use of lex/yacc for math"
212   echo "--disable-shm           Disable SHM support"
213   echo "--disable-optimizations Don't enable compiler optimizations"
214   exit $exit_val
215 fi
216
217 cross_prefix=${cross_prefix-${CROSS_COMPILE}}
218 cc="${CC-${cross_prefix}gcc}"
219
220 if check_define __ANDROID__ ; then
221   targetos="Android"
222 elif check_define __linux__ ; then
223   targetos="Linux"
224 elif check_define __OpenBSD__ ; then
225   targetos='OpenBSD'
226 elif check_define __sun__ ; then
227   targetos='SunOS'
228   CFLAGS="$CFLAGS -D_REENTRANT"
229 elif check_define _WIN32 ; then
230   targetos='CYGWIN'
231 else
232   targetos=`uname -s`
233 fi
234
235 echo "# Automatically generated by configure - do not modify" > $config_host_mak
236 printf "# Configured with:" >> $config_host_mak
237 printf " '%s'" "$0" "$@" >> $config_host_mak
238 echo >> $config_host_mak
239 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
240
241 if test "$no_shm" = "yes" ; then
242   output_sym "CONFIG_NO_SHM"
243 fi
244
245 if test "$disable_opt" = "yes" ; then
246   output_sym "CONFIG_FIO_NO_OPT"
247 fi
248
249 # Some host OSes need non-standard checks for which CPU to use.
250 # Note that these checks are broken for cross-compilation: if you're
251 # cross-compiling to one of these OSes then you'll need to specify
252 # the correct CPU with the --cpu option.
253 case $targetos in
254 AIX)
255   # Unless explicitly enabled, turn off lex.
256   if test -z "$disable_lex" ; then
257     disable_lex="yes"
258   else
259     force_no_lex_o="yes"
260   fi
261   ;;
262 Darwin)
263   # on Leopard most of the system is 32-bit, so we have to ask the kernel if
264   # we can run 64-bit userspace code.
265   # If the user didn't specify a CPU explicitly and the kernel says this is
266   # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
267   # detection code.
268   if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
269     cpu="x86_64"
270   fi
271   # Error at compile time linking of weak/partial symbols if possible...
272 cat > $TMPC <<EOF
273 int main(void)
274 {
275   return 0;
276 }
277 EOF
278   if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
279     echo "Disabling weak symbols"
280     LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
281   fi
282   ;;
283 SunOS)
284   # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
285   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
286     cpu="x86_64"
287   fi
288   LIBS="-lnsl -lsocket"
289   ;;
290 CYGWIN*)
291   # We still force some options, so keep this message here.
292   echo "Forcing some known good options on Windows"
293   if test -z "$CC" ; then
294     if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
295       CC="i686-w64-mingw32-gcc"
296       if test -e "../zlib/contrib/vstudio/vc14/x86/ZlibStatReleaseWithoutAsm/zlibstat.lib"; then
297         echo "Building with zlib support"
298         output_sym "CONFIG_ZLIB"
299         echo "LIBS=../zlib/contrib/vstudio/vc14/x86/ZlibStatReleaseWithoutAsm/zlibstat.lib" >> $config_host_mak
300       fi
301     else
302       CC="x86_64-w64-mingw32-gcc"
303       if test -e "../zlib/contrib/vstudio/vc14/x64/ZlibStatReleaseWithoutAsm/zlibstat.lib"; then
304         echo "Building with zlib support"
305         output_sym "CONFIG_ZLIB"
306         echo "LIBS=../zlib/contrib/vstudio/vc14/x64/ZlibStatReleaseWithoutAsm/zlibstat.lib" >> $config_host_mak
307       fi
308     fi
309   fi
310   if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
311     output_sym "CONFIG_32BIT"
312   else
313     output_sym "CONFIG_64BIT_LLP64"
314   fi
315   # We need this to be output_sym'd here because this is Windows specific.
316   # The regular configure path never sets this config.
317   output_sym "CONFIG_WINDOWSAIO"
318   # We now take the regular configuration path without having exit 0 here.
319   # Flags below are still necessary mostly for MinGW.
320   socklen_t="yes"
321   sfaa="yes"
322   rusage_thread="yes"
323   fdatasync="yes"
324   clock_gettime="yes" # clock_monotonic probe has dependency on this
325   clock_monotonic="yes"
326   gettimeofday="yes"
327   sched_idle="yes"
328   tcp_nodelay="yes"
329   tls_thread="yes"
330   static_assert="yes"
331   ipv6="yes"
332   echo "CC=$CC" >> $config_host_mak
333   echo "BUILD_CFLAGS=$CFLAGS -I../zlib -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
334   ;;
335 esac
336
337 if test ! -z "$cpu" ; then
338   # command line argument
339   :
340 elif check_define __i386__ ; then
341   cpu="i386"
342 elif check_define __x86_64__ ; then
343   cpu="x86_64"
344 elif check_define __sparc__ ; then
345   if check_define __arch64__ ; then
346     cpu="sparc64"
347   else
348     cpu="sparc"
349   fi
350 elif check_define _ARCH_PPC ; then
351   if check_define _ARCH_PPC64 ; then
352     cpu="ppc64"
353   else
354     cpu="ppc"
355   fi
356 elif check_define __mips__ ; then
357   cpu="mips"
358 elif check_define __ia64__ ; then
359   cpu="ia64"
360 elif check_define __s390__ ; then
361   if check_define __s390x__ ; then
362     cpu="s390x"
363   else
364     cpu="s390"
365   fi
366 elif check_define __arm__ ; then
367   cpu="arm"
368 elif check_define __aarch64__ ; then
369   cpu="aarch64"
370 elif check_define __hppa__ ; then
371   cpu="hppa"
372 else
373   cpu=`uname -m`
374 fi
375
376 # Normalise host CPU name and set ARCH.
377 case "$cpu" in
378   ia64|ppc|ppc64|s390|s390x|sparc64)
379     cpu="$cpu"
380   ;;
381   i386|i486|i586|i686|i86pc|BePC)
382     cpu="x86"
383   ;;
384   x86_64|amd64)
385     cpu="x86_64"
386   ;;
387   armv*b|armv*l|arm)
388     cpu="arm"
389   ;;
390   aarch64)
391     cpu="arm64"
392   ;;
393   hppa|parisc|parisc64)
394     cpu="hppa"
395   ;;
396   mips*)
397     cpu="mips"
398   ;;
399   sparc|sun4[cdmuv])
400     cpu="sparc"
401   ;;
402   *)
403   echo "Unknown CPU"
404   ;;
405 esac
406
407 if test -z "$CC" ; then
408   if test "$targetos" = "FreeBSD"; then
409     if has clang; then
410       CC=clang
411     else
412       CC=gcc
413     fi
414   fi
415 fi
416
417 cc="${CC-${cross_prefix}gcc}"
418
419 ##########################################
420 # check cross compile
421
422 if test "$cross_compile" != "yes" ; then
423   cross_compile="no"
424 fi
425 cat > $TMPC <<EOF
426 int main(void)
427 {
428   return 0;
429 }
430 EOF
431 if compile_prog "" "" "cross"; then
432   $TMPE 2>/dev/null || cross_compile="yes"
433 else
434   fatal "compile test failed"
435 fi
436
437 ##########################################
438 # check endianness
439 if test "$bigendian" != "yes" ; then
440   bigendian="no"
441 fi
442 if test "$cross_compile" = "no" ; then
443   cat > $TMPC <<EOF
444 #include <inttypes.h>
445 int main(void)
446 {
447   volatile uint32_t i=0x01234567;
448   return (*((uint8_t*)(&i))) == 0x67;
449 }
450 EOF
451   if compile_prog "" "" "endian"; then
452     $TMPE && bigendian="yes"
453   fi
454 else
455   # If we're cross compiling, try our best to work it out and rely on the
456   # run-time check to fail if we get it wrong.
457   cat > $TMPC <<EOF
458 #include <endian.h>
459 int main(void)
460 {
461 #if __BYTE_ORDER != __BIG_ENDIAN
462 # error "Unknown endianness"
463 #endif
464 }
465 EOF
466   compile_prog "" "" "endian" && bigendian="yes"
467   check_define "__ARMEB__" && bigendian="yes"
468   check_define "__MIPSEB__" && bigendian="yes"
469 fi
470
471
472 echo "Operating system              $targetos"
473 echo "CPU                           $cpu"
474 echo "Big endian                    $bigendian"
475 echo "Compiler                      $cc"
476 echo "Cross compile                 $cross_compile"
477 echo
478
479 ##########################################
480 # See if we need to build a static build
481 if test "$build_static" = "yes" ; then
482   CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
483   LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
484 else
485   build_static="no"
486 fi
487 echo "Static build                  $build_static"
488
489 ##########################################
490 # check for wordsize
491 wordsize="0"
492 cat > $TMPC <<EOF
493 #include <limits.h>
494 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
495 int main(void)
496 {
497   BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
498   return 0;
499 }
500 EOF
501 if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
502   wordsize="32"
503 elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
504   wordsize="64"
505 else
506   fatal "Unknown wordsize"
507 fi
508 echo "Wordsize                      $wordsize"
509
510 ##########################################
511 # zlib probe
512 if test "$zlib" != "yes" ; then
513   zlib="no"
514 fi
515 cat > $TMPC <<EOF
516 #include <zlib.h>
517 int main(void)
518 {
519   z_stream stream;
520   if (inflateInit(&stream) != Z_OK)
521     return 1;
522   return 0;
523 }
524 EOF
525 if compile_prog "" "-lz" "zlib" ; then
526   zlib=yes
527   LIBS="-lz $LIBS"
528 fi
529 echo "zlib                          $zlib"
530
531 ##########################################
532 # linux-aio probe
533 if test "$libaio" != "yes" ; then
534   libaio="no"
535 fi
536 if test "$esx" != "yes" ; then
537   cat > $TMPC <<EOF
538 #include <libaio.h>
539 #include <stddef.h>
540 int main(void)
541 {
542   io_setup(0, NULL);
543   return 0;
544 }
545 EOF
546   if compile_prog "" "-laio" "libaio" ; then
547     libaio=yes
548     LIBS="-laio $LIBS"
549   else
550     if test "$libaio" = "yes" ; then
551       feature_not_found "linux AIO" "libaio-dev or libaio-devel"
552     fi
553     libaio=no
554   fi
555 fi
556 echo "Linux AIO support             $libaio"
557
558 ##########################################
559 # posix aio probe
560 if test "$posix_aio" != "yes" ; then
561   posix_aio="no"
562 fi
563 if test "$posix_aio_lrt" != "yes" ; then
564   posix_aio_lrt="no"
565 fi
566 cat > $TMPC <<EOF
567 #include <aio.h>
568 int main(void)
569 {
570   struct aiocb cb;
571   aio_read(&cb);
572   return 0;
573 }
574 EOF
575 if compile_prog "" "" "posixaio" ; then
576   posix_aio="yes"
577 elif compile_prog "" "-lrt" "posixaio"; then
578   posix_aio="yes"
579   posix_aio_lrt="yes"
580   LIBS="-lrt $LIBS"
581 fi
582 echo "POSIX AIO support             $posix_aio"
583 echo "POSIX AIO support needs -lrt  $posix_aio_lrt"
584
585 ##########################################
586 # posix aio fsync probe
587 if test "$posix_aio_fsync" != "yes" ; then
588   posix_aio_fsync="no"
589 fi
590 if test "$posix_aio" = "yes" ; then
591   cat > $TMPC <<EOF
592 #include <fcntl.h>
593 #include <aio.h>
594 int main(void)
595 {
596   struct aiocb cb;
597   return aio_fsync(O_SYNC, &cb);
598   return 0;
599 }
600 EOF
601   if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
602     posix_aio_fsync=yes
603   fi
604 fi
605 echo "POSIX AIO fsync               $posix_aio_fsync"
606
607 ##########################################
608 # POSIX pshared attribute probe
609 posix_pshared="no"
610 cat > $TMPC <<EOF
611 #include <unistd.h>
612 int main(void)
613 {
614 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
615 # if defined(__CYGWIN__)
616 #  error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
617 # elif defined(__APPLE__)
618 #  include <AvailabilityMacros.h>
619 #  include <TargetConditionals.h>
620 #  if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
621 #   error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
622 #  endif
623 # endif
624 #else
625 # error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
626 #endif
627   return 0;
628 }
629 EOF
630 if compile_prog "" "$LIBS" "posix_pshared" ; then
631   posix_pshared=yes
632 fi
633 echo "POSIX pshared support         $posix_pshared"
634
635 ##########################################
636 # solaris aio probe
637 if test "$solaris_aio" != "yes" ; then
638   solaris_aio="no"
639 fi
640 cat > $TMPC <<EOF
641 #include <sys/types.h>
642 #include <sys/asynch.h>
643 #include <unistd.h>
644 int main(void)
645 {
646   aio_result_t res;
647   return aioread(0, NULL, 0, 0, SEEK_SET, &res);
648   return 0;
649 }
650 EOF
651 if compile_prog "" "-laio" "solarisaio" ; then
652   solaris_aio=yes
653   LIBS="-laio $LIBS"
654 fi
655 echo "Solaris AIO support           $solaris_aio"
656
657 ##########################################
658 # __sync_fetch_and_add test
659 if test "$sfaa" != "yes" ; then
660   sfaa="no"
661 fi
662 cat > $TMPC << EOF
663 #include <inttypes.h>
664 static int sfaa(uint64_t *ptr)
665 {
666   return __sync_fetch_and_add(ptr, 0);
667 }
668
669 int main(int argc, char **argv)
670 {
671   uint64_t val = 42;
672   sfaa(&val);
673   return val;
674 }
675 EOF
676 if compile_prog "" "" "__sync_fetch_and_add()" ; then
677     sfaa="yes"
678 fi
679 echo "__sync_fetch_and_add          $sfaa"
680
681 ##########################################
682 # libverbs probe
683 if test "$libverbs" != "yes" ; then
684   libverbs="no"
685 fi
686 cat > $TMPC << EOF
687 #include <stdio.h>
688 #include <infiniband/arch.h>
689 int main(int argc, char **argv)
690 {
691   struct ibv_pd *pd = ibv_alloc_pd(NULL);
692   return 0;
693 }
694 EOF
695 if compile_prog "" "-libverbs" "libverbs" ; then
696     libverbs="yes"
697     LIBS="-libverbs $LIBS"
698 fi
699 echo "libverbs                      $libverbs"
700
701 ##########################################
702 # rdmacm probe
703 if test "$rdmacm" != "yes" ; then
704   rdmacm="no"
705 fi
706 cat > $TMPC << EOF
707 #include <stdio.h>
708 #include <rdma/rdma_cma.h>
709 int main(int argc, char **argv)
710 {
711   rdma_destroy_qp(NULL);
712   return 0;
713 }
714 EOF
715 if compile_prog "" "-lrdmacm" "rdma"; then
716     rdmacm="yes"
717     LIBS="-lrdmacm $LIBS"
718 fi
719 echo "rdmacm                        $rdmacm"
720
721 ##########################################
722 # Linux fallocate probe
723 if test "$linux_fallocate" != "yes" ; then
724   linux_fallocate="no"
725 fi
726 cat > $TMPC << EOF
727 #include <stdio.h>
728 #include <fcntl.h>
729 #include <linux/falloc.h>
730 int main(int argc, char **argv)
731 {
732   int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
733   return r;
734 }
735 EOF
736 if compile_prog "" "" "linux_fallocate"; then
737     linux_fallocate="yes"
738 fi
739 echo "Linux fallocate               $linux_fallocate"
740
741 ##########################################
742 # POSIX fadvise probe
743 if test "$posix_fadvise" != "yes" ; then
744   posix_fadvise="no"
745 fi
746 cat > $TMPC << EOF
747 #include <stdio.h>
748 #include <fcntl.h>
749 int main(int argc, char **argv)
750 {
751   int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
752   return r;
753 }
754 EOF
755 if compile_prog "" "" "posix_fadvise"; then
756     posix_fadvise="yes"
757 fi
758 echo "POSIX fadvise                 $posix_fadvise"
759
760 ##########################################
761 # POSIX fallocate probe
762 if test "$posix_fallocate" != "yes" ; then
763   posix_fallocate="no"
764 fi
765 cat > $TMPC << EOF
766 #include <stdio.h>
767 #include <fcntl.h>
768 int main(int argc, char **argv)
769 {
770   int r = posix_fallocate(0, 0, 1024);
771   return r;
772 }
773 EOF
774 if compile_prog "" "" "posix_fallocate"; then
775     posix_fallocate="yes"
776 fi
777 echo "POSIX fallocate               $posix_fallocate"
778
779 ##########################################
780 # sched_set/getaffinity 2 or 3 argument test
781 if test "$linux_2arg_affinity" != "yes" ; then
782   linux_2arg_affinity="no"
783 fi
784 if test "$linux_3arg_affinity" != "yes" ; then
785   linux_3arg_affinity="no"
786 fi
787 cat > $TMPC << EOF
788 #include <sched.h>
789 int main(int argc, char **argv)
790 {
791   cpu_set_t mask;
792   return sched_setaffinity(0, sizeof(mask), &mask);
793 }
794 EOF
795 if compile_prog "" "" "sched_setaffinity(,,)"; then
796   linux_3arg_affinity="yes"
797 else
798   cat > $TMPC << EOF
799 #include <sched.h>
800 int main(int argc, char **argv)
801 {
802   cpu_set_t mask;
803   return sched_setaffinity(0, &mask);
804 }
805 EOF
806   if compile_prog "" "" "sched_setaffinity(,)"; then
807     linux_2arg_affinity="yes"
808   fi
809 fi
810 echo "sched_setaffinity(3 arg)      $linux_3arg_affinity"
811 echo "sched_setaffinity(2 arg)      $linux_2arg_affinity"
812
813 ##########################################
814 # clock_gettime probe
815 if test "$clock_gettime" != "yes" ; then
816   clock_gettime="no"
817 fi
818 cat > $TMPC << EOF
819 #include <stdio.h>
820 #include <time.h>
821 int main(int argc, char **argv)
822 {
823   return clock_gettime(0, NULL);
824 }
825 EOF
826 if compile_prog "" "" "clock_gettime"; then
827     clock_gettime="yes"
828 elif compile_prog "" "-lrt" "clock_gettime"; then
829     clock_gettime="yes"
830     LIBS="-lrt $LIBS"
831 fi
832 echo "clock_gettime                 $clock_gettime"
833
834 ##########################################
835 # CLOCK_MONOTONIC probe
836 if test "$clock_monotonic" != "yes" ; then
837   clock_monotonic="no"
838 fi
839 if test "$clock_gettime" = "yes" ; then
840   cat > $TMPC << EOF
841 #include <stdio.h>
842 #include <time.h>
843 int main(int argc, char **argv)
844 {
845   return clock_gettime(CLOCK_MONOTONIC, NULL);
846 }
847 EOF
848   if compile_prog "" "$LIBS" "clock monotonic"; then
849       clock_monotonic="yes"
850   fi
851 fi
852 echo "CLOCK_MONOTONIC               $clock_monotonic"
853
854 ##########################################
855 # CLOCK_MONOTONIC_RAW probe
856 if test "$clock_monotonic_raw" != "yes" ; then
857   clock_monotonic_raw="no"
858 fi
859 if test "$clock_gettime" = "yes" ; then
860   cat > $TMPC << EOF
861 #include <stdio.h>
862 #include <time.h>
863 int main(int argc, char **argv)
864 {
865   return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
866 }
867 EOF
868   if compile_prog "" "$LIBS" "clock monotonic"; then
869       clock_monotonic_raw="yes"
870   fi
871 fi
872 echo "CLOCK_MONOTONIC_RAW           $clock_monotonic_raw"
873
874 ##########################################
875 # CLOCK_MONOTONIC_PRECISE probe
876 if test "$clock_monotonic_precise" != "yes" ; then
877   clock_monotonic_precise="no"
878 fi
879 if test "$clock_gettime" = "yes" ; then
880   cat > $TMPC << EOF
881 #include <stdio.h>
882 #include <time.h>
883 int main(int argc, char **argv)
884 {
885   return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
886 }
887 EOF
888   if compile_prog "" "$LIBS" "clock monotonic precise"; then
889       clock_monotonic_precise="yes"
890   fi
891 fi
892 echo "CLOCK_MONOTONIC_PRECISE       $clock_monotonic_precise"
893
894 ##########################################
895 # clockid_t probe
896 if test "$clockid_t" != "yes" ; then
897   clockid_t="no"
898 fi
899 cat > $TMPC << EOF
900 #include <time.h>
901 int main(int argc, char **argv)
902 {
903   volatile clockid_t cid;
904   memset(&cid, 0, sizeof(cid));
905   return 0;
906 }
907 EOF
908 if compile_prog "" "$LIBS" "clockid_t"; then
909   clockid_t="yes"
910 fi
911 echo "clockid_t                     $clockid_t"
912
913 ##########################################
914 # gettimeofday() probe
915 if test "$gettimeofday" != "yes" ; then
916   gettimeofday="no"
917 fi
918 cat > $TMPC << EOF
919 #include <sys/time.h>
920 #include <stdio.h>
921 int main(int argc, char **argv)
922 {
923   struct timeval tv;
924   return gettimeofday(&tv, NULL);
925 }
926 EOF
927 if compile_prog "" "" "gettimeofday"; then
928     gettimeofday="yes"
929 fi
930 echo "gettimeofday                  $gettimeofday"
931
932 ##########################################
933 # fdatasync() probe
934 if test "$fdatasync" != "yes" ; then
935   fdatasync="no"
936 fi
937 cat > $TMPC << EOF
938 #include <stdio.h>
939 #include <unistd.h>
940 int main(int argc, char **argv)
941 {
942   return fdatasync(0);
943 }
944 EOF
945 if compile_prog "" "" "fdatasync"; then
946   fdatasync="yes"
947 fi
948 echo "fdatasync                     $fdatasync"
949
950 ##########################################
951 # sync_file_range() probe
952 if test "$sync_file_range" != "yes" ; then
953   sync_file_range="no"
954 fi
955 cat > $TMPC << EOF
956 #include <stdio.h>
957 #include <unistd.h>
958 #include <fcntl.h>
959 #include <linux/fs.h>
960 int main(int argc, char **argv)
961 {
962   unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
963                         SYNC_FILE_RANGE_WAIT_AFTER;
964   return sync_file_range(0, 0, 0, flags);
965 }
966 EOF
967 if compile_prog "" "" "sync_file_range"; then
968   sync_file_range="yes"
969 fi
970 echo "sync_file_range               $sync_file_range"
971
972 ##########################################
973 # ext4 move extent probe
974 if test "$ext4_me" != "yes" ; then
975   ext4_me="no"
976 fi
977 cat > $TMPC << EOF
978 #include <fcntl.h>
979 #include <sys/ioctl.h>
980 int main(int argc, char **argv)
981 {
982   struct move_extent me;
983   return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
984 }
985 EOF
986 if compile_prog "" "" "ext4 move extent" ; then
987   ext4_me="yes"
988 elif test $targetos = "Linux" ; then
989   # On Linux, just default to it on and let it error at runtime if we really
990   # don't have it. None of my updated systems have it defined, but it does
991   # work. Takes a while to bubble back.
992   ext4_me="yes"
993 fi
994 echo "EXT4 move extent              $ext4_me"
995
996 ##########################################
997 # splice probe
998 if test "$linux_splice" != "yes" ; then
999   linux_splice="no"
1000 fi
1001 cat > $TMPC << EOF
1002 #include <stdio.h>
1003 #include <fcntl.h>
1004 int main(int argc, char **argv)
1005 {
1006   return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1007 }
1008 EOF
1009 if compile_prog "" "" "linux splice"; then
1010   linux_splice="yes"
1011 fi
1012 echo "Linux splice(2)               $linux_splice"
1013
1014 ##########################################
1015 # GUASI probe
1016 if test "$guasi" != "yes" ; then
1017   guasi="no"
1018 fi
1019 cat > $TMPC << EOF
1020 #include <guasi.h>
1021 #include <guasi_syscalls.h>
1022 int main(int argc, char **argv)
1023 {
1024   guasi_t ctx = guasi_create(0, 0, 0);
1025   return 0;
1026 }
1027 EOF
1028 if compile_prog "" "" "guasi"; then
1029   guasi="yes"
1030 fi
1031 echo "GUASI                         $guasi"
1032
1033 ##########################################
1034 # fusion-aw probe
1035 if test "$fusion_aw" != "yes" ; then
1036   fusion_aw="no"
1037 fi
1038 cat > $TMPC << EOF
1039 #include <nvm/nvm_primitives.h>
1040 int main(int argc, char **argv)
1041 {
1042   nvm_version_t ver_info;
1043   nvm_handle_t handle;
1044
1045   handle = nvm_get_handle(0, &ver_info);
1046   return nvm_atomic_write(handle, 0, 0, 0);
1047 }
1048 EOF
1049 if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1050   LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
1051   fusion_aw="yes"
1052 fi
1053 echo "Fusion-io atomic engine       $fusion_aw"
1054
1055 ##########################################
1056 # libnuma probe
1057 if test "$libnuma" != "yes" ; then
1058   libnuma="no"
1059 fi
1060 cat > $TMPC << EOF
1061 #include <numa.h>
1062 int main(int argc, char **argv)
1063 {
1064   return numa_available();
1065 }
1066 EOF
1067 if test "$disable_numa" != "yes"  && compile_prog "" "-lnuma" "libnuma"; then
1068   libnuma="yes"
1069   LIBS="-lnuma $LIBS"
1070 fi
1071 echo "libnuma                       $libnuma"
1072
1073 ##########################################
1074 # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
1075 if test "$libnuma" = "yes" ; then
1076 libnuma_v2="no"
1077 cat > $TMPC << EOF
1078 #include <numa.h>
1079 int main(int argc, char **argv)
1080 {
1081   struct bitmask *mask = numa_parse_nodestring(NULL);
1082   return mask->size == 0;
1083 }
1084 EOF
1085 if compile_prog "" "" "libnuma api"; then
1086   libnuma_v2="yes"
1087 fi
1088 echo "libnuma v2                    $libnuma_v2"
1089 fi
1090
1091 ##########################################
1092 # strsep() probe
1093 if test "$strsep" != "yes" ; then
1094   strsep="no"
1095 fi
1096 cat > $TMPC << EOF
1097 #include <string.h>
1098 int main(int argc, char **argv)
1099 {
1100   static char *string = "This is a string";
1101   strsep(&string, "needle");
1102   return 0;
1103 }
1104 EOF
1105 if compile_prog "" "" "strsep"; then
1106   strsep="yes"
1107 fi
1108 echo "strsep                        $strsep"
1109
1110 ##########################################
1111 # strcasestr() probe
1112 if test "$strcasestr" != "yes" ; then
1113   strcasestr="no"
1114 fi
1115 cat > $TMPC << EOF
1116 #include <string.h>
1117 int main(int argc, char **argv)
1118 {
1119   return strcasestr(argv[0], argv[1]) != NULL;
1120 }
1121 EOF
1122 if compile_prog "" "" "strcasestr"; then
1123   strcasestr="yes"
1124 fi
1125 echo "strcasestr                    $strcasestr"
1126
1127 ##########################################
1128 # strlcat() probe
1129 if test "$strlcat" != "yes" ; then
1130   strlcat="no"
1131 fi
1132 cat > $TMPC << EOF
1133 #include <string.h>
1134 int main(int argc, char **argv)
1135 {
1136   static char dst[64];
1137   static char *string = "This is a string";
1138   memset(dst, 0, sizeof(dst));
1139   strlcat(dst, string, sizeof(dst));
1140   return 0;
1141 }
1142 EOF
1143 if compile_prog "" "" "strlcat"; then
1144   strlcat="yes"
1145 fi
1146 echo "strlcat                       $strlcat"
1147
1148 ##########################################
1149 # getopt_long_only() probe
1150 if test "$getopt_long_only" != "yes" ; then
1151   getopt_long_only="no"
1152 fi
1153 cat > $TMPC << EOF
1154 #include <unistd.h>
1155 #include <stdio.h>
1156 #include <getopt.h>
1157 int main(int argc, char **argv)
1158 {
1159   int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1160   return c;
1161 }
1162 EOF
1163 if compile_prog "" "" "getopt_long_only"; then
1164   getopt_long_only="yes"
1165 fi
1166 echo "getopt_long_only()            $getopt_long_only"
1167
1168 ##########################################
1169 # inet_aton() probe
1170 if test "$inet_aton" != "yes" ; then
1171   inet_aton="no"
1172 fi
1173 cat > $TMPC << EOF
1174 #include <sys/socket.h>
1175 #include <arpa/inet.h>
1176 #include <stdio.h>
1177 int main(int argc, char **argv)
1178 {
1179   struct in_addr in;
1180   return inet_aton(NULL, &in);
1181 }
1182 EOF
1183 if compile_prog "" "" "inet_aton"; then
1184   inet_aton="yes"
1185 fi
1186 echo "inet_aton                     $inet_aton"
1187
1188 ##########################################
1189 # socklen_t probe
1190 if test "$socklen_t" != "yes" ; then
1191   socklen_t="no"
1192 fi
1193 cat > $TMPC << EOF
1194 #include <sys/socket.h>
1195 int main(int argc, char **argv)
1196 {
1197   socklen_t len = 0;
1198   return len;
1199 }
1200 EOF
1201 if compile_prog "" "" "socklen_t"; then
1202   socklen_t="yes"
1203 fi
1204 echo "socklen_t                     $socklen_t"
1205
1206 ##########################################
1207 # Whether or not __thread is supported for TLS
1208 if test "$tls_thread" != "yes" ; then
1209   tls_thread="no"
1210 fi
1211 cat > $TMPC << EOF
1212 #include <stdio.h>
1213 static __thread int ret;
1214 int main(int argc, char **argv)
1215 {
1216   return ret;
1217 }
1218 EOF
1219 if compile_prog "" "" "__thread"; then
1220   tls_thread="yes"
1221 fi
1222 echo "__thread                      $tls_thread"
1223
1224 ##########################################
1225 # Check if we have required gtk/glib support for gfio
1226 if test "$gfio" != "yes" ; then
1227   gfio="no"
1228 fi
1229 if test "$gfio_check" = "yes" ; then
1230   cat > $TMPC << EOF
1231 #include <glib.h>
1232 #include <cairo.h>
1233 #include <gtk/gtk.h>
1234 int main(void)
1235 {
1236   gdk_threads_enter();
1237   gdk_threads_leave();
1238
1239   printf("%d", GTK_CHECK_VERSION(2, 18, 0));
1240 }
1241 EOF
1242 GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1243 ORG_LDFLAGS=$LDFLAGS
1244 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1245 if test "$?" != "0" ; then
1246   echo "configure: gtk and gthread not found"
1247   exit 1
1248 fi
1249 GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1250 if test "$?" != "0" ; then
1251   echo "configure: gtk and gthread not found"
1252   exit 1
1253 fi
1254 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1255   r=$($TMPE)
1256   if test "$r" != "0" ; then
1257     gfio="yes"
1258     GFIO_LIBS="$LIBS $GTK_LIBS"
1259     CFLAGS="$CFLAGS $GTK_CFLAGS"
1260   else
1261     echo "GTK found, but need version 2.18 or higher"
1262     gfio="no"
1263   fi
1264 else
1265   echo "Please install gtk and gdk libraries"
1266   gfio="no"
1267 fi
1268 LDFLAGS=$ORG_LDFLAGS
1269 fi
1270
1271 if test "$gfio_check" = "yes" ; then
1272   echo "gtk 2.18 or higher            $gfio"
1273 fi
1274
1275 # Check whether we have getrusage(RUSAGE_THREAD)
1276 if test "$rusage_thread" != "yes" ; then
1277   rusage_thread="no"
1278 fi
1279 cat > $TMPC << EOF
1280 #include <sys/time.h>
1281 #include <sys/resource.h>
1282 int main(int argc, char **argv)
1283 {
1284   struct rusage ru;
1285   getrusage(RUSAGE_THREAD, &ru);
1286   return 0;
1287 }
1288 EOF
1289 if compile_prog "" "" "RUSAGE_THREAD"; then
1290   rusage_thread="yes"
1291 fi
1292 echo "RUSAGE_THREAD                 $rusage_thread"
1293
1294 ##########################################
1295 # Check whether we have SCHED_IDLE
1296 if test "$sched_idle" != "yes" ; then
1297   sched_idle="no"
1298 fi
1299 cat > $TMPC << EOF
1300 #include <sched.h>
1301 int main(int argc, char **argv)
1302 {
1303   struct sched_param p;
1304   return sched_setscheduler(0, SCHED_IDLE, &p);
1305 }
1306 EOF
1307 if compile_prog "" "" "SCHED_IDLE"; then
1308   sched_idle="yes"
1309 fi
1310 echo "SCHED_IDLE                    $sched_idle"
1311
1312 ##########################################
1313 # Check whether we have TCP_NODELAY
1314 if test "$tcp_nodelay" != "yes" ; then
1315   tcp_nodelay="no"
1316 fi
1317 cat > $TMPC << EOF
1318 #include <stdio.h>
1319 #include <sys/types.h>
1320 #include <sys/socket.h>
1321 #include <netinet/tcp.h>
1322 int main(int argc, char **argv)
1323 {
1324   return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1325 }
1326 EOF
1327 if compile_prog "" "" "TCP_NODELAY"; then
1328   tcp_nodelay="yes"
1329 fi
1330 echo "TCP_NODELAY                   $tcp_nodelay"
1331
1332 ##########################################
1333 # Check whether we have SO_SNDBUF
1334 if test "$window_size" != "yes" ; then
1335   window_size="no"
1336 fi
1337 cat > $TMPC << EOF
1338 #include <stdio.h>
1339 #include <sys/types.h>
1340 #include <sys/socket.h>
1341 #include <netinet/tcp.h>
1342 int main(int argc, char **argv)
1343 {
1344   setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1345   setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1346 }
1347 EOF
1348 if compile_prog "" "" "SO_SNDBUF"; then
1349   window_size="yes"
1350 fi
1351 echo "Net engine window_size        $window_size"
1352
1353 ##########################################
1354 # Check whether we have TCP_MAXSEG
1355 if test "$mss" != "yes" ; then
1356   mss="no"
1357 fi
1358 cat > $TMPC << EOF
1359 #include <stdio.h>
1360 #include <sys/types.h>
1361 #include <sys/socket.h>
1362 #include <netinet/tcp.h>
1363 #include <arpa/inet.h>
1364 #include <netinet/in.h>
1365 int main(int argc, char **argv)
1366 {
1367   return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1368 }
1369 EOF
1370 if compile_prog "" "" "TCP_MAXSEG"; then
1371   mss="yes"
1372 fi
1373 echo "TCP_MAXSEG                    $mss"
1374
1375 ##########################################
1376 # Check whether we have RLIMIT_MEMLOCK
1377 if test "$rlimit_memlock" != "yes" ; then
1378   rlimit_memlock="no"
1379 fi
1380 cat > $TMPC << EOF
1381 #include <sys/time.h>
1382 #include <sys/resource.h>
1383 int main(int argc, char **argv)
1384 {
1385   struct rlimit rl;
1386   return getrlimit(RLIMIT_MEMLOCK, &rl);
1387 }
1388 EOF
1389 if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1390   rlimit_memlock="yes"
1391 fi
1392 echo "RLIMIT_MEMLOCK                $rlimit_memlock"
1393
1394 ##########################################
1395 # Check whether we have pwritev/preadv
1396 if test "$pwritev" != "yes" ; then
1397   pwritev="no"
1398 fi
1399 cat > $TMPC << EOF
1400 #include <stdio.h>
1401 #include <sys/uio.h>
1402 int main(int argc, char **argv)
1403 {
1404   return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1405 }
1406 EOF
1407 if compile_prog "" "" "pwritev"; then
1408   pwritev="yes"
1409 fi
1410 echo "pwritev/preadv                $pwritev"
1411
1412 ##########################################
1413 # Check whether we have pwritev2/preadv2
1414 if test "$pwritev2" != "yes" ; then
1415   pwritev2="no"
1416 fi
1417 cat > $TMPC << EOF
1418 #include <stdio.h>
1419 #include <sys/uio.h>
1420 int main(int argc, char **argv)
1421 {
1422   return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1423 }
1424 EOF
1425 if compile_prog "" "" "pwritev2"; then
1426   pwritev2="yes"
1427 fi
1428 echo "pwritev2/preadv2              $pwritev2"
1429
1430 ##########################################
1431 # Check whether we have the required functions for ipv6
1432 if test "$ipv6" != "yes" ; then
1433   ipv6="no"
1434 fi
1435 cat > $TMPC << EOF
1436 #include <sys/types.h>
1437 #include <sys/socket.h>
1438 #include <netinet/in.h>
1439 #include <netdb.h>
1440 #include <stdio.h>
1441 int main(int argc, char **argv)
1442 {
1443   struct addrinfo hints;
1444   struct in6_addr addr;
1445   int ret;
1446
1447   ret = getaddrinfo(NULL, NULL, &hints, NULL);
1448   freeaddrinfo(NULL);
1449   printf("%s\n", gai_strerror(ret));
1450   addr = in6addr_any;
1451   return 0;
1452 }
1453 EOF
1454 if compile_prog "" "" "ipv6"; then
1455   ipv6="yes"
1456 fi
1457 echo "IPv6 helpers                  $ipv6"
1458
1459 ##########################################
1460 # check for rbd
1461 if test "$rbd" != "yes" ; then
1462   rbd="no"
1463 fi
1464 cat > $TMPC << EOF
1465 #include <rbd/librbd.h>
1466
1467 int main(int argc, char **argv)
1468 {
1469
1470   rados_t cluster;
1471   rados_ioctx_t io_ctx;
1472   const char pool[] = "rbd";
1473
1474   int major, minor, extra;
1475   rbd_version(&major, &minor, &extra);
1476
1477   rados_ioctx_create(cluster, pool, &io_ctx);
1478   return 0;
1479 }
1480 EOF
1481 if test "$disable_rbd" != "yes"  && compile_prog "" "-lrbd -lrados" "rbd"; then
1482   LIBS="-lrbd -lrados $LIBS"
1483   rbd="yes"
1484 fi
1485 echo "Rados Block Device engine     $rbd"
1486
1487 ##########################################
1488 # check for rbd_poll
1489 if test "$rbd_poll" != "yes" ; then
1490   rbd_poll="no"
1491 fi
1492 if test "$rbd" = "yes"; then
1493 cat > $TMPC << EOF
1494 #include <rbd/librbd.h>
1495 #include <sys/eventfd.h>
1496
1497 int main(int argc, char **argv)
1498 {
1499   rbd_image_t image;
1500   rbd_completion_t comp;
1501
1502   int fd = eventfd(0, EFD_NONBLOCK);
1503   rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1504   rbd_poll_io_events(image, comp, 1);
1505
1506   return 0;
1507 }
1508 EOF
1509 if compile_prog "" "-lrbd -lrados" "rbd"; then
1510   rbd_poll="yes"
1511 fi
1512 echo "rbd_poll                      $rbd_poll"
1513 fi
1514
1515 ##########################################
1516 # check for rbd_invaidate_cache()
1517 if test "$rbd_inval" != "yes" ; then
1518   rbd_inval="no"
1519 fi
1520 if test "$rbd" = "yes"; then
1521 cat > $TMPC << EOF
1522 #include <rbd/librbd.h>
1523
1524 int main(int argc, char **argv)
1525 {
1526   rbd_image_t image;
1527
1528   return rbd_invalidate_cache(image);
1529 }
1530 EOF
1531 if compile_prog "" "-lrbd -lrados" "rbd"; then
1532   rbd_inval="yes"
1533 fi
1534 echo "rbd_invalidate_cache          $rbd_inval"
1535 fi
1536
1537 ##########################################
1538 # check for blkin
1539 if test "$rbd_blkin" != "yes" ; then
1540   rbd_blkin="no"
1541 fi
1542 cat > $TMPC << EOF
1543 #include <rbd/librbd.h>
1544 #include <zipkin_c.h>
1545
1546 int main(int argc, char **argv)
1547 {
1548   int r;
1549   struct blkin_trace_info t_info;
1550   blkin_init_trace_info(&t_info);
1551   rbd_completion_t completion;
1552   rbd_image_t image;
1553   uint64_t off;
1554   size_t len;
1555   const char *buf;
1556   r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
1557   return 0;
1558 }
1559 EOF
1560 if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
1561  && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
1562   LIBS="-lblkin $LIBS"
1563   rbd_blkin="yes"
1564 fi
1565 echo "rbd blkin tracing             $rbd_blkin"
1566
1567 ##########################################
1568 # Check whether we have setvbuf
1569 if test "$setvbuf" != "yes" ; then
1570   setvbuf="no"
1571 fi
1572 cat > $TMPC << EOF
1573 #include <stdio.h>
1574 int main(int argc, char **argv)
1575 {
1576   FILE *f = NULL;
1577   char buf[80];
1578   setvbuf(f, buf, _IOFBF, sizeof(buf));
1579   return 0;
1580 }
1581 EOF
1582 if compile_prog "" "" "setvbuf"; then
1583   setvbuf="yes"
1584 fi
1585 echo "setvbuf                       $setvbuf"
1586
1587 # check for gfapi
1588 if test "$gfapi" != "yes" ; then
1589   gfapi="no"
1590 fi
1591 cat > $TMPC << EOF
1592 #include <glusterfs/api/glfs.h>
1593
1594 int main(int argc, char **argv)
1595 {
1596
1597   glfs_t *g = glfs_new("foo");
1598
1599   return 0;
1600 }
1601 EOF
1602 if test "$disable_gfapi" != "yes"  && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1603   LIBS="-lgfapi -lglusterfs $LIBS"
1604   gfapi="yes"
1605 fi
1606  echo "Gluster API engine            $gfapi"
1607
1608 ##########################################
1609 # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1610 if test "$gfapi" = "yes" ; then
1611 gf_fadvise="no"
1612 cat > $TMPC << EOF
1613 #include <glusterfs/api/glfs.h>
1614
1615 int main(int argc, char **argv)
1616 {
1617   struct glfs_fd *fd;
1618   int ret = glfs_fadvise(fd, 0, 0, 1);
1619
1620   return 0;
1621 }
1622 EOF
1623 if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1624   gf_fadvise="yes"
1625 fi
1626 echo "Gluster API use fadvise       $gf_fadvise"
1627 fi
1628
1629 ##########################################
1630 # check for gfapi trim support
1631 if test "$gf_trim" != "yes" ; then
1632   gf_trim="no"
1633 fi
1634 if test "$gfapi" = "yes" ; then
1635 cat > $TMPC << EOF
1636 #include <glusterfs/api/glfs.h>
1637
1638 int main(int argc, char **argv)
1639 {
1640   return glfs_discard_async(NULL, 0, 0);
1641 }
1642 EOF
1643 if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1644   gf_trim="yes"
1645 fi
1646 echo "Gluster API trim support      $gf_trim"
1647 fi
1648
1649 ##########################################
1650 # Check if we support stckf on s390
1651 if test "$s390_z196_facilities" != "yes" ; then
1652   s390_z196_facilities="no"
1653 fi
1654 cat > $TMPC << EOF
1655 #define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1656 int main(int argc, char **argv)
1657 {
1658     /* We want just 1 double word to be returned.  */
1659     register unsigned long reg0 asm("0") = 0;
1660     unsigned long stfle_bits;
1661     asm volatile(".machine push"        "\n\t"
1662                  ".machine \"z9-109\""  "\n\t"
1663                  "stfle %0"             "\n\t"
1664                  ".machine pop"         "\n"
1665                  : "=QS" (stfle_bits), "+d" (reg0)
1666                  : : "cc");
1667
1668     if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1669       return 0;
1670     else
1671       return -1;
1672 }
1673 EOF
1674 if compile_prog "" "" "s390_z196_facilities"; then
1675   $TMPE
1676   if [[ $? -eq 0 ]]; then
1677         s390_z196_facilities="yes"
1678   fi
1679 fi
1680 echo "s390_z196_facilities          $s390_z196_facilities"
1681
1682 ##########################################
1683 # Check if we have required environment variables configured for libhdfs
1684 if test "$libhdfs" = "yes" ; then
1685   hdfs_conf_error=0
1686   if test "$JAVA_HOME" = "" ; then
1687     echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1688     hdfs_conf_error=1
1689   fi
1690   if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1691     echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1692     hdfs_conf_error=1
1693   fi
1694   if test "$FIO_LIBHDFS_LIB" = "" ; then
1695     echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1696     hdfs_conf_error=1
1697   fi
1698   if test "$hdfs_conf_error" = "1" ; then
1699     exit 1
1700   fi
1701   FIO_HDFS_CPU=$cpu
1702   if test "$FIO_HDFS_CPU" = "x86_64" ; then
1703     FIO_HDFS_CPU="amd64"
1704   fi
1705 fi
1706 echo "HDFS engine                   $libhdfs"
1707
1708 ##########################################
1709 # Check whether we have MTD
1710 if test "$mtd" != "yes" ; then
1711   mtd="no"
1712 fi
1713 cat > $TMPC << EOF
1714 #include <string.h>
1715 #include <mtd/mtd-user.h>
1716 #include <sys/ioctl.h>
1717 int main(int argc, char **argv)
1718 {
1719   struct mtd_write_req ops;
1720   struct mtd_info_user info;
1721   memset(&ops, 0, sizeof(ops));
1722   info.type = MTD_MLCNANDFLASH;
1723   return ioctl(0, MEMGETINFO, &info);
1724 }
1725 EOF
1726 if compile_prog "" "" "mtd"; then
1727   mtd="yes"
1728 fi
1729 echo "MTD                           $mtd"
1730
1731 ##########################################
1732 # Check whether we have libpmem
1733 if test "$libpmem" != "yes" ; then
1734   libpmem="no"
1735 fi
1736 cat > $TMPC << EOF
1737 #include <libpmem.h>
1738 int main(int argc, char **argv)
1739 {
1740   int rc;
1741   rc = pmem_is_pmem(0, 0);
1742   return 0;
1743 }
1744 EOF
1745 if compile_prog "" "-lpmem" "libpmem"; then
1746   libpmem="yes"
1747   LIBS="-lpmem $LIBS"
1748 fi
1749 echo "libpmem                       $libpmem"
1750
1751 ##########################################
1752 # Check whether we have libpmemblk
1753 # libpmem is a prerequisite
1754 if test "$libpmemblk" != "yes" ; then
1755   libpmemblk="no"
1756 fi
1757 if test "$libpmem" = "yes"; then
1758   cat > $TMPC << EOF
1759 #include <libpmemblk.h>
1760 int main(int argc, char **argv)
1761 {
1762   PMEMblkpool *pbp;
1763   pbp = pmemblk_open("", 0);
1764   return 0;
1765 }
1766 EOF
1767   if compile_prog "" "-lpmemblk" "libpmemblk"; then
1768     libpmemblk="yes"
1769     LIBS="-lpmemblk $LIBS"
1770   fi
1771 fi
1772 echo "libpmemblk                    $libpmemblk"
1773
1774 # Choose the ioengines
1775 if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1776   devdax="yes"
1777   if test "$libpmemblk" = "yes"; then
1778     pmemblk="yes"
1779   fi
1780 fi
1781
1782 ##########################################
1783 # Report whether pmemblk engine is enabled
1784 echo "NVML pmemblk engine           $pmemblk"
1785
1786 ##########################################
1787 # Report whether dev-dax engine is enabled
1788 echo "NVML dev-dax engine           $devdax"
1789
1790 # Check if we have lex/yacc available
1791 yacc="no"
1792 yacc_is_bison="no"
1793 lex="no"
1794 arith="no"
1795 if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
1796 if test "$targetos" != "SunOS" ; then
1797 LEX=$(which lex 2> /dev/null)
1798 if test -x "$LEX" ; then
1799   lex="yes"
1800 fi
1801 YACC=$(which bison 2> /dev/null)
1802 if test -x "$YACC" ; then
1803   yacc="yes"
1804   yacc_is_bison="yes"
1805 else
1806   YACC=$(which yacc 2> /dev/null)
1807   if test -x "$YACC" ; then
1808     yacc="yes"
1809   fi
1810 fi
1811 if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1812   arith="yes"
1813 fi
1814
1815 if test "$arith" = "yes" ; then
1816 cat > $TMPC << EOF
1817 extern int yywrap(void);
1818
1819 int main(int argc, char **argv)
1820 {
1821   yywrap();
1822   return 0;
1823 }
1824 EOF
1825 if compile_prog "" "-ll" "lex"; then
1826   LIBS="-ll $LIBS"
1827 else
1828   arith="no"
1829 fi
1830 fi
1831 fi
1832 fi
1833
1834 # Check if lex fails using -o
1835 if test "$arith" = "yes" ; then
1836 if test "$force_no_lex_o" = "yes" ; then
1837   lex_use_o="no"
1838 else
1839 $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1840 if test "$?" = "0" ; then
1841   lex_use_o="yes"
1842 else
1843   lex_use_o="no"
1844 fi
1845 fi
1846 fi
1847
1848 echo "lex/yacc for arithmetic       $arith"
1849
1850 ##########################################
1851 # Check whether we have setmntent/getmntent
1852 if test "$getmntent" != "yes" ; then
1853   getmntent="no"
1854 fi
1855 cat > $TMPC << EOF
1856 #include <stdio.h>
1857 #include <mntent.h>
1858 int main(int argc, char **argv)
1859 {
1860   FILE *mtab = setmntent(NULL, "r");
1861   struct mntent *mnt = getmntent(mtab);
1862   endmntent(mtab);
1863   return 0;
1864 }
1865 EOF
1866 if compile_prog "" "" "getmntent"; then
1867   getmntent="yes"
1868 fi
1869 echo "getmntent                     $getmntent"
1870
1871 ##########################################
1872 # Check whether we have getmntinfo
1873 # These are originally added for BSDs, but may also work
1874 # on other operating systems with getmntinfo(3).
1875
1876 # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1877 # Note that NetBSD needs -Werror to catch warning as error.
1878 if test "$getmntinfo" != "yes" ; then
1879   getmntinfo="no"
1880 fi
1881 cat > $TMPC << EOF
1882 #include <stdio.h>
1883 #include <sys/param.h>
1884 #include <sys/mount.h>
1885 int main(int argc, char **argv)
1886 {
1887   struct statfs *st;
1888   return getmntinfo(&st, MNT_NOWAIT);
1889 }
1890 EOF
1891 if compile_prog "-Werror" "" "getmntinfo"; then
1892   getmntinfo="yes"
1893 fi
1894 echo "getmntinfo                    $getmntinfo"
1895
1896 # getmntinfo(3) for NetBSD.
1897 if test "$getmntinfo_statvfs" != "yes" ; then
1898   getmntinfo_statvfs="no"
1899 fi
1900 cat > $TMPC << EOF
1901 #include <stdio.h>
1902 #include <sys/statvfs.h>
1903 int main(int argc, char **argv)
1904 {
1905   struct statvfs *st;
1906   return getmntinfo(&st, MNT_NOWAIT);
1907 }
1908 EOF
1909 # Skip the test if the one with statfs arg is detected.
1910 if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1911   getmntinfo_statvfs="yes"
1912   echo "getmntinfo_statvfs            $getmntinfo_statvfs"
1913 fi
1914
1915 ##########################################
1916 # Check whether we have _Static_assert
1917 if test "$static_assert" != "yes" ; then
1918   static_assert="no"
1919 fi
1920 cat > $TMPC << EOF
1921 #include <assert.h>
1922 #include <stdlib.h>
1923 #undef offsetof
1924 #ifdef __compiler_offsetof
1925 #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1926 #else
1927 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1928 #endif
1929
1930 #define container_of(ptr, type, member) ({                      \
1931         const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
1932         (type *)( (char *)__mptr - offsetof(type,member) );})
1933
1934 struct foo {
1935   int a, b;
1936 };
1937
1938 int main(int argc, char **argv)
1939 {
1940   _Static_assert(offsetof(struct foo, a) == 0 , "Check");
1941   return 0 ;
1942 }
1943 EOF
1944 if compile_prog "" "" "static_assert"; then
1945     static_assert="yes"
1946 fi
1947 echo "Static Assert                 $static_assert"
1948
1949 ##########################################
1950 # Check whether we have bool / stdbool.h
1951 if test "$have_bool" != "yes" ; then
1952   have_bool="no"
1953 fi
1954 cat > $TMPC << EOF
1955 #include <stdbool.h>
1956 int main(int argc, char **argv)
1957 {
1958   bool var = true;
1959   return var != false;
1960 }
1961 EOF
1962 if compile_prog "" "" "bool"; then
1963   have_bool="yes"
1964 fi
1965 echo "bool                          $have_bool"
1966
1967 ##########################################
1968 # check march=armv8-a+crc+crypto
1969 if test "$march_armv8_a_crc_crypto" != "yes" ; then
1970   march_armv8_a_crc_crypto="no"
1971 fi
1972 if test "$cpu" = "arm64" ; then
1973   cat > $TMPC <<EOF
1974 #include <sys/auxv.h>
1975 #include <arm_acle.h>
1976 #include <arm_neon.h>
1977
1978 int main(void)
1979 {
1980   return 0;
1981 }
1982 EOF
1983   if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
1984     march_armv8_a_crc_crypto="yes"
1985     CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
1986   fi
1987 fi
1988 echo "march_armv8_a_crc_crypto      $march_armv8_a_crc_crypto"
1989
1990
1991 #############################################################################
1992
1993 if test "$wordsize" = "64" ; then
1994   output_sym "CONFIG_64BIT"
1995 elif test "$wordsize" = "32" ; then
1996   output_sym "CONFIG_32BIT"
1997 else
1998   fatal "Unknown wordsize!"
1999 fi
2000 if test "$bigendian" = "yes" ; then
2001   output_sym "CONFIG_BIG_ENDIAN"
2002 else
2003   output_sym "CONFIG_LITTLE_ENDIAN"
2004 fi
2005 if test "$zlib" = "yes" ; then
2006   output_sym "CONFIG_ZLIB"
2007 fi
2008 if test "$libaio" = "yes" ; then
2009   output_sym "CONFIG_LIBAIO"
2010 fi
2011 if test "$posix_aio" = "yes" ; then
2012   output_sym "CONFIG_POSIXAIO"
2013 fi
2014 if test "$posix_aio_fsync" = "yes" ; then
2015   output_sym "CONFIG_POSIXAIO_FSYNC"
2016 fi
2017 if test "$posix_pshared" = "yes" ; then
2018   output_sym "CONFIG_PSHARED"
2019 fi
2020 if test "$linux_fallocate" = "yes" ; then
2021   output_sym "CONFIG_LINUX_FALLOCATE"
2022 fi
2023 if test "$posix_fallocate" = "yes" ; then
2024   output_sym "CONFIG_POSIX_FALLOCATE"
2025 fi
2026 if test "$fdatasync" = "yes" ; then
2027   output_sym "CONFIG_FDATASYNC"
2028 fi
2029 if test "$sync_file_range" = "yes" ; then
2030   output_sym "CONFIG_SYNC_FILE_RANGE"
2031 fi
2032 if test "$sfaa" = "yes" ; then
2033   output_sym "CONFIG_SFAA"
2034 fi
2035 if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2036   output_sym "CONFIG_RDMA"
2037 fi
2038 if test "$clock_gettime" = "yes" ; then
2039   output_sym "CONFIG_CLOCK_GETTIME"
2040 fi
2041 if test "$clock_monotonic" = "yes" ; then
2042   output_sym "CONFIG_CLOCK_MONOTONIC"
2043 fi
2044 if test "$clock_monotonic_raw" = "yes" ; then
2045   output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2046 fi
2047 if test "$clock_monotonic_precise" = "yes" ; then
2048   output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2049 fi
2050 if test "$clockid_t" = "yes"; then
2051   output_sym "CONFIG_CLOCKID_T"
2052 fi
2053 if test "$gettimeofday" = "yes" ; then
2054   output_sym "CONFIG_GETTIMEOFDAY"
2055 fi
2056 if test "$posix_fadvise" = "yes" ; then
2057   output_sym "CONFIG_POSIX_FADVISE"
2058 fi
2059 if test "$linux_3arg_affinity" = "yes" ; then
2060   output_sym "CONFIG_3ARG_AFFINITY"
2061 elif test "$linux_2arg_affinity" = "yes" ; then
2062   output_sym "CONFIG_2ARG_AFFINITY"
2063 fi
2064 if test "$strsep" = "yes" ; then
2065   output_sym "CONFIG_STRSEP"
2066 fi
2067 if test "$strcasestr" = "yes" ; then
2068   output_sym "CONFIG_STRCASESTR"
2069 fi
2070 if test "$strlcat" = "yes" ; then
2071   output_sym "CONFIG_STRLCAT"
2072 fi
2073 if test "$getopt_long_only" = "yes" ; then
2074   output_sym "CONFIG_GETOPT_LONG_ONLY"
2075 fi
2076 if test "$inet_aton" = "yes" ; then
2077   output_sym "CONFIG_INET_ATON"
2078 fi
2079 if test "$socklen_t" = "yes" ; then
2080   output_sym "CONFIG_SOCKLEN_T"
2081 fi
2082 if test "$ext4_me" = "yes" ; then
2083   output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2084 fi
2085 if test "$linux_splice" = "yes" ; then
2086   output_sym "CONFIG_LINUX_SPLICE"
2087 fi
2088 if test "$guasi" = "yes" ; then
2089   output_sym "CONFIG_GUASI"
2090 fi
2091 if test "$fusion_aw" = "yes" ; then
2092   output_sym "CONFIG_FUSION_AW"
2093 fi
2094 if test "$libnuma_v2" = "yes" ; then
2095   output_sym "CONFIG_LIBNUMA"
2096 fi
2097 if test "$solaris_aio" = "yes" ; then
2098   output_sym "CONFIG_SOLARISAIO"
2099 fi
2100 if test "$tls_thread" = "yes" ; then
2101   output_sym "CONFIG_TLS_THREAD"
2102 fi
2103 if test "$rusage_thread" = "yes" ; then
2104   output_sym "CONFIG_RUSAGE_THREAD"
2105 fi
2106 if test "$gfio" = "yes" ; then
2107   echo "CONFIG_GFIO=y" >> $config_host_mak
2108 fi
2109 if test "$esx" = "yes" ; then
2110   output_sym "CONFIG_ESX"
2111   output_sym "CONFIG_NO_SHM"
2112 fi
2113 if test "$sched_idle" = "yes" ; then
2114   output_sym "CONFIG_SCHED_IDLE"
2115 fi
2116 if test "$tcp_nodelay" = "yes" ; then
2117   output_sym "CONFIG_TCP_NODELAY"
2118 fi
2119 if test "$window_size" = "yes" ; then
2120   output_sym "CONFIG_NET_WINDOWSIZE"
2121 fi
2122 if test "$mss" = "yes" ; then
2123   output_sym "CONFIG_NET_MSS"
2124 fi
2125 if test "$rlimit_memlock" = "yes" ; then
2126   output_sym "CONFIG_RLIMIT_MEMLOCK"
2127 fi
2128 if test "$pwritev" = "yes" ; then
2129   output_sym "CONFIG_PWRITEV"
2130 fi
2131 if test "$pwritev2" = "yes" ; then
2132   output_sym "CONFIG_PWRITEV2"
2133 fi
2134 if test "$ipv6" = "yes" ; then
2135   output_sym "CONFIG_IPV6"
2136 fi
2137 if test "$rbd" = "yes" ; then
2138   output_sym "CONFIG_RBD"
2139 fi
2140 if test "$rbd_poll" = "yes" ; then
2141   output_sym "CONFIG_RBD_POLL"
2142 fi
2143 if test "$rbd_inval" = "yes" ; then
2144   output_sym "CONFIG_RBD_INVAL"
2145 fi
2146 if test "$rbd_blkin" = "yes" ; then
2147   output_sym "CONFIG_RBD_BLKIN"
2148 fi
2149 if test "$setvbuf" = "yes" ; then
2150   output_sym "CONFIG_SETVBUF"
2151 fi
2152 if test "$s390_z196_facilities" = "yes" ; then
2153   output_sym "CONFIG_S390_Z196_FACILITIES"
2154   CFLAGS="$CFLAGS -march=z9-109"
2155 fi
2156 if test "$gfapi" = "yes" ; then
2157   output_sym "CONFIG_GFAPI"
2158 fi
2159 if test "$gf_fadvise" = "yes" ; then
2160   output_sym "CONFIG_GF_FADVISE"
2161 fi
2162 if test "$gf_trim" = "yes" ; then
2163   output_sym "CONFIG_GF_TRIM"
2164 fi
2165 if test "$libhdfs" = "yes" ; then
2166   output_sym "CONFIG_LIBHDFS"
2167   echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2168   echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2169   echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2170   echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2171  fi
2172 if test "$mtd" = "yes" ; then
2173   output_sym "CONFIG_MTD"
2174 fi
2175 if test "$pmemblk" = "yes" ; then
2176   output_sym "CONFIG_PMEMBLK"
2177 fi
2178 if test "$devdax" = "yes" ; then
2179   output_sym "CONFIG_LINUX_DEVDAX"
2180 fi
2181 if test "$arith" = "yes" ; then
2182   output_sym "CONFIG_ARITHMETIC"
2183   if test "$yacc_is_bison" = "yes" ; then
2184     echo "YACC=$YACC -y" >> $config_host_mak
2185   else
2186     echo "YACC=$YACC" >> $config_host_mak
2187   fi
2188   if test "$lex_use_o" = "yes" ; then
2189     echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2190   fi
2191 fi
2192 if test "$getmntent" = "yes" ; then
2193   output_sym "CONFIG_GETMNTENT"
2194 fi
2195 if test "$getmntinfo" = "yes" ; then
2196   output_sym "CONFIG_GETMNTINFO"
2197 fi
2198 if test "$getmntinfo_statvfs" = "yes" ; then
2199   output_sym "CONFIG_GETMNTINFO_STATVFS"
2200 fi
2201 if test "$static_assert" = "yes" ; then
2202   output_sym "CONFIG_STATIC_ASSERT"
2203 fi
2204 if test "$have_bool" = "yes" ; then
2205   output_sym "CONFIG_HAVE_BOOL"
2206 fi
2207 if test "$disable_opt" = "yes" ; then
2208   output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2209 fi
2210
2211 if test "$zlib" = "no" ; then
2212   echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
2213 fi
2214
2215 echo "LIBS+=$LIBS" >> $config_host_mak
2216 echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
2217 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
2218 echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
2219 echo "CC=$cc" >> $config_host_mak
2220 echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
2221 echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2222
2223 if [ `dirname $0` != "." -a ! -e Makefile ]; then
2224     cat > Makefile <<EOF
2225 SRCDIR:=`dirname $0`
2226 include \$(SRCDIR)/Makefile
2227 EOF
2228 fi