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

ruby-changes:28486

From: nobu <ko1@a...>
Date: Wed, 1 May 2013 16:48:16 +0900 (JST)
Subject: [ruby-changes:28486] nobu:r40538 (trunk): curses/extconf.rb: simplify

nobu	2013-05-01 16:48:06 +0900 (Wed, 01 May 2013)

  New Revision: 40538

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

  Log:
    curses/extconf.rb: simplify
    
    * ext/curses/extconf.rb (curses_version): try once for each tests, a
      function or a variable.  fallback to variable for old SVR4.

  Modified files:
    trunk/ChangeLog
    trunk/ext/curses/extconf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40537)
+++ ChangeLog	(revision 40538)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed May  1 16:47:47 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/curses/extconf.rb (curses_version): try once for each tests, a
+	  function or a variable.  fallback to variable for old SVR4.
+
 Wed May  1 16:17:46 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/extmk.rb (extmake): extensions not to be installed should not
Index: ext/curses/extconf.rb
===================================================================
--- ext/curses/extconf.rb	(revision 40537)
+++ ext/curses/extconf.rb	(revision 40538)
@@ -110,18 +110,17 @@ if header_library https://github.com/ruby/ruby/blob/trunk/ext/curses/extconf.rb#L110
           return EXIT_FAILURE;
       }
     End
-    function_p = checking_for(checking_message('link function curses_version', curses)) { try_link(func_test_program) } ? nil : false
-    variable_p = checking_for(checking_message('link variable curses_version', curses)) { try_link(var_test_program) } ? nil : false
-    if [header, library].any? {|v| /ncurses|pdcurses|xcurses/i =~ v }
-      function_p = true if function_p == nil
-      variable_p = false if variable_p == nil
-    end
-    if !CROSS_COMPILING
-      if function_p != false
-        function_p = checking_for(checking_message('run function curses_version', curses)) { try_run(func_test_program) }
-      end
-      if variable_p != false
-        variable_p = checking_for(checking_message('run variable curses_version', curses)) { try_run(var_test_program) }
+    try = method(CROSS_COMPILING ? :try_link : :try_run)
+    function_p = checking_for(checking_message('function curses_version', curses)) { try[func_test_program] }
+    variable_p = checking_for(checking_message('variable curses_version', curses)) { try[var_test_program] }
+    if function_p and variable_p
+      if [header, library].grep(/ncurses|pdcurses|xcurses/i)
+        variable_p = false
+      else
+        warn "found curses_version but cannot determin whether it is a"
+        warn "function or a variable, so assume a variable in old SVR4"
+        warn "ncurses."
+        function_p = false
       end
     end
     $defs << '-DHAVE_FUNC_CURSES_VERSION' if function_p

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

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