summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--lib/mkmf.rb7
-rw-r--r--template/Makefile.in2
-rw-r--r--win32/Makefile.sub2
4 files changed, 8 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 45a181c1eb..9db4f0c7a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -662,9 +662,9 @@ RUBY_WERROR_FLAG([
[enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [
- RPATHFLAG="${rpathflag:+ ${rpathflag}%1\$-s}"
+ RPATHFLAG="${rpathflag:+${rpathflag}%1\$-s}"
])
- AS_CASE([${RPATHFLAG}],[*'%1$'*],[: ${LIBPATHFLAG=' -L%1$-s'}],[: ${LIBPATHFLAG=' -L%s'}])
+ AS_CASE([${RPATHFLAG}],[*'%1$'*],[: ${LIBPATHFLAG='-L%1$-s'}],[: ${LIBPATHFLAG='-L%s'}])
}
RUBY_TRY_LDFLAGS(-fdeclspec, [fdeclspec=yes], [fdeclspec=no])
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 73459ffeb9..d970e9a6ad 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -583,14 +583,15 @@ MSG
end
def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
+ libpathflags = nil
libpath.map{|x|
case x
when "$(topdir)", /\A\./
LIBPATHFLAG
else
- LIBPATHFLAG+RPATHFLAG
+ libpathflags ||= [LIBPATHFLAG, RPATHFLAG].grep(/\S/).join(" ")
end % x.quote
- }.join
+ }.join(" ")
end
def werror_flag(opt = nil)
@@ -2906,7 +2907,7 @@ MESSAGE
##
# Argument which will add a library path to the linker
- LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L%s'
+ LIBPATHFLAG = config_string('LIBPATHFLAG') || '-L%s'
##
# Argument which will add a runtime library path to the linker
diff --git a/template/Makefile.in b/template/Makefile.in
index 7e0a02b909..4cc0865ddc 100644
--- a/template/Makefile.in
+++ b/template/Makefile.in
@@ -360,7 +360,7 @@ install-cross: $(arch)-fake.rb $(RBCONFIG) rbconfig.rb $(arch_hdrdir)/ruby/confi
$(Q) sed '/^\$$:\.unshift/q' $(arch)-fake.rb > fake.rb
$(Q) $(BASERUBY) -p \
-e '~/^\s*CONFIG\["LDFLAGS"\]/ and' \
- -e '$$_[/(?=\s*"$$)/] = %q[ #{(CONFIG["LIBPATHFLAG"]%File.dirname(__FILE__)).strip}]' \
+ -e '$$_[/(?=\s*"$$)/] = %q[ #{CONFIG["LIBPATHFLAG"]%File.dirname(__FILE__)}]' \
rbconfig.rb > fake-rbconfig.rb
$(INSTALL_SCRIPT) fake.rb $(XRUBY_RUBYLIBDIR)/$(arch)/fake.rb
$(INSTALL_SCRIPT) fake-rbconfig.rb $(XRUBY_RUBYLIBDIR)/$(arch)/rbconfig.rb
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 2598c798d1..6ca909f61b 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -1095,7 +1095,7 @@ s,@CSRCFLAG@,$(CSRCFLAG),;t t
s,@CPPOUTFILE@,-P,;t t
s,@PRELOADENV@,,;t t
s,@LIBPATHENV@,PATH,;t t
-s,@LIBPATHFLAG@, -libpath:%s,;t t
+s,@LIBPATHFLAG@,-libpath:%s,;t t
s,@RPATHFLAG@,,;t t
s,@LIBARG@,%s.lib,;t t
s,@LINK_SO@,$$(LDSHARED) -Fe$$(@) $$(OBJS) $$(LIBS) $$(LOCAL_LIBS) -link $$(DLDFLAGS) -implib:$$(*F:.so=)-$$(arch).lib -pdb:$$(*F:.so=)-$$(arch).pdb -def:$$(DEFFILE),;t t