[前][次][番号順一覧][スレッド一覧]

ruby-changes:16770

From: nobu <ko1@a...>
Date: Tue, 27 Jul 2010 19:10:15 +0900 (JST)
Subject: [ruby-changes:16770] Ruby:r28765 (trunk): * lib/mkmf.rb (have_framework): added.

nobu	2010-07-27 18:59:29 +0900 (Tue, 27 Jul 2010)

  New Revision: 28765

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28765

  Log:
    * lib/mkmf.rb (have_framework): added.

  Modified files:
    trunk/ChangeLog
    trunk/lib/mkmf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28764)
+++ ChangeLog	(revision 28765)
@@ -1,3 +1,7 @@
+Tue Jul 27 18:59:15 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/mkmf.rb (have_framework): added.
+
 Tue Jul 27 18:33:42 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* defines.h, intern.h, missing.h, ruby.h, st.h, util.h: include
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 28764)
+++ lib/mkmf.rb	(revision 28765)
@@ -839,6 +839,26 @@
   end
 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_'.
+#
+# For example, if have_framework('Ruby') returned true, then the HAVE_FRAMEWORK_RUBY
+# preprocessor macro would be passed to the compiler.
+#
+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, opt = "-framework #{fw}", &b)
+      $defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp))
+      $LDFLAGS << " " << opt
+      true
+    else
+      false
+    end
+  end
+end
+
 # Instructs mkmf to search for the given +header+ in any of the +paths+
 # provided, and returns whether or not it was found in those paths.
 #
@@ -1875,6 +1895,12 @@
       mfile.printf("\n\t%s\n\n", COMPILE_C)
     end
   end
+  %w[m].each do |e|
+    COMPILE_RULES.each do |rule|
+      mfile.printf(rule, e, $OBJEXT)
+      mfile.printf("\n\t%s\n\n", COMPILE_OBJC)
+    end
+  end
 
   mfile.print "$(RUBYARCHDIR)/" if $extout
   mfile.print "$(DLLIB): "
@@ -2037,6 +2063,7 @@
 RULE_SUBST = config_string('RULE_SUBST')
 COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<'
 COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<'
+COMPILE_OBJC = config_string('COMPILE_OBJC') || COMPILE_C
 TRY_LINK = config_string('TRY_LINK') ||
   "$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
   "$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]