File tree Expand file tree Collapse file tree 7 files changed +38
-22
lines changed
Expand file tree Collapse file tree 7 files changed +38
-22
lines changed Original file line number Diff line number Diff line change 1+ Tue May 1 06:03:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+ * ext/digest/*/extconf.rb: use pkg_config to use same library with
4+ openssl. [ruby-core:44755][Bug #6379]
5+
6+ * ext/openssl/deprecation.rb: extract check for broken Apple OpenSSL.
7+
18Tue May 1 05:02:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
29
310 * configure.in (optflags): disable unsafe optimizations.
Original file line number Diff line number Diff line change 99$objs = [ "md5init.#{ $OBJEXT} " ]
1010
1111dir_config ( "openssl" )
12+ pkg_config ( "openssl" )
13+ require_relative '../../openssl/deprecation'
1214
1315if !with_config ( "bundled-md5" ) &&
14- have_library ( "crypto" ) && have_header ( "openssl/md5.h" )
16+ have_library ( "crypto" ) && OpenSSL . check_func ( "MD5_Transform" , "openssl/md5.h" )
1517 $objs << "md5ossl.#{ $OBJEXT} "
1618
1719else
2224
2325$preload = %w[ digest ]
2426
25- if try_compile ( "" , flag = " -Wno-deprecated-declarations" )
26- $warnflags << flag
27- end
2827create_makefile ( "digest/md5" )
Original file line number Diff line number Diff line change 99$objs = [ "rmd160init.#{ $OBJEXT} " ]
1010
1111dir_config ( "openssl" )
12+ pkg_config ( "openssl" )
13+ require_relative '../../openssl/deprecation'
1214
1315if !with_config ( "bundled-rmd160" ) &&
14- have_library ( "crypto" ) && have_header ( "openssl/ripemd.h" )
16+ have_library ( "crypto" ) && OpenSSL . check_func ( "RMD160_Transform" , "openssl/ripemd.h" )
1517 $objs << "rmd160ossl.#{ $OBJEXT} "
1618else
1719 $objs << "rmd160.#{ $OBJEXT} "
2123
2224$preload = %w[ digest ]
2325
24- if try_compile ( "" , flag = " -Wno-deprecated-declarations" )
25- $warnflags << flag
26- end
2726create_makefile ( "digest/rmd160" )
Original file line number Diff line number Diff line change 99$objs = [ "sha1init.#{ $OBJEXT} " ]
1010
1111dir_config ( "openssl" )
12+ pkg_config ( "openssl" )
13+ require_relative '../../openssl/deprecation'
1214
1315if !with_config ( "bundled-sha1" ) &&
14- have_library ( "crypto" ) && have_header ( "openssl/sha.h" )
16+ have_library ( "crypto" ) && OpenSSL . check_func ( "SHA1_Transform" , "openssl/sha.h" )
1517 $objs << "sha1ossl.#{ $OBJEXT} "
1618else
1719 $objs << "sha1.#{ $OBJEXT} "
2123
2224$preload = %w[ digest ]
2325
24- if try_compile ( "" , flag = " -Wno-deprecated-declarations" )
25- $warnflags << flag
26- end
2726create_makefile ( "digest/sha1" )
Original file line number Diff line number Diff line change 99$objs = [ "sha2init.#{ $OBJEXT} " ]
1010
1111dir_config ( "openssl" )
12+ pkg_config ( "openssl" )
13+ require_relative '../../openssl/deprecation'
1214
1315if !with_config ( "bundled-sha2" ) &&
1416 have_library ( "crypto" ) &&
15- %w[ SHA256 SHA512 ] . all? { |d | have_func ( "#{ d } _Transform" , "openssl/sha.h" ) } &&
17+ %w[ SHA256 SHA512 ] . all? { |d | OpenSSL . check_func ( "#{ d } _Transform" , "openssl/sha.h" ) } &&
1618 %w[ SHA256 SHA512 ] . all? { |d | have_type ( "#{ d } _CTX" , "openssl/sha.h" ) }
1719 $objs << "sha2ossl.#{ $OBJEXT} "
1820 $defs << "-DSHA2_USE_OPENSSL"
2628$preload = %w[ digest ]
2729
2830if have_type ( "uint64_t" , "defs.h" , $defs. join ( ' ' ) )
29- if try_compile ( "" , flag = " -Wno-deprecated-declarations" )
30- $warnflags << flag
31- end
3231 create_makefile ( "digest/sha2" )
3332end
Original file line number Diff line number Diff line change 1+ module OpenSSL
2+ def self . check_func ( func , header )
3+ unless flag = ( @deprecated_warning_flag ||= nil )
4+ if try_compile ( "" , flag = "-Werror=deprecated-declarations" )
5+ if with_config ( "broken-apple-openssl" )
6+ flag = "-Wno-deprecated-declarations"
7+ end
8+ $warnflags << " #{ flag } "
9+ else
10+ flag = ""
11+ end
12+ @deprecated_warning_flag = flag
13+ end
14+ have_func ( func , header , flag )
15+ end
16+ end
Original file line number Diff line number Diff line change 1515=end
1616
1717require "mkmf"
18+ require_relative 'deprecation'
1819
1920dir_config ( "openssl" )
2021dir_config ( "kerberos" )
5758 message "OpenSSL 0.9.6 or later required.\n "
5859 exit 1
5960end
60- if try_compile ( "" , flag = "-Werror=deprecated-declarations" )
61- unless have_func ( "SSL_library_init()" , "openssl/ssl.h" , flag )
62- with_config ( "broken-apple-openssl" ) or
63- abort "Ignore OpenSSL broken by Apple"
64- $warnflags << " -Wno-deprecated-declarations"
65- end
61+ unless OpenSSL . check_func ( "SSL_library_init()" , "openssl/ssl.h" )
62+ abort "Ignore OpenSSL broken by Apple"
6663end
6764
6865message "=== Checking for OpenSSL features... ===\n "
You can’t perform that action at this time.
0 commit comments