You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

92 lines
2.2 KiB

AC_INIT([utun],[2.0.0],[https://github.com/anomalyco/utun3/issues])
AC_CONFIG_SRCDIR([src/utun.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
# Required programs
AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_AR
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])
# Checks for programs
AC_PROG_INSTALL
AC_PROG_MAKE_SET
# Option to use OpenSSL instead of TinyCrypt for secure_channel
AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl], [Use OpenSSL for cryptography (default: yes)]),
[with_openssl=$withval],
[with_openssl=yes])
if test "x$with_openssl" = "xyes"; then
AC_CHECK_LIB([crypto], [SHA256_Init], [], [AC_MSG_ERROR([OpenSSL crypto library required. Use --without-openssl to use TinyCrypt instead.])])
AC_DEFINE([USE_OPENSSL], [1], [Define to use OpenSSL for cryptography])
fi
AM_CONDITIONAL([USE_OPENSSL], [test "x$with_openssl" = "xyes"])
# Detect Windows for TUN implementation
AC_MSG_CHECKING([for Windows])
case $host_os in
*mingw* | *msys* | *cygwin* | *win*)
os_windows=yes
;;
*)
os_windows=no
;;
esac
AC_MSG_RESULT([$os_windows])
AM_CONDITIONAL([OS_WINDOWS], [test "x$os_windows" = "xyes"])
# Checks for header files
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_C_INLINE
# Checks for library functions
AC_FUNC_MALLOC
AC_CHECK_FUNCS([gettimeofday memset socket strchr strdup strerror strstr])
# Check for TUN/TAP support
AC_MSG_CHECKING([for TUN/TAP support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <linux/if_tun.h>
]], [[
int fd = open("/dev/net/tun", O_RDWR);
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_TUN_TAP], [1], [Define if TUN/TAP is available])
], [
AC_MSG_RESULT([no])
])
# Output files
AC_CONFIG_FILES([
Makefile
src/Makefile
tests/Makefile
lib/Makefile
])
AC_OUTPUT
# Summary
echo "
Configuration summary:
----------------------
Prefix: ${prefix}
Compiler: ${CC}
CFLAGS: ${CFLAGS}
Features:
TUN/TAP: ${have_tun_tap}
"