readchar fix
[vde.git] / vde-2 / configure.ac
blob264b8b6a2bdcca83f1fc49ff2d574fcbb767e354
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT(vde2, [2.2.0-pre1], 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.])
66         else
67                 AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
68                 AC_MSG_RESULT([no])
69         fi
71 # All other nice checks I have to make for recostructing missing parts of
72 # slirp's config.h file
73 AC_CHECK_SIZEOF(char)
74 AC_CHECK_SIZEOF(short)
75 AC_CHECK_SIZEOF(int)
76 AC_CHECK_SIZEOF(char *)
78 # Define VDE_LINUX or VDE_DARWIN
79 case "$build_os" in
80         linux*)
81                 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
82                 ;;
83         darwin*)
84                 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
85                 darwin_gcc=yes
86                 ;;
87         freebsd*)
88                 AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
89                 ;;
90         *)
91                 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
92 Linux, Darwin and FreeBSD are supported. Contributions are appreciated! :-)])
93                 ;;
94 esac
96 # Enable experimental features
97 AC_ARG_ENABLE([experimental],
98         AS_HELP_STRING([--enable-experimental],
99                 [Enable experimental features (async notifies, plugin support, packet counter)]),
100         [if test $enableval = "yes"; then enable_experimental=yes; fi])
102 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
103 AC_ARG_ENABLE([cryptcab],
104         AS_HELP_STRING([--disable-cryptcab],
105                 [Disable libcrypto-dependend vde_cryptcab compilation]),
106         [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
108 # Check of tuntap device
109 AC_ARG_ENABLE([tuntap],
110     AS_HELP_STRING([--disable-tuntap],
111       [Disable tuntap compilation]), [:],
112         [case "$build_os" in
113                 linux*)
114                         AC_CHECK_HEADER([linux/if_tun.h],
115                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
116                                 [warn_tuntap=yes])
117                         can_make_libvdetap=yes
118                         ;;
119                 darwin*)
120                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
121                         for i in /dev/tap0 /Library/Extensions/tap.kext /System/Library/Extensions/tap.kext ; do
122                                 AC_MSG_CHECKING([for $i])
123                                 if test -e "$i" ; then
124                                         AC_MSG_RESULT([yes])
125                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
126                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
127                                         eval HAVE_$definename=yes
128                                 else
129                                         AC_MSG_RESULT([no])
130                                         warn_tuntap=yes
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                                 warn_tuntap=yes
142                                 AC_MSG_WARN([You do not have tuntap support. You can get it here:
143 http://www-user.rhrk.uni-kl.de/~nissler/tuntap/])
144                         fi
145                         ;;
146                 freebsd*)
147                         AC_CHECK_HEADER([net/if_tun.h],
148                                 [AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
149                                 [warn_tuntap=yes])
150                         ;;
151         esac])
153 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
154 AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
155 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
156 AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
157 AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
159 if test "x${prefix}" = "xNONE"; then
160         AC_DEFINE_UNQUOTED(INSTALLPATH, "${ac_default_prefix}",[PREFIX])
161 else
162         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                 [libvdesnmp/Makefile])
187 AC_OUTPUT
190 echo
191 echo
192 echo "Configure results:"
193 echo
194 if test x$add_cryptcab_support = "xyes" ; then
195         echo " vde_cryptcab : enabled"
196 else
197         echo " vde_cryptcab : disabled"
198         if test x$warn_cryptcab = "xyes" ; then
199                 AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
200 not installed on your system, or because openssl/blowfish.h could not be
201 found. Please install them if you want CryptCab to be compiled and installed.])
202         fi
204 if test x$warn_tuntap = "xyes" ; then
205         echo " tuntap support : disabled"
206 else
207         echo " tuntap support : enabled"
209 if test x$warn_pcap = "xyes" ; then
210         echo " pcap support : disabled"
211         AC_MSG_WARN([VDE packet dump plugin has been disabled because libpcap is
212 not installed on your system, or because it's too old.
213 Please install it if you want pdump to be compiled and installed.])
214 else
215         echo " pcap support : enabled"
217 if test x$enable_experimental = "xyes" ; then
218         echo " experimental features : enabled"
219 else
220         echo " experimental features : disabled"
222 echo
223 echo "Type 'make' to compile $PACKAGE $VERSION"
224 echo "and then type 'make install' to install it into $prefix"
225 echo