123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717 |
- eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
- if 0;
- BEGIN
- {
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
- unshift @INC, $pkgdatadir;
-
-
-
-
- $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
- }
- use Autom4te::ChannelDefs;
- use Autom4te::Channels;
- use Autom4te::Configure_ac;
- use Autom4te::FileUtils;
- use Autom4te::General;
- use Autom4te::XFile;
- use Cwd 'cwd';
- use strict;
- $help = "Usage: $0 [OPTION]... [DIRECTORY]...
- Run `autoconf' (and `autoheader', `aclocal', `automake', `autopoint'
- (formerly `gettextize'), and `libtoolize' where appropriate)
- repeatedly to remake the GNU Build System files in specified
- DIRECTORIES and their subdirectories (defaulting to `.').
- By default, it only remakes those files that are older than their
- sources. If you install new versions of the GNU Build System,
- you can make `autoreconf' remake all of the files by giving it the
- `--force' option.
- 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
- -f, --force consider all files obsolete
- -i, --install copy missing auxiliary files
- --no-recursive don't rebuild sub-packages
- -s, --symlink with -i, install symbolic links instead of copies
- -m, --make when applicable, re-run ./configure && make
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
- " . Autom4te::ChannelDefs::usage . "
- The environment variable \`WARNINGS\' is honored. Some subtools might
- support other warning types, using \`all' is encouraged.
- Library directories:
- -B, --prepend-include=DIR prepend directory DIR to search path
- -I, --include=DIR append directory DIR to search path
- The environment variables AUTOM4TE, AUTOCONF, AUTOHEADER, AUTOMAKE,
- ACLOCAL, AUTOPOINT, LIBTOOLIZE, M4, and MAKE are honored.
- Report bugs to <bug-autoconf\@gnu.org>.
- GNU Autoconf home page: <http://www.gnu.org/software/autoconf/>.
- General help using GNU software: <http://www.gnu.org/gethelp/>.
- ";
- $version = "autoreconf (@PACKAGE_NAME@) @VERSION@
- Copyright (C) @RELEASE_YEAR@ Free Software Foundation, Inc.
- License GPLv3+/Autoconf: GNU GPL version 3 or later
- <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
- Written by David J. MacKenzie and Akim Demaille.
- ";
- my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@';
- my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@';
- my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
- my $automake = $ENV{'AUTOMAKE'} || 'automake';
- my $aclocal = $ENV{'ACLOCAL'} || 'aclocal';
- my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
- my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint';
- my $make = $ENV{'MAKE'} || 'make';
- my $install = 0;
- my $symlink = 0;
- my $aclocal_supports_force = 0;
- my $aclocal_supports_warnings = 0;
- my $automake_supports_force_missing = 0;
- my $automake_supports_warnings = 0;
- my @prepend_include;
- my @include;
- my @warning;
- my $run_make = 0;
- my $recursive = 1;
- sub parse_args ()
- {
- my $srcdir;
- getopt ("W|warnings=s" => \@warning,
- 'I|include=s' => \@include,
- 'B|prepend-include=s' => \@prepend_include,
- 'i|install' => \$install,
- 's|symlink' => \$symlink,
- 'm|make' => \$run_make,
- 'recursive!' => \$recursive);
-
-
- @warning = map { split /,/ } @warning;
- parse_WARNINGS;
- parse_warnings '--warnings', @warning;
-
-
-
-
- @ARGV = map { /configure\.(ac|in)$/ ? dirname ($_) : $_ } @ARGV;
- push @ARGV, '.' unless @ARGV;
- if ($verbose && $debug)
- {
- for my $prog ($autoconf, $autoheader,
- $automake, $aclocal,
- $autopoint,
- $libtoolize)
- {
- xsystem ("$prog --version | sed 1q >&2");
- print STDERR "\n";
- }
- }
- my $aclocal_help = `$aclocal --help 2>/dev/null`;
- my $automake_help = `$automake --help 2>/dev/null`;
- $aclocal_supports_force = $aclocal_help =~ /--force/;
- $aclocal_supports_warnings = $aclocal_help =~ /--warnings/;
- $automake_supports_force_missing = $automake_help =~ /--force-missing/;
- $automake_supports_warnings = $automake_help =~ /--warnings/;
-
-
- $aclocal .= join (' -I ', '', map { shell_quote ($_) } @include);
- $autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
- $autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
- $autoheader .= join (' --include=', '', map { shell_quote ($_) } @include);
- $autoheader .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
-
- if ($install)
- {
- $automake .= ' --add-missing';
- $automake .= ' --copy' unless $symlink;
- $libtoolize .= ' --copy' unless $symlink;
- }
-
- if ($force)
- {
- $aclocal .= ' --force'
- if $aclocal_supports_force;
- $autoconf .= ' --force';
- $autoheader .= ' --force';
- $automake .= ' --force-missing'
- if $automake_supports_force_missing;
- $autopoint .= ' --force';
- $libtoolize .= ' --force';
- }
- else
- {
-
-
-
-
- $automake .= ' --no-force'
- if $aclocal_supports_force;
- }
-
- if ($verbose > 1 || $debug)
- {
- $autoconf .= ' --verbose';
- $autoheader .= ' --verbose';
- $automake .= ' --verbose';
- $aclocal .= ' --verbose';
- }
- if ($debug)
- {
- $autoconf .= ' --debug';
- $autoheader .= ' --debug';
- $libtoolize .= ' --debug';
- }
-
- if (@warning)
- {
- my $warn = ' --warnings=' . join (',', @warning);
- $autoconf .= $warn;
- $autoheader .= $warn;
- $automake .= $warn
- if $automake_supports_warnings;
- $aclocal .= $warn
- if $aclocal_supports_warnings;
- }
- }
- sub run_aclocal ($$)
- {
- my ($aclocal, $flags) = @_;
-
-
- if ($aclocal_supports_force)
- {
- xsystem ("$aclocal $flags");
- }
- else
- {
- xsystem ("$aclocal $flags --output=aclocal.m4t");
-
- if (-f 'aclocal.m4t')
- {
- update_file ('aclocal.m4t', 'aclocal.m4');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- my $aclocal_local_dir = '.';
- if ($flags =~ /-I\s+(\S+)/)
- {
- $aclocal_local_dir = $1;
- }
-
-
- my $aclocal_m4_mtime = mtime ('aclocal.m4');
- for my $file (glob ("$aclocal_local_dir/*.m4"), 'acinclude.m4')
- {
- if ($aclocal_m4_mtime < mtime ($file))
- {
- debug "aging $file to be not newer than aclocal.m4";
- utime $aclocal_m4_mtime, $aclocal_m4_mtime, $file;
- }
- }
- }
- }
- }
- sub autoreconf_current_directory ()
- {
- my $configure_ac = find_configure_ac;
-
-
-
- my $uses_autoconf;
- my $uses_gettext;
- if (-f $configure_ac)
- {
- my $configure_ac_file = new Autom4te::XFile "< $configure_ac";
- while ($_ = $configure_ac_file->getline)
- {
- s/#.*//;
- s/dnl.*//;
- $uses_autoconf = 1 if /AC_INIT/;
-
- $uses_gettext = 1 if /^AM_GNU_GETTEXT_VERSION/;
- }
- }
- if (!$uses_autoconf)
- {
- verb "$configure_ac: not using Autoconf";
- return;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (!$uses_gettext)
- {
- verb "$configure_ac: not using Gettext";
- }
- elsif (!$install)
- {
- verb "$configure_ac: not running autopoint: --install not given";
- }
- else
- {
- xsystem_hint ("autopoint is needed because this package uses Gettext", "$autopoint");
- }
-
-
-
-
-
-
-
-
-
-
- my $uses_aclocal = 1;
-
-
- if (-f 'aclocal.m4')
- {
- my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4';
- $_ = $aclocal_m4->getline;
- $uses_aclocal = 0
- unless defined ($_) && /generated.*by aclocal/;
- }
-
- my $aclocal_flags = '';
- if ($uses_aclocal && -f 'Makefile.am')
- {
- my $makefile = new Autom4te::XFile 'Makefile.am';
- while ($_ = $makefile->getline)
- {
- if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)
- {
- $aclocal_flags = $1;
- last;
- }
- }
- }
- if (!$uses_aclocal)
- {
- verb "$configure_ac: not using aclocal";
- }
- else
- {
-
-
-
-
-
-
-
-
- sleep 1;
- run_aclocal ($aclocal, $aclocal_flags);
- }
-
-
- my $rerun_aclocal = 0;
-
-
-
-
-
-
- my $aux_dir;
- my $uses_gettext_via_traces;
- my $uses_libtool;
- my $uses_libltdl;
- my $uses_autoheader;
- my $uses_automake;
- my @subdir;
- verb "$configure_ac: tracing";
- my $traces = new Autom4te::XFile
- ("$autoconf"
- . join (' ',
- map { ' --trace=' . $_ . ':\$n::\${::}%' }
-
-
- 'AC_CONFIG_AUX_DIR',
- 'AC_CONFIG_HEADERS',
- 'AC_CONFIG_SUBDIRS',
- 'AC_INIT',
- 'AC_PROG_LIBTOOL',
- 'LT_INIT',
- 'LT_CONFIG_LTDL_DIR',
- 'AM_GNU_GETTEXT',
- 'AM_INIT_AUTOMAKE',
- )
- . ' |');
- while ($_ = $traces->getline)
- {
- chomp;
- my ($macro, @args) = split (/::/);
- $aux_dir = $args[0] if $macro eq "AC_CONFIG_AUX_DIR";
- $uses_autoconf = 1 if $macro eq "AC_INIT";
- $uses_gettext_via_traces = 1 if $macro eq "AM_GNU_GETTEXT";
- $uses_libtool = 1 if $macro eq "AC_PROG_LIBTOOL"
- || $macro eq "LT_INIT";
- $uses_libltdl = 1 if $macro eq "LT_CONFIG_LTDL_DIR";
- $uses_autoheader = 1 if $macro eq "AC_CONFIG_HEADERS";
- $uses_automake = 1 if $macro eq "AM_INIT_AUTOMAKE";
- push @subdir, split (' ', $args[0])
- if $macro eq "AC_CONFIG_SUBDIRS" && $recursive;
- }
-
- foreach (@subdir)
- {
- if (-d)
- {
- verb "$configure_ac: adding subdirectory $_ to autoreconf";
- autoreconf ($_);
- }
- else
- {
- verb "$configure_ac: subdirectory $_ not present";
- }
- }
-
- error "$configure_ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION"
- if $uses_gettext_via_traces && ! $uses_gettext;
- error "$configure_ac: AM_GNU_GETTEXT_VERSION is used, but not AM_GNU_GETTEXT"
- if $uses_gettext && ! $uses_gettext_via_traces;
-
-
-
-
-
-
-
-
- if (defined $aux_dir && ! -d $aux_dir)
- {
- verb "$configure_ac: creating directory $aux_dir";
- mkdir $aux_dir, 0755
- or error "cannot create $aux_dir: $!";
- }
-
-
-
- if (!$uses_libtool)
- {
- verb "$configure_ac: not using Libtool";
- }
- elsif ($install)
- {
- if ($uses_libltdl)
- {
- $libtoolize .= " --ltdl";
- }
- xsystem_hint ("libtoolize is needed because this package uses Libtool", $libtoolize);
- $rerun_aclocal = 1;
- }
- else
- {
- verb "$configure_ac: not running libtoolize: --install not given";
- }
-
-
-
-
-
- if ($rerun_aclocal)
- {
- if (!$uses_aclocal)
- {
- verb "$configure_ac: not using aclocal";
- }
- else
- {
- run_aclocal ($aclocal, $aclocal_flags);
- }
- }
-
-
-
-
-
-
-
-
-
-
- xsystem ($autoconf);
-
-
-
-
-
-
-
-
-
-
-
- if (!$uses_autoheader)
- {
- verb "$configure_ac: not using Autoheader";
- }
- else
- {
- xsystem ($autoheader);
- }
-
-
-
- if (!$uses_automake)
- {
- verb "$configure_ac: not using Automake";
- }
- else
- {
-
-
-
- xsystem ($automake);
- }
-
-
-
- if ($run_make)
- {
- if (!-f "config.status")
- {
- verb "no config.status: cannot re-make";
- }
- else
- {
- xsystem ("./config.status --recheck");
- xsystem ("./config.status");
- if (!-f "Makefile")
- {
- verb "no Makefile: cannot re-make";
- }
- else
- {
- xsystem ("$make");
- }
- }
- }
- }
- sub autoreconf ($)
- {
- my ($directory) = @_;
- my $cwd = cwd;
-
-
- verb "Entering directory `$directory'";
- chdir $directory
- or error "cannot chdir to $directory: $!";
- autoreconf_current_directory;
-
-
- verb "Leaving directory `$directory'";
- chdir $cwd
- or error "cannot chdir to $cwd: $!";
- }
- mktmpdir ('ar');
- $ENV{'TMPDIR'} = $tmp;
- parse_args;
- $ENV{'AUTOM4TE'} = $autom4te;
- for my $directory (@ARGV)
- {
- require_configure_ac ($directory);
- autoreconf ($directory);
- }
|