1 dnl Process this file with autoconf to produce a configure script.
7 AC_CONFIG_SRCDIR([src/tincd.c])
8 AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
9 AC_CONFIG_HEADERS([config.h])
12 dnl Include the macros from the m4/ directory
13 AM_ACLOCAL_INCLUDE(m4)
15 AM_GNU_GETTEXT([external])
16 AM_GNU_GETTEXT_VERSION(0.12.1)
18 # Enable GNU extensions.
19 # Define this here, not in acconfig's @TOP@ section, since definitions
20 # in the latter don't make it into the configure-time tests.
21 AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extenstions])
22 AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
26 dnl Checks for programs.
29 AC_PROG_GCC_TRADITIONAL
44 AC_DEFINE(HAVE_LINUX, 1, [Linux])
45 [ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
48 AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
49 [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ]
52 AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
53 [ rm -f src/device.c; ln -sf darwin/device.c src/device.c ]
56 AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
57 [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
60 AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
61 [ rm -f src/device.c; ln -sf openbsd/device.c src/device.c ]
64 AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
65 [ rm -f src/device.c; ln -sf netbsd/device.c src/device.c ]
68 AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
69 [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ]
72 AC_DEFINE(HAVE_MINGW, 1, [MinGW])
73 [ rm -f src/device.c; cp -f src/mingw/device.c src/device.c ]
77 AC_MSG_ERROR("Unknown operating system.")
83 if test -d /sw/include ; then
84 CPPFLAGS="$CPPFLAGS -I/sw/include"
86 if test -d /sw/lib ; then
87 LIBS="$LIBS -L/sw/lib"
90 dnl Checks for libraries.
92 dnl Checks for header files.
93 dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
96 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])
97 AC_CHECK_HEADERS([net/if.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h],
99 [#ifdef HAVE_SYS_TYPES_H
100 #include <sys/types.h>
105 #ifdef HAVE_ARPA_INET_H
106 #include <arpa/inet.h>
108 #ifdef HAVE_SYS_SOCKET_H
109 #include <sys/socket.h>
113 AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
115 [#ifdef HAVE_SYS_TYPES_H
116 #include <sys/types.h>
121 #ifdef HAVE_ARPA_INET_H
122 #include <arpa/inet.h>
124 #ifdef HAVE_SYS_SOCKET_H
125 #include <sys/socket.h>
130 #ifdef HAVE_NETINET_IN_SYSTM_H
131 #include <netinet/in_systm.h>
133 #ifdef HAVE_NETINET_IN_H
134 #include <netinet/in.h>
136 #ifdef HAVE_NETINET_IN6_H
137 #include <netinet/in6.h>
139 #ifdef HAVE_NET_ETHERNET_H
140 #include <net/ethernet.h>
142 #ifdef HAVE_NET_IF_ARP_H
143 #include <net/if_arp.h>
147 AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
149 [#ifdef HAVE_SYS_TYPES_H
150 #include <sys/types.h>
155 #ifdef HAVE_ARPA_INET_H
156 #include <arpa/inet.h>
158 #ifdef HAVE_SYS_SOCKET_H
159 #include <sys/socket.h>
164 #ifdef HAVE_NETINET_IN_SYSTM_H
165 #include <netinet/in_systm.h>
167 #ifdef HAVE_NETINET_IN_H
168 #include <netinet/in.h>
170 #ifdef HAVE_NETINET_IP_H
171 #include <netinet/ip.h>
173 #ifdef HAVE_NETINET_IN6_H
174 #include <netinet/in6.h>
176 #ifdef HAVE_NETINET_IP6_H
177 #include <netinet/ip6.h>
179 #ifdef HAVE_NET_ETHERNET_H
180 #include <net/ethernet.h>
182 #ifdef HAVE_NET_IF_ARP_H
183 #include <net/if_arp.h>
185 #ifdef HAVE_NETINET_IF_ETHER_H
186 #include <netinet/if_ether.h>
191 dnl Checks for typedefs, structures, and compiler characteristics.
199 tinc_ATTRIBUTE(__malloc__)
201 AC_CHECK_TYPES([socklen_t, struct ether_header, 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], , ,
202 [#ifdef HAVE_SYS_TYPES_H
203 #include <sys/types.h>
208 #ifdef HAVE_ARPA_INET_H
209 #include <arpa/inet.h>
211 #ifdef HAVE_SYS_SOCKET_H
212 #include <sys/socket.h>
217 #ifdef HAVE_NETINET_IN_SYSTM_H
218 #include <netinet/in_systm.h>
220 #ifdef HAVE_NETINET_IN_H
221 #include <netinet/in.h>
223 #ifdef HAVE_NETINET_IP_H
224 #include <netinet/ip.h>
226 #ifdef HAVE_NETINET_TCP_H
227 #include <netinet/tcp.h>
229 #ifdef HAVE_NETINET_IN6_H
230 #include <netinet/in6.h>
232 #ifdef HAVE_NETINET_IP6_H
233 #include <netinet/ip6.h>
235 #ifdef HAVE_NET_ETHERNET_H
236 #include <net/ethernet.h>
238 #ifdef HAVE_NET_IF_ARP_H
239 #include <net/if_arp.h>
241 #ifdef HAVE_NETINET_IF_ETHER_H
242 #include <netinet/if_ether.h>
244 #ifdef HAVE_NETINET_IP_ICMP_H
245 #include <netinet/ip_icmp.h>
247 #ifdef HAVE_NETINET_ICMP6_H
248 #include <netinet/icmp6.h>
253 dnl Checks for library functions.
257 AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system unsetenv vsyslog])
261 dnl Support for SunOS
263 AC_CHECK_FUNC(socket, [], [
264 AC_CHECK_LIB(socket, connect)
266 AC_CHECK_FUNC(gethostbyname, [], [
267 AC_CHECK_LIB(nsl, gethostbyname)
270 AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton])
274 dnl These are defined in files in m4/
286 dnl Check if support for jumbograms is requested
287 AC_ARG_ENABLE(jumbograms,
288 AS_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
289 [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
292 dnl Check if checkpoint tracing has to be enabled
293 AC_ARG_ENABLE(tracing,
294 AS_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]),
295 [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]
300 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile doc/tincd.8 doc/tinc.conf.5 doc/tincinclude.texi lib/Makefile po/Makefile.in m4/Makefile])