2 eval 'exec perl -S $0 ${1+"$@"}'
9 system
("rm -Rf autom4te.cache");
10 system
("rm -f missing install-sh mkinstalldirs libtool ltmain.sh");
11 print
"cleaned the build tree\n";
16 # check we have various vital tools
20 my @path
= split (':', $ENV{'PATH'});
23 'pkg-config' => "pkg-config is required to be installed",
24 'autoconf' => "autoconf is required",
25 $aclocal => "$aclocal is required",
28 for my
$elem (@path
) {
29 for my
$app (keys
%required
) {
30 if (-f "$elem/$app") {
31 delete
$required{$app};
35 if ((keys
%required
) > 0) {
36 print
("Various low-level dependencies are missing, please install them:\n");
37 for my
$app (keys
%required
) {
38 print
"\t $app: " .
$required{$app} .
"\n";
44 # one argument per line
50 open
($fh, $file) || die
"can't open file: $file";
53 # migrate from the old system
54 if ( substr
($_, 0, 1) eq
"'" ) {
55 print
"Migrating options from the old autogen.lastrun format, using:\n";
58 foreach my $opt (@opts) {
59 if ( substr($opt, 0, 1) eq "-" ) {
64 } elsif ( substr($_, 0, 1) eq "#" ) {
71 # print "read args from file '$file': @lst\n";
75 sub invalid_distro($$)
77 my ($config, $distro) = @_;
78 print STDERR "Can't
find distro option
set: $config\nThis is not necessarily a problem.
\n";
79 print STDERR "Distros with distro option sets are
:\n";
81 opendir ($dirh, "distro-configs
");
82 while (($_ = readdir ($dirh))) {
83 /(.*)\.conf$/ || next;
84 print STDERR "\t$1\n";
89 my @cmdline_args = ();
91 my $lastrun = "autogen.lastrun
";
92 @cmdline_args = read_args ($lastrun) if (-f $lastrun);
94 @cmdline_args = @ARGV;
98 for my $arg (@cmdline_args) {
99 if ($arg eq '--clean') {
101 } elsif ($arg =~ m/--with-distro=(.*)$/) {
102 my $config = "distro-configs
/$1.conf
";
104 invalid_distro ($config, $1);
106 push @args, read_args ($config);
112 for my $arg (@args) {
113 if ($arg =~ /^([A-Z]+)=(.*)/) {
118 # Alloc $ACLOCAL to specify which aclocal to use
119 $aclocal = $ENV{ACLOCAL} ? $ENV{ACLOCAL} : 'aclocal';
121 my $system = `uname -s`;
124 sanity_checks ($system) unless($system eq 'Darwin');
126 my $aclocal_flags = $ENV{ACLOCAL_FLAGS};
128 $aclocal_flags = "-I .
/m
4/mac
" if (($aclocal_flags eq "") && ($system eq 'Darwin'));
130 $ENV{AUTOMAKE_EXTRA_FLAGS} = '--warnings=no-portability' if (!($system eq 'Darwin'));
132 system ("$aclocal $aclocal_flags") && die "Failed to run aclocal
";
133 unlink ("configure
");
134 system ("autoconf
") && die "Failed to run autoconf
";
135 die "failed to generate configure
" if (! -x "configure
");
137 if (defined $ENV{NOCONFIGURE}) {
138 print "Skipping configure process.
";
140 # Save autogen.lastrun only if we did get some arguments on the command-line
142 if (scalar(@cmdline_args) > 0) {
143 # print "writing args to autogen.lastrun
\n";
145 open ($fh, ">autogen.lastrun
") || die "can
't open autogen.lastrun: $!";
146 for my $arg (@cmdline_args) {
152 elsif ( ! -e "autogen.lastrun")
154 system("touch autogen.lastrun");
156 print "running ./configure with '" . join ("' '", @args), "'\n";
157 system ("./configure", @args) && die "Error running configure";
162 # cperl-indent-level: 4
164 # indent-tabs-mode: nil
167 # vim:set shiftwidth=4 softtabstop=4 expandtab: #