autoreconf.in
来自「LINUX下的源码工具,可自己分析,或者直接装在系统上作为应用」· IN 代码 · 共 617 行 · 第 1/2 页
IN
617 行
#! @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 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., 59 Temple Place - Suite 330, Boston, MA# 02111-1307, USA.# Written by David J. MacKenzie.# Extended and rewritten in Perl by Akim Demaille.BEGIN{ my $perllibdir = $ENV{'autom4te_perllibdir'} || '@datadir@'; unshift @INC, "$perllibdir";}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] ... [CONFIGURE-AC or DIRECTORY] ...Run `autoconf' (and `autoheader', `aclocal', `automake', `autopoint'(formerly `gettextize'), and `libtoolize' where appropriate)repeatedly to remake the GNU Build System files in the DIRECTORIES orthe directory trees driven by CONFIGURE-AC (defaulting to `.').By default, it only remakes those files that are older than theirpredecessors. If you install new versions of the GNU Build System,running `autoreconf' remakes 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 -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]Warning categories include: \`cross\' cross compilation issues \`obsolete\' obsolete constructs \`portability\' portability issues \`syntax\' dubious syntactic constructs \`all\' all the warnings \`no-CATEGORY\' turn off the warnings on CATEGORY \`none\' turn off all the warnings \`error\' warnings are errorThe 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 are honored.Report bugs to <bug-autoconf\@gnu.org>.";# $VERSION# --------$version = "autoreconf (@PACKAGE_NAME@) @VERSION@Written by David J. MacKenzie and Akim Demaille.Copyright 2002 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;my @prepend_include;my @include;# List of warnings.my @warning;# Rerun `./configure && make'?my $make = 0;## ---------- #### 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); # Split the warnings as a list of elements instead of a list of # lists. @warning = map { split /,/ } @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"; } } # 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) { $autoconf .= ' --force'; $autoheader .= ' --force'; $automake .= ' --force-missing'; $autopoint .= ' --force'; $libtoolize .= ' --force'; } else { $automake .= ' --no-force'; } # --debug; if ($debug) { $autoconf .= ' --verbose --debug'; $autoheader .= ' --verbose --debug'; $automake .= ' --verbose'; $aclocal .= ' --verbose'; $libtoolize .= ' --debug'; } # --warnings; if (@warning) { $autoconf .= ' --warnings=' . join (',', @warning); $autoheader .= ' --warnings=' . join (',', @warning); $automake .= ' --warnings=' . join (',', @warning) if `$automake --help` =~ /--warnings/; }}# &autoreconf_current_directory# -----------------------------sub autoreconf_current_directory (){ my $configure_ac = find_configure_ac; error "cannot find `configure.ac'" unless $configure_ac; # ---------------------- # # Is it using Autoconf? # # ---------------------- # my $uses_autoconf; my $uses_gettext; 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) { verbose "$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. # # We can only grep for AM_GNU_GETTEXT_VERSION in configure.ac. You # might think this approach is naive, and indeed it is, as it # prevents one to embed AM_GNU_GETTEXT_VERSION in another *.m4, but # anyway we don't limit the generality, since... that's what # autopoint does. Actually, it is even more restrictive, as it # greps for `^AM_GNU_GETTEXT_VERSION('. We did this above, while # scanning configure.ac. if (!$uses_gettext) { verbose "$configure_ac: not using Gettext"; } elsif (!$install) { verbose "$configure_ac: not running autopoint: --install not given"; } else { xsystem "$autopoint"; } # ----------------- # # Running aclocal. # # ----------------- # # Run it first: it might discover new macros to add, e.g., # AC_PROG_LIBTOOL, which we will trace later to see if Libtool is # used. # # Always run it. Tracking its sources for up-to-dateness is too # complex and too error prone. The best we can do is avoiding # nuking the time stamp. my $uses_aclocal = 1; # Nevertheless, if aclocal.m4 exists and is not made by aclocal, # don't run aclocal. if (-f 'aclocal.m4') { my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4'; $_ = $aclocal_m4->getline; $uses_aclocal = 0 unless /generated.*by aclocal/; } # If there are flags for aclocal in Makefile.am, use them. my $aclocal_flags = ''; if ($uses_aclocal && -f 'Makefile.am') { my $makefile = new Autom4te::XFile 'Makefile.am'; while ($_ = $makefile->getline) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?