summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-30 16:17:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-30 16:17:55 +0000
commit8a22a0530e5095b11a52dfc820cef4016c55e3ff (patch)
tree09fedee402ff510de2bf36b4986e3802485a8587
parente3230f154c874917f9c4384498558da3fdaba432 (diff)
mkmf.rb: try without -ObjC option
* lib/mkmf.rb (have_framework): try without -ObjC option first as MacPorts GCCs do not support it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/mkmf.rb4
-rw-r--r--test/mkmf/test_framework.rb4
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index bc93fec6c41..6177e04f562 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1092,11 +1092,11 @@ SRC
checking_for fw do
src = cpp_include("#{fw}/#{header}") << "\n" "int main(void){return 0;}"
opt = " -framework #{fw}"
- if try_link(src, "-ObjC#{opt}", &b)
+ if try_link(src, opt, &b) or (objc = try_link(src, "-ObjC#{opt}", &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.
- $LDFLAGS << " -ObjC" unless /(\A|\s)-ObjC(\s|\z)/ =~ $LDFLAGS
+ $LDFLAGS << " -ObjC" if objc and /(\A|\s)-ObjC(\s|\z)/ !~ $LDFLAGS
$LIBS << opt
true
else
diff --git a/test/mkmf/test_framework.rb b/test/mkmf/test_framework.rb
index 3585f959f96..cad6b052d0e 100644
--- a/test/mkmf/test_framework.rb
+++ b/test/mkmf/test_framework.rb
@@ -26,7 +26,9 @@ class TestMkmf
def test_multi_frameworks
assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
- assert(have_framework("Cocoa"), mkmflog("try as Objective-C"))
+ create_framework("MkmfTest") do |fw|
+ assert(have_framework(fw), MKMFLOG)
+ end
end
def test_empty_framework