vtun/configure.ac

242 lines
5.8 KiB
Plaintext
Raw Normal View History

dnl
dnl VTun - Virtual Tunnel over TCP/IP network.
dnl Copyright (C) 1998-2006 Maxim Krasnyansky <max_mk@yahoo.com>
dnl
dnl $Id: configure.in,v 1.19.2.3 2013/07/07 19:54:28 mtbishop Exp $
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(vtun, 3) dnl this needs to change via variables as in the tail
AC_CONFIG_HEADER(config.h)
dnl Shapper support
AC_ARG_ENABLE(shaper,
--disable-shaper Don not compile shaper module,
SHAPER=$enableval,
SHAPER=yes
)
dnl Encryption support
AC_ARG_ENABLE(sodium,
--disable-sodium Don not compile encryption module,
SODIUM=$enableval,
SODIUM=yes
)
dnl ZLIB support
AC_ARG_ENABLE(zlib,
--disable-zlib Don not compile ZLIB compression module,
ZLIB=$enableval,
ZLIB=yes
)
dnl LZO support
AC_ARG_ENABLE(lzo,
--disable-lzo Don not compile LZO compression module,
LZO=$enableval,
LZO=yes
)
dnl SOCKS support
AC_ARG_ENABLE(socks,
--enable-socks Compile with SOCKS support,
SOCKS=$enableval,
SOCKS=no
)
dnl Delayed UDP Start support
AC_ARG_ENABLE(nathack,
--disable-nathack Do not enable Nat Hack code,
NATHACK=$enableval,
NATHACK=yes
)
AC_ARG_WITH(sodium-headers,
--with-sodium-headers=DIR Crypto Include files location,
SODIUM_HDR_DIR="$withval"
CPPFLAGS="$CPPFLAGS -I$withval"
)
AC_ARG_WITH(sodium-lib,
--with-sodium-lib=DIR Crypto Library location,
LIBS="$LIBS -L$withval"
)
AC_ARG_WITH(lzo-headers,
--with-lzo-headers=DIR LZO Include files location,
LZO_HDR_DIR="$withval"
)
AC_ARG_WITH(lzo-lib,
--with-lzo-lib=DIR LZO Library location,
LIBS="$LIBS -L$withval"
)
AC_ARG_WITH(blowfish-headers,
--with-blowfish-headers=DIR Blowfish Include files location,
BLOWFISH_HDR_DIR="$withval"
)
AC_ARG_WITH(socks-lib,
--with-socks-lib=DIR SOCKS Library location,
LIBS="$LIBS -L$withval"
)
dnl Guess host type.
AC_CANONICAL_HOST
AC_CANONICAL_SYSTEM
dnl Check for programs.
AC_PROG_YACC
AC_PROG_LEX
AC_PROG_CC
AC_PROG_INSTALL
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
dnl Check for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/resource.h netdb.h sched.h resolv.h arpa/inet.h)
AC_CHECK_HEADERS(netinet/ip.h netinet/in.h netinet/tcp.h netinet/in_systm.h)
AC_CHECK_HEADERS(libutil.h sys/sockio.h)
dnl Check for libsocket
AC_SEARCH_LIBS(socket, socket)
dnl Check for libnsl
AC_SEARCH_LIBS(inet_ntoa, nsl)
dnl Check for libresolv
AC_SEARCH_LIBS(gethostbyname, resolv nsl)
dnl Check for librt
AC_SEARCH_LIBS(nanosleep, rt posix4)
dnl Check for setproctitle in libutil
AC_SEARCH_LIBS(setproctitle, util bsd, AC_DEFINE(HAVE_SETPROC_TITLE, [1], [Define to 1 if you have setproctitle() function]) )
dnl Check for fork() (fallback to vfork() on non-MMU systems)
AC_FUNC_FORK
if test "$SHAPER" = "yes"; then
AC_DEFINE(HAVE_SHAPER, [1], [Define to 1 if you want to enable shaper module])
fi
if test "$ZLIB" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for ZLIB Library and Header files ... )
AC_CHECK_LIB(z, deflate,
LIBS="$LIBS -lz"
AC_DEFINE(HAVE_ZLIB, [1], [Define to 1 if you have zlib]),
AC_MSG_ERROR( Zlib library not found.)
)
fi
dnl very servicable code borrowed heavily from openvpn.
if test "$LZO" = "yes"; then
LZOCHK=""
AC_MSG_RESULT()
AC_CHECKING( for LZO Library and Header files ... )
AC_SEARCH_HEADERS(lzo_asm.h,
$LZO_HDR_DIR /usr/include/lzo "" /usr/local/include,
LZOCHK="lzo2 lzo",
AC_SEARCH_HEADERS(lzo1x.h,
$LZO_HDR_DIR /usr/include/lzo "" /usr/local/include,
LZOCHK="lzo",
AC_MSG_ERROR( LZO library not found. )
)
)
if test -n "$LZOCHK"; then
havelzo=0;
for I in $LZOCHK ; do
if test $havelzo = 0; then
AC_CHECK_LIB($I, lzo1x_decompress,
[
LIBS="$LIBS -l"$I
AC_DEFINE(HAVE_LZO, [1], [Define to 1 if you have lzo])
havelzo=1
]
)
fi
done
if test $havelzo = 0; then
AC_MSG_ERROR( LZO library not found. )
fi
else
AC_MSG_ERROR( LZO headers not found. )
fi
fi
if test "$SODIUM" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for Sodium Library and Header files ... )
2015-10-17 18:25:38 +03:00
AC_SEARCH_LIBS(crypto_aead_aes256gcm_encrypt, [sodium],
[AC_DEFINE(HAVE_SODIUM, [1], [Define to 1 if you have Sodium])],
2015-10-17 18:25:38 +03:00
AC_ERROR([libsodium with crypto_aead_aes256gcm_encrypt not found]))
AC_SEARCH_HEADERS(sodium.h,
$SSL_HDR_DIR /usr/include /usr/local/include /opt/include,
,
AC_MSG_ERROR( Sodium headers not found. )
)
fi
if test "$NATHACK" = "yes"; then
AC_DEFINE(ENABLE_NAT_HACK, [1], [Define to 1 if you want to enable Nat Hack code])
fi
if test "$SOCKS" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for SOCKS Library ... )
AC_CHECK_LIB(socks5, SOCKSconnect,
[
CFLAGS="$CFLAGS -DVTUN_SOCKS=1"
LIBS="$LIBS -lsocks5"
],
AC_CHECK_LIB(socks, Rconnect,
[
CFLAGS="$CFLAGS -DVTUN_SOCKS=2"
LIBS="$LIBS -lsocks"
],
AC_MSG_ERROR( SOCKS library not found. )
)
)
fi
AC_MSG_RESULT()
2015-10-08 02:27:09 +03:00
CFLAGS="$CFLAGS -fstack-protector-all -fno-strict-overflow -fno-strict-aliasing"
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
AC_CHECK_FUNCS([getpt grantpt unlockpt ptsname])
OS_REL=`uname -r | tr -d '[A-Za-z\-\_\.]'`
case $host_os in
*linux*)
OS_DIR="linux"
AC_CHECK_HEADERS(linux/if_tun.h)
;;
*solaris*)
OS_DIR="svr4"
;;
*freebsd*)
if test "$OS_REL" -ge "40"; then
OS_DIR="freebsd"
fi
;;
*openbsd*)
if test "$OS_REL" -ge "25"; then
OS_DIR="openbsd"
fi
;;
esac
AC_LINK_DRV(`cat vtun.drivers`, $OS_DIR)
AC_MSG_RESULT()
dnl Build release name
changequote(<,>)
REL=`echo 'BRANCH-3_X' | tr -d '$: \-' | sed 's/^[A-Za-z]*//' | sed 's/\_/\./'`
changequote([,])
AC_DEFINE_UNQUOTED(VTUN_VER, "$REL `date '+%m/%d/%Y'`", [Vtun version])
AC_OUTPUT(Makefile)