* 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
This commit is contained in:
nobu 2012-04-30 21:03:38 +00:00
Родитель 0f1181a539
Коммит 26e258c807
7 изменённых файлов: 38 добавлений и 22 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Tue May 1 06:03:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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.
Tue May 1 05:02:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue May 1 05:02:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (optflags): disable unsafe optimizations. * configure.in (optflags): disable unsafe optimizations.

Просмотреть файл

@ -9,9 +9,11 @@ $INCFLAGS << " -I$(srcdir)/.."
$objs = [ "md5init.#{$OBJEXT}" ] $objs = [ "md5init.#{$OBJEXT}" ]
dir_config("openssl") dir_config("openssl")
pkg_config("openssl")
require_relative '../../openssl/deprecation'
if !with_config("bundled-md5") && if !with_config("bundled-md5") &&
have_library("crypto") && have_header("openssl/md5.h") have_library("crypto") && OpenSSL.check_func("MD5_Transform", "openssl/md5.h")
$objs << "md5ossl.#{$OBJEXT}" $objs << "md5ossl.#{$OBJEXT}"
else else
@ -22,7 +24,4 @@ have_header("sys/cdefs.h")
$preload = %w[digest] $preload = %w[digest]
if try_compile("", flag = " -Wno-deprecated-declarations")
$warnflags << flag
end
create_makefile("digest/md5") create_makefile("digest/md5")

Просмотреть файл

@ -9,9 +9,11 @@ $INCFLAGS << " -I$(srcdir)/.."
$objs = [ "rmd160init.#{$OBJEXT}" ] $objs = [ "rmd160init.#{$OBJEXT}" ]
dir_config("openssl") dir_config("openssl")
pkg_config("openssl")
require_relative '../../openssl/deprecation'
if !with_config("bundled-rmd160") && if !with_config("bundled-rmd160") &&
have_library("crypto") && have_header("openssl/ripemd.h") have_library("crypto") && OpenSSL.check_func("RMD160_Transform", "openssl/ripemd.h")
$objs << "rmd160ossl.#{$OBJEXT}" $objs << "rmd160ossl.#{$OBJEXT}"
else else
$objs << "rmd160.#{$OBJEXT}" $objs << "rmd160.#{$OBJEXT}"
@ -21,7 +23,4 @@ have_header("sys/cdefs.h")
$preload = %w[digest] $preload = %w[digest]
if try_compile("", flag = " -Wno-deprecated-declarations")
$warnflags << flag
end
create_makefile("digest/rmd160") create_makefile("digest/rmd160")

Просмотреть файл

@ -9,9 +9,11 @@ $INCFLAGS << " -I$(srcdir)/.."
$objs = [ "sha1init.#{$OBJEXT}" ] $objs = [ "sha1init.#{$OBJEXT}" ]
dir_config("openssl") dir_config("openssl")
pkg_config("openssl")
require_relative '../../openssl/deprecation'
if !with_config("bundled-sha1") && if !with_config("bundled-sha1") &&
have_library("crypto") && have_header("openssl/sha.h") have_library("crypto") && OpenSSL.check_func("SHA1_Transform", "openssl/sha.h")
$objs << "sha1ossl.#{$OBJEXT}" $objs << "sha1ossl.#{$OBJEXT}"
else else
$objs << "sha1.#{$OBJEXT}" $objs << "sha1.#{$OBJEXT}"
@ -21,7 +23,4 @@ have_header("sys/cdefs.h")
$preload = %w[digest] $preload = %w[digest]
if try_compile("", flag = " -Wno-deprecated-declarations")
$warnflags << flag
end
create_makefile("digest/sha1") create_makefile("digest/sha1")

Просмотреть файл

@ -9,10 +9,12 @@ $INCFLAGS << " -I$(srcdir)/.."
$objs = [ "sha2init.#{$OBJEXT}" ] $objs = [ "sha2init.#{$OBJEXT}" ]
dir_config("openssl") dir_config("openssl")
pkg_config("openssl")
require_relative '../../openssl/deprecation'
if !with_config("bundled-sha2") && if !with_config("bundled-sha2") &&
have_library("crypto") && have_library("crypto") &&
%w[SHA256 SHA512].all? {|d| have_func("#{d}_Transform", "openssl/sha.h")} && %w[SHA256 SHA512].all? {|d| OpenSSL.check_func("#{d}_Transform", "openssl/sha.h")} &&
%w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")} %w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")}
$objs << "sha2ossl.#{$OBJEXT}" $objs << "sha2ossl.#{$OBJEXT}"
$defs << "-DSHA2_USE_OPENSSL" $defs << "-DSHA2_USE_OPENSSL"
@ -26,8 +28,5 @@ have_header("sys/cdefs.h")
$preload = %w[digest] $preload = %w[digest]
if have_type("uint64_t", "defs.h", $defs.join(' ')) if have_type("uint64_t", "defs.h", $defs.join(' '))
if try_compile("", flag = " -Wno-deprecated-declarations")
$warnflags << flag
end
create_makefile("digest/sha2") create_makefile("digest/sha2")
end end

Просмотреть файл

@ -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

Просмотреть файл

@ -15,6 +15,7 @@
=end =end
require "mkmf" require "mkmf"
require_relative 'deprecation'
dir_config("openssl") dir_config("openssl")
dir_config("kerberos") dir_config("kerberos")
@ -57,12 +58,8 @@ unless have_header("openssl/conf_api.h")
message "OpenSSL 0.9.6 or later required.\n" message "OpenSSL 0.9.6 or later required.\n"
exit 1 exit 1
end end
if try_compile("", flag = "-Werror=deprecated-declarations") unless OpenSSL.check_func("SSL_library_init()", "openssl/ssl.h")
unless have_func("SSL_library_init()", "openssl/ssl.h", flag)
with_config("broken-apple-openssl") or
abort "Ignore OpenSSL broken by Apple" abort "Ignore OpenSSL broken by Apple"
$warnflags << " -Wno-deprecated-declarations"
end
end end
message "=== Checking for OpenSSL features... ===\n" message "=== Checking for OpenSSL features... ===\n"