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