ipn_node: dev renamed as netdev, new chrdev field added
[vde.git] / vde-2 / configure.ac
blob25ee2b2e5808d7042f3d365687da759edf6930d8
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([vde2], [2.2.3], [info@v2.cs.unibo.it])
6 AC_CONFIG_MACRO_DIR([m4])
7 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
8 AC_CONFIG_SRCDIR([include/vde.h])
9 AC_CONFIG_HEADER([include/config.h])
10 AC_CONFIG_LIBOBJ_DIR(src/common)
12 # Checks for programs.
13 AC_PROG_CXX
14 AC_PROG_CC
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_LIBTOOL
18 AM_PROG_CC_C_O
20 # Checks for libraries.
21 AC_CHECK_LIB([dl], [dlopen])
22 AC_CHECK_LIB([crypto], [EVP_EncryptInit],
23                 [add_cryptcab_support=yes],
24                 [add_cryptcab_support=no ; warn_cryptcab=yes])
25 AC_CHECK_LIB([pcap], [pcap_open_dead],
26                 [add_pcap=yes],
27                 [add_pcap=no ; warn_pcap=yes])
29 # Checks for header files.
30 AC_HEADER_STDC
31 AC_HEADER_SYS_WAIT
32 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])
34 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
36 AC_CHECK_HEADERS([openssl/blowfish.h],
37                  [],
38                  [add_cryptcab_support=no ; warn_cryptcab=yes])
40 # Checks for typedefs, structures, and compiler characteristics.
41 AC_C_CONST
42 AC_C_INLINE
43 AC_C_BIGENDIAN
44 AC_C_PROTOTYPES
45 AC_TYPE_MODE_T
46 AC_TYPE_PID_T
47 AC_TYPE_SIZE_T
48 AC_HEADER_TIME
50 # Checks for library functions.
51 AC_FUNC_CHOWN
52 AC_FUNC_FORK
53 AC_PROG_GCC_TRADITIONAL
54 AC_FUNC_MALLOC
55 AC_FUNC_MEMCMP
56 AC_FUNC_REALLOC
57 AC_FUNC_SELECT_ARGTYPES
58 AC_TYPE_SIGNAL
59 AC_FUNC_VPRINTF
60 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])
61 AC_REPLACE_FUNCS([open_memstream strndup])
62 AC_CHECK_FUNC([poll],
63         [
64                 AC_MSG_CHECKING([for poll sanity])
65                 if expr "$build_os" : "darwin*" > /dev/null; then
66                         AC_MSG_RESULT([present but broken, emulating with select])
67                         AC_LIBOBJ([poll])
68                         AC_DEFINE([poll], [vde_poll], [Define to vde_poll if the replacement function should be used.])
69                 else
70                         AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
71                         AC_MSG_RESULT([yes])
72                 fi
73         ],
74         [])
76 # All other nice checks I have to make for recostructing missing parts of
77 # slirp's config.h file
78 AC_CHECK_SIZEOF(char)
79 AC_CHECK_SIZEOF(short)
80 AC_CHECK_SIZEOF(int)
81 AC_CHECK_SIZEOF(char *)
83 # Define VDE_LINUX or VDE_DARWIN
84 case "$build_os" in
85         linux*)
86                 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
87                 ;;
88         darwin*)
89                 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
90                 darwin_gcc=yes
91                 ;;
92         freebsd*)
93                 AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
94                 ;;
95         *)
96                 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
97 Linux, Darwin and FreeBSD are supported. Contributions are appreciated! :-)])
98                 ;;
99 esac
101 # Enable profiling options
102 AC_ARG_ENABLE([profile],
103         AS_HELP_STRING([--enable-profile],
104                 [Compile with debugging/profiling options]),
105         [if test $enableval = "yes"; then enable_profile=yes; fi])
107 # Enable experimental features
108 AC_ARG_ENABLE([experimental],
109         AS_HELP_STRING([--enable-experimental],
110                 [Enable experimental features (async notifies, plugin support, packet counter)]),
111         [if test $enableval = "yes"; then enable_experimental=yes; fi])
113 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
114 AC_ARG_ENABLE([cryptcab],
115         AS_HELP_STRING([--disable-cryptcab],
116                 [Disable libcrypto-dependend vde_cryptcab compilation]),
117         [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
119 # Check of tuntap device
120 AC_ARG_ENABLE([tuntap],
121     AS_HELP_STRING([--disable-tuntap],
122       [Disable tuntap compilation]), [:],
123         [case "$build_os" in
124                 linux*)
125                         AC_CHECK_HEADER([linux/if_tun.h],
126                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
127                                 [warn_tuntap=yes])
128                         can_make_libvdetap=yes
129                         can_make_vdetunctl=yes
130                         ;;
131                 darwin*)
132                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
133                         for i in /dev/tap0 /Library/Extensions/tap.kext ; do
134                                 AC_MSG_CHECKING([for $i])
135                                 if test -e "$i" ; then
136                                         AC_MSG_RESULT([yes])
137                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
138                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
139                                         eval HAVE_$definename=yes
140                                 else
141                                         AC_MSG_RESULT([no])
142                                         warn_tuntap=yes
143                                 fi
144                         done
145                         
146                         if test "$HAVE__DEV_TAP0_" ; then
147                                 AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
148                                 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
149                                         AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
150 configuration does work...])
151                                 fi
152                         else
153                                 warn_tuntap=yes
154                                 AC_MSG_WARN([You do not have tuntap support. You can get it here:
155 http://tuntaposx.sourceforge.net/])
156                         fi
157                         ;;
158                 freebsd*)
159                         AC_CHECK_HEADER([net/if_tun.h],
160                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
161                                 [warn_tuntap=yes])
162                         ;;
163         esac])
165 # Disable pcap support (pdump)? (depends on libpcap, maybe unwanted)
166 AC_ARG_ENABLE([pcap],
167         AS_HELP_STRING([--disable-pcap],
168                 [Disable pcap support (pdump plugin)]),
169         [if test $enableval = "no" ; then add_pcap=no ; warn_pcap=no ; fi])
171 AC_ARG_ENABLE([kernel-switch],
172         AS_HELP_STRING([--enable-kernel-switch],
173                 [Compile support for in-kernel switch. ]),
174         [if test $enableval = "yes"; then
175                 enable_kernel_switch=yes
176                 AC_DEFINE([USE_IPN], 1, [If defined, enable support for IPN socket])
177         fi])
179 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
180 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
181 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
182 AM_CONDITIONAL(CAN_MAKE_VDETUNCTL, test "$can_make_vdetunctl" = yes)
183 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
184 AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes)
185 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
186 AM_CONDITIONAL(ENABLE_KERNEL_SWITCH, test "$enable_kernel_switch" = yes)
188 if test "x${prefix}" = "xNONE"; then
189         AC_DEFINE_UNQUOTED(INSTALLPATH, "${ac_default_prefix}",[PREFIX])
190 else
191         AC_DEFINE_UNQUOTED(INSTALLPATH, "${prefix}",[PREFIX])
194 CFLAGS="-Wall -O2 $CFLAGS"
195 AC_SUBST(CFLAGS)
197 AC_CONFIG_FILES(
198                 [Makefile]
199                 [doc/Makefile]
200                 [include/Makefile]
201                 [man/Makefile]
202                 [src/Makefile]
203                 [src/lib/Makefile]
204                 [src/lib/vdesnmp.pc]
205                 [src/lib/vdemgmt.pc]
206                 [src/lib/vdeplug.pc]
207                 [src/lib/vdehist.pc]
208                 [src/vde_switch/Makefile]
209                 [src/kvde_switch/Makefile]
210                 [src/vde_over_ns/Makefile]
211                 [src/common/Makefile]
212                 [src/vdetaplib/Makefile]
213                 [src/vde_l3/Makefile]
214                 [src/vde_cryptcab/Makefile]
215                 [src/slirpvde/Makefile]
216                 [src/vde_switch/plugins/Makefile]
217                 )
218 AC_OUTPUT
221 echo
222 echo
223 echo "Configure results:"
224 echo
225 if test x$add_cryptcab_support = "xyes" ; then
226         echo " + VDE CryptCab............ enabled"
227 else
228         echo " - VDE CryptCab............ disabled"
231 if test x$warn_tuntap = "xyes" ; then
232         echo " - TAP support............. disabled"
233 else
234         echo " + TAP support............. enabled"
237 if test x$add_pcap = "xyes" ; then
238         echo " + pcap support............ enabled"
239 else
240         echo " - pcap support............ disabled"
243 if test x$enable_experimental = "xyes" ; then
244         echo " + Experimental features... enabled"
245 else
246         echo " - Experimental features... disabled"
249 if test x$enable_profile = "xyes" ; then
250         echo " + Profiling options....... enabled"
251 else
252         echo " - Profiling options....... disabled"
255 if test x$enable_kernel_switch = "xyes" ; then
256         echo " + Kernel switch........... enabled"
257 else
258         echo " - Kernel switch........... disabled"
261 echo
262 echo
263 if ! test x$add_cryptcab_support = "xyes" ; then
264         if test x$warn_cryptcab = "xyes" ; then
265                 AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
266 not installed on your system, or because openssl/blowfish.h could not be
267 found. Please install them if you want CryptCab to be compiled and installed.])
268         fi
271 if ! test x$add_pcap = "xyes" ; then
272         if test x$warn_pcap = "xyes" ; then
273                 AC_MSG_WARN([VDE vde_pcapplug and packet dump plugin have been disabled because
274 libpcap is not installed on your system, or because it's too old.
275 Please install it if you want vde_pcapplug and pdump to be compiled and installed.])
276         fi
279 echo
280 echo "Type 'make' to compile $PACKAGE $VERSION"
281 echo "and then type 'make install' to install it into $prefix"
282 echo