configure.ac: Escape plan for old Nettle without pkg-config dropping.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 18 Dec 2011 20:54:00 +0000 (20:54 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 18 Dec 2011 20:54:00 +0000 (20:54 +0000)
configure.ac

index 66d3dfc..6c76e24 100644 (file)
@@ -37,7 +37,16 @@ dnl--------------------------------------------------------------------------
 dnl C programming environment.
 
 PKG_CHECK_MODULES([mLib], [mLib >= 2.1.0])
-PKG_CHECK_MODULES([nettle], [nettle >= 2.4])
+PKG_CHECK_MODULES([nettle], [nettle >= 2.4], [], [
+  ## That didn't work; unfortunately older Nettle packages don't have a
+  ## pkg-config dropping.  Let's see whether it will work anyway.
+  nettlep=t
+  AC_CHECK_HEADER([nettle/sha.h], [], [nettlep=nil])
+  AC_CHECK_LIB([nettle], [nettle_sha256_init], [], [nettlep=nil])
+  case $nettlep in
+    nil) AC_MSG_ERROR([Failed to find Nettle library.]) ;;
+  esac
+  NETTLE_CFLAGS= NETTLE_LIBS=-lnettle])
 
 dnl--------------------------------------------------------------------------
 dnl Perl programming environment.