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