1 dnl Process this file with autoconf to produce a configure script.
3 dnl $Id: configure.in,v 1.13.2.85 2003/10/08 11:34:55 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 ]
76 AC_MSG_ERROR("Unknown operating system.")
82 if test -d /sw/include ; then
83 CPPFLAGS="$CPPFLAGS -I/sw/include"
85 if test -d /sw/lib ; then
86 LIBS="$LIBS -L/sw/lib"
89 dnl Checks for libraries.
91 dnl Checks for header files.
92 dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
95 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])
96 AC_CHECK_HEADERS([net/if.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h],
98 [#ifdef HAVE_SYS_TYPES_H
99 #include <sys/types.h>
104 #ifdef HAVE_ARPA_INET_H
105 #include <arpa/inet.h>
107 #ifdef HAVE_SYS_SOCKET_H
108 #include <sys/socket.h>
112 AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
114 [#ifdef HAVE_SYS_TYPES_H
115 #include <sys/types.h>
120 #ifdef HAVE_ARPA_INET_H
121 #include <arpa/inet.h>
123 #ifdef HAVE_SYS_SOCKET_H
124 #include <sys/socket.h>
129 #ifdef HAVE_NETINET_IN_SYSTM_H
130 #include <netinet/in_systm.h>
132 #ifdef HAVE_NETINET_IN_H
133 #include <netinet/in.h>
135 #ifdef HAVE_NETINET_IN6_H
136 #include <netinet/in6.h>
138 #ifdef HAVE_NET_ETHERNET_H
139 #include <net/ethernet.h>
141 #ifdef HAVE_NET_IF_ARP_H
142 #include <net/if_arp.h>
146 AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
148 [#ifdef HAVE_SYS_TYPES_H
149 #include <sys/types.h>
154 #ifdef HAVE_ARPA_INET_H
155 #include <arpa/inet.h>
157 #ifdef HAVE_SYS_SOCKET_H
158 #include <sys/socket.h>
163 #ifdef HAVE_NETINET_IN_SYSTM_H
164 #include <netinet/in_systm.h>
166 #ifdef HAVE_NETINET_IN_H
167 #include <netinet/in.h>
169 #ifdef HAVE_NETINET_IP_H
170 #include <netinet/ip.h>
172 #ifdef HAVE_NETINET_IN6_H
173 #include <netinet/in6.h>
175 #ifdef HAVE_NETINET_IP6_H
176 #include <netinet/ip6.h>
178 #ifdef HAVE_NET_ETHERNET_H
179 #include <net/ethernet.h>
181 #ifdef HAVE_NET_IF_ARP_H
182 #include <net/if_arp.h>
184 #ifdef HAVE_NETINET_IF_ETHER_H
185 #include <netinet/if_ether.h>
190 dnl Checks for typedefs, structures, and compiler characteristics.
198 tinc_ATTRIBUTE(__malloc__)
200 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], , ,
201 [#ifdef HAVE_SYS_TYPES_H
202 #include <sys/types.h>
207 #ifdef HAVE_ARPA_INET_H
208 #include <arpa/inet.h>
210 #ifdef HAVE_SYS_SOCKET_H
211 #include <sys/socket.h>
216 #ifdef HAVE_NETINET_IN_SYSTM_H
217 #include <netinet/in_systm.h>
219 #ifdef HAVE_NETINET_IN_H
220 #include <netinet/in.h>
222 #ifdef HAVE_NETINET_IP_H
223 #include <netinet/ip.h>
225 #ifdef HAVE_NETINET_TCP_H
226 #include <netinet/tcp.h>
228 #ifdef HAVE_NETINET_IN6_H
229 #include <netinet/in6.h>
231 #ifdef HAVE_NETINET_IP6_H
232 #include <netinet/ip6.h>
234 #ifdef HAVE_NET_ETHERNET_H
235 #include <net/ethernet.h>
237 #ifdef HAVE_NET_IF_ARP_H
238 #include <net/if_arp.h>
240 #ifdef HAVE_NETINET_IF_ETHER_H
241 #include <netinet/if_ether.h>
243 #ifdef HAVE_NETINET_IP_ICMP_H
244 #include <netinet/ip_icmp.h>
246 #ifdef HAVE_NETINET_ICMP6_H
247 #include <netinet/icmp6.h>
252 dnl Checks for library functions.
256 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])
260 dnl Support for SunOS
262 AC_CHECK_FUNC(socket, [], [
263 AC_CHECK_LIB(socket, connect)
265 AC_CHECK_FUNC(gethostbyname, [], [
266 AC_CHECK_LIB(nsl, gethostbyname)
269 AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton])
273 dnl These are defined in files in m4/
285 dnl Check if support for jumbograms is requested
286 AC_ARG_ENABLE(jumbograms,
287 AC_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
288 [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
291 dnl Check if checkpoint tracing has to be enabled
292 AC_ARG_ENABLE(tracing,
293 AC_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]),
294 [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]
299 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])