summaryrefslogtreecommitdiff
path: root/ext/curses
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-26 03:43:19 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-26 03:43:19 +0000
commita36cd96c2a01b5cc4e569fba5c7d7c0da0c30664 (patch)
tree5783d10a1d24001c4cfb021887d8e07e208a1a02 /ext/curses
parent93ed9f08ad9e9aa1aa44d83e6dc850721e1fd112 (diff)
* ext/curses/extconf.rb: Test linkability of curses_version at first.
* ext/socket/extconf.rb: Test the behavior of fd passing with MSG_PEEK only if recvmsg(), msg_control member, AF_UNIX and SCM_RIGHTS are available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/curses')
-rw-r--r--ext/curses/extconf.rb62
1 files changed, 31 insertions, 31 deletions
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 467494e190..830369c301 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -89,40 +89,40 @@ if header_library
when "variable"
$defs << '-DHAVE_VAR_CURSES_VERSION'
when nil
- function_p = nil
- variable_p = nil
- if [header, library].any? {|v| /ncurses|pdcurses|xcurses/i =~ v }
- function_p = true
- end
- if !CROSS_COMPILING
- prolog = cpp_include(curses)
- function_p = checking_for(checking_message('function curses_version', curses)) {
- try_run(<<-"End")
- #{prolog}
- int main(int argc, char *argv[])
- {
- curses_version();
- return EXIT_SUCCESS;
- }
- End
+ func_test_program = cpp_include(curses) + <<-"End"
+ int main(int argc, char *argv[])
+ {
+ curses_version();
+ return EXIT_SUCCESS;
}
- variable_p = checking_for(checking_message('variable curses_version', curses)) {
- try_run(<<-"End")
- #{prolog}
- extern char *curses_version;
- int main(int argc, char *argv[])
- {
- int i = 0;
- for (i = 0; i < 100; i++) {
- if (curses_version[i] == 0)
- return 0 < i ? EXIT_SUCCESS : EXIT_FAILURE;
- if (curses_version[i] & 0x80)
- return EXIT_FAILURE;
- }
- return EXIT_FAILURE;
+ End
+ var_test_program = cpp_include(curses) + <<-"End"
+ extern char *curses_version;
+ int main(int argc, char *argv[])
+ {
+ int i = 0;
+ for (i = 0; i < 100; i++) {
+ if (curses_version[i] == 0)
+ return 0 < i ? EXIT_SUCCESS : EXIT_FAILURE;
+ if (curses_version[i] & 0x80)
+ return EXIT_FAILURE;
}
- End
+ 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) }
+ end
end
$defs << '-DHAVE_FUNC_CURSES_VERSION' if function_p
$defs << '-DHAVE_VAR_CURSES_VERSION' if variable_p