📄 configure.ac
字号:
dnl OpenVPN -- An application to securely tunnel IP networksdnl over a single UDP port, with support for SSL/TLS-baseddnl session authentication and key exchange,dnl packet encryption, packet authentication, anddnl packet compression.dnldnl Copyright (C) 2002-2004 James Yonan <jim@yonan.net>dnldnl This program is free software; you can redistribute it and/or modifydnl it under the terms of the GNU General Public License as published bydnl the Free Software Foundation; either version 2 of the License, ordnl (at your option) any later version.dnldnl This program is distributed in the hope that it will be useful,dnl but WITHOUT ANY WARRANTY; without even the implied warranty ofdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See thednl GNU General Public License for more details.dnldnl You should have received a copy of the GNU General Public Licensednl along with this program (see the file COPYING included with thisdnl distribution); if not, write to the Free Software Foundation, Inc.,dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAdnl Process this file with autoconf to produce a configure script.AC_PREREQ(2.50)AC_INIT([OpenVPN], [2.0_beta7], [openvpn-users@lists.sourceforge.net], [openvpn])AM_CONFIG_HEADER(config.h)AC_CONFIG_SRCDIR(syshead.h)AC_ARG_ENABLE(lzo, [ --disable-lzo Do not compile LZO compression support], [LZO="$enableval"], [LZO="yes"])AC_ARG_ENABLE(crypto, [ --disable-crypto Do not compile OpenSSL crypto support], [CRYPTO="$enableval"], [CRYPTO="yes"])AC_ARG_ENABLE(ssl, [ --disable-ssl Do not compile OpenSSL SSL support for TLS-based key exchange], [SSL="$enableval"], [SSL="yes"])AC_ARG_ENABLE(pthread, [ --enable-pthread Compile pthread support (Not implemented in 2.0)], [PTHREAD="$enableval"], [PTHREAD="no"])AC_ARG_ENABLE(multi, [ --disable-multi Do not compile multi-client server support (--mode server)], [MULTI="$enableval"], [MULTI="yes"])AC_ARG_ENABLE(strict, [ --enable-strict Enable strict compiler warnings], [STRICT="$enableval"], [STRICT="no"])AC_ARG_ENABLE(profiling, [ --enable-profiling Enable profiling], [PROFILE="$enableval"], [PROFILE="no"])AC_ARG_ENABLE(strict-options, [ --enable-strict-options Enable strict options check between peers], [STRICT_OPTIONS="$enableval"], [STRICT_OPTIONS="no"])AC_ARG_WITH(ssl-headers, [ --with-ssl-headers=DIR Crypto/SSL Include files location], [CS_HDR_DIR="$withval"] [CPPFLAGS="$CPPFLAGS -I$withval"] )AC_ARG_WITH(ssl-lib, [ --with-ssl-lib=DIR Crypto/SSL Library location], [LDFLAGS="$LDFLAGS -L$withval"] )AC_ARG_WITH(lzo-headers, [ --with-lzo-headers=DIR LZO Include files location], [LZO_HDR_DIR="$withval"] [CPPFLAGS="$CPPFLAGS -I$withval"] )AC_ARG_WITH(lzo-lib, [ --with-lzo-lib=DIR LZO Library location], [LDFLAGS="$LDFLAGS -L$withval"] )AC_ARG_WITH(ifconfig-path, [ --with-ifconfig-path=PATH Path to ifconfig tool], [IFCONFIG="$withval"], [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])])AC_DEFINE_UNQUOTED(IFCONFIG_PATH, "$IFCONFIG", [Path to ifconfig tool])AC_ARG_WITH(iproute-path, [ --with-iproute-path=PATH Path to iproute tool], [IPROUTE="$withval"], [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])])AC_DEFINE_UNQUOTED(IPROUTE_PATH, "$IPROUTE", [Path to iproute tool])AC_ARG_WITH(route-path, [ --with-route-path=PATH Path to route tool], [ROUTE="$withval"], [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])])AC_DEFINE_UNQUOTED(ROUTE_PATH, "$ROUTE", [Path to route tool])AC_ARG_WITH(leak-check, [ --with-leak-check=TYPE Build with memory leak checking, TYPE = dmalloc or ssl], [LEAK="$withval"])AC_ARG_ENABLE(iproute2, [ --enable-iproute2 Enable support for iproute2], AC_DEFINE(CONFIG_FEATURE_IPROUTE, 1, [enable iproute2 support]) )dnl Guess host type.AC_CANONICAL_HOSTAC_CANONICAL_SYSTEMAM_INIT_AUTOMAKE(openvpn, [$PACKAGE_VERSION])dnl fix search path, to allow compilers to find syshead.hCPPFLAGS="$CPPFLAGS -I${srcdir}"dnl check target OSopenvpn_target=$targetif test $target_alias; then openvpn_target=$target_aliasfiAC_DEFINE_UNQUOTED(TARGET_ALIAS, "$openvpn_target", [A string representing our target])case "$target" in*linux*) AC_DEFINE(TARGET_LINUX, 1, [Are we running on Linux?]) dnl RH9 SSL headers workaround if test -z $CS_HDR_DIR && test "$CRYPTO" = "yes"; then CPPFLAGS="$CPPFLAGS $(pkg-config --cflags openssl 2>/dev/null)" fi ;;*solaris*) AC_DEFINE(TARGET_SOLARIS, 1, [Are we running on Solaris?]) ;;*openbsd*) AC_DEFINE(TARGET_OPENBSD, 1, [Are we running on OpenBSD?]) ;;*freebsd*) AC_DEFINE(TARGET_FREEBSD, 1, [Are we running on FreeBSD?]) ;;*netbsd*) AC_DEFINE(TARGET_NETBSD, 1, [Are we running NetBSD?]) ;;*darwin*) dnl some Mac OS X tendering (we use vararg macros...) AC_DEFINE(TARGET_DARWIN, 1, [Are we running on Mac OS X?]) CPPFLAGS="$CPPFLAGS -no-cpp-precomp" ;;*mingw*) AC_MSG_RESULT([WARNING: configure support for mingw is incomplete]) AC_MSG_RESULT([WARNING: use makefile.w32 instead]) OPENVPN_ADD_LIBS(-lgdi32) OPENVPN_ADD_LIBS(-lwsock32) ;; esacdnl Checks for programs.AC_PROG_CCAC_PROG_INSTALLAC_PROG_GCC_TRADITIONALdnl Checks for header files.AC_HEADER_STDCdnl Checks for typedefs, structures, and compiler characteristics.AC_C_CONSTAC_C_INLINEAC_C_VOLATILEAC_TYPE_OFF_TAC_TYPE_PID_TAC_TYPE_SIZE_TAC_TYPE_UID_TAC_HEADER_TIMEAX_CPP_VARARG_MACRO_ISOAX_CPP_VARARG_MACRO_GCCdnl Check for more header files.AC_HEADER_SYS_WAITAC_CHECK_HEADERS(sys/time.h sys/socket.h sys/ioctl.h sys/stat.h dnl sys/mman.h fcntl.h sys/file.h stdlib.h stdint.h dnl stdarg.h unistd.h signal.h stdio.h string.h dnl strings.h ctype.h errno.h syslog.h pwd.h grp.h dnl net/if_tun.h net/if.h stropts.h sys/sockio.h dnl netinet/in.h netinet/in_systm.h netinet/ip.h dnl netinet/if_ether.h netinet/tcp.h resolv.h arpa/inet.h dnl netdb.h sys/uio.h linux/if_tun.h linux/sockios.h dnl linux/types.h linux/errqueue.h dnl sys/poll.h sys/epoll.h)AC_CACHE_SAVEdnl check that in_addr_t is definedAC_CHECK_TYPE( [in_addr_t], [], [AC_DEFINE(in_addr_t, uint32_t, [Some systems don't define in_addr_t])], [#include "syshead.h"])dnl check for basic typesAC_CHECK_TYPE( [uint8_t], [], [AC_DEFINE(uint8_t, unsigned char, [8-bit unsigned type])], [#include "syshead.h"])AC_CHECK_TYPE( [uint16_t], [], [AC_DEFINE(uint16_t, unsigned char, [16-bit unsigned type])], [#include "syshead.h"])AC_CHECK_TYPE( [uint32_t], [], [AC_DEFINE(uint32_t, unsigned long, [32-bit unsigned type])], [#include "syshead.h"])dnl check for IPv6 typesAC_CHECK_TYPE( [struct tun_pi], [AC_DEFINE(HAVE_TUN_PI, 1, [struct tun_pi needed for IPv6 support])], [], [#include "syshead.h"])AC_CHECK_TYPE( [struct iphdr], [AC_DEFINE(HAVE_IPHDR, 1, [struct iphdr needed for IPv6 support])], [], [#include "syshead.h"])AC_CHECK_TYPE( [struct iovec], [AC_DEFINE(HAVE_IOVEC, 1, [struct iovec needed for IPv6 support])], [], [#include "syshead.h"])dnl check for extended socket error typesAC_CHECK_TYPE( [struct sock_extended_err], [AC_DEFINE(HAVE_SOCK_EXTENDED_ERR, 1, [struct sock_extended_err needed for extended socket error support])], [], [#include "syshead.h"])AC_CHECK_TYPE( [struct msghdr], [AC_DEFINE(HAVE_MSGHDR, 1, [struct msghdr needed for extended socket error support])], [], [#include "syshead.h"])AC_CHECK_TYPE( [struct cmsghdr], [AC_DEFINE(HAVE_CMSGHDR, 1, [struct cmsghdr needed for extended socket error support])], [], [#include "syshead.h"])AC_CHECK_SIZEOF(unsigned int)AC_CHECK_SIZEOF(unsigned long)AC_CACHE_SAVEdnl check for other typesTYPE_SOCKLEN_TAC_TYPE_SIGNALdnl Check for libsocketAC_SEARCH_LIBS(socket, socket)dnl Check for libnslAC_SEARCH_LIBS(inet_ntoa, nsl)dnl Check for libresolvAC_SEARCH_LIBS(gethostbyname, resolv nsl)dnl optional library functionsAC_FUNC_FORKAC_CHECK_FUNCS(daemon chroot getpwnam setuid nice system getpid dup dup2 dnl getpass strerror syslog openlog mlockall getgrnam setgid dnl setgroups stat flock readv writev setsockopt getsockopt dnl setsid chdir gettimeofday putenv getpeername unlink dnl poll epoll_create chsize ftruncate)AC_REPLACE_FUNCS(inet_aton)AC_CACHE_SAVEdnl Required library functionsAC_FUNC_MEMCMPAC_CHECK_FUNCS(socket recv recvfrom send sendto listen dnl accept connect bind select gethostbyname dnl inet_ntoa time ctime memset vsnprintf, [], [AC_MSG_ERROR([Required library function not found])])dnldnl check librariesdnldnldnl check for pthread librarydnlif test "$PTHREAD" = "yes"; then AC_CHECKING([for pthread support]) ACX_PTHREAD( [ case "$target" in *openbsd*) AC_MSG_RESULT([WARNING: pthread support on OpenBSD is unstable!]) CFLAGS="$CFLAGS -pthread" ;; esac LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" AC_DEFINE(USE_PTHREAD, 1, [Use pthread-based multithreading]) ], [ AC_MSG_RESULT([I don't know how to build with pthread support on this platform.]) AC_MSG_ERROR([try ./configure --disable-pthread]) ])fidnldnl check for dmalloc librarydnlif test "$LEAK" = "dmalloc"; then AC_CHECKING([for dmalloc Library and Header files]) AC_CHECK_HEADER(dmalloc.h, [AC_CHECK_LIB(dmalloc, malloc, [ if test "$PTHREAD" = "yes"; then OPENVPN_ADD_LIBS(-ldmallocth) else OPENVPN_ADD_LIBS(-ldmalloc) fi AC_DEFINE(DMALLOC, 1, [Use dmalloc memory debugging library]) ], [AC_MSG_ERROR([dmalloc library not found.])] )], [AC_MSG_ERROR([dmalloc headers not found.])] )fidnldnl check for LZO librarydnlif test "$LZO" = "yes"; then AC_CHECKING([for LZO Library and Header files]) AC_CHECK_HEADER(lzo1x.h, [AC_CHECK_LIB(lzo, lzo1x_1_15_compress, [ OPENVPN_ADD_LIBS(-llzo) AC_DEFINE(USE_LZO, 1, [Use LZO compression library]) ], [AC_MSG_ERROR([LZO headers were found but LZO library was not found.])] )], [ AC_MSG_RESULT([LZO library and headers not found.]) AC_MSG_RESULT([LZO library available from http://www.oberhumer.com/opensource/lzo/]) AC_MSG_ERROR([Or try ./configure --disable-lzo]) ] )fidnldnl check for OpenSSL-crypto librarydnlif test "$CRYPTO" = "yes"; then AC_CHECKING([for OpenSSL Crypto Library and Header files]) AC_CHECK_HEADER(openssl/evp.h, [AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_init, [ AC_CHECKING([that OpenSSL Library is at least version 0.9.6]) AC_EGREP_CPP(yes, [ #include "openssl/evp.h" #if SSLEAY_VERSION_NUMBER >= 0x00906000L yes #endif ], [ AC_DEFINE(USE_CRYPTO, 1, [Use OpenSSL crypto library]) OPENVPN_ADD_LIBS(-lcrypto) AC_CHECK_FUNCS(EVP_CIPHER_CTX_set_key_length) dnl check for OpenSSL crypto acceleration capability AC_CHECK_HEADERS(openssl/engine.h) AC_CHECK_FUNCS(ENGINE_load_builtin_engines) AC_CHECK_FUNCS(ENGINE_register_all_complete) AC_CHECK_FUNCS(ENGINE_cleanup) ], [AC_MSG_ERROR([OpenSSL crypto Library is too old.])] ) ], [AC_MSG_ERROR([OpenSSL Crypto library not found.])] )], [AC_MSG_ERROR([OpenSSL Crypto headers not found.])] )dnldnl check for OpenSSL-SSL librarydnl if test "$SSL" = "yes"; then AC_CHECKING([for OpenSSL SSL Library and Header files]) AC_CHECK_HEADER(openssl/ssl.h, [AC_CHECK_LIB(ssl, SSL_CTX_new, [ if test "$LEAK" = "ssl"; then AC_CHECKING([for Memory Debugging Capabilities in OpenSSL Library]) AC_CHECK_LIB(ssl, CRYPTO_mem_ctrl, [ AC_DEFINE(CRYPTO_MDEBUG, 1, [Use memory debugging function in OpenSSL]) AC_MSG_RESULT([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG]) ], [AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])] ) fi ], [AC_MSG_ERROR([OpenSSL SSL library not found.])] )], [AC_MSG_ERROR([OpenSSL SSL headers not found.])] ) AC_DEFINE(USE_SSL, 1, [Use OpenSSL SSL library]) OPENVPN_ADD_LIBS(-lssl) fifidnl enable multi-client modeif test "$MULTI" = "yes"; then AC_DEFINE(MULTICLIENT_SERVER_ENABLED, 1, [Enable multiclient server capability])fidnl enable strict compiler warningsif test "$STRICT" = "yes"; then CFLAGS="$CFLAGS -Wall -W -Wpointer-arith -Wsign-compare -Wno-unused-parameter -Wno-unused-function"fidnl enable profilingif test "$PROFILE" = "yes"; then CFLAGS="$CFLAGS -pg -DENABLE_PROFILING"fidnl enable strict options check between peersif test "$STRICT_OPTIONS" = "yes"; then AC_DEFINE(STRICT_OPTIONS_CHECK, 1, [Enable strict options check between peers])fiAC_OUTPUT(Makefile openvpn.spec config-win32.h install-win32/openvpn.nsi)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -