diff --git a/ChangeLog b/ChangeLog index 08309a8acf..22e5f9f758 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jun 19 14:46:18 2002 WATANABE Hirofumi + + * ext/extmk.rb, lib/mkmf.rb (xsystem): open the log file if xsystem + is called. + Mon Jun 17 10:51:37 2002 Nobuyoshi Nakada * dln.c (dln_load): need to preserve dln_strerror() result, diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 4dc2339acb..244b3bc13f 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -78,18 +78,21 @@ end LINK = "@CC@ #{OUTFLAG}conftest -I#$topdir -I#$top_srcdir #{CFLAGS} @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@" CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} %s %s %s conftest.c" -$log = open('extmk.log', 'w') - +$log = nil $orgerr = $stderr.dup $orgout = $stdout.dup + def xsystem command if $DEBUG puts command + $stdout.flush return system(command) end + $log ||= open(File.join($topdir, 'ext', 'extmk.log'), 'w') $stderr.reopen($log) $stdout.reopen($log) puts command + $stdout.flush r = system(command) $stderr.reopen($orgerr) $stdout.reopen($orgout) @@ -712,6 +715,7 @@ for d in Dir["#{ext_prefix}/**/*"] load "#{$top_srcdir}/ext/aix_mksym.rb" end end + $stdout.flush extmake(d) end diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 5a540187dc..89a88cddb4 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -57,8 +57,6 @@ elsif RUBY_PLATFORM =~ /-nextstep|-rhapsody|-darwin/ CFLAGS.gsub!( /-arch\s\w*/, '' ) end -$log = open('mkmf.log', 'w') - if /mswin32/ =~ RUBY_PLATFORM OUTFLAG = '-Fe' else @@ -78,17 +76,22 @@ def rm_f(*files) end end +$log = nil + $orgerr = $stderr.dup $orgout = $stdout.dup def xsystem command Config.expand(command) if $DEBUG puts command + $stdout.flush return system(command) end + $log ||= open('mkmf.log', 'w') $stderr.reopen($log) $stdout.reopen($log) puts command + $stdout.flush r = system(command) $stderr.reopen($orgerr) $stdout.reopen($orgout)