2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([vde2], [2.2.2], [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.
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],
26 [add_pcap=no ; warn_pcap=yes])
28 # Checks for header files.
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],
37 [add_cryptcab_support=no ; warn_cryptcab=yes])
39 # Checks for typedefs, structures, and compiler characteristics.
49 # Checks for library functions.
52 AC_PROG_GCC_TRADITIONAL
56 AC_FUNC_SELECT_ARGTYPES
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])
63 AC_MSG_CHECKING([for poll sanity])
64 if expr "$build_os" : "darwin*" > /dev/null; then
65 AC_MSG_RESULT([present but broken, emulating with select])
67 AC_DEFINE([poll], [vde_poll], [Define to vde_poll if the replacement function should be used.])
69 AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
75 # All other nice checks I have to make for recostructing missing parts of
76 # slirp's config.h file
78 AC_CHECK_SIZEOF(short)
80 AC_CHECK_SIZEOF(char *)
82 # Define VDE_LINUX or VDE_DARWIN
85 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
88 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
92 AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
95 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
96 Linux, Darwin and FreeBSD are supported. Contributions are appreciated! :-)])
100 # Enable profiling options
101 AC_ARG_ENABLE([profile],
102 AS_HELP_STRING([--enable-profile],
103 [Compile with debugging/profiling options]),
104 [if test $enableval = "yes"; then enable_profile=yes; fi])
106 # Enable experimental features
107 AC_ARG_ENABLE([experimental],
108 AS_HELP_STRING([--enable-experimental],
109 [Enable experimental features (async notifies, plugin support, packet counter)]),
110 [if test $enableval = "yes"; then enable_experimental=yes; fi])
112 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
113 AC_ARG_ENABLE([cryptcab],
114 AS_HELP_STRING([--disable-cryptcab],
115 [Disable libcrypto-dependend vde_cryptcab compilation]),
116 [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
118 # Check of tuntap device
119 AC_ARG_ENABLE([tuntap],
120 AS_HELP_STRING([--disable-tuntap],
121 [Disable tuntap compilation]), [:],
124 AC_CHECK_HEADER([linux/if_tun.h],
125 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
127 can_make_libvdetap=yes
128 can_make_vdetunctl=yes
131 # I don't use AC_CHECK_FILES because I need test -e and not test -r
132 for i in /dev/tap0 /Library/Extensions/tap.kext ; do
133 AC_MSG_CHECKING([for $i])
134 if test -e "$i" ; then
136 definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
137 AC_DEFINE_UNQUOTED([HAVE_$definename])
138 eval HAVE_$definename=yes
145 if test "$HAVE__DEV_TAP0_" ; then
146 AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
147 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
148 AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
149 configuration does work...])
153 AC_MSG_WARN([You do not have tuntap support. You can get it here:
154 http://tuntaposx.sourceforge.net/])
158 AC_CHECK_HEADER([net/if_tun.h],
159 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
164 AC_ARG_ENABLE([kernel-switch],
165 AS_HELP_STRING([--enable-kernel-switch],
166 [Compile support for in-kernel switch. ]),
167 [if test $enableval = "yes"; then
168 enable_kernel_switch=yes
169 AC_DEFINE([USE_IPN], 1, [If defined, enable support for IPN socket])
172 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
173 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
174 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
175 AM_CONDITIONAL(CAN_MAKE_VDETUNCTL, test "$can_make_vdetunctl" = yes)
176 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
177 AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes)
178 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
179 AM_CONDITIONAL(ENABLE_KERNEL_SWITCH, test "$enable_kernel_switch" = yes)
181 if test "x${prefix}" = "xNONE"; then
182 AC_DEFINE_UNQUOTED(INSTALLPATH, "${ac_default_prefix}",[PREFIX])
184 AC_DEFINE_UNQUOTED(INSTALLPATH, "${prefix}",[PREFIX])
187 CFLAGS="-Wall -O2 $CFLAGS"
197 [src/vde_switch/Makefile]
198 [src/kvde_switch/Makefile]
199 [src/vde_over_ns/Makefile]
200 [src/common/Makefile]
201 [src/vdetaplib/Makefile]
202 [src/vde_l3/Makefile]
203 [src/vde_cryptcab/Makefile]
204 [src/slirpvde/Makefile]
205 [src/vde_switch/plugins/Makefile]
212 echo "Configure results:"
214 if test x$add_cryptcab_support = "xyes" ; then
215 echo " + VDE CryptCab............ enabled"
217 echo " - VDE CryptCab............ disabled"
220 if test x$warn_tuntap = "xyes" ; then
221 echo " - TAP support............. disabled"
223 echo " + TAP support............. enabled"
226 if test x$warn_pcap = "xyes" ; then
227 echo " - pcap support............ disabled"
229 echo " + pcap support............ enabled"
232 if test x$enable_experimental = "xyes" ; then
233 echo " + Experimental features... enabled"
235 echo " - Experimental features... disabled"
238 if test x$enable_profile = "xyes" ; then
239 echo " + Profiling options....... enabled"
241 echo " - Profiling options....... disabled"
244 if test x$enable_kernel_switch = "xyes" ; then
245 echo " + Kernel switch........... enabled"
247 echo " - Kernel switch........... disabled"
252 if ! test x$add_cryptcab_support = "xyes" ; then
253 if test x$warn_cryptcab = "xyes" ; then
254 AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
255 not installed on your system, or because openssl/blowfish.h could not be
256 found. Please install them if you want CryptCab to be compiled and installed.])
260 if test x$warn_pcap = "xyes" ; then
261 AC_MSG_WARN([VDE vde_pcapplug and packet dump plugin have been disabled because
262 libpcap is not installed on your system, or because it's too old.
263 Please install it if you want vde_pcapplug and pdump to be compiled and installed.])
267 echo "Type 'make' to compile $PACKAGE $VERSION"
268 echo "and then type 'make install' to install it into $prefix"