merge revision(s) 40080,40081: [Backport #8209]

	* ext/extmk.rb (extmake): Use Logging.open to switch stdout and
	  stderr.  Delay Logging::log_close until the failure message is
	  written.  Write the failure message only if log file is opened.

	* lib/mkmf.rb (Logging.log_opened?): New method.
	  [ruby-dev:47215] [Bug #8209]

	* ext/extmk.rb (extmake): Invoke Logging::log_close in a ensure
	  clause.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e