1 dnl Process this file with autoconf to produce a configure script.
3 dnl $Id: configure.in,v 1.13.2.77 2003/07/31 11:17:39 guus Exp $
7 AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
8 AM_CONFIG_HEADER(config.h)
11 dnl Include the macros from the m4/ directory
12 AM_ACLOCAL_INCLUDE(m4)
14 AM_GNU_GETTEXT([external])
15 AM_GNU_GETTEXT_VERSION(0.12.1)
17 # Enable GNU extensions.
18 # Define this here, not in acconfig's @TOP@ section, since definitions
19 # in the latter don't make it into the configure-time tests.
20 AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extenstions])
21 AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
25 dnl Checks for programs.
28 AC_PROG_GCC_TRADITIONAL
43 AC_DEFINE(HAVE_LINUX, 1, [Linux])
44 [ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
47 AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
48 [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ]
51 AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
52 [ rm -f src/device.c; ln -sf darwin/device.c src/device.c ]
55 AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
56 [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
59 AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
60 [ rm -f src/device.c; ln -sf openbsd/device.c src/device.c ]
63 AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
64 [ rm -f src/device.c; ln -sf netbsd/device.c src/device.c ]
67 AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
68 [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ]
71 AC_DEFINE(HAVE_MINGW, 1, [MinGW])
72 [ rm -f src/device.c; ln -sf mingw/device.c src/device.c ]
75 AC_MSG_ERROR("Unknown operating system.")
81 if test -d /sw/include ; then
82 CPPFLAGS="$CPPFLAGS -I/sw/include"
84 if test -d /sw/lib ; then
85 LIBS="$LIBS -L/sw/lib"
88 dnl Checks for libraries.
90 dnl Checks for header files.
92 AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/param.h sys/time.h sys/socket.h sys/wait.h sys/mman.h netdb.h arpa/inet.h netinet/in_systm.h netinet/in.h])
93 AC_CHECK_HEADERS([net/ethernet.h net/if.h net/if_arp.h netinet/if_ether.h netinet/ip.h netinet/tcp.h netinet/ip_icmp.h netinet/ip6.h netinet/icmp6.h],
95 [#ifdef HAVE_SYS_TYPES_H
96 #include <sys/types.h>
98 #ifdef HAVE_SYS_SOCKET_H
99 #include <sys/socket.h>
101 #ifdef HAVE_NETINET_IN_SYSTM_H
102 #include <netinet/in_systm.h>
104 #ifdef HAVE_NETINET_IN_H
105 #include <netinet/in.h>
110 dnl Checks for typedefs, structures, and compiler characteristics.
118 tinc_ATTRIBUTE(__malloc__)
120 AC_CHECK_TYPES([socklen_t, struct arphdr, struct ether_arp, struct in_addr, struct addrinfo, struct ip, struct icmp, struct in6_addr, struct sockaddr_in6, struct ip6_hdr, struct icmp6_hdr, struct nd_neighbor_solicit, struct nd_opt_hdr], , ,
121 [#ifdef HAVE_SYS_TYPES_H
122 #include <sys/types.h>
124 #ifdef HAVE_SYS_SOCKET_H
125 #include <sys/socket.h>
130 #ifdef HAVE_NET_IF_ARP_H
131 #include <net/if_arp.h>
133 #ifdef HAVE_NETINET_IF_ETHER_H
134 #include <netinet/if_ether.h>
136 #ifdef HAVE_NETINET_IN_SYSTM_H
137 #include <netinet/in_systm.h>
139 #ifdef HAVE_NETINET_IN_H
140 #include <netinet/in.h>
142 #ifdef HAVE_NETINET_IP_H
143 #include <netinet/ip.h>
145 #ifdef HAVE_NETINET_IP_ICMP_H
146 #include <netinet/ip_icmp.h>
148 #ifdef HAVE_NETINET_IP6_H
149 #include <netinet/ip6.h>
151 #ifdef HAVE_NETINET_ICMP6_H
152 #include <netinet/icmp6.h>
157 dnl Checks for library functions.
161 AC_CHECK_FUNCS([asprintf daemon fcloseall flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol unsetenv vsyslog])
165 dnl Support for SunOS
167 AC_CHECK_FUNC(socket, [], [
168 AC_CHECK_LIB(socket, connect)
170 AC_CHECK_FUNC(gethostbyname, [], [
171 AC_CHECK_LIB(nsl, gethostbyname)
174 AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton])
178 dnl These are defined in files in m4/
190 dnl Check if support for jumbograms is requested
191 AC_ARG_ENABLE(jumbograms,
192 AC_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
193 [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
196 dnl Check if checkpoint tracing has to be enabled
197 AC_ARG_ENABLE(tracing,
198 AC_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]),
199 [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]