Commit Diff


commit - e81f6f1a0b51a5565d284b8930b6c93c25fa288e
commit + 9445abba2bb2aa3b928e16d88abb8f27c360f4e8
blob - 5ecb1e0be7519f3c6ebc7ef010454baac4c9b649
blob + 9307922a9c5eff0a9735dfc2b42ab58f130a5bbc
--- configure.ac
+++ configure.ac
@@ -85,31 +85,27 @@ if test "x$ac_cv_header_sha2_h" = xyes; then
 	AC_DEFINE(HAVE_SHA2)
 fi
 
+if test "x$ac_cv_header_sha256_h" = xyes; then
+	AC_DEFINE(HAVE_SHA256)
+fi
+
 # Check for SHA1_DIGEST_LENGTH
-have_sha1_digest_length=no
 if test "x$ac_cv_header_sha_h" = xyes; then
-	AC_RUN_IFELSE([AC_LANG_PROGRAM(
-	    [#include <sha.h>],
-	    [#if !defined(SHA1_DIGEST_LENGTH) && defined (SHA_DIGEST_LENGTH)
-		exit(1);
-	     #endif
-	    ])],
-	[have_sha1_digest_length=yes])
-	AC_DEFINE(HAVE_SHA_AS_SHA1)
+AC_CHECK_DECL([SHA_DIGEST_LENGTH],
+	      [AC_DEFINE(HAVE_SHA_AS_SHA1)],
+	      [AC_DEFINE(NEEDS_SHA1_DEFS)],
+	      [#include <sha.h>])
 fi
 
 if test "x$ac_cv_header_sha1_h" = xyes; then
-	AC_RUN_IFELSE([AC_LANG_PROGRAM(
-	    [#include <sha1.h>],
-	    [#if !defined(SHA1_DIGEST_LENGTH) && defined(SHA_DIGEST_LENGTH)
-		exit(1);
-	     #endif
-	]    )],
-	[have_sha1_digest_length=yes])
-	AC_DEFINE(HAVE_SHA1_AS_SHA1)
+AC_CHECK_DECL([SHA_DIGEST_LENGTH],
+	      [AC_DEFINE(HAVE_SHA1_AS_SHA1)],
+	      [AC_DEFINE(NEEDS_SHA1_DEFS)],
+	      [#include <sha1.h>])
 fi
 
-if test "x$have_sha1_digest_length" = "xno"; then
+if test "x$ac_cv_header_sha_h" = xno || test "x$ac_cv_header_sha1_h" = xno
+then
 	AC_DEFINE(NEEDS_SHA1_DEFS)
 fi
 
blob - bd7a2184fd73cfb5a1ece5f92428ce2c6d7c726e
blob + b980175e1da9ead266343b969d45f2336147ae88
--- template/configure.ac
+++ template/configure.ac
@@ -20,7 +20,16 @@ test -n "$HOSTCFLAGS"	&& export CFLAGS="$SAVED_CFLAGS 
 
 AC_PROG_CC
 AC_PROG_YACC
+PKG_PROG_PKG_CONFIG
 
+PKG_CHECK_MODULES(LIBBSD, libbsd-overlay, [
+	AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
+	CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
+	LIBS="$LIBBSD_LIBS $LIBS"
+	AC_DEFINE(HAVE_LIBBSD)
+], [AC_MSG_NOTICE([libbisd not found])])
+
+
 AM_CPPFLAGS="$CFLAGS"
 
 AC_REPLACE_FUNCS([ \