]> git.ipfire.org Git - thirdparty/openvpn.git/blame - configure.ac
plugin: Extend the plug-in v3 API to identify the SSL implementation used
[thirdparty/openvpn.git] / configure.ac
CommitLineData
6fbf66fa
JY
1dnl OpenVPN -- An application to securely tunnel IP networks
2dnl over a single UDP port, with support for SSL/TLS-based
3dnl session authentication and key exchange,
4dnl packet encryption, packet authentication, and
5dnl packet compression.
6dnl
564a2109 7dnl Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
51bd56f4 8dnl Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
6fbf66fa
JY
9dnl
10dnl This program is free software; you can redistribute it and/or modify
11dnl it under the terms of the GNU General Public License as published by
12dnl the Free Software Foundation; either version 2 of the License, or
13dnl (at your option) any later version.
14dnl
15dnl This program is distributed in the hope that it will be useful,
16dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
17dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18dnl GNU General Public License for more details.
19dnl
20dnl You should have received a copy of the GNU General Public License
21dnl along with this program (see the file COPYING included with this
22dnl distribution); if not, write to the Free Software Foundation, Inc.,
23dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
25dnl Process this file with autoconf to produce a configure script.
26
51bd56f4 27AC_PREREQ(2.59)
6fbf66fa 28
ce351583 29m4_include(version.m4)
51bd56f4
ABL
30AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME])
31m4_include(compat.m4)
98bc1a3e
ABL
32AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format])
33
51bd56f4 34AC_CONFIG_AUX_DIR([.])
d86d5770 35AC_CONFIG_HEADERS([config.h])
34cb9132 36AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
0fc5b8b3 37AC_CONFIG_MACRO_DIR([m4])
51bd56f4
ABL
38AM_INIT_AUTOMAKE
39AC_CANONICAL_HOST
40AC_USE_SYSTEM_EXTENSIONS
6fbf66fa 41
51bd56f4
ABL
42AC_ARG_ENABLE(
43 [lzo],
40a56e79 44 [AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@default=yes@:>@])],
51bd56f4 45 ,
40a56e79 46 [enable_lzo="yes"]
6c34e74f
JY
47)
48
38d96bd7
JY
49AC_ARG_ENABLE(snappy,
50 [ --disable-snappy Disable Snappy compression support],
51 [enable_snappy="$enableval"],
52 [enable_snappy="yes"]
53)
54
55AC_ARG_ENABLE(comp-stub,
56 [ --enable-comp-stub Don't compile compression support but still allow limited interoperability with compression-enabled peers],
57 [enable_comp_stub="$enableval"],
58 [enable_comp_stub="no"]
6fbf66fa
JY
59)
60
51bd56f4
ABL
61AC_ARG_ENABLE(
62 [crypto],
709f7a1f 63 [AS_HELP_STRING([--disable-crypto], [disable crypto support @<:@default=yes@:>@])],
51bd56f4
ABL
64 ,
65 [enable_crypto="yes"]
6fbf66fa
JY
66)
67
51bd56f4
ABL
68AC_ARG_ENABLE(
69 [ssl],
709f7a1f 70 [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange @<:@default=yes@:>@])],
51bd56f4
ABL
71 ,
72 [enable_ssl="yes"]
fbd18db6
DS
73)
74
51bd56f4
ABL
75AC_ARG_ENABLE(
76 [x509-alt-username],
709f7a1f 77 [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])],
51bd56f4
ABL
78 ,
79 [enable_x509_alt_username="no"]
6fbf66fa
JY
80)
81
51bd56f4
ABL
82AC_ARG_ENABLE(
83 [multi],
709f7a1f 84 [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode) @<:@default=yes@:>@])],
51bd56f4
ABL
85 ,
86 [enable_multi="yes"]
6fbf66fa
JY
87)
88
51bd56f4
ABL
89AC_ARG_ENABLE(
90 [server],
709f7a1f 91 [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support) @<:@default=yes@:>@])],
51bd56f4
ABL
92 ,
93 [enable_server="yes"]
6fbf66fa
JY
94)
95
51bd56f4
ABL
96AC_ARG_ENABLE(
97 [plugins],
709f7a1f 98 [AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])],
51bd56f4
ABL
99 ,
100 [enable_plugins="yes"]
0c1f7ad5
DS
101)
102
51bd56f4
ABL
103AC_ARG_ENABLE(
104 [management],
709f7a1f 105 [AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])],
51bd56f4
ABL
106 ,
107 [enable_management="yes"]
ce98fd24
JY
108)
109
51bd56f4
ABL
110AC_ARG_ENABLE(
111 [pkcs11],
709f7a1f 112 [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])],
51bd56f4 113 ,
18b5fbdf 114 [enable_pkcs11="no"]
6fbf66fa
JY
115)
116
51bd56f4
ABL
117AC_ARG_ENABLE(
118 [socks],
709f7a1f 119 [AS_HELP_STRING([--disable-socks], [disable Socks support @<:@default=yes@:>@])],
51bd56f4
ABL
120 ,
121 [enable_socks="yes"]
6fbf66fa
JY
122)
123
51bd56f4
ABL
124AC_ARG_ENABLE(
125 [http-proxy],
709f7a1f 126 [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support @<:@default=yes@:>@])],
51bd56f4
ABL
127 ,
128 [enable_http_proxy="yes"]
6fbf66fa
JY
129)
130
51bd56f4
ABL
131AC_ARG_ENABLE(
132 [fragment],
709f7a1f 133 [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])],
51bd56f4
ABL
134 ,
135 [enable_fragment="yes"]
8bc93d7f
JY
136)
137
51bd56f4
ABL
138AC_ARG_ENABLE(
139 [multihome],
709f7a1f 140 [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome) @<:@default=yes@:>@])],
51bd56f4
ABL
141 ,
142 [enable_multihome="yes"]
6add6b2f
JY
143)
144
51bd56f4
ABL
145AC_ARG_ENABLE(
146 [port-share],
709f7a1f 147 [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])],
51bd56f4
ABL
148 ,
149 [enable_port_share="yes"]
6fbf66fa
JY
150)
151
51bd56f4
ABL
152AC_ARG_ENABLE(
153 [debug],
709f7a1f 154 [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])],
51bd56f4
ABL
155 ,
156 [enable_debug="yes"]
6fbf66fa
JY
157)
158
51bd56f4
ABL
159AC_ARG_ENABLE(
160 [small],
709f7a1f 161 [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=yes@:>@])],
51bd56f4
ABL
162 ,
163 [enable_small="no"]
6fbf66fa
JY
164)
165
51bd56f4
ABL
166AC_ARG_ENABLE(
167 [password-save],
709f7a1f 168 [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file @<:@default=yes@:>@])],
8993847d 169 ,
51bd56f4 170 [enable_password_save="no"]
6fbf66fa
JY
171)
172
51bd56f4
ABL
173AC_ARG_ENABLE(
174 [iproute2],
709f7a1f 175 [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])],
51bd56f4
ABL
176 ,
177 [enable_iproute2="no"]
fb7aa54a
JY
178)
179
51bd56f4
ABL
180AC_ARG_ENABLE(
181 [def-auth],
709f7a1f 182 [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication @<:@default=yes@:>@])],
51bd56f4
ABL
183 ,
184 [enable_def_auth="yes"]
fb7aa54a
JY
185)
186
51bd56f4
ABL
187AC_ARG_ENABLE(
188 [pf],
709f7a1f 189 [AS_HELP_STRING([--disable-pf], [disable internal packet filter @<:@default=yes@:>@])],
51bd56f4
ABL
190 ,
191 [enable_pf="yes"]
6fbf66fa
JY
192)
193
ce8271f5
ABL
194AC_ARG_ENABLE(
195 [plugin-auth-pam],
5a57e201 196 [AS_HELP_STRING([--disable-plugin-auth-pam], [disable auth-pam plugin @<:@default=platform specific@:>@])],
ce8271f5 197 ,
5a57e201
ABL
198 [
199 case "$host" in
200 *-*-openbsd*) enable_plugin_auth_pam="no";;
201 *-mingw*) enable_plugin_auth_pam="no";;
202 *) enable_plugin_auth_pam="yes";;
203 esac
204 ]
ce8271f5
ABL
205)
206
207AC_ARG_ENABLE(
208 [plugin-down-root],
5a57e201
ABL
209 [AS_HELP_STRING([--disable-plugin-down-root], [disable down-root plugin @<:@default=platform specific@:>@])],
210 ,
211 [
212 case "$host" in
213 *-mingw*) enable_plugin_down_root="no";;
214 *) enable_plugin_down_root="yes";;
215 esac
216 ]
ce8271f5
ABL
217)
218
219AC_ARG_ENABLE(
220 [pam-dlopen],
221 [AS_HELP_STRING([--enable-pam-dlopen], [dlopen libpam @<:@default=no@:>@])],
222 ,
223 [enable_pam_dlopen="no"]
224)
225
51bd56f4
ABL
226AC_ARG_ENABLE(
227 [strict],
709f7a1f 228 [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])],
51bd56f4
ABL
229 ,
230 [enable_strict="no"]
6fbf66fa
JY
231)
232
51bd56f4
ABL
233AC_ARG_ENABLE(
234 [pedantic],
709f7a1f 235 [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])],
51bd56f4
ABL
236 ,
237 [enable_pedantic="no"]
6fbf66fa
JY
238)
239
51bd56f4
ABL
240AC_ARG_ENABLE(
241 [strict-options],
709f7a1f 242 [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])],
51bd56f4
ABL
243 ,
244 [enable_strict_options="no"]
6fbf66fa
JY
245)
246
51bd56f4
ABL
247AC_ARG_ENABLE(
248 [selinux],
709f7a1f 249 [AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])],
51bd56f4
ABL
250 ,
251 [enable_selinux="no"]
99385447
JY
252)
253
51bd56f4
ABL
254AC_ARG_ENABLE(
255 [systemd],
709f7a1f 256 [AS_HELP_STRING([--enable-systemd], [enable systemd suppport @<:@default=no@:>@])],
51bd56f4
ABL
257 ,
258 [enable_systemd="no"]
9449e6a9
FC
259)
260
10b4b65e
ABL
261AC_ARG_WITH(
262 [special-build],
263 [AS_HELP_STRING([--with-special-build=STRING], [specify special build string])],
264 [test -n "${withval}" && AC_DEFINE_UNQUOTED([CONFIGURE_SPECIAL_BUILD], ["${withval}"], [special build string])]
265)
266
51bd56f4
ABL
267AC_ARG_WITH(
268 [mem-check],
709f7a1f 269 [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])],
51bd56f4
ABL
270 [
271 case "${withval}" in
272 dmalloc|valgrind|ssl|no) ;;
273 *) AC_MSG_ERROR([bad value ${withval} for --mem-check]) ;;
274 esac
275 ],
276 [with_mem_check="no"]
6fbf66fa
JY
277)
278
51bd56f4 279AC_ARG_WITH(
9b33b5a4
ABL
280 [crypto-library],
281 [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|polarssl @<:@default=openssl@:>@])],
51bd56f4
ABL
282 [
283 case "${withval}" in
284 openssl|polarssl) ;;
9b33b5a4 285 *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;;
51bd56f4
ABL
286 esac
287 ],
9b33b5a4 288 [with_crypto_library="openssl"]
0a180174 289)
0a180174 290
ce8271f5
ABL
291AC_ARG_WITH(
292 [plugindir],
293 [AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
294 ,
295 [with_plugindir="\$(libdir)/openvpn/plugins"]
296)
297
298
6440083e 299AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
86715242 300case "$host" in
51bd56f4
ABL
301 *-*-linux*)
302 AC_DEFINE([TARGET_LINUX], [1], [Are we running on Linux?])
303 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix])
304 ;;
305 *-*-solaris*)
306 AC_DEFINE([TARGET_SOLARIS], [1], [Are we running on Solaris?])
307 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["S"], [Target prefix])
308 ;;
309 *-*-openbsd*)
310 AC_DEFINE([TARGET_OPENBSD], [1], [Are we running on OpenBSD?])
311 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["O"], [Target prefix])
312 ;;
313 *-*-freebsd*)
314 AC_DEFINE([TARGET_FREEBSD], [1], [Are we running on FreeBSD?])
315 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["F"], [Target prefix])
316 ;;
317 *-*-netbsd*)
318 AC_DEFINE([TARGET_NETBSD], [1], [Are we running NetBSD?])
319 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["N"], [Target prefix])
320 ;;
321 *-*-darwin*)
322 AC_DEFINE([TARGET_DARWIN], [1], [Are we running on Mac OS X?])
323 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["M"], [Target prefix])
05f16e84 324 have_tap_header="yes"
51bd56f4
ABL
325 dnl some Mac OS X tendering (we use vararg macros...)
326 CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
327 ;;
328 *-mingw*)
329 AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?])
330 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
4b1a82db
ABL
331 CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
332 CPPFLAGS="${CPPFLAGS} -DNTDDI_VERSION=NTDDI_WINXP -D_WIN32_WINNT=_WIN32_WINNT_WINXP"
51bd56f4 333 WIN32=yes
51bd56f4
ABL
334 ;;
335 *-*-dragonfly*)
336 AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
337 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["D"], [Target prefix])
338 ;;
339 *)
340 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
05f16e84 341 have_tap_header="yes"
51bd56f4 342 ;;
6fbf66fa
JY
343esac
344
51bd56f4
ABL
345PKG_PROG_PKG_CONFIG
346AC_PROG_CPP
6fbf66fa 347AC_PROG_INSTALL
51bd56f4 348AC_PROG_LN_S
7046ff20 349AC_PROG_SED
51bd56f4 350AC_PROG_MAKE_SET
6fbf66fa 351
c3fc703d
ABL
352AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility])
353AC_ARG_VAR([ROUTE], [full path to route utility])
354AC_ARG_VAR([IPROUTE], [full path to ip utility])
355AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests
356AC_ARG_VAR([MAN2HTML], [path to man2html utility])
7046ff20 357AC_ARG_VAR([GIT], [path to git utility])
c3fc703d
ABL
358AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
359AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
360AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
361AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests
362AC_CHECK_PROGS([MAN2HTML], [man2html])
7046ff20 363AC_CHECK_PROGS([GIT], [git]) # optional
c3fc703d
ABL
364AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
365AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
366AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
367
98bc1a3e
ABL
368#
369# Libtool
370#
371ifdef(
372 [LT_INIT],
373 [
374 LT_INIT([win32-dll])
375 LT_LANG([Windows Resource])
376 ],
377 [
378 AC_LIBTOOL_WIN32_DLL
379 AC_LIBTOOL_RC
380 AC_PROG_LIBTOOL
381 ]
382)
383
6fbf66fa
JY
384AC_C_CONST
385AC_C_INLINE
386AC_C_VOLATILE
387AC_TYPE_OFF_T
388AC_TYPE_PID_T
389AC_TYPE_SIZE_T
390AC_TYPE_UID_T
51bd56f4
ABL
391AC_TYPE_INT8_T
392AC_TYPE_INT16_T
393AC_TYPE_INT32_T
394AC_TYPE_INT64_T
395AC_TYPE_UINT8_T
396AC_TYPE_UINT16_T
397AC_TYPE_UINT32_T
398AC_TYPE_UINT64_T
399AC_TYPE_SIGNAL
6fbf66fa
JY
400AX_CPP_VARARG_MACRO_ISO
401AX_CPP_VARARG_MACRO_GCC
0dbd45db 402AX_TYPE_SOCKLEN_T
6fbf66fa 403AX_EMPTY_ARRAY
51bd56f4
ABL
404AC_CHECK_SIZEOF([unsigned int])
405AC_CHECK_SIZEOF([unsigned long])
406AC_CHECK_HEADERS([ \
40299712 407 stdio.h stdarg.h stdbool.h limits.h \
51bd56f4
ABL
408 time.h errno.h fcntl.h io.h direct.h \
409 ctype.h sys/types.h sys/socket.h \
bdae4110 410 signal.h unistd.h dlfcn.h \
51bd56f4
ABL
411 netinet/in.h netinet/in_systm.h \
412 netinet/tcp.h arpa/inet.h netdb.h \
413 windows.h winsock2.h ws2tcpip.h \
414])
cab53332 415AC_CHECK_HEADERS([ \
a2d747bb 416 sys/time.h sys/ioctl.h sys/stat.h \
f641637a 417 sys/mman.h sys/file.h sys/wait.h \
7cacdfd4 418 unistd.h signal.h libgen.h stropts.h \
cab53332 419 syslog.h pwd.h grp.h \
7cacdfd4 420 sys/sockio.h sys/uio.h linux/sockios.h \
cab53332
ABL
421 linux/types.h sys/poll.h sys/epoll.h err.h \
422])
6fbf66fa 423
51bd56f4
ABL
424SOCKET_INCLUDES="
425#ifdef HAVE_STDLIB_H
426#include <stdlib.h>
427#endif
428#ifdef HAVE_SYS_TYPES_H
429#include <sys/types.h>
430#endif
431#ifdef HAVE_SYS_SOCKET_H
432#include <sys/socket.h>
433#endif
434#ifdef HAVE_NETINET_IN_H
435#include <netinet/in.h>
436#endif
437#ifdef HAVE_WINDOWS_H
438#include <windows.h>
439#endif
440#ifdef HAVE_WINSOCK2_H
441#include <winsock2.h>
442#endif
443#ifdef HAVE_WS2TCPIP_H
444#include <ws2tcpip.h>
445#endif
2a744891
ABL
446#ifdef HAVE_NETINET_IN_SYSTM_H
447#include <netinet/in_systm.h>
448#endif
4025a595
ABL
449#ifdef HAVE_NETINET_IP_H
450#include <netinet/ip.h>
451#endif
51bd56f4 452"
1bda73a7 453
cab53332 454AC_CHECK_HEADERS(
fbc04bed 455 [net/if.h netinet/ip.h netinet/if_ether.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h],
51bd56f4 456 ,
51bd56f4 457 ,
cab53332 458 [[${SOCKET_INCLUDES}]]
51bd56f4
ABL
459)
460
461AC_CHECK_TYPES(
6fbf66fa 462 [in_addr_t],
51bd56f4
ABL
463 ,
464 [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])],
465 [[${SOCKET_INCLUDES}]]
466)
6fbf66fa
JY
467AC_CHECK_TYPE(
468 [struct iphdr],
7c0a2b5f 469 [AC_DEFINE([HAVE_IPHDR], [1], [struct iphdr needed for IPv6 support])],
51bd56f4
ABL
470 ,
471 [[${SOCKET_INCLUDES}]]
472)
6fbf66fa
JY
473AC_CHECK_TYPE(
474 [struct sock_extended_err],
7c0a2b5f 475 [AC_DEFINE([HAVE_SOCK_EXTENDED_ERR], [1], [struct sock_extended_err needed for extended socket error support])],
51bd56f4
ABL
476 ,
477 [[${SOCKET_INCLUDES}]]
478)
6fbf66fa
JY
479AC_CHECK_TYPE(
480 [struct msghdr],
7c0a2b5f 481 [AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended socket error support])],
51bd56f4
ABL
482 ,
483 [[${SOCKET_INCLUDES}]]
484)
6fbf66fa
JY
485AC_CHECK_TYPE(
486 [struct cmsghdr],
7c0a2b5f 487 [AC_DEFINE([HAVE_CMSGHDR], [1], [struct cmsghdr needed for extended socket error support])],
51bd56f4
ABL
488 ,
489 [[${SOCKET_INCLUDES}]]
490)
8bc93d7f
JY
491AC_CHECK_TYPE(
492 [struct in_pktinfo],
7c0a2b5f 493 [AC_DEFINE([HAVE_IN_PKTINFO], [1], [struct in_pktinfo needed for IP_PKTINFO support])],
51bd56f4
ABL
494 ,
495 [[${SOCKET_INCLUDES}]]
496)
497AC_CHECK_TYPE(
498 [struct sockaddr_in6],
499 ,
500 [AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])],
501 [[${SOCKET_INCLUDES}]]
502)
cab53332
ABL
503AC_CHECK_DECLS(
504 [SO_MARK],
505 ,
506 ,
507 [[${SOCKET_INCLUDES}]]
508)
51bd56f4 509
cab53332
ABL
510dnl We emulate signals in Windows
511AC_CHECK_DECLS(
512 [SIGHUP],
51bd56f4 513 ,
cab53332
ABL
514 [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])],
515 [[
516 #ifdef HAVE_SIGNAL_H
517 #include <signal.h>
518 #endif
519 ]]
51bd56f4 520)
cab53332
ABL
521AC_CHECK_DECLS(
522 [SIGINT],
523 ,
524 [AC_DEFINE([SIGINT], [2], [SIGINT replacement])],
525 [[
526 #ifdef HAVE_SIGNAL_H
527 #include <signal.h>
528 #endif
529 ]]
530)
531AC_CHECK_DECLS(
532 [SIGUSR1],
533 ,
534 [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
535 [[
536 #ifdef HAVE_SIGNAL_H
537 #include <signal.h>
538 #endif
539 ]]
540)
541AC_CHECK_DECLS(
542 [SIGUSR2],
543 ,
544 [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
545 [[
546 #ifdef HAVE_SIGNAL_H
547 #include <signal.h>
548 #endif
549 ]]
550)
551AC_CHECK_DECLS(
552 [SIGTERM],
553 ,
554 [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])],
555 [[
556 #ifdef HAVE_SIGNAL_H
557 #include <signal.h>
558 #endif
559 ]]
560)
561
562AC_FUNC_FORK
563
51bd56f4
ABL
564AC_CHECK_FUNCS([ \
565 daemon chroot getpwnam setuid nice system getpid dup dup2 \
566 getpass strerror syslog openlog mlockall getgrnam setgid \
567 setgroups stat flock readv writev time gettimeofday \
cab53332 568 ctime memset vsnprintf strdup \
51bd56f4
ABL
569 setsid chdir putenv getpeername unlink \
570 chsize ftruncate execve getpeereid umask basename dirname access \
571 epoll_create \
572])
aee7428c
ABL
573
574AC_CHECK_LIB(
575 [dl],
576 [dlopen],
577 [DL_LIBS="-ldl"]
578)
579AC_SUBST([DL_LIBS])
580
581AC_CHECK_LIB(
582 [nsl],
583 [inet_ntoa],
584 [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
585)
586AC_CHECK_LIB(
587 [socket],
588 [socket],
589 [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
590)
591AC_CHECK_LIB(
592 [resolv],
593 [gethostbyname],
594 [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
595)
596AC_SUBST([SOCKETS_LIBS])
597
598old_LIBS="${LIBS}"
599LIBS="${LIBS} ${SOCKETS_LIBS}"
f106f64b 600AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
51bd56f4
ABL
601AC_CHECK_FUNCS(
602 [res_init],
603 ,
604 ,
605 [[#include <resolv.h>]]
606)
0eb2ee14 607# Windows use stdcall for winsock so we cannot auto detect these
51bd56f4
ABL
608m4_define(
609 [SOCKET_FUNCS],
610[socket recv recvfrom send sendto listen dnl
611accept connect bind select gethostbyname inet_ntoa]dnl
612)
613m4_define(
614 [SOCKET_OPT_FUNCS],
615 [setsockopt getsockopt getsockname poll]dnl
616)
1bda73a7 617if test "${WIN32}" = "yes"; then
51bd56f4
ABL
618 m4_foreach(
619 [F],
620 m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
621 m4_define([UF], [[m4_join([_], [HAVE], m4_toupper(F))]])
622 AC_DEFINE([UF], [1], [Win32 builtin])
623 )
1bda73a7 624else
51bd56f4
ABL
625 AC_CHECK_FUNCS(
626 SOCKET_FUNCS,
627 ,
628 [AC_MSG_ERROR([Required library function not found])]
629 )
630 AC_CHECK_FUNCS(SOCKET_OPT_FUNCS)
631fi
aee7428c 632LIBS="${old_LIBS}"
7647a48c 633
7cacdfd4
ABL
634AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap])
635old_CFLAGS="${CFLAGS}"
636CFLAGS="${CFLAGS} ${TAP_CFLAGS}"
637AC_CHECK_HEADERS(
638 [ \
639 net/if_tun.h net/tun/if_tun.h \
640 linux/if_tun.h \
641 tap-windows.h \
642 ],
643 [have_tap_header="yes"]
644)
88f3a402
ABL
645AC_CHECK_DECLS(
646 [TUNSETPERSIST],
647 [AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])],
648 ,
649 [[
650 #ifdef HAVE_LINUX_IF_TUN_H
651 #include <linux/if_tun.h>
652 #endif
653 ]]
654)
7cacdfd4
ABL
655CFLAGS="${old_CFLAGS}"
656test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])
657
cd5990e0
ABL
658AC_CHECK_LIB(
659 [selinux],
660 [setcon],
661 [SELINUX_LIBS="-lselinux"]
662)
663AC_SUBST([SELINUX_LIBS])
664
ce8271f5
ABL
665AC_ARG_VAR([LIBPAM_CFLAGS], [C compiler flags for libpam])
666AC_ARG_VAR([LIBPAM_LIBS], [linker flags for libpam])
667if test -z "${LIBPAM_LIBS}"; then
668 AC_CHECK_LIB(
669 [pam],
670 [pam_start],
671 [LIBPAM_LIBS="-lpam"]
672 )
673fi
674
51bd56f4
ABL
675case "${with_mem_check}" in
676 valgrind)
677 AC_CHECK_HEADER(
678 [valgrind/memcheck.h],
679 [
680 CFLAGS="${CFLAGS} -g -fno-inline"
681 AC_DEFINE(
682 [USE_VALGRIND],
683 [1],
684 [Use valgrind memory debugging library]
685 )
686 ],
687 [AC_MSG_ERROR([valgrind headers not found.])]
688 )
689 ;;
690 dmalloc)
691 AC_CHECK_HEADER(
692 [dmalloc.h],
693 [AC_CHECK_LIB(
694 [dmalloc],
695 [malloc],
696 [
e02570fd 697 LIBS="${LIBS} -ldmalloc"
51bd56f4
ABL
698 AC_DEFINE(
699 [DMALLOC],
700 [1],
701 [Use dmalloc memory debugging library]
702 )
703 ],
704 [AC_MSG_ERROR([dmalloc library not found.])]
705 )],
706 [AC_MSG_ERROR([dmalloc headers not found.])]
707 )
708 ;;
709 ssl)
710 AC_CHECK_LIB(
711 [ssl],
712 [CRYPTO_mem_ctrl],
713 [
714 AC_DEFINE(
715 [CRYPTO_MDEBUG],
716 [1],
717 [Use memory debugging function in OpenSSL]
718 )
719 AC_MSG_NOTICE([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG])
720 ],
721 [AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])]
722 )
723 ;;
724esac
6fbf66fa 725
9a3f6702
SK
726PKG_CHECK_MODULES(
727 [PKCS11_HELPER],
728 [libpkcs11-helper-1 >= 1.02],
729 [have_pkcs11_helper="yes"],
730 []
731)
732
9b33b5a4
ABL
733PKG_CHECK_MODULES(
734 [OPENSSL_CRYPTO],
735 [libcrypto >= 0.9.6],
736 [have_openssl_crypto="yes"],
737 [AC_CHECK_LIB(
738 [crypto],
739 [RSA_new],
740 [
741 have_openssl_crypto="yes"
742 OPENSSL_CRYPTO_LIBS="-lcrypto"
743 ]
744 )]
745)
746
747PKG_CHECK_MODULES(
748 [OPENSSL_SSL],
749 [libssl >= 0.9.6],
750 [have_openssl_ssl="yes"],
751 [AC_CHECK_LIB(
752 [ssl],
753 [SSL_CTX_new],
754 [
755 have_openssl_ssl="yes"
756 OPENSSL_SSL_LIBS="-lssl"
757 ]
758 )]
759)
760
761if test "${have_openssl_crypto}" = "yes"; then
762 saved_CFLAGS="${CFLAGS}"
763 saved_LIBS="${LIBS}"
764 CFLAGS="${CFLAGS} ${OPENSSL_CRYPTO_CFLAGS}"
765 LIBS="${LIBS} ${OPENSSL_CRYPTO_LIBS}"
766 AC_CHECK_FUNCS([EVP_CIPHER_CTX_set_key_length])
767 have_openssl_engine="yes"
768 AC_CHECK_FUNCS(
769 [ \
770 ENGINE_load_builtin_engines \
771 ENGINE_register_all_complete \
772 ENGINE_cleanup \
773 ],
774 ,
775 [have_openssl_engine="no"; break]
776 )
777
778 CFLAGS="${saved_CFLAGS}"
779 LIBS="${saved_LIBS}"
780fi
781
782AC_ARG_VAR([POLARSSL_CFLAGS], [C compiler flags for polarssl])
783AC_ARG_VAR([POLARSSL_LIBS], [linker flags for polarssl])
784have_polarssl_ssl="yes"
785have_polarssl_crypto="yes"
786if test -z "${POLARSSL_LIBS}"; then
787 AC_CHECK_LIB(
788 [polarssl],
789 [ssl_init],
790 [POLARSSL_LIBS="-lpolarssl"],
791 [
792 have_polarssl_ssl="no"
793 AC_CHECK_LIB(
794 [polarssl],
795 [aes_crypt_cbc],
796 ,
9a3f6702
SK
797 [have_polarssl_crypto="no"],
798 [${PKCS11_HELPER_LIBS}]
9b33b5a4 799 )
9a3f6702
SK
800 ],
801 [${PKCS11_HELPER_LIBS}]
9b33b5a4
ABL
802 )
803fi
804
13b38eb0
ABL
805if test "${with_crypto_library}" = "polarssl" ; then
806 AC_MSG_CHECKING([polarssl version])
807 old_CFLAGS="${CFLAGS}"
808 CFLAGS="${POLARSSL_CFLAGS} ${CFLAGS}"
809 AC_COMPILE_IFELSE(
810 [AC_LANG_PROGRAM(
811 [[
812#include <polarssl/version.h>
813 ]],
814 [[
4a56d19f 815#if POLARSSL_VERSION_NUMBER < 0x01020500
9a3f6702 816#error invalid version
13b38eb0
ABL
817#endif
818 ]]
819 )],
820 [AC_MSG_RESULT([ok])],
9a3f6702 821 [AC_MSG_ERROR([PolarSSL 1.2.5 or newer required])]
13b38eb0 822 )
9a3f6702
SK
823
824 polarssl_with_pkcs11="no"
825 AC_COMPILE_IFELSE(
826 [AC_LANG_PROGRAM(
827 [[
828#include <polarssl/config.h>
829 ]],
830 [[
831#ifndef POLARSSL_PKCS11_C
832#error pkcs11 wrapper missing
833#endif
834 ]]
835 )],
836 polarssl_with_pkcs11="yes")
13b38eb0 837 CFLAGS="${old_CFLAGS}"
9a3f6702
SK
838
839 AC_MSG_CHECKING([polarssl pkcs11 support])
840 if test "${enable_pkcs11}" = "yes"; then
841 if test "${polarssl_with_pkcs11}" = "yes"; then
842 AC_MSG_RESULT([ok])
843 else
844 AC_MSG_ERROR([polarssl has no pkcs11 wrapper compiled in])
845 fi
846 else
847 if test "${polarssl_with_pkcs11}" != "yes"; then
848 AC_MSG_RESULT([ok])
849 else
850 AC_MSG_ERROR([PolarSSL compiled with PKCS11, while OpenVPN is not])
851 fi
852 fi
853
13b38eb0
ABL
854fi
855
74bbc71b
ABL
856AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
857AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
858have_lzo="yes"
859if test -z "${LZO_LIBS}"; then
860 AC_CHECK_LIB(
861 [lzo2],
862 [lzo1x_1_15_compress],
863 [LZO_LIBS="-llzo2"],
864 [AC_CHECK_LIB(
865 [lzo],
866 [lzo1x_1_15_compress],
867 [LZO_LIBS="-llzo"],
868 [have_lzo="no"]
869 )]
870 )
871fi
872if test "${have_lzo}" = "yes"; then
873 saved_CFLAGS="${CFLAGS}"
874 CFLAGS="${CFLAGS} ${LZO_CFLAGS}"
875 AC_CHECK_HEADERS(
876 [lzo/lzoutil.h],
877 ,
878 [AC_CHECK_HEADERS(
879 [lzoutil.h],
880 ,
881 [AC_MSG_ERROR([lzoutil.h is missing])]
882 )]
883 )
884 AC_CHECK_HEADERS(
885 [lzo/lzo1x.h],
886 ,
887 [AC_CHECK_HEADERS(
888 [lzo1x.h],
889 ,
890 [AC_MSG_ERROR([lzo1x.h is missing])]
891 )]
892 )
893 CFLAGS="${saved_CFLAGS}"
6fbf66fa
JY
894fi
895
38d96bd7
JY
896dnl
897dnl check for Snappy library
898dnl
899
900AC_ARG_VAR([SNAPPY_CFLAGS], [C compiler flags for snappy])
901AC_ARG_VAR([SNAPPY_LIBS], [linker flags for snappy])
902if test "$enable_snappy" = "yes" && test "$enable_comp_stub" = "no"; then
903 AC_CHECKING([for Snappy Library and Header files])
904 havesnappylib=1
905
906 # if SNAPPY_LIBS is set, we assume it will work, otherwise test
907 if test -z "${SNAPPY_LIBS}"; then
908 AC_CHECK_LIB(snappy, snappy_compress,
909 [ SNAPPY_LIBS="-lsnappy" ],
910 [
911 AC_MSG_RESULT([Snappy library not found.])
912 havesnappylib=0
913 ])
914 fi
915
916 saved_CFLAGS="${CFLAGS}"
917 CFLAGS="${CFLAGS} ${SNAPPY_CFLAGS}"
918 AC_CHECK_HEADER(snappy-c.h,
919 ,
920 [
921 AC_MSG_RESULT([Snappy headers not found.])
922 havesnappylib=0
923 ])
924
925 if test $havesnappylib = 0 ; then
926 AC_MSG_RESULT([Snappy library available from http://code.google.com/p/snappy/])
927 AC_MSG_ERROR([Or try ./configure --disable-snappy OR ./configure --enable-comp-stub])
928 fi
929 OPTIONAL_SNAPPY_CFLAGS="${SNAPPY_CFLAGS}"
930 OPTIONAL_SNAPPY_LIBS="${SNAPPY_LIBS}"
931 AC_DEFINE(ENABLE_SNAPPY, 1, [Enable Snappy compression library])
932 CFLAGS="${saved_CFLAGS}"
933fi
934
935
7046ff20
ABL
936AC_MSG_CHECKING([git checkout])
937GIT_CHECKOUT="no"
938if test -n "${GIT}" -a -d "${srcdir}/.git"; then
939 AC_DEFINE([HAVE_CONFIG_VERSION_H], [1], [extra version available in config-version.h])
940 GIT_CHECKOUT="yes"
941fi
942AC_MSG_RESULT([${GIT_CHECKOUT}])
943
51bd56f4
ABL
944if test -n "${SP_PLATFORM_WINDOWS}"; then
945 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
946 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
947else
948 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['/'], [Path separator])
949 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["/"], [Path separator])
950fi
951
952dnl enable --x509-username-field feature if requested
953if test "${enable_x509_alt_username}" = "yes"; then
9b33b5a4 954 if test "${with_crypto_library}" = "polarssl" ; then
51bd56f4
ABL
955 AC_MSG_ERROR([PolarSSL does not support the --x509-username-field feature])
956 fi
957
958 AC_DEFINE([ENABLE_X509ALTUSERNAME], [1], [Enable --x509-username-field feature])
959fi
960
961test "${ac_cv_header_sys_uio_h}" = "yes" && AC_DEFINE([HAVE_IOVEC], [1], [struct iovec needed for IPv6 support])
962test "${enable_multi}" = "yes" && AC_DEFINE([ENABLE_CLIENT_SERVER], [1], [Enable client/server capability])
963test "${enable_server}" = "no" && AC_DEFINE([ENABLE_CLIENT_ONLY], [1], [Enable client capability only])
964test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability])
965test "${enable_socks}" = "yes" && AC_DEFINE([ENABLE_SOCKS], [1], [Enable Socks proxy support])
966test "${enable_http_proxy}" = "yes" && AC_DEFINE([ENABLE_HTTP_PROXY], [1], [Enable HTTP proxy support])
967test "${enable_multihome}" = "yes" && AC_DEFINE([ENABLE_MULTIHOME], [1], [Enable multi-homed UDP server capability])
968test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support])
969test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size])
970test "${enable_fragment}" = "yes" && AC_DEFINE([ENABLE_FRAGMENT], [1], [Enable internal fragmentation support])
971test "${enable_port_share}" = "yes" && AC_DEFINE([ENABLE_PORT_SHARE], [1], [Enable TCP Server port sharing])
972test "${enable_def_auth}" = "yes" && AC_DEFINE([ENABLE_DEF_AUTH], [1], [Enable deferred authentication])
973test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal packet filter])
974test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
975test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
976test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
c3fc703d 977
9b33b5a4
ABL
978case "${with_crypto_library}" in
979 openssl)
980 have_crypto_crypto="${have_openssl_crypto}"
981 have_crypto_ssl="${have_openssl_ssl}"
982 CRYPTO_CRYPTO_CFLAGS="${OPENSSL_CRYPTO_CFLAGS}"
983 CRYPTO_CRYPTO_LIBS="${OPENSSL_CRYPTO_LIBS}"
984 CRYPTO_SSL_CFLAGS="${OPENSSL_SSL_CFLAGS}"
985 CRYPTO_SSL_LIBS="${OPENSSL_SSL_LIBS}"
986 AC_DEFINE([ENABLE_CRYPTO_OPENSSL], [1], [Use OpenSSL library])
987 test "${have_openssl_engine}" = "yes" && AC_DEFINE([HAVE_OPENSSL_ENGINE], [1], [Use crypto library])
988 ;;
989 polarssl)
990 have_crypto_crypto="${have_polarssl_crypto}"
991 have_crypto_ssl="${have_polarssl_ssl}"
21fdfb73 992 CRYPTO_CRYPTO_CFLAGS="${POLARSSL_CFLAGS}"
9b33b5a4
ABL
993 CRYPTO_CRYPTO_LIBS="${POLARSSL_LIBS}"
994 AC_DEFINE([ENABLE_CRYPTO_POLARSSL], [1], [Use PolarSSL library])
995 ;;
996esac
997
998if test "${enable_ssl}" = "yes"; then
999 test "${enable_crypto}" != "yes" && AC_MSG_ERROR([crypto must be enabled for ssl])
1000 test "${have_crypto_ssl}" != "yes" && AC_MSG_ERROR([${with_ssl_library} ssl is required but missing])
1001 OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_SSL_CFLAGS}"
1002 OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_SSL_LIBS}"
1003 AC_DEFINE([ENABLE_SSL], [1], [Enable ssl library])
1004fi
1005
1006if test "${enable_crypto}" = "yes"; then
038f0aca 1007 test "${have_crypto_crypto}" != "yes" && AC_MSG_ERROR([${with_crypto_library} crypto is required but missing])
9b33b5a4
ABL
1008 OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_CRYPTO_CFLAGS}"
1009 OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_CRYPTO_LIBS}"
1010 AC_DEFINE([ENABLE_CRYPTO], [1], [Enable crypto library])
1011fi
1012
bdae4110 1013if test "${enable_plugins}" = "yes"; then
bdae4110
ABL
1014 OPTIONAL_DL_LIBS="${DL_LIBS}"
1015 AC_DEFINE([ENABLE_PLUGIN], [1], [Enable systemd support])
ce8271f5
ABL
1016else
1017 enable_plugin_auth_pam="no"
1018 enable_plugin_down_root="no"
bdae4110
ABL
1019fi
1020
c3fc703d
ABL
1021if test "${enable_iproute2}" = "yes"; then
1022 test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
1023 AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
1024else
1025 if test "${WIN32}" != "yes"; then
1026 test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing])
1027 test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing])
1028 fi
1029fi
51bd56f4 1030
cd5990e0
ABL
1031if test "${enable_selinux}" = "yes"; then
1032 test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing])
1033 OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}"
1034 AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
1035fi
1036
74bbc71b
ABL
1037if test "${enable_lzo}" = "yes"; then
1038 test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo enabled but missing])
1039 OPTIONAL_LZO_CFLAGS="${LZO_CFLAGS}"
1040 OPTIONAL_LZO_LIBS="${LZO_LIBS}"
1041 AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library])
1042fi
38d96bd7
JY
1043if test "${enable_comp_stub}" = "yes"; then
1044 test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and lzo enabled (use --disable-lzo)])
1045 test "${enable_snappy}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and snappy enabled (use --disable-snappy)])
1046 AC_DEFINE([ENABLE_COMP_STUB], [1], [Enable compression stub capability])
07084261
ABL
1047fi
1048
18b5fbdf
ABL
1049if test "${enable_pkcs11}" = "yes"; then
1050 test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
1051 test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
1052 OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}"
1053 OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}"
1054 AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11])
1055fi
1056
51bd56f4
ABL
1057if test "${enable_pedantic}" = "yes"; then
1058 enable_strict="yes"
31444111
ABL
1059 CFLAGS="${CFLAGS} -pedantic"
1060 test "${WIN32}" != "yes" && CFLAGS="${CFLAGS} -ansi"
51bd56f4
ABL
1061fi
1062if test "${enable_strict}" = "yes"; then
1063 CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
99385447
JY
1064fi
1065
c3fc703d
ABL
1066if test "${WIN32}" = "yes"; then
1067 test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
1068fi
1069
ce8271f5
ABL
1070if test "${enable_plugin_auth_pam}" = "yes"; then
1071 PLUGIN_AUTH_PAM_CFLAGS="${LIBPAM_CFLAGS}"
1072 if test "${enable_pam_dlopen}" = "yes"; then
1073 AC_DEFINE([USE_PAM_DLOPEN], [1], [dlopen libpam])
1074 PLUGIN_AUTH_PAM_LIBS="${DL_LIBS}"
1075 else
1076 test -z "${LIBPAM_LIBS}" && AC_MSG_ERROR([libpam required but missing])
1077 PLUGIN_AUTH_PAM_LIBS="${LIBPAM_LIBS}"
1078 fi
1079fi
1080
fcff80aa
ABL
1081CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
1082AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
1083
ac2447cd
ABL
1084TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
1085TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR"
1086TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
1087AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id])
1088AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN])
1089AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN])
1090AC_SUBST([TAP_WIN_COMPONENT_ID])
1091AC_SUBST([TAP_WIN_MIN_MAJOR])
1092AC_SUBST([TAP_WIN_MIN_MINOR])
1bda73a7 1093
bdae4110 1094AC_SUBST([OPTIONAL_DL_LIBS])
cd5990e0 1095AC_SUBST([OPTIONAL_SELINUX_LIBS])
9b33b5a4
ABL
1096AC_SUBST([OPTIONAL_CRYPTO_CFLAGS])
1097AC_SUBST([OPTIONAL_CRYPTO_LIBS])
74bbc71b
ABL
1098AC_SUBST([OPTIONAL_LZO_CFLAGS])
1099AC_SUBST([OPTIONAL_LZO_LIBS])
38d96bd7
JY
1100AC_SUBST([OPTIONAL_SNAPPY_CFLAGS])
1101AC_SUBST([OPTIONAL_SNAPPY_LIBS])
18b5fbdf
ABL
1102AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
1103AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
bdae4110 1104
ce8271f5
ABL
1105AC_SUBST([PLUGIN_AUTH_PAM_CFLAGS])
1106AC_SUBST([PLUGIN_AUTH_PAM_LIBS])
1107
51bd56f4 1108AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
7046ff20 1109AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"])
ce8271f5
ABL
1110AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "yes"])
1111AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"])
1bda73a7 1112
ce8271f5 1113plugindir="${with_plugindir}"
880a2ae9 1114sampledir="\$(docdir)/sample"
ce8271f5 1115AC_SUBST([plugindir])
880a2ae9
ABL
1116AC_SUBST([sampledir])
1117
51bd56f4 1118AC_CONFIG_FILES([
6187644b 1119 version.sh
1bda73a7 1120 Makefile
98bc1a3e 1121 build/Makefile
4b1a82db
ABL
1122 build/msvc/Makefile
1123 build/msvc/msvc-generate/Makefile
34cb9132
ABL
1124 distro/Makefile
1125 distro/rpm/Makefile
1126 distro/rpm/openvpn.spec
1127 include/Makefile
1128 src/Makefile
dc81e743 1129 src/compat/Makefile
34cb9132
ABL
1130 src/openvpn/Makefile
1131 src/openvpnserv/Makefile
ce8271f5
ABL
1132 src/plugins/Makefile
1133 src/plugins/auth-pam/Makefile
1134 src/plugins/down-root/Makefile
34cb9132
ABL
1135 tests/Makefile
1136 sample/Makefile
1137 doc/Makefile
1bda73a7 1138])
34cb9132 1139AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])
51bd56f4 1140AC_OUTPUT