4 eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac'
7 # gnu-configize - install the GNU config.guess / config.sub in a directory tree
9 # Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003
10 # Free Software Foundation, Inc.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2, or (at your option)
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29 my $datadir = $ENV{'autom4te_perllibdir'} || '@autom4te_perllibdir@';
30 # '/home/kergoth/code/build-arm/tmp/staging/share/autoconf';
31 unshift @INC, $datadir;
33 # Override SHELL. On DJGPP SHELL may not be set to a shell
34 # that can handle redirection and quote arguments correctly,
35 # e.g.: COMMAND.COM. For DJGPP always use the shell that configure
37 $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos');
40 use Autom4te::ChannelDefs;
41 use Autom4te::Channels;
42 use Autom4te::Configure_ac;
43 use Autom4te::FileUtils;
44 use Autom4te::General;
46 # Do not use Cwd::chdir, since it might hang.
56 $help = "Usage: $0 [OPTION] ... [CONFIGURE-AC or DIRECTORY] ...
58 Install the GNU config.sub and config.guess scripts in the
59 DIRECTORIES or the directory trees driven by CONFIGURE-AC
63 -h, --help print this help, then exit
64 -V, --version print version number, then exit
65 -v, --verbose verbosely report processing
66 -f, --force consider all files obsolete
67 -s, --symlink install symbolic links instead of copies
68 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
70 " . Autom4te::ChannelDefs::usage . "
72 The environment variable \`WARNINGS\' is honored. Some subtools might
73 support other warning types, using \`all' is encouraged.
78 $version = "gnu-configize 1.0
80 Copyright (C) 2004 Chris Larson
81 This is free software; see the source for copying conditions. There is NO
82 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
85 my $configdir = '@gnu-configdir@';
86 #'/home/kergoth/code/build-arm/tmp/staging/i686-linux/share/gnu-config';
87 my $autoconf = $ENV{'AUTOCONF'} || 'autoconf';
89 # use symlinks instead.
107 # Process any command line arguments.
112 getopt ('s|symlink' => \$symlink);
114 # Even if the user specified a configure.ac, trim to get the
115 # directory, and look for configure.ac again. Because (i) the code
116 # is simpler, and (ii) we are still able to diagnose simultaneous
117 # presence of configure.ac and configure.in.
118 @ARGV = map { /configure\.(ac|in)$/ ? dirname ($_) : $_ } @ARGV;
119 push @ARGV, '.' unless @ARGV;
123 # &gnu_configize_current_directory
124 # -----------------------------
125 sub gnu_configize_current_directory ()
127 my $configure_ac = require_configure_ac;
129 # ---------------------- #
130 # Is it using Autoconf? #
131 # ---------------------- #
135 my $configure_ac_file = new Autom4te::XFile $configure_ac;
136 while ($_ = $configure_ac_file->getline)
140 $uses_autoconf = 1 if /AC_INIT/;
145 verb "$configure_ac: not using Autoconf";
154 verb "$configure_ac: tracing";
155 my $traces = new Autom4te::XFile
157 . join (' --trace=', '',
158 # If you change this list, update the
159 # `Autoreconf-preselections' section of autom4te.in.
160 'AC_CONFIG_AUX_DIR:AC_CONFIG_AUX_DIR:\$1',
161 'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1',
165 while ($_ = $traces->getline)
167 $aux_dir = $1 if /AC_CONFIG_AUX_DIR:(.*)/;
168 $uses_autoconf = 1 if /AC_INIT/;
169 push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;
172 # The subdirs are *optional*, they may not exist.
177 verb "$configure_ac: subdirectory $_ to gnu-configize";
182 verb "$configure_ac: subdirectory $_ not present";
188 if (defined $aux_dir)
193 verb "$configure_ac: creating directory $aux_dir";
195 or error "cannot create $aux_dir: $!";
208 xsystem ("$cmd $configdir/config.guess $dest/");
209 xsystem ("$chmod u+x $dest/config.guess");
210 xsystem ("$cmd $configdir/config.sub $dest/");
211 xsystem ("$chmod u+x $dest/config.sub");
215 # &gnu_configize ($DIRECTORY)
216 # ------------------------
217 # Reconf the $DIRECTORY.
218 sub gnu_configize ($)
220 my ($directory) = @_;
223 # The format for this message is not free: taken from Emacs, itself
224 # using GNU Make's format.
225 verb "Entering directory `$directory'";
227 or error "cannot chdir to $directory: $!";
229 gnu_configize_current_directory;
231 # The format is not free: taken from Emacs, itself using GNU Make's
233 verb "Leaving directory `$directory'";
235 or error "cannot chdir to $cwd: $!";
245 # Autoreconf all the given configure.ac. A while loop, not a for,
246 # since the list can change at runtime because of AC_CONFIG_SUBDIRS.
247 for my $directory (@ARGV)
249 gnu_configize ($directory);
252 ### Setup "GNU" style for perl-mode and cperl-mode.
254 ## perl-indent-level: 2
255 ## perl-continued-statement-offset: 2
256 ## perl-continued-brace-offset: 0
257 ## perl-brace-offset: 0
258 ## perl-brace-imaginary-offset: 0
259 ## perl-label-offset: -2
260 ## cperl-indent-level: 2
261 ## cperl-brace-offset: 0
262 ## cperl-continued-brace-offset: 0
263 ## cperl-label-offset: -2
264 ## cperl-extra-newline-before-brace: t
265 ## cperl-merge-trailing-else: nil
266 ## cperl-continued-statement-offset: 2