From 4f6f0b1066be455ccc3f1ad80dd42c3f54068c7f Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 26 Sep 2006 16:05:52 +0000 Subject: * lib/mkmf.rb (try_func): check function pointer first and macro next. * lib/mkmf.rb (have_type): simplified with typedef and sizeof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/mkmf.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'lib/mkmf.rb') diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 198765c8ef..d68eb8b060 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -410,12 +410,7 @@ end def try_func(func, libs, headers = nil, &b) headers = cpp_include(headers) - try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b) -#{headers} -/*top*/ -int main() { return 0; } -int t() { #{func}(); return 0; } -SRC + try_link(<<"SRC", libs, &b) or macro_defined?(func, COMMON_HEADERS+headers, &b) #{COMMON_HEADERS} #{headers} /*top*/ @@ -758,16 +753,12 @@ end def have_type(type, headers = nil, opt = "", &b) checking_for checking_message(type, headers, opt) do headers = cpp_include(headers) - if try_compile(<<"SRC", opt, &b) or (/\A\w+\z/n =~ type && try_compile(<<"SRC", opt, &b)) -#{COMMON_HEADERS} -#{headers} -/*top*/ -static #{type} t; -SRC + if try_compile(<<"SRC", opt, &b) #{COMMON_HEADERS} #{headers} /*top*/ -static #{type} *t; +typedef #{type} conftest_type; +static conftest_type conftestval[sizeof(conftest_type)?1:-1]; SRC $defs.push(format("-DHAVE_TYPE_%s", type.strip.upcase.tr_s("^A-Z0-9_", "_"))) true -- cgit v1.2.3