On 12/03/2013 12:03 AM, Pádraig Brady wrote: > On 12/02/2013 10:48 PM, Paul Eggert wrote: >> On 12/02/2013 01:05 PM, Pádraig Brady wrote: >>> each project would have >>> to add LIB_CRYPTO_MD5 etc. to their list of libs similarly >>> to the coreutils patch I had inline in my previous mail. >> >> Thanks for explaining. >> >> I tried that for Emacs and came up with the patch >> appended to this message. Unfortunately, it means that Emacs >> is now linked with a command of this form: >> >> gcc $(objects) ... -lcrypto -lcrypto -lcrypto -lcrypto ...
> I separated them to give support for picking the best > library for a particular routine. Separating the libs > now means we could do this transparently in future. > However this probably is a bit over engineered, and > selection on a per library basis is fine. > > I've adjusted my gnulib patch to only export a single LIB_CRYPTO, > and that can be transparently mapped to any other crypto libraries > that we might add in future. Adjusted patch is attached. Seem like I messed this up, and it doesn't work when SHA512 isn't available, while any of the others are. I noticed this failure on the libcrypto available on solaris 10. I'm thinking the simple adjustment attached might be the best fix. thanks, Pádraig.
>From 6589d710ff402dfe5d922a1237b985bf91ecd3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com> Date: Sun, 8 Dec 2013 23:19:29 +0000 Subject: [PATCH] md5, sha1, sha256, sha512: fix link error with partial libcrypto * m4/gl-openssl.m4 (gl_CRYPTO_CHECK): Don't empty LIB_CRYPTO so that if early checks find crypto routines, while the last does not, that @LIB_CRYPTO@ is replaced correctly, avoiding link failures. --- ChangeLog | 7 +++++++ m4/gc.m4 | 1 - m4/gl-openssl.m4 | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9688c32..34563af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-12-07 Pádraig Brady <p...@draigbrady.com> + + md5, sha1, sha256, sha512: fix link error with partial libcrypto + * m4/gl-openssl.m4 (gl_CRYPTO_CHECK): Don't empty LIB_CRYPTO so that + if early checks find crypto routines, while the last does not, + that @LIB_CRYPTO@ is replaced correctly, avoiding link failures. + 2013-12-07 Paul Eggert <egg...@cs.ucla.edu> md5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT diff --git a/m4/gc.m4 b/m4/gc.m4 index 3d13354..66736b8 100644 --- a/m4/gc.m4 +++ b/m4/gc.m4 @@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_GC], [ - LIB_CRYPTO= AC_SUBST([LIB_CRYPTO]) AC_ARG_WITH([libgcrypt], AS_HELP_STRING([--with-libgcrypt], [use libgcrypt for low-level crypto]), diff --git a/m4/gl-openssl.m4 b/m4/gl-openssl.m4 index c8f9dd9..8a5d6bd 100644 --- a/m4/gl-openssl.m4 +++ b/m4/gl-openssl.m4 @@ -29,7 +29,6 @@ AC_DEFUN([gl_CRYPTO_CHECK], ALG_header=sha.h fi - LIB_CRYPTO= AC_SUBST([LIB_CRYPTO]) if test "x$with_openssl" != xno; then AC_CHECK_LIB([crypto], [$1], -- 1.7.7.6