X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=perl%2FUCW%2FConfigure.pm;h=dc1dac85328c7266753dd43c29d3503588f92881;hb=aec3aea0c865154a35d7f04dfa86da95fdaea4da;hp=5d458adbb63c15e96d1011682eb1286877a0bafd;hpb=3d14be2fa32fe908dfef0f6ac3b76067c080a43a;p=leo.git diff --git a/perl/UCW/Configure.pm b/perl/UCW/Configure.pm index 5d458ad..dc1dac8 100644 --- a/perl/UCW/Configure.pm +++ b/perl/UCW/Configure.pm @@ -9,6 +9,7 @@ package UCW::Configure; use strict; use warnings; +use IO::File; BEGIN { # The somewhat hairy Perl export mechanism @@ -33,14 +34,17 @@ sub DebugDump() { sub Log($) { print @_; + STDOUT->flush; } sub Notice($) { print @_ if $vars{"VERBOSE"}; + STDOUT->flush; } sub Warn($) { print "WARNING: ", @_; + STDOUT->flush; } sub Fail($) { @@ -105,16 +109,22 @@ sub TestBool($$$) { Log ((Get($var) ? "yes" : "no") . " (set)\n"); } else { my ($val, $comment) = &$sub(); - Set($var, $val); + if ($val) { + Set($var); + } else { + UnSet($var); + } Log (($val ? "yes" : "no") . "\n"); } } sub TryFindFile($) { my ($f) = @_; - if (-f $f) { - return $f; - } elsif ($f !~ /^\// && -f (Get("SRCDIR")."/$f")) { + if ($f =~ m{^/}) { + return (-f $f) ? $f : undef; + } elsif (-f $f) { + return "./$f"; + } elsif (-f (Get("SRCDIR")."/$f")) { return Get("SRCDIR")."/$f"; } else { return undef;