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