vde_vxlan initial release
[vde.git] / vde-2 / configure.ac
blob76024c49f32de625941a34b443dc3d869a4def56
1 #                                               -*- Autoconf -*-/
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([vde2],[2.3.2],[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([pthread], [pthread_create],
29   [enable_router=yes],
30   [enable_router=no ; warn_router=yes])
31 AC_CHECK_LIB([pcap], [pcap_open_dead],
32   [add_pcap=yes],
33   [add_pcap=no ; warn_pcap=yes])
35 # Checks for header files.
36 AC_HEADER_STDC
37 AC_HEADER_SYS_WAIT
38 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stddef.h stdint.h \
39   stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h \
40   sys/time.h syslog.h termio.h termios.h unistd.h sys/filio.h sys/bitypes.h \
41   sys/wait.h sys/select.h sys/signal.h sys/stropts.h termios.h sys/type32.h])
43 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
45 AC_CHECK_HEADERS([openssl/blowfish.h], [],
46   [add_cryptcab_support=no ; warn_cryptcab=yes])
48 AC_CHECK_HEADERS([sysexits.h], [],
49   [add_over_ns_support=no ; warn_over_ns=yes])
51 # Checks for typedefs, structures, and compiler characteristics.
52 AC_C_CONST
53 AC_C_INLINE
54 AC_C_BIGENDIAN
55 AC_C_PROTOTYPES
56 AC_TYPE_MODE_T
57 AC_TYPE_PID_T
58 AC_TYPE_SIZE_T
59 AC_HEADER_TIME
61 # Checks for library functions.
62 AC_FUNC_CHOWN
63 AC_FUNC_FORK
64 AC_PROG_GCC_TRADITIONAL
65 AC_FUNC_MALLOC
66 AC_FUNC_MEMCMP
67 AC_FUNC_REALLOC
68 AC_FUNC_SELECT_ARGTYPES
69 AC_FUNC_VPRINTF
70 AC_CHECK_FUNCS([atexit dup2 gethostbyname gethostname gettimeofday inet_ntoa \
71   memmove memset putenv select setenv socket strchr strdup strerror strstr \
72   uname inet_aton sprintf readv random srandom index bcmp drand48 memmove \
73   gethostid revoke fchmod getopt_long_only funopen])
74 AC_REPLACE_FUNCS([open_memstream strndup])
75 AC_CHECK_FUNC([poll],
76   [
77     AC_MSG_CHECKING([for poll sanity])
78     if expr "$build_os" : "darwin*" > /dev/null; then
79       AC_MSG_RESULT([present but broken, emulating with select])
80       AC_LIBOBJ([poll])
81       AC_DEFINE([poll], [vde_poll],
82                 [Define to vde_poll if the replacement function should be used.])
83     else
84       AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
85       AC_MSG_RESULT([yes])
86     fi
87   ],
88   [])
90 # All other nice checks I have to make for recostructing missing parts of
91 # slirp's config.h file
92 AC_CHECK_SIZEOF(char)
93 AC_CHECK_SIZEOF(short)
94 AC_CHECK_SIZEOF(int)
95 AC_CHECK_SIZEOF(char *)
97 # Define VDE_LINUX or VDE_DARWIN
98 case "$build_os" in
99   linux*)
100     if expr "$host_os" : ".*android" > /dev/null; then
101       AC_DEFINE([VDE_BIONIC], 1, [If defined, this is a Linux/bionic system])
102     else
103       AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
104     fi
105   ;;
106   darwin*)
107     AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
108     darwin_gcc=yes
109   ;;
110   freebsd*)
111     AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
112   ;;
113   *)
114     AC_MSG_ERROR([Unsupported OS: $build_os. At the moment, only Linux, Darwin
115 and FreeBSD are supported. Contributions are appreciated! :-)])
116   ;;
117 esac
119 # Enable profiling options
120 AC_ARG_ENABLE([profile],
121   AS_HELP_STRING([--enable-profile],
122     [Compile with debugging/profiling options]),
123   [if test $enableval = "yes"; then enable_profile=yes; fi])
125 # Enable experimental features
126 AC_ARG_ENABLE([experimental],
127   AS_HELP_STRING([--enable-experimental],
128     [Enable experimental features (async notifies, plugin support, packet counter)]),
129   [if test $enableval = "yes"; then enable_experimental=yes; fi])
131 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
132 AC_ARG_ENABLE([cryptcab],
133   AS_HELP_STRING([--disable-cryptcab],
134     [Disable libcrypto-dependend vde_cryptcab compilation]),
135   [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
137 # Disable vde_over_ns? (not working on android, maybe unwanted)
138 AC_ARG_ENABLE([vde_over_ns],
139   AS_HELP_STRING([--disable-vde_over_ns],
140     [Disable vde_over_ns compilation]),
141   [if test $enableval = "no" ; then add_over_ns_support=no ; warn_over_ns=no ; fi])
143 # Disable vde_router? (depends on lpthread, maybe unwanted)
144 AC_ARG_ENABLE([router],
145   AS_HELP_STRING([--disable-router],
146     [Disable libpthread-dependent vde_router compilation]),
147   [if test $enableval = "no" ; then enable_router=no ; warn_router=no ; fi])
149 enable_vxlan=yes
150 # Disable vde_vxlan?
151 AC_ARG_ENABLE([vxlan],
152   AS_HELP_STRING([--disable-vxlan],
153     [Disable vde_vxlan compilation]),
154   [if test $enableval = "no" ; then enable_vxlan=no ; warn_vxlan=no ; fi])
156 # Check of tuntap device
157 AC_ARG_ENABLE([tuntap],
158   AS_HELP_STRING([--disable-tuntap], [Disable tuntap compilation]), [:],
159   [case "$build_os" in
160     linux*)
161       AC_CHECK_HEADER([linux/if_tun.h],
162         [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
163         [warn_tuntap=yes])
164       can_make_libvdetap=yes
165       can_make_vdetunctl=yes
166       ;;
167     darwin*)
168       # I don't use AC_CHECK_FILES because I need test -e and not test -r
169       for i in /dev/tap0 /Library/Extensions/tap.kext ; do
170         AC_MSG_CHECKING([for $i])
171         if test -e "$i" ; then
172           AC_MSG_RESULT([yes])
173           definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
174           AC_DEFINE_UNQUOTED([HAVE_$definename])
175           eval HAVE_$definename=yes
176         else
177           AC_MSG_RESULT([no])
178           warn_tuntap=yes
179         fi
180       done
182       if test "$HAVE__DEV_TAP0_" ; then
183         AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
184         if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" || "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
185           AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
186 configuration does work...])
187         fi
188       else
189         warn_tuntap=yes
190         AC_MSG_WARN([You do not have tuntap support. You can get it here:
191 http://tuntaposx.sourceforge.net/])
192       fi
193       ;;
194     freebsd*)
195       AC_CHECK_HEADER([net/if_tun.h],
196         [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
197         [warn_tuntap=yes])
198       ;;
199   esac])
201 # Disable pcap support (pdump)? (depends on libpcap, maybe unwanted)
202 AC_ARG_ENABLE([pcap],
203   AS_HELP_STRING([--disable-pcap],
204     [Disable pcap support (pdump plugin)]),
205   [if test $enableval = "no" ; then add_pcap=no ; warn_pcap=no ; fi])
207 AC_ARG_ENABLE([kernel-switch],
208   AS_HELP_STRING([--enable-kernel-switch],
209     [Compile support for in-kernel switch. ]),
210   [if test $enableval = "yes"; then
211     enable_kernel_switch=yes
212     AC_DEFINE([USE_IPN], 1, [If defined, enable support for IPN socket])
213   fi])
215 # python bindings
216 AC_ARG_ENABLE([python],
217   AS_HELP_STRING([--disable-python], [Disable python bindings]),
218   [enable_python=$enableval],
219   [enable_python=yes]
222 if test x"$enable_python" = x"yes"; then
223   # check python
224   AM_PATH_PYTHON([2.5])
225   AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
226   if test x"$PYTHON_CONFIG" = x""; then
227     AC_PATH_PROG(PYTHON_CONFIG, python-config)
228   fi
229   if test x"$PYTHON_CONFIG" = x""; then
230     # not found, give up
231     enable_python=no
232   else
233     PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
234     PYTHON_LIBS=`$PYTHON_CONFIG --libs`
235     PYTHON_INCLUDES="$PYTHON_CFLAGS"
236   fi
237   AC_SUBST(PYTHON_CFLAGS)
238   AC_SUBST(PYTHON_INCLUDES)
239   AC_SUBST(PYTHON_LIBS)
243 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
244 AM_CONDITIONAL(ENABLE_VDE_OVER_NS, test "$add_over_ns_support" = yes)
245 AM_CONDITIONAL(ENABLE_ROUTER, test "$enable_router" = yes)
246 AM_CONDITIONAL(ENABLE_VXLAN, test "$enable_vxlan" = yes)
247 AM_CONDITIONAL(ENABLE_PYTHON, test "$enable_python" = yes)
248 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
249 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
250 AM_CONDITIONAL(CAN_MAKE_VDETUNCTL, test "$can_make_vdetunctl" = yes)
251 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
252 AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes)
253 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
254 AM_CONDITIONAL(ENABLE_KERNEL_SWITCH, test "$enable_kernel_switch" = yes)
257 CFLAGS="-Wall -O2 $CFLAGS"
258 AC_SUBST(CFLAGS)
260 AC_CONFIG_FILES(
261   [Makefile]
262   [doc/Makefile]
263   [include/Makefile]
264   [man/Makefile]
265   [src/Makefile]
266   [src/lib/Makefile]
267   [src/lib/vdesnmp.pc]
268   [src/lib/vdemgmt.pc]
269   [src/lib/vdeplug.pc]
270   [src/lib/vdehist.pc]
271   [src/lib/python/Makefile]
272   [src/vde_switch/Makefile]
273   [src/kvde_switch/Makefile]
274   [src/vde_over_ns/Makefile]
275   [src/common/Makefile]
276   [src/vdetaplib/Makefile]
277   [src/vde_l3/Makefile]
278   [src/vde_cryptcab/Makefile]
279   [src/vde_router/Makefile]
280   [src/vde_vxlan/Makefile]
281   [src/slirpvde/Makefile]
282   [src/vde_switch/plugins/Makefile]
284 AC_OUTPUT
287 AS_ECHO
288 AS_ECHO
289 AS_ECHO "Configure results:"
290 AS_ECHO
291 if test x$add_cryptcab_support = "xyes" ; then
292   AS_ECHO " + VDE CryptCab............ enabled"
293 else
294   AS_ECHO " - VDE CryptCab............ disabled"
297 if test x$enable_router = "xyes" ; then
298   AS_ECHO " + VDE Router.............. enabled"
299 else
300   AS_ECHO " - VDE Router.............. disabled"
303 if test x$enable_vxlan = "xyes" ; then
304   AS_ECHO " + VDE VXLAN............... enabled"
305 else
306   AS_ECHO " - VDE VXLAN............... disabled"
309 if test x$enable_python = "xyes" ; then
310   AS_ECHO " + Python Libraries........ enabled"
311 else
312   AS_ECHO " - Python Libraries........ disabled"
315 if test x$warn_tuntap = "xyes" ; then
316   AS_ECHO " - TAP support............. disabled"
317 else
318   AS_ECHO " + TAP support............. enabled"
321 if test x$add_pcap = "xyes" ; then
322   AS_ECHO " + pcap support............ enabled"
323 else
324   AS_ECHO " - pcap support............ disabled"
327 if test x$enable_experimental = "xyes" ; then
328   AS_ECHO " + Experimental features... enabled"
329 else
330   AS_ECHO " - Experimental features... disabled"
333 if test x$enable_profile = "xyes" ; then
334   AS_ECHO " + Profiling options....... enabled"
335 else
336   AS_ECHO " - Profiling options....... disabled"
339 if test x$enable_kernel_switch = "xyes" ; then
340   AS_ECHO " + Kernel switch........... enabled"
341 else
342   AS_ECHO " - Kernel switch........... disabled"
345 AS_ECHO
346 AS_ECHO
347 if ! test x$add_cryptcab_support = "xyes" ; then
348   if test x$warn_cryptcab = "xyes" ; then
349     AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
350 not installed on your system, or because openssl/blowfish.h could not be found.
351 Please install them if you want CryptCab to be compiled and installed.])
352     AS_ECHO
353   fi
356 if ! test x$add_over_ns_support = "xyes" ; then
357   if test x$warn_over_ns = "xyes" ; then
358     AC_MSG_WARN([VDE vde_over_ns support has been disabled because your libc
359     sysexits.h could not be found.])
360     AS_ECHO
361   fi
364 if ! test x$enable_router = "xyes" ; then
365   if test x$warn_router = "xyes" ; then
366     AC_MSG_WARN([VDE Router support has been disabled because libpthread is
367 not installed on your system.])
368     AS_ECHO
369   fi
372 if ! test x$enable_vxlan = "xyes" ; then
373   if test x$warn_vxlan = "xyes" ; then
374     AC_MSG_WARN([VDE VXLAN support has been disabled.])
375     AS_ECHO
376   fi
379 if ! test x$enable_python = "xyes" ; then
380     AC_MSG_WARN([Python libraries support has been disabled because python is
381 not installed on your system, or because it could not be found. Please install
382 it if you want Python libraries to be compiled and installed.])
383     AS_ECHO
386 if ! test x$add_pcap = "xyes" ; then
387   if test x$warn_pcap = "xyes" ; then
388     AC_MSG_WARN([VDE vde_pcapplug and packet dump plugin have been disabled
389 because libpcap is not installed on your system, or because it is too old.
390 Please install it if you want vde_pcapplug and pdump to be compiled and
391 installed.])
392     AS_ECHO
393   fi
396 AS_ECHO
397 AS_ECHO "Type 'make' to compile $PACKAGE $VERSION,"
398 AS_ECHO "or type 'make V=1' for verbose compiling"
399 AS_ECHO "and then type 'make install' to install it into $prefix"
400 AS_ECHO