From 5fe5eb264d79e4ffa7c77b1a09d1de69469fffb9 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 24 Feb 2010 00:31:37 +0000 Subject: * ext/digest/extconf.rb: use OpenSSL only when all transform functions are available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/digest/sha2/extconf.rb | 3 ++- ext/digest/sha2/sha2init.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'ext/digest/sha2') diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb index e546e3ac12..d4af8702aa 100644 --- a/ext/digest/sha2/extconf.rb +++ b/ext/digest/sha2/extconf.rb @@ -11,9 +11,10 @@ $objs = [ "sha2init.#{$OBJEXT}" ] dir_config("openssl") if !with_config("bundled-sha2") && - have_library("crypto") && have_header("openssl/sha.h") && + have_library("crypto") && %w[SHA256 SHA512].all? {|d| have_func("#{d}_Transform", "openssl/sha.h")} $objs << "sha2ossl.#{$OBJEXT}" + $defs << "-DSHA2_USE_OPENSSL" else have_type("u_int8_t") $objs << "sha2.#{$OBJEXT}" diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c index 25ef6d2546..13df4bcb78 100644 --- a/ext/digest/sha2/sha2init.c +++ b/ext/digest/sha2/sha2init.c @@ -2,7 +2,7 @@ /* $Id$ */ #include "digest.h" -#if defined(HAVE_OPENSSL_SHA_H) && defined(HAVE_SHA256_TRANSFORM) && defined(HAVE_SHA512_TRANSFORM) +#if defined(SHA2_USE_OPENSSL) #include "sha2ossl.h" #else #include "sha2.h" -- cgit v1.2.3