Added dynamic loadable traffic control/queuing discipline support for vde_l3.
[vde.git] / vde-2 / configure.ac
blob3c32bd98ac8a69bc5ebcc7cdabfda272207597f8
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT(vde2, [2.1.6], renzo@cs.unibo.it)
6 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
7 AC_CONFIG_SRCDIR([vde.h])
8 AC_CONFIG_HEADER([config.h])
9 AC_CONFIG_LIBOBJ_DIR(utils)
11 # Checks for programs.
12 AC_PROG_CXX
13 AC_PROG_CC
14 AC_PROG_INSTALL
15 AC_PROG_LN_S
16 AC_PROG_LIBTOOL
18 # Checks for libraries.
19 AC_CHECK_LIB([dl], [dlopen])
20 AC_CHECK_LIB([crypto], [EVP_EncryptInit],
21                 [add_cryptcab_support=yes],
22                 [add_cryptcab_support=no ; warn_cryptcab=yes])
23 AC_CHECK_LIB([pcap], [pcap_open_dead],
24                 [add_pcap=yes],
25                 [add_pcap=no ; warn_pcap=yes])
27 # Checks for header files.
28 AC_HEADER_STDC
29 AC_HEADER_SYS_WAIT
30 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])
32 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
34 AC_CHECK_HEADERS([openssl/blowfish.h],
35                  [],
36                  [add_cryptcab_support=no ; warn_cryptcab=yes])
38 # Checks for typedefs, structures, and compiler characteristics.
39 AC_C_CONST
40 AC_C_INLINE
41 AC_C_BIGENDIAN
42 AC_C_PROTOTYPES
43 AC_TYPE_MODE_T
44 AC_TYPE_PID_T
45 AC_TYPE_SIZE_T
46 AC_HEADER_TIME
48 # Checks for library functions.
49 AC_FUNC_CHOWN
50 AC_FUNC_FORK
51 AC_PROG_GCC_TRADITIONAL
52 AC_FUNC_MALLOC
53 AC_FUNC_MEMCMP
54 AC_FUNC_REALLOC
55 AC_FUNC_SELECT_ARGTYPES
56 AC_TYPE_SIGNAL
57 AC_FUNC_VPRINTF
58 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])
59 AC_REPLACE_FUNCS([open_memstream strndup])
60 AC_MSG_CHECKING([for broken poll()])
61         if expr "$build_os" : "darwin8\..*" > /dev/null; then
62                 AC_MSG_RESULT([yes, emulating with select()])
63                 AC_DEFINE([HAVE_POLL], 0, [Define to 1 if your system has a working poll() function.])
64                 AC_LIBOBJ([poll])
65                 AC_DEFINE([poll], [rpl_poll], [Define to rpl_poll if the replacement function should be used.])
67         else
68                 AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
69                 AC_MSG_RESULT([no])
70         fi
72 # All other nice checks I have to make for recostructing missing parts of
73 # slirp's config.h file
74 AC_CHECK_SIZEOF(char)
75 AC_CHECK_SIZEOF(short)
76 AC_CHECK_SIZEOF(int)
77 AC_CHECK_SIZEOF(char *)
79 # Define VDE_LINUX or VDE_DARWIN
80 case "$build_os" in
81         linux*)
82                 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
83                 ;;
84         darwin*)
85                 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
86                 darwin_gcc=yes
87                 ;;
88         freebsd*)
89                 AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
90                 ;;
91         *)
92                 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
93 Linux, Darwin and FreeBSD are supported. Contributions are appreciated! :-)])
94                 ;;
95 esac
97 # Enable experimental features
98 AC_ARG_ENABLE([experimental],
99         AS_HELP_STRING([--enable-experimental],
100                 [Enable experimental features (async notifies, plugin support, packet counter)]),
101         [if test $enableval = "yes"; then enable_experimental=yes; fi])
103 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
104 AC_ARG_ENABLE([cryptcab],
105         AS_HELP_STRING([--disable-cryptcab],
106                 [Disable libcrypto-dependend vde_cryptcab compilation]),
107         [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
109 # Check of tuntap device
110 AC_ARG_ENABLE([tuntap],
111     AS_HELP_STRING([--disable-tuntap],
112       [Disable tuntap compilation]), [:],
113         [case "$build_os" in
114                 linux*)
115                         AC_CHECK_HEADER([linux/if_tun.h],
116                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
117                                 [AC_MSG_WARN([Tuntap support seem to be not enabled on your kernel])])
118                         can_make_libvdetap=yes
119                         ;;
120                 darwin*)
121                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
122                         for i in /dev/tap0 /Library/Extensions/tap.kext /System/Library/Extensions/tap.kext ; do
123                                 AC_MSG_CHECKING([for $i])
124                                 if test -e "$i" ; then
125                                         AC_MSG_RESULT([yes])
126                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
127                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
128                                         eval HAVE_$definename=yes
129                                 else
130                                         AC_MSG_RESULT([no])
131                                 fi
132                         done
133                         
134                         if test "$HAVE__DEV_TAP0_" ; then
135                                 AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
136                                 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
137                                         AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
138 configuration does work...])
139                                 fi
140                         else
141                                 AC_MSG_WARN([You do not have tuntap support. You can get it here:
142 http://www-user.rhrk.uni-kl.de/~nissler/tuntap/])
143                         fi
144                         ;;
145                 freebsd*)
146                         AC_CHECK_HEADER([net/if_tun.h],
147                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
148                                 [AC_MSG_WARN([Tuntap support seem to be not enabled on your kernel])])
149                         ;;
150         esac])
152 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
153 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
154 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
155 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
156 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
158 if test "x${prefix}" = "xNONE"; then
159         AC_DEFINE_UNQUOTED(INSTALLPATH, "${ac_default_prefix}",[PREFIX])
160 else
161         AC_DEFINE_UNQUOTED(INSTALLPATH, "${prefix}",[PREFIX])
165 AC_CONFIG_FILES([Makefile]
166                 [doc/Makefile]
167                 [qemu/Makefile]
168                 [slirpvde/Makefile]
169                 [vdetaplib/Makefile]
170                 [libvdeplug/Makefile]
171                 [vde_plug/Makefile]
172                 [vde_plug2tap/Makefile]
173                 [vde_cryptcab/Makefile]
174                 [bochs/Makefile]
175                 [dpipe/Makefile]
176                 [unixterm/Makefile]
177                 [wirefilter/Makefile]
178                 [vde_over_ns/Makefile]
179                 [plugin/Makefile]
180                 [vde_l3/Makefile]
181                 [uml/Makefile]
182                 [libvdemgmt/Makefile]
183                 [unixcmd/Makefile]
184                 [tunctl/Makefile]
185                 [vde_autolink/Makefile])
186 AC_OUTPUT
188 if test x$warn_cryptcab = "xyes"
189 then
190         AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
191 not installed on your system, or because openssl/blowfish.h could not be
192 found. Please install them if you want CryptCab to be compiled and installed.])
195 if test x$warn_pcap = "xyes"
196 then
197         AC_MSG_WARN([VDE packet dump plugin has been disabled because libpcap is
198 not installed on your system, or because it's too old.
199 Please install it if you want pdump to be compiled and installed.])