1 dnl OpenVPN -- An application to securely tunnel IP networks
2 dnl over a single UDP port, with support for SSL/TLS-based
3 dnl session authentication and key exchange,
4 dnl packet encryption, packet authentication, and
5 dnl packet compression.
7 dnl Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
8 dnl Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
10 dnl This program is free software; you can redistribute it and/or modify
11 dnl it under the terms of the GNU General Public License as published by
12 dnl the Free Software Foundation; either version 2 of the License, or
13 dnl (at your option) any later version.
15 dnl This program is distributed in the hope that it will be useful,
16 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 dnl GNU General Public License for more details.
20 dnl You should have received a copy of the GNU General Public License
21 dnl along with this program (see the file COPYING included with this
22 dnl distribution); if not, write to the Free Software Foundation, Inc.,
23 dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 dnl Process this file with autoconf to produce a configure script.
29 m4_include(version.m4)
30 AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME])
32 AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format])
34 AC_CONFIG_AUX_DIR([.])
35 AC_CONFIG_HEADERS([config.h])
36 AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
37 AC_CONFIG_MACRO_DIR([m4])
39 dnl Initialize automake. automake < 1.12 didn't have serial-tests and
40 dnl gives an error if it sees this, but for automake >= 1.13
41 dnl serial-tests is required so we have to include it. Solution is to
42 dnl test for the version of automake (by running an external command)
43 dnl and provide it if necessary. Note we have to do this entirely using
44 dnl m4 macros since automake queries this macro by running
45 dnl 'autoconf --trace ...'.
46 m4_define([serial_tests], [
47 m4_esyscmd([automake --version |
49 awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
52 AM_INIT_AUTOMAKE(foreign serial_tests) dnl NB: Do not [quote] this parameter.
54 AC_USE_SYSTEM_EXTENSIONS
58 [AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@default=yes@:>@])],
65 [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers @<:@default=no@:>@])],
67 [enable_lzo_stub="no"]
72 [AS_HELP_STRING([--disable-crypto], [disable crypto support @<:@default=yes@:>@])],
79 [AS_HELP_STRING([--disable-ofb-cfb], [disable support for OFB and CFB cipher modes @<:@default=yes@:>@])],
81 [enable_crypto_ofb_cfb="yes"]
86 [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange @<:@default=yes@:>@])],
93 [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])],
95 [enable_x509_alt_username="no"]
100 [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode) @<:@default=yes@:>@])],
107 [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support) @<:@default=yes@:>@])],
109 [enable_server="yes"]
114 [AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])],
116 [enable_plugins="yes"]
121 [AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])],
123 [enable_management="yes"]
128 [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])],
135 [AS_HELP_STRING([--disable-socks], [disable Socks support @<:@default=yes@:>@])],
142 [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support @<:@default=yes@:>@])],
144 [enable_http_proxy="yes"]
149 [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])],
151 [enable_fragment="yes"]
156 [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome) @<:@default=yes@:>@])],
158 [enable_multihome="yes"]
163 [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])],
165 [enable_port_share="yes"]
170 [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])],
177 [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=no@:>@])],
184 [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])],
186 [enable_iproute2="no"]
191 [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication @<:@default=yes@:>@])],
193 [enable_def_auth="yes"]
198 [AS_HELP_STRING([--disable-pf], [disable internal packet filter @<:@default=yes@:>@])],
205 [AS_HELP_STRING([--disable-plugin-auth-pam], [disable auth-pam plugin @<:@default=platform specific@:>@])],
209 *-*-openbsd*) enable_plugin_auth_pam="no";;
210 *-mingw*) enable_plugin_auth_pam="no";;
211 *) enable_plugin_auth_pam="yes";;
218 [AS_HELP_STRING([--disable-plugin-down-root], [disable down-root plugin @<:@default=platform specific@:>@])],
222 *-mingw*) enable_plugin_down_root="no";;
223 *) enable_plugin_down_root="yes";;
230 [AS_HELP_STRING([--enable-pam-dlopen], [dlopen libpam @<:@default=no@:>@])],
232 [enable_pam_dlopen="no"]
237 [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])],
244 [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])],
246 [enable_pedantic="no"]
251 [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])],
253 [enable_strict_options="no"]
258 [AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])],
260 [enable_selinux="no"]
265 [AS_HELP_STRING([--enable-systemd], [enable systemd suppport @<:@default=no@:>@])],
267 [enable_systemd="no"]
272 [AS_HELP_STRING([--with-special-build=STRING], [specify special build string])],
273 [test -n "${withval}" && AC_DEFINE_UNQUOTED([CONFIGURE_SPECIAL_BUILD], ["${withval}"], [special build string])]
278 [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])],
281 dmalloc|valgrind|ssl|no) ;;
282 *) AC_MSG_ERROR([bad value ${withval} for --mem-check]) ;;
285 [with_mem_check="no"]
290 [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|polarssl @<:@default=openssl@:>@])],
294 *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;;
297 [with_crypto_library="openssl"]
302 [AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
304 [with_plugindir="\$(libdir)/openvpn/plugins"]
308 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
311 AC_DEFINE([TARGET_LINUX], [1], [Are we running on Linux?])
312 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix])
315 AC_DEFINE([TARGET_SOLARIS], [1], [Are we running on Solaris?])
316 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["S"], [Target prefix])
319 AC_DEFINE([TARGET_OPENBSD], [1], [Are we running on OpenBSD?])
320 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["O"], [Target prefix])
323 AC_DEFINE([TARGET_FREEBSD], [1], [Are we running on FreeBSD?])
324 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["F"], [Target prefix])
327 AC_DEFINE([TARGET_NETBSD], [1], [Are we running NetBSD?])
328 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["N"], [Target prefix])
331 AC_DEFINE([TARGET_DARWIN], [1], [Are we running on Mac OS X?])
332 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["M"], [Target prefix])
333 have_tap_header="yes"
334 dnl some Mac OS X tendering (we use vararg macros...)
335 CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
338 AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?])
339 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
340 CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
341 CPPFLAGS="${CPPFLAGS} -DNTDDI_VERSION=NTDDI_WINXP -D_WIN32_WINNT=_WIN32_WINNT_WINXP"
345 AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
346 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["D"], [Target prefix])
349 AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
350 have_tap_header="yes"
361 AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility])
362 AC_ARG_VAR([ROUTE], [full path to route utility])
363 AC_ARG_VAR([IPROUTE], [full path to ip utility])
364 AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests
365 AC_ARG_VAR([MAN2HTML], [path to man2html utility])
366 AC_ARG_VAR([GIT], [path to git utility])
367 AC_ARG_VAR([SYSTEMD_ASK_PASSWORD], [path to systemd-ask-password utility])
368 AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
369 AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
370 AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
371 AC_PATH_PROGS([SYSTEMD_ASK_PASSWORD], [systemd-ask-password],, [$PATH:/usr/local/bin:/usr/bin:/bin])
372 AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests
373 AC_CHECK_PROGS([MAN2HTML], [man2html])
374 AC_CHECK_PROGS([GIT], [git]) # optional
375 AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
376 AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
377 AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
378 AC_DEFINE_UNQUOTED([SYSTEMD_ASK_PASSWORD_PATH], ["$SYSTEMD_ASK_PASSWORD"], [Path to systemd-ask-password tool])
387 LT_LANG([Windows Resource])
412 AX_CPP_VARARG_MACRO_ISO
413 AX_CPP_VARARG_MACRO_GCC
416 AC_CHECK_SIZEOF([unsigned int])
417 AC_CHECK_SIZEOF([unsigned long])
419 stdio.h stdarg.h stdbool.h limits.h \
420 time.h errno.h fcntl.h io.h direct.h \
421 ctype.h sys/types.h sys/socket.h \
422 signal.h unistd.h dlfcn.h \
423 netinet/in.h netinet/in_systm.h \
424 netinet/tcp.h arpa/inet.h netdb.h \
425 windows.h winsock2.h ws2tcpip.h \
429 sys/time.h sys/ioctl.h sys/stat.h \
430 sys/mman.h sys/file.h sys/wait.h \
431 unistd.h signal.h libgen.h stropts.h \
432 syslog.h pwd.h grp.h \
433 sys/sockio.h sys/uio.h linux/sockios.h \
434 linux/types.h sys/poll.h sys/epoll.h err.h \
441 #ifdef HAVE_SYS_TYPES_H
442 #include <sys/types.h>
444 #ifdef HAVE_SYS_SOCKET_H
445 #include <sys/socket.h>
447 #ifdef HAVE_NETINET_IN_H
448 #include <netinet/in.h>
450 #ifdef HAVE_WINDOWS_H
453 #ifdef HAVE_WINSOCK2_H
454 #include <winsock2.h>
456 #ifdef HAVE_WS2TCPIP_H
457 #include <ws2tcpip.h>
459 #ifdef HAVE_NETINET_IN_SYSTM_H
460 #include <netinet/in_systm.h>
462 #ifdef HAVE_NETINET_IP_H
463 #include <netinet/ip.h>
468 [net/if.h netinet/ip.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h],
471 [[${SOCKET_INCLUDES}]]
477 [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])],
478 [[${SOCKET_INCLUDES}]]
482 [AC_DEFINE([HAVE_IPHDR], [1], [struct iphdr needed for IPv6 support])],
484 [[${SOCKET_INCLUDES}]]
487 [struct sock_extended_err],
488 [AC_DEFINE([HAVE_SOCK_EXTENDED_ERR], [1], [struct sock_extended_err needed for extended socket error support])],
490 [[${SOCKET_INCLUDES}]]
494 [AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended socket error support])],
496 [[${SOCKET_INCLUDES}]]
500 [AC_DEFINE([HAVE_CMSGHDR], [1], [struct cmsghdr needed for extended socket error support])],
502 [[${SOCKET_INCLUDES}]]
506 [AC_DEFINE([HAVE_IN_PKTINFO], [1], [struct in_pktinfo needed for IP_PKTINFO support])],
508 [[${SOCKET_INCLUDES}]]
511 [struct sockaddr_in6],
513 [AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])],
514 [[${SOCKET_INCLUDES}]]
520 [[${SOCKET_INCLUDES}]]
523 dnl We emulate signals in Windows
527 [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])],
537 [AC_DEFINE([SIGINT], [2], [SIGINT replacement])],
547 [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
557 [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
567 [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])],
578 daemon chroot getpwnam setuid nice system getpid dup dup2 \
579 getpass strerror syslog openlog mlockall getgrnam setgid \
580 setgroups stat flock readv writev time gettimeofday \
581 ctime memset vsnprintf strdup \
582 setsid chdir putenv getpeername unlink \
583 chsize ftruncate execve getpeereid umask basename dirname access \
597 [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
602 [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
607 [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
609 AC_SUBST([SOCKETS_LIBS])
612 LIBS="${LIBS} ${SOCKETS_LIBS}"
613 AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
614 # Windows use stdcall for winsock so we cannot auto detect these
617 [socket recv recvfrom send sendto listen dnl
618 accept connect bind select gethostbyname inet_ntoa]dnl
622 [setsockopt getsockopt getsockname poll]dnl
624 if test "${WIN32}" = "yes"; then
627 m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
628 m4_define([UF], [[m4_join([_], [HAVE], m4_toupper(F))]])
629 AC_DEFINE([UF], [1], [Win32 builtin])
635 [AC_MSG_ERROR([Required library function not found])]
637 AC_CHECK_FUNCS(SOCKET_OPT_FUNCS)
641 # we assume res_init() always exist, but need to find out *where*...
642 AC_SEARCH_LIBS(__res_init, resolv bind, ,
643 AC_SEARCH_LIBS(res_9_init, resolv bind, ,
644 AC_SEARCH_LIBS(res_init, resolv bind, , )))
646 AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap])
647 old_CFLAGS="${CFLAGS}"
648 CFLAGS="${CFLAGS} ${TAP_CFLAGS}"
651 net/if_tun.h net/tun/if_tun.h \
655 [have_tap_header="yes"]
659 [AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])],
662 #ifdef HAVE_LINUX_IF_TUN_H
663 #include <linux/if_tun.h>
667 CFLAGS="${old_CFLAGS}"
668 test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])
673 [SELINUX_LIBS="-lselinux"]
675 AC_SUBST([SELINUX_LIBS])
677 AC_ARG_VAR([LIBPAM_CFLAGS], [C compiler flags for libpam])
678 AC_ARG_VAR([LIBPAM_LIBS], [linker flags for libpam])
679 if test -z "${LIBPAM_LIBS}"; then
683 [LIBPAM_LIBS="-lpam"]
687 case "${with_mem_check}" in
690 [valgrind/memcheck.h],
692 CFLAGS="${CFLAGS} -g -fno-inline"
696 [Use valgrind memory debugging library]
699 [AC_MSG_ERROR([valgrind headers not found.])]
709 LIBS="${LIBS} -ldmalloc"
713 [Use dmalloc memory debugging library]
716 [AC_MSG_ERROR([dmalloc library not found.])]
718 [AC_MSG_ERROR([dmalloc headers not found.])]
729 [Use memory debugging function in OpenSSL]
731 AC_MSG_NOTICE([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG])
733 [AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])]
740 [libpkcs11-helper-1 >= 1.11],
741 [have_pkcs11_helper="yes"],
747 [libcrypto >= 0.9.6],
748 [have_openssl_crypto="yes"],
753 have_openssl_crypto="yes"
754 OPENSSL_CRYPTO_LIBS="-lcrypto"
762 [have_openssl_ssl="yes"],
767 have_openssl_ssl="yes"
768 OPENSSL_SSL_LIBS="-lssl"
775 if test "${have_openssl_crypto}" = "yes"; then
776 saved_CFLAGS="${CFLAGS}"
778 CFLAGS="${CFLAGS} ${OPENSSL_CRYPTO_CFLAGS}"
779 LIBS="${LIBS} ${OPENSSL_CRYPTO_LIBS}"
780 AC_CHECK_FUNCS([EVP_CIPHER_CTX_set_key_length])
781 have_openssl_engine="yes"
784 ENGINE_load_builtin_engines \
785 ENGINE_register_all_complete \
789 [have_openssl_engine="no"; break]
792 CFLAGS="${saved_CFLAGS}"
796 AC_ARG_VAR([POLARSSL_CFLAGS], [C compiler flags for polarssl])
797 AC_ARG_VAR([POLARSSL_LIBS], [linker flags for polarssl])
798 have_polarssl_ssl="yes"
799 have_polarssl_crypto="yes"
800 if test -z "${POLARSSL_LIBS}"; then
804 [POLARSSL_LIBS="-lpolarssl"],
806 have_polarssl_ssl="no"
811 [have_polarssl_crypto="no"],
812 [${PKCS11_HELPER_LIBS}]
815 [${PKCS11_HELPER_LIBS}]
819 if test "${with_crypto_library}" = "polarssl" ; then
820 AC_MSG_CHECKING([polarssl version])
821 old_CFLAGS="${CFLAGS}"
822 CFLAGS="${POLARSSL_CFLAGS} ${CFLAGS}"
826 #include <polarssl/version.h>
829 #if POLARSSL_VERSION_NUMBER < 0x01030800 || POLARSSL_VERSION_NUMBER >= 0x01040000
830 #error invalid version
834 [AC_MSG_RESULT([ok])],
835 [AC_MSG_ERROR([PolarSSL 1.3.x required and must be 1.3.8 or later])]
838 polarssl_with_pkcs11="no"
842 #include <polarssl/config.h>
845 #ifndef POLARSSL_PKCS11_C
846 #error pkcs11 wrapper missing
850 polarssl_with_pkcs11="yes")
851 CFLAGS="${old_CFLAGS}"
853 AC_MSG_CHECKING([polarssl pkcs11 support])
854 if test "${enable_pkcs11}" = "yes"; then
855 if test "${polarssl_with_pkcs11}" = "yes"; then
858 AC_MSG_ERROR([polarssl has no pkcs11 wrapper compiled in])
861 if test "${polarssl_with_pkcs11}" != "yes"; then
864 AC_MSG_ERROR([PolarSSL compiled with PKCS11, while OpenVPN is not])
870 AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
871 AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
873 if test -z "${LZO_LIBS}"; then
876 [lzo1x_1_15_compress],
880 [lzo1x_1_15_compress],
886 if test "${have_lzo}" = "yes"; then
887 saved_CFLAGS="${CFLAGS}"
888 CFLAGS="${CFLAGS} ${LZO_CFLAGS}"
895 [AC_MSG_ERROR([lzoutil.h is missing])]
904 [AC_MSG_ERROR([lzo1x.h is missing])]
907 CFLAGS="${saved_CFLAGS}"
912 dnl Check for systemd
915 if test "$enable_systemd" = "yes" ; then
916 PKG_CHECK_MODULES([libsystemd], [systemd libsystemd],
918 [PKG_CHECK_MODULES([libsystemd], [libsystemd-daemon])]
920 AC_CHECK_HEADERS(systemd/sd-daemon.h,
923 AC_MSG_ERROR([systemd development headers not found.])
927 LIBS="${LIBS} ${libsystemd_LIBS}"
928 AC_CHECK_FUNCS([sd_booted], [], [AC_MSG_ERROR([systemd library is missing sd_booted()])])
929 OPTIONAL_SYSTEMD_LIBS="${libsystemd_LIBS}"
930 AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd integration])
935 AC_MSG_CHECKING([git checkout])
937 if test -n "${GIT}" -a -d "${srcdir}/.git"; then
938 AC_DEFINE([HAVE_CONFIG_VERSION_H], [1], [extra version available in config-version.h])
941 AC_MSG_RESULT([${GIT_CHECKOUT}])
943 if test -n "${SP_PLATFORM_WINDOWS}"; then
944 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
945 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
947 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['/'], [Path separator])
948 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["/"], [Path separator])
951 dnl enable --x509-username-field feature if requested
952 if test "${enable_x509_alt_username}" = "yes"; then
953 if test "${with_crypto_library}" = "polarssl" ; then
954 AC_MSG_ERROR([PolarSSL does not support the --x509-username-field feature])
957 AC_DEFINE([ENABLE_X509ALTUSERNAME], [1], [Enable --x509-username-field feature])
960 test "${ac_cv_header_sys_uio_h}" = "yes" && AC_DEFINE([HAVE_IOVEC], [1], [struct iovec needed for IPv6 support])
961 test "${enable_multi}" = "yes" && AC_DEFINE([ENABLE_CLIENT_SERVER], [1], [Enable client/server capability])
962 test "${enable_server}" = "no" && AC_DEFINE([ENABLE_CLIENT_ONLY], [1], [Enable client capability only])
963 test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability])
964 test "${enable_socks}" = "yes" && AC_DEFINE([ENABLE_SOCKS], [1], [Enable Socks proxy support])
965 test "${enable_http_proxy}" = "yes" && AC_DEFINE([ENABLE_HTTP_PROXY], [1], [Enable HTTP proxy support])
966 test "${enable_multihome}" = "yes" && AC_DEFINE([ENABLE_MULTIHOME], [1], [Enable multi-homed UDP server capability])
967 test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support])
968 test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size])
969 test "${enable_fragment}" = "yes" && AC_DEFINE([ENABLE_FRAGMENT], [1], [Enable internal fragmentation support])
970 test "${enable_port_share}" = "yes" && AC_DEFINE([ENABLE_PORT_SHARE], [1], [Enable TCP Server port sharing])
971 test "${enable_def_auth}" = "yes" && AC_DEFINE([ENABLE_DEF_AUTH], [1], [Enable deferred authentication])
972 test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal packet filter])
973 test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
975 case "${with_crypto_library}" in
977 have_crypto_crypto="${have_openssl_crypto}"
978 have_crypto_ssl="${have_openssl_ssl}"
979 CRYPTO_CRYPTO_CFLAGS="${OPENSSL_CRYPTO_CFLAGS}"
980 CRYPTO_CRYPTO_LIBS="${OPENSSL_CRYPTO_LIBS}"
981 CRYPTO_SSL_CFLAGS="${OPENSSL_SSL_CFLAGS}"
982 CRYPTO_SSL_LIBS="${OPENSSL_SSL_LIBS}"
983 AC_DEFINE([ENABLE_CRYPTO_OPENSSL], [1], [Use OpenSSL library])
984 test "${have_openssl_engine}" = "yes" && AC_DEFINE([HAVE_OPENSSL_ENGINE], [1], [Use crypto library])
987 have_crypto_crypto="${have_polarssl_crypto}"
988 have_crypto_ssl="${have_polarssl_ssl}"
989 CRYPTO_CRYPTO_CFLAGS="${POLARSSL_CFLAGS}"
990 CRYPTO_CRYPTO_LIBS="${POLARSSL_LIBS}"
991 AC_DEFINE([ENABLE_CRYPTO_POLARSSL], [1], [Use PolarSSL library])
995 if test "${enable_ssl}" = "yes"; then
996 test "${enable_crypto}" != "yes" && AC_MSG_ERROR([crypto must be enabled for ssl])
997 test "${have_crypto_ssl}" != "yes" && AC_MSG_ERROR([${with_ssl_library} ssl is required but missing])
998 OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_SSL_CFLAGS}"
999 OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_SSL_LIBS}"
1000 AC_DEFINE([ENABLE_SSL], [1], [Enable ssl library])
1003 if test "${enable_crypto}" = "yes"; then
1004 test "${have_crypto_crypto}" != "yes" && AC_MSG_ERROR([${with_crypto_library} crypto is required but missing])
1005 test "${enable_crypto_ofb_cfb}" = "yes" && AC_DEFINE([ENABLE_OFB_CFB_MODE], [1], [Enable OFB and CFB cipher modes])
1006 OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_CRYPTO_CFLAGS}"
1007 OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_CRYPTO_LIBS}"
1008 AC_DEFINE([ENABLE_CRYPTO], [1], [Enable crypto library])
1011 if test "${enable_plugins}" = "yes"; then
1012 OPTIONAL_DL_LIBS="${DL_LIBS}"
1013 AC_DEFINE([ENABLE_PLUGIN], [1], [Enable plug-in support])
1015 enable_plugin_auth_pam="no"
1016 enable_plugin_down_root="no"
1019 if test "${enable_iproute2}" = "yes"; then
1020 test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
1021 AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
1023 if test "${WIN32}" != "yes"; then
1024 test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing])
1025 test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing])
1029 if test "${enable_selinux}" = "yes"; then
1030 test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing])
1031 OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}"
1032 AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
1035 if test "${enable_lzo}" = "yes"; then
1036 test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo enabled but missing])
1037 OPTIONAL_LZO_CFLAGS="${LZO_CFLAGS}"
1038 OPTIONAL_LZO_LIBS="${LZO_LIBS}"
1039 AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library])
1041 if test "${enable_lzo_stub}" = "yes"; then
1042 test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both lzo stub and lzo enabled])
1043 AC_DEFINE([ENABLE_LZO_STUB], [1], [Enable LZO stub capability])
1044 AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library])
1047 if test "${enable_pkcs11}" = "yes"; then
1048 test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
1049 test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
1050 OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}"
1051 OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}"
1052 AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11])
1056 [proxy_module="`$PKG_CONFIG --variable=proxy_module p11-kit-1`"
1057 AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_MODULE], "${proxy_module}", [p11-kit proxy])],
1062 if test "${enable_pedantic}" = "yes"; then
1064 CFLAGS="${CFLAGS} -pedantic"
1065 test "${WIN32}" != "yes" && CFLAGS="${CFLAGS} -ansi"
1067 if test "${enable_strict}" = "yes"; then
1068 CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
1071 if test "${WIN32}" = "yes"; then
1072 test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
1075 if test "${enable_plugin_auth_pam}" = "yes"; then
1076 PLUGIN_AUTH_PAM_CFLAGS="${LIBPAM_CFLAGS}"
1077 if test "${enable_pam_dlopen}" = "yes"; then
1078 AC_DEFINE([USE_PAM_DLOPEN], [1], [dlopen libpam])
1079 PLUGIN_AUTH_PAM_LIBS="${DL_LIBS}"
1081 test -z "${LIBPAM_LIBS}" && AC_MSG_ERROR([libpam required but missing])
1082 PLUGIN_AUTH_PAM_LIBS="${LIBPAM_LIBS}"
1086 CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
1087 AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
1089 TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
1090 TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR"
1091 TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
1092 AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id])
1093 AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN])
1094 AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN])
1095 AC_SUBST([TAP_WIN_COMPONENT_ID])
1096 AC_SUBST([TAP_WIN_MIN_MAJOR])
1097 AC_SUBST([TAP_WIN_MIN_MINOR])
1099 AC_SUBST([OPTIONAL_DL_LIBS])
1100 AC_SUBST([OPTIONAL_SELINUX_LIBS])
1101 AC_SUBST([OPTIONAL_CRYPTO_CFLAGS])
1102 AC_SUBST([OPTIONAL_CRYPTO_LIBS])
1103 AC_SUBST([OPTIONAL_LZO_CFLAGS])
1104 AC_SUBST([OPTIONAL_LZO_LIBS])
1105 AC_SUBST([OPTIONAL_SYSTEMD_LIBS])
1106 AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
1107 AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
1109 AC_SUBST([PLUGIN_AUTH_PAM_CFLAGS])
1110 AC_SUBST([PLUGIN_AUTH_PAM_LIBS])
1112 AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
1113 AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"])
1114 AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "yes"])
1115 AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"])
1117 plugindir="${with_plugindir}"
1118 sampledir="\$(docdir)/sample"
1119 AC_SUBST([plugindir])
1120 AC_SUBST([sampledir])
1127 build/msvc/msvc-generate/Makefile
1130 distro/rpm/openvpn.spec
1134 src/openvpn/Makefile
1135 src/openvpnserv/Makefile
1136 src/plugins/Makefile
1137 src/plugins/auth-pam/Makefile
1138 src/plugins/down-root/Makefile
1143 AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])