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