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