aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-01 07:48:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-01 07:48:06 +0000
commitf0a5e1fc3cd6e6bde9e8c8c25d3b85aa4a2559b4 (patch)
treea24f11ea3a6f248be7bbabcc4c1970d6cdc3f2fc /ext
parent262669e6c68e28322c1ab2b9323977548d46c09a (diff)
downloadruby-f0a5e1fc3cd6e6bde9e8c8c25d3b85aa4a2559b4.tar.gz
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/curses/extconf.rb23
1 files changed, 11 insertions, 12 deletions
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 830369c301..cff10a9ce1 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -110,18 +110,17 @@ if header_library
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