From: Guus Sliepen Date: Tue, 10 Dec 2013 10:18:04 +0000 (+0100) Subject: Add our own autoconf check for libgcrypt. X-Git-Tag: release-1.1pre10~24 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=53b00f8c1abda0d477c75e4d70a7341301fa1733;p=tinc Add our own autoconf check for libgcrypt. This one doesn't require one to have libgcrypt installed while running autoreconf, making life easier for people who compile tinc from git. --- diff --git a/configure.ac b/configure.ac index 28d94a62..c5b0d23a 100644 --- a/configure.ac +++ b/configure.ac @@ -217,16 +217,16 @@ tinc_READLINE 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, diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 new file mode 100644 index 00000000..01c7478f --- /dev/null +++ b/m4/libgcrypt.m4 @@ -0,0 +1,33 @@ +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.])] + ) +]) diff --git a/src/Makefile.am b/src/Makefile.am index ccb966ca..64c845d6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -197,7 +197,7 @@ endif tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS) sptps_speed_LDADD = -lrt -LIBS = @LIBS@ @LIBGCRYPT_LIBS@ +LIBS = @LIBS@ if TUNEMU LIBS += -lpcap