1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#!/usr/bin/env perl
#
# $Id: bootstrap.pl,v 1.2 2011/03/07 22:24:12 mjl Exp $
#
# script to ship scamper with generated configure script ready to build.
my @aclocal = ("aclocal", "aclocal-1.11", "aclocal-1.9");
my @libtoolize = ("libtoolize", "glibtoolize");
my @autoheader = ("autoheader", "autoheader-2.68", "autoheader259");
my @automake = ("automake", "automake-1.11");
my @autoconf = ("autoconf", "autoconf-2.68");
if(tryexec("", @aclocal) != 0)
{
print STDERR "could not exec aclocal\n";
exit -1;
}
if(tryexec("--force --copy", @libtoolize) != 0)
{
print STDERR "could not libtoolize\n";
exit -1;
}
if(tryexec("", @autoheader) != 0)
{
print STDERR "could not autoheader\n";
exit -1;
}
if(tryexec("--add-missing --copy --foreign", @automake) != 0)
{
print STDERR "could not automake\n";
exit -1;
}
if(tryexec("", @autoconf) != 0)
{
print STDERR "could not autoconf\n";
exit -1;
}
sub which($)
{
my ($bin) = @_;
my $rc = undef;
open(WHICH, "which $bin |") or die "could not which";
while(<WHICH>)
{
chomp;
$rc = $_;
last;
}
close WHICH;
return $rc;
}
sub tryexec
{
my $args = shift;
my $rc = -1;
foreach my $util (@_)
{
$util = which($util);
if(defined($util))
{
print "===> $util $args\n";
$rc = system("$util $args");
last;
}
}
return $rc;
}
|