From d0d68df7d00f58c8ebb9a74f577dca389876d882 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 6 Sep 2012 16:21:57 +0000 Subject: mkmf.rb: fix splitting options with an argument * ext/extmk.rb (extmake), lib/mkmf.rb (have_framework): fix splitting options with an argument, not using NUL as special character. [ruby-core:47447] [Bug #6987] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/mkmf.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/mkmf.rb') diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 39113b5130..5a0d2743d1 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -234,6 +234,10 @@ module MakeMakefile t if times.all? {|n| n <= t} end + def split_libs(*strs) + strs.map {|s| s.split(/\s+(?=-|\z)/)}.flatten + end + def merge_libs(*libs) libs.inject([]) do |x, y| xy = x & y @@ -1018,11 +1022,10 @@ SRC def have_framework(fw, &b) checking_for fw do src = cpp_include("#{fw}/#{fw}.h") << "\n" "int main(void){return 0;}" - if try_link(src, "-ObjC -framework #{fw}", &b) + if try_link(src, opt = "-ObjC -framework #{fw}", &b) $defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp)) # TODO: non-worse way than this hack, to get rid of separating # option and its argument. - opt = " -ObjC -framework\0#{fw}" $LDFLAGS << opt true else @@ -1804,7 +1807,7 @@ INCFLAGS = -I. #$INCFLAGS DEFS = #{CONFIG['DEFS']} CPPFLAGS = #{extconf_h}#{$CPPFLAGS} CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']} -ldflags = #{$LDFLAGS.tr("\0", " ")} +ldflags = #{$LDFLAGS} dldflags = #{$DLDFLAGS} #{CONFIG['EXTDLDFLAGS']} ARCH_FLAG = #{$ARCH_FLAG} DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) -- cgit v1.2.3