Update configure scripts.
[tinc] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl $Id: configure.in,v 1.13.2.73 2003/07/29 11:50:39 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; ln -sf mingw/device.c src/device.c ]
73   ;;
74   *)
75     AC_MSG_ERROR("Unknown operating system.")
76   ;;
77 esac
78
79 AC_CACHE_SAVE
80
81 if test -d /sw/include ; then
82   CPPFLAGS="$CPPFLAGS -I/sw/include"
83 fi
84 if test -d /sw/lib ; then
85   LIBS="$LIBS -L/sw/lib"
86 fi
87
88 dnl Checks for libraries.
89
90 dnl Checks for header files.
91 AC_HEADER_STDC
92 AC_CHECK_HEADERS([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],
94   [], [],
95   [#ifdef HAVE_SYS_TYPES_H
96    #include <sys/types.h>
97    #endif
98    #ifdef HAVE_SYS_SOCKET_H
99    #include <sys/socket.h>
100    #endif
101    #ifdef HAVE_NETINET_IN_SYSTM_H
102    #include <netinet/in_systm.h>
103    #endif
104    #ifdef HAVE_NETINET_IN_H
105    #include <netinet/in.h>
106    #endif
107   ]
108 )
109
110 dnl Checks for typedefs, structures, and compiler characteristics.
111 AC_C_CONST
112 AC_TYPE_PID_T
113 AC_TYPE_SIZE_T
114 AC_HEADER_TIME
115 AC_STRUCT_TM
116
117 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], , ,
118   [#ifdef HAVE_SYS_TYPES_H
119    #include <sys/types.h>
120    #endif
121    #ifdef HAVE_SYS_SOCKET_H
122    #include <sys/socket.h>
123    #endif
124    #ifdef HAVE_NETDB_H
125    #include <netdb.h>
126    #endif
127    #ifdef HAVE_NET_IF_ARP_H
128    #include <net/if_arp.h>
129    #endif
130    #ifdef HAVE_NETINET_IF_ETHER_H
131    #include <netinet/if_ether.h>
132    #endif
133    #ifdef HAVE_NETINET_IN_SYSTM_H
134    #include <netinet/in_systm.h>
135    #endif
136    #ifdef HAVE_NETINET_IN_H
137    #include <netinet/in.h>
138    #endif
139    #ifdef HAVE_NETINET_IP_H
140    #include <netinet/ip.h>
141    #endif
142    #ifdef HAVE_NETINET_IP_ICMP_H
143    #include <netinet/ip_icmp.h>
144    #endif
145    #ifdef HAVE_NETINET_IP6_H
146    #include <netinet/ip6.h>
147    #endif
148    #ifdef HAVE_NETINET_ICMP6_H
149    #include <netinet/icmp6.h>
150    #endif
151   ]
152 )
153
154 dnl Checks for library functions.
155 AC_FUNC_MEMCMP
156 AC_FUNC_ALLOCA
157 AC_TYPE_SIGNAL
158 AC_CHECK_FUNCS([asprintf daemon fcloseall flock ftime fork get_current_dir_name gettimeofday mlockall putenv select strdup strerror strsignal strtol unsetenv vsyslog])
159 jm_FUNC_MALLOC
160 jm_FUNC_REALLOC
161
162 dnl Support for SunOS
163
164 AC_CHECK_FUNC(socket, [], [
165   AC_CHECK_LIB(socket, connect)
166 ])
167 AC_CHECK_FUNC(gethostbyname, [], [
168   AC_CHECK_LIB(nsl, gethostbyname)
169 ])
170
171 AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton])
172
173 AC_CACHE_SAVE
174
175 dnl These are defined in files in m4/
176
177 case $host_os in
178   *linux*)
179     tinc_TUNTAP
180   ;;
181 esac
182
183 tinc_OPENSSL
184 tinc_ZLIB
185 tinc_LZO
186
187 dnl Check if support for jumbograms is requested 
188 AC_ARG_ENABLE(jumbograms,
189   AC_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
190   [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
191 )
192
193 dnl Check if checkpoint tracing has to be enabled
194 AC_ARG_ENABLE(tracing,
195   AC_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]),
196   [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]
197 )
198
199 AC_SUBST(INCLUDES)
200
201 AC_OUTPUT(Makefile 
202 src/Makefile
203 doc/Makefile
204 doc/es/Makefile
205 lib/Makefile
206 po/Makefile.in
207 m4/Makefile
208 )