two minor bugfixes.
[vde.git] / vde-2 / configure.ac
blob5efd187bc028451016e48abcb1e1e6cfce164ad3
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT(vde2, [2.1.3], renzo@cs.unibo.it)
6 AM_INIT_AUTOMAKE([foreign])
7 AC_CONFIG_SRCDIR([vde.h])
8 AC_CONFIG_HEADER([config.h])
10 # Checks for programs.
11 AC_PROG_CXX
12 AC_PROG_CC
13 AC_PROG_INSTALL
14 AC_PROG_LN_S
15 AC_PROG_LIBTOOL
17 # Checks for libraries.
18 AC_CHECK_LIB([dl], [dlopen])
19 AC_CHECK_LIB([crypto], [EVP_EncryptInit],
20                 [add_cryptcab_support=yes],
21                 [add_cryptcab_support=no ; warn_cryptcab=yes])
23 # Checks for header files.
24 AC_HEADER_STDC
25 AC_HEADER_SYS_WAIT
26 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termio.h termios.h unistd.h sys/filio.h sys/bitypes.h sys/wait.h sys/select.h sys/signal.h sys/stropts.h termios.h sys/type32.h])
28 # Checks for typedefs, structures, and compiler characteristics.
29 AC_C_CONST
30 AC_C_INLINE
31 AC_C_BIGENDIAN
32 AC_C_PROTOTYPES
33 AC_TYPE_MODE_T
34 AC_TYPE_PID_T
35 AC_TYPE_SIZE_T
36 AC_HEADER_TIME
38 # Checks for library functions.
39 AC_FUNC_CHOWN
40 AC_FUNC_FORK
41 AC_PROG_GCC_TRADITIONAL
42 AC_FUNC_MALLOC
43 AC_FUNC_MEMCMP
44 AC_FUNC_REALLOC
45 AC_FUNC_SELECT_ARGTYPES
46 AC_TYPE_SIGNAL
47 AC_FUNC_VPRINTF
48 AC_CHECK_FUNCS([atexit dup2 gethostbyname gethostname gettimeofday inet_ntoa memmove memset putenv select setenv socket strchr strdup strndup strerror strstr uname inet_aton sprintf readv random srandom index bcmp drand48 memmove gethostid revoke fchmod getopt_long_only])
50 # All other nice checks I have to make for recostructing missing parts of
51 # slirp's config.h file
52 AC_CHECK_SIZEOF(char)
53 AC_CHECK_SIZEOF(short)
54 AC_CHECK_SIZEOF(int)
55 AC_CHECK_SIZEOF(char *)
57 # Define VDE_LINUX or VDE_DARWIN
58 case "$build_os" in
59         linux*)
60                 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
61                 ;;
62         darwin*)
63                 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
64                 ;;
65         *)
66                 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
67 Linux and Darwin are supported. Contributions are appreciated! :-)])
68                 ;;
69 esac
72 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
73 AC_ARG_ENABLE([cryptcab],
74         AS_HELP_STRING([--disable-cryptcab],
75                 [Disable libcrypto-dependend vde_cryptcab compilation]),
76         [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
78 # Check of tuntap device
79 AC_ARG_ENABLE([tuntap],
80     AS_HELP_STRING([--disable-tuntap],
81       [Disable tuntap compilation]),
82     [if test $enableval != "no" ; then add_tuntap_support=yes ; else add_tuntap_support=no ; fi],
83     [add_tuntap_support=yes])
85 # Check for tuntap support for Linux and OSX
86 if test "$add_tuntap_support" = yes ; then
87         case "$build_os" in
88                 linux*)
89                         AC_CHECK_HEADER([linux/if_tun.h],
90                                 [AC_DEFINE([TUNTAP], 1, [If defined, tuntap support is compiled in])],
91                                 [AC_MSG_ERROR([Tuntap support seem to be not enabled on your kernel])])
92                         can_make_libvdetap=yes
93                         ;;
94                 darwin*)
95                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
96                         for i in /dev/tap0 /Library/Extensions/tap.kext /System/Library/Extensions/tap.kext ; do
97                                 AC_MSG_CHECKING([for $i])
98                                 if test -e "$i" ; then
99                                         AC_MSG_RESULT([yes])
100                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
101                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
102                                         eval HAVE_$definename=yes
103                                 else
104                                         AC_MSG_RESULT([no])
105                                 fi
106                         done
107                         
108                         if test "$HAVE__DEV_TAP0_" ; then
109                                 AC_DEFINE([TUNTAP], 1, [If defined, tuntap support is compiled in])
110                                 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
111                                         AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
112 configuration does work...])
113                                 fi
114                                 AC_MSG_CHECKING([for broken poll() support in Tiger])
115                                 if expr "$build_os" : "darwin8\..*" > /dev/null; then
116                                         AC_MSG_RESULT([yes, emulating with select()])
117                                         AC_DEFINE([HAVE_BROKEN_POLL], 1, [If defined, use poll2select])
118                                         have_broken_poll=yes
119                                 else
120                                         AC_MSG_RESULT([no])
121                                 fi
122                         else
123                                 AC_MSG_ERROR([You do not have tuntap support. You can get it here:
124 http://www-user.rhrk.uni-kl.de/~nissler/tuntap/])
125                         fi
126                         ;;
127         esac
130 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
131 AM_CONDITIONAL(WANT_TUNTAP, test "$add_tuntap_support" = yes)
132 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
133 AM_CONDITIONAL(HAVE_BROKEN_POLL, test "$have_broken_poll" = yes)
135 AC_CONFIG_FILES([Makefile]
136                 [doc/Makefile]
137                 [qemu/Makefile]
138                 [slirpvde/Makefile]
139                 [vdetaplib/Makefile]
140                 [libvdeplug/Makefile]
141                 [vde_plug/Makefile]
142                 [vde_cryptcab/Makefile]
143                 [bochs/Makefile]
144                 [dpipe/Makefile]
145                 [unixterm/Makefile]
146                 [wirefilter/Makefile]
147                 [uml/Makefile])
148 AC_OUTPUT
150 if test x$warn_cryptcab = "xyes"
151 then
152         AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is not installed on
153 your system. Please install it if you want CryptCab to be compiled and
154 installed.])