b49497b77a35d903b9d257f57d594d94147b13f8
[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   echo "CONFIG_RUSAGE_THREAD=y"    >> $config_host_mak
168   echo "CONFIG_WINDOWSAIO=y"       >> $config_host_mak
169   echo "CONFIG_FDATASYNC=y"        >> $config_host_mak
170   exit 0
171 esac
172
173 if test ! -z "$cpu" ; then
174   # command line argument
175   :
176 elif check_define __i386__ ; then
177   cpu="i386"
178 elif check_define __x86_64__ ; then
179   cpu="x86_64"
180 elif check_define __sparc__ ; then
181   if check_define __arch64__ ; then
182     cpu="sparc64"
183   else
184     cpu="sparc"
185   fi
186 elif check_define _ARCH_PPC ; then
187   if check_define _ARCH_PPC64 ; then
188     cpu="ppc64"
189   else
190     cpu="ppc"
191   fi
192 elif check_define __mips__ ; then
193   cpu="mips"
194 elif check_define __ia64__ ; then
195   cpu="ia64"
196 elif check_define __s390__ ; then
197   if check_define __s390x__ ; then
198     cpu="s390x"
199   else
200     cpu="s390"
201   fi
202 elif check_define __arm__ ; then
203   cpu="arm"
204 elif check_define __hppa__ ; then
205   cpu="hppa"
206 else
207   cpu=`uname -m`
208 fi
209
210 # Normalise host CPU name and set ARCH.
211 case "$cpu" in
212   ia64|ppc|ppc64|s390|s390x|sparc64)
213     cpu="$cpu"
214   ;;
215   i386|i486|i586|i686|i86pc|BePC)
216     cpu="i386"
217   ;;
218   x86_64|amd64)
219     cpu="x86_64"
220   ;;
221   armv*b|armv*l|arm)
222     cpu="arm"
223   ;;
224   hppa|parisc|parisc64)
225     cpu="hppa"
226   ;;
227   mips*)
228     cpu="mips"
229   ;;
230   sparc|sun4[cdmuv])
231     cpu="sparc"
232   ;;
233   *)
234     echo "Unknown CPU"
235     exit 1;
236   ;;
237 esac
238
239 if test -z $CC; then
240   if test "$targetos" = "FreeBSD"; then
241     if has clang; then
242       CC=clang
243     else
244       CC=gcc
245     fi
246   fi
247 fi
248
249 cc="${CC-${cross_prefix}gcc}"
250
251 ##########################################
252 # check endianness
253 bigendian="no"
254 cat > $TMPC <<EOF
255 #include <inttypes.h>
256 int main(void)
257 {
258   volatile uint32_t i=0x01234567;
259   return (*((uint8_t*)(&i))) == 0x67;
260 }
261 EOF
262 if compile_prog "" "" "endian"; then
263   $TMPE && bigendian="yes"
264 fi
265
266
267 echo "Operating system              $targetos"
268 echo "CPU                           $cpu"
269 echo "Big endian                    $bigendian"
270 echo "Compiler                      $cc"
271 echo
272
273 ##########################################
274 # check for wordsize
275 wordsize="0"
276 cat > $TMPC <<EOF
277 #include <stdio.h>
278 int main(void)
279 {
280   unsigned int wsize = sizeof(long) * 8;
281   printf("%d\n", wsize);
282   return 0;
283 }
284 EOF
285 if compile_prog "" "" "wordsize"; then
286   wordsize=$($TMPE)
287 fi
288 echo "Wordsize                      $wordsize"
289
290 ##########################################
291 # linux-aio probe
292 libaio="no"
293 cat > $TMPC <<EOF
294 #include <libaio.h>
295 #include <stddef.h>
296 int main(void)
297 {
298   io_setup(0, NULL);
299   return 0;
300 }
301 EOF
302 if compile_prog "" "-laio" "libaio" ; then
303   libaio=yes
304   LIBS="-laio $LIBS"
305 else
306   if test "$libaio" = "yes" ; then
307     feature_not_found "linux AIO"
308   fi
309   libaio=no
310 fi
311 echo "Linux AIO support             $libaio"
312
313 ##########################################
314 # posix aio probe
315 posix_aio="no"
316 posix_aio_lrt="no"
317 cat > $TMPC <<EOF
318 #include <aio.h>
319 int main(void)
320 {
321   struct aiocb cb;
322   aio_read(&cb);
323   return 0;
324 }
325 EOF
326 if compile_prog "" "" "posixaio" ; then
327   posix_aio="yes"
328 elif compile_prog "" "-lrt" "posixaio"; then
329   posix_aio="yes"
330   posix_aio_lrt="yes"
331   LIBS="-lrt $LIBS"
332 fi
333 echo "POSIX AIO support             $posix_aio"
334 echo "POSIX AIO support needs -lrt  $posix_aio_lrt"
335
336 ##########################################
337 # posix aio fsync probe
338 posix_aio_fsync="no"
339 if test "$posix_aio" = "yes" ; then
340   cat > $TMPC <<EOF
341 #include <fcntl.h>
342 #include <aio.h>
343 int main(void)
344 {
345   struct aiocb cb;
346   return aio_fsync(O_SYNC, &cb);
347   return 0;
348 }
349 EOF
350   if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
351     posix_aio_fsync=yes
352   fi
353 fi
354 echo "POSIX AIO fsync               $posix_aio_fsync"
355
356 ##########################################
357 # solaris aio probe
358 solaris_aio="no"
359 cat > $TMPC <<EOF
360 #include <sys/types.h>
361 #include <sys/asynch.h>
362 #include <unistd.h>
363 int main(void)
364 {
365   aio_result_t res;
366   return aioread(0, NULL, 0, 0, SEEK_SET, &res);
367   return 0;
368 }
369 EOF
370 if compile_prog "" "-laio" "solarisaio" ; then
371   solaris_aio=yes
372   LIBS="-laio $LIBS"
373 fi
374 echo "Solaris AIO support           $solaris_aio"
375
376 ##########################################
377 # __sync_fetch_and_and test
378 sfaa="no"
379 cat > $TMPC << EOF
380 static int sfaa(int *ptr)
381 {
382   return __sync_fetch_and_and(ptr, 0);
383 }
384
385 int main(int argc, char **argv)
386 {
387   int val = 42;
388   sfaa(&val);
389   return val;
390 }
391 EOF
392 if compile_prog "" "" "__sync_fetch_and_add()" ; then
393     sfaa="yes"
394 fi
395 echo "__sync_fetch_and add          $sfaa"
396
397 ##########################################
398 # libverbs probe
399 libverbs="no"
400 cat > $TMPC << EOF
401 #include <stdio.h>
402 #include <infiniband/arch.h>
403 int main(int argc, char **argv)
404 {
405   struct ibv_pd *pd = ibv_alloc_pd(NULL);
406   return 0;
407 }
408 EOF
409 if compile_prog "" "-libverbs" "libverbs" ; then
410     libverbs="yes"
411     LIBS="-libverbs $LIBS"
412 fi
413 echo "libverbs                      $libverbs"
414
415 ##########################################
416 # rdmacm probe
417 rdmacm="no"
418 cat > $TMPC << EOF
419 #include <stdio.h>
420 #include <rdma/rdma_cma.h>
421 int main(int argc, char **argv)
422 {
423   rdma_destroy_qp(NULL);
424   return 0;
425 }
426 EOF
427 if compile_prog "" "-lrdmacm" "rdma"; then
428     rdmacm="yes"
429     LIBS="-lrdmacm $LIBS"
430 fi
431 echo "rdmacm                        $rdmacm"
432
433 ##########################################
434 # Linux fallocate probe
435 linux_fallocate="no"
436 cat > $TMPC << EOF
437 #include <stdio.h>
438 #include <linux/falloc.h>
439 int main(int argc, char **argv)
440 {
441   int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
442   return r;
443 }
444 EOF
445 if compile_prog "" "" "linux_fallocate"; then
446     linux_fallocate="yes"
447 fi
448 echo "Linux fallocate               $linux_fallocate"
449
450 ##########################################
451 # POSIX fadvise probe
452 posix_fadvise="no"
453 cat > $TMPC << EOF
454 #include <stdio.h>
455 #include <fcntl.h>
456 int main(int argc, char **argv)
457 {
458   int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
459   return r;
460 }
461 EOF
462 if compile_prog "" "" "posix_fadvise"; then
463     posix_fadvise="yes"
464 fi
465 echo "POSIX fadvise                 $posix_fadvise"
466
467 ##########################################
468 # POSIX fallocate probe
469 posix_fallocate="no"
470 cat > $TMPC << EOF
471 #include <stdio.h>
472 #include <fcntl.h>
473 int main(int argc, char **argv)
474 {
475   int r = posix_fallocate(0, 0, 1024);
476   return r;
477 }
478 EOF
479 if compile_prog "" "" "posix_fallocate"; then
480     posix_fallocate="yes"
481 fi
482 echo "POSIX fallocate               $posix_fallocate"
483
484 ##########################################
485 # sched_set/getaffinity 2 or 3 argument test
486 linux_2arg_affinity="no"
487 linux_3arg_affinity="no"
488 cat > $TMPC << EOF
489 #include <sched.h>
490 int main(int argc, char **argv)
491 {
492   cpu_set_t mask;
493   return sched_setaffinity(0, sizeof(mask), &mask);
494 }
495 EOF
496 if compile_prog "" "" "sched_setaffinity(,,)"; then
497   linux_3arg_affinity="yes"
498 else
499   cat > $TMPC << EOF
500 #include <sched.h>
501 int main(int argc, char **argv)
502 {
503   cpu_set_t mask;
504   return sched_setaffinity(0, &mask);
505 }
506 EOF
507   if compile_prog "" "" "sched_setaffinity(,)"; then
508     linux_2arg_affinity="yes"
509   fi
510 fi
511 echo "sched_setaffinity(3 arg)      $linux_3arg_affinity"
512 echo "sched_setaffinity(2 arg)      $linux_2arg_affinity"
513
514 ##########################################
515 # clock_gettime probe
516 clock_gettime="no"
517 cat > $TMPC << EOF
518 #include <stdio.h>
519 #include <time.h>
520 int main(int argc, char **argv)
521 {
522   return clock_gettime(0, NULL);
523 }
524 EOF
525 if compile_prog "" "" "clock_gettime"; then
526     clock_gettime="yes"
527 elif compile_prog "" "-lrt" "clock_gettime"; then
528     clock_gettime="yes"
529     LIBS="-lrt $LIBS"
530 fi
531 echo "clock_gettime                 $clock_gettime"
532
533 ##########################################
534 # CLOCK_MONOTONIC probe
535 clock_monotonic="no"
536 if test "$clock_gettime" = "yes" ; then
537   cat > $TMPC << EOF
538 #include <stdio.h>
539 #include <time.h>
540 int main(int argc, char **argv)
541 {
542   return clock_gettime(CLOCK_MONOTONIC, NULL);
543 }
544 EOF
545   if compile_prog "" "$LIBS" "clock monotonic"; then
546       clock_monotonic="yes"
547   fi
548 fi
549 echo "CLOCK_MONOTONIC               $clock_monotonic"
550
551 ##########################################
552 # CLOCK_MONOTONIC_PRECISE probe
553 clock_monotonic_precise="no"
554 if test "$clock_gettime" = "yes" ; then
555   cat > $TMPC << EOF
556 #include <stdio.h>
557 #include <time.h>
558 int main(int argc, char **argv)
559 {
560   return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
561 }
562 EOF
563   if compile_prog "" "$LIBS" "clock monotonic precise"; then
564       clock_monotonic_precise="yes"
565   fi
566 fi
567 echo "CLOCK_MONOTONIC_PRECISE       $clock_monotonic_precise"
568
569 ##########################################
570 # gettimeofday() probe
571 gettimeofday="no"
572 cat > $TMPC << EOF
573 #include <sys/time.h>
574 #include <stdio.h>
575 int main(int argc, char **argv)
576 {
577   struct timeval tv;
578   return gettimeofday(&tv, NULL);
579 }
580 EOF
581 if compile_prog "" "" "gettimeofday"; then
582     gettimeofday="yes"
583 fi
584 echo "gettimeofday                  $gettimeofday"
585
586 ##########################################
587 # fdatasync() probe
588 fdatasync="no"
589 cat > $TMPC << EOF
590 #include <stdio.h>
591 #include <unistd.h>
592 int main(int argc, char **argv)
593 {
594   return fdatasync(0);
595 }
596 EOF
597 if compile_prog "" "" "fdatasync"; then
598   fdatasync="yes"
599 fi
600 echo "fdatasync                     $fdatasync"
601
602 ##########################################
603 # sync_file_range() probe
604 sync_file_range="no"
605 cat > $TMPC << EOF
606 #include <stdio.h>
607 #include <unistd.h>
608 #include <fcntl.h>
609 #include <linux/fs.h>
610 int main(int argc, char **argv)
611 {
612   unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
613                         SYNC_FILE_RANGE_WAIT_AFTER;
614   return sync_file_range(0, 0, 0, flags);
615 }
616 EOF
617 if compile_prog "" "" "sync_file_range"; then
618   sync_file_range="yes"
619 fi
620 echo "sync_file_range               $sync_file_range"
621
622 ##########################################
623 # ext4 move extent probe
624 ext4_me="no"
625 cat > $TMPC << EOF
626 #include <fcntl.h>
627 #include <sys/ioctl.h>
628 int main(int argc, char **argv)
629 {
630   struct move_extent me;
631   return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
632 }
633 EOF
634 if compile_prog "" "" "ext4 move extent" ; then
635   ext4_me="yes"
636 elif test $targetos = "Linux" ; then
637   # On Linux, just default to it on and let it error at runtime if we really
638   # don't have it. None of my updated systems have it defined, but it does
639   # work. Takes a while to bubble back.
640   ext4_me="yes"
641 fi
642 echo "EXT4 move extent              $ext4_me"
643
644 ##########################################
645 # splice probe
646 linux_splice="no"
647 cat > $TMPC << EOF
648 #include <stdio.h>
649 #include <fcntl.h>
650 int main(int argc, char **argv)
651 {
652   return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
653 }
654 EOF
655 if compile_prog "" "" "linux splice"; then
656   linux_splice="yes"
657 fi
658 echo "Linux splice(2)               $linux_splice"
659
660 ##########################################
661 # GUASI probe
662 guasi="no"
663 cat > $TMPC << EOF
664 #include <guasi.h>
665 #include <guasi_syscalls.h>
666 int main(int argc, char **argv)
667 {
668   guasi_t ctx = guasi_create(0, 0, 0);
669   return 0;
670 }
671 EOF
672 if compile_prog "" "" "guasi"; then
673   guasi="yes"
674 fi
675 echo "GUASI                         $guasi"
676
677 ##########################################
678 # fusion-aw probe
679 fusion_aw="no"
680 cat > $TMPC << EOF
681 #include <nvm/vectored_write.h>
682 int main(int argc, char **argv)
683 {
684   struct vsl_iovec iov;
685   return vsl_vectored_write(0, &iov, 0, O_ATOMIC);
686 }
687 EOF
688 if compile_prog "" "-L/usr/lib/fio -lnvm-primitives" "fusion-aw"; then
689   LIBS="-L/usr/lib/fio -lnvm-primitives $LIBS"
690   fusion_aw="yes"
691 fi
692 echo "Fusion-io atomic engine       $fusion_aw"
693
694 ##########################################
695 # libnuma probe
696 libnuma="no"
697 cat > $TMPC << EOF
698 #include <numa.h>
699 int main(int argc, char **argv)
700 {
701   return numa_available();
702 }
703 EOF
704 if compile_prog "" "-lnuma" "libnuma"; then
705   libnuma="yes"
706   LIBS="-lnuma $LIBS"
707 fi
708 echo "libnuma                       $libnuma"
709
710 ##########################################
711 # strsep() probe
712 strsep="no"
713 cat > $TMPC << EOF
714 #include <string.h>
715 int main(int argc, char **argv)
716 {
717   strsep(NULL, NULL);
718   return 0;
719 }
720 EOF
721 if compile_prog "" "" "strsep"; then
722   strsep="yes"
723 fi
724 echo "strsep                        $strsep"
725
726 ##########################################
727 # getopt_long_only() probe
728 getopt_long_only="no"
729 cat > $TMPC << EOF
730 #include <unistd.h>
731 #include <stdio.h>
732 int main(int argc, char **argv)
733 {
734   int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
735   return c;
736 }
737 EOF
738 if compile_prog "" "" "getopt_long_only"; then
739   getopt_long_only="yes"
740 fi
741 echo "getopt_long_only()            $getopt_long_only"
742
743 ##########################################
744 # inet_aton() probe
745 inet_aton="no"
746 cat > $TMPC << EOF
747 #include <sys/socket.h>
748 #include <arpa/inet.h>
749 #include <stdio.h>
750 int main(int argc, char **argv)
751 {
752   struct in_addr in;
753   return inet_aton(NULL, &in);
754 }
755 EOF
756 if compile_prog "" "" "inet_aton"; then
757   inet_aton="yes"
758 fi
759 echo "inet_aton                     $inet_aton"
760
761 ##########################################
762 # socklen_t probe
763 socklen_t="no"
764 cat > $TMPC << EOF
765 #include <string.h>
766 #include <netinet/in.h>
767 int main(int argc, char **argv)
768 {
769   socklen_t len = 0;
770   return len;
771 }
772 EOF
773 if compile_prog "" "" "socklen_t"; then
774   socklen_t="yes"
775 fi
776 echo "socklen_t                     $socklen_t"
777
778 ##########################################
779 # Whether or not __thread is supported for TLS
780 tls_thread="no"
781 cat > $TMPC << EOF
782 #include <stdio.h>
783 static int __thread ret;
784 int main(int argc, char **argv)
785 {
786   return ret;
787 }
788 EOF
789 if compile_prog "" "" "__thread"; then
790   tls_thread="yes"
791 fi
792 echo "__thread                      $tls_thread"
793
794 ##########################################
795 # Check whether we have getrusage(RUSAGE_THREAD)
796 rusage_thread="no"
797 cat > $TMPC << EOF
798 #include <sys/time.h>
799 #include <sys/resource.h>
800 int main(int argc, char **argv)
801 {
802   struct rusage ru;
803   getrusage(RUSAGE_THREAD, &ru);
804   return 0;
805 }
806 EOF
807 if compile_prog "" "" "RUSAGE_THREAD"; then
808   rusage_thread="yes"
809 fi
810 echo "RUSAGE_THREAD                 $rusage_thread"
811
812 #############################################################################
813
814 echo "# Automatically generated by configure - do not modify" > $config_host_mak
815 printf "# Configured with:" >> $config_host_mak
816 printf " '%s'" "$0" "$@" >> $config_host_mak
817 echo >> $config_host_mak
818
819 if test "$wordsize" = "64" ; then
820   echo "CONFIG_64BIT=y" >> $config_host_mak
821 elif test "$wordsize" = "32" ; then
822   echo "CONFIG_32BIT=y" >> $config_host_mak
823 else
824   echo "Unknown wordsize!"
825   exit 1
826 fi
827 if test "$bigendian" = "yes" ; then
828   echo "CONFIG_BIG_ENDIAN=y" >> $config_host_mak
829 else
830   echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak
831 fi
832 if test "$libaio" = "yes" ; then
833   echo "CONFIG_LIBAIO=y" >> $config_host_mak
834 fi
835 if test "$posix_aio" = "yes" ; then
836   echo "CONFIG_POSIXAIO=y" >> $config_host_mak
837 fi
838 if test "$posix_aio_fsync" = "yes" ; then
839   echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak
840 fi
841 if test "$linux_fallocate" = "yes" ; then
842   echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak
843 fi
844 if test "$posix_fallocate" = "yes" ; then
845   echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
846 fi
847 if test "$fdatasync" = "yes" ; then
848   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
849 fi
850 if test "$sync_file_range" = "yes" ; then
851   echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
852 fi
853 if test "$sfaa" = "yes" ; then
854   echo "CONFIG_SFAA=y" >> $config_host_mak
855 fi
856 if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then
857   echo "CONFIG_RDMA=y" >> $config_host_mak
858 fi
859 if test "$clock_gettime" = "yes" ; then
860   echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak
861 fi
862 if test "$clock_monotonic" = "yes" ; then
863   echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak
864 fi
865 if test "$clock_monotonic_precise" = "yes" ; then
866   echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak
867 fi
868 if test "$gettimeofday" = "yes" ; then
869   echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak
870 fi
871 if test "$posix_fadvise" = "yes" ; then
872   echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak
873 fi
874 if test "$linux_3arg_affinity" = "yes" ; then
875   echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak
876 elif test "$linux_2arg_affinity" = "yes" ; then
877   echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak
878 fi
879 if test "$strsep" = "yes" ; then
880   echo "CONFIG_STRSEP=y" >> $config_host_mak
881 fi
882 if test "$getopt_long_only" = "yes" ; then
883   echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak
884 fi
885 if test "$inet_aton" = "yes" ; then
886   echo "CONFIG_INET_ATON=y" >> $config_host_mak
887 fi
888 if test "$socklen_t" = "yes" ; then
889   echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak
890 fi
891 if test "$ext4_me" = "yes" ; then
892   echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak
893 fi
894 if test "$linux_splice" = "yes" ; then
895   echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak
896 fi
897 if test "$guasi" = "yes" ; then
898   echo "CONFIG_GUASI=y" >> $config_host_mak
899 fi
900 if test "$fusion_aw" = "yes" ; then
901   echo "CONFIG_FUSION_AW=y" >> $config_host_mak
902 fi
903 if test "$libnuma" = "yes" ; then
904   echo "CONFIG_LIBNUMA=y" >> $config_host_mak
905 fi
906 if test "$solaris_aio" = "yes" ; then
907   echo "CONFIG_SOLARISAIO=y" >> $config_host_mak
908 fi
909 if test "$tls_thread" = "yes" ; then
910   echo "CONFIG_TLS_THREAD=y" >> $config_host_mak
911 fi
912 if test "$rusage_thread" = "yes" ; then
913   echo "CONFIG_RUSAGE_THREAD=y" >> $config_host_mak
914 fi
915
916 echo "LIBS+=$LIBS" >> $config_host_mak
917 echo "CC=$cc" >> $config_host_mak
918 echo "CFLAGS=$CFLAGS" >> $config_host_mak