diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-24 14:11:27 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-24 14:11:27 +0000 |
| commit | 5236fdea4b6815bb50d90243b7c5fcde41706f67 (patch) | |
| tree | b937976b2fc644405db528545704e132eb47d715 /lib | |
| parent | 51f7bfbb35db28f0ebdbd3e7adc28ff0e2a30b1b (diff) | |
| download | ruby-5236fdea4b6815bb50d90243b7c5fcde41706f67.tar.gz ruby-5236fdea4b6815bb50d90243b7c5fcde41706f67.tar.xz ruby-5236fdea4b6815bb50d90243b7c5fcde41706f67.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mkmf.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 5263c4b07..5c4917c94 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -407,10 +407,11 @@ end def macro_defined?(macro, src, opt = "", &b) src = src.sub(/[^\n]\z/, "\\&\n") - try_cpp(src + <<"SRC", opt, &b) + try_compile(src + <<"SRC", opt, &b) /*top*/ #ifndef #{macro} # error +>>>>>> #{macro} undefined <<<<<< #endif SRC end @@ -618,12 +619,18 @@ def check_sizeof(type, header = nil, &b) expr = "sizeof(#{type})" m = "checking size of #{type}... " message "%s", m - Logging::message "check_sizeof: %s--------------------\n", m - if size = try_constant(expr, header, &b) - $defs.push(format("-DSIZEOF_%s=%d", type.upcase.tr_s("^A-Z0-9_", "_"), size)) + a = size = nil + Logging::postpone do + if size = try_constant(expr, header, &b) + $defs.push(format("-DSIZEOF_%s=%d", type.upcase.tr_s("^A-Z0-9_", "_"), size)) + a = "#{size}\n" + else + a = "failed\n" + end + "check_sizeof: #{m}-------------------- #{a}\n" end - message(a = size ? "#{size}\n" : "failed\n") - Logging::message "-------------------- %s\n", a + message(a) + Logging::message "--------------------\n\n" size end |
