tinc_ZLIB
tinc_LZO
-if test "$with_libgcrypt" = yes; then
+if test "x$with_libgcrypt" != "xno"; then
gcrypt=true
- AM_PATH_LIBGCRYPT([1.4.0], [], [])
+ tinc_LIBGCRYPT
else
openssl=true
tinc_OPENSSL
fi
AM_CONDITIONAL(OPENSSL, test -n "$openssl")
-AM_CONDITIONAL(GCRYPT, test "$gcrypt" = true)
+AM_CONDITIONAL(GCRYPT, test -n "$gcrypt")
dnl Check if support for jumbograms is requested
AC_ARG_ENABLE(jumbograms,
--- /dev/null
+dnl Check to find the libgcrypt headers/libraries
+
+AC_DEFUN([tinc_LIBGCRYPT],
+[
+ AC_ARG_WITH(libgcrypt,
+ AS_HELP_STRING([--with-libgcrypt=DIR], [libgcrypt base directory, or:]),
+ [libgcrypt="$withval"
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ LDFLAGS="$LDFLAGS -L$withval/lib"]
+ )
+
+ AC_ARG_WITH(libgcrypt-include,
+ AS_HELP_STRING([--with-libgcrypt-include=DIR], [libgcrypt headers directory (without trailing /libgcrypt)]),
+ [libgcrypt_include="$withval"
+ CPPFLAGS="$CPPFLAGS -I$withval"]
+ )
+
+ AC_ARG_WITH(libgcrypt-lib,
+ AS_HELP_STRING([--with-libgcrypt-lib=DIR], [libgcrypt library directory]),
+ [libgcrypt_lib="$withval"
+ LDFLAGS="$LDFLAGS -L$withval"]
+ )
+
+ AC_CHECK_HEADERS([gcrypt.h],
+ [],
+ [AC_MSG_ERROR([libgcrypt header files not found.]); break]
+ )
+
+ AC_CHECK_LIB(gcrypt, gcry_cipher_encrypt,
+ [LIBS="-lgcrypt $LIBS"],
+ [AC_MSG_ERROR([libgcrypt libraries not found.])]
+ )
+])