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