summaryrefslogtreecommitdiff
path: root/ext/digest/sha2/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/digest/sha2/extconf.rb')
-rw-r--r--ext/digest/sha2/extconf.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb
index c15043f..e546e3a 100644
--- a/ext/digest/sha2/extconf.rb
+++ b/ext/digest/sha2/extconf.rb
@@ -6,10 +6,18 @@ require "mkmf"
$defs << "-DHAVE_CONFIG_H"
$INCFLAGS << " -I$(srcdir)/.."
-$objs = [
- "sha2.#{$OBJEXT}",
- "sha2init.#{$OBJEXT}",
-]
+$objs = [ "sha2init.#{$OBJEXT}" ]
+
+dir_config("openssl")
+
+if !with_config("bundled-sha2") &&
+ have_library("crypto") && have_header("openssl/sha.h") &&
+ %w[SHA256 SHA512].all? {|d| have_func("#{d}_Transform", "openssl/sha.h")}
+ $objs << "sha2ossl.#{$OBJEXT}"
+else
+ have_type("u_int8_t")
+ $objs << "sha2.#{$OBJEXT}"
+end
have_header("sys/cdefs.h")