1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
|
3 |
AC_PREREQ(2.57) |
4 |
AC_INIT(src/vped.C) |
5 |
AC_CANONICAL_TARGET |
6 |
AM_INIT_AUTOMAKE(vpe, 1.6) |
7 |
AM_CONFIG_HEADER(config.h) |
8 |
AM_MAINTAINER_MODE |
9 |
|
10 |
AH_TOP([ |
11 |
#ifndef CONFIG_H__ |
12 |
#define CONFIG_H__ |
13 |
|
14 |
#ifdef __cplusplus |
15 |
using namespace std; |
16 |
#endif |
17 |
|
18 |
]) |
19 |
|
20 |
AH_BOTTOM([ |
21 |
#if __CYGWIN__ |
22 |
|
23 |
typedef unsigned char u8; |
24 |
typedef unsigned short u16; |
25 |
typedef unsigned int u32; |
26 |
|
27 |
#else |
28 |
#include <inttypes.h> |
29 |
|
30 |
/* old modula-2 habits */ |
31 |
typedef unsigned char u8; |
32 |
typedef uint16_t u16; |
33 |
typedef uint32_t u32; |
34 |
#endif |
35 |
|
36 |
#endif |
37 |
]) |
38 |
|
39 |
dnl Include the macros from the m4/ directory |
40 |
AM_ACLOCAL_INCLUDE(m4) |
41 |
|
42 |
AM_GNU_GETTEXT([external]) |
43 |
AM_GNU_GETTEXT_VERSION(0.11.5) |
44 |
|
45 |
# Enable GNU extensions. |
46 |
# Define this here, not in acconfig's @TOP@ section, since definitions |
47 |
# in the latter don't make it into the configure-time tests. |
48 |
AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extenstions]) |
49 |
|
50 |
# do NOT define POSIX_SOURCE, sicne this clashes with many BSDs |
51 |
dnl AC_DEFINE([_POSIX_SOURCE], 1, [Enable POSIX 1003.1 extensions]) |
52 |
dnl AC_DEFINE([_XOPEN_SOURCE], 500, [Enable XOPEN extensions]) |
53 |
|
54 |
ALL_LINGUAS="" |
55 |
|
56 |
dnl Checks for programs. |
57 |
AC_PROG_CC |
58 |
AC_PROG_CPP |
59 |
AC_PROG_CXX |
60 |
AC_PROG_GCC_TRADITIONAL |
61 |
AC_PROG_AWK |
62 |
AC_PROG_INSTALL |
63 |
AC_PROG_LN_S |
64 |
AC_PROG_MAKE_SET |
65 |
AC_PROG_RANLIB |
66 |
|
67 |
AC_ARG_ENABLE(iftype, |
68 |
[AC_HELP_STRING(--enable-iftype[=TYPE/SUBTYPE], [ |
69 |
Use kernel/net device interface TYPE/SUBTYPE. |
70 |
Working combinations are: |
71 |
"native/linux" |
72 |
"tincd/linux" |
73 |
"tincd/freebsd" |
74 |
"tincd/openbsd" |
75 |
"tincd/darwin" |
76 |
"native/cygwin"; |
77 |
Untested combinations are: |
78 |
"tincd/netbsd" |
79 |
"tincd/solaris" |
80 |
"tincd/mingw"; |
81 |
Broken combinations are: |
82 |
"tincd/cygwin"; |
83 |
The default is to autodetect. |
84 |
])], |
85 |
[ |
86 |
IFTYPE=`echo $enableval | sed s%/.*%%` |
87 |
IFSUBTYPE=`echo $enableval | sed s%.*/%%` |
88 |
] |
89 |
) |
90 |
|
91 |
dnl Check and set OS |
92 |
AC_MSG_CHECKING(for kernel networking interface type) |
93 |
|
94 |
if test "x$IFTYPE" = "x"; then |
95 |
case $target_os in |
96 |
*linux*) |
97 |
IFTYPE=native |
98 |
IFSUBTYPE=linux |
99 |
AC_DEFINE(HAVE_LINUX, 1, [Linux]) |
100 |
;; |
101 |
*freebsd*) |
102 |
IFTYPE=tincd |
103 |
IFSUBTYPE=freebsd |
104 |
AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD]) |
105 |
;; |
106 |
*darwin*) |
107 |
IFTYPE=tincd |
108 |
IFSUBTYPE=darwin |
109 |
AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)]) |
110 |
;; |
111 |
*solaris*) |
112 |
IFTYPE=tincd |
113 |
IFSUBTYPE=solaris |
114 |
AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS]) |
115 |
;; |
116 |
*openbsd*) |
117 |
IFTYPE=tincd |
118 |
IFSUBTYPE=openbsd |
119 |
AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD]) |
120 |
;; |
121 |
*netbsd*) |
122 |
IFTYPE=tincd |
123 |
IFSUBTYPE=netbsd |
124 |
AC_DEFINE(HAVE_NETBSD, 1, [NetBSD]) |
125 |
;; |
126 |
*cygwin*) |
127 |
IFTYPE=native |
128 |
IFSUBTYPE=cygwin |
129 |
AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin]) |
130 |
;; |
131 |
*) |
132 |
AC_MSG_ERROR("Unknown operating system.") |
133 |
;; |
134 |
esac |
135 |
fi |
136 |
AC_MSG_RESULT($IFTYPE/$IFSUBTYPE) |
137 |
AC_SUBST(IFTYPE,$IFTYPE) |
138 |
AC_SUBST(IFSUBTYPE,$IFSUBTYPE) |
139 |
AC_DEFINE_UNQUOTED(IFTYPE,"$IFTYPE",[kernel interface type]) |
140 |
AC_DEFINE_UNQUOTED(IFSUBTYPE,"$IFSUBTYPE",[kernel interface subtype]) |
141 |
|
142 |
AC_CACHE_SAVE |
143 |
|
144 |
dnl Checks for libraries. |
145 |
|
146 |
AC_LANG(C++) |
147 |
AC_CHECK_HEADERS(ext/hash_map) |
148 |
|
149 |
dnl Checks for header files. |
150 |
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stdint.h strings.h syslog.h unistd.h \ |
151 |
sys/file.h sys/ioctl.h sys/param.h sys/time.h netinet/in_systm.h sys/cygwin.h \ |
152 |
sys/mman.h netinet/in.h]) |
153 |
AC_CHECK_HEADERS([arpa/inet.h net/ethernet.h net/if.h netinet/ip.h netinet/tcp.h netinet/in_systm.h], [], [], |
154 |
[ |
155 |
#include <sys/types.h> |
156 |
#include <sys/socket.h> |
157 |
#ifdef HAVE_NETINET_IN_H |
158 |
# include <netinet/in.h> |
159 |
#endif |
160 |
#ifdef HAVE_ARPA_INET_H |
161 |
# include <arpa/inet.h> |
162 |
#endif |
163 |
#ifdef HAVE_NETINET_IN_SYSTM_H |
164 |
# include <netinet/in_systm.h> |
165 |
#endif |
166 |
]) |
167 |
|
168 |
dnl Checks for typedefs, structures, and compiler characteristics. |
169 |
AC_C_CONST |
170 |
AC_TYPE_PID_T |
171 |
AC_TYPE_SIZE_T |
172 |
AC_HEADER_TIME |
173 |
AC_STRUCT_TM |
174 |
|
175 |
AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, |
176 |
[ |
177 |
AC_TRY_COMPILE( |
178 |
[#include <sys/types.h> |
179 |
#include <sys/socket.h>], |
180 |
[socklen_t len = 42; return len;], |
181 |
ac_cv_type_socklen_t=yes, |
182 |
ac_cv_type_socklen_t=no) |
183 |
]) |
184 |
if test $ac_cv_type_socklen_t = yes; then |
185 |
AC_DEFINE(HAVE_SOCKLEN_T, 1, [socklen_t available]) |
186 |
fi |
187 |
|
188 |
AC_CACHE_CHECK([for struct addrinfo], ac_cv_struct_addrinfo, |
189 |
[ |
190 |
AC_TRY_COMPILE( |
191 |
[#include <sys/types.h> |
192 |
#include <sys/socket.h> |
193 |
#include <netdb.h>], |
194 |
[struct addrinfo ai; ai.ai_family = AF_INET; return ai.ai_family;], |
195 |
ac_cv_struct_addrinfo=yes, |
196 |
ac_cv_struct_addrinfo=no) |
197 |
]) |
198 |
if test $ac_cv_struct_addrinfo = yes; then |
199 |
AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [struct addrinfo available]) |
200 |
fi |
201 |
|
202 |
dnl Checks for library functions. |
203 |
AC_TYPE_SIGNAL |
204 |
|
205 |
AC_LANG_PUSH(C) |
206 |
|
207 |
AC_HEADER_STDC |
208 |
|
209 |
dnl argl, could somebody catapult darwin into the 21st century??? |
210 |
AC_CHECK_FUNCS(asprintf daemon get_current_dir_name putenv select strerror strsignal strtol unsetenv mlockall) |
211 |
|
212 |
AC_FUNC_ALLOCA |
213 |
|
214 |
dnl Support for SunOS |
215 |
|
216 |
AC_CHECK_FUNC(socket, [], [ |
217 |
AC_CHECK_LIB(socket, connect) |
218 |
]) |
219 |
AC_CHECK_FUNC(gethostbyname, [], [ |
220 |
AC_CHECK_LIB(nsl, gethostbyname) |
221 |
]) |
222 |
|
223 |
AC_LANG_POP |
224 |
|
225 |
dnl AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo]) |
226 |
|
227 |
AC_CACHE_SAVE |
228 |
|
229 |
dnl These are defined in files in m4/ |
230 |
tinc_TUNTAP |
231 |
|
232 |
tinc_OPENSSL |
233 |
if test "x$openssl_include" != x; then |
234 |
CXXFLAGS="$CXXFLAGS -I$openssl_include" |
235 |
fi |
236 |
dnl tinc_ZLIB |
237 |
|
238 |
AC_ARG_ENABLE(rohc, |
239 |
[AC_HELP_STRING(--enable-rohc, [enable robust header compression (rfc3095).])], |
240 |
[ |
241 |
echo |
242 |
echo "**********************************************************************" |
243 |
echo "**********************************************************************" |
244 |
echo "**** --enable-rohc is highly experimental, do not use ****************" |
245 |
echo "**********************************************************************" |
246 |
echo "**********************************************************************" |
247 |
echo |
248 |
rohc=true |
249 |
AC_DEFINE_UNQUOTED(ENABLE_ROHC, 1, [ROHC support]) |
250 |
] |
251 |
) |
252 |
|
253 |
AM_CONDITIONAL(ROHC, test x$rohc = xtrue) |
254 |
|
255 |
AC_ARG_ENABLE(icmp, |
256 |
[AC_HELP_STRING(--enable-icmp, [enable icmp protocol support (default disabled).])], |
257 |
AC_DEFINE_UNQUOTED(ENABLE_ICMP, 1, [ICMP protocol support.]) |
258 |
) |
259 |
|
260 |
AC_ARG_ENABLE(tcp, |
261 |
[AC_HELP_STRING(--enable-tcp, [enable tcp protocol support (default disabled).])], |
262 |
AC_DEFINE_UNQUOTED(ENABLE_TCP, 1, [TCP protocol support.]) |
263 |
) |
264 |
|
265 |
AC_ARG_ENABLE(dns, |
266 |
[AC_HELP_STRING(--enable-dns, [enable dns tunnel protocol support (DOES NOT WORK).])], |
267 |
AC_DEFINE_UNQUOTED(ENABLE_DNS, 1, [DNS tunnel protocol support.]) |
268 |
) |
269 |
|
270 |
AC_ARG_ENABLE(http-proxy, |
271 |
[AC_HELP_STRING(--enable-http-proxy, [enable http proxy connect support (default disabled).])], |
272 |
AC_DEFINE_UNQUOTED(ENABLE_HTTP_PROXY, 1, [http proxy connect support.]) |
273 |
) |
274 |
|
275 |
HMAC=12 dnl see also the AC_HELP_STRING |
276 |
AC_ARG_ENABLE(hmac-length, |
277 |
[AC_HELP_STRING(--enable-hmac-length=BYTES, [use a hmac of length BYTES bytes (default 12). Allowed values are 4, 8, 12, 16.])], |
278 |
HMAC=$enableval |
279 |
) |
280 |
AC_DEFINE_UNQUOTED(HMACLENGTH, $HMAC, [Size of HMAC in each packet in bytes.]) |
281 |
|
282 |
RAND=8 dnl see also the AC_HELP_STRING |
283 |
AC_ARG_ENABLE(rand-length, |
284 |
[AC_HELP_STRING(--enable-rand-length=BYTES, [use BYTES bytes of extra randomness (default 8). Allowed values are 0, 4, 8.])], |
285 |
RAND=$enableval |
286 |
) |
287 |
AC_DEFINE_UNQUOTED(RAND_SIZE, $RAND, [Add this many bytes of randomness to each packet.]) |
288 |
|
289 |
MTU=1500 dnl see also the AC_HELP_STRING |
290 |
AC_ARG_ENABLE(mtu, |
291 |
[AC_HELP_STRING(--enable-max-mtu=BYTES, enable mtu sizes upto BYTES bytes (default 1500). Use 9100 for jumbogram support.)], |
292 |
MTU=$enableval |
293 |
) |
294 |
AC_DEFINE_UNQUOTED(MAX_MTU, $MTU + 14, [Maximum MTU supported.]) |
295 |
|
296 |
COMPRESS=1 |
297 |
AC_ARG_ENABLE(compression, |
298 |
[AC_HELP_STRING(--disable-compression, Disable compression support.)], |
299 |
if test "x$enableval" = xno; then |
300 |
COMPRESS=0 |
301 |
fi |
302 |
) |
303 |
AC_DEFINE_UNQUOTED(ENABLE_COMPRESSION, $COMPRESS, [Enable compression support.]) |
304 |
|
305 |
CIPHER=bf_cbc |
306 |
AC_ARG_ENABLE(cipher, |
307 |
[AC_HELP_STRING(--enable-cipher, [ |
308 |
Select the symmetric cipher (default "bf"). Must be one of |
309 |
"bf" (blowfish), "aes-128" (rijndael), "aes-192" or "aes-256".])], |
310 |
if test "x$enableval" = xbf ; then CIPHER=bf_cbc ; fi |
311 |
if test "x$enableval" = xaes-128; then CIPHER=aes_128_cbc; fi |
312 |
if test "x$enableval" = xaes-192; then CIPHER=aes_192_cbc; fi |
313 |
if test "x$enableval" = xaes-256; then CIPHER=aes_256_cbc; fi |
314 |
) |
315 |
AC_DEFINE_UNQUOTED(ENABLE_CIPHER, EVP_${CIPHER}, [Select the symmetric cipher to use.]) |
316 |
|
317 |
DIGEST=sha1 |
318 |
AC_ARG_ENABLE(digest, |
319 |
[AC_HELP_STRING(--enable-digest, [ |
320 |
Select the digets algorithm to use (default "sha1"). Must be one of |
321 |
"sha1", "ripemd160", "md5" or "md4" (insecure).])], |
322 |
if test "x$enableval" = xsha1 ; then DIGEST=sha1 ; fi |
323 |
if test "x$enableval" = xripemd160; then DIGEST=ripemd160; fi |
324 |
if test "x$enableval" = xmd5 ; then DIGEST=md5 ; fi |
325 |
if test "x$enableval" = xmd4 ; then DIGEST=md4 ; fi |
326 |
) |
327 |
AC_DEFINE_UNQUOTED(ENABLE_DIGEST, EVP_${DIGEST}, [Select the digest algorithm to use.]) |
328 |
|
329 |
if $CXX -v --help 2>&1 | grep -q fno-rtti; then |
330 |
CXXFLAGS="$CXXFLAGS -fno-rtti" |
331 |
fi |
332 |
|
333 |
if $CXX -v --help 2>&1 | grep -q fexceptions; then |
334 |
CXXFLAGS="$CXXFLAGS -fno-exceptions" |
335 |
fi |
336 |
|
337 |
dnl if $CXX -v --help 2>&1 | grep -q ffunction-sections; then |
338 |
dnl CXXFLAGS="$CXXFLAGS -ffunction-sections" |
339 |
dnl fi |
340 |
dnl |
341 |
dnl if $LD -v --help 2>&1 | grep -q gc-sections; then |
342 |
dnl LDFLAGS="$LDFLAGS -Wl,--gc-sections" |
343 |
dnl fi |
344 |
|
345 |
AC_CONFIG_COMMANDS_POST([ |
346 |
|
347 |
echo |
348 |
echo "***" |
349 |
echo "*** Configuration Summary" |
350 |
echo "***" |
351 |
echo "*** Kernel Iface: $IFTYPE/$IFSUBTYPE" |
352 |
echo "*** Cipher used: $CIPHER" |
353 |
echo "*** Digest used: $DIGEST" |
354 |
echo "*** HMAC length: $HMAC" |
355 |
echo "*** RAND used: $RAND" |
356 |
echo "*** Max. MTU: $MTU" |
357 |
echo "*** Compression: $COMPRESS" |
358 |
|
359 |
if test "x$DIGEST" = xmd4; then |
360 |
echo "***" |
361 |
echo "*** WARNING: The digest you have chosen ($DIGEST) is known to be insecure" |
362 |
fi |
363 |
|
364 |
if test "$HMAC" -lt 12; then |
365 |
echo "***" |
366 |
echo "*** WARNING: The hmac length you have chosen ($HMAC) is probably insecure" |
367 |
fi |
368 |
|
369 |
if test "$RAND" -lt 8; then |
370 |
echo "***" |
371 |
echo "*** WARNING: The random prefix you have chosen ($RAND) is probably insecure" |
372 |
fi |
373 |
|
374 |
echo "***" |
375 |
|
376 |
echo |
377 |
|
378 |
]) |
379 |
|
380 |
AC_SUBST(INCLUDES) |
381 |
|
382 |
AC_OUTPUT(Makefile po/Makefile.in |
383 |
src/Makefile |
384 |
src/rohc/Makefile |
385 |
doc/Makefile |
386 |
lib/Makefile |
387 |
m4/Makefile |
388 |
) |