plugins: std search path mgmt. path, ~/vde-2/plugins, {stdlib}/vde2/plugins
[vde.git] / vde-2 / configure.ac
blob6cd14af03ce6ccebf44ca222e5e1a6a34003c819
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 AC_CHECK_HEADERS([$PYTHONINCLUDEDIR/Python.h], [add_python_support=yes],
32                 [add_python_support=no; warn_python=no])
33 AC_CHECK_LIB([pcap], [pcap_open_dead],
34                 [add_pcap=yes],
35                 [add_pcap=no ; warn_pcap=yes])
36 AC_SUBST(PYTHONINCLUDEDIR)
38 # Checks for header files.
39 AC_HEADER_STDC
40 AC_HEADER_SYS_WAIT
41 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])
43 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
45 AC_CHECK_HEADERS([openssl/blowfish.h],
46                  [],
47                  [add_cryptcab_support=no ; warn_cryptcab=yes])
49 # Checks for typedefs, structures, and compiler characteristics.
50 AC_C_CONST
51 AC_C_INLINE
52 AC_C_BIGENDIAN
53 AC_C_PROTOTYPES
54 AC_TYPE_MODE_T
55 AC_TYPE_PID_T
56 AC_TYPE_SIZE_T
57 AC_HEADER_TIME
59 # Checks for library functions.
60 AC_FUNC_CHOWN
61 AC_FUNC_FORK
62 AC_PROG_GCC_TRADITIONAL
63 AC_FUNC_MALLOC
64 AC_FUNC_MEMCMP
65 AC_FUNC_REALLOC
66 AC_FUNC_SELECT_ARGTYPES
67 AC_FUNC_VPRINTF
68 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])
69 AC_REPLACE_FUNCS([open_memstream strndup])
70 AC_CHECK_FUNC([poll],
71         [
72                 AC_MSG_CHECKING([for poll sanity])
73                 if expr "$build_os" : "darwin*" > /dev/null; then
74                         AC_MSG_RESULT([present but broken, emulating with select])
75                         AC_LIBOBJ([poll])
76                         AC_DEFINE([poll], [vde_poll], [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 architecture: $build_os. At the moment, only
105 Linux, Darwin 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],
130       [Disable tuntap compilation]), [:],
131         [case "$build_os" in
132                 linux*)
133                         AC_CHECK_HEADER([linux/if_tun.h],
134                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
135                                 [warn_tuntap=yes])
136                         can_make_libvdetap=yes
137                         can_make_vdetunctl=yes
138                         ;;
139                 darwin*)
140                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
141                         for i in /dev/tap0 /Library/Extensions/tap.kext ; do
142                                 AC_MSG_CHECKING([for $i])
143                                 if test -e "$i" ; then
144                                         AC_MSG_RESULT([yes])
145                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
146                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
147                                         eval HAVE_$definename=yes
148                                 else
149                                         AC_MSG_RESULT([no])
150                                         warn_tuntap=yes
151                                 fi
152                         done
153                         
154                         if test "$HAVE__DEV_TAP0_" ; then
155                                 AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
156                                 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
157                                         AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
158 configuration does work...])
159                                 fi
160                         else
161                                 warn_tuntap=yes
162                                 AC_MSG_WARN([You do not have tuntap support. You can get it here:
163 http://tuntaposx.sourceforge.net/])
164                         fi
165                         ;;
166                 freebsd*)
167                         AC_CHECK_HEADER([net/if_tun.h],
168                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
169                                 [warn_tuntap=yes])
170                         ;;
171         esac])
173 # Disable pcap support (pdump)? (depends on libpcap, maybe unwanted)
174 AC_ARG_ENABLE([pcap],
175         AS_HELP_STRING([--disable-pcap],
176                 [Disable pcap support (pdump plugin)]),
177         [if test $enableval = "no" ; then add_pcap=no ; warn_pcap=no ; fi])
179 AC_ARG_ENABLE([kernel-switch],
180         AS_HELP_STRING([--enable-kernel-switch],
181                 [Compile support for in-kernel switch. ]),
182         [if test $enableval = "yes"; then
183                 enable_kernel_switch=yes
184                 AC_DEFINE([USE_IPN], 1, [If defined, enable support for IPN socket])
185         fi])
187 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
188 AM_CONDITIONAL(ENABLE_PYTHON, test "$add_python_support" = yes)
189 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
190 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
191 AM_CONDITIONAL(CAN_MAKE_VDETUNCTL, test "$can_make_vdetunctl" = yes)
192 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
193 AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes)
194 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
195 AM_CONDITIONAL(ENABLE_KERNEL_SWITCH, test "$enable_kernel_switch" = yes)
198 CFLAGS="-Wall -O2 $CFLAGS"
199 AC_SUBST(CFLAGS)
201 AC_CONFIG_FILES(
202                 [Makefile]
203                 [doc/Makefile]
204                 [include/Makefile]
205                 [man/Makefile]
206                 [src/Makefile]
207                 [src/lib/Makefile]
208                 [src/lib/vdesnmp.pc]
209                 [src/lib/vdemgmt.pc]
210                 [src/lib/vdeplug.pc]
211                 [src/lib/vdehist.pc]
212                 [src/lib/python/Makefile]
213                 [src/vde_switch/Makefile]
214                 [src/kvde_switch/Makefile]
215                 [src/vde_over_ns/Makefile]
216                 [src/common/Makefile]
217                 [src/vdetaplib/Makefile]
218                 [src/vde_l3/Makefile]
219                 [src/vde_cryptcab/Makefile]
220                 [src/slirpvde/Makefile]
221                 [src/vde_switch/plugins/Makefile]
222                 )
223 AC_OUTPUT
226 echo
227 echo
228 echo "Configure results:"
229 echo
230 if test x$add_cryptcab_support = "xyes" ; then
231         echo " + VDE CryptCab............ enabled"
232 else
233         echo " - VDE CryptCab............ disabled"
236 if test x$add_python_support = "xyes" ; then
237         echo " + Python Libraries........ enabled"
238 else
239         echo " - Python Libraries........ disabled"
242 if test x$warn_tuntap = "xyes" ; then
243         echo " - TAP support............. disabled"
244 else
245         echo " + TAP support............. enabled"
248 if test x$add_pcap = "xyes" ; then
249         echo " + pcap support............ enabled"
250 else
251         echo " - pcap support............ disabled"
254 if test x$enable_experimental = "xyes" ; then
255         echo " + Experimental features... enabled"
256 else
257         echo " - Experimental features... disabled"
260 if test x$enable_profile = "xyes" ; then
261         echo " + Profiling options....... enabled"
262 else
263         echo " - Profiling options....... disabled"
266 if test x$enable_kernel_switch = "xyes" ; then
267         echo " + Kernel switch........... enabled"
268 else
269         echo " - Kernel switch........... disabled"
272 echo
273 echo
274 if ! test x$add_cryptcab_support = "xyes" ; then
275         if test x$warn_cryptcab = "xyes" ; then
276                 AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
277 not installed on your system, or because openssl/blowfish.h could not be
278 found. Please install them if you want CryptCab to be compiled and installed.])
279         fi
282 if ! test x$add_python_support = "xyes" ; then
283         if test x$warn_python = "xyes" ; then
284                 AC_MSG_WARN([Python libraries support has been disabled because python is
285 not installed on your system, or because it could not be
286 found. Please install it if you want Python libraries to be compiled and installed.])
287         fi
290 if ! test x$add_pcap = "xyes" ; then
291         if test x$warn_pcap = "xyes" ; then
292                 AC_MSG_WARN([VDE vde_pcapplug and packet dump plugin have been disabled because
293 libpcap is not installed on your system, or because it's too old.
294 Please install it if you want vde_pcapplug and pdump to be compiled and installed.])
295         fi
298 echo
299 echo "Type 'make' to compile $PACKAGE $VERSION,"
300 echo "or type 'make V=1' for verbose compiling"
301 echo "and then type 'make install' to install it into $prefix"
302 echo