configure: fixup Windows
[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_ld="config-host.ld"
28
29 # Print a helpful header at the top of config.log
30 echo "# FIO configure log $(date)" >> config.log
31 printf "# Configured with:" >> config.log
32 printf " '%s'" "$0" "$@" >> config.log
33 echo >> config.log
34 echo "#" >> config.log
35
36 do_cc() {
37     # Run the compiler, capturing its output to the log.
38     echo $cc "$@" >> config.log
39     $cc "$@" >> config.log 2>&1 || return $?
40     # Test passed. If this is an --enable-werror build, rerun
41     # the test with -Werror and bail out if it fails. This
42     # makes warning-generating-errors in configure test code
43     # obvious to developers.
44     if test "$werror" != "yes"; then
45         return 0
46     fi
47     # Don't bother rerunning the compile if we were already using -Werror
48     case "$*" in
49         *-Werror*)
50            return 0
51         ;;
52     esac
53     echo $cc -Werror "$@" >> config.log
54     $cc -Werror "$@" >> config.log 2>&1 && return $?
55     echo "ERROR: configure test passed without -Werror but failed with -Werror."
56     echo "This is probably a bug in the configure script. The failing command"
57     echo "will be at the bottom of config.log."
58     echo "You can run configure with --disable-werror to bypass this check."
59     exit 1
60 }
61
62 compile_object() {
63   do_cc $CFLAGS -c -o $TMPO $TMPC
64 }
65
66 compile_prog() {
67   local_cflags="$1"
68   local_ldflags="$2"
69   echo "Compiling test case $3" >> config.log
70   do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
71 }
72
73 feature_not_found() {
74   feature=$1
75
76   echo "ERROR"
77   echo "ERROR: User requested feature $feature"
78   echo "ERROR: configure was not able to find it"
79   echo "ERROR"
80   exit 1;
81 }
82
83 has() {
84   type "$1" >/dev/null 2>&1
85 }
86
87 check_define() {
88   cat > $TMPC <<EOF
89 #if !defined($1)
90 #error $1 not defined
91 #endif
92 int main(void)
93 {
94   return 0;
95 }
96 EOF
97   compile_object
98 }
99
100 targetos=""
101 cpu=""
102
103 cc="${CC-${cross_prefix}gcc}"
104
105 # parse options
106 for opt do
107   optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
108   case "$opt" in
109   --cc=*) CC="$optarg"
110   ;;
111   *)
112   echo "Bad option $opt"
113   exit 1
114   esac
115 done
116
117 if check_define __linux__ ; then
118   targetos="Linux"
119 elif check_define __OpenBSD__ ; then
120   targetos='OpenBSD'
121 elif check_define __sun__ ; then
122   targetos='SunOS'
123 else
124   targetos=`uname -s`
125 fi
126
127 # Some host OSes need non-standard checks for which CPU to use.
128 # Note that these checks are broken for cross-compilation: if you're
129 # cross-compiling to one of these OSes then you'll need to specify
130 # the correct CPU with the --cpu option.
131 case $targetos in
132 Darwin)
133   # on Leopard most of the system is 32-bit, so we have to ask the kernel if
134   # we can run 64-bit userspace code.
135   # If the user didn't specify a CPU explicitly and the kernel says this is
136   # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
137   # detection code.
138   if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
139     cpu="x86_64"
140   fi
141   ;;
142 SunOS)
143   # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
144   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
145     cpu="x86_64"
146   fi
147   ;;
148 CYGWIN*)
149   echo "Forcing known good options on Windows"
150   echo "CC=$CC"                    >  $config_host_mak
151   echo "CONFIG_LITTLE_ENDIAN=y"    >> $config_host_mak
152   echo "CONFIG_64BIT_LLP64=y"      >> $config_host_mak
153   echo "CONFIG_CLOCK_GETTIME=y"    >> $config_host_mak
154   echo "CONFIG_CLOCK_MONOTONIC=y"  >> $config_host_mak
155   echo "CONFIG_GETTIMEOFDAY=y"     >> $config_host_mak
156   echo "CONFIG_FADVISE=y"          >> $config_host_mak
157   echo "CONFIG_STRSEP=y"           >> $config_host_mak
158   echo "CONFIG_SOCKLEN_T=y"        >> $config_host_mak
159   echo "CONFIG_POSIX_FALLOCATE=y"  >> $config_host_mak
160   echo "CONFIG_FADVISE=y"          >> $config_host_mak
161   echo "CONFIG_SFAA=y"             >> $config_host_mak
162   exit 0
163 esac
164
165 if test ! -z "$cpu" ; then
166   # command line argument
167   :
168 elif check_define __i386__ ; then
169   cpu="i386"
170 elif check_define __x86_64__ ; then
171   cpu="x86_64"
172 elif check_define __sparc__ ; then
173   if check_define __arch64__ ; then
174     cpu="sparc64"
175   else
176     cpu="sparc"
177   fi
178 elif check_define _ARCH_PPC ; then
179   if check_define _ARCH_PPC64 ; then
180     cpu="ppc64"
181   else
182     cpu="ppc"
183   fi
184 elif check_define __mips__ ; then
185   cpu="mips"
186 elif check_define __ia64__ ; then
187   cpu="ia64"
188 elif check_define __s390__ ; then
189   if check_define __s390x__ ; then
190     cpu="s390x"
191   else
192     cpu="s390"
193   fi
194 elif check_define __arm__ ; then
195   cpu="arm"
196 elif check_define __hppa__ ; then
197   cpu="hppa"
198 else
199   cpu=`uname -m`
200 fi
201
202 # Normalise host CPU name and set ARCH.
203 case "$cpu" in
204   ia64|ppc|ppc64|s390|s390x|sparc64)
205     cpu="$cpu"
206   ;;
207   i386|i486|i586|i686|i86pc|BePC)
208     cpu="i386"
209   ;;
210   x86_64|amd64)
211     cpu="x86_64"
212   ;;
213   armv*b|armv*l|arm)
214     cpu="arm"
215   ;;
216   hppa|parisc|parisc64)
217     cpu="hppa"
218   ;;
219   mips*)
220     cpu="mips"
221   ;;
222   sparc|sun4[cdmuv])
223     cpu="sparc"
224   ;;
225   *)
226     echo "Unknown CPU"
227     exit 1;
228   ;;
229 esac
230
231 if test -z $CC; then
232   if test "$targetos" = "FreeBSD"; then
233     if has clang; then
234       CC=clang
235     else
236       CC=gcc
237     fi
238   fi
239 fi
240
241 cc="${CC-${cross_prefix}gcc}"
242
243 ##########################################
244 # check endianness
245 bigendian="no"
246 cat > $TMPC <<EOF
247 #include <inttypes.h>
248 int main(void)
249 {
250   volatile uint32_t i=0x01234567;
251   return (*((uint8_t*)(&i))) == 0x67;
252 }
253 EOF
254 if compile_prog "" "" "endian"; then
255   $TMPE && bigendian="yes"
256 fi
257
258
259 echo "Operating system              $targetos"
260 echo "CPU                           $cpu"
261 echo "Big endian                    $bigendian"
262 echo "Compiler                      $cc"
263 echo
264
265 ##########################################
266 # check for wordsize
267 wordsize="0"
268 cat > $TMPC <<EOF
269 #include <stdio.h>
270 int main(void)
271 {
272   unsigned int wsize = sizeof(long) * 8;
273   printf("%d\n", wsize);
274   return 0;
275 }
276 EOF
277 if compile_prog "" "" "wordsize"; then
278   wordsize=$($TMPE)
279 fi
280 echo "Wordsize                      $wordsize"
281
282 ##########################################
283 # linux-aio probe
284 libaio="no"
285 cat > $TMPC <<EOF
286 #include <libaio.h>
287 #include <stddef.h>
288 int main(void)
289 {
290   io_setup(0, NULL);
291   return 0;
292 }
293 EOF
294 if compile_prog "" "-laio" "libaio" ; then
295   libaio=yes
296   LIBS="-laio $LIBS"
297 else
298   if test "$libaio" = "yes" ; then
299     feature_not_found "linux AIO"
300   fi
301   libaio=no
302 fi
303 echo "Linux AIO support             $libaio"
304
305 ##########################################
306 # posix aio probe
307 posix_aio="no"
308 posix_aio_lrt="no"
309 cat > $TMPC <<EOF
310 #include <aio.h>
311 int main(void)
312 {
313   struct aiocb cb;
314   aio_read(&cb);
315   return 0;
316 }
317 EOF
318 if compile_prog "" "" "posixaio" ; then
319   posix_aio="yes"
320 elif compile_prog "" "-lrt" "posixaio"; then
321   posix_aio="yes"
322   posix_aio_lrt="yes"
323   LIBS="-lrt $LIBS"
324 fi
325 echo "POSIX AIO support             $posix_aio"
326 echo "POSIX AIO support needs -lrt  $posix_aio_lrt"
327
328 ##########################################
329 # posix aio fsync probe
330 posix_aio_fsync="no"
331 if test "$posix_aio" = "yes" ; then
332   cat > $TMPC <<EOF
333 #include <fcntl.h>
334 #include <aio.h>
335 int main(void)
336 {
337   struct aiocb cb;
338   return aio_fsync(O_SYNC, &cb);
339   return 0;
340 }
341 EOF
342   if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
343     posix_aio_fsync=yes
344   fi
345 fi
346 echo "POSIX AIO fsync               $posix_aio_fsync"
347
348 ##########################################
349 # solaris aio probe
350 solaris_aio="no"
351 cat > $TMPC <<EOF
352 #include <sys/types.h>
353 #include <sys/asynch.h>
354 #include <unistd.h>
355 int main(void)
356 {
357   aio_result_t res;
358   return aioread(0, NULL, 0, 0, SEEK_SET, &res);
359   return 0;
360 }
361 EOF
362 if compile_prog "" "-laio" "solarisaio" ; then
363   solaris_aio=yes
364   LIBS="-laio $LIBS"
365 fi
366 echo "Solaris AIO support           $solaris_aio"
367
368 ##########################################
369 # __sync_fetch_and_and test
370 sfaa="no"
371 cat > $TMPC << EOF
372 static int sfaa(int *ptr)
373 {
374   return __sync_fetch_and_and(ptr, 0);
375 }
376
377 int main(int argc, char **argv)
378 {
379   int val = 42;
380   sfaa(&val);
381   return val;
382 }
383 EOF
384 if compile_prog "" "" "__sync_fetch_and_add()" ; then
385     sfaa="yes"
386 fi
387 echo "__sync_fetch_and add          $sfaa"
388
389 ##########################################
390 # libverbs probe
391 libverbs="no"
392 cat > $TMPC << EOF
393 #include <stdio.h>
394 #include <infiniband/arch.h>
395 int main(int argc, char **argv)
396 {
397   struct ibv_pd *pd = ibv_alloc_pd(NULL);
398   return 0;
399 }
400 EOF
401 if compile_prog "" "-libverbs" "libverbs" ; then
402     libverbs="yes"
403     LIBS="-libverbs $LIBS"
404 fi
405 echo "libverbs                      $libverbs"
406
407 ##########################################
408 # rdmacm probe
409 rdmacm="no"
410 cat > $TMPC << EOF
411 #include <stdio.h>
412 #include <rdma/rdma_cma.h>
413 int main(int argc, char **argv)
414 {
415   rdma_destroy_qp(NULL);
416   return 0;
417 }
418 EOF
419 if compile_prog "" "-lrdmacm" "rdma"; then
420     rdmacm="yes"
421     LIBS="-lrdmacm $LIBS"
422 fi
423 echo "rdmacm                        $rdmacm"
424
425 ##########################################
426 # Linux fallocate probe
427 linux_fallocate="no"
428 cat > $TMPC << EOF
429 #include <stdio.h>
430 #include <linux/falloc.h>
431 int main(int argc, char **argv)
432 {
433   int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
434   return r;
435 }
436 EOF
437 if compile_prog "" "" "linux_fallocate"; then
438     linux_fallocate="yes"
439 fi
440 echo "Linux fallocate               $linux_fallocate"
441
442 ##########################################
443 # POSIX fadvise probe
444 posix_fadvise="no"
445 cat > $TMPC << EOF
446 #include <stdio.h>
447 #include <fcntl.h>
448 int main(int argc, char **argv)
449 {
450   int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
451   return r;
452 }
453 EOF
454 if compile_prog "" "" "posix_fadvise"; then
455     posix_fadvise="yes"
456 fi
457 echo "POSIX fadvise                 $posix_fadvise"
458
459 ##########################################
460 # POSIX fallocate probe
461 posix_fallocate="no"
462 cat > $TMPC << EOF
463 #include <stdio.h>
464 #include <fcntl.h>
465 int main(int argc, char **argv)
466 {
467   int r = posix_fallocate(0, 0, 1024);
468   return r;
469 }
470 EOF
471 if compile_prog "" "" "posix_fallocate"; then
472     posix_fallocate="yes"
473 fi
474 echo "POSIX fallocate               $posix_fallocate"
475
476 ##########################################
477 # sched_set/getaffinity 2 or 3 argument test
478 linux_2arg_affinity="no"
479 linux_3arg_affinity="no"
480 cat > $TMPC << EOF
481 #define _GNU_SOURCE
482 #include <sched.h>
483 int main(int argc, char **argv)
484 {
485   cpu_set_t mask;
486   return sched_setaffinity(0, sizeof(mask), &mask);
487 }
488 EOF
489 if compile_prog "" "" "sched_setaffinity(,,)"; then
490   linux_3arg_affinity="yes"
491 else
492   cat > $TMPC << EOF
493 #define _GNU_SOURCE
494 #include <sched.h>
495 int main(int argc, char **argv)
496 {
497   cpu_set_t mask;
498   return sched_setaffinity(0, &mask);
499 }
500 EOF
501   if compile_prog "" "" "sched_setaffinity(,)"; then
502     linux_2arg_affinity="yes"
503   fi
504 fi
505 echo "sched_setaffinity(3 arg)      $linux_3arg_affinity"
506 echo "sched_setaffinity(2 arg)      $linux_2arg_affinity"
507
508 ##########################################
509 # clock_gettime probe
510 clock_gettime="no"
511 cat > $TMPC << EOF
512 #include <stdio.h>
513 #include <time.h>
514 int main(int argc, char **argv)
515 {
516   return clock_gettime(0, NULL);
517 }
518 EOF
519 if compile_prog "" "" "clock_gettime"; then
520     clock_gettime="yes"
521 elif compile_prog "" "-lrt" "clock_gettime"; then
522     clock_gettime="yes"
523     LIBS="-lrt $LIBS"
524 fi
525 echo "clock_gettime                 $clock_gettime"
526
527 ##########################################
528 # CLOCK_MONOTONIC probe
529 clock_monotonic="no"
530 if test "$clock_gettime" = "yes" ; then
531   cat > $TMPC << EOF
532 #include <stdio.h>
533 #include <time.h>
534 int main(int argc, char **argv)
535 {
536   return clock_gettime(CLOCK_MONOTONIC, NULL);
537 }
538 EOF
539   if compile_prog "" "$LIBS" "clock monotonic"; then
540       clock_monotonic="yes"
541   fi
542 fi
543 echo "CLOCK_MONOTONIC               $clock_monotonic"
544
545 ##########################################
546 # CLOCK_MONOTONIC_PRECISE probe
547 clock_monotonic_precise="no"
548 if test "$clock_gettime" = "yes" ; then
549   cat > $TMPC << EOF
550 #include <stdio.h>
551 #include <time.h>
552 int main(int argc, char **argv)
553 {
554   return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
555 }
556 EOF
557   if compile_prog "" "$LIBS" "clock monotonic precise"; then
558       clock_monotonic_precise="yes"
559   fi
560 fi
561 echo "CLOCK_MONOTONIC_PRECISE       $clock_monotonic_precise"
562
563 ##########################################
564 # gettimeofday() probe
565 gettimeofday="no"
566 cat > $TMPC << EOF
567 #include <sys/time.h>
568 #include <stdio.h>
569 int main(int argc, char **argv)
570 {
571   struct timeval tv;
572   return gettimeofday(&tv, NULL);
573 }
574 EOF
575 if compile_prog "" "" "gettimeofday"; then
576     gettimeofday="yes"
577 fi
578 echo "gettimeofday                  $gettimeofday"
579
580 ##########################################
581 # fdatasync() probe
582 fdatasync="no"
583 cat > $TMPC << EOF
584 #include <stdio.h>
585 #include <unistd.h>
586 int main(int argc, char **argv)
587 {
588   return fdatasync(0);
589 }
590 EOF
591 if compile_prog "" "" "fdatasync"; then
592   fdatasync="yes"
593 fi
594 echo "fdatasync                     $fdatasync"
595
596 ##########################################
597 # sync_file_range() probe
598 sync_file_range="no"
599 cat > $TMPC << EOF
600 #include <stdio.h>
601 #include <unistd.h>
602 #define _GNU_SOURCE
603 #include <fcntl.h>
604 #include <linux/fs.h>
605 int main(int argc, char **argv)
606 {
607   unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
608                         SYNC_FILE_RANGE_WAIT_AFTER;
609   return sync_file_range(0, 0, 0, flags);
610 }
611 EOF
612 if compile_prog "" "" "sync_file_range"; then
613   sync_file_range="yes"
614 fi
615 echo "sync_file_range               $sync_file_range"
616
617 ##########################################
618 # ext4 move extent probe
619 ext4_me="no"
620 cat > $TMPC << EOF
621 #include <fcntl.h>
622 #include <sys/ioctl.h>
623 int main(int argc, char **argv)
624 {
625   struct move_extent me;
626   return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
627 }
628 EOF
629 if compile_prog "" "" "ext4 move extent" ; then
630   ext4_me="yes"
631 elif test $targetos = "Linux" ; then
632   # On Linux, just default to it on and let it error at runtime if we really
633   # don't have it. None of my updated systems have it defined, but it does
634   # work. Takes a while to bubble back.
635   ext4_me="yes"
636 fi
637 echo "EXT4 move extent              $ext4_me"
638
639 ##########################################
640 # splice probe
641 linux_splice="no"
642 cat > $TMPC << EOF
643 #define _GNU_SOURCE
644 #include <stdio.h>
645 #include <fcntl.h>
646 int main(int argc, char **argv)
647 {
648   return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
649 }
650 EOF
651 if compile_prog "" "" "linux splice"; then
652   linux_splice="yes"
653 fi
654 echo "Linux splice(2)               $linux_splice"
655
656 ##########################################
657 # GUASI probe
658 guasi="no"
659 cat > $TMPC << EOF
660 #include <guasi.h>
661 #include <guasi_syscalls.h>
662 int main(int argc, char **argv)
663 {
664   guasi_t ctx = guasi_create(0, 0, 0);
665   return 0;
666 }
667 EOF
668 if compile_prog "" "" "guasi"; then
669   guasi="yes"
670 fi
671 echo "GUASI                         $guasi"
672
673 ##########################################
674 # fusion-aw probe
675 fusion_aw="no"
676 cat > $TMPC << EOF
677 #include <nvm/vectored_write.h>
678 int main(int argc, char **argv)
679 {
680   struct vsl_iovec iov;
681   return vsl_vectored_write(0, &iov, 0, O_ATOMIC);
682 }
683 EOF
684 if compile_prog "" "-L/usr/lib/fio -lnvm-primitives" "fusion-aw"; then
685   LIBS="-L/usr/lib/fio -lnvm-primitives $LIBS"
686   fusion_aw="yes"
687 fi
688 echo "Fusion-io atomic engine       $fusion_aw"
689
690 ##########################################
691 # libnuma probe
692 libnuma="no"
693 cat > $TMPC << EOF
694 #include <numa.h>
695 int main(int argc, char **argv)
696 {
697   return numa_available();
698 }
699 EOF
700 if compile_prog "" "-lnuma" "libnuma"; then
701   libnuma="yes"
702   LIBS="-lnuma $LIBS"
703 fi
704 echo "libnuma                       $libnuma"
705
706 ##########################################
707 # strsep() probe
708 strsep="no"
709 cat > $TMPC << EOF
710 #include <string.h>
711 int main(int argc, char **argv)
712 {
713   strsep(NULL, NULL);
714   return 0;
715 }
716 EOF
717 if compile_prog "" "" "strsep"; then
718   strsep="yes"
719 fi
720 echo "strsep                        $strsep"
721
722 ##########################################
723 # getopt_long_only() probe
724 getopt_long_only="no"
725 cat > $TMPC << EOF
726 #include <unistd.h>
727 #include <stdio.h>
728 int main(int argc, char **argv)
729 {
730   int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
731   return c;
732 }
733 EOF
734 if compile_prog "" "" "getopt_long_only"; then
735   getopt_long_only="yes"
736 fi
737 echo "getopt_long_only()            $getopt_long_only"
738
739 ##########################################
740 # inet_aton() probe
741 inet_aton="no"
742 cat > $TMPC << EOF
743 #include <sys/socket.h>
744 #include <arpa/inet.h>
745 #include <stdio.h>
746 int main(int argc, char **argv)
747 {
748   struct in_addr in;
749   return inet_aton(NULL, &in);
750 }
751 EOF
752 if compile_prog "" "" "inet_aton"; then
753   inet_aton="yes"
754 fi
755 echo "inet_aton                     $inet_aton"
756
757 ##########################################
758 # socklen_t probe
759 socklen_t="no"
760 cat > $TMPC << EOF
761 #include <string.h>
762 #include <netinet/in.h>
763 int main(int argc, char **argv)
764 {
765   socklen_t len = 0;
766   return len;
767 }
768 EOF
769 if compile_prog "" "" "socklen_t"; then
770   socklen_t="yes"
771 fi
772 echo "socklen_t                     $socklen_t"
773
774 ##########################################
775 # Whether or not __thread is supported for TLS
776 tls_thread="no"
777 cat > $TMPC << EOF
778 #include <stdio.h>
779 static int __thread ret;
780 int main(int argc, char **argv)
781 {
782   return ret;
783 }
784 EOF
785 if compile_prog "" "" "__thread"; then
786   tls_thread="yes"
787 fi
788 echo "__thread                      $tls_thread"
789
790 #############################################################################
791
792 echo "# Automatically generated by configure - do not modify" > $config_host_mak
793 printf "# Configured with:" >> $config_host_mak
794 printf " '%s'" "$0" "$@" >> $config_host_mak
795 echo >> $config_host_mak
796
797 if test "$wordsize" = "64" ; then
798   echo "CONFIG_64BIT=y" >> $config_host_mak
799 elif test "$wordsize" = "32" ; then
800   echo "CONFIG_32BIT=y" >> $config_host_mak
801 else
802   echo "Unknown wordsize!"
803   exit 1
804 fi
805 if test "$bigendian" = "yes" ; then
806   echo "CONFIG_BIG_ENDIAN=y" >> $config_host_mak
807 else
808   echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak
809 fi
810 if test "$libaio" = "yes" ; then
811   echo "CONFIG_LIBAIO=y" >> $config_host_mak
812 fi
813 if test "$posix_aio" = "yes" ; then
814   echo "CONFIG_POSIXAIO=y" >> $config_host_mak
815 fi
816 if test "$posix_aio_fsync" = "yes" ; then
817   echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak
818 fi
819 if test "$linux_fallocate" = "yes" ; then
820   echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak
821 fi
822 if test "$posix_fallocate" = "yes" ; then
823   echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
824 fi
825 if test "$fdatasync" = "yes" ; then
826   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
827 fi
828 if test "$sync_file_range" = "yes" ; then
829   echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
830 fi
831 if test "$sfaa" = "yes" ; then
832   echo "CONFIG_SFAA=y" >> $config_host_mak
833 fi
834 if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then
835   echo "CONFIG_RDMA=y" >> $config_host_mak
836 fi
837 if test "$clock_gettime" = "yes" ; then
838   echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak
839 fi
840 if test "$clock_monotonic" = "yes" ; then
841   echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak
842 fi
843 if test "$clock_monotonic_precise" = "yes" ; then
844   echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak
845 fi
846 if test "$gettimeofday" = "yes" ; then
847   echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak
848 fi
849 if test "$posix_fadvise" = "yes" ; then
850   echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak
851 fi
852 if test "$linux_3arg_affinity" = "yes" ; then
853   echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak
854 elif test "$linux_2arg_affinity" = "yes" ; then
855   echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak
856 fi
857 if test "$strsep" = "yes" ; then
858   echo "CONFIG_STRSEP=y" >> $config_host_mak
859 fi
860 if test "$getopt_long_only" = "yes" ; then
861   echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak
862 fi
863 if test "$inet_aton" = "yes" ; then
864   echo "CONFIG_INET_ATON=y" >> $config_host_mak
865 fi
866 if test "$socklen_t" = "yes" ; then
867   echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak
868 fi
869 if test "$ext4_me" = "yes" ; then
870   echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak
871 fi
872 if test "$linux_splice" = "yes" ; then
873   echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak
874 fi
875 if test "$guasi" = "yes" ; then
876   echo "CONFIG_GUASI=y" >> $config_host_mak
877 fi
878 if test "$fusion_aw" = "yes" ; then
879   echo "CONFIG_FUSION_AW=y" >> $config_host_mak
880 fi
881 if test "$libnuma" = "yes" ; then
882   echo "CONFIG_LIBNUMA=y" >> $config_host_mak
883 fi
884 if test "$solaris_aio" = "yes" ; then
885   echo "CONFIG_SOLARISAIO=y" >> $config_host_mak
886 fi
887 if test "$tls_thread" = "yes" ; then
888   echo "CONFIG_TLS_THREAD=y" >> $config_host_mak
889 fi
890
891 echo "LIBS+=$LIBS" >> $config_host_mak
892 echo "CC=$cc" >> $config_host_mak