solved some undefined when LDFLAGS includes "--no-undefined"
[vde.git] / vde-2 / configure.ac
blob3a790c4a70556ec5913b8e1450fe9aa96ee7281f
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])
29 AM_PATH_PYTHON([2.5], [add_python_support=yes], [add_python_support=warn])
30 PYTHONINCLUDEDIR=`python2.5 -c "from distutils.sysconfig import get_python_inc; print get_python_inc();"`
31 PYTHON_LIBS=`python2.5-config --libs`
32 AC_CHECK_HEADERS([$PYTHONINCLUDEDIR/Python.h], [add_python_support=yes],
33                 [add_python_support=no; warn_python=no])
34 AC_CHECK_LIB([pcap], [pcap_open_dead],
35                 [add_pcap=yes],
36                 [add_pcap=no ; warn_pcap=yes])
37 AC_SUBST(PYTHONINCLUDEDIR)
38 AC_SUBST(PYTHON_LIBS)
40 # Checks for header files.
41 AC_HEADER_STDC
42 AC_HEADER_SYS_WAIT
43 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])
45 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
47 AC_CHECK_HEADERS([openssl/blowfish.h],
48                  [],
49                  [add_cryptcab_support=no ; warn_cryptcab=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 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])
71 AC_REPLACE_FUNCS([open_memstream strndup])
72 AC_CHECK_FUNC([poll],
73         [
74                 AC_MSG_CHECKING([for poll sanity])
75                 if expr "$build_os" : "darwin*" > /dev/null; then
76                         AC_MSG_RESULT([present but broken, emulating with select])
77                         AC_LIBOBJ([poll])
78                         AC_DEFINE([poll], [vde_poll], [Define to vde_poll if the replacement function should be used.])
79                 else
80                         AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
81                         AC_MSG_RESULT([yes])
82                 fi
83         ],
84         [])
86 # All other nice checks I have to make for recostructing missing parts of
87 # slirp's config.h file
88 AC_CHECK_SIZEOF(char)
89 AC_CHECK_SIZEOF(short)
90 AC_CHECK_SIZEOF(int)
91 AC_CHECK_SIZEOF(char *)
93 # Define VDE_LINUX or VDE_DARWIN
94 case "$build_os" in
95         linux*)
96                 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
97                 ;;
98         darwin*)
99                 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
100                 darwin_gcc=yes
101                 ;;
102         freebsd*)
103                 AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
104                 ;;
105         *)
106                 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
107 Linux, Darwin and FreeBSD are supported. Contributions are appreciated! :-)])
108                 ;;
109 esac
111 # Enable profiling options
112 AC_ARG_ENABLE([profile],
113         AS_HELP_STRING([--enable-profile],
114                 [Compile with debugging/profiling options]),
115         [if test $enableval = "yes"; then enable_profile=yes; fi])
117 # Enable experimental features
118 AC_ARG_ENABLE([experimental],
119         AS_HELP_STRING([--enable-experimental],
120                 [Enable experimental features (async notifies, plugin support, packet counter)]),
121         [if test $enableval = "yes"; then enable_experimental=yes; fi])
123 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
124 AC_ARG_ENABLE([cryptcab],
125         AS_HELP_STRING([--disable-cryptcab],
126                 [Disable libcrypto-dependend vde_cryptcab compilation]),
127         [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
129 # Check of tuntap device
130 AC_ARG_ENABLE([tuntap],
131     AS_HELP_STRING([--disable-tuntap],
132       [Disable tuntap compilation]), [:],
133         [case "$build_os" in
134                 linux*)
135                         AC_CHECK_HEADER([linux/if_tun.h],
136                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
137                                 [warn_tuntap=yes])
138                         can_make_libvdetap=yes
139                         can_make_vdetunctl=yes
140                         ;;
141                 darwin*)
142                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
143                         for i in /dev/tap0 /Library/Extensions/tap.kext ; do
144                                 AC_MSG_CHECKING([for $i])
145                                 if test -e "$i" ; then
146                                         AC_MSG_RESULT([yes])
147                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
148                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
149                                         eval HAVE_$definename=yes
150                                 else
151                                         AC_MSG_RESULT([no])
152                                         warn_tuntap=yes
153                                 fi
154                         done
155                         
156                         if test "$HAVE__DEV_TAP0_" ; then
157                                 AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
158                                 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
159                                         AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
160 configuration does work...])
161                                 fi
162                         else
163                                 warn_tuntap=yes
164                                 AC_MSG_WARN([You do not have tuntap support. You can get it here:
165 http://tuntaposx.sourceforge.net/])
166                         fi
167                         ;;
168                 freebsd*)
169                         AC_CHECK_HEADER([net/if_tun.h],
170                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
171                                 [warn_tuntap=yes])
172                         ;;
173         esac])
175 # Disable pcap support (pdump)? (depends on libpcap, maybe unwanted)
176 AC_ARG_ENABLE([pcap],
177         AS_HELP_STRING([--disable-pcap],
178                 [Disable pcap support (pdump plugin)]),
179         [if test $enableval = "no" ; then add_pcap=no ; warn_pcap=no ; fi])
181 AC_ARG_ENABLE([kernel-switch],
182         AS_HELP_STRING([--enable-kernel-switch],
183                 [Compile support for in-kernel switch. ]),
184         [if test $enableval = "yes"; then
185                 enable_kernel_switch=yes
186                 AC_DEFINE([USE_IPN], 1, [If defined, enable support for IPN socket])
187         fi])
189 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
190 AM_CONDITIONAL(ENABLE_PYTHON, test "$add_python_support" = yes)
191 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
192 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
193 AM_CONDITIONAL(CAN_MAKE_VDETUNCTL, test "$can_make_vdetunctl" = yes)
194 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
195 AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes)
196 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
197 AM_CONDITIONAL(ENABLE_KERNEL_SWITCH, test "$enable_kernel_switch" = yes)
200 CFLAGS="-Wall -O2 $CFLAGS"
201 AC_SUBST(CFLAGS)
203 AC_CONFIG_FILES(
204                 [Makefile]
205                 [doc/Makefile]
206                 [include/Makefile]
207                 [man/Makefile]
208                 [src/Makefile]
209                 [src/lib/Makefile]
210                 [src/lib/vdesnmp.pc]
211                 [src/lib/vdemgmt.pc]
212                 [src/lib/vdeplug.pc]
213                 [src/lib/vdehist.pc]
214                 [src/lib/python/Makefile]
215                 [src/vde_switch/Makefile]
216                 [src/kvde_switch/Makefile]
217                 [src/vde_over_ns/Makefile]
218                 [src/common/Makefile]
219                 [src/vdetaplib/Makefile]
220                 [src/vde_l3/Makefile]
221                 [src/vde_cryptcab/Makefile]
222                 [src/slirpvde/Makefile]
223                 [src/vde_switch/plugins/Makefile]
224                 )
225 AC_OUTPUT
228 echo
229 echo
230 echo "Configure results:"
231 echo
232 if test x$add_cryptcab_support = "xyes" ; then
233         echo " + VDE CryptCab............ enabled"
234 else
235         echo " - VDE CryptCab............ disabled"
238 if test x$add_python_support = "xyes" ; then
239         echo " + Python Libraries........ enabled"
240 else
241         echo " - Python Libraries........ disabled"
244 if test x$warn_tuntap = "xyes" ; then
245         echo " - TAP support............. disabled"
246 else
247         echo " + TAP support............. enabled"
250 if test x$add_pcap = "xyes" ; then
251         echo " + pcap support............ enabled"
252 else
253         echo " - pcap support............ disabled"
256 if test x$enable_experimental = "xyes" ; then
257         echo " + Experimental features... enabled"
258 else
259         echo " - Experimental features... disabled"
262 if test x$enable_profile = "xyes" ; then
263         echo " + Profiling options....... enabled"
264 else
265         echo " - Profiling options....... disabled"
268 if test x$enable_kernel_switch = "xyes" ; then
269         echo " + Kernel switch........... enabled"
270 else
271         echo " - Kernel switch........... disabled"
274 echo
275 echo
276 if ! test x$add_cryptcab_support = "xyes" ; then
277         if test x$warn_cryptcab = "xyes" ; then
278                 AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
279 not installed on your system, or because openssl/blowfish.h could not be
280 found. Please install them if you want CryptCab to be compiled and installed.])
281         fi
284 if ! test x$add_python_support = "xyes" ; then
285         if test x$warn_python = "xyes" ; then
286                 AC_MSG_WARN([Python libraries support has been disabled because python is
287 not installed on your system, or because it could not be
288 found. Please install it if you want Python libraries to be compiled and installed.])
289         fi
292 if ! test x$add_pcap = "xyes" ; then
293         if test x$warn_pcap = "xyes" ; then
294                 AC_MSG_WARN([VDE vde_pcapplug and packet dump plugin have been disabled because
295 libpcap is not installed on your system, or because it's too old.
296 Please install it if you want vde_pcapplug and pdump to be compiled and installed.])
297         fi
300 echo
301 echo "Type 'make' to compile $PACKAGE $VERSION,"
302 echo "or type 'make V=1' for verbose compiling"
303 echo "and then type 'make install' to install it into $prefix"
304 echo