blob: af2c1d97f6667aa20a4de571b09abc022e3fe3df [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"
27config_host_ld="config-host.ld"
28
29# Print a helpful header at the top of config.log
30echo "# FIO configure log $(date)" >> config.log
31printf "# Configured with:" >> config.log
32printf " '%s'" "$0" "$@" >> config.log
33echo >> config.log
34echo "#" >> config.log
35
36do_cc() {
37 # Run the compiler, capturing its output to the log.
38 echo $cc "$@" >> config.log
39 $cc "$@" >> config.log 2>&1 || return $?
40 # Test passed. If this is an --enable-werror build, rerun
41 # the test with -Werror and bail out if it fails. This
42 # makes warning-generating-errors in configure test code
43 # obvious to developers.
44 if test "$werror" != "yes"; then
45 return 0
46 fi
47 # Don't bother rerunning the compile if we were already using -Werror
48 case "$*" in
49 *-Werror*)
50 return 0
51 ;;
52 esac
53 echo $cc -Werror "$@" >> config.log
54 $cc -Werror "$@" >> config.log 2>&1 && return $?
55 echo "ERROR: configure test passed without -Werror but failed with -Werror."
56 echo "This is probably a bug in the configure script. The failing command"
57 echo "will be at the bottom of config.log."
58 echo "You can run configure with --disable-werror to bypass this check."
59 exit 1
60}
61
62compile_object() {
63 do_cc $CFLAGS -c -o $TMPO $TMPC
64}
65
66compile_prog() {
67 local_cflags="$1"
68 local_ldflags="$2"
69 echo "Compiling test case $3" >> config.log
70 do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
71}
72
73feature_not_found() {
74 feature=$1
75
76 echo "ERROR"
77 echo "ERROR: User requested feature $feature"
78 echo "ERROR: configure was not able to find it"
79 echo "ERROR"
80 exit 1;
81}
82
83has() {
84 type "$1" >/dev/null 2>&1
85}
86
87check_define() {
88 cat > $TMPC <<EOF
89#if !defined($1)
90#error $1 not defined
91#endif
92int main(void)
93{
94 return 0;
95}
96EOF
97 compile_object
98}
99
100targetos=""
101cpu=""
102
103cc="${CC-${cross_prefix}gcc}"
104
Jens Axboe91f94d52013-01-24 10:25:42 -0700105# default options
106gfio="no"
Jens Axboe47f44632013-01-24 10:34:14 -0700107show_help="no"
108exit_val=0
Jens Axboe91f94d52013-01-24 10:25:42 -0700109
Jens Axboecb1125b2013-01-23 13:47:54 -0700110# parse options
111for opt do
112 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
113 case "$opt" in
Jens Axboe91f94d52013-01-24 10:25:42 -0700114 --cc=*)
115 CC="$optarg"
116 ;;
117 --enable-gfio)
118 gfio="yes"
119 ;;
Jens Axboe827da4f2013-01-24 10:27:26 -0700120 --help)
Jens Axboe47f44632013-01-24 10:34:14 -0700121 show_help="yes"
Jens Axboe827da4f2013-01-24 10:27:26 -0700122 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700123 *)
124 echo "Bad option $opt"
Jens Axboe47f44632013-01-24 10:34:14 -0700125 show_help="yes"
126 exit_val=1
Jens Axboecb1125b2013-01-23 13:47:54 -0700127 esac
128done
129
Jens Axboe47f44632013-01-24 10:34:14 -0700130if test "$show_help" = "yes" ; then
131 echo "--cc= Specify compiler to use"
132 echo "--enable-gfio Enable building of gtk gfio"
133 exit $exit_val
134fi
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 Axboecfd94f72013-01-23 16:23:48 -0700172 echo "CC=$CC" > $config_host_mak
173 echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak
174 echo "CONFIG_64BIT_LLP64=y" >> $config_host_mak
175 echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak
176 echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak
177 echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak
178 echo "CONFIG_FADVISE=y" >> $config_host_mak
Jens Axboecfd94f72013-01-23 16:23:48 -0700179 echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak
180 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
181 echo "CONFIG_FADVISE=y" >> $config_host_mak
182 echo "CONFIG_SFAA=y" >> $config_host_mak
183 exit 0
Jens Axboe67bf9822013-01-10 11:23:19 +0100184esac
185
186if test ! -z "$cpu" ; then
187 # command line argument
188 :
189elif check_define __i386__ ; then
190 cpu="i386"
191elif check_define __x86_64__ ; then
192 cpu="x86_64"
193elif check_define __sparc__ ; then
194 if check_define __arch64__ ; then
195 cpu="sparc64"
196 else
197 cpu="sparc"
198 fi
199elif check_define _ARCH_PPC ; then
200 if check_define _ARCH_PPC64 ; then
201 cpu="ppc64"
202 else
203 cpu="ppc"
204 fi
205elif check_define __mips__ ; then
206 cpu="mips"
207elif check_define __ia64__ ; then
208 cpu="ia64"
209elif check_define __s390__ ; then
210 if check_define __s390x__ ; then
211 cpu="s390x"
212 else
213 cpu="s390"
214 fi
215elif check_define __arm__ ; then
216 cpu="arm"
217elif check_define __hppa__ ; then
218 cpu="hppa"
219else
220 cpu=`uname -m`
221fi
222
223# Normalise host CPU name and set ARCH.
224case "$cpu" in
225 ia64|ppc|ppc64|s390|s390x|sparc64)
226 cpu="$cpu"
227 ;;
228 i386|i486|i586|i686|i86pc|BePC)
229 cpu="i386"
230 ;;
231 x86_64|amd64)
232 cpu="x86_64"
233 ;;
234 armv*b|armv*l|arm)
235 cpu="arm"
236 ;;
237 hppa|parisc|parisc64)
238 cpu="hppa"
239 ;;
240 mips*)
241 cpu="mips"
242 ;;
243 sparc|sun4[cdmuv])
244 cpu="sparc"
245 ;;
246 *)
247 echo "Unknown CPU"
248 exit 1;
249 ;;
250esac
251
252if test -z $CC; then
253 if test "$targetos" = "FreeBSD"; then
254 if has clang; then
255 CC=clang
256 else
257 CC=gcc
258 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100259 fi
260fi
261
262cc="${CC-${cross_prefix}gcc}"
263
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700264##########################################
265# check endianness
266bigendian="no"
267cat > $TMPC <<EOF
268#include <inttypes.h>
269int main(void)
270{
271 volatile uint32_t i=0x01234567;
272 return (*((uint8_t*)(&i))) == 0x67;
273}
274EOF
275if compile_prog "" "" "endian"; then
276 $TMPE && bigendian="yes"
277fi
278
279
Jens Axboe67bf9822013-01-10 11:23:19 +0100280echo "Operating system $targetos"
281echo "CPU $cpu"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700282echo "Big endian $bigendian"
Jens Axboe67bf9822013-01-10 11:23:19 +0100283echo "Compiler $cc"
284echo
285
286##########################################
287# check for wordsize
288wordsize="0"
289cat > $TMPC <<EOF
290#include <stdio.h>
291int main(void)
292{
293 unsigned int wsize = sizeof(long) * 8;
294 printf("%d\n", wsize);
295 return 0;
296}
297EOF
298if compile_prog "" "" "wordsize"; then
299 wordsize=$($TMPE)
300fi
301echo "Wordsize $wordsize"
302
303##########################################
304# linux-aio probe
305libaio="no"
306cat > $TMPC <<EOF
307#include <libaio.h>
308#include <stddef.h>
309int main(void)
310{
311 io_setup(0, NULL);
312 return 0;
313}
314EOF
315if compile_prog "" "-laio" "libaio" ; then
316 libaio=yes
317 LIBS="-laio $LIBS"
318else
319 if test "$libaio" = "yes" ; then
320 feature_not_found "linux AIO"
321 fi
322 libaio=no
323fi
324echo "Linux AIO support $libaio"
325
326##########################################
327# posix aio probe
328posix_aio="no"
329posix_aio_lrt="no"
330cat > $TMPC <<EOF
331#include <aio.h>
332int main(void)
333{
334 struct aiocb cb;
335 aio_read(&cb);
336 return 0;
337}
338EOF
339if compile_prog "" "" "posixaio" ; then
340 posix_aio="yes"
341elif compile_prog "" "-lrt" "posixaio"; then
342 posix_aio="yes"
343 posix_aio_lrt="yes"
344 LIBS="-lrt $LIBS"
345fi
346echo "POSIX AIO support $posix_aio"
347echo "POSIX AIO support needs -lrt $posix_aio_lrt"
348
349##########################################
350# posix aio fsync probe
351posix_aio_fsync="no"
352if test "$posix_aio" = "yes" ; then
353 cat > $TMPC <<EOF
354#include <fcntl.h>
355#include <aio.h>
356int main(void)
357{
358 struct aiocb cb;
359 return aio_fsync(O_SYNC, &cb);
360 return 0;
361}
362EOF
363 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
364 posix_aio_fsync=yes
365 fi
366fi
367echo "POSIX AIO fsync $posix_aio_fsync"
368
369##########################################
370# solaris aio probe
371solaris_aio="no"
372cat > $TMPC <<EOF
373#include <sys/types.h>
374#include <sys/asynch.h>
375#include <unistd.h>
376int main(void)
377{
378 aio_result_t res;
379 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
380 return 0;
381}
382EOF
383if compile_prog "" "-laio" "solarisaio" ; then
384 solaris_aio=yes
385 LIBS="-laio $LIBS"
386fi
387echo "Solaris AIO support $solaris_aio"
388
389##########################################
390# __sync_fetch_and_and test
391sfaa="no"
392cat > $TMPC << EOF
393static int sfaa(int *ptr)
394{
395 return __sync_fetch_and_and(ptr, 0);
396}
397
398int main(int argc, char **argv)
399{
400 int val = 42;
401 sfaa(&val);
402 return val;
403}
404EOF
405if compile_prog "" "" "__sync_fetch_and_add()" ; then
406 sfaa="yes"
407fi
408echo "__sync_fetch_and add $sfaa"
409
410##########################################
411# libverbs probe
412libverbs="no"
413cat > $TMPC << EOF
414#include <stdio.h>
415#include <infiniband/arch.h>
416int main(int argc, char **argv)
417{
418 struct ibv_pd *pd = ibv_alloc_pd(NULL);
419 return 0;
420}
421EOF
422if compile_prog "" "-libverbs" "libverbs" ; then
423 libverbs="yes"
424 LIBS="-libverbs $LIBS"
425fi
426echo "libverbs $libverbs"
427
428##########################################
429# rdmacm probe
430rdmacm="no"
431cat > $TMPC << EOF
432#include <stdio.h>
433#include <rdma/rdma_cma.h>
434int main(int argc, char **argv)
435{
436 rdma_destroy_qp(NULL);
437 return 0;
438}
439EOF
440if compile_prog "" "-lrdmacm" "rdma"; then
441 rdmacm="yes"
442 LIBS="-lrdmacm $LIBS"
443fi
444echo "rdmacm $rdmacm"
445
446##########################################
447# Linux fallocate probe
448linux_fallocate="no"
449cat > $TMPC << EOF
450#include <stdio.h>
451#include <linux/falloc.h>
452int main(int argc, char **argv)
453{
454 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
455 return r;
456}
457EOF
458if compile_prog "" "" "linux_fallocate"; then
459 linux_fallocate="yes"
460fi
461echo "Linux fallocate $linux_fallocate"
462
463##########################################
464# POSIX fadvise probe
465posix_fadvise="no"
466cat > $TMPC << EOF
467#include <stdio.h>
468#include <fcntl.h>
469int main(int argc, char **argv)
470{
471 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
472 return r;
473}
474EOF
475if compile_prog "" "" "posix_fadvise"; then
476 posix_fadvise="yes"
477fi
478echo "POSIX fadvise $posix_fadvise"
479
480##########################################
481# POSIX fallocate probe
482posix_fallocate="no"
483cat > $TMPC << EOF
484#include <stdio.h>
485#include <fcntl.h>
486int main(int argc, char **argv)
487{
488 int r = posix_fallocate(0, 0, 1024);
489 return r;
490}
491EOF
492if compile_prog "" "" "posix_fallocate"; then
493 posix_fallocate="yes"
494fi
495echo "POSIX fallocate $posix_fallocate"
496
497##########################################
498# sched_set/getaffinity 2 or 3 argument test
499linux_2arg_affinity="no"
500linux_3arg_affinity="no"
501cat > $TMPC << EOF
502#define _GNU_SOURCE
503#include <sched.h>
504int main(int argc, char **argv)
505{
506 cpu_set_t mask;
507 return sched_setaffinity(0, sizeof(mask), &mask);
508}
509EOF
510if compile_prog "" "" "sched_setaffinity(,,)"; then
511 linux_3arg_affinity="yes"
512else
513 cat > $TMPC << EOF
514#define _GNU_SOURCE
515#include <sched.h>
516int main(int argc, char **argv)
517{
518 cpu_set_t mask;
519 return sched_setaffinity(0, &mask);
520}
521EOF
522 if compile_prog "" "" "sched_setaffinity(,)"; then
523 linux_2arg_affinity="yes"
524 fi
525fi
526echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
527echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
528
529##########################################
530# clock_gettime probe
531clock_gettime="no"
532cat > $TMPC << EOF
533#include <stdio.h>
534#include <time.h>
535int main(int argc, char **argv)
536{
537 return clock_gettime(0, NULL);
538}
539EOF
540if compile_prog "" "" "clock_gettime"; then
541 clock_gettime="yes"
542elif compile_prog "" "-lrt" "clock_gettime"; then
543 clock_gettime="yes"
544 LIBS="-lrt $LIBS"
545fi
546echo "clock_gettime $clock_gettime"
547
548##########################################
549# CLOCK_MONOTONIC probe
550clock_monotonic="no"
551if test "$clock_gettime" = "yes" ; then
552 cat > $TMPC << EOF
553#include <stdio.h>
554#include <time.h>
555int main(int argc, char **argv)
556{
557 return clock_gettime(CLOCK_MONOTONIC, NULL);
558}
559EOF
560 if compile_prog "" "$LIBS" "clock monotonic"; then
561 clock_monotonic="yes"
562 fi
563fi
564echo "CLOCK_MONOTONIC $clock_monotonic"
565
566##########################################
567# CLOCK_MONOTONIC_PRECISE probe
568clock_monotonic_precise="no"
569if test "$clock_gettime" = "yes" ; then
570 cat > $TMPC << EOF
571#include <stdio.h>
572#include <time.h>
573int main(int argc, char **argv)
574{
575 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
576}
577EOF
578 if compile_prog "" "$LIBS" "clock monotonic precise"; then
579 clock_monotonic_precise="yes"
580 fi
581fi
582echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
583
584##########################################
585# gettimeofday() probe
586gettimeofday="no"
587cat > $TMPC << EOF
588#include <sys/time.h>
589#include <stdio.h>
590int main(int argc, char **argv)
591{
592 struct timeval tv;
593 return gettimeofday(&tv, NULL);
594}
595EOF
596if compile_prog "" "" "gettimeofday"; then
597 gettimeofday="yes"
598fi
599echo "gettimeofday $gettimeofday"
600
601##########################################
602# fdatasync() probe
603fdatasync="no"
604cat > $TMPC << EOF
605#include <stdio.h>
606#include <unistd.h>
607int main(int argc, char **argv)
608{
609 return fdatasync(0);
610}
611EOF
612if compile_prog "" "" "fdatasync"; then
613 fdatasync="yes"
614fi
615echo "fdatasync $fdatasync"
616
617##########################################
618# sync_file_range() probe
619sync_file_range="no"
620cat > $TMPC << EOF
621#include <stdio.h>
622#include <unistd.h>
623#define _GNU_SOURCE
624#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
664#define _GNU_SOURCE
665#include <stdio.h>
666#include <fcntl.h>
667int main(int argc, char **argv)
668{
669 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
670}
671EOF
672if compile_prog "" "" "linux splice"; then
673 linux_splice="yes"
674fi
675echo "Linux splice(2) $linux_splice"
676
677##########################################
678# GUASI probe
679guasi="no"
680cat > $TMPC << EOF
681#include <guasi.h>
682#include <guasi_syscalls.h>
683int main(int argc, char **argv)
684{
685 guasi_t ctx = guasi_create(0, 0, 0);
686 return 0;
687}
688EOF
689if compile_prog "" "" "guasi"; then
690 guasi="yes"
691fi
692echo "GUASI $guasi"
693
694##########################################
695# fusion-aw probe
696fusion_aw="no"
697cat > $TMPC << EOF
Jens Axboe99db6562013-01-14 19:33:40 +0100698#include <nvm/vectored_write.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100699int main(int argc, char **argv)
700{
701 struct vsl_iovec iov;
702 return vsl_vectored_write(0, &iov, 0, O_ATOMIC);
703}
704EOF
Jens Axboe99db6562013-01-14 19:33:40 +0100705if compile_prog "" "-L/usr/lib/fio -lnvm-primitives" "fusion-aw"; then
706 LIBS="-L/usr/lib/fio -lnvm-primitives $LIBS"
Jens Axboe67bf9822013-01-10 11:23:19 +0100707 fusion_aw="yes"
708fi
709echo "Fusion-io atomic engine $fusion_aw"
710
711##########################################
712# libnuma probe
713libnuma="no"
714cat > $TMPC << EOF
715#include <numa.h>
716int main(int argc, char **argv)
717{
718 return numa_available();
719}
720EOF
721if compile_prog "" "-lnuma" "libnuma"; then
722 libnuma="yes"
723 LIBS="-lnuma $LIBS"
724fi
725echo "libnuma $libnuma"
726
727##########################################
728# strsep() probe
729strsep="no"
730cat > $TMPC << EOF
731#include <string.h>
732int main(int argc, char **argv)
733{
734 strsep(NULL, NULL);
735 return 0;
736}
737EOF
738if compile_prog "" "" "strsep"; then
739 strsep="yes"
740fi
741echo "strsep $strsep"
742
743##########################################
744# getopt_long_only() probe
745getopt_long_only="no"
746cat > $TMPC << EOF
747#include <unistd.h>
748#include <stdio.h>
749int main(int argc, char **argv)
750{
751 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
752 return c;
753}
754EOF
755if compile_prog "" "" "getopt_long_only"; then
756 getopt_long_only="yes"
757fi
758echo "getopt_long_only() $getopt_long_only"
759
760##########################################
761# inet_aton() probe
762inet_aton="no"
763cat > $TMPC << EOF
764#include <sys/socket.h>
765#include <arpa/inet.h>
766#include <stdio.h>
767int main(int argc, char **argv)
768{
769 struct in_addr in;
770 return inet_aton(NULL, &in);
771}
772EOF
773if compile_prog "" "" "inet_aton"; then
774 inet_aton="yes"
775fi
776echo "inet_aton $inet_aton"
777
778##########################################
779# socklen_t probe
780socklen_t="no"
781cat > $TMPC << EOF
782#include <string.h>
783#include <netinet/in.h>
784int main(int argc, char **argv)
785{
786 socklen_t len = 0;
787 return len;
788}
789EOF
790if compile_prog "" "" "socklen_t"; then
791 socklen_t="yes"
792fi
793echo "socklen_t $socklen_t"
794
795##########################################
796# Whether or not __thread is supported for TLS
797tls_thread="no"
798cat > $TMPC << EOF
799#include <stdio.h>
800static int __thread ret;
801int main(int argc, char **argv)
802{
803 return ret;
804}
805EOF
806if compile_prog "" "" "__thread"; then
807 tls_thread="yes"
808fi
809echo "__thread $tls_thread"
810
Jens Axboe91f94d52013-01-24 10:25:42 -0700811##########################################
812# Whether or not __thread is supported for TLS
813if test "$gfio" = "yes" ; then
814 cat > $TMPC << EOF
815#include <glib.h>
816#include <cairo.h>
817#include <gtk/gtk.h>
818int main(void)
819{
820 gdk_threads_enter();
821 gtk_main();
822 gdk_threads_leave();
823 return 0;
824}
825EOF
826GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
827if test "$?" != "0" ; then
828 echo "configure: gtk and gthread not found"
829 exit 1
830fi
831GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
832if test "$?" != "0" ; then
833 echo "configure: gtk and gthread not found"
834 exit 1
835fi
836if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio"; then
837 gfio="yes"
838 LIBS="$LIBS $GTK_LIBS"
839 CFLAGS="$CFLAGS $GTK_CFLAGS"
840else
841 echo "Please install gtk and gdk libraries"
842 gfio="no"
843fi
844fi
845
846echo "gfio $gfio"
847
Jens Axboe67bf9822013-01-10 11:23:19 +0100848#############################################################################
849
850echo "# Automatically generated by configure - do not modify" > $config_host_mak
851printf "# Configured with:" >> $config_host_mak
852printf " '%s'" "$0" "$@" >> $config_host_mak
853echo >> $config_host_mak
854
855if test "$wordsize" = "64" ; then
856 echo "CONFIG_64BIT=y" >> $config_host_mak
857elif test "$wordsize" = "32" ; then
858 echo "CONFIG_32BIT=y" >> $config_host_mak
859else
860 echo "Unknown wordsize!"
861 exit 1
862fi
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700863if test "$bigendian" = "yes" ; then
864 echo "CONFIG_BIG_ENDIAN=y" >> $config_host_mak
865else
866 echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak
867fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100868if test "$libaio" = "yes" ; then
869 echo "CONFIG_LIBAIO=y" >> $config_host_mak
870fi
871if test "$posix_aio" = "yes" ; then
872 echo "CONFIG_POSIXAIO=y" >> $config_host_mak
873fi
874if test "$posix_aio_fsync" = "yes" ; then
875 echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak
876fi
877if test "$linux_fallocate" = "yes" ; then
878 echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak
879fi
880if test "$posix_fallocate" = "yes" ; then
881 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
882fi
883if test "$fdatasync" = "yes" ; then
884 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
885fi
886if test "$sync_file_range" = "yes" ; then
887 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
888fi
889if test "$sfaa" = "yes" ; then
890 echo "CONFIG_SFAA=y" >> $config_host_mak
891fi
892if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then
893 echo "CONFIG_RDMA=y" >> $config_host_mak
894fi
895if test "$clock_gettime" = "yes" ; then
896 echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak
897fi
898if test "$clock_monotonic" = "yes" ; then
899 echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak
900fi
901if test "$clock_monotonic_precise" = "yes" ; then
902 echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak
903fi
904if test "$gettimeofday" = "yes" ; then
905 echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak
906fi
907if test "$posix_fadvise" = "yes" ; then
908 echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak
909fi
910if test "$linux_3arg_affinity" = "yes" ; then
911 echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak
912elif test "$linux_2arg_affinity" = "yes" ; then
913 echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak
914fi
915if test "$strsep" = "yes" ; then
916 echo "CONFIG_STRSEP=y" >> $config_host_mak
917fi
918if test "$getopt_long_only" = "yes" ; then
919 echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak
920fi
921if test "$inet_aton" = "yes" ; then
922 echo "CONFIG_INET_ATON=y" >> $config_host_mak
923fi
924if test "$socklen_t" = "yes" ; then
925 echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak
926fi
927if test "$ext4_me" = "yes" ; then
928 echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak
929fi
930if test "$linux_splice" = "yes" ; then
931 echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak
932fi
933if test "$guasi" = "yes" ; then
934 echo "CONFIG_GUASI=y" >> $config_host_mak
935fi
936if test "$fusion_aw" = "yes" ; then
937 echo "CONFIG_FUSION_AW=y" >> $config_host_mak
938fi
939if test "$libnuma" = "yes" ; then
940 echo "CONFIG_LIBNUMA=y" >> $config_host_mak
941fi
942if test "$solaris_aio" = "yes" ; then
943 echo "CONFIG_SOLARISAIO=y" >> $config_host_mak
944fi
945if test "$tls_thread" = "yes" ; then
946 echo "CONFIG_TLS_THREAD=y" >> $config_host_mak
947fi
Jens Axboe91f94d52013-01-24 10:25:42 -0700948if test "$gfio" = "yes" ; then
949 echo "CONFIG_GFIO=y" >> $config_host_mak
950fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100951
952echo "LIBS+=$LIBS" >> $config_host_mak
Jens Axboe91f94d52013-01-24 10:25:42 -0700953echo "CFLAGS+=$CFLAGS" >> $config_host_mak
Jens Axboe67bf9822013-01-10 11:23:19 +0100954echo "CC=$cc" >> $config_host_mak