* lib/mkmf.rb (macro_defined?): try to compile for an old compiler

which doesn't bail out at #error directive.  [ruby-dev:25818]

* lib/mkmf.rb (check_sizeof): refine logging messages.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-03-24 14:11:27 +00:00
parent 3b6992be67
commit 15df6bd4f7
2 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,10 @@
Thu Mar 24 23:10:44 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (macro_defined?): try to compile for an old compiler
which doesn't bail out at #error directive. [ruby-dev:25818]
* lib/mkmf.rb (check_sizeof): refine logging messages.
Wed Mar 23 19:08:10 2005 GOTOU Yuuzou <gotoyuzo@notwork.org> Wed Mar 23 19:08:10 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/utils.rb (WEBrick::Utils.create_listeners): * lib/webrick/utils.rb (WEBrick::Utils.create_listeners):

View File

@ -458,10 +458,11 @@ end
def macro_defined?(macro, src, opt = "", &b) def macro_defined?(macro, src, opt = "", &b)
src = src.sub(/[^\n]\z/, "\\&\n") src = src.sub(/[^\n]\z/, "\\&\n")
try_cpp(src + <<"SRC", opt, &b) try_compile(src + <<"SRC", opt, &b)
/*top*/ /*top*/
#ifndef #{macro} #ifndef #{macro}
# error # error
>>>>>> #{macro} undefined <<<<<<
#endif #endif
SRC SRC
end end
@ -688,12 +689,18 @@ def check_sizeof(type, header = nil, &b)
expr = "sizeof(#{type})" expr = "sizeof(#{type})"
m = "checking size of #{type}... " m = "checking size of #{type}... "
message "%s", m message "%s", m
Logging::message "check_sizeof: %s--------------------\n", m a = size = nil
Logging::postpone do
if size = try_constant(expr, header, &b) if size = try_constant(expr, header, &b)
$defs.push(format("-DSIZEOF_%s=%d", type.upcase.tr_s("^A-Z0-9_", "_"), size)) $defs.push(format("-DSIZEOF_%s=%d", type.upcase.tr_s("^A-Z0-9_", "_"), size))
a = "#{size}\n"
else
a = "failed\n"
end end
message(a = size ? "#{size}\n" : "failed\n") "check_sizeof: #{m}-------------------- #{a}\n"
Logging::message "-------------------- %s\n", a end
message(a)
Logging::message "--------------------\n\n"
size size
end end