Poor's man hub implemented. (patch by Luca Saiu)
[vde.git] / vde-2 / configure.ac
blobab3fdd84606592448e50ea828964a3e4eaaaf77b
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([vde2], [2.2.1], [info@v2.cs.unibo.it])
6 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
7 AC_CONFIG_SRCDIR([include/vde.h])
8 AC_CONFIG_HEADER([include/config.h])
9 AC_CONFIG_LIBOBJ_DIR(src/common)
11 # Checks for programs.
12 AC_PROG_CXX
13 AC_PROG_CC
14 AC_PROG_INSTALL
15 AC_PROG_LN_S
16 AC_PROG_LIBTOOL
17 AM_PROG_CC_C_O
19 # Checks for libraries.
20 AC_CHECK_LIB([dl], [dlopen])
21 AC_CHECK_LIB([crypto], [EVP_EncryptInit],
22                 [add_cryptcab_support=yes],
23                 [add_cryptcab_support=no ; warn_cryptcab=yes])
24 AC_CHECK_LIB([pcap], [pcap_open_dead],
25                 [add_pcap=yes],
26                 [add_pcap=no ; warn_pcap=yes])
28 # Checks for header files.
29 AC_HEADER_STDC
30 AC_HEADER_SYS_WAIT
31 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])
33 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
35 AC_CHECK_HEADERS([openssl/blowfish.h],
36                  [],
37                  [add_cryptcab_support=no ; warn_cryptcab=yes])
39 # Checks for typedefs, structures, and compiler characteristics.
40 AC_C_CONST
41 AC_C_INLINE
42 AC_C_BIGENDIAN
43 AC_C_PROTOTYPES
44 AC_TYPE_MODE_T
45 AC_TYPE_PID_T
46 AC_TYPE_SIZE_T
47 AC_HEADER_TIME
49 # Checks for library functions.
50 AC_FUNC_CHOWN
51 AC_FUNC_FORK
52 AC_PROG_GCC_TRADITIONAL
53 AC_FUNC_MALLOC
54 AC_FUNC_MEMCMP
55 AC_FUNC_REALLOC
56 AC_FUNC_SELECT_ARGTYPES
57 AC_TYPE_SIGNAL
58 AC_FUNC_VPRINTF
59 AC_CHECK_FUNCS([atexit dup2 gethostbyname gethostname gettimeofday inet_ntoa memmove memset putenv select setenv socket strchr strdup strerror strstr uname inet_aton sprintf readv random srandom index bcmp drand48 memmove gethostid revoke fchmod getopt_long_only funopen])
60 AC_REPLACE_FUNCS([open_memstream strndup])
61 AC_CHECK_FUNC([poll],
62         [
63                 AC_MSG_CHECKING([for poll sanity])
64                 if expr "$build_os" : "darwin8\..*" > /dev/null; then
65                         AC_MSG_RESULT([present but broken, emulating with select])
66                         AC_LIBOBJ([poll])
67                         AC_DEFINE([poll], [vde_poll], [Define to vde_poll if the replacement function should be used.])
68                 else
69                         AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
70                         AC_MSG_RESULT([yes])
71                 fi
72         ],
73         [])
75 # All other nice checks I have to make for recostructing missing parts of
76 # slirp's config.h file
77 AC_CHECK_SIZEOF(char)
78 AC_CHECK_SIZEOF(short)
79 AC_CHECK_SIZEOF(int)
80 AC_CHECK_SIZEOF(char *)
82 # Define VDE_LINUX or VDE_DARWIN
83 case "$build_os" in
84         linux*)
85                 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
86                 ;;
87         darwin*)
88                 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
89                 darwin_gcc=yes
90                 ;;
91         freebsd*)
92                 AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
93                 ;;
94         *)
95                 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
96 Linux, Darwin and FreeBSD are supported. Contributions are appreciated! :-)])
97                 ;;
98 esac
100 # Enable experimental features
101 AC_ARG_ENABLE([experimental],
102         AS_HELP_STRING([--enable-experimental],
103                 [Enable experimental features (async notifies, plugin support, packet counter)]),
104         [if test $enableval = "yes"; then enable_experimental=yes; fi])
106 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
107 AC_ARG_ENABLE([cryptcab],
108         AS_HELP_STRING([--disable-cryptcab],
109                 [Disable libcrypto-dependend vde_cryptcab compilation]),
110         [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
112 # Check of tuntap device
113 AC_ARG_ENABLE([tuntap],
114     AS_HELP_STRING([--disable-tuntap],
115       [Disable tuntap compilation]), [:],
116         [case "$build_os" in
117                 linux*)
118                         AC_CHECK_HEADER([linux/if_tun.h],
119                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
120                                 [warn_tuntap=yes])
121                         can_make_libvdetap=yes
122                         ;;
123                 darwin*)
124                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
125                         for i in /dev/tap0 /Library/Extensions/tap.kext /System/Library/Extensions/tap.kext ; do
126                                 AC_MSG_CHECKING([for $i])
127                                 if test -e "$i" ; then
128                                         AC_MSG_RESULT([yes])
129                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
130                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
131                                         eval HAVE_$definename=yes
132                                 else
133                                         AC_MSG_RESULT([no])
134                                         warn_tuntap=yes
135                                 fi
136                         done
137                         
138                         if test "$HAVE__DEV_TAP0_" ; then
139                                 AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
140                                 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
141                                         AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
142 configuration does work...])
143                                 fi
144                         else
145                                 warn_tuntap=yes
146                                 AC_MSG_WARN([You do not have tuntap support. You can get it here:
147 http://www-user.rhrk.uni-kl.de/~nissler/tuntap/])
148                         fi
149                         ;;
150                 freebsd*)
151                         AC_CHECK_HEADER([net/if_tun.h],
152                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
153                                 [warn_tuntap=yes])
154                         ;;
155         esac])
157 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
158 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
159 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
160 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
161 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
163 if test "x${prefix}" = "xNONE"; then
164         AC_DEFINE_UNQUOTED(INSTALLPATH, "${ac_default_prefix}",[PREFIX])
165 else
166         AC_DEFINE_UNQUOTED(INSTALLPATH, "${prefix}",[PREFIX])
169 CFLAGS="-Wall -O2 $CFLAGS"
170 AC_SUBST(CFLAGS)
172 AC_CONFIG_FILES(
173                 [Makefile]
174                 [doc/Makefile]
175                 [include/Makefile]
176                 [man/Makefile]
177                 [src/Makefile]
178                 [src/lib/Makefile]
179                 [src/vde_switch/Makefile]
180                 [src/kvde_switch/Makefile]
181                 [src/vde_over_ns/Makefile]
182                 [src/common/Makefile]
183                 [src/vdetaplib/Makefile]
184                 [src/vde_l3/Makefile]
185                 [src/vde_cryptcab/Makefile]
186                 [src/slirpvde/Makefile]
187                 [src/vde_switch/plugins/Makefile]
188                 )
190 #               [src/kvde_switch/Makefile]
192 AC_OUTPUT
195 echo
196 echo
197 echo "Configure results:"
198 echo
199 if test x$add_cryptcab_support = "xyes" ; then
200         echo " + VDE CryptCab............ enabled"
201 else
202         echo " - VDE CryptCab............ disabled"
205 if test x$warn_tuntap = "xyes" ; then
206         echo " - TAP support............. disabled"
207 else
208         echo " + TAP support............. enabled"
211 if test x$warn_pcap = "xyes" ; then
212         echo " - pcap support............ disabled"
213 else
214         echo " + pcap support............ enabled"
217 if test x$enable_experimental = "xyes" ; then
218         echo " + Experimental features... enabled"
219 else
220         echo " - Experimental features... disabled"
223 echo
224 echo
225 if ! test x$add_cryptcab_support = "xyes" ; then
226         if test x$warn_cryptcab = "xyes" ; then
227                 AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
228 not installed on your system, or because openssl/blowfish.h could not be
229 found. Please install them if you want CryptCab to be compiled and installed.])
230         fi
233 if test x$warn_pcap = "xyes" ; then
234         AC_MSG_WARN([VDE packet dump plugin has been disabled because libpcap is
235 not installed on your system, or because it's too old.
236 Please install it if you want pdump to be compiled and installed.])
239 echo
240 echo "Type 'make' to compile $PACKAGE $VERSION"
241 echo "and then type 'make install' to install it into $prefix"
242 echo