summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-14 00:59:08 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-14 00:59:08 +0000
commitca90e7d844729e9abb9b31efcc8f2eec0d866a28 (patch)
treec6ad2a86625b592d815b0836a8fd282eb7aeb74a /lib
parentd720aebb665b2d255c98b84e87f44991c4d79e7e (diff)
merge revision(s) 36948,41777,41779 [Backport #8593]
* lib/mkmf.rb (have_framework): insert a space between options. add just one -ObjC option. * lib/mkmf.rb (have_framework): allow header file to check. [ruby-core:55745] [Bug #8593] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@42550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb27
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 80c1f49e66..f5e4e92f39 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -938,18 +938,31 @@ def have_header(header, preheaders = nil, &b)
end
# Returns whether or not the given +framework+ can be found on your system.
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the framework name, in uppercase, prepended with 'HAVE_FRAMEWORK_'.
+# If found, a macro is passed as a preprocessor constant to the compiler
+# using the framework name, in uppercase, prepended with +HAVE_FRAMEWORK_+.
#
-# For example, if have_framework('Ruby') returned true, then the HAVE_FRAMEWORK_RUBY
-# preprocessor macro would be passed to the compiler.
+# For example, if <code>have_framework('Ruby')</code> returned true, then
+# the +HAVE_FRAMEWORK_RUBY+ preprocessor macro would be passed to the
+# compiler.
#
+# If +fw+ is a pair of the framework name and its header file name
+# that header file is checked, instead of the normally used header
+# file which is named same as the framework.
def have_framework(fw, &b)
+ if Array === fw
+ fw, header = *fw
+ else
+ header = "#{fw}.h"
+ end
checking_for fw do
- src = cpp_include("#{fw}/#{fw}.h") << "\n" "int main(void){return 0;}"
- if try_link(src, opt = "-framework #{fw}", &b)
+ src = cpp_include("#{fw}/#{header}") << "\n" "int main(void){return 0;}"
+ opt = " -framework #{fw}"
+ if try_link(src, "-ObjC#{opt}", &b)
$defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp))
- $LDFLAGS << " " << opt
+ # 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 << opt
true
else
false