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