If we're not in main_loop() and the service is stopped, exit immediately.
[oweals/tinc.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl $Id: configure.in,v 1.13.2.83 2003/08/08 22:13:50 guus Exp $
4
5 AC_PREREQ(2.57)
6 AC_INIT(src/tincd.c)
7 AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
8 AM_CONFIG_HEADER(config.h)
9 AM_MAINTAINER_MODE
10
11 dnl Include the macros from the m4/ directory
12 AM_ACLOCAL_INCLUDE(m4)
13
14 AM_GNU_GETTEXT([external])
15 AM_GNU_GETTEXT_VERSION(0.12.1)
16
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])
22
23 ALL_LINGUAS="nl"
24
25 dnl Checks for programs.
26 AC_PROG_CC
27 AC_PROG_CPP
28 AC_PROG_GCC_TRADITIONAL
29 AC_PROG_AWK
30 AC_PROG_INSTALL
31 AC_PROG_LN_S
32 AC_PROG_MAKE_SET
33 AC_PROG_RANLIB
34
35 AC_ISC_POSIX
36
37 dnl Check and set OS
38
39 #AC_CANONICAL_HOST
40
41 case $host_os in
42   *linux*)
43     AC_DEFINE(HAVE_LINUX, 1, [Linux])
44     [ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
45   ;;
46   *freebsd*)
47     AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
48     [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ]
49   ;;
50   *darwin*)
51     AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
52     [ rm -f src/device.c; ln -sf darwin/device.c src/device.c ]
53   ;;
54   *solaris*)
55     AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
56     [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
57   ;;
58   *openbsd*)
59     AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
60     [ rm -f src/device.c; ln -sf openbsd/device.c src/device.c ]
61   ;;
62   *netbsd*)
63     AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
64     [ rm -f src/device.c; ln -sf netbsd/device.c src/device.c ]
65   ;;
66   *cygwin*)
67     AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
68     [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ]
69   ;;
70   *mingw*)
71     AC_DEFINE(HAVE_MINGW, 1, [MinGW])
72     [ rm -f src/device.c; cp -f src/mingw/device.c src/device.c ]
73     LIBS="$LIBS -lws2_32"
74   ;;
75   *)
76     AC_MSG_ERROR("Unknown operating system.")
77   ;;
78 esac
79
80 AC_CACHE_SAVE
81
82 if test -d /sw/include ; then
83   CPPFLAGS="$CPPFLAGS -I/sw/include"
84 fi
85 if test -d /sw/lib ; then
86   LIBS="$LIBS -L/sw/lib"
87 fi
88
89 dnl Checks for libraries.
90
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.
93
94 AC_HEADER_STDC
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],
97   [], [],
98   [#ifdef HAVE_SYS_TYPES_H
99    #include <sys/types.h>
100    #endif
101    #ifdef HAVE_NETDB_H
102    #include <netdb.h>
103    #endif
104    #ifdef HAVE_ARPA_INET_H
105    #include <arpa/inet.h>
106    #endif
107    #ifdef HAVE_SYS_SOCKET_H
108    #include <sys/socket.h>
109    #endif
110   ]
111 )
112 AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
113   [], [],
114   [#ifdef HAVE_SYS_TYPES_H
115    #include <sys/types.h>
116    #endif
117    #ifdef HAVE_NETDB_H
118    #include <netdb.h>
119    #endif
120    #ifdef HAVE_ARPA_INET_H
121    #include <arpa/inet.h>
122    #endif
123    #ifdef HAVE_SYS_SOCKET_H
124    #include <sys/socket.h>
125    #endif
126    #ifdef HAVE_NET_IF_H
127    #include <net/if.h>
128    #endif
129    #ifdef HAVE_NETINET_IN_SYSTM_H
130    #include <netinet/in_systm.h>
131    #endif
132    #ifdef HAVE_NETINET_IN_H
133    #include <netinet/in.h>
134    #endif
135    #ifdef HAVE_NETINET_IN6_H
136    #include <netinet/in6.h>
137    #endif
138    #ifdef HAVE_NET_ETHERNET_H
139    #include <net/ethernet.h>
140    #endif
141    #ifdef HAVE_NET_IF_ARP_H
142    #include <net/if_arp.h>
143    #endif
144   ]
145 )
146 AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
147   [], [],
148   [#ifdef HAVE_SYS_TYPES_H
149    #include <sys/types.h>
150    #endif
151    #ifdef HAVE_NETDB_H
152    #include <netdb.h>
153    #endif
154    #ifdef HAVE_ARPA_INET_H
155    #include <arpa/inet.h>
156    #endif
157    #ifdef HAVE_SYS_SOCKET_H
158    #include <sys/socket.h>
159    #endif
160    #ifdef HAVE_NET_IF_H
161    #include <net/if.h>
162    #endif
163    #ifdef HAVE_NETINET_IN_SYSTM_H
164    #include <netinet/in_systm.h>
165    #endif
166    #ifdef HAVE_NETINET_IN_H
167    #include <netinet/in.h>
168    #endif
169    #ifdef HAVE_NETINET_IP_H
170    #include <netinet/ip.h>
171    #endif
172    #ifdef HAVE_NETINET_IN6_H
173    #include <netinet/in6.h>
174    #endif
175    #ifdef HAVE_NETINET_IP6_H
176    #include <netinet/ip6.h>
177    #endif
178    #ifdef HAVE_NET_ETHERNET_H
179    #include <net/ethernet.h>
180    #endif
181    #ifdef HAVE_NET_IF_ARP_H
182    #include <net/if_arp.h>
183    #endif
184    #ifdef HAVE_NETINET_IF_ETHER_H
185    #include <netinet/if_ether.h>
186    #endif
187   ]
188 )
189
190 dnl Checks for typedefs, structures, and compiler characteristics.
191 AC_C_CONST
192 AC_C_VOLATILE
193 AC_TYPE_PID_T
194 AC_TYPE_SIZE_T
195 AC_HEADER_TIME
196 AC_STRUCT_TM
197
198 tinc_ATTRIBUTE(__malloc__)
199
200 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], , ,
201   [#ifdef HAVE_SYS_TYPES_H
202    #include <sys/types.h>
203    #endif
204    #ifdef HAVE_NETDB_H
205    #include <netdb.h>
206    #endif
207    #ifdef HAVE_ARPA_INET_H
208    #include <arpa/inet.h>
209    #endif
210    #ifdef HAVE_SYS_SOCKET_H
211    #include <sys/socket.h>
212    #endif
213    #ifdef HAVE_NET_IF_H
214    #include <net/if.h>
215    #endif
216    #ifdef HAVE_NETINET_IN_SYSTM_H
217    #include <netinet/in_systm.h>
218    #endif
219    #ifdef HAVE_NETINET_IN_H
220    #include <netinet/in.h>
221    #endif
222    #ifdef HAVE_NETINET_IP_H
223    #include <netinet/ip.h>
224    #endif
225    #ifdef HAVE_NETINET_TCP_H
226    #include <netinet/tcp.h>
227    #endif
228    #ifdef HAVE_NETINET_IN6_H
229    #include <netinet/in6.h>
230    #endif
231    #ifdef HAVE_NETINET_IP6_H
232    #include <netinet/ip6.h>
233    #endif
234    #ifdef HAVE_NET_ETHERNET_H
235    #include <net/ethernet.h>
236    #endif
237    #ifdef HAVE_NET_IF_ARP_H
238    #include <net/if_arp.h>
239    #endif
240    #ifdef HAVE_NETINET_IF_ETHER_H
241    #include <netinet/if_ether.h>
242    #endif
243    #ifdef HAVE_NETINET_IP_ICMP_H
244    #include <netinet/ip_icmp.h>
245    #endif
246    #ifdef HAVE_NETINET_ICMP6_H
247    #include <netinet/icmp6.h>
248    #endif
249   ]
250 )
251
252 dnl Checks for library functions.
253 AC_FUNC_MEMCMP
254 AC_FUNC_ALLOCA
255 AC_TYPE_SIGNAL
256 AC_CHECK_FUNCS([asprintf daemon fchmod fcloseall flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system unsetenv vsyslog])
257 jm_FUNC_MALLOC
258 jm_FUNC_REALLOC
259
260 dnl Support for SunOS
261
262 AC_CHECK_FUNC(socket, [], [
263   AC_CHECK_LIB(socket, connect)
264 ])
265 AC_CHECK_FUNC(gethostbyname, [], [
266   AC_CHECK_LIB(nsl, gethostbyname)
267 ])
268
269 AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton])
270
271 AC_CACHE_SAVE
272
273 dnl These are defined in files in m4/
274
275 case $host_os in
276   *linux*)
277     tinc_TUNTAP
278   ;;
279 esac
280
281 tinc_OPENSSL
282 tinc_ZLIB
283 tinc_LZO
284
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)]) ]
289 )
290
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]) ]
295 )
296
297 AC_SUBST(INCLUDES)
298
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])
300
301 AC_OUTPUT