]> mj.ucw.cz Git - libucw.git/blobdiff - lib/perl/Configure.pm
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git#v3.11
[libucw.git] / lib / perl / Configure.pm
index ee1c83df114397bd71a3a54ac464296d6e4640dd..bd1a7cc53f94ad5297beb1b9cd39c07441866d29 100644 (file)
@@ -16,7 +16,7 @@ BEGIN {
        our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
        $VERSION = 1.0;
        @ISA = qw(Exporter);
-       @EXPORT = qw(&Init &Log &Notice &Fail &IsSet &Set &UnSet &Append &Override &Get &Test &Include &Finish &FindFile &TryFindFile);
+       @EXPORT = qw(&Init &Log &Notice &Warn &Fail &IsSet &Set &UnSet &Append &Override &Get &Test &Include &Finish &FindFile &TryFindFile);
        @EXPORT_OK = qw();
        %EXPORT_TAGS = ();
 }
@@ -32,8 +32,12 @@ sub Notice($) {
        print @_ if $vars{"VERBOSE"};
 }
 
+sub Warn($) {
+       print "WARNING: ", @_;
+}
+
 sub Fail($) {
-       Log((shift @_) . "\n");
+       Log("ERROR: " . (shift @_) . "\n");
        exit 1;
 }
 
@@ -115,12 +119,12 @@ sub Init($$) {
                if ($x =~ /^(\w+)=(.*)/) {
                        Override($1 => $2);
                } elsif ($x =~ /^-(\w+)$/) {
-                       Override($1 => 1);
+                       Override($1 => 0);
                        delete $vars{$1};
                } elsif ($x =~ /^(\w+)$/) {
                        Override($1 => 1);
                } else {
-                       print STDERR "Invalid option $_\n";
+                       print STDERR "Invalid option $x\n";
                        exit 1;
                }
        }
@@ -158,7 +162,7 @@ sub Finish() {
        Log "done\n";
 
        Log "Generating autoconf.h ... ";
-       open X, ">obj/lib/autoconf.h" or Fail $!;
+       open X, ">obj/autoconf.h" or Fail $!;
        print X "/* Generated automatically by $0, please don't touch manually. */\n";
        foreach my $x (sort keys %vars) {
                # Don't export variables which contain no underscores
@@ -177,6 +181,8 @@ sub Finish() {
        foreach my $x (sort keys %vars) {
                print X "$x=$vars{$x}\n";
        }
+       print X "s=\${SRCDIR}\n";
+       print X "o=obj\n";
        close X;
        Log "done\n";
 }