vdetelweb: now it uses lwip_poll instead of lwip_select
[vde.git] / vde-2 / configure.ac
blob2bcddad4829af959ebca3eae679a5dd0344b0b61
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([vde2],[2.3.1],[info@v2.cs.unibo.it])
6 AC_CONFIG_MACRO_DIR([m4])
7 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
8 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
9 AC_CONFIG_SRCDIR([include/vde.h])
10 AC_CONFIG_HEADER([include/config.h])
11 AC_CONFIG_LIBOBJ_DIR(src/common)
13 # Checks for programs.
14 AC_PROG_CXX
15 AC_PROG_CC
16 AC_PROG_INSTALL
17 AC_PROG_LN_S
18 AC_PROG_LIBTOOL
19 AM_PROG_CC_C_O
21 AC_DEFINE_UNQUOTED(MODULES_EXT, "$shrext_cmds", [Extension of shared objects])
23 # Checks for libraries.
24 AC_CHECK_LIB([dl], [dlopen])
25 AC_CHECK_LIB([crypto], [EVP_EncryptInit],
26   [add_cryptcab_support=yes],
27   [add_cryptcab_support=no ; warn_cryptcab=yes])
28 AC_CHECK_LIB([pcap], [pcap_open_dead],
29   [add_pcap=yes],
30   [add_pcap=no ; warn_pcap=yes])
32 # Checks for header files.
33 AC_HEADER_STDC
34 AC_HEADER_SYS_WAIT
35 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stddef.h stdint.h \
36   stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h \
37   sys/time.h syslog.h termio.h termios.h unistd.h sys/filio.h sys/bitypes.h \
38   sys/wait.h sys/select.h sys/signal.h sys/stropts.h termios.h sys/type32.h])
40 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
42 AC_CHECK_HEADERS([openssl/blowfish.h], [],
43   [add_cryptcab_support=no ; warn_cryptcab=yes])
45 # Checks for typedefs, structures, and compiler characteristics.
46 AC_C_CONST
47 AC_C_INLINE
48 AC_C_BIGENDIAN
49 AC_C_PROTOTYPES
50 AC_TYPE_MODE_T
51 AC_TYPE_PID_T
52 AC_TYPE_SIZE_T
53 AC_HEADER_TIME
55 # Checks for library functions.
56 AC_FUNC_CHOWN
57 AC_FUNC_FORK
58 AC_PROG_GCC_TRADITIONAL
59 AC_FUNC_MALLOC
60 AC_FUNC_MEMCMP
61 AC_FUNC_REALLOC
62 AC_FUNC_SELECT_ARGTYPES
63 AC_FUNC_VPRINTF
64 AC_CHECK_FUNCS([atexit dup2 gethostbyname gethostname gettimeofday inet_ntoa \
65   memmove memset putenv select setenv socket strchr strdup strerror strstr \
66   uname inet_aton sprintf readv random srandom index bcmp drand48 memmove \
67   gethostid revoke fchmod getopt_long_only funopen])
68 AC_REPLACE_FUNCS([open_memstream strndup])
69 AC_CHECK_FUNC([poll],
70   [
71     AC_MSG_CHECKING([for poll sanity])
72     if expr "$build_os" : "darwin*" > /dev/null; then
73       AC_MSG_RESULT([present but broken, emulating with select])
74       AC_LIBOBJ([poll])
75       AC_DEFINE([poll], [vde_poll],
76                 [Define to vde_poll if the replacement function should be used.])
77     else
78       AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
79       AC_MSG_RESULT([yes])
80     fi
81   ],
82   [])
84 # All other nice checks I have to make for recostructing missing parts of
85 # slirp's config.h file
86 AC_CHECK_SIZEOF(char)
87 AC_CHECK_SIZEOF(short)
88 AC_CHECK_SIZEOF(int)
89 AC_CHECK_SIZEOF(char *)
91 # Define VDE_LINUX or VDE_DARWIN
92 case "$build_os" in
93   linux*)
94     AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
95   ;;
96   darwin*)
97     AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
98     darwin_gcc=yes
99   ;;
100   freebsd*)
101     AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
102   ;;
103   *)
104     AC_MSG_ERROR([Unsupported OS: $build_os. At the moment, only Linux, Darwin
105 and FreeBSD are supported. Contributions are appreciated! :-)])
106   ;;
107 esac
109 # Enable profiling options
110 AC_ARG_ENABLE([profile],
111   AS_HELP_STRING([--enable-profile],
112     [Compile with debugging/profiling options]),
113   [if test $enableval = "yes"; then enable_profile=yes; fi])
115 # Enable experimental features
116 AC_ARG_ENABLE([experimental],
117   AS_HELP_STRING([--enable-experimental],
118     [Enable experimental features (async notifies, plugin support, packet counter)]),
119   [if test $enableval = "yes"; then enable_experimental=yes; fi])
121 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
122 AC_ARG_ENABLE([cryptcab],
123   AS_HELP_STRING([--disable-cryptcab],
124     [Disable libcrypto-dependend vde_cryptcab compilation]),
125   [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
127 # Check of tuntap device
128 AC_ARG_ENABLE([tuntap],
129   AS_HELP_STRING([--disable-tuntap], [Disable tuntap compilation]), [:],
130   [case "$build_os" in
131     linux*)
132       AC_CHECK_HEADER([linux/if_tun.h],
133         [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
134         [warn_tuntap=yes])
135       can_make_libvdetap=yes
136       can_make_vdetunctl=yes
137       ;;
138     darwin*)
139       # I don't use AC_CHECK_FILES because I need test -e and not test -r
140       for i in /dev/tap0 /Library/Extensions/tap.kext ; do
141         AC_MSG_CHECKING([for $i])
142         if test -e "$i" ; then
143           AC_MSG_RESULT([yes])
144           definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
145           AC_DEFINE_UNQUOTED([HAVE_$definename])
146           eval HAVE_$definename=yes
147         else
148           AC_MSG_RESULT([no])
149           warn_tuntap=yes
150         fi
151       done
153       if test "$HAVE__DEV_TAP0_" ; then
154         AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
155         if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" || "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
156           AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
157 configuration does work...])
158         fi
159       else
160         warn_tuntap=yes
161         AC_MSG_WARN([You do not have tuntap support. You can get it here:
162 http://tuntaposx.sourceforge.net/])
163       fi
164       ;;
165     freebsd*)
166       AC_CHECK_HEADER([net/if_tun.h],
167         [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
168         [warn_tuntap=yes])
169       ;;
170   esac])
172 # Disable pcap support (pdump)? (depends on libpcap, maybe unwanted)
173 AC_ARG_ENABLE([pcap],
174   AS_HELP_STRING([--disable-pcap],
175     [Disable pcap support (pdump plugin)]),
176   [if test $enableval = "no" ; then add_pcap=no ; warn_pcap=no ; fi])
178 AC_ARG_ENABLE([kernel-switch],
179   AS_HELP_STRING([--enable-kernel-switch],
180     [Compile support for in-kernel switch. ]),
181   [if test $enableval = "yes"; then
182     enable_kernel_switch=yes
183     AC_DEFINE([USE_IPN], 1, [If defined, enable support for IPN socket])
184   fi])
186 # python bindings
187 AC_ARG_ENABLE([python],
188   AS_HELP_STRING([--disable-python], [Disable python bindings]),
189   [enable_python=$enableval],
190   [enable_python=yes]
193 if test x"$enable_python" = x"yes"; then
194   # check python
195   AM_PATH_PYTHON([2.5])
196   AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
197   if test x"$PYTHON_CONFIG" = x""; then
198     AC_PATH_PROG(PYTHON_CONFIG, python-config)
199   fi
200   if test x"$PYTHON_CONFIG" = x""; then
201     # not found, give up
202     enable_python=no
203   else
204     PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
205     PYTHON_LIBS=`$PYTHON_CONFIG --libs`
206     PYTHON_INCLUDES="$PYTHON_CFLAGS"
207   fi
208   AC_SUBST(PYTHON_CFLAGS)
209   AC_SUBST(PYTHON_INCLUDES)
210   AC_SUBST(PYTHON_LIBS)
214 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
215 AM_CONDITIONAL(ENABLE_PYTHON, test "$enable_python" = yes)
216 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
217 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
218 AM_CONDITIONAL(CAN_MAKE_VDETUNCTL, test "$can_make_vdetunctl" = yes)
219 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
220 AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes)
221 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
222 AM_CONDITIONAL(ENABLE_KERNEL_SWITCH, test "$enable_kernel_switch" = yes)
225 CFLAGS="-Wall -O2 $CFLAGS"
226 AC_SUBST(CFLAGS)
228 AC_CONFIG_FILES(
229   [Makefile]
230   [doc/Makefile]
231   [include/Makefile]
232   [man/Makefile]
233   [src/Makefile]
234   [src/lib/Makefile]
235   [src/lib/vdesnmp.pc]
236   [src/lib/vdemgmt.pc]
237   [src/lib/vdeplug.pc]
238   [src/lib/vdehist.pc]
239   [src/lib/python/Makefile]
240   [src/vde_switch/Makefile]
241   [src/kvde_switch/Makefile]
242   [src/vde_over_ns/Makefile]
243   [src/common/Makefile]
244   [src/vdetaplib/Makefile]
245   [src/vde_l3/Makefile]
246   [src/vde_cryptcab/Makefile]
247   [src/slirpvde/Makefile]
248   [src/vde_switch/plugins/Makefile]
250 AC_OUTPUT
253 AS_ECHO
254 AS_ECHO
255 AS_ECHO "Configure results:"
256 AS_ECHO
257 if test x$add_cryptcab_support = "xyes" ; then
258   AS_ECHO " + VDE CryptCab............ enabled"
259 else
260   AS_ECHO " - VDE CryptCab............ disabled"
263 if test x$enable_python = "xyes" ; then
264   AS_ECHO " + Python Libraries........ enabled"
265 else
266   AS_ECHO " - Python Libraries........ disabled"
269 if test x$warn_tuntap = "xyes" ; then
270   AS_ECHO " - TAP support............. disabled"
271 else
272   AS_ECHO " + TAP support............. enabled"
275 if test x$add_pcap = "xyes" ; then
276   AS_ECHO " + pcap support............ enabled"
277 else
278   AS_ECHO " - pcap support............ disabled"
281 if test x$enable_experimental = "xyes" ; then
282   AS_ECHO " + Experimental features... enabled"
283 else
284   AS_ECHO " - Experimental features... disabled"
287 if test x$enable_profile = "xyes" ; then
288   AS_ECHO " + Profiling options....... enabled"
289 else
290   AS_ECHO " - Profiling options....... disabled"
293 if test x$enable_kernel_switch = "xyes" ; then
294   AS_ECHO " + Kernel switch........... enabled"
295 else
296   AS_ECHO " - Kernel switch........... disabled"
299 AS_ECHO
300 AS_ECHO
301 if ! test x$add_cryptcab_support = "xyes" ; then
302   if test x$warn_cryptcab = "xyes" ; then
303     AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
304 not installed on your system, or because openssl/blowfish.h could not be found.
305 Please install them if you want CryptCab to be compiled and installed.])
306     AS_ECHO
307   fi
310 if ! test x$enable_python = "xyes" ; then
311     AC_MSG_WARN([Python libraries support has been disabled because python is
312 not installed on your system, or because it could not be found. Please install
313 it if you want Python libraries to be compiled and installed.])
314     AS_ECHO
317 if ! test x$add_pcap = "xyes" ; then
318   if test x$warn_pcap = "xyes" ; then
319     AC_MSG_WARN([VDE vde_pcapplug and packet dump plugin have been disabled
320 because libpcap is not installed on your system, or because it is too old.
321 Please install it if you want vde_pcapplug and pdump to be compiled and
322 installed.])
323     AS_ECHO
324   fi
327 AS_ECHO
328 AS_ECHO "Type 'make' to compile $PACKAGE $VERSION,"
329 AS_ECHO "or type 'make V=1' for verbose compiling"
330 AS_ECHO "and then type 'make install' to install it into $prefix"
331 AS_ECHO