aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-12-30 02:21:12 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-12-30 02:21:12 +0900
commita2dc925ac646f30e7d518158d7931ff422444ffe (patch)
treeff9b18b902ef256befc03ccc0bb59a375785b8c2
parent0a74f209ad8e3247932f6eaaa0c0cac6a99510b4 (diff)
downloadruby-openssl-topic/windows-static-linking-without-pkg-config.tar.gz
Fix build with static OpenSSL libraries on Windowstopic/windows-static-linking-without-pkg-config
OpenSSL <= 1.0.2 requires gdi32 for RAND_screen(). OpenSSL >= 1.1.0 no longer has RAND_screen() but it now requires crypt32. If pkg-config is usable, they are automatically linked, but if it is not, configuring Ruby/OpenSSL fails. Fixes: https://bugs.ruby-lang.org/issues/13080
-rw-r--r--ext/openssl/extconf.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 7033b0e2..60bd518e 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -37,6 +37,12 @@ have_library("socket", "socket")
Logging::message "=== Checking for required stuff... ===\n"
result = pkg_config("openssl") && have_header("openssl/ssl.h")
unless result
+ if $mswin || $mingw
+ # required for static OpenSSL libraries
+ have_library("gdi32") # OpenSSL <= 1.0.2 (for RAND_screen())
+ have_library("crypt32")
+ end
+
result = have_header("openssl/ssl.h")
result &&= %w[crypto libeay32].any? {|lib| have_library(lib, "CRYPTO_malloc")}
result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_new")}