diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 34dbcda657..43298dc29c 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -388,7 +388,7 @@ def xsystem command, opts = nil result = nil Logging.postpone do |log| output = IO.popen(libpath_env, command, &:read) - result = ($?.success? and File.zero?(log.path)) + result = ($?.success? and log_harmless?(log.path)) output end result @@ -410,6 +410,14 @@ def xpopen command, *mode, &block end end + # Returns true when the log file given by +path+ is empty or contains nothing + # but harmless warnings. + def log_harmless? path + File.readlines(path).all? do |line| + line =~ /warning: \w+\(\) is .+ misused/ + end + end + def log_src(src, heading="checked program was") src = src.split(/^/) fmt = "%#{src.size.to_s.size}d: %s"