syslimits.h fix for OSX
[vde.git] / vde-2 / configure.ac
blob3314781ae400d0b43573b89dd8cdcee63ba3e762
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT(vde2, [2.1.5], renzo@cs.unibo.it)
6 AM_INIT_AUTOMAKE([foreign])
7 AC_CONFIG_SRCDIR([vde.h])
8 AC_CONFIG_HEADER([config.h])
10 # Checks for programs.
11 AC_PROG_CXX
12 AC_PROG_CC
13 AC_PROG_INSTALL
14 AC_PROG_LN_S
15 AC_PROG_LIBTOOL
17 # Checks for libraries.
18 AC_CHECK_LIB([dl], [dlopen])
19 AC_CHECK_LIB([crypto], [EVP_EncryptInit],
20                 [add_cryptcab_support=yes],
21                 [add_cryptcab_support=no ; warn_cryptcab=yes])
23 # Checks for header files.
24 AC_HEADER_STDC
25 AC_HEADER_SYS_WAIT
26 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])
28 AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
30 AC_CHECK_HEADERS([openssl/blowfish.h],
31                  [],
32                  [add_cryptcab_support=no ; warn_cryptcab=yes])
34 # Checks for typedefs, structures, and compiler characteristics.
35 AC_C_CONST
36 AC_C_INLINE
37 AC_C_BIGENDIAN
38 AC_C_PROTOTYPES
39 AC_TYPE_MODE_T
40 AC_TYPE_PID_T
41 AC_TYPE_SIZE_T
42 AC_HEADER_TIME
44 # Checks for library functions.
45 AC_FUNC_CHOWN
46 AC_FUNC_FORK
47 AC_PROG_GCC_TRADITIONAL
48 AC_FUNC_MALLOC
49 AC_FUNC_MEMCMP
50 AC_FUNC_REALLOC
51 AC_FUNC_SELECT_ARGTYPES
52 AC_TYPE_SIGNAL
53 AC_FUNC_VPRINTF
54 AC_CHECK_FUNCS([atexit dup2 gethostbyname gethostname gettimeofday inet_ntoa memmove memset putenv select setenv socket strchr strdup strndup strerror strstr uname inet_aton sprintf readv random srandom index bcmp drand48 memmove gethostid revoke fchmod getopt_long_only])
56 # All other nice checks I have to make for recostructing missing parts of
57 # slirp's config.h file
58 AC_CHECK_SIZEOF(char)
59 AC_CHECK_SIZEOF(short)
60 AC_CHECK_SIZEOF(int)
61 AC_CHECK_SIZEOF(char *)
63 # Define VDE_LINUX or VDE_DARWIN
64 case "$build_os" in
65         linux*)
66                 AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
67                 ;;
68         darwin*)
69                 AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
70                 ;;
71         *)
72                 AC_MSG_ERROR([Unsupported architecture: $build_os. At the moment, only
73 Linux and Darwin are supported. Contributions are appreciated! :-)])
74                 ;;
75 esac
78 # Disable vde_cryptcab? (depends on ssl, maybe unwanted)
79 AC_ARG_ENABLE([cryptcab],
80         AS_HELP_STRING([--disable-cryptcab],
81                 [Disable libcrypto-dependend vde_cryptcab compilation]),
82         [if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
84 # Check of tuntap device
85 AC_ARG_ENABLE([tuntap],
86     AS_HELP_STRING([--disable-tuntap],
87       [Disable tuntap compilation]),
88     [if test $enableval != "no" ; then add_tuntap_support=yes ; else add_tuntap_support=no ; fi],
89     [add_tuntap_support=yes])
91 # Check for tuntap support for Linux and OSX
92 if test "$add_tuntap_support" = yes ; then
93         case "$build_os" in
94                 linux*)
95                         AC_CHECK_HEADER([linux/if_tun.h],
96                                 [AC_DEFINE([TUNTAP], 1, [If defined, tuntap support is compiled in])],
97                                 [AC_MSG_ERROR([Tuntap support seem to be not enabled on your kernel])])
98                         can_make_libvdetap=yes
99                         ;;
100                 darwin*)
101                         # I don't use AC_CHECK_FILES because I need test -e and not test -r
102                         for i in /dev/tap0 /Library/Extensions/tap.kext /System/Library/Extensions/tap.kext ; do
103                                 AC_MSG_CHECKING([for $i])
104                                 if test -e "$i" ; then
105                                         AC_MSG_RESULT([yes])
106                                         definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
107                                         AC_DEFINE_UNQUOTED([HAVE_$definename])
108                                         eval HAVE_$definename=yes
109                                 else
110                                         AC_MSG_RESULT([no])
111                                 fi
112                         done
113                         
114                         if test "$HAVE__DEV_TAP0_" ; then
115                                 AC_DEFINE([TUNTAP], 1, [If defined, tuntap support is compiled in])
116                                 if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" -o "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
117                                         AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
118 configuration does work...])
119                                 fi
120                                 AC_MSG_CHECKING([for broken poll() support in Tiger])
121                                 if expr "$build_os" : "darwin8\..*" > /dev/null; then
122                                         AC_MSG_RESULT([yes, emulating with select()])
123                                         AC_DEFINE([HAVE_BROKEN_POLL], 1, [If defined, use poll2select])
124                                         have_broken_poll=yes
125                                 else
126                                         AC_MSG_RESULT([no])
127                                 fi
128                         else
129                                 AC_MSG_ERROR([You do not have tuntap support. You can get it here:
130 http://www-user.rhrk.uni-kl.de/~nissler/tuntap/])
131                         fi
132                         ;;
133         esac
136 AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
137 AM_CONDITIONAL(WANT_TUNTAP, test "$add_tuntap_support" = yes)
138 AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
139 AM_CONDITIONAL(HAVE_BROKEN_POLL, test "$have_broken_poll" = yes)
141 AC_CONFIG_FILES([Makefile]
142                 [doc/Makefile]
143                 [qemu/Makefile]
144                 [slirpvde/Makefile]
145                 [vdetaplib/Makefile]
146                 [libvdeplug/Makefile]
147                 [vde_plug/Makefile]
148                 [vde_plug2tap/Makefile]
149                 [vde_cryptcab/Makefile]
150                 [bochs/Makefile]
151                 [dpipe/Makefile]
152                 [unixterm/Makefile]
153                 [wirefilter/Makefile]
154                 [uml/Makefile])
155 AC_OUTPUT
157 if test x$warn_cryptcab = "xyes"
158 then
159         AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
160 not installed on your system, or because openssl/blowfish.h could not be
161 found. Please install them if you want CryptCab to be compiled and installed.])