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.
This commit is contained in:
Guus Sliepen 2013-12-10 11:18:04 +01:00
parent 283c5d1cf0
commit 53b00f8c1a
3 changed files with 37 additions and 4 deletions

View file

@ -217,16 +217,16 @@ tinc_READLINE
tinc_ZLIB tinc_ZLIB
tinc_LZO tinc_LZO
if test "$with_libgcrypt" = yes; then if test "x$with_libgcrypt" != "xno"; then
gcrypt=true gcrypt=true
AM_PATH_LIBGCRYPT([1.4.0], [], []) tinc_LIBGCRYPT
else else
openssl=true openssl=true
tinc_OPENSSL tinc_OPENSSL
fi fi
AM_CONDITIONAL(OPENSSL, test -n "$openssl") 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 dnl Check if support for jumbograms is requested
AC_ARG_ENABLE(jumbograms, AC_ARG_ENABLE(jumbograms,

33
m4/libgcrypt.m4 Normal file
View file

@ -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.])]
)
])

View file

@ -197,7 +197,7 @@ endif
tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS) tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS)
sptps_speed_LDADD = -lrt sptps_speed_LDADD = -lrt
LIBS = @LIBS@ @LIBGCRYPT_LIBS@ LIBS = @LIBS@
if TUNEMU if TUNEMU
LIBS += -lpcap LIBS += -lpcap