From 53b00f8c1abda0d477c75e4d70a7341301fa1733 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 10 Dec 2013 11:18:04 +0100 Subject: [PATCH] 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. --- configure.ac | 6 +++--- m4/libgcrypt.m4 | 33 +++++++++++++++++++++++++++++++++ src/Makefile.am | 2 +- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 m4/libgcrypt.m4 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 -- 2.39.5