[PATCH] Prefer libsha1 over libgcrypt

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Tue Apr 13 11:37:18 PDT 2010


From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

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 <yselkowitz at users.sourceforge.net>
---
 configure.ac |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index fd8ea9b..4d62618 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1408,15 +1408,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
@@ -1426,6 +1417,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],
-- 
1.6.6.1



More information about the xorg-devel mailing list