summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-26 16:05:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-26 16:05:52 +0000
commita38c728e4b69bff3d9be416f519e75e248f921d5 (patch)
tree8b99553be35981bc6fcf12ea9730fc333fd14a4b
parent33ae7493f91350a5cf4a0b829e803f9501381252 (diff)
* 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/branches/ruby_1_8@11037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/mkmf.rb17
2 files changed, 10 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index f4dfb12829..30168505f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Sep 27 01:04:49 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (try_func): check function pointer first and macro next.
+
+ * lib/mkmf.rb (have_type): simplified with typedef and sizeof.
+
Tue Sep 26 23:57:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (OptionParser#getopts): use strings as key.
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index e2be086f3b..0e2b5829a5 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