]> git.meshlink.io Git - meshlink/commitdiff
Add our own autoconf check for libgcrypt.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 10 Dec 2013 10:18:04 +0000 (11:18 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 10 Dec 2013 10:18:04 +0000 (11:18 +0100)
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
m4/libgcrypt.m4 [new file with mode: 0644]
src/Makefile.am

index 28d94a6260fb26adadb012c7c284692a305a918f..c5b0d23a6ff3c8ce91af244c73e55cf803f1e99e 100644 (file)
@@ -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 (file)
index 0000000..01c7478
--- /dev/null
@@ -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.])]
+  )
+])
index ccb966cae1b6f1d9c21efd053d604bb219beaf50..64c845d60e278a305e3aa8bdb84d3bcf4472b8e5 100644 (file)
@@ -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