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