1 dnl Process this file with autoconf to produce a configure script.
3 dnl $Id: configure.in,v 1.13.2.79 2003/08/02 15:32:57 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; cp -f src/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.
91 dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
94 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])
95 AC_CHECK_HEADERS([net/if.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h],
97 [#ifdef HAVE_SYS_TYPES_H
98 #include <sys/types.h>
103 #ifdef HAVE_ARPA_INET_H
104 #include <arpa/inet.h>
106 #ifdef HAVE_SYS_SOCKET_H
107 #include <sys/socket.h>
111 AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
113 [#ifdef HAVE_SYS_TYPES_H
114 #include <sys/types.h>
119 #ifdef HAVE_ARPA_INET_H
120 #include <arpa/inet.h>
122 #ifdef HAVE_SYS_SOCKET_H
123 #include <sys/socket.h>
128 #ifdef HAVE_NETINET_IN_SYSTM_H
129 #include <netinet/in_systm.h>
131 #ifdef HAVE_NETINET_IN_H
132 #include <netinet/in.h>
134 #ifdef HAVE_NETINET_IN6_H
135 #include <netinet/in6.h>
137 #ifdef HAVE_NET_ETHERNET_H
138 #include <net/ethernet.h>
140 #ifdef HAVE_NET_IF_ARP_H
141 #include <net/if_arp.h>
145 AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
147 [#ifdef HAVE_SYS_TYPES_H
148 #include <sys/types.h>
153 #ifdef HAVE_ARPA_INET_H
154 #include <arpa/inet.h>
156 #ifdef HAVE_SYS_SOCKET_H
157 #include <sys/socket.h>
162 #ifdef HAVE_NETINET_IN_SYSTM_H
163 #include <netinet/in_systm.h>
165 #ifdef HAVE_NETINET_IN_H
166 #include <netinet/in.h>
168 #ifdef HAVE_NETINET_IP_H
169 #include <netinet/ip.h>
171 #ifdef HAVE_NETINET_IN6_H
172 #include <netinet/in6.h>
174 #ifdef HAVE_NETINET_IP6_H
175 #include <netinet/ip6.h>
177 #ifdef HAVE_NET_ETHERNET_H
178 #include <net/ethernet.h>
180 #ifdef HAVE_NET_IF_ARP_H
181 #include <net/if_arp.h>
183 #ifdef HAVE_NETINET_IF_ETHER_H
184 #include <netinet/if_ether.h>
189 dnl Checks for typedefs, structures, and compiler characteristics.
197 tinc_ATTRIBUTE(__malloc__)
199 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], , ,
200 [#ifdef HAVE_SYS_TYPES_H
201 #include <sys/types.h>
206 #ifdef HAVE_ARPA_INET_H
207 #include <arpa/inet.h>
209 #ifdef HAVE_SYS_SOCKET_H
210 #include <sys/socket.h>
215 #ifdef HAVE_NETINET_IN_SYSTM_H
216 #include <netinet/in_systm.h>
218 #ifdef HAVE_NETINET_IN_H
219 #include <netinet/in.h>
221 #ifdef HAVE_NETINET_IP_H
222 #include <netinet/ip.h>
224 #ifdef HAVE_NETINET_TCP_H
225 #include <netinet/tcp.h>
227 #ifdef HAVE_NETINET_IN6_H
228 #include <netinet/in6.h>
230 #ifdef HAVE_NETINET_IP6_H
231 #include <netinet/ip6.h>
233 #ifdef HAVE_NET_ETHERNET_H
234 #include <net/ethernet.h>
236 #ifdef HAVE_NET_IF_ARP_H
237 #include <net/if_arp.h>
239 #ifdef HAVE_NETINET_IF_ETHER_H
240 #include <netinet/if_ether.h>
242 #ifdef HAVE_NETINET_IP_ICMP_H
243 #include <netinet/ip_icmp.h>
245 #ifdef HAVE_NETINET_ICMP6_H
246 #include <netinet/icmp6.h>
251 dnl Checks for library functions.
255 AC_CHECK_FUNCS([asprintf daemon fcloseall flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol unsetenv vsyslog])
259 dnl Support for SunOS
261 AC_CHECK_FUNC(socket, [], [
262 AC_CHECK_LIB(socket, connect)
264 AC_CHECK_FUNC(gethostbyname, [], [
265 AC_CHECK_LIB(nsl, gethostbyname)
268 AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton])
272 dnl These are defined in files in m4/
284 dnl Check if support for jumbograms is requested
285 AC_ARG_ENABLE(jumbograms,
286 AC_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
287 [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
290 dnl Check if checkpoint tracing has to be enabled
291 AC_ARG_ENABLE(tracing,
292 AC_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]),
293 [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]