From 0d8fe2fe5c37659147cbecac793183c62fc6818a Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 13 Apr 2010 13:32:51 -0500 Subject: [PATCH] Prefer libsha1 over libgcrypt When no SHA1 implementation is specified, we should first prefer system-builtin solutions (libc/libmd/CommonCrypto), then smaller implementations over the larger ones. libsha1 is much smaller than libgcrypt, so it should be first. Signed-off-by: Yaakov Selkowitz Reviewed-by: Mikhail Gusarov Acked-by: Julien Cristau --- configure.ac | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 1dc05f918..7b74820de 100644 --- a/configure.ac +++ b/configure.ac @@ -1382,15 +1382,6 @@ if test "x$with_sha1" = xlibmd; then [Use libmd SHA1 functions]) SHA1_LIBS=-lmd fi -AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes]) -if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then - with_sha1=libgcrypt -fi -if test "x$with_sha1" = xlibgcrypt; then - AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1], - [Use libgcrypt SHA1 functions]) - SHA1_LIBS=-lgcrypt -fi AC_CHECK_LIB([sha1], [sha1_begin], [HAVE_LIBSHA1=yes]) if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then with_sha1=libsha1 @@ -1400,6 +1391,15 @@ if test "x$with_sha1" = xlibsha1; then [Use libsha1 for SHA1]) SHA1_LIBS=-lsha1 fi +AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes]) +if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then + with_sha1=libgcrypt +fi +if test "x$with_sha1" = xlibgcrypt; then + AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1], + [Use libgcrypt SHA1 functions]) + SHA1_LIBS=-lgcrypt +fi # We don't need all of the OpenSSL libraries, just libcrypto AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes]) PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],