2001-10-08 16:25:44 +08:00
|
|
|
#! @PERL@ -w
|
|
|
|
# -*- perl -*-
|
|
|
|
# @configure_input@
|
|
|
|
|
|
|
|
eval 'exec @PERL@ -S $0 ${1+"$@"}'
|
|
|
|
if 0;
|
|
|
|
|
|
|
|
# autoreconf - install the GNU Build System in a directory tree
|
* configure.ac: Also find tested executables in bin.
* bin/autoconf.in, bin/autoheader.in, bin/autoreconf.in,
* bin/autoscan.in, autoupdate.in: Use exclusively the name of the
installed peer executables, only PATH is allowed to resolve it.
Pass `autoconf_dir' via options, not via invisible envvars.
* lib/Autom4te/General.pm (&find_peer): Remove.
* lib/autotest/general.m4 (AT_INIT): `AUTOTEST_PATH=a:b' gives
`abuild:asrc:bbuild:bsrc', not `abuild:bbuild:asrc:bsrc'.
* man/Makefile.am: Let help2man rely on PATH instead of trying to
find the executables for it.
* tests/Makefile.am: Major cleanup. Too lazy to document...
* tests/atlocal.in: Remove all the obscure envvar manipulations.
We only need PERL.
* tests/atspecific.m4, tests/tools.at: Passing --localdir is
indeed related to running the test suite, while passing
--autoconf-dir and others is related to running non installed
Autoconf executables. So don't do that, leave it to...
* tests/autoconf, tests/autoheader, tests/autom4te, tests/autoupdate,
* tests/autoscan: New.
* tests/atspecific.m4 (AT_CHECK_M4SUGAR, AT_CHECK_M4SH): Don't
refer to library files: rely on --language.
2001-08-31 21:30:11 +08:00
|
|
|
# Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
|
1994-04-30 09:42:39 +08:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
1996-06-13 01:55:25 +08:00
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
# 02111-1307, USA.
|
1994-04-30 09:42:39 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
# Written by David J. MacKenzie.
|
|
|
|
# Extended and rewritten in Perl by Akim Demaille.
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
{
|
|
|
|
my $perllibdir = $ENV{'autom4te_perllibdir'} || '@datadir@';
|
|
|
|
unshift @INC, "$perllibdir";
|
|
|
|
}
|
2000-02-08 19:39:46 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
use Autom4te::General;
|
|
|
|
use Autom4te::XFile;
|
|
|
|
use File::Find;
|
|
|
|
use strict;
|
1999-01-08 11:38:59 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
## ----------- ##
|
|
|
|
## Variables. ##
|
|
|
|
## ----------- ##
|
|
|
|
|
|
|
|
# $HELP
|
|
|
|
# -----
|
|
|
|
$help = "Usage: $0 [OPTION] ... [TEMPLATE-FILE]
|
|
|
|
|
2001-10-08 16:27:15 +08:00
|
|
|
Run `autoconf' (and `autoheader', `aclocal', `automake', `gettextize',
|
|
|
|
and `libtoolize' where appropriate) repeatedly to remake the GNU Build
|
2001-10-08 16:26:58 +08:00
|
|
|
System files in the directory tree rooted at the current directory.
|
|
|
|
By default, it only remakes those files that are older than their
|
2001-10-08 16:27:15 +08:00
|
|
|
predecessors. If you install new versions of the GNU Build System,
|
|
|
|
running `autoreconf' remakes all of the files by giving it the
|
|
|
|
`--force' option.
|
1999-01-08 11:38:59 +08:00
|
|
|
|
2000-07-10 18:18:57 +08:00
|
|
|
Operation modes:
|
|
|
|
-h, --help print this help, then exit
|
|
|
|
-V, --version print version number, then exit
|
|
|
|
-v, --verbose verbosely report processing
|
|
|
|
-d, --debug don't remove temporary files
|
2001-09-20 22:55:49 +08:00
|
|
|
-f, --force consider all files obsolete
|
2000-07-10 18:22:06 +08:00
|
|
|
-i, --install copy missing auxiliary files
|
2000-07-19 17:04:26 +08:00
|
|
|
-s, --symlink instead of copying, install symbolic links
|
2000-07-10 18:22:06 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
The option `--install' is similar to the option `--add-missing' in
|
2000-07-10 18:22:06 +08:00
|
|
|
other tools.
|
2000-07-10 18:18:57 +08:00
|
|
|
|
|
|
|
Library directories:
|
2001-10-20 14:51:41 +08:00
|
|
|
-I, --include=DIR look for FILES in DIR (cumulative)
|
|
|
|
-M, --m4dir=M4DIR this package's Autoconf extensions
|
2000-07-10 18:18:57 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
Unless specified, heuristics try to compute `M4DIR' from the `Makefile.am',
|
|
|
|
or defaults to `m4' if it exists.
|
2000-06-26 18:51:17 +08:00
|
|
|
|
2001-10-08 16:27:15 +08:00
|
|
|
The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
|
|
|
|
GETTEXTIZE, LIBTOOLIZE are honored.
|
1999-01-08 11:38:59 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
Report bugs to <bug-autoconf\@gnu.org>.
|
|
|
|
";
|
1994-09-16 02:34:35 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
# $VERSION
|
|
|
|
# --------
|
|
|
|
$version = "autoreconf (@PACKAGE_NAME@) @VERSION@
|
|
|
|
Written by David J. MacKenzie and Akim Demaille.
|
2000-01-10 18:11:57 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
|
2000-01-10 18:11:57 +08:00
|
|
|
This is free software; see the source for copying conditions. There is NO
|
2001-10-08 16:25:44 +08:00
|
|
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
";
|
|
|
|
|
|
|
|
# Lib files.
|
|
|
|
my $autoconf = $ENV{'AUTOCONF'} || '@autoconf-name@';
|
|
|
|
my $autoheader = $ENV{'AUTOHEADER'} || '@autoheader-name@';
|
|
|
|
my $automake = $ENV{'AUTOMAKE'} || 'automake';
|
|
|
|
my $aclocal = $ENV{'ACLOCAL'} || 'aclocal';
|
2001-10-08 16:27:15 +08:00
|
|
|
my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
|
|
|
|
my $gettextize = $ENV{'GETTEXTIZE'} || 'gettextize';
|
2001-10-08 16:25:44 +08:00
|
|
|
|
|
|
|
|
2000-07-10 18:22:06 +08:00
|
|
|
# --install -- as --add-missing in other tools.
|
2001-10-08 16:25:44 +08:00
|
|
|
my $install = 0;
|
2001-10-20 14:51:41 +08:00
|
|
|
my @include;
|
2000-07-10 18:18:57 +08:00
|
|
|
# m4dir -- local Autoconf extensions. Typically `m4'.
|
2001-10-08 16:25:44 +08:00
|
|
|
my $m4dir;
|
|
|
|
my $status = 0;
|
2000-07-10 18:22:06 +08:00
|
|
|
# symlink -- when --install, use symlinks instead.
|
2001-10-08 16:25:44 +08:00
|
|
|
my $symlink = 0;
|
2000-07-10 16:57:16 +08:00
|
|
|
|
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
## ---------- ##
|
|
|
|
## Routines. ##
|
|
|
|
## ---------- ##
|
2000-07-10 18:01:42 +08:00
|
|
|
|
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
# parse_args ()
|
|
|
|
# -------------
|
|
|
|
# Process any command line arguments.
|
|
|
|
sub parse_args ()
|
|
|
|
{
|
|
|
|
my $srcdir;
|
|
|
|
|
2001-10-20 14:51:41 +08:00
|
|
|
getopt ('I|include|A|autoconf-dir|m|macrodir|l|localdir=s' => \@include,
|
|
|
|
'M|m4dir=s' => \$m4dir,
|
|
|
|
'i|install' => \$install,
|
|
|
|
's|symlink' => \$symlink);
|
2001-10-08 16:25:44 +08:00
|
|
|
|
|
|
|
die "$me: too many arguments\n"
|
|
|
|
if @ARGV;
|
|
|
|
|
|
|
|
if ($verbose && $debug)
|
|
|
|
{
|
|
|
|
xsystem ("$autoconf --version | sed 1q >&2");
|
|
|
|
print STDERR "\n";
|
|
|
|
xsystem ("$autoheader --version | sed 1q >&2");
|
|
|
|
print STDERR "\n";
|
|
|
|
xsystem ("$automake --version | sed 1q >&2");
|
|
|
|
print STDERR "\n";
|
|
|
|
xsystem ("$aclocal --version | sed 1q >&2");
|
|
|
|
print STDERR "\n";
|
2001-10-08 16:27:15 +08:00
|
|
|
xsystem ("$gettextize --version | sed 1q >&2");
|
|
|
|
print STDERR "\n";
|
|
|
|
xsystem ("$libtoolize --version | sed 1q >&2");
|
|
|
|
print STDERR "\n";
|
2001-10-08 16:25:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Dispatch autoreconf's option to the tools.
|
2001-10-20 14:51:41 +08:00
|
|
|
# --include;
|
|
|
|
$autoconf .= join (' ', map { "--include=$_" } @include);
|
|
|
|
$autoheader .= join (' ', map { "--include=$_" } @include);
|
|
|
|
|
2001-10-08 17:40:33 +08:00
|
|
|
# --install and --symlink;
|
|
|
|
if ($install)
|
|
|
|
{
|
2001-10-20 14:51:41 +08:00
|
|
|
$automake .= ' --add-missing';
|
|
|
|
$automake .= ' --copy' unless $symlink;
|
|
|
|
$gettextize .= ' --copy' unless $symlink;
|
|
|
|
$libtoolize .= ' --copy' unless $symlink;
|
2001-10-08 17:40:33 +08:00
|
|
|
}
|
2001-10-08 16:25:44 +08:00
|
|
|
# --force;
|
|
|
|
if ($force)
|
|
|
|
{
|
|
|
|
$autoconf .= ' --force';
|
|
|
|
$autoheader .= ' --force';
|
2001-10-08 17:40:33 +08:00
|
|
|
$automake .= ' --force-missing';
|
2001-10-08 16:26:58 +08:00
|
|
|
$gettextize .= ' --force';
|
2001-10-08 16:27:15 +08:00
|
|
|
$libtoolize .= ' --force';
|
2001-10-08 16:25:44 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$automake .= ' --no-force';
|
|
|
|
}
|
|
|
|
# --debug;
|
|
|
|
if ($debug)
|
|
|
|
{
|
2001-10-08 17:40:33 +08:00
|
|
|
$autoconf .= ' --verbose --debug';
|
|
|
|
$autoheader .= ' --verbose --debug';
|
2001-10-08 16:26:58 +08:00
|
|
|
$automake .= ' --verbose';
|
2001-10-08 17:40:33 +08:00
|
|
|
$aclocal .= ' --verbose';
|
2001-10-08 16:27:15 +08:00
|
|
|
$libtoolize .= ' --debug';
|
2001-10-08 16:25:44 +08:00
|
|
|
}
|
|
|
|
}
|
2000-07-10 18:01:42 +08:00
|
|
|
|
1994-09-16 02:34:35 +08:00
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
# &autoreconf ()
|
|
|
|
# --------------
|
|
|
|
# Reconf the current directory.
|
|
|
|
sub autoreconf ()
|
|
|
|
{
|
|
|
|
# If there it's not `configure.ac' or `configure.in', we are not
|
|
|
|
# interested in the directory.
|
|
|
|
return
|
|
|
|
if !/^configure\.(ac|in)$/;
|
|
|
|
|
|
|
|
my $configure_ac = $_;
|
2001-10-19 22:26:45 +08:00
|
|
|
verbose "working on $File::Find::dir/$configure_ac";
|
2001-10-08 16:25:44 +08:00
|
|
|
|
|
|
|
# If there is no AC_INIT, then we are not interested: it looks like
|
|
|
|
# a Cygnus thingy.
|
|
|
|
my $configure_ac_file = new Autom4te::XFile $configure_ac;
|
2001-10-08 16:26:58 +08:00
|
|
|
my $uses_autoconf;
|
2001-10-08 16:25:44 +08:00
|
|
|
while ($_ = $configure_ac_file->getline)
|
|
|
|
{
|
2001-10-08 16:26:58 +08:00
|
|
|
$uses_autoconf = 1
|
2001-10-08 16:25:44 +08:00
|
|
|
if /AC_INIT/;
|
|
|
|
}
|
2001-10-08 16:26:58 +08:00
|
|
|
if (!$uses_autoconf)
|
2001-10-08 16:25:44 +08:00
|
|
|
{
|
2001-10-08 16:27:15 +08:00
|
|
|
verbose "$configure_ac: not using Autoconf";
|
2001-10-08 16:25:44 +08:00
|
|
|
return;
|
|
|
|
}
|
2000-07-10 16:57:16 +08:00
|
|
|
|
2001-10-08 16:27:15 +08:00
|
|
|
|
2001-10-08 16:26:58 +08:00
|
|
|
# -------------------- #
|
|
|
|
# Running gettexitze. #
|
|
|
|
# -------------------- #
|
|
|
|
|
|
|
|
my $uses_gettext = 0;
|
|
|
|
my $traces = new Autom4te::XFile "$autoconf --trace=AM_GNU_GETTEXT |";
|
|
|
|
while ($_ = $traces->getline)
|
|
|
|
{
|
|
|
|
$uses_gettext = 1
|
|
|
|
if /AM_GNU_GETTEXT/;
|
|
|
|
}
|
|
|
|
if (!$uses_gettext)
|
|
|
|
{
|
2001-10-08 16:27:15 +08:00
|
|
|
verbose "$configure_ac: not using Gettext";
|
2001-10-08 16:26:58 +08:00
|
|
|
}
|
2001-10-20 14:51:41 +08:00
|
|
|
elsif (-d 'intl')
|
|
|
|
{
|
|
|
|
verbose "$configure_ac: not running gettextize: `intl' is already present";
|
|
|
|
}
|
2001-10-08 16:26:58 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
xsystem ($gettextize);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-08 16:27:15 +08:00
|
|
|
# -------------------- #
|
|
|
|
# Running libtoolize. #
|
|
|
|
# -------------------- #
|
|
|
|
|
|
|
|
my $uses_libtool = 0;
|
2001-10-08 17:40:33 +08:00
|
|
|
$traces = new Autom4te::XFile "$autoconf --trace=AM_PROG_LIBTOOL |";
|
2001-10-08 16:27:15 +08:00
|
|
|
while ($_ = $traces->getline)
|
|
|
|
{
|
|
|
|
$uses_libtool = 1
|
|
|
|
if /AM_PROG_LIBTOOL/;
|
|
|
|
}
|
|
|
|
if (!$uses_libtool)
|
|
|
|
{
|
|
|
|
verbose "$configure_ac: not using Libtool";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xsystem ($libtoolize);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-10 16:57:16 +08:00
|
|
|
# ----------------- #
|
|
|
|
# Running aclocal. #
|
|
|
|
# ----------------- #
|
|
|
|
|
2001-10-20 14:51:41 +08:00
|
|
|
if (-f 'aclocal.m4' &&
|
|
|
|
!up_to_date_p ('aclocal.m4', 'acinclude.m4'))
|
2001-10-08 16:25:44 +08:00
|
|
|
{
|
|
|
|
# If there are flags for aclocal in Makefile.am, use them.
|
|
|
|
my $aclocal_flags;
|
2001-10-20 14:51:41 +08:00
|
|
|
if (-f 'Makefile.am')
|
2001-10-08 16:25:44 +08:00
|
|
|
{
|
2001-10-20 14:51:41 +08:00
|
|
|
my $aclocal_m4 = new Autom4te::XFile 'Makefile.am';
|
2001-10-08 16:25:44 +08:00
|
|
|
while ($_ = $aclocal_m4->getline)
|
|
|
|
{
|
|
|
|
if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)
|
|
|
|
{
|
|
|
|
$aclocal_flags = $1;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# If m4dir is not specified and these flags do not specify the
|
|
|
|
# location of the local Autoconf extensions, default to `m4'.
|
|
|
|
if (!$aclocal_flags)
|
|
|
|
{
|
|
|
|
$aclocal_flags = '-I ' . ($m4dir || 'm4');
|
|
|
|
}
|
|
|
|
xsystem ("$aclocal $aclocal_flags")
|
|
|
|
}
|
|
|
|
|
1998-10-29 08:53:33 +08:00
|
|
|
|
2000-07-10 16:57:16 +08:00
|
|
|
|
|
|
|
# ------------------ #
|
|
|
|
# Running automake. #
|
|
|
|
# ------------------ #
|
|
|
|
|
|
|
|
# Assumes that there is a Makefile.am in the topmost directory.
|
2001-10-08 16:27:15 +08:00
|
|
|
if (!-f 'Makefile.am')
|
|
|
|
{
|
|
|
|
verbose "$configure_ac: not using Automake";
|
|
|
|
}
|
|
|
|
else
|
2001-10-08 16:25:44 +08:00
|
|
|
{
|
|
|
|
# We should always run automake, and let it decide whether it shall
|
|
|
|
# update the file or not. In fact, the effect of `$force' is already
|
|
|
|
# included in `$automake' via `--no-force'.
|
|
|
|
xsystem ($automake);
|
|
|
|
}
|
1998-10-29 08:53:33 +08:00
|
|
|
|
2000-07-10 16:57:16 +08:00
|
|
|
|
|
|
|
# ------------------ #
|
|
|
|
# Running autoconf. #
|
|
|
|
# ------------------ #
|
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
# Don't try to be smarter than `autoconf', which does its own
|
|
|
|
# up to date checkings.
|
|
|
|
xsystem ($autoconf);
|
1994-09-16 02:34:35 +08:00
|
|
|
|
2000-07-10 16:57:16 +08:00
|
|
|
|
|
|
|
# -------------------- #
|
|
|
|
# Running autoheader. #
|
|
|
|
# -------------------- #
|
|
|
|
|
2001-10-08 16:25:44 +08:00
|
|
|
# We now consider that if AC_CONFIG_HEADERS is used, then autoheader
|
|
|
|
# is used too.
|
|
|
|
# Just as for autoconf, up to date ness is performed by the tool itself.
|
2001-10-08 16:26:58 +08:00
|
|
|
my $uses_autoheader = 0;
|
2001-10-08 17:40:33 +08:00
|
|
|
$traces = new Autom4te::XFile "$autoconf --trace=AC_CONFIG_HEADERS |";
|
2001-10-08 16:25:44 +08:00
|
|
|
while ($_ = $traces->getline)
|
|
|
|
{
|
2001-10-08 16:26:58 +08:00
|
|
|
$uses_autoheader = 1
|
2001-10-08 16:25:44 +08:00
|
|
|
if /AC_CONFIG_HEADERS/;
|
|
|
|
}
|
2001-10-08 16:26:58 +08:00
|
|
|
if (!$uses_autoheader)
|
2001-10-08 16:25:44 +08:00
|
|
|
{
|
2001-10-08 16:27:15 +08:00
|
|
|
verbose "$configure_ac: not using Autoheader";
|
2001-10-08 16:25:44 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xsystem ($autoheader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
## ------ ##
|
|
|
|
## Main. ##
|
|
|
|
## ------ ##
|
|
|
|
|
|
|
|
# When debugging, it is convenient that all the related temporary
|
|
|
|
# files be at the same place.
|
|
|
|
mktmpdir ('ah');
|
|
|
|
$ENV{'TMPDIR'} = $tmp;
|
|
|
|
parse_args;
|
2001-10-20 14:51:41 +08:00
|
|
|
find (\&maybe_autoreconf, '.');
|