summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-30 21:03:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-30 21:03:38 +0000
commit26e258c807c25097ae41e9c5d7dcb3b7a3bda64c (patch)
tree25fcab122d349a4ea9cb97de477b66859a243270 /ext/openssl
parent0f1181a5390df3ac3a8e2d9f8bd9815c1215e94b (diff)
* ext/digest/*/extconf.rb: use pkg_config to use same library with
openssl. [ruby-core:44755][Bug #6379] * ext/openssl/deprecation.rb: extract check for broken Apple OpenSSL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/deprecation.rb16
-rw-r--r--ext/openssl/extconf.rb9
2 files changed, 19 insertions, 6 deletions
diff --git a/ext/openssl/deprecation.rb b/ext/openssl/deprecation.rb
new file mode 100644
index 0000000..d026f02
--- /dev/null
+++ b/ext/openssl/deprecation.rb
@@ -0,0 +1,16 @@
+module OpenSSL
+ def self.check_func(func, header)
+ unless flag = (@deprecated_warning_flag ||= nil)
+ if try_compile("", flag = "-Werror=deprecated-declarations")
+ if with_config("broken-apple-openssl")
+ flag = "-Wno-deprecated-declarations"
+ end
+ $warnflags << " #{flag}"
+ else
+ flag = ""
+ end
+ @deprecated_warning_flag = flag
+ end
+ have_func(func, header, flag)
+ end
+end
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index dd0ebf4..640348f 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -15,6 +15,7 @@
=end
require "mkmf"
+require_relative 'deprecation'
dir_config("openssl")
dir_config("kerberos")
@@ -57,12 +58,8 @@ unless have_header("openssl/conf_api.h")
message "OpenSSL 0.9.6 or later required.\n"
exit 1
end
-if try_compile("", flag = "-Werror=deprecated-declarations")
- unless have_func("SSL_library_init()", "openssl/ssl.h", flag)
- with_config("broken-apple-openssl") or
- abort "Ignore OpenSSL broken by Apple"
- $warnflags << " -Wno-deprecated-declarations"
- end
+unless OpenSSL.check_func("SSL_library_init()", "openssl/ssl.h")
+ abort "Ignore OpenSSL broken by Apple"
end
message "=== Checking for OpenSSL features... ===\n"