summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-24 10:49:57 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-24 10:49:57 +0000
commitab6e5c655ca15457c0ce1be10a16b958994ca2f9 (patch)
treefb659b308041e1516462d5bfcbff7203cb6001f9 /ext
parent8e19c02e8f14be0254e7a3978cce6ff07677abd2 (diff)
* ext/extmk.rb: add -Wl,--no-undefined to LDSHARED only
if GNU ld is 2.11 or later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/extmk.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/extmk.rb b/ext/extmk.rb
index 06a9fd50fc..0485568d6b 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -10,6 +10,7 @@ $extinit = nil
$extobjs = nil
$ignore = nil
$message = nil
+$use_no_undef = nil
$progname = $0
alias $PROGRAM_NAME $0
@@ -33,6 +34,12 @@ $topdir = File.expand_path(".")
$top_srcdir = srcdir
$hdrdir = $top_srcdir
+if not $use_no_undef and /linux/ =~ RUBY_PLATFORM and
+ $configure_args['--enable-shared'] and
+ CONFIG["GNU_LD"] == "yes"
+ $use_no_undef = 0 <= (`ld -v`.scan(/\d+/).map{|x| x.to_i} <=> [2, 11])
+end
+
def sysquote(x)
@quote ||= /human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
@quote ? x.quote : x
@@ -53,7 +60,7 @@ def extmake(target)
init_mkmf
- if /linux/ =~ RUBY_PLATFORM and $configure_args['--enable-shared'] and CONFIG["GNU_LD"] == "yes"
+ if $use_no_undef
$DLDFLAGS << " -Wl,--no-undefined"
end