1 | dnl Process this file with autoconf to produce a configure script. |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | |
2 | |
3 | AC_PREREQ(2.57) |
3 | AC_PREREQ(2.57) |
4 | AC_INIT(src/vped.C) |
4 | AC_INIT(src/vped.C) |
5 | AC_CANONICAL_TARGET |
5 | AC_CANONICAL_TARGET |
6 | AM_INIT_AUTOMAKE(vpe, 0.1) |
6 | AM_INIT_AUTOMAKE(vpe, 1.4) |
7 | AM_CONFIG_HEADER(config.h) |
7 | AM_CONFIG_HEADER(config.h) |
8 | AM_MAINTAINER_MODE |
8 | AM_MAINTAINER_MODE |
9 | |
9 | |
10 | AH_TOP([ |
10 | AH_TOP([ |
11 | #ifndef CONFIG_H__ |
11 | #ifndef CONFIG_H__ |
… | |
… | |
61 | AC_PROG_MAKE_SET |
61 | AC_PROG_MAKE_SET |
62 | AC_PROG_RANLIB |
62 | AC_PROG_RANLIB |
63 | |
63 | |
64 | AC_ISC_POSIX |
64 | AC_ISC_POSIX |
65 | |
65 | |
66 | m4_if([ |
66 | AC_ARG_ENABLE(iftype, |
|
|
67 | [AC_HELP_STRING(--enable-iftype[=TYPE/SUBTYPE], [ |
|
|
68 | Use kernel/net device interface TYPE/SUBTYPE. |
|
|
69 | Working combinations are: |
|
|
70 | "native/linux" |
|
|
71 | "tincd/linux" |
|
|
72 | "tincd/freebsd" |
|
|
73 | "tincd/openbsd" |
|
|
74 | "tincd/darwin" |
|
|
75 | "native/cygwin"; |
|
|
76 | Untested combinations are: |
|
|
77 | "tincd/netbsd" |
|
|
78 | "tincd/solaris" |
|
|
79 | "tincd/mingw"; |
|
|
80 | Broken combinations are: |
|
|
81 | "tincd/cygwin"; |
|
|
82 | The default is to autodetect. |
|
|
83 | ])], |
|
|
84 | [ |
|
|
85 | IFTYPE=`echo $enableval | sed s%/.*%%` |
|
|
86 | IFSUBTYPE=`echo $enableval | sed s%.*/%%` |
|
|
87 | ] |
|
|
88 | ) |
|
|
89 | |
67 | dnl Check and set OS |
90 | dnl Check and set OS |
|
|
91 | AC_MSG_CHECKING(for kernel networking interface type) |
68 | |
92 | |
|
|
93 | if test "x$IFTYPE" = "x"; then |
69 | case $target_os in |
94 | case $target_os in |
70 | *linux*) |
95 | *linux*) |
|
|
96 | IFTYPE=native |
|
|
97 | IFSUBTYPE=linux |
71 | AC_DEFINE(HAVE_LINUX, 1, [Linux]) |
98 | AC_DEFINE(HAVE_LINUX, 1, [Linux]) |
72 | [ rm -f src/device.c; ln -sf linux/device.c src/device.c ] |
99 | ;; |
73 | ;; |
|
|
74 | *freebsd*) |
100 | *freebsd*) |
|
|
101 | IFTYPE=tincd |
|
|
102 | IFSUBTYPE=freebsd |
75 | AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD]) |
103 | AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD]) |
76 | [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ] |
104 | ;; |
77 | ;; |
|
|
78 | *darwin*) |
105 | *darwin*) |
|
|
106 | IFTYPE=tincd |
|
|
107 | IFSUBTYPE=darwin |
79 | AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)]) |
108 | AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)]) |
80 | [ rm -f src/device.c; ln -sf darwin/device.c src/device.c ] |
109 | ;; |
81 | ;; |
|
|
82 | *solaris*) |
110 | *solaris*) |
|
|
111 | IFTYPE=tincd |
|
|
112 | IFSUBTYPE=solaris |
83 | AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS]) |
113 | AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS]) |
84 | [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ] |
114 | ;; |
85 | ;; |
|
|
86 | *openbsd*) |
115 | *openbsd*) |
|
|
116 | IFTYPE=tincd |
|
|
117 | IFSUBTYPE=openbsd |
87 | AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD]) |
118 | AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD]) |
88 | [ rm -f src/device.c; ln -sf openbsd/device.c src/device.c ] |
119 | ;; |
89 | ;; |
|
|
90 | *netbsd*) |
120 | *netbsd*) |
|
|
121 | IFTYPE=tincd |
|
|
122 | IFSUBTYPE=netbsd |
91 | AC_DEFINE(HAVE_NETBSD, 1, [NetBSD]) |
123 | AC_DEFINE(HAVE_NETBSD, 1, [NetBSD]) |
92 | [ rm -f src/device.c; ln -sf netbsd/device.c src/device.c ] |
124 | ;; |
93 | ;; |
|
|
94 | *cygwin*) |
125 | *cygwin*) |
|
|
126 | IFTYPE=native |
|
|
127 | IFSUBTYPE=cygwin |
95 | AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin]) |
128 | AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin]) |
96 | [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ] |
129 | ;; |
97 | ;; |
130 | *) |
98 | *) |
|
|
99 | AC_MSG_ERROR("Unknown operating system.") |
131 | AC_MSG_ERROR("Unknown operating system.") |
100 | ;; |
132 | ;; |
101 | esac |
133 | esac |
102 | ]) |
134 | fi |
|
|
135 | AC_MSG_RESULT($IFTYPE/$IFSUBTYPE) |
|
|
136 | AC_SUBST(IFTYPE,$IFTYPE) |
|
|
137 | AC_SUBST(IFSUBTYPE,$IFSUBTYPE) |
|
|
138 | AC_DEFINE_UNQUOTED(IFTYPE,"$IFTYPE",[kernel interface type]) |
|
|
139 | AC_DEFINE_UNQUOTED(IFSUBTYPE,"$IFSUBTYPE",[kernel interface subtype]) |
103 | |
140 | |
104 | AC_CACHE_SAVE |
141 | AC_CACHE_SAVE |
105 | |
142 | |
106 | dnl Checks for libraries. |
143 | dnl Checks for libraries. |
107 | |
144 | |
108 | AC_LANG(C++) |
145 | AC_LANG(C++) |
109 | AC_CHECK_HEADERS(ext/hash_map) |
146 | AC_CHECK_HEADERS(ext/hash_map) |
110 | |
147 | |
111 | dnl Checks for header files. |
148 | dnl Checks for header files. |
112 | AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stdint.h strings.h syslog.h unistd.h \ |
149 | AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stdint.h strings.h syslog.h unistd.h \ |
113 | sys/file.h sys/ioctl.h sys/param.h sys/time.h netinet/in_systm.h cygwin.h]) |
150 | sys/file.h sys/ioctl.h sys/param.h sys/time.h netinet/in_systm.h sys/cygwin.h arpa/inet.h \ |
|
|
151 | sys/mman.h netinet/in.h]) |
114 | AC_CHECK_HEADERS([net/ethernet.h net/if.h netinet/ip.h netinet/tcp.h], [], [], |
152 | AC_CHECK_HEADERS([net/ethernet.h net/if.h netinet/ip.h netinet/tcp.h netinet/in_systm.h], [], [], |
|
|
153 | [ |
115 | [#include <sys/types.h> |
154 | #include <sys/types.h> |
116 | #include <sys/socket.h> |
155 | #include <sys/socket.h> |
|
|
156 | #ifdef HAVE_NETINET_IN_H |
|
|
157 | # include <netinet/in.h> |
|
|
158 | #endif |
|
|
159 | #ifdef HAVE_ARPA_INET_H |
|
|
160 | # include <arpa/inet.h> |
|
|
161 | #endif |
117 | #ifdef HAVE_NETINET_IN_SYSTM_H |
162 | #ifdef HAVE_NETINET_IN_SYSTM_H |
118 | #include <netinet/in_systm.h> |
163 | # include <netinet/in_systm.h> |
119 | #endif]) |
164 | #endif |
|
|
165 | ]) |
120 | |
166 | |
121 | dnl Checks for typedefs, structures, and compiler characteristics. |
167 | dnl Checks for typedefs, structures, and compiler characteristics. |
122 | AC_C_CONST |
168 | AC_C_CONST |
123 | AC_TYPE_PID_T |
169 | AC_TYPE_PID_T |
124 | AC_TYPE_SIZE_T |
170 | AC_TYPE_SIZE_T |
… | |
… | |
157 | |
203 | |
158 | AC_LANG_PUSH(C) |
204 | AC_LANG_PUSH(C) |
159 | |
205 | |
160 | AC_HEADER_STDC |
206 | AC_HEADER_STDC |
161 | |
207 | |
|
|
208 | dnl argl, could somebody catapult darwin into the 21st century??? |
162 | AC_CHECK_FUNCS(asprintf daemon get_current_dir_name putenv select strerror strsignal strtol unsetenv mlockall) |
209 | AC_CHECK_FUNCS(asprintf daemon get_current_dir_name putenv select strerror strsignal strtol unsetenv mlockall) |
163 | |
210 | |
164 | AC_FUNC_ALLOCA |
211 | AC_FUNC_ALLOCA |
165 | |
212 | |
166 | dnl Support for SunOS |
213 | dnl Support for SunOS |
… | |
… | |
178 | |
225 | |
179 | AC_CACHE_SAVE |
226 | AC_CACHE_SAVE |
180 | |
227 | |
181 | dnl These are defined in files in m4/ |
228 | dnl These are defined in files in m4/ |
182 | tinc_TUNTAP |
229 | tinc_TUNTAP |
|
|
230 | |
183 | tinc_OPENSSL |
231 | tinc_OPENSSL |
|
|
232 | if test "x$openssl_include" != x; then |
|
|
233 | CXXFLAGS="$CXXFLAGS -I$openssl_include" |
|
|
234 | fi |
184 | dnl tinc_ZLIB |
235 | dnl tinc_ZLIB |
185 | |
236 | |
186 | AC_ARG_ENABLE(rohc, |
237 | AC_ARG_ENABLE(rohc, |
187 | [AC_HELP_STRING(--enable-rohc, [enable robust header compression (rfc3095).])], |
238 | [AC_HELP_STRING(--enable-rohc, [enable robust header compression (rfc3095).])], |
188 | [ |
239 | [ |
… | |
… | |
202 | echo |
253 | echo |
203 | ] |
254 | ] |
204 | ) |
255 | ) |
205 | |
256 | |
206 | AC_ARG_ENABLE(icmp, |
257 | AC_ARG_ENABLE(icmp, |
207 | [AC_HELP_STRING(--enable-icmp, [enable icmp protocol support.])], |
258 | [AC_HELP_STRING(--enable-icmp, [enable icmp protocol support (default disabled).])], |
208 | AC_DEFINE_UNQUOTED(ENABLE_ICMP, 1, [ICMP protocol support.]) |
259 | AC_DEFINE_UNQUOTED(ENABLE_ICMP, 1, [ICMP protocol support.]) |
209 | ) |
260 | ) |
210 | |
261 | |
211 | AC_ARG_ENABLE(tcp, |
262 | AC_ARG_ENABLE(tcp, |
212 | [AC_HELP_STRING(--enable-tcp, [enable tcp protocol support.])], |
263 | [AC_HELP_STRING(--enable-tcp, [enable tcp protocol support (default disabled).])], |
213 | AC_DEFINE_UNQUOTED(ENABLE_TCP, 1, [TCP protocol support.]) |
264 | AC_DEFINE_UNQUOTED(ENABLE_TCP, 1, [TCP protocol support.]) |
214 | ) |
265 | ) |
215 | |
266 | |
216 | AC_ARG_ENABLE(http-proxy, |
267 | AC_ARG_ENABLE(http-proxy, |
217 | [AC_HELP_STRING(--enable-http-proxy, [enable http proxy connect support.])], |
268 | [AC_HELP_STRING(--enable-http-proxy, [enable http proxy connect support (default disabled).])], |
218 | AC_DEFINE_UNQUOTED(ENABLE_HTTP_PROXY, 1, [http proxy connect support.]) |
269 | AC_DEFINE_UNQUOTED(ENABLE_HTTP_PROXY, 1, [http proxy connect support.]) |
219 | ) |
270 | ) |
220 | |
271 | |
221 | HMAC=16 dnl see also the AC_HELP_STRING |
272 | HMAC=8 dnl see also the AC_HELP_STRING |
222 | AC_ARG_ENABLE(hmac-length, |
273 | AC_ARG_ENABLE(hmac-length, |
223 | [AC_HELP_STRING(--enable-hmac-length=BYTES, [use a hmac of length BYTES bytes (default 16). Allowed values are 4, 8, 12, 16.])], |
274 | [AC_HELP_STRING(--enable-hmac-length=BYTES, [use a hmac of length BYTES bytes (default 12). Allowed values are 4, 8, 12, 16.])], |
224 | HMAC=$enableval |
275 | HMAC=$enableval |
225 | ) |
276 | ) |
226 | AC_DEFINE_UNQUOTED(HMACLENGTH, $HMAC, [Size of HMAC in each packet in bytes.]) |
277 | AC_DEFINE_UNQUOTED(HMACLENGTH, $HMAC, [Size of HMAC in each packet in bytes.]) |
227 | |
278 | |
228 | RAND=8 dnl see also the AC_HELP_STRING |
279 | RAND=8 dnl see also the AC_HELP_STRING |
… | |
… | |
250 | |
301 | |
251 | CIPHER=bf_cbc |
302 | CIPHER=bf_cbc |
252 | AC_ARG_ENABLE(cipher, |
303 | AC_ARG_ENABLE(cipher, |
253 | [AC_HELP_STRING(--enable-cipher, [ |
304 | [AC_HELP_STRING(--enable-cipher, [ |
254 | Select the symmetric cipher (default "bf"). Must be one of |
305 | Select the symmetric cipher (default "bf"). Must be one of |
255 | "bf" (blowfish), "aes-128", "aes-192" or "aes-256".])], |
306 | "bf" (blowfish), "aes-128" (rijndael), "aes-192" or "aes-256".])], |
256 | if test "x$enableval" = xbf ; then CIPHER=bf_cbc ; fi |
307 | if test "x$enableval" = xbf ; then CIPHER=bf_cbc ; fi |
257 | if test "x$enableval" = xaes-128; then CIPHER=aes_128_cbc; fi |
308 | if test "x$enableval" = xaes-128; then CIPHER=aes_128_cbc; fi |
258 | if test "x$enableval" = xaes-192; then CIPHER=aes_192_cbc; fi |
309 | if test "x$enableval" = xaes-192; then CIPHER=aes_192_cbc; fi |
259 | if test "x$enableval" = xaes-256; then CIPHER=aes_256_cbc; fi |
310 | if test "x$enableval" = xaes-256; then CIPHER=aes_256_cbc; fi |
260 | ) |
311 | ) |
… | |
… | |
262 | |
313 | |
263 | DIGEST=sha1 |
314 | DIGEST=sha1 |
264 | AC_ARG_ENABLE(digest, |
315 | AC_ARG_ENABLE(digest, |
265 | [AC_HELP_STRING(--enable-digest, [ |
316 | [AC_HELP_STRING(--enable-digest, [ |
266 | Select the digets algorithm to use (default "sha1"). Must be one of |
317 | Select the digets algorithm to use (default "sha1"). Must be one of |
267 | "sha1", "ripemd160", "md4" or "md5".])], |
318 | "sha1", "ripemd160", "md5" or "md4" (insecure).])], |
268 | if test "x$enableval" = xsha1 ; then DIGEST=sha1 ; fi |
319 | if test "x$enableval" = xsha1 ; then DIGEST=sha1 ; fi |
269 | if test "x$enableval" = xripemd160; then DIGEST=ripemd160; fi |
320 | if test "x$enableval" = xripemd160; then DIGEST=ripemd160; fi |
|
|
321 | if test "x$enableval" = xmd5 ; then DIGEST=md5 ; fi |
270 | if test "x$enableval" = xmd4 ; then DIGEST=md4 ; fi |
322 | if test "x$enableval" = xmd4 ; then DIGEST=md4 ; fi |
271 | if test "x$enableval" = xmd5 ; then DIGEST=md5 ; fi |
|
|
272 | ) |
323 | ) |
273 | AC_DEFINE_UNQUOTED(ENABLE_DIGEST, EVP_${DIGEST}, [Select the digest algorithm to use.]) |
324 | AC_DEFINE_UNQUOTED(ENABLE_DIGEST, EVP_${DIGEST}, [Select the digest algorithm to use.]) |
274 | |
|
|
275 | TRUST=1 |
|
|
276 | m4_if([ |
|
|
277 | AC_ARG_ENABLE(trust, |
|
|
278 | [AC_HELP_STRING(--enable-trust, [ |
|
|
279 | Make authentication faster but allow decoding by all hosts of a VPN. |
|
|
280 | Use this when the VPN hosts DO trust each other and you don't care |
|
|
281 | wether man-in-the-middle sniffing attacks are possible by admins |
|
|
282 | of other VPN hosts. On pentiums or similar machines this can cut down |
|
|
283 | the time for reconnects by 0.4 seconds or more.])], |
|
|
284 | if test "x$enableval" = xyes; then |
|
|
285 | TRUST=1 |
|
|
286 | fi |
|
|
287 | ) |
|
|
288 | ]) |
|
|
289 | AC_DEFINE_UNQUOTED(ENABLE_TRUST, $TRUST, [Faster, but VPN hosts may sniff each others data.]) |
|
|
290 | |
325 | |
291 | if $CXX -v --help 2>&1 | grep -q fno-rtti; then |
326 | if $CXX -v --help 2>&1 | grep -q fno-rtti; then |
292 | CXXFLAGS="$CXXFLAGS -fno-rtti" |
327 | CXXFLAGS="$CXXFLAGS -fno-rtti" |
293 | fi |
328 | fi |
294 | |
329 | |
295 | if $CXX -v --help 2>&1 | grep -q fexceptions; then |
330 | if $CXX -v --help 2>&1 | grep -q fexceptions; then |
296 | CXXFLAGS="$CXXFLAGS -fno-exceptions" |
331 | CXXFLAGS="$CXXFLAGS -fno-exceptions" |
297 | fi |
332 | fi |
298 | |
333 | |
299 | if $CXX -v --help 2>&1 | grep -q ffunction-sections; then |
334 | dnl if $CXX -v --help 2>&1 | grep -q ffunction-sections; then |
300 | CXXFLAGS="$CXXFLAGS -ffunction-sections" |
335 | dnl CXXFLAGS="$CXXFLAGS -ffunction-sections" |
301 | fi |
336 | dnl fi |
302 | |
337 | dnl |
303 | if $LD -v --help 2>&1 | grep -q gc-sections; then |
338 | dnl if $LD -v --help 2>&1 | grep -q gc-sections; then |
304 | LDFLAGS="$LDFLAGS -Wl,--gc-sections" |
339 | dnl LDFLAGS="$LDFLAGS -Wl,--gc-sections" |
305 | fi |
340 | dnl fi |
306 | |
341 | |
307 | AC_CONFIG_COMMANDS_POST([ |
342 | AC_CONFIG_COMMANDS_POST([ |
308 | |
343 | |
309 | echo |
344 | echo |
310 | echo "***" |
345 | echo "***" |
311 | echo "*** Configuration Summary" |
346 | echo "*** Configuration Summary" |
312 | echo "***" |
347 | echo "***" |
|
|
348 | echo "*** Kernel Iface: $IFTYPE/$IFSUBTYPE" |
313 | echo "*** Cipher used: $CIPHER" |
349 | echo "*** Cipher used: $CIPHER" |
314 | echo "*** Digest used: $DIGEST" |
350 | echo "*** Digest used: $DIGEST" |
315 | echo "*** HMAC length: $HMAC" |
351 | echo "*** HMAC length: $HMAC" |
316 | echo "*** RAND used: $RAND" |
352 | echo "*** RAND used: $RAND" |
317 | echo "*** Max. MTU: $MTU" |
353 | echo "*** Max. MTU: $MTU" |
318 | echo "*** Compression: $COMPRESS" |
354 | echo "*** Compression: $COMPRESS" |
319 | dnl echo "*** Trusted Mode: $TRUST" |
|
|
320 | echo "***" |
355 | echo "***" |
|
|
356 | |
|
|
357 | if test "x$DIGEST" = xmd4; then |
|
|
358 | echo "*** WARNING" |
|
|
359 | echo "*** The digest you have chosen ($DIGEST) is known to be insecure" |
|
|
360 | echo "***" |
|
|
361 | fi |
|
|
362 | |
321 | echo |
363 | echo |
322 | |
364 | |
323 | ]) |
365 | ]) |
324 | |
366 | |
325 | AC_SUBST(INCLUDES) |
367 | AC_SUBST(INCLUDES) |