Stylize consistently, add more Emacs mode goodness

This commit is contained in:
Tor Lillqvist 2011-05-31 10:00:39 +03:00
parent 90a9bed187
commit 471fd2e4e8

View File

@ -16,30 +16,28 @@ sub sanity_checks($)
{ {
my $system = shift; my $system = shift;
my @path = split (':', $ENV{'PATH'}); my @path = split (':', $ENV{'PATH'});
my %required = ( my %required =
'pkg-config' => "pkg-config is required to be installed", (
'autoconf' => "autoconf is required", 'pkg-config' => "pkg-config is required to be installed",
'aclocal' => "aclocal is required", 'autoconf' => "autoconf is required",
# 'knurdle' => 'please knurdle me test' 'aclocal' => "aclocal is required",
); );
my $exe_ext = ''; my $exe_ext = '';
$exe_ext = ".exe" if ($system =~ m/CYGWIN/); $exe_ext = ".exe" if ($system =~ m/CYGWIN/);
for my $elem (@path) { for my $elem (@path) {
# print "check $elem\n"; for my $app (keys %required) {
for my $app (keys %required) { if (-f "$elem/$app$exe_ext") {
if (-f "$elem/$app$exe_ext") { delete $required{$app};
# print "removing $app - found in $elem/$app\n"; }
delete $required{$app};
} }
} }
}
if ((keys %required) > 0) { if ((keys %required) > 0) {
print ("Various low-level dependencies are missing, please install them:\n"); print ("Various low-level dependencies are missing, please install them:\n");
for my $app (keys %required) { for my $app (keys %required) {
print "\t $app$exe_ext: " . $required{$app} . "\n"; print "\t $app$exe_ext: " . $required{$app} . "\n";
} }
exit (1); exit (1);
} }
} }
@ -51,25 +49,24 @@ sub read_args($)
my @lst; my @lst;
open ($fh, $file) || die "can't open file: $file"; open ($fh, $file) || die "can't open file: $file";
while (<$fh>) { while (<$fh>) {
chomp(); chomp();
# migrate from the old system # migrate from the old system
if ( substr($_, 0, 1) eq "'" ) { if ( substr($_, 0, 1) eq "'" ) {
print "Migrating options from the old autogen.lastrun format, using:\n"; print "Migrating options from the old autogen.lastrun format, using:\n";
my @opts; my @opts;
@opts = split(/'/); @opts = split(/'/);
foreach my $opt (@opts) { foreach my $opt (@opts) {
if ( substr($opt, 0, 1) eq "-" ) { if ( substr($opt, 0, 1) eq "-" ) {
push @lst, $opt; push @lst, $opt;
print " $opt\n"; print " $opt\n";
}
}
} else {
push @lst, $_;
} }
}
}
else {
push @lst, $_;
}
} }
close ($fh); close ($fh);
# print "read args from file '$file': @lst\n"; # print "read args from file '$file': @lst\n";
return @lst; return @lst;
} }
@ -81,8 +78,8 @@ sub invalid_distro($$)
my $dirh; my $dirh;
opendir ($dirh, "distro-configs"); opendir ($dirh, "distro-configs");
while (($_ = readdir ($dirh))) { while (($_ = readdir ($dirh))) {
/(.*)\.conf$/ || next; /(.*)\.conf$/ || next;
print STDERR "\t$1\n"; print STDERR "\t$1\n";
} }
closedir ($dirh); closedir ($dirh);
} }
@ -98,16 +95,16 @@ if (!@ARGV) {
my @args; my @args;
for my $arg (@cmdline_args) { for my $arg (@cmdline_args) {
if ($arg eq '--clean') { if ($arg eq '--clean') {
clean(); clean();
} elsif ($arg =~ m/--with-distro=(.*)$/) { } elsif ($arg =~ m/--with-distro=(.*)$/) {
my $config = "distro-configs/$1.conf"; my $config = "distro-configs/$1.conf";
if (! -f $config) { if (! -f $config) {
invalid_distro ($config, $1); invalid_distro ($config, $1);
} else {
push @args, read_args ($config);
}
} else { } else {
push @args, read_args ($config); push @args, $arg;
}
} else {
push @args, $arg;
} }
} }
@ -149,6 +146,8 @@ if (defined $ENV{NOCONFIGURE}) {
} }
# Local Variables: # Local Variables:
# mode: perl
# cperl-indent-level: 4
# tab-width: 4 # tab-width: 4
# indent-tabs-mode: nil # indent-tabs-mode: nil
# End: # End: