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