From a36cd96c2a01b5cc4e569fba5c7d7c0da0c30664 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 26 Apr 2013 03:43:19 +0000 Subject: * 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 --- ext/curses/extconf.rb | 62 +++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'ext/curses/extconf.rb') 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 -- cgit v1.2.3