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