📄 autoreconf.in
字号:
#! @PERL@ -w# -*- perl -*-# @configure_input@eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' if 0;# autoreconf - install the GNU Build System in a directory tree# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006# Free Software Foundation, Inc.# 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# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA# 02110-1301, USA.# Written by David J. MacKenzie.# Extended and rewritten in Perl by Akim Demaille.BEGIN{ my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@'; unshift @INC, $datadir; # Override SHELL. On DJGPP SHELL may not be set to a shell # that can handle redirection and quote arguments correctly, # e.g.: COMMAND.COM. For DJGPP always use the shell that configure # has detected. $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;# Do not use Cwd::chdir, since it might hang.use Cwd 'cwd';use strict;## ----------- #### Variables. #### ----------- ### $HELP# -----$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 specifiedDIRECTORIES and their subdirectories (defaulting to `.').By default, it only remakes those files that are older than theirsources. 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 mightsupport 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 pathThe environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,AUTOPOINT, LIBTOOLIZE, M4 are honored.Report bugs to <bug-autoconf\@gnu.org>.";# $VERSION# --------$version = "autoreconf (@PACKAGE_NAME@) @VERSION@Written by David J. MacKenzie and Akim Demaille.Copyright (C) 2006 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.";# Lib files.my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@';my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@';my $automake = $ENV{'AUTOMAKE'} || 'automake';my $aclocal = $ENV{'ACLOCAL'} || 'aclocal';my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint';# --install -- as --add-missing in other tools.my $install = 0;# symlink -- when --install, use symlinks instead.my $symlink = 0;# Does aclocal support --force?my $aclocal_supports_force = 0;# Does automake support --force-missing?my $automake_supports_force_missing = 0;my @prepend_include;my @include;# List of command line warning requests.my @warning;# Rerun `./configure && make'?my $make = 0;# Recurse into subpackagesmy $recursive = 1;## ---------- #### Routines. #### ---------- ### parse_args ()# -------------# Process any command line arguments.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' => \$make, 'recursive!' => \$recursive); # Split the warnings as a list of elements instead of a list of # lists. @warning = map { split /,/ } @warning; parse_WARNINGS; parse_warnings '--warnings', @warning; # Even if the user specified a configure.ac, trim to get the # directory, and look for configure.ac again. Because (i) the code # is simpler, and (ii) we are still able to diagnose simultaneous # presence of configure.ac and configure.in. @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"; } } $aclocal_supports_force = `$aclocal --help` =~ /--force/; $automake_supports_force_missing = `$automake --help` =~ /--force-missing/; # Dispatch autoreconf's option to the tools. # --include; $autoconf .= join (' --include=', '', @include); $autoconf .= join (' --prepend-include=', '', @prepend_include); $autoheader .= join (' --include=', '', @include); $autoheader .= join (' --prepend-include=', '', @prepend_include); # --install and --symlink; if ($install) { $automake .= ' --add-missing'; $automake .= ' --copy' unless $symlink; $libtoolize .= ' --copy' unless $symlink; } # --force; 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 { # The implementation of --no-force is bogus in all implementations # of Automake up to 1.8, so we avoid it in these cases. (Automake # 1.8 is the first version where aclocal supports force, hence # the condition.) $automake .= ' --no-force' if $aclocal_supports_force; } # --verbose --verbose or --debug; if ($verbose > 1 || $debug) { $autoconf .= ' --verbose'; $autoheader .= ' --verbose'; $automake .= ' --verbose'; $aclocal .= ' --verbose'; } if ($debug) { $autoconf .= ' --debug'; $autoheader .= ' --debug'; $libtoolize .= ' --debug'; } # --warnings; if (@warning) { my $warn = ' --warnings=' . join (',', @warning); $autoconf .= $warn; $autoheader .= $warn; $automake .= $warn if `$automake --help` =~ /--warnings/; }}# &run_aclocal ($ACLOCAL, $FLAGS)# -------------------------------# Update aclocal.m4 as lazily as possible, as aclocal pre-1.8 always# overwrites aclocal.m4, hence triggers autoconf, autoheader, automake# etc. uselessly. aclocal 1.8+ does not need this.sub run_aclocal ($$){ my ($aclocal, $flags) = @_; # aclocal 1.8+ does all this for free. It can be recognized by its # --force support. if ($aclocal_supports_force) { xsystem ("$aclocal $flags"); } else { xsystem ("$aclocal $flags --output=aclocal.m4t"); # aclocal may produce no output. if (-f 'aclocal.m4t') { update_file ('aclocal.m4t', 'aclocal.m4'); # Make sure that the local m4 files are older than # aclocal.m4. # # Why is not always the case? Because we already run # aclocal at first (before tracing), which, for instance, # can find Gettext's macros in .../share/aclocal, so we may # have had the right aclocal.m4 already. Then autopoint is # run, and installs locally these M4 files. Then # autoreconf, via update_file, sees it is the _same_ # aclocal.m4, and doesn't change its timestamp. But later, # Automake's Makefile expresses that aclocal.m4 depends on # these local files, which are newer, so it triggers aclocal # again. # # To make sure aclocal.m4 is no older, we change the # modification times of the local M4 files to be not newer # than it. # # First, where are the local files? my $aclocal_local_dir = '.'; if ($flags =~ /-I\s+(\S+)/) { $aclocal_local_dir = $1; } # All the local files newer than aclocal.m4 are to be # made not newer than it. 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; } } } }}# &autoreconf_current_directory# -----------------------------sub autoreconf_current_directory (){ my $configure_ac = find_configure_ac; # ---------------------- # # Is it using Autoconf? # # ---------------------- # 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/; # See below for why we look for gettext here. $uses_gettext = 1 if /^AM_GNU_GETTEXT_VERSION/; } } if (!$uses_autoconf) { verb "$configure_ac: not using Autoconf"; return; } # ------------------- # # Running autopoint. # # ------------------- # # Gettext is a bit of a problem: its macros are not necessarily # visible to aclocal, so if we start with a completely striped down # package (think of a fresh CVS checkout), running `aclocal' first # will fail: the Gettext macros are missing. # # Therefore, we can't use the traces to decide if we use Gettext or # not. I guess that once Gettext move to 2.5x we will be able to, # but in the meanwhile forget it. #
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -