summaryrefslogtreecommitdiff
path: root/ext/openssl/extconf.rb
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-14 09:49:09 +0000
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-14 09:49:09 +0000
commit9eb92007b6c2ab2b1fe031c3681144e51e2bcc14 (patch)
tree30f9be0741e8ce45db7639cd700031e7d24dbd4d /ext/openssl/extconf.rb
parentdbf67bf02db7afcca46b58e5b48fc7d805818e48 (diff)
openssl: import v2.0.4
Import Ruby/OpenSSL 2.0.4. Only bug (and typo) fixes. The full commit history since v2.0.3 (imported at r57482) can be found at: https://github.com/ruby/openssl/compare/v2.0.3...v2.0.4 This contains the fix for [Bug #11033]. ---------------------------------------------------------------- Jun Aruga (1): Update .travis.yml and Dockerfile Kazuki Yamaguchi (9): test/test_pkey_ec: do not use dummy 0 order test/test_ssl: fix typo in test_sysread_and_syswrite ssl: check return value of SSL_set_fd() Fix typos test/test_x509store: skip OpenSSL::TestX509Store#test_set_errors tool/sync-with-trunk: 'LASY' -> 'LAST' x509store: clear error queue after calling X509_LOOKUP_load_file() extconf.rb: simplify searching libraries logic Ruby/OpenSSL 2.0.4 SHIBATA Hiroshi (1): Fix typos Vladimir Rybas (1): Fix documentation for OpenSSL::Cipher#final nobu (2): openssl: fix broken openssl check openssl: fix broken openssl check usa (1): Search SSL libraries by testing various filename patterns git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/extconf.rb')
-rw-r--r--ext/openssl/extconf.rb64
1 files changed, 33 insertions, 31 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 250aabe478..8f6047087a 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -46,41 +46,43 @@ def find_openssl_library
return false unless have_header("openssl/ssl.h")
- libpath = $LIBPATH.dup
- libpath |= ENV["LIB"].split(File::PATH_SEPARATOR).map{|d| d.tr(File::ALT_SEPARATOR, File::SEPARATOR)} if $mswin
-
- result = false
- %w[crypto eay32].each do |base|
- libs = [base]
- if $mswin || $mingw
- libs << "lib" + libs.first
- if base == "crypto"
- libs << libs.first + "-[0-9][0-9]"
- libs << "lib" + libs.last
- end
- libs = Dir.glob(libs.map{|l| libpath.map{|d| File.join(d, l + ".*")}}.flatten).map{|path| File.basename(path, ".*")}.uniq
+ ret = have_library("crypto", "CRYPTO_malloc") &&
+ have_library("ssl", "SSL_new")
+ return ret if ret
+
+ if $mswin
+ # OpenSSL >= 1.1.0: libcrypto.lib and libssl.lib.
+ if have_library("libcrypto", "CRYPTO_malloc") &&
+ have_library("libssl", "SSL_new")
+ return true
end
- libs.each do |lib|
- result = have_library(lib, "CRYPTO_malloc")
- break if result
+
+ # OpenSSL <= 1.0.2: libeay32.lib and ssleay32.lib.
+ if have_library("libeay32", "CRYPTO_malloc") &&
+ have_library("ssleay32", "SSL_new")
+ return true
end
- break if result
- end
- return false unless result
-
- %w[ssl ssleay32].each do |base|
- libs = [base]
- if $mswin || $mingw
- libs << "lib" + libs.first
- if base == "ssl"
- libs << libs.first + "-[0-9][0-9]"
- libs << "lib" + libs.last
- end
+
+ # LibreSSL: libcrypto-##.lib and libssl-##.lib, where ## is the ABI version
+ # number. We have to find the version number out by scanning libpath.
+ libpath = $LIBPATH.dup
+ libpath |= ENV["LIB"].split(File::PATH_SEPARATOR)
+ libpath.map! { |d| d.tr(File::ALT_SEPARATOR, File::SEPARATOR) }
+
+ ret = [
+ ["crypto", "CRYPTO_malloc"],
+ ["ssl", "SSL_new"]
+ ].all? do |base, func|
+ result = false
+ libs = ["lib#{base}-[0-9][0-9]", "lib#{base}-[0-9][0-9][0-9]"]
libs = Dir.glob(libs.map{|l| libpath.map{|d| File.join(d, l + ".*")}}.flatten).map{|path| File.basename(path, ".*")}.uniq
+ libs.each do |lib|
+ result = have_library(lib, func)
+ break if result
+ end
+ result
end
- libs.each do |lib|
- return true if have_library(lib, "SSL_new")
- end
+ return ret if ret
end
return false
end