More updates
authorIvo Timmermans <ivo@lychnis.net>
Tue, 9 Apr 2002 15:48:54 +0000 (15:48 +0000)
committerIvo Timmermans <ivo@lychnis.net>
Tue, 9 Apr 2002 15:48:54 +0000 (15:48 +0000)
m4/Makefile.am [new file with mode: 0644]
m4/openssl.m4 [new file with mode: 0644]
m4/tuntap.m4 [new file with mode: 0644]
m4/zlib.m4 [new file with mode: 0644]

diff --git a/m4/Makefile.am b/m4/Makefile.am
new file mode 100644 (file)
index 0000000..b0028d7
--- /dev/null
@@ -0,0 +1,15 @@
+## Process this file with automake to produce Makefile.in
+# $Id: Makefile.am,v 1.3 2002/04/09 15:48:54 zarq Exp $
+
+noinst_LIBRARIES = libvpn.a
+
+INCLUDES = @INCLUDES@ -I. -I$(top_builddir) -I$(top_srcdir)/intl
+
+libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c
+
+libvpn_a_LIBADD = @LIBOBJS@ @ALLOCA@
+libvpn_a_DEPENDENCIES = $(libvpn_a_LIBADD)
+
+noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h
+
+EXTRA_DIST = README
diff --git a/m4/openssl.m4 b/m4/openssl.m4
new file mode 100644 (file)
index 0000000..e5c0939
--- /dev/null
@@ -0,0 +1,49 @@
+dnl Check to find the OpenSSL headers/libraries
+
+AC_DEFUN(tinc_OPENSSL,
+[
+  tinc_ac_save_CPPFLAGS="$CPPFLAGS"
+
+  AC_ARG_WITH(openssl-include,
+    [  --with-openssl-include=DIR  OpenSSL headers directory (without trailing /openssl)],
+    [openssl_include="$withval"
+     CFLAGS="$CFLAGS -I$withval"
+     CPPFLAGS="$CPPFLAGS -I$withval"]
+  )
+
+  AC_ARG_WITH(openssl-lib,
+    [  --with-openssl-lib=DIR  OpenSSL library directory],
+    [openssl_lib="$withval"
+     LIBS="$LIBS -L$withval"]
+  )
+
+  AC_CHECK_HEADERS(openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h,
+    [],
+    [AC_MSG_ERROR("OpenSSL header files not found."); break]
+  )
+
+  CPPFLAGS="$tinc_ac_save_CPPFLAGS"
+
+  AC_CHECK_LIB(crypto, SHA1_version,
+    [LIBS="$LIBS -lcrypto"],
+    [AC_MSG_ERROR("OpenSSL libraries not found.")]
+  )
+
+  AC_CHECK_FUNCS(RAND_pseudo_bytes)
+
+  AC_CHECK_FUNC(OpenSSL_add_all_algorithms,
+    [],
+    AC_CHECK_FUNC(SSLeay_add_all_algorithms,
+      [AC_DEFINE(HAVE_SSLEAY_ADD_ALL_ALGORITHMS)],
+      [AC_MSG_ERROR("Missing required OpenSSL functionality!")]
+    )
+  )
+
+  AC_CHECK_FUNC(dlopen,
+    [],
+    AC_CHECK_LIB(dl, dlopen,
+      [LIBS="$LIBS -ldl"],
+      [AC_MSG_ERROR("OpenSSL depends on libdl.")]
+    )
+  )
+])
diff --git a/m4/tuntap.m4 b/m4/tuntap.m4
new file mode 100644 (file)
index 0000000..0bee1ce
--- /dev/null
@@ -0,0 +1,39 @@
+dnl Check to find out whether the running kernel has support for TUN/TAP
+
+AC_DEFUN(tinc_TUNTAP,
+[
+AC_ARG_WITH(kernel,
+  [  --with-kernel=dir       give the directory with kernel sources]
+  [                        (default: /usr/src/linux)],
+  kerneldir="$withval",
+  kerneldir="/usr/src/linux"
+)
+
+AC_CACHE_CHECK([for linux/if_tun.h], tinc_cv_linux_if_tun_h,
+[ 
+  AC_TRY_COMPILE([#include "$kerneldir/include/linux/if_tun.h"],
+    [int a = IFF_TAP;],
+    if_tun_h="\"$kerneldir/include/linux/if_tun.h\"",
+    [AC_TRY_COMPILE([#include <linux/if_tun.h>],
+      [int a = IFF_TAP;],
+      if_tun_h="default",
+      if_tun_h="no"
+    )]
+  )
+
+  if test $if_tun_h = no; then
+    tinc_cv_linux_if_tun_h=none
+  else
+    tinc_cv_linux_if_tun_h="$if_tun_h"
+  fi
+])
+
+if test $tinc_cv_linux_if_tun_h != none; then
+  AC_DEFINE(HAVE_TUNTAP)
+  if test $tinc_cv_linux_if_tun_h != default; then
+   AC_DEFINE_UNQUOTED(LINUX_IF_TUN_H, $tinc_cv_linux_if_tun_h)
+  fi
+fi
+AC_SUBST(LINUX_IF_TUN_H)
+AC_SUBST(HAVE_TUNTAP)
+])
diff --git a/m4/zlib.m4 b/m4/zlib.m4
new file mode 100644 (file)
index 0000000..d5fbc67
--- /dev/null
@@ -0,0 +1,31 @@
+dnl Check to find the zlib headers/libraries
+
+AC_DEFUN(tinc_ZLIB,
+[
+  tinc_ac_save_CPPFLAGS="$CPPFLAGS"
+
+  AC_ARG_WITH(zlib-include,
+    [  --with-zlib-include=DIR zlib headers directory],
+    [zlib_include="$withval"
+     CFLAGS="$CFLAGS -I$withval"
+     CPPFLAGS="$CPPFLAGS -I$withval"]
+  )
+
+  AC_ARG_WITH(zlib-lib,
+    [  --with-zlib-lib=DIR     zlib library directory],
+    [zlib_lib="$withval"
+     LIBS="$LIBS -L$withval"]
+  )
+
+  AC_CHECK_HEADERS(zlib.h,
+    [],
+    [AC_MSG_ERROR("zlib header files not found."); break]
+  )
+
+  CPPFLAGS="$tinc_ac_save_CPPFLAGS"
+
+  AC_CHECK_LIB(z, compress2,
+    [LIBS="$LIBS -lz"],
+    [AC_MSG_ERROR("zlib libraries not found.")]
+  )
+])