# PaCkAgE DaTaStReAm
autoconf 1 6443
# end of header
0707010009b805000081a40000000000000000000000014f7aa0480000010f0000010000010007ffffffffffffffff0000001100000000autoconf/pkginfo PKG=autoconf
NAME=GNU autoconf 2.68 SPARC 64bit Solaris 10
VERSION=2.68
PSTAMP=3rd April 2012
VENDOR=GNU
EMAIL=http://www.gnu.org/software/autoconf/
DESC=GNU autoconf m4 macro creator
ARCH=sparc
CATEGORY=utility
CLASSES=none
BASEDIR=/
ISTATES=S s 1 2 3
RSTATES=S s 1 2 3
0707010009b804000081a40000000000000000000000014f7aa0490000174c0000010000010007ffffffffffffffff0000001000000000autoconf/pkgmap : 1 6443
1 d none /usr ? ? ?
1 d none /usr/local ? ? ?
1 d none /usr/local/bin 0755 root root
1 f none /usr/local/bin/autoconf 0755 root root 14660 30824 1333436460
1 f none /usr/local/bin/autoheader 0755 root root 8642 27886 1333436460
1 f none /usr/local/bin/autom4te 0755 root root 32254 18650 1333436460
1 f none /usr/local/bin/autoreconf 0755 root root 21173 8581 1333436460
1 f none /usr/local/bin/autoscan 0755 root root 17225 5210 1333436460
1 f none /usr/local/bin/autoupdate 0755 root root 33979 18125 1333436460
1 f none /usr/local/bin/ifnames 0755 root root 4199 9090 1333436460
1 d none /usr/local/share 0755 root root
1 d none /usr/local/share/autoconf 0755 root root
1 d none /usr/local/share/autoconf/Autom4te 0755 root root
1 f none /usr/local/share/autoconf/Autom4te/C4che.pm 0644 root root 4914 63904 1333436460
1 f none /usr/local/share/autoconf/Autom4te/ChannelDefs.pm 0644 root root 9182 24356 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Channels.pm 0644 root root 20976 35098 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Configure_ac.pm 0644 root root 3369 13628 1333436460
1 f none /usr/local/share/autoconf/Autom4te/FileUtils.pm 0644 root root 10119 5024 1333436460
1 f none /usr/local/share/autoconf/Autom4te/General.pm 0644 root root 9632 33475 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Request.pm 0644 root root 2563 11164 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Struct.pm 0644 root root 19599 58718 1333436460
1 f none /usr/local/share/autoconf/Autom4te/XFile.pm 0644 root root 7801 28844 1333436460
1 f none /usr/local/share/autoconf/INSTALL 0644 root root 15584 59728 1333436460
1 d none /usr/local/share/autoconf/autoconf 0755 root root
1 f none /usr/local/share/autoconf/autoconf/autoconf.m4 0644 root root 3689 61703 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoconf.m4f 0644 root root 467497 48154 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoheader.m4 0644 root root 2786 23756 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoscan.m4 0644 root root 2025 30155 1333436460
1 f none /usr/local/share/autoconf/autoconf/autotest.m4 0644 root root 2961 45817 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoupdate.m4 0644 root root 4355 30859 1333436460
1 f none /usr/local/share/autoconf/autoconf/c.m4 0644 root root 60195 11183 1333436460
1 f none /usr/local/share/autoconf/autoconf/erlang.m4 0644 root root 9919 31574 1333436460
1 f none /usr/local/share/autoconf/autoconf/fortran.m4 0644 root root 46784 16685 1333436460
1 f none /usr/local/share/autoconf/autoconf/functions.m4 0644 root root 63609 13684 1333436460
1 f none /usr/local/share/autoconf/autoconf/general.m4 0644 root root 102419 38417 1333436460
1 f none /usr/local/share/autoconf/autoconf/headers.m4 0644 root root 29700 21745 1333436460
1 f none /usr/local/share/autoconf/autoconf/lang.m4 0644 root root 23892 53788 1333436460
1 f none /usr/local/share/autoconf/autoconf/libs.m4 0644 root root 16295 47377 1333436460
1 f none /usr/local/share/autoconf/autoconf/oldnames.m4 0644 root root 3879 29667 1333436460
1 f none /usr/local/share/autoconf/autoconf/programs.m4 0644 root root 29651 52496 1333436460
1 f none /usr/local/share/autoconf/autoconf/specific.m4 0644 root root 14277 560 1333436460
1 f none /usr/local/share/autoconf/autoconf/status.m4 0644 root root 55868 44191 1333436460
1 f none /usr/local/share/autoconf/autoconf/types.m4 0644 root root 35937 49959 1333436460
1 f none /usr/local/share/autoconf/autom4te.cfg 0644 root root 4804 56801 1333436461
1 d none /usr/local/share/autoconf/autoscan 0755 root root
1 f none /usr/local/share/autoconf/autoscan/autoscan.list 0644 root root 9588 59245 1333436461
1 d none /usr/local/share/autoconf/autotest 0755 root root
1 f none /usr/local/share/autoconf/autotest/autotest.m4 0644 root root 1223 38700 1333436461
1 f none /usr/local/share/autoconf/autotest/autotest.m4f 0644 root root 128377 21823 1333436461
1 f none /usr/local/share/autoconf/autotest/general.m4 0644 root root 73651 2328 1333436461
1 f none /usr/local/share/autoconf/autotest/specific.m4 0644 root root 3043 48263 1333436461
1 d none /usr/local/share/autoconf/m4sugar 0755 root root
1 f none /usr/local/share/autoconf/m4sugar/foreach.m4 0644 root root 14761 48594 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sh.m4 0644 root root 74143 2665 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sh.m4f 0644 root root 70726 7785 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sugar.m4 0644 root root 121846 45131 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sugar.m4f 0644 root root 30553 46123 1333436460
1 f none /usr/local/share/autoconf/m4sugar/version.m4 0644 root root 523 39908 1333436460
1 d none /usr/local/share/info 0755 root root
1 f none /usr/local/share/info/autoconf.info 0644 root root 1104426 19181 1333436461
1 f none /usr/local/share/info/dir 0644 root root 6918 57238 1333436461
1 f none /usr/local/share/info/standards.info 0644 root root 228560 19901 1333436461
1 d none /usr/local/share/man 0755 root root
1 d none /usr/local/share/man/man1 0755 root root
1 f none /usr/local/share/man/man1/autoconf.1 0644 root root 2903 49332 1333436462
1 f none /usr/local/share/man/man1/autoheader.1 0644 root root 2642 28609 1333436462
1 f none /usr/local/share/man/man1/autom4te.1 0644 root root 4629 65476 1333436462
1 f none /usr/local/share/man/man1/autoreconf.1 0644 root root 3524 40346 1333436462
1 f none /usr/local/share/man/man1/autoscan.1 0644 root root 2026 40692 1333436462
1 f none /usr/local/share/man/man1/autoupdate.1 0644 root root 2015 38166 1333436462
1 f none /usr/local/share/man/man1/config.guess.1 0644 root root 2081 38698 1333436462
1 f none /usr/local/share/man/man1/config.sub.1 0644 root root 1227 29244 1333436462
1 f none /usr/local/share/man/man1/ifnames.1 0644 root root 1756 16055 1333436462
1 i checkinstall 785 2565 1333436488
1 i pkginfo 271 21051 1333436488
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!! 0707010009b805000081a40000000000000000000000014f7aa0480000010f0000010000010007ffffffffffffffff0000000800000000pkginfo PKG=autoconf
NAME=GNU autoconf 2.68 SPARC 64bit Solaris 10
VERSION=2.68
PSTAMP=3rd April 2012
VENDOR=GNU
EMAIL=http://www.gnu.org/software/autoconf/
DESC=GNU autoconf m4 macro creator
ARCH=sparc
CATEGORY=utility
CLASSES=none
BASEDIR=/
ISTATES=S s 1 2 3
RSTATES=S s 1 2 3
0707010009b804000081a40000000000000000000000014f7aa0490000174c0000010000010007ffffffffffffffff0000000700000000pkgmap : 1 6443
1 d none /usr ? ? ?
1 d none /usr/local ? ? ?
1 d none /usr/local/bin 0755 root root
1 f none /usr/local/bin/autoconf 0755 root root 14660 30824 1333436460
1 f none /usr/local/bin/autoheader 0755 root root 8642 27886 1333436460
1 f none /usr/local/bin/autom4te 0755 root root 32254 18650 1333436460
1 f none /usr/local/bin/autoreconf 0755 root root 21173 8581 1333436460
1 f none /usr/local/bin/autoscan 0755 root root 17225 5210 1333436460
1 f none /usr/local/bin/autoupdate 0755 root root 33979 18125 1333436460
1 f none /usr/local/bin/ifnames 0755 root root 4199 9090 1333436460
1 d none /usr/local/share 0755 root root
1 d none /usr/local/share/autoconf 0755 root root
1 d none /usr/local/share/autoconf/Autom4te 0755 root root
1 f none /usr/local/share/autoconf/Autom4te/C4che.pm 0644 root root 4914 63904 1333436460
1 f none /usr/local/share/autoconf/Autom4te/ChannelDefs.pm 0644 root root 9182 24356 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Channels.pm 0644 root root 20976 35098 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Configure_ac.pm 0644 root root 3369 13628 1333436460
1 f none /usr/local/share/autoconf/Autom4te/FileUtils.pm 0644 root root 10119 5024 1333436460
1 f none /usr/local/share/autoconf/Autom4te/General.pm 0644 root root 9632 33475 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Request.pm 0644 root root 2563 11164 1333436460
1 f none /usr/local/share/autoconf/Autom4te/Struct.pm 0644 root root 19599 58718 1333436460
1 f none /usr/local/share/autoconf/Autom4te/XFile.pm 0644 root root 7801 28844 1333436460
1 f none /usr/local/share/autoconf/INSTALL 0644 root root 15584 59728 1333436460
1 d none /usr/local/share/autoconf/autoconf 0755 root root
1 f none /usr/local/share/autoconf/autoconf/autoconf.m4 0644 root root 3689 61703 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoconf.m4f 0644 root root 467497 48154 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoheader.m4 0644 root root 2786 23756 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoscan.m4 0644 root root 2025 30155 1333436460
1 f none /usr/local/share/autoconf/autoconf/autotest.m4 0644 root root 2961 45817 1333436460
1 f none /usr/local/share/autoconf/autoconf/autoupdate.m4 0644 root root 4355 30859 1333436460
1 f none /usr/local/share/autoconf/autoconf/c.m4 0644 root root 60195 11183 1333436460
1 f none /usr/local/share/autoconf/autoconf/erlang.m4 0644 root root 9919 31574 1333436460
1 f none /usr/local/share/autoconf/autoconf/fortran.m4 0644 root root 46784 16685 1333436460
1 f none /usr/local/share/autoconf/autoconf/functions.m4 0644 root root 63609 13684 1333436460
1 f none /usr/local/share/autoconf/autoconf/general.m4 0644 root root 102419 38417 1333436460
1 f none /usr/local/share/autoconf/autoconf/headers.m4 0644 root root 29700 21745 1333436460
1 f none /usr/local/share/autoconf/autoconf/lang.m4 0644 root root 23892 53788 1333436460
1 f none /usr/local/share/autoconf/autoconf/libs.m4 0644 root root 16295 47377 1333436460
1 f none /usr/local/share/autoconf/autoconf/oldnames.m4 0644 root root 3879 29667 1333436460
1 f none /usr/local/share/autoconf/autoconf/programs.m4 0644 root root 29651 52496 1333436460
1 f none /usr/local/share/autoconf/autoconf/specific.m4 0644 root root 14277 560 1333436460
1 f none /usr/local/share/autoconf/autoconf/status.m4 0644 root root 55868 44191 1333436460
1 f none /usr/local/share/autoconf/autoconf/types.m4 0644 root root 35937 49959 1333436460
1 f none /usr/local/share/autoconf/autom4te.cfg 0644 root root 4804 56801 1333436461
1 d none /usr/local/share/autoconf/autoscan 0755 root root
1 f none /usr/local/share/autoconf/autoscan/autoscan.list 0644 root root 9588 59245 1333436461
1 d none /usr/local/share/autoconf/autotest 0755 root root
1 f none /usr/local/share/autoconf/autotest/autotest.m4 0644 root root 1223 38700 1333436461
1 f none /usr/local/share/autoconf/autotest/autotest.m4f 0644 root root 128377 21823 1333436461
1 f none /usr/local/share/autoconf/autotest/general.m4 0644 root root 73651 2328 1333436461
1 f none /usr/local/share/autoconf/autotest/specific.m4 0644 root root 3043 48263 1333436461
1 d none /usr/local/share/autoconf/m4sugar 0755 root root
1 f none /usr/local/share/autoconf/m4sugar/foreach.m4 0644 root root 14761 48594 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sh.m4 0644 root root 74143 2665 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sh.m4f 0644 root root 70726 7785 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sugar.m4 0644 root root 121846 45131 1333436460
1 f none /usr/local/share/autoconf/m4sugar/m4sugar.m4f 0644 root root 30553 46123 1333436460
1 f none /usr/local/share/autoconf/m4sugar/version.m4 0644 root root 523 39908 1333436460
1 d none /usr/local/share/info 0755 root root
1 f none /usr/local/share/info/autoconf.info 0644 root root 1104426 19181 1333436461
1 f none /usr/local/share/info/dir 0644 root root 6918 57238 1333436461
1 f none /usr/local/share/info/standards.info 0644 root root 228560 19901 1333436461
1 d none /usr/local/share/man 0755 root root
1 d none /usr/local/share/man/man1 0755 root root
1 f none /usr/local/share/man/man1/autoconf.1 0644 root root 2903 49332 1333436462
1 f none /usr/local/share/man/man1/autoheader.1 0644 root root 2642 28609 1333436462
1 f none /usr/local/share/man/man1/autom4te.1 0644 root root 4629 65476 1333436462
1 f none /usr/local/share/man/man1/autoreconf.1 0644 root root 3524 40346 1333436462
1 f none /usr/local/share/man/man1/autoscan.1 0644 root root 2026 40692 1333436462
1 f none /usr/local/share/man/man1/autoupdate.1 0644 root root 2015 38166 1333436462
1 f none /usr/local/share/man/man1/config.guess.1 0644 root root 2081 38698 1333436462
1 f none /usr/local/share/man/man1/config.sub.1 0644 root root 1227 29244 1333436462
1 f none /usr/local/share/man/man1/ifnames.1 0644 root root 1756 16055 1333436462
1 i checkinstall 785 2565 1333436488
1 i pkginfo 271 21051 1333436488
0707010009b853000041ed0000000000000000000000024f7aa049000000000000010000010007ffffffffffffffff0000000800000000install 0707010009b854000081ed0000000000000000000000014f7aa048000003110000010000010007ffffffffffffffff0000001500000000install/checkinstall #!/bin/sh
#
expected_bits="64"
expected_release="5.10"
expected_platform="sparc"
#
release=`uname -r`
platform=`uname -p`
bits=`isainfo -b`
#
if [ ${platform} != ${expected_platform} ]; then
echo "\n\n\n\tThis package must be installed on a ${expected_platform} architecture\n"
echo "\tAborting installation.\n\n\n"
exit 1
fi
if [ ${release} != ${expected_release} ]; then
echo "\n\n\n\tThis package must be installed on a ${expected_release} machine\n"
echo "\tAborting installation.\n\n\n"
exit 1
fi
if [ ${bits} != ${expected_bits} ]; then
echo "\n\n\n\tThis package must be installed on a ${expected_bits} bit machine\n"
echo "\tYour machine is running a ${bits} bit O.S. currently\n"
echo "\tAborting installation.\n\n\n"
exit 1
fi
exit 0
0707010009b806000041ed0000000000000000000000034f7aa049000000000000010000010007ffffffffffffffff0000000500000000root 0707010009b807000041ed0000000000000000000000034f7aa049000000000000010000010007ffffffffffffffff0000000900000000root/usr 0707010009b808000041ed0000000000000000000000044f7aa049000000000000010000010007ffffffffffffffff0000000f00000000root/usr/local 0707010009b809000041ed0000000000000000000000024f7aa049000000000000010000010007ffffffffffffffff0000001300000000root/usr/local/bin 0707010009b810000081ed0000000000000000000000014f7aa02c000010670000010000010007ffffffffffffffff0000001b00000000root/usr/local/bin/ifnames #! /usr/local/bin/perl -w
# -*- perl -*-
# Generated from ifnames.in; do not edit by hand.
eval 'case $# in 0) exec /usr/local/bin/perl -S "$0";; *) exec /usr/local/bin/perl -S "$0" "$@";; esac'
if 0;
# ifnames - print the identifiers used in C preprocessor conditionals
# Copyright (C) 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
# 2007, 2008, 2009, 2010 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 3 of the License, 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, see .
# Reads from stdin if no files are given.
# Writes to stdout.
# Written by David MacKenzie
# and Paul Eggert .
BEGIN
{
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/usr/local/share/autoconf';
unshift @INC, $pkgdatadir;
# 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'} = '/bin/bash' if ($^O eq 'dos');
}
use Autom4te::General;
use Autom4te::XFile;
use Autom4te::FileUtils;
# $HELP
# -----
$help = "Usage: $0 [OPTION]... [FILE]...
Scan all of the C source FILES (or the standard input, if none are
given) and write to the standard output a sorted list of all the
identifiers that appear in those files in `#if', `#elif', `#ifdef', or
`#ifndef' directives. Print each identifier on a line, followed by a
space-separated list of the files in which that identifier occurs.
-h, --help print this help, then exit
-V, --version print version number, then exit
Report bugs to .
GNU Autoconf home page: .
General help using GNU software: .
";
# $VERSION
# --------
$version = "ifnames (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
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 Paul Eggert.
";
# &parse_args ()
# --------------
# Process any command line arguments.
sub parse_args ()
{
getopt ();
}
# %OCCURRENCE
# -----------
my %occurrence;
# &scan_file ($FILE-NAME)
# -----------------------
sub scan_file ($)
{
my ($file_name) = @_;
my $file = new Autom4te::XFile ("< " . open_quote ($file_name));
while ($_ = $file->getline)
{
# Continuation lines.
$_ .= $file->getline
while (s/\\$//);
# Preprocessor directives.
if (s/^\s*\#\s*(if|ifdef|ifndef|elif)\s+//)
{
# Remove comments. Not perfect, but close enough.
s(/\*.*?\*/)();
s(/\*.*)();
s(//.*)();
foreach my $word (split (/\W+/))
{
next
if $word eq 'defined' || $word !~ /^[a-zA-Z_]/;
$occurrence{$word}{$file_name} = 1;
}
}
}
}
## ------ ##
## Main. ##
## ------ ##
parse_args();
foreach (@ARGV)
{
scan_file ($_);
}
foreach (sort keys %occurrence)
{
print "$_ ", join (' ', sort keys %{$occurrence{$_}}), "\n";
}
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b80d000081ed0000000000000000000000014f7aa02c000052b50000010000010007ffffffffffffffff0000001e00000000root/usr/local/bin/autoreconf #! /usr/local/bin/perl -w
# -*- perl -*-
# Generated from autoreconf.in; do not edit by hand.
eval 'case $# in 0) exec /usr/local/bin/perl -S "$0";; *) exec /usr/local/bin/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,
# 2007, 2008, 2009, 2010 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 3 of the License, 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, see .
# Written by David J. MacKenzie.
# Extended and rewritten in Perl by Akim Demaille.
BEGIN
{
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/usr/local/share/autoconf';
unshift @INC, $pkgdatadir;
# 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'} = '/bin/bash' 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 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 .
GNU Autoconf home page: .
General help using GNU software: .
";
# $VERSION
# --------
$version = "autoreconf (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
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.
";
# Lib files.
my $autoconf = $ENV{'AUTOCONF'} || '/usr/local/bin/autoconf';
my $autoheader = $ENV{'AUTOHEADER'} || '/usr/local/bin/autoheader';
my $autom4te = $ENV{'AUTOM4TE'} || '/usr/local/bin/autom4te';
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';
# --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 aclocal support -Wfoo?
my $aclocal_supports_warnings = 0;
# Does automake support --force-missing?
my $automake_supports_force_missing = 0;
# Does automake support -Wfoo?
my $automake_supports_warnings = 0;
my @prepend_include;
my @include;
# List of command line warning requests.
my @warning;
# Rerun `./configure && make'?
my $run_make = 0;
# Recurse into subpackages
my $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' => \$run_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";
}
}
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/;
# Dispatch autoreconf's option to the tools.
# --include;
$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);
# --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_supports_warnings;
$aclocal .= $warn
if $aclocal_supports_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.
#
# 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)
{
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");
}
# ----------------- #
# 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 defined ($_) && /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)
{
if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)
{
$aclocal_flags = $1;
last;
}
}
}
if (!$uses_aclocal)
{
verb "$configure_ac: not using aclocal";
}
else
{
# Some file systems have sub-second time stamps, and if so we may
# run into trouble later, after we rerun autoconf and set the
# time stamps of input files to be no greater than aclocal.m4,
# because the time-stamp-setting operation (utime) has a
# resolution of only 1 second. Work around the problem by
# ensuring that there is at least a one-second window before the
# time stamp of aclocal.m4t in which no file time stamps can
# fall.
sleep 1;
run_aclocal ($aclocal, $aclocal_flags);
}
# We might have to rerun aclocal if Libtool (or others) imports new
# macros.
my $rerun_aclocal = 0;
# ------------------------------- #
# See what tools will be needed. #
# ------------------------------- #
# Perform a single trace reading to avoid --force forcing a rerun
# between two --trace, that's useless. If there is no AC_INIT, then
# we are not interested: it looks like a Cygnus thingy.
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::\${::}%' }
# If you change this list, update the
# `Autoreconf-preselections' section of autom4te.in.
'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;
}
# The subdirs are *optional*, they may not exist.
foreach (@subdir)
{
if (-d)
{
verb "$configure_ac: adding subdirectory $_ to autoreconf";
autoreconf ($_);
}
else
{
verb "$configure_ac: subdirectory $_ not present";
}
}
# Gettext consistency checks...
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;
# ---------------------------- #
# Setting up the source tree. #
# ---------------------------- #
# libtoolize, automake --add-missing etc. will drop files in the
# $AUX_DIR. But these tools fail to install these files if the
# directory itself does not exist, which valid: just imagine a CVS
# repository with hand written code only (there is not even a need
# for a Makefile.am!).
if (defined $aux_dir && ! -d $aux_dir)
{
verb "$configure_ac: creating directory $aux_dir";
mkdir $aux_dir, 0755
or error "cannot create $aux_dir: $!";
}
# -------------------- #
# Running libtoolize. #
# -------------------- #
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";
}
# ------------------- #
# Rerunning aclocal. #
# ------------------- #
# If we re-installed Libtool or Gettext, the macros might have changed.
# Automake also needs an up-to-date aclocal.m4.
if ($rerun_aclocal)
{
if (!$uses_aclocal)
{
verb "$configure_ac: not using aclocal";
}
else
{
run_aclocal ($aclocal, $aclocal_flags);
}
}
# ------------------ #
# Running autoconf. #
# ------------------ #
# Don't try to be smarter than `autoconf', which does its own up to
# date checks.
#
# We prefer running autoconf before autoheader, because (i) the
# latter runs the former, and (ii) autoconf is stricter than
# autoheader. So all in all, autoconf should give better error
# messages.
xsystem ($autoconf);
# -------------------- #
# Running autoheader. #
# -------------------- #
# 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.
#
# Run it before automake, since the latter checks the presence of
# config.h.in when it sees an AC_CONFIG_HEADERS.
if (!$uses_autoheader)
{
verb "$configure_ac: not using Autoheader";
}
else
{
xsystem ($autoheader);
}
# ------------------ #
# Running automake. #
# ------------------ #
if (!$uses_automake)
{
verb "$configure_ac: not using Automake";
}
else
{
# 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);
}
# -------------- #
# Running make. #
# -------------- #
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");
}
}
}
}
# &autoreconf ($DIRECTORY)
# ------------------------
# Reconf the $DIRECTORY.
sub autoreconf ($)
{
my ($directory) = @_;
my $cwd = cwd;
# The format for this message is not free: taken from Emacs, itself
# using GNU Make's format.
verb "Entering directory `$directory'";
chdir $directory
or error "cannot chdir to $directory: $!";
autoreconf_current_directory;
# The format is not free: taken from Emacs, itself using GNU Make's
# format.
verb "Leaving directory `$directory'";
chdir $cwd
or error "cannot chdir to $cwd: $!";
}
## ------ ##
## Main. ##
## ------ ##
# When debugging, it is convenient that all the related temporary
# files be at the same place.
mktmpdir ('ar');
$ENV{'TMPDIR'} = $tmp;
parse_args;
# Autoreconf all the given configure.ac. Unless `--no-recursive' is passed,
# AC_CONFIG_SUBDIRS will be traversed in &autoreconf_current_directory.
$ENV{'AUTOM4TE'} = $autom4te;
for my $directory (@ARGV)
{
require_configure_ac ($directory);
autoreconf ($directory);
}
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b80c000081ed0000000000000000000000014f7aa02c00007dfe0000010000010007ffffffffffffffff0000001c00000000root/usr/local/bin/autom4te #! /usr/local/bin/perl -w
# -*- perl -*-
# Generated from autom4te.in; do not edit by hand.
eval 'case $# in 0) exec /usr/local/bin/perl -S "$0";; *) exec /usr/local/bin/perl -S "$0" "$@";; esac'
if 0;
# autom4te - Wrapper around M4 libraries.
# Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010
# 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 3 of the License, 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, see .
BEGIN
{
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/usr/local/share/autoconf';
unshift @INC, $pkgdatadir;
# 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'} = '/bin/bash' if ($^O eq 'dos');
}
use Autom4te::C4che;
use Autom4te::ChannelDefs;
use Autom4te::Channels;
use Autom4te::FileUtils;
use Autom4te::General;
use Autom4te::XFile;
use File::Basename;
use strict;
# Data directory.
my $pkgdatadir = $ENV{'AC_MACRODIR'} || '/usr/local/share/autoconf';
# $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
my %language;
my $output = '-';
# Mode of the output file except for traces.
my $mode = "0666";
# If melt, don't use frozen files.
my $melt = 0;
# Names of the cache directory, cache directory index, trace cache
# prefix, and output cache prefix. And the IO object for the index.
my $cache;
my $icache;
my $tcache;
my $ocache;
my $icache_file;
my $flock_implemented = 'yes';
# The macros to trace mapped to their format, as specified by the
# user.
my %trace;
# The macros the user will want to trace in the future.
# We need `include' to get the included file, `m4_pattern_forbid' and
# `m4_pattern_allow' to check the output.
#
# FIXME: What about `sinclude'?
my @preselect = ('include',
'm4_pattern_allow', 'm4_pattern_forbid',
'_m4_warn');
# M4 include path.
my @include;
# Do we freeze?
my $freeze = 0;
# $M4.
my $m4 = $ENV{"M4"} || '/usr/local/bin/m4';
# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
fatal "need GNU m4 1.4 or later: $m4"
if system "$m4 --help &1 | grep reload-state >/dev/null";
# Set some high recursion limit as the default limit, 250, has already
# been hit with AC_OUTPUT. Don't override the user's choice.
$m4 .= ' --nesting-limit=1024'
if " $m4 " !~ / (--nesting-limit(=[0-9]+)?|-L[0-9]*) /;
# @M4_BUILTIN -- M4 builtins and a useful comment.
my @m4_builtin = `echo dumpdef | $m4 2>&1 >/dev/null`;
map { s/:.*//;s/\W// } @m4_builtin;
# %M4_BUILTIN_ALTERNATE_NAME
# --------------------------
# The builtins are renamed, e.g., `define' is renamed `m4_define'.
# So map `define' to `m4_define' and conversely.
# Some macros don't follow this scheme: be sure to properly map to their
# alternate name too.
#
# FIXME: Trace status of renamed builtins was fixed in M4 1.4.5, which
# we now depend on; do we still need to do this mapping?
#
# So we will merge them, i.e., tracing `BUILTIN' or tracing
# `m4_BUILTIN' will be the same: tracing both, but honoring the
# *last* trace specification.
#
# FIXME: This is not enough: in the output `$0' will be `BUILTIN'
# sometimes and `m4_BUILTIN' at others. We should return a unique name,
# the one specified by the user.
#
# FIXME: To be absolutely rigorous, I would say that given that we
# _redefine_ divert (instead of _copying_ it), divert and the like
# should not be part of this list.
my %m4_builtin_alternate_name;
@m4_builtin_alternate_name{"$_", "m4_$_"} = ("m4_$_", "$_")
foreach (grep { !/m4wrap|m4exit|dnl|ifelse|__.*__/ } @m4_builtin);
@m4_builtin_alternate_name{"ifelse", "m4_if"} = ("m4_if", "ifelse");
@m4_builtin_alternate_name{"m4exit", "m4_exit"} = ("m4_exit", "m4exit");
@m4_builtin_alternate_name{"m4wrap", "m4_wrap"} = ("m4_wrap", "m4wrap");
# $HELP
# -----
$help = "Usage: $0 [OPTION]... [FILES]
Run GNU M4 on the FILES, avoiding useless runs. Output the traces if tracing,
the frozen file if freezing, otherwise the expansion of the FILES.
If some of the FILES are named \`FILE.m4f\' they are considered to be M4
frozen files of all the previous files (which are therefore not loaded).
If \`FILE.m4f\' is not found, then \`FILE.m4\' will be used, together with
all the previous files.
Some files may be optional, i.e., will only be processed if found in the
include path, but then must end in \`.m4?\'; the question mark is not part of
the actual file name.
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
-o, --output=FILE save output in FILE (defaults to \`-\', stdout)
-f, --force don\'t rely on cached values
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
-l, --language=LANG specify the set of M4 macros to use
-C, --cache=DIRECTORY preserve results for future runs in DIRECTORY
--no-cache disable the cache
-m, --mode=OCTAL change the non trace output file mode (0666)
-M, --melt don\'t use M4 frozen files
Languages include:
\`Autoconf\' create Autoconf configure scripts
\`Autotest\' create Autotest test suites
\`M4sh\' create M4sh shell scripts
\`M4sugar\' create M4sugar output
" . Autom4te::ChannelDefs::usage . "
The environment variables \`M4\' and \`WARNINGS\' are honored.
Library directories:
-B, --prepend-include=DIR prepend directory DIR to search path
-I, --include=DIR append directory DIR to search path
Tracing:
-t, --trace=MACRO[:FORMAT] report the MACRO invocations
-p, --preselect=MACRO prepare to trace MACRO in a future run
Freezing:
-F, --freeze produce an M4 frozen state file for FILES
FORMAT defaults to \`\$f:\$l:\$n:\$%\', and can use the following escapes:
\$\$ literal \$
\$f file where macro was called
\$l line where macro was called
\$d nesting depth of macro call
\$n name of the macro
\$NUM argument NUM, unquoted and with newlines
\$SEP\@ all arguments, with newlines, quoted, and separated by SEP
\$SEP* all arguments, with newlines, unquoted, and separated by SEP
\$SEP% all arguments, without newlines, unquoted, and separated by SEP
SEP can be empty for the default (comma for \@ and *, colon for %),
a single character for that character, or {STRING} to use a string.
Report bugs to .
GNU Autoconf home page: .
General help using GNU software: .
";
# $VERSION
# --------
$version = <<"EOF";
autom4te (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Akim Demaille.
EOF
## ---------- ##
## Routines. ##
## ---------- ##
# $OPTION
# files_to_options (@FILE)
# ------------------------
# Transform Autom4te conventions (e.g., using foo.m4f to designate a frozen
# file) into a suitable command line for M4 (e.g., using --reload-state).
# parse_args guarantees that we will see at most one frozen file, and that
# if a frozen file is present, it is the first argument.
sub files_to_options (@)
{
my (@file) = @_;
my @res;
foreach my $file (@file)
{
my $arg = shell_quote ($file);
if ($file =~ /\.m4f$/)
{
$arg = "--reload-state=$arg";
# If the user downgraded M4 from 1.6 to 1.4.x after freezing
# the file, then we ensure the frozen __m4_version__ will
# not cause m4_init to make the wrong decision about the
# current M4 version.
$arg .= " --undefine=__m4_version__"
unless grep {/__m4_version__/} @m4_builtin;
}
push @res, $arg;
}
return join ' ', @res;
}
# load_configuration ($FILE)
# --------------------------
# Load the configuration $FILE.
sub load_configuration ($)
{
my ($file) = @_;
use Text::ParseWords;
my $cfg = new Autom4te::XFile ("< " . open_quote ($file));
my $lang;
while ($_ = $cfg->getline)
{
chomp;
# Comments.
next
if /^\s*(\#.*)?$/;
my @words = shellwords ($_);
my $type = shift @words;
if ($type eq 'begin-language:')
{
fatal "$file:$.: end-language missing for: $lang"
if defined $lang;
$lang = lc $words[0];
}
elsif ($type eq 'end-language:')
{
error "$file:$.: end-language mismatch: $lang"
if $lang ne lc $words[0];
$lang = undef;
}
elsif ($type eq 'args:')
{
fatal "$file:$.: no current language"
unless defined $lang;
push @{$language{$lang}}, @words;
}
else
{
error "$file:$.: unknown directive: $type";
}
}
}
# parse_args ()
# -------------
# Process any command line arguments.
sub parse_args ()
{
# We want to look for the early options, which should not be found
# in the configuration file. Prepend to the user arguments.
# Perform this repeatedly so that we can use --language in language
# definitions. Beware that there can be several --language
# invocations.
my @language;
do {
@language = ();
use Getopt::Long;
Getopt::Long::Configure ("pass_through", "permute");
GetOptions ("l|language=s" => \@language);
foreach (@language)
{
error "unknown language: $_"
unless exists $language{lc $_};
unshift @ARGV, @{$language{lc $_}};
}
} while @language;
# --debug is useless: it is parsed below.
if (exists $ENV{'AUTOM4TE_DEBUG'})
{
print STDERR "$me: concrete arguments:\n";
foreach my $arg (@ARGV)
{
print STDERR "| $arg\n";
}
}
# Process the arguments for real this time.
my @trace;
my @prepend_include;
parse_WARNINGS;
getopt
(
# Operation modes:
"o|output=s" => \$output,
"W|warnings=s" => \&parse_warnings,
"m|mode=s" => \$mode,
"M|melt" => \$melt,
# Library directories:
"B|prepend-include=s" => \@prepend_include,
"I|include=s" => \@include,
# Tracing:
# Using a hash for traces is seducing. Unfortunately, upon `-t FOO',
# instead of mapping `FOO' to undef, Getopt maps it to `1', preventing
# us from distinguishing `-t FOO' from `-t FOO=1'. So let's do it
# by hand.
"t|trace=s" => \@trace,
"p|preselect=s" => \@preselect,
# Freezing.
"F|freeze" => \$freeze,
# Caching.
"C|cache=s" => \$cache,
"no-cache" => sub { $cache = undef; },
);
fatal "too few arguments
Try `$me --help' for more information."
unless @ARGV;
# Freezing:
# We cannot trace at the same time (well, we can, but it sounds insane).
# And it implies melting: there is risk not to update properly using
# old frozen files, and worse yet: we could load a frozen file and
# refreeze it! A sort of caching :)
fatal "cannot freeze and trace"
if $freeze && @trace;
$melt = 1
if $freeze;
# Names of the cache directory, cache directory index, trace cache
# prefix, and output cache prefix. If the cache is not to be
# preserved, default to a temporary directory (automatically removed
# on exit).
$cache = $tmp
unless $cache;
$icache = "$cache/requests";
$tcache = "$cache/traces.";
$ocache = "$cache/output.";
# Normalize the includes: the first occurrence is enough, several is
# a pain since it introduces a useless difference in the path which
# invalidates the cache. And strip `.' which is implicit and always
# first.
@include = grep { !/^\.$/ } uniq (reverse(@prepend_include), @include);
# Convert @trace to %trace, and work around the M4 builtins tracing
# problem.
# The default format is `$f:$l:$n:$%'.
foreach (@trace)
{
/^([^:]+)(?::(.*))?$/ms;
$trace{$1} = defined $2 ? $2 : '$f:$l:$n:$%';
$trace{$m4_builtin_alternate_name{$1}} = $trace{$1}
if exists $m4_builtin_alternate_name{$1};
}
# Work around the M4 builtins tracing problem for @PRESELECT.
# FIXME: Is this still needed, now that we rely on M4 1.4.5?
push (@preselect,
map { $m4_builtin_alternate_name{$_} }
grep { exists $m4_builtin_alternate_name{$_} } @preselect);
# If we find frozen files, then all the files before it are
# discarded: the frozen file is supposed to include them all.
#
# We don't want to depend upon m4's --include to find the top level
# files, so we use `find_file' here. Try to get a canonical name,
# as it's part of the key for caching. And some files are optional
# (also handled by `find_file').
my @argv;
foreach (@ARGV)
{
if ($_ eq '-')
{
push @argv, $_;
}
elsif (/\.m4f$/)
{
# Frozen files are optional => pass a `?' to `find_file'.
my $file = find_file ("$_?", @include);
if (!$melt && $file)
{
@argv = ($file);
}
else
{
s/\.m4f$/.m4/;
push @argv, find_file ($_, @include);
}
}
else
{
my $file = find_file ($_, @include);
push @argv, $file
if $file;
}
}
@ARGV = @argv;
}
# handle_m4 ($REQ, @MACRO)
# ------------------------
# Run m4 on the input files, and save the traces on the @MACRO.
sub handle_m4 ($@)
{
my ($req, @macro) = @_;
# GNU m4 appends when using --debugfile/--error-output.
unlink ($tcache . $req->id . "t");
# Run m4.
#
# We don't output directly to the cache files, to avoid problems
# when we are interrupted (that leaves corrupted files).
xsystem ("$m4 --gnu"
. join (' --include=', '', map { shell_quote ($_) } @include)
. ' --debug=aflq'
. (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '')
. " --debugfile=" . shell_quote ("$tcache" . $req->id . "t")
. join (' --trace=', '', map { shell_quote ($_) } sort @macro)
. " " . files_to_options (@ARGV)
. " > " . shell_quote ("$ocache" . $req->id . "t"));
# Everything went ok: preserve the outputs.
foreach my $file (map { $_ . $req->id } ($tcache, $ocache))
{
use File::Copy;
move ("${file}t", "$file")
or fatal "cannot rename ${file}t as $file: $!";
}
}
# warn_forbidden ($WHERE, $WORD, %FORBIDDEN)
# ------------------------------------------
# $WORD is forbidden. Warn with a dedicated error message if in
# %FORBIDDEN, otherwise a simple `error: possibly undefined macro'
# will do.
my $first_warn_forbidden = 1;
sub warn_forbidden ($$%)
{
my ($where, $word, %forbidden) = @_;
my $message;
for my $re (sort keys %forbidden)
{
if ($word =~ $re)
{
$message = $forbidden{$re};
last;
}
}
$message ||= "possibly undefined macro: $word";
warn "$where: error: $message\n";
if ($first_warn_forbidden)
{
warn < 'forbid:$1:$2',
'm4_pattern_allow' => 'allow:$1'));
my @patterns = new Autom4te::XFile ("< " . open_quote ("$tmp/patterns"))->getlines;
chomp @patterns;
my %forbidden =
map { /^forbid:([^:]+):.+$/ => /^forbid:[^:]+:(.+)$/ } @patterns;
my $forbidden = join ('|', map { /^forbid:([^:]+)/ } @patterns) || "^\$";
my $allowed = join ('|', map { /^allow:([^:]+)/ } @patterns) || "^\$";
verb "forbidden tokens: $forbidden";
verb "forbidden token : $_ => $forbidden{$_}"
foreach (sort keys %forbidden);
verb "allowed tokens: $allowed";
# Read the (cached) raw M4 output, produce the actual result. We
# have to use the 2nd arg to have Autom4te::XFile honor the third, but then
# stdout is to be handled by hand :(. Don't use fdopen as it means
# we will close STDOUT, which we already do in END.
my $out = new Autom4te::XFile;
if ($output eq '-')
{
$out->open (">$output");
}
else
{
$out->open($output, O_CREAT | O_WRONLY | O_TRUNC, oct ($mode));
}
fatal "cannot create $output: $!"
unless $out;
my $in = new Autom4te::XFile ("< " . open_quote ($ocache . $req->id));
my %prohibited;
my $res;
while ($_ = $in->getline)
{
s/\s+$//;
s/__oline__/$./g;
s/\@<:\@/[/g;
s/\@:>\@/]/g;
s/\@\{:\@/(/g;
s/\@:\}\@/)/g;
s/\@S\|\@/\$/g;
s/\@%:\@/#/g;
$res = $_;
# Don't complain in comments. Well, until we have something
# better, don't consider `#include' etc. are comments.
s/\#.*//
unless /^\#\s*(if|include|endif|ifdef|ifndef|define)\b/;
foreach (split (/\W+/))
{
$prohibited{$_} = $.
if !/^$/ && /$forbidden/o && !/$allowed/o && ! exists $prohibited{$_};
}
# Performed *last*: the empty quadrigraph.
$res =~ s/\@&t\@//g;
print $out "$res\n";
}
$out->close();
# If no forbidden words, we're done.
return
if ! %prohibited;
# Locate the forbidden words in the last input file.
# This is unsatisfying but...
$exit_code = 1;
if ($ARGV[$#ARGV] ne '-')
{
my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
my $file = new Autom4te::XFile ("< " . open_quote ($ARGV[$#ARGV]));
while ($_ = $file->getline)
{
# Don't complain in comments. Well, until we have something
# better, don't consider `#include' etc. to be comments.
s/\#.*//
unless /^\#(if|include|endif|ifdef|ifndef|define)\b/;
# Complain once per word, but possibly several times per line.
while (/$prohibited/)
{
my $word = $1;
warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
delete $prohibited{$word};
# If we're done, exit.
return
if ! %prohibited;
$prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
}
}
}
warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden)
foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited);
}
## --------------------- ##
## Handling the traces. ##
## --------------------- ##
# $M4_MACRO
# trace_format_to_m4 ($FORMAT)
# ----------------------------
# Convert a trace $FORMAT into a M4 trace processing macro's body.
sub trace_format_to_m4 ($)
{
my ($format) = @_;
my $underscore = $_;
my %escape = (# File name.
'f' => '$1',
# Line number.
'l' => '$2',
# Depth.
'd' => '$3',
# Name (also available as $0).
'n' => '$4',
# Escaped dollar.
'$' => '$');
my $res = '';
$_ = $format;
while ($_)
{
# $n -> $(n + 4)
if (s/^\$(\d+)//)
{
$res .= "\$" . ($1 + 4);
}
# $x, no separator given.
elsif (s/^\$([fldn\$])//)
{
$res .= $escape{$1};
}
# $.x or ${sep}x.
elsif (s/^\$\{([^}]*)\}([@*%])//
|| s/^\$(.?)([@*%])//)
{
# $@, list of quoted effective arguments.
if ($2 eq '@')
{
$res .= ']at_at([' . ($1 ? $1 : ',') . '], $@)[';
}
# $*, list of unquoted effective arguments.
elsif ($2 eq '*')
{
$res .= ']at_star([' . ($1 ? $1 : ',') . '], $@)[';
}
# $%, list of flattened unquoted effective arguments.
elsif ($2 eq '%')
{
$res .= ']at_percent([' . ($1 ? $1 : ':') . '], $@)[';
}
}
elsif (/^(\$.)/)
{
error "invalid escape: $1";
}
else
{
s/^([^\$]+)//;
$res .= $1;
}
}
$_ = $underscore;
return '[[' . $res . ']]';
}
# handle_traces($REQ, $OUTPUT, %TRACE)
# ------------------------------------
# We use M4 itself to process the traces. But to avoid name clashes when
# processing the traces, the builtins are disabled, and moved into `at_'.
# Actually, all the low level processing macros are in `at_' (and `_at_').
# To avoid clashes between user macros and `at_' macros, the macros which
# implement tracing are in `AT_'.
#
# Having $REQ is needed to neutralize the macros which have been traced,
# but are not wanted now.
sub handle_traces ($$%)
{
my ($req, $output, %trace) = @_;
verb "formatting traces for `$output': " . join (', ', sort keys %trace);
# Processing the traces.
my $trace_m4 = new Autom4te::XFile ("> " . open_quote ("$tmp/traces.m4"));
$_ = <<'EOF';
divert(-1)
changequote([, ])
# _at_MODE(SEPARATOR, ELT1, ELT2...)
# ----------------------------------
# List the elements, separating then with SEPARATOR.
# MODE can be:
# `at' -- the elements are enclosed in brackets.
# `star' -- the elements are listed as are.
# `percent' -- the elements are `flattened': spaces are singled out,
# and no new line remains.
define([_at_at],
[at_ifelse([$#], [1], [],
[$#], [2], [[[$2]]],
[[[$2]][$1]$0([$1], at_shift(at_shift($@)))])])
define([_at_percent],
[at_ifelse([$#], [1], [],
[$#], [2], [at_flatten([$2])],
[at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])])
define([_at_star],
[at_ifelse([$#], [1], [],
[$#], [2], [[$2]],
[[$2][$1]$0([$1], at_shift(at_shift($@)))])])
# FLATTEN quotes its result.
# Note that the second pattern is `newline, tab or space'. Don't lose
# the tab!
define([at_flatten],
[at_patsubst(at_patsubst([[[$1]]], [\\\n]), [[\n\t ]+], [ ])])
define([at_args], [at_shift(at_shift(at_shift(at_shift(at_shift($@)))))])
define([at_at], [_$0([$1], at_args($@))])
define([at_percent], [_$0([$1], at_args($@))])
define([at_star], [_$0([$1], at_args($@))])
EOF
s/^ //mg;s/\\t/\t/mg;s/\\n/\n/mg;
print $trace_m4 $_;
# If you trace `define', then on `define([m4_exit], defn([m4exit])' you
# will produce
#
# AT_define([m4sugar.m4], [115], [1], [define], [m4_exit], )
#
# Since `' is not quoted, the outer m4, when processing
# `trace.m4' will exit prematurely. Hence, move all the builtins to
# the `at_' name space.
print $trace_m4 "# Copy the builtins.\n";
map { print $trace_m4 "define([at_$_], defn([$_]))\n" } @m4_builtin;
print $trace_m4 "\n";
print $trace_m4 "# Disable them.\n";
map { print $trace_m4 "at_undefine([$_])\n" } @m4_builtin;
print $trace_m4 "\n";
# Neutralize traces: we don't want traces of cached requests (%REQUEST).
print $trace_m4
"## -------------------------------------- ##\n",
"## By default neutralize all the traces. ##\n",
"## -------------------------------------- ##\n",
"\n";
print $trace_m4 "at_define([AT_$_], [at_dnl])\n"
foreach (sort keys %{$req->macro});
print $trace_m4 "\n";
# Implement traces for current requests (%TRACE).
print $trace_m4
"## ------------------------- ##\n",
"## Trace processing macros. ##\n",
"## ------------------------- ##\n",
"\n";
foreach (sort keys %trace)
{
# Trace request can be embed \n.
(my $comment = "Trace $_:$trace{$_}") =~ s/^/\# /;
print $trace_m4 "$comment\n";
print $trace_m4 "at_define([AT_$_],\n";
print $trace_m4 trace_format_to_m4 ($trace{$_}) . ")\n\n";
}
print $trace_m4 "\n";
# Reenable output.
print $trace_m4 "at_divert(0)at_dnl\n";
# Transform the traces from m4 into an m4 input file.
# Typically, transform:
#
# | m4trace:configure.ac:3: -1- AC_SUBST([exec_prefix], [NONE])
#
# into
#
# | AT_AC_SUBST([configure.ac], [3], [1], [AC_SUBST], [exec_prefix], [NONE])
#
# Pay attention that the file name might include colons, if under DOS
# for instance, so we don't use `[^:]+'.
my $traces = new Autom4te::XFile ("< " . open_quote ($tcache . $req->id));
while ($_ = $traces->getline)
{
# Trace with arguments, as the example above. We don't try
# to match the trailing parenthesis as it might be on a
# separate line.
s{^m4trace:(.+):(\d+): -(\d+)- ([^(]+)\((.*)$}
{AT_$4([$1], [$2], [$3], [$4], $5};
# Traces without arguments, always on a single line.
s{^m4trace:(.+):(\d+): -(\d+)- ([^)]*)\n$}
{AT_$4([$1], [$2], [$3], [$4])\n};
print $trace_m4 "$_";
}
$trace_m4->close;
my $in = new Autom4te::XFile ("$m4 " . shell_quote ("$tmp/traces.m4") . " |");
my $out = new Autom4te::XFile ("> " . open_quote ($output));
# This is dubious: should we really transform the quadrigraphs in
# traces? It might break balanced [ ] etc. in the output. The
# consensus seeems to be that traces are more useful this way.
while ($_ = $in->getline)
{
# It makes no sense to try to transform __oline__.
s/\@<:\@/[/g;
s/\@:>\@/]/g;
s/\@\{:\@/(/g;
s/\@:\}\@/)/g;
s/\@S\|\@/\$/g;
s/\@%:\@/#/g;
s/\@&t\@//g;
print $out $_;
}
}
# $BOOL
# up_to_date ($REQ)
# -----------------
# Are the cache files of $REQ up to date?
# $REQ is `valid' if it corresponds to the request and exists, which
# does not mean it is up to date. It is up to date if, in addition,
# its files are younger than its dependencies.
sub up_to_date ($)
{
my ($req) = @_;
return 0
if ! $req->valid;
my $tfile = $tcache . $req->id;
my $ofile = $ocache . $req->id;
# We can't answer properly if the traces are not computed since we
# need to know what other files were included. Actually, if any of
# the cache files is missing, we are not up to date.
return 0
if ! -f $tfile || ! -f $ofile;
# The youngest of the cache files must be older than the oldest of
# the dependencies.
my $tmtime = mtime ($tfile);
my $omtime = mtime ($ofile);
my ($file, $mtime) = ($tmtime < $omtime
? ($ofile, $omtime) : ($tfile, $tmtime));
# We depend at least upon the arguments.
my @dep = @ARGV;
# stdin is always out of date.
if (grep { $_ eq '-' } @dep)
{ return 0 }
# Files may include others. We can use traces since we just checked
# if they are available.
handle_traces ($req, "$tmp/dependencies",
('include' => '$1',
'm4_include' => '$1'));
my $deps = new Autom4te::XFile ("< " . open_quote ("$tmp/dependencies"));
while ($_ = $deps->getline)
{
chomp;
my $file = find_file ("$_?", @include);
# If a file which used to be included is no longer there, then
# don't say it's missing (it might no longer be included). But
# of course, that causes the output to be outdated (as if the
# time stamp of that missing file was newer).
return 0
if ! $file;
push @dep, $file;
}
# If $FILE is younger than one of its dependencies, it is outdated.
return up_to_date_p ($file, @dep);
}
## ---------- ##
## Freezing. ##
## ---------- ##
# freeze ($OUTPUT)
# ----------------
sub freeze ($)
{
my ($output) = @_;
# When processing the file with diversion disabled, there must be no
# output but comments and empty lines.
my $result = xqx ("$m4"
. ' --fatal-warning'
. join (' --include=', '', map { shell_quote ($_) } @include)
. ' --define=divert'
. " " . files_to_options (@ARGV)
. ' lock (LOCK_EX)
if ($flock_implemented eq "yes");
# Read the cache index if available and older than autom4te itself.
# If autom4te is younger, then some structures such as C4che might
# have changed, which would corrupt its processing.
Autom4te::C4che->load ($icache_file)
if -f $icache && mtime ($icache) > mtime ($0);
# Add the new trace requests.
my $req = Autom4te::C4che->request ('input' => \@ARGV,
'path' => \@include,
'macro' => [keys %trace, @preselect]);
# If $REQ's cache files are not up to date, or simply if the user
# discarded them (-f), declare it invalid.
$req->valid (0)
if $force || ! up_to_date ($req);
# We now know whether we can trust the Request object. Say it.
verb "the trace request object is:\n" . $req->marshall;
# We need to run M4 if (i) the user wants it (--force), (ii) $REQ is
# invalid.
handle_m4 ($req, keys %{$req->macro})
if $force || ! $req->valid;
# Issue the warnings each time autom4te was run.
my $separator = "\n" . ('-' x 25) . " END OF WARNING " . ('-' x 25) . "\n\n";
handle_traces ($req, "$tmp/warnings",
('_m4_warn' => "\$1::\$f:\$l::\$2::\$3$separator"));
# Swallow excessive newlines.
for (split (/\n*$separator\n*/o, contents ("$tmp/warnings")))
{
# The message looks like:
# | syntax::input.as:5::ouch
# | ::input.as:4: baz is expanded from...
# | input.as:2: bar is expanded from...
# | input.as:3: foo is expanded from...
# | input.as:5: the top level
# In particular, m4_warn guarantees that either $stackdump is empty, or
# it consists of lines where only the last line ends in "top level".
my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4);
msg $cat, $loc, "warning: $msg",
partial => ($stacktrace =~ /top level$/) + 0;
for (split /\n/, $stacktrace)
{
my ($loc, $trace) = split (': ', $_, 2);
msg $cat, $loc, $trace, partial => ($trace !~ /top level$/) + 0;
}
}
# Now output...
if (%trace)
{
# Always produce traces, since even if the output is young enough,
# there is no guarantee that the traces use the same *format*
# (e.g., `-t FOO:foo' and `-t FOO:bar' are both using the same M4
# traces, hence the M4 traces cache is usable, but its formatting
# will yield different results).
handle_traces ($req, $output, %trace);
}
else
{
# Actual M4 expansion, if the user wants it, or if $output is old
# (STDOUT is pretty old).
handle_output ($req, $output)
if $force || mtime ($output) < mtime ($ocache . $req->id);
}
# If we ran up to here, the cache is valid.
$req->valid (1);
Autom4te::C4che->save ($icache_file);
exit $exit_code;
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b80b000081ed0000000000000000000000014f7aa02c000021c20000010000010007ffffffffffffffff0000001e00000000root/usr/local/bin/autoheader #! /usr/local/bin/perl
# -*- Perl -*-
# Generated from autoheader.in; do not edit by hand.
eval 'case $# in 0) exec /usr/local/bin/perl -S "$0";; *) exec /usr/local/bin/perl -S "$0" "$@";; esac'
if 0;
# autoheader -- create `config.h.in' from `configure.ac'
# Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 3 of the License, 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, see .
# Written by Roland McGrath.
# Rewritten in Perl by Akim Demaille.
BEGIN
{
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/usr/local/share/autoconf';
unshift @INC, "$pkgdatadir";
# 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'} = '/bin/bash' if ($^O eq 'dos');
}
use Autom4te::ChannelDefs;
use Autom4te::Channels;
use Autom4te::Configure_ac;
use Autom4te::FileUtils;
use Autom4te::General;
use Autom4te::XFile;
use strict;
# Using `do FILE', we need `local' vars.
use vars qw ($config_h %verbatim %symbol);
# Lib files.
my $autom4te = $ENV{'AUTOM4TE'} || '/usr/local/bin/autom4te';
local $config_h;
my $config_h_in;
my @prepend_include;
my @include;
# $HELP
# -----
$help = "Usage: $0 [OPTION]... [TEMPLATE-FILE]
Create a template file of C \`\#define\' statements for \`configure\' to
use. To this end, scan TEMPLATE-FILE, or \`configure.ac\' if present,
or else \`configure.in\'.
-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
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
" . Autom4te::ChannelDefs::usage () . "
Library directories:
-B, --prepend-include=DIR prepend directory DIR to search path
-I, --include=DIR append directory DIR to search path
Report bugs to .
GNU Autoconf home page: .
General help using GNU software: .
";
# $VERSION
# --------
$version = "autoheader (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Roland McGrath and Akim Demaille.
";
## ---------- ##
## Routines. ##
## ---------- ##
# parse_args ()
# -------------
# Process any command line arguments.
sub parse_args ()
{
my $srcdir;
parse_WARNINGS;
getopt ('I|include=s' => \@include,
'B|prepend-include=s' => \@prepend_include,
'W|warnings=s' => \&parse_warnings);
if (! @ARGV)
{
my $configure_ac = require_configure_ac;
push @ARGV, $configure_ac;
}
}
## -------------- ##
## Main program. ##
## -------------- ##
mktmpdir ('ah');
switch_warning 'obsolete';
parse_args;
# Preach.
my $config_h_top = find_file ("config.h.top?",
reverse (@prepend_include), @include);
my $config_h_bot = find_file ("config.h.bot?",
reverse (@prepend_include), @include);
my $acconfig_h = find_file ("acconfig.h?",
reverse (@prepend_include), @include);
if ($config_h_top || $config_h_bot || $acconfig_h)
{
my $msg = << "END";
Using auxiliary files such as \`acconfig.h\', \`config.h.bot\'
and \`config.h.top\', to define templates for \`config.h.in\'
is deprecated and discouraged.
Using the third argument of \`AC_DEFINE\' and
\`AC_DEFINE_UNQUOTED\' allows one to define a template without
\`acconfig.h\':
AC_DEFINE([NEED_FUNC_MAIN], 1,
[Define if a function \`main\' is needed.])
More sophisticated templates can also be produced, see the
documentation.
END
$msg =~ s/^ /WARNING: /gm;
msg 'obsolete', $msg;
}
# Set up autoconf.
my $autoconf = "'$autom4te' --language=autoconf ";
$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
$autoconf .= ' --debug' if $debug;
$autoconf .= ' --force' if $force;
$autoconf .= ' --verbose' if $verbose;
# ----------------------- #
# Real work starts here. #
# ----------------------- #
# Source what the traces are trying to tell us.
verb "$me: running $autoconf to trace from $ARGV[0]";
my $quoted_tmp = shell_quote ($tmp);
xsystem ("$autoconf"
# If you change this list, update the
# `Autoheader-preselections' section of autom4te.in.
. ' --trace AC_CONFIG_HEADERS:\'$$config_h ||= \'"\'"\'$1\'"\'"\';\''
. ' --trace AH_OUTPUT:\'$$verbatim{\'"\'"\'$1\'"\'"\'} = \'"\'"\'$2\'"\'"\';\''
. ' --trace AC_DEFINE_TRACE_LITERAL:\'$$symbol{\'"\'"\'$1\'"\'"\'} = 1;\''
. " " . shell_quote ($ARGV[0]) . " >$quoted_tmp/traces.pl");
local (%verbatim, %symbol);
debug "$me: \`do'ing $tmp/traces.pl:\n" . `sed 's/^/| /' $quoted_tmp/traces.pl`;
do "$tmp/traces.pl";
warn "couldn't parse $tmp/traces.pl: $@" if $@;
unless ($config_h)
{
error "error: AC_CONFIG_HEADERS not found in $ARGV[0]";
exit 1;
}
# We template only the first CONFIG_HEADER.
$config_h =~ s/ .*//;
# Support "outfile[:infile]", defaulting infile="outfile.in".
($config_h, $config_h_in) = split (':', $config_h, 2);
$config_h_in ||= "$config_h.in";
# %SYMBOL might contain things like `F77_FUNC(name,NAME)', but we keep
# only the name of the macro.
%symbol = map { s/\(.*//; $_ => 1 } keys %symbol;
my $out = new Autom4te::XFile ("> " . open_quote ("$tmp/config.hin"));
# Don't write "do not edit" -- it will get copied into the
# config.h, which it's ok to edit.
print $out "/* $config_h_in. Generated from $ARGV[0] by autoheader. */\n";
# Dump the top.
if ($config_h_top)
{
my $in = new Autom4te::XFile ("< " . open_quote ($config_h_top));
while ($_ = $in->getline)
{
print $out $_;
}
}
# Dump `acconfig.h', except for its bottom portion.
if ($acconfig_h)
{
my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h));
while ($_ = $in->getline)
{
last if /\@BOTTOM\@/;
next if /\@TOP\@/;
print $out $_;
}
}
# Dump the templates from `configure.ac'.
foreach (sort keys %verbatim)
{
print $out "\n$verbatim{$_}\n";
}
# Dump bottom portion of `acconfig.h'.
if ($acconfig_h)
{
my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h));
my $dump = 0;
while ($_ = $in->getline)
{
print $out $_ if $dump;
$dump = 1 if /\@BOTTOM\@/;
}
}
# Dump the bottom.
if ($config_h_bot)
{
my $in = new Autom4te::XFile ("< " . open_quote ($config_h_bot));
while ($_ = $in->getline)
{
print $out $_;
}
}
$out->close;
# Check that all the symbols have a template.
{
my $in = new Autom4te::XFile ("< " . open_quote ("$tmp/config.hin"));
my $suggest_ac_define = 1;
while ($_ = $in->getline)
{
my ($symbol) = /^\#\s*\w+\s+(\w+)/
or next;
delete $symbol{$symbol};
}
foreach (sort keys %symbol)
{
msg 'syntax', "warning: missing template: $_";
if ($suggest_ac_define)
{
msg 'syntax', "Use AC_DEFINE([$_], [], [Description])";
$suggest_ac_define = 0;
}
}
exit 1
if keys %symbol;
}
update_file ("$tmp/config.hin", "$config_h_in", $force);
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b80e000081ed0000000000000000000000014f7aa02c000043490000010000010007ffffffffffffffff0000001c00000000root/usr/local/bin/autoscan #! /usr/local/bin/perl -w
# -*- perl -*-
# Generated from autoscan.in; do not edit by hand.
# autoscan - Create configure.scan (a preliminary configure.ac) for a package.
# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
# 2007, 2008, 2009, 2010 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 3 of the License, 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, see .
# Written by David MacKenzie .
eval 'case $# in 0) exec /usr/local/bin/perl -S "$0";; *) exec /usr/local/bin/perl -S "$0" "$@";; esac'
if 0;
BEGIN
{
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/usr/local/share/autoconf';
unshift @INC, $pkgdatadir;
# 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'} = '/bin/bash' if ($^O eq 'dos');
}
use Autom4te::ChannelDefs;
use Autom4te::Configure_ac;
use Autom4te::General;
use Autom4te::FileUtils;
use Autom4te::XFile;
use File::Basename;
use File::Find;
use strict;
use vars qw(@cfiles @makefiles @shfiles @subdirs %printed);
# The kind of the words we are looking for.
my @kinds = qw (function header identifier program
makevar librarie);
# For each kind, the default macro.
my %generic_macro =
(
'function' => 'AC_CHECK_FUNCS',
'header' => 'AC_CHECK_HEADERS',
'identifier' => 'AC_CHECK_TYPES',
'program' => 'AC_CHECK_PROGS',
'library' => 'AC_CHECK_LIB'
);
my %kind_comment =
(
'function' => 'Checks for library functions.',
'header' => 'Checks for header files.',
'identifier' => 'Checks for typedefs, structures, and compiler characteristics.',
'program' => 'Checks for programs.',
);
# $USED{KIND}{ITEM} is the list of locations where the ITEM (of KIND) was used
# in the user package.
# For instance $USED{function}{alloca} is the list of `file:line' where
# `alloca (...)' appears.
my %used = ();
# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.
# Initialized from lib/autoscan/*. E.g., $MACRO{function}{alloca} contains
# the singleton AC_FUNC_ALLOCA. Some require several checks.
my %macro = ();
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
# E.g., $NEEDED_MACROS{AC_FUNC_ALLOC} the list of `file:line' containing
# `alloca (...)'.
my %needed_macros =
(
'AC_PREREQ' => [$me],
);
my $configure_scan = 'configure.scan';
my $log;
# Autoconf and lib files.
my $autom4te = $ENV{'AUTOM4TE'} || '/usr/local/bin/autom4te';
my $autoconf = "$autom4te --language=autoconf";
my @prepend_include;
my @include = ('/usr/local/share/autoconf');
# $help
# -----
$help = "Usage: $0 [OPTION]... [SRCDIR]
Examine source files in the directory tree rooted at SRCDIR, or the
current directory if none is given. Search the source files for
common portability problems, check for incompleteness of
`configure.ac', and create a file `$configure_scan' which is a
preliminary `configure.ac' for that package.
-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
Library directories:
-B, --prepend-include=DIR prepend directory DIR to search path
-I, --include=DIR append directory DIR to search path
Report bugs to .
GNU Autoconf home page: .
General help using GNU software: .
";
# $version
# --------
$version = "autoscan (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
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.
";
## ------------------------ ##
## Command line interface. ##
## ------------------------ ##
# parse_args ()
# -------------
# Process any command line arguments.
sub parse_args ()
{
getopt ('I|include=s' => \@include,
'B|prepend-include=s' => \@prepend_include);
die "$me: too many arguments
Try `$me --help' for more information.\n"
if @ARGV > 1;
my $srcdir = $ARGV[0] || ".";
verb "srcdir = $srcdir";
chdir $srcdir || error "cannot cd to $srcdir: $!";
}
# init_tables ()
# --------------
# Put values in the tables of what to do with each token.
sub init_tables ()
{
# The data file format supports only one line of macros per function.
# If more than that is required for a common portability problem,
# a new Autoconf macro should probably be written for that case,
# instead of duplicating the code in lots of configure.ac files.
my $file = find_file ("autoscan/autoscan.list",
reverse (@prepend_include), @include);
my $table = new Autom4te::XFile "< " . open_quote ($file);
my $tables_are_consistent = 1;
while ($_ = $table->getline)
{
# Ignore blank lines and comments.
next
if /^\s*$/ || /^\s*\#/;
# ': ' or...
# ': warn: '.
if (/^(\S+):\s+(\S+)\s+(\S.*)$/)
{
my ($kind, $word, $macro) = ($1, $2, $3);
error "$file:$.: invalid kind: $_"
unless grep { $_ eq $kind } @kinds;
push @{$macro{$kind}{$word}}, $macro;
}
else
{
error "$file:$.: invalid definition: $_";
}
}
if ($debug)
{
foreach my $kind (@kinds)
{
foreach my $word (sort keys %{$macro{$kind}})
{
print "$kind: $word: @{$macro{$kind}{$word}}\n";
}
}
}
}
# used ($KIND, $WORD, [$WHERE])
# -----------------------------
# $WORD is used as a $KIND.
sub used ($$;$)
{
my ($kind, $word, $where) = @_;
$where ||= "$File::Find::name:$.";
if (
# Check for all the libraries. But `-links' is certainly a
# `find' argument, and `-le', a `test' argument.
($kind eq 'library' && $word !~ /^(e|inks)$/)
# Other than libraries are to be checked only if listed in
# the Autoscan library files.
|| defined $macro{$kind}{$word}
)
{
push (@{$used{$kind}{$word}}, $where);
}
}
## ----------------------- ##
## Scanning source files. ##
## ----------------------- ##
# scan_c_file ($FILE-NAME)
# ------------------------
sub scan_c_file ($)
{
my ($file_name) = @_;
push @cfiles, $File::Find::name;
# Nonzero if in a multiline comment.
my $in_comment = 0;
my $file = new Autom4te::XFile "< " . open_quote ($file_name);
while ($_ = $file->getline)
{
# Strip out comments.
if ($in_comment && s,^.*?\*/,,)
{
$in_comment = 0;
}
# The whole line is inside a commment.
next if $in_comment;
# All on one line.
s,/\*.*?\*/,,g;
# Starting on this line.
if (s,/\*.*$,,)
{
$in_comment = 1;
}
# Preprocessor directives.
if (s/^\s*\#\s*//)
{
if (/^include\s*<([^>]*)>/)
{
used ('header', $1);
}
if (s/^(if|ifdef|ifndef|elif)\s+//)
{
foreach my $word (split (/\W+/))
{
used ('identifier', $word)
unless $word eq 'defined' || $word !~ /^[a-zA-Z_]/;
}
}
# Ignore other preprocessor directives.
next;
}
# Remove string and character constants.
s,\"[^\"]*\",,g;
s,\'[^\']*\',,g;
# Tokens in the code.
# Maybe we should ignore function definitions (in column 0)?
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
{
used ('function', $1);
}
while (s/\b([a-zA-Z_]\w*)\b/ /)
{
used ('identifier', $1);
}
}
$file->close;
}
# scan_makefile($MAKEFILE-NAME)
# -----------------------------
sub scan_makefile ($)
{
my ($file_name) = @_;
push @makefiles, $File::Find::name;
my $file = new Autom4te::XFile "< " . open_quote ($file_name);
while ($_ = $file->getline)
{
# Strip out comments.
s/#.*//;
# Variable assignments.
while (s/\b([a-zA-Z_]\w*)\s*=/ /)
{
used ('makevar', $1);
}
# Be sure to catch a whole word. For instance `lex$U.$(OBJEXT)'
# is a single token. Otherwise we might believe `lex' is needed.
foreach my $word (split (/\s+/))
{
# Libraries.
if ($word =~ /^-l([a-zA-Z_]\w*)$/)
{
used ('library', $1);
}
# Tokens in the code.
# We allow some additional characters, e.g., `+', since
# autoscan/programs includes `c++'.
if ($word =~ /^[a-zA-Z_][\w+]*$/)
{
used ('program', $word);
}
}
}
$file->close;
}
# scan_sh_file($SHELL-SCRIPT-NAME)
# --------------------------------
sub scan_sh_file ($)
{
my ($file_name) = @_;
push @shfiles, $File::Find::name;
my $file = new Autom4te::XFile "< " . open_quote ($file_name);
while ($_ = $file->getline)
{
# Strip out comments and variable references.
s/#.*//;
s/\${[^\}]*}//g;
s/@[^@]*@//g;
# Tokens in the code.
while (s/\b([a-zA-Z_]\w*)\b/ /)
{
used ('program', $1);
}
}
$file->close;
}
# scan_file ()
# ------------
# Called by &find on each file. $_ contains the current file name with
# the current directory of the walk through.
sub scan_file ()
{
# Wanted only if there is no corresponding FILE.in.
return
if -f "$_.in";
# Save $_ as Find::File requires it to be preserved.
local $_ = $_;
# Strip a useless leading `./'.
$File::Find::name =~ s,^\./,,;
if ($_ ne '.' and -d $_ and
-f "$_/configure.in" ||
-f "$_/configure.ac" ||
-f "$_/configure.gnu" ||
-f "$_/configure")
{
$File::Find::prune = 1;
push @subdirs, $File::Find::name;
}
if (/\.[chlym](\.in)?$/)
{
used 'program', 'cc', $File::Find::name;
scan_c_file ($_);
}
elsif (/\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H|yy|ypp|ll|lpp)(\.in)?$/)
{
used 'program', 'c++', $File::Find::name;
scan_c_file ($_);
}
elsif ((/^((?:GNUm|M|m)akefile)(\.in)?$/ && ! -f "$1.am")
|| /^(?:GNUm|M|m)akefile(\.am)?$/)
{
scan_makefile ($_);
}
elsif (/\.sh(\.in)?$/)
{
scan_sh_file ($_);
}
}
# scan_files ()
# -------------
# Read through the files and collect lists of tokens in them
# that might create nonportabilities.
sub scan_files ()
{
find (\&scan_file, '.');
if ($verbose)
{
print "cfiles: @cfiles\n";
print "makefiles: @makefiles\n";
print "shfiles: @shfiles\n";
foreach my $kind (@kinds)
{
print "\n$kind:\n";
foreach my $word (sort keys %{$used{$kind}})
{
print "$word: @{$used{$kind}{$word}}\n";
}
}
}
}
## ----------------------- ##
## Output configure.scan. ##
## ----------------------- ##
# output_kind ($FILE, $KIND)
# --------------------------
sub output_kind ($$)
{
my ($file, $kind) = @_;
# Lists of words to be checked with the generic macro.
my @have;
print $file "\n# $kind_comment{$kind}\n"
if exists $kind_comment{$kind};
foreach my $word (sort keys %{$used{$kind}})
{
# Output the needed macro invocations in $configure_scan if not
# already printed, and remember these macros are needed.
foreach my $macro (@{$macro{$kind}{$word}})
{
if ($macro =~ /^warn:\s+(.*)/)
{
my $message = $1;
foreach my $location (@{$used{$kind}{$word}})
{
warn "$location: warning: $message\n";
}
}
elsif (exists $generic_macro{$kind}
&& $macro eq $generic_macro{$kind})
{
push (@have, $word);
push (@{$needed_macros{"$generic_macro{$kind}([$word])"}},
@{$used{$kind}{$word}});
}
else
{
if (! $printed{$macro})
{
print $file "$macro\n";
$printed{$macro} = 1;
}
push (@{$needed_macros{$macro}},
@{$used{$kind}{$word}});
}
}
}
print $file "$generic_macro{$kind}([" . join(' ', sort(@have)) . "])\n"
if @have;
}
# output_libraries ($FILE)
# ------------------------
sub output_libraries ($)
{
my ($file) = @_;
print $file "\n# Checks for libraries.\n";
foreach my $word (sort keys %{$used{'library'}})
{
print $file "# FIXME: Replace `main' with a function in `-l$word':\n";
print $file "AC_CHECK_LIB([$word], [main])\n";
}
}
# output ($CONFIGURE_SCAN)
# ------------------------
# Print a proto configure.ac.
sub output ($)
{
my $configure_scan = shift;
my %unique_makefiles;
my $file = new Autom4te::XFile "> " . open_quote ($configure_scan);
print $file
("# -*- Autoconf -*-\n" .
"# Process this file with autoconf to produce a configure script.\n" .
"\n" .
"AC_PREREQ([2.68])\n" .
"AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])\n");
if (defined $cfiles[0])
{
print $file "AC_CONFIG_SRCDIR([$cfiles[0]])\n";
print $file "AC_CONFIG_HEADERS([config.h])\n";
}
output_kind ($file, 'program');
output_kind ($file, 'makevar');
output_libraries ($file);
output_kind ($file, 'header');
output_kind ($file, 'identifier');
output_kind ($file, 'function');
print $file "\n";
if (@makefiles)
{
# Change DIR/Makefile.in to DIR/Makefile.
foreach my $m (@makefiles)
{
$m =~ s/\.(?:in|am)$//;
$unique_makefiles{$m}++;
}
print $file ("AC_CONFIG_FILES([",
join ("\n ",
sort keys %unique_makefiles), "])\n");
}
if (@subdirs)
{
print $file ("AC_CONFIG_SUBDIRS([",
join ("\n ",
sort @subdirs), "])\n");
}
print $file "AC_OUTPUT\n";
$file->close;
}
## --------------------------------------- ##
## Checking the accuracy of configure.ac. ##
## --------------------------------------- ##
# &check_configure_ac ($CONFIGURE_AC)
# -----------------------------------
# Use autoconf to check if all the suggested macros are included
# in CONFIGURE_AC.
sub check_configure_ac ($)
{
my ($configure_ac) = @_;
# Find what needed macros are invoked in CONFIGURE_AC.
# I'd be very happy if someone could explain to me why sort (uniq ...)
# doesn't work properly: I need `uniq (sort ...)'. --akim
my $trace_option =
join (' --trace=', '',
uniq (sort (map { s/\(.*//; $_ } keys %needed_macros)));
verb "running: $autoconf $trace_option $configure_ac";
my $traces =
new Autom4te::XFile "$autoconf $trace_option $configure_ac |";
while ($_ = $traces->getline)
{
chomp;
my ($file, $line, $macro, @args) = split (/:/, $_);
if ($macro =~ /^AC_CHECK_(HEADER|FUNC|TYPE|MEMBER)S$/)
{
# To be rigorous, we should distinguish between space and comma
# separated macros. But there is no point.
foreach my $word (split (/\s|,/, $args[0]))
{
# AC_CHECK_MEMBERS wants `struct' or `union'.
if ($macro eq "AC_CHECK_MEMBERS"
&& $word =~ /^stat.st_/)
{
$word = "struct " . $word;
}
delete $needed_macros{"$macro([$word])"};
}
}
else
{
delete $needed_macros{$macro};
}
}
$traces->close;
# Report the missing macros.
foreach my $macro (sort keys %needed_macros)
{
warn ("$configure_ac: warning: missing $macro wanted by: "
. (${$needed_macros{$macro}}[0])
. "\n");
print $log "$me: warning: missing $macro wanted by: \n";
foreach my $need (@{$needed_macros{$macro}})
{
print $log "\t$need\n";
}
}
}
## -------------- ##
## Main program. ##
## -------------- ##
parse_args;
$log = new Autom4te::XFile "> " . open_quote ("$me.log");
$autoconf .= " --debug" if $debug;
$autoconf .= " --verbose" if $verbose;
$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
my $configure_ac = find_configure_ac;
init_tables;
scan_files;
output ('configure.scan');
if (-f $configure_ac)
{
check_configure_ac ($configure_ac);
}
# This close is really needed. For some reason, probably best named
# a bug, it seems that the dtor of $LOG is not called automatically
# at END. It results in a truncated file.
$log->close;
exit 0;
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b80a000081ed0000000000000000000000014f7aa02c000039440000010000010007ffffffffffffffff0000001c00000000root/usr/local/bin/autoconf #! /bin/sh
# Generated from autoconf.as by GNU Autoconf 2.68.
# Generated from autoconf.in; do not edit by hand.
# autoconf -- create `configure' using m4 macros
# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
# 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 3 of the License, 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, see .
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1"
as_suggested=""
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir/$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
break 2
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_error STATUS ERROR
# ------------------------
# Output "`basename $0`: error: ERROR" to stderr. Then exit the script with
# STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
## -------------------- ##
## Main body of script. ##
## -------------------- ##
usage="\
Usage: $0 [OPTION]... [TEMPLATE-FILE]
Generate a configuration script from a TEMPLATE-FILE if given, or
\`configure.ac' if present, or else \`configure.in'. Output is sent
to the standard output if TEMPLATE-FILE is given, else into
\`configure'.
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
-o, --output=FILE save output in FILE (stdout is the default)
-W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
Warning categories include:
\`cross' cross compilation issues
\`obsolete' obsolete constructs
\`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 error
The environment variables \`M4' and \`WARNINGS' are honored.
Library directories:
-B, --prepend-include=DIR prepend directory DIR to search path
-I, --include=DIR append directory DIR to search path
Tracing:
-t, --trace=MACRO[:FORMAT] report the list of calls to MACRO
-i, --initialization also trace Autoconf's initialization process
In tracing mode, no configuration script is created. FORMAT defaults
to \`\$f:\$l:\$n:\$%'; see \`autom4te --help' for information about FORMAT.
Report bugs to .
GNU Autoconf home page: .
General help using GNU software: ."
version="\
autoconf (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
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."
help="\
Try \`$as_me --help' for more information."
exit_missing_arg='
as_fn_error $? "option \`$1'\'' requires an argument$as_nl$help"'
# restore font-lock: '
# Variables.
: ${AUTOM4TE='/usr/local/bin/autom4te'}
autom4te_options=
outfile=
verbose=false
# Parse command line.
while test $# -gt 0 ; do
option=`expr "x$1" : 'x\(--[^=]*\)' \| \
"x$1" : 'x\(-.\)'`
optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
"x$1" : 'x-.\(.*\)'`
case $1 in
--version | -V )
echo "$version" ; exit ;;
--help | -h )
$as_echo "$usage"; exit ;;
--verbose | -v )
verbose=:
autom4te_options="$autom4te_options $1"; shift ;;
# Arguments passed as is to autom4te.
--debug | -d | \
--force | -f | \
--include=* | -I?* | \
--prepend-include=* | -B?* | \
--warnings=* | -W?* )
case $1 in
*\'*) arg=`$as_echo "$1" | sed "s/'/'\\\\\\\\''/g"` ;; #'
*) arg=$1 ;;
esac
autom4te_options="$autom4te_options '$arg'"; shift ;;
# Options with separated arg passed as is to autom4te.
--include | -I | \
--prepend-include | -B | \
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
case $2 in
*\'*) arg=`$as_echo "$2" | sed "s/'/'\\\\\\\\''/g"` ;; #'
*) arg=$2 ;;
esac
autom4te_options="$autom4te_options $option '$arg'"
shift; shift ;;
--trace=* | -t?* )
traces="$traces --trace='"`$as_echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--trace | -t )
test $# = 1 && eval "$exit_missing_arg"
traces="$traces --trace='"`$as_echo "$2" | sed "s/'/'\\\\\\\\''/g"`"'"
shift; shift ;;
--initialization | -i )
autom4te_options="$autom4te_options --melt"
shift;;
--output=* | -o?* )
outfile=$optarg
shift ;;
--output | -o )
test $# = 1 && eval "$exit_missing_arg"
outfile=$2
shift; shift ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
exec >&2
as_fn_error $? "invalid option \`$1'$as_nl$help" ;; #`
* )
break ;;
esac
done
# Find the input file.
case $# in
0)
if test -f configure.ac; then
if test -f configure.in; then
$as_echo "$as_me: warning: both \`configure.ac' and \`configure.in' are present." >&2
$as_echo "$as_me: warning: proceeding with \`configure.ac'." >&2
fi
infile=configure.ac
elif test -f configure.in; then
infile=configure.in
else
as_fn_error $? "no input file"
fi
test -z "$traces" && test -z "$outfile" && outfile=configure;;
1)
infile=$1 ;;
*) exec >&2
as_fn_error $? "invalid number of arguments$as_nl$help" ;;
esac
# Unless specified, the output is stdout.
test -z "$outfile" && outfile=-
# Run autom4te with expansion.
eval set x "$autom4te_options" \
--language=autoconf --output=\"\$outfile\" "$traces" \"\$infile\"
shift
$verbose && $as_echo "$as_me: running $AUTOM4TE $*" >&2
exec "$AUTOM4TE" "$@"
0707010009b80f000081ed0000000000000000000000014f7aa02c000084bb0000010000010007ffffffffffffffff0000001e00000000root/usr/local/bin/autoupdate #! /usr/local/bin/perl -w
# -*- perl -*-
# Generated from autoupdate.in; do not edit by hand.
# autoupdate - modernize an Autoconf file.
# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
# 2007, 2008, 2009, 2010 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 3 of the License, 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, see .
# Originally written by David MacKenzie .
# Rewritten by Akim Demaille .
eval 'case $# in 0) exec /usr/local/bin/perl -S "$0";; *) exec /usr/local/bin/perl -S "$0" "$@";; esac'
if 0;
BEGIN
{
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/usr/local/share/autoconf';
unshift @INC, $pkgdatadir;
# 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'} = '/bin/bash' if ($^O eq 'dos');
}
use Autom4te::ChannelDefs;
use Autom4te::Channels;
use Autom4te::Configure_ac;
use Autom4te::FileUtils;
use Autom4te::General;
use Autom4te::XFile;
use File::Basename;
use strict;
# Lib files.
my $autom4te = $ENV{'AUTOM4TE'} || '/usr/local/bin/autom4te';
my $autoconf = "$autom4te --language=autoconf";
# We need to find m4sugar.
my @prepend_include;
my @include = ('/usr/local/share/autoconf');
my $force = 0;
# m4.
my $m4 = $ENV{"M4"} || '/usr/local/bin/m4';
# $HELP
# -----
$help = "Usage: $0 [OPTION]... [TEMPLATE-FILE]...
Update each TEMPLATE-FILE if given, or `configure.ac' if present,
or else `configure.in', to the syntax of the current version of
Autoconf. The original files are backed up.
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
Library directories:
-B, --prepend-include=DIR prepend directory DIR to search path
-I, --include=DIR append directory DIR to search path
Report bugs to .
GNU Autoconf home page: .
General help using GNU software: .
";
# $VERSION
# --------
$version = "autoupdate (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
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.
";
## ---------- ##
## Routines. ##
## ---------- ##
# parse_args ()
# -------------
# Process any command line arguments.
sub parse_args ()
{
my $srcdir;
getopt ('I|include=s' => \@include,
'B|prepend-include=s' => \@prepend_include,
'f|force' => \$force);
if (! @ARGV)
{
my $configure_ac = require_configure_ac;
push @ARGV, $configure_ac;
}
}
# ----------------- #
# Autoconf macros. #
# ----------------- #
my (%ac_macros, %au_macros, %m4_builtins);
# HANDLE_AUTOCONF_MACROS ()
# -------------------------
# @M4_BUILTINS -- M4 builtins and a useful comment.
sub handle_autoconf_macros ()
{
# Get the builtins.
xsystem ("echo dumpdef | $m4 2>" . shell_quote ("$tmp/m4.defs") . " >/dev/null");
my $m4_defs = new Autom4te::XFile "< " . open_quote ("$tmp/m4.defs");
while ($_ = $m4_defs->getline)
{
$m4_builtins{$1} = 1
if /^(\w+):/;
}
$m4_defs->close;
my $macros = new Autom4te::XFile ("$autoconf"
. " --trace AU_DEFINE:'AU:\$f:\$1'"
. " --trace define:'AC:\$f:\$1'"
. " --melt /dev/null |");
while ($_ = $macros->getline)
{
chomp;
my ($domain, $file, $macro) = /^(AC|AU):(.*):([^:]*)$/ or next;
if ($domain eq "AU")
{
$au_macros{$macro} = 1;
}
elsif ($file =~ /(^|\/)m4sugar\/(m4sugar|version)\.m4$/)
{
# Add the m4sugar macros to m4_builtins.
$m4_builtins{$macro} = 1;
}
else
{
# Autoconf, aclocal, and m4sh macros.
$ac_macros{$macro} = 1;
}
}
$macros->close;
# Don't keep AU macros in @AC_MACROS.
delete $ac_macros{$_}
foreach (keys %au_macros);
# Don't keep M4sugar macros which are redefined by Autoconf,
# such as `builtin', `changequote' etc. See autoconf/autoconf.m4.
delete $ac_macros{$_}
foreach (keys %m4_builtins);
error "no current Autoconf macros found"
unless keys %ac_macros;
error "no obsolete Autoconf macros found"
unless keys %au_macros;
if ($debug)
{
print STDERR "Current Autoconf macros:\n";
print STDERR join (' ', sort keys %ac_macros) . "\n\n";
print STDERR "Obsolete Autoconf macros:\n";
print STDERR join (' ', sort keys %au_macros) . "\n\n";
}
# ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded).
# unac.m4 -- undefine the AC macros.
my $ac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/ac.m4");
print $ac_m4 "# ac.m4 -- autoquoting definitions of the AC macros.\n";
my $unac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unac.m4");
print $unac_m4 "# unac.m4 -- undefine the AC macros.\n";
foreach (sort keys %ac_macros)
{
print $ac_m4 "_au_m4_define([$_], [m4_if(\$#, 0, [[\$0]], [[\$0(\$\@)]])])\n";
print $unac_m4 "_au_m4_undefine([$_])\n";
}
# m4save.m4 -- save the m4 builtins.
# unm4.m4 -- disable the m4 builtins.
# m4.m4 -- enable the m4 builtins.
my $m4save_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/m4save.m4");
print $m4save_m4 "# m4save.m4 -- save the m4 builtins.\n";
my $unm4_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unm4.m4");
print $unm4_m4 "# unm4.m4 -- disable the m4 builtins.\n";
my $m4_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/m4.m4");
print $m4_m4 "# m4.m4 -- enable the m4 builtins.\n";
foreach (sort keys %m4_builtins)
{
print $m4save_m4 "_au__save([$_])\n";
print $unm4_m4 "_au__undefine([$_])\n";
print $m4_m4 "_au__restore([$_])\n";
}
}
## -------------- ##
## Main program. ##
## -------------- ##
parse_args;
$autoconf .= " --debug" if $debug;
$autoconf .= " --force" if $force;
$autoconf .= " --verbose" if $verbose;
$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
mktmpdir ('au');
handle_autoconf_macros;
# $au_changequote -- enable the quote `[', `]' right before any AU macro.
my $au_changequote =
's/\b(' . join ('|', keys %au_macros) . ')\b/_au_m4_changequote([,])$1/g';
# au.m4 -- definitions the AU macros.
xsystem ("$autoconf --trace AU_DEFINE:'_au_defun(\@<:\@\$1\@:>\@,
\@<:\@\$2\@:>\@)' --melt /dev/null "
. ">" . shell_quote ("$tmp/au.m4"));
## ------------------- ##
## Process the files. ##
## ------------------- ##
foreach my $file (@ARGV)
{
# We need an actual file.
if ($file eq '-')
{
$file = "$tmp/stdin";
system "cat >" . shell_quote ($file);
}
elsif (! -r "$file")
{
die "$me: $file: No such file or directory";
}
# input.m4 -- m4 program to produce the updated file.
# Load the values, the dispatcher, neutralize m4, and the prepared
# input file.
my $input_m4 = <<\EOF;
divert(-1) -*- Autoconf -*-
changequote([,])
# Define our special macros:
define([_au__defn], defn([defn]))
define([_au__divert], defn([divert]))
define([_au__ifdef], defn([ifdef]))
define([_au__include], defn([include]))
define([_au___undefine], defn([undefine]))
define([_au__undefine], [_au__ifdef([$1], [_au___undefine([$1])])])
define([_au__save], [m4_ifdef([$1],
[m4_define([_au_$1], _m4_defn([$1]))])])
define([_au__restore],
[_au_m4_ifdef([_au_$1],
[_au_m4_define([$1], _au__defn([_au_$1]))])])
# Set up m4sugar.
include(m4sugar/m4sugar.m4)
# Redefine __file__ to make warnings nicer; $file is replaced below.
m4_define([__file__], [$file])
# Redefine m4_location to fix the line number.
m4_define([m4_location], [__file__:m4_eval(__line__ - _au__first_line)])
# Move all the builtins into the `_au_' pseudo namespace
m4_include([m4save.m4])
# _au_defun(NAME, BODY)
# ---------------------
# Define NAME to BODY, plus AU activation/deactivation.
_au_m4_define([_au_defun],
[_au_m4_define([$1],
[_au_enable()dnl
$2[]dnl
_au_disable()])])
# Import the definition of the obsolete macros.
_au__include([au.m4])
## ------------------------ ##
## _au_enable/_au_disable. ##
## ------------------------ ##
# They work by pair: each time an AU macro is activated, it runs
# _au_enable, and at its end its runs _au_disable (see _au_defun
# above). AU macros might use AU macros, which should
# enable/disable only for the outer AU macros.
#
# `_au_enabled' is used to this end, determining whether we really
# enable/disable.
# __au_enable
# -----------
# Reenable the builtins, m4sugar, and the autoquoting AC macros.
_au_m4_define([__au_enable],
[_au__divert(-1)
# Enable special characters.
_au_m4_changecom([#])
_au__include([m4.m4])
_au__include([ac.m4])
_au__divert(0)])
# _au_enable
# ----------
# Called at the beginning of all the obsolete macros. If this is the
# outermost level, call __au_enable.
_au_m4_define([_au_enable],
[_au_m4_ifdef([_au_enabled],
[],
[__au_enable()])_au_dnl
_au_m4_pushdef([_au_enabled])])
# __au_disable
# ------------
# Disable the AC autoquoting macros, m4sugar, and m4.
_au_m4_define([__au_disable],
[_au__divert(-1)
_au__include([unac.m4])
_au__include([unm4.m4])
# Disable special characters.
_au_m4_changequote()
_au_m4_changecom()
_au__divert(0)])
# _au_disable
# -----------
# Called at the end of all the obsolete macros. If we are at the
# outermost level, call __au_disable.
_au_m4_define([_au_disable],
[_au_m4_popdef([_au_enabled])_au_dnl
_au_m4_ifdef([_au_enabled],
[],
[__au_disable()])])
## ------------------------------- ##
## Disable, and process the file. ##
## ------------------------------- ##
# The AC autoquoting macros are not loaded yet, hence invoking
# `_au_disable' would be wrong.
_au__include([unm4.m4])
# Disable special characters, and set the first line number.
_au_m4_changequote()
_au_m4_changecom()
_au_m4_define(_au__first_line, _au___line__)_au__divert(0)_au_dnl
EOF
$input_m4 =~ s/^ //mg;
$input_m4 =~ s/\$file/$file/g;
# prepared input -- input, but reenables the quote before each AU macro.
open INPUT_M4, "> " . open_quote ("$tmp/input.m4")
or error "cannot open: $!";
open FILE, "< " . open_quote ($file)
or error "cannot open: $!";
print INPUT_M4 "$input_m4";
while ()
{
eval $au_changequote;
print INPUT_M4;
}
close FILE
or error "cannot close $file: $!";
close INPUT_M4
or error "cannot close $tmp/input.m4: $!";
# Now ask m4 to perform the update.
xsystem ("$m4 --include=" . shell_quote ($tmp)
. join (' --include=', '', map { shell_quote ($_) } reverse (@prepend_include))
. join (' --include=', '', map { shell_quote ($_) } @include)
. " " . shell_quote ("$tmp/input.m4") . " > " . shell_quote ("$tmp/updated"));
update_file ("$tmp/updated",
"$file" eq "$tmp/stdin" ? '-' : "$file");
}
exit 0;
# ## ---------------------------- ##
# ## How `autoupdate' functions. ##
# ## ---------------------------- ##
#
# The task of `autoupdate' is not trivial: the biggest difficulty being
# that you must limit the changes to the parts that really need to be
# updated. Finding a satisfying implementation proved to be quite hard,
# as this is the fifth implementation of `autoupdate'.
#
# Below, we will use a simple example of an obsolete macro:
#
# AU_DEFUN([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))])
# AC_DEFUN([NEW], [echo "sum($1) = $2"])
#
# the input file contains
#
# dnl The Unbelievable Truth
# OLD(1, 2)
# NEW([0, 0], [0])
#
# Of course the expected output is
#
# dnl The Unbelievable Truth
# NEW([1, 2], [3])
# NEW([0, 0], [0])
#
#
# # First implementation: sed
# # =========================
#
# The first implementation was only able to change the name of obsolete
# macros.
#
# The file `acoldnames.m4' defined the old names based on the new names.
# It was simple then to produce a sed script such as:
#
# s/OLD/NEW/g
#
# Updating merely consisted in running this script on the file to
# update.
#
# This scheme suffers from an obvious limitation: that `autoupdate' was
# unable to cope with new macros that just swap some of its arguments
# compared to the old macro. Fortunately, that was enough to upgrade
# from Autoconf 1 to Autoconf 2. (But I have no idea whether the
# changes in Autoconf 2 were precisely limited by this constraint.)
#
#
# # Second implementation: hooks
# # ============================
#
# The version 2.15 of Autoconf brought a vast number of changes compared
# to 2.13, so a solution was needed. One could think of extending the
# `sed' scripts with specialized code for complex macros. However, this
# approach is of course full of flaws:
#
# a. the Autoconf maintainers have to write these snippets, which we
# just don't want to,
#
# b. I really don't think you'll ever manage to handle the quoting of
# m4 with a sed script.
#
# To satisfy a., let's remark that the code which implements the old
# features in term of the new feature is exactly the code which should
# replace the old code.
#
# To answer point b, as usual in the history of Autoconf, the answer, at
# least on the paper, is simple: m4 is the best tool to parse m4, so
# let's use m4.
#
# Therefore the specification is:
#
# I want to be able to tell Autoconf, well, m4, that the macro I
# am currently defining is an obsolete macro (so that the user is
# warned), and its code is the code to use when running autoconf,
# but that the very same code has to be used when running
# autoupdate. To summarize, the interface I want is
# `AU_DEFUN(OLD-NAME, NEW-CODE)'.
#
#
# Now for the technical details.
#
# When running autoconf, except for the warning, AU_DEFUN is basically
# AC_DEFUN.
#
# When running autoupdate, we want *only* OLD-NAMEs to be expanded.
# This obviously means that acgeneral.m4 and acspecific.m4 must not be
# loaded. Nonetheless, because we want to use a rich set of m4
# features, m4sugar.m4 is needed. Please note that the fact that
# Autoconf's macros are not loaded is positive on two points:
#
# - we do get an updated `configure.ac', not a `configure'!
#
# - the old macros are replaced by *calls* to the new-macros, not the
# body of the new macros, since their body is not defined!!!
# (Whoa, that's really beautiful!).
#
# Additionally we need to disable the quotes when reading the input for
# two reasons: first because otherwise `m4' will swallow the quotes of
# other macros:
#
# NEW([1, 2], 3)
# => NEW(1, 2, 3)
#
# and second, because we want to update the macro calls which are
# quoted, i.e., we want
#
# FOO([OLD(1, 2)])
# => FOO([NEW([1, 2], [3])])
#
# If we don't disable the quotes, only the macros called at the top
# level would be updated.
#
# So, let's disable the quotes.
#
# Well, not quite: m4sugar.m4 still needs to use quotes for some macros.
# Well, in this case, when running in autoupdate code, each macro first
# reestablishes the quotes, expands itself, and disables the quotes.
#
# Thinking a bit more, you realize that in fact, people may use `define',
# `ifelse' etc. in their files, and you certainly don't want to process
# them. Another example is `dnl': you don't want to remove the
# comments. You then realize you don't want exactly to import m4sugar:
# you want to specify when it is enabled (macros active), and disabled.
# m4sugar provides m4_disable/m4_enable to this end.
#
# You're getting close to it. Now remains one task: how to handle
# twofold definitions?
#
# Remember that the same AU_DEFUN must be understood in two different
# ways, the AC way, and the AU way.
#
# One first solution is to check whether acgeneral.m4 was loaded. But
# that's definitely not cute. Another is simply to install `hooks',
# that is to say, to keep in some place m4 knows, late `define' to be
# triggered *only* in AU mode.
#
# You first think of designing AU_DEFUN like this:
#
# 1. AC_DEFUN(OLD-NAME,
# [Warn the user OLD-NAME is obsolete.
# NEW-CODE])
#
# 2. Store for late AU binding([define(OLD_NAME,
# [Reestablish the quotes.
# NEW-CODE
# Disable the quotes.])])
#
# but this will not work: NEW-CODE probably uses $1, $2 etc. and these
# guys will be replaced with the argument of `Store for late AU binding'
# when you call it.
#
# I don't think there is a means to avoid this using this technology
# (remember that $1 etc. are *always* expanded in m4). You may also try
# to replace them with $[1] to preserve them for a later evaluation, but
# if `Store for late AU binding' is properly written, it will remain
# quoted till the end...
#
# You have to change technology. Since the problem is that `$1'
# etc. should be `consumed' right away, one solution is to define now a
# second macro, `AU_OLD-NAME', and to install a hook than binds OLD-NAME
# to AU_OLD-NAME. Then, autoupdate.m4 just need to run the hooks. By
# the way, the same method was used in autoheader.
#
#
# # Third implementation: m4 namespaces by m4sugar
# # ==============================================
#
# Actually, this implementation was just a clean up of the previous
# implementation: instead of defining hooks by hand, m4sugar was equipped
# with `namespaces'. What are they?
#
# Sometimes we want to disable some *set* of macros, and restore them
# later. We provide support for this via namespaces.
#
# There are basically three characters playing this scene: defining a
# macro in a namespace, disabling a namespace, and restoring a namespace
# (i.e., all the definitions it holds).
#
# Technically, to define a MACRO in NAMESPACE means to define the macro
# named `NAMESPACE::MACRO' to the VALUE. At the same time, we append
# `undefine(NAME)' in the macro named `m4_disable(NAMESPACE)', and
# similarly a binding of NAME to the value of `NAMESPACE::MACRO' in
# `m4_enable(NAMESPACE)'. These mechanisms allow to bind the macro of
# NAMESPACE and to unbind them at will.
#
# Of course this implementation is really inefficient: m4 has to grow
# strings which can become quickly huge, which slows it significantly.
#
# In particular one should avoid as much as possible to use `define' for
# temporaries. Now that `define' has quite a complex meaning, it is an
# expensive operations that should be limited to macros. Use
# `m4_define' for temporaries.
#
# Private copies of the macros we used in entering / exiting the m4sugar
# namespace. It is much more convenient than fighting with the renamed
# version of define etc.
#
#
#
# Those two implementations suffered from serious problems:
#
# - namespaces were really expensive, and incurred a major performance
# loss on `autoconf' itself, not only `autoupdate'. One solution
# would have been the limit the use of namespaces to `autoupdate', but
# that's again some complications on m4sugar, which really doesn't need
# this. So we wanted to get rid of the namespaces.
#
# - since the quotes were disabled, autoupdate was sometimes making
# wrong guesses, for instance on:
#
# foo([1, 2])
#
# m4 saw 2 arguments: `[1'and `2]'. A simple solution, somewhat
# fragile, is to reestablish the quotes right before all the obsolete
# macros, i.e., to use sed so that the previous text becomes
#
# changequote([, ])foo([1, 2])
#
# To this end, one wants to trace the definition of obsolete macros.
#
# It was there that the limitations of the namespace approach became
# painful: because it was a complex machinery playing a lot with the
# builtins of m4 (hence, quite fragile), tracing was almost impossible.
#
#
# So this approach was dropped.
#
#
# # The fourth implementation: two steps
# # ====================================
#
# If you drop the uses of namespaces, you no longer can compute the
# updated value, and replace the old call with it simultaneously.
#
# Obviously you will use m4 to compute the updated values, but you may
# use some other tool to achieve the replacement. Personally, I trust
# nobody but m4 to parse m4, so below, m4 will perform the two tasks.
#
# How can m4 be used to replace *some* macros calls with newer values.
# Well, that's dead simple: m4 should learn the definitions of obsolete
# macros, forget its builtins, disable the quotes, and then run on the
# input file, which amounts to doing this:
#
# divert(-1)dnl
# changequote([, ])
# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()])
# undefine([dnl])
# undefine([m4_eval])
# # Some more undefines...
# changequote()
# divert(0)dnl
# dnl The Unbelievable Truth
# changequote([, ])OLD(1, 2)
# NEW([0, 0],
# 0)
#
# which will result in
#
# dnl The Unbelievable Truth
# NEW(1, 2, m4_eval(1 + 2))
# NEW([0, 0],
# 0)
#
# Grpmh. Two problems. A minor problem: it would have been much better
# to have the `m4_eval' computed, and a major problem: you lost the
# quotation in the result.
#
# Let's address the big problem first. One solution is to define any
# modern macro to rewrite its calls with the proper quotation, thanks to
# `$@'. Again, tracing the `define's makes it possible to know which
# are these macros, so you input is:
#
# divert(-1)dnl
# changequote([, ])
# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()])
# define([NEW], [[NEW($@)]changequote()])
# undefine([dnl])
# undefine([m4_eval])
# # Some more undefines...
# changequote()
# divert(0)dnl
# dnl The Unbelievable Truth
# changequote([, ])OLD(1, 2)
# changequote([, ])NEW([0, 0],
# 0)
#
# which results in
#
# dnl The Unbelievable Truth
# NEW([1, 2],[m4_eval(1 + 2)])
# NEW([0, 0],[0])
#
# Our problem is solved, i.e., the first call to `NEW' is properly
# quoted, but introduced another problem: we changed the layout of the
# second calls, which can be a drama in the case of huge macro calls
# (think of `AC_TRY_RUN' for instance). This example didn't show it,
# but we also introduced parens to macros which did not have some:
#
# AC_INIT
# => AC_INIT()
#
# No big deal for the semantics (unless the macro depends upon $#, which
# is bad), but the users would not be happy.
#
# Additionally, we introduced quotes that were not there before, which is
# OK in most cases, but could change the semantics of the file.
#
# Cruel dilemma: we do want the auto-quoting definition of `NEW' when
# evaluating `OLD', but we don't when we evaluate the second `NEW'.
# Back to namespaces?
#
# No.
#
#
# # Second step: replacement
# # ------------------------
#
# No, as announced above, we will work in two steps: in a first step we
# compute the updated values, and in a second step we replace them. Our
# goal is something like this:
#
# divert(-1)dnl
# changequote([, ])
# define([OLD], [NEW([1, 2], [3])changequote()])
# undefine([dnl])
# undefine([m4_eval])
# # Some more undefines...
# changequote()
# divert(0)dnl
# dnl The Unbelievable Truth
# changequote([, ])OLD(1, 2)
# NEW([0, 0],
# 0)
#
# i.e., the new value of `OLD' is precomputed using the auto-quoting
# definition of `NEW' and the m4 builtins. We'll see how afterwards,
# let's finish with the replacement.
#
# Of course the solution above is wrong: if there were other calls to
# `OLD' with different values, we would smash them to the same value.
# But it is quite easy to generalize the scheme above:
#
# divert(-1)dnl
# changequote([, ])
# define([OLD([1],[2])], [NEW([1, 2], [3])])
# define([OLD], [defn([OLD($@)])changequote()])
# undefine([dnl])
# undefine([m4_eval])
# # Some more undefines...
# changequote()
# divert(0)dnl
# dnl The Unbelievable Truth
# changequote([, ])OLD(1, 2)
# NEW([0, 0],
# 0)
#
# i.e., for each call to obsolete macros, we build an array `call =>
# value', and use a macro to dispatch these values. This results in:
#
# dnl The Unbelievable Truth
# NEW([1, 2], [3])
# NEW([0, 0],
# 0)
#
# In French, we say `Youpi !', which you might roughly translate as
# `Yippee!'.
#
#
# # First step: computation
# # -----------------------
#
# Let's study the anatomy of the file, and name its sections:
#
# prologue
# divert(-1)dnl
# changequote([, ])
# values
# define([OLD([1],[2])], [NEW([1, 2], [3])])
# dispatcher
# define([OLD], [defn([OLD($@)])changequote()])
# disabler
# undefine([dnl])
# undefine([m4_eval])
# # Some more undefines...
# changequote()
# divert(0)dnl
# input
# dnl The Unbelievable Truth
# changequote([, ])OLD(1, 2)
# NEW([0, 0],
# 0)
#
#
# # Computing the `values' section
# # ..............................
#
# First we need to get the list of all the AU macro uses. To this end,
# first get the list of all the AU macros names by tracing `AU_DEFUN' in
# the initialization of autoconf. This list is computed in the file
# `au.txt' below.
#
# Then use this list to trace all the AU macro uses in the input. The
# goal is obtain in the case of our example:
#
# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)]
#
# This is the file `values.in' below.
#
# We want to evaluate this with only the builtins (in fact m4sugar), the
# auto-quoting definitions of the new macros (`new.m4'), and the
# definition of the old macros (`old.m4'). Computing these last two
# files is easy: it's just a matter of using the right `--trace' option.
#
# So the content of `values.in' is:
#
# include($autoconf_dir/m4sugar.m4)
# m4_include(new.m4)
# m4_include(old.m4)
# divert(0)dnl
# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)]
#
# We run m4 on it, which yields:
#
# define([OLD([1],[2])],@<<@NEW([1, 2], [3])@>>@)
#
# Transform `@<<@' and `@>>@' into quotes and we get
#
# define([OLD([1],[2])],[NEW([1, 2], [3])])
#
# This is `values.m4'.
#
#
# # Computing the `dispatcher' section
# # ..................................
#
# The `prologue', and the `disabler' are simple and need no commenting.
#
# To compute the `dispatcher' (`dispatch.m4'), again, it is a simple
# matter of using the right `--trace'.
#
# Finally, the input is not exactly the input file, rather it is the
# input file with the added `changequote'. To this end, we build
# `quote.sed'.
#
#
# # Putting it all together
# # .......................
#
# We build the file `input.m4' which contains:
#
# divert(-1)dnl
# changequote([, ])
# include(values.m4)
# include(dispatch.m4)
# undefine([dnl])
# undefine([eval])
# # Some more undefines...
# changequote()
# divert(0)dnl
# dnl The Unbelievable Truth
# changequote([, ])OLD(1, 2)
# NEW([0, 0],
# 0)
#
# And we just run m4 on it. Et voila`, Monsieur ! Mais oui, mais oui.
#
# Well, there are a few additional technicalities. For instance, we
# rely on `changequote', `ifelse' and `defn', but we don't want to
# interpret the changequotes of the user, so we simply use another name:
# `_au_changequote' etc.
#
#
# # Failure of the fourth approach
# # ------------------------------
#
# This approach is heavily based on traces, but then there is an obvious
# problem: non expanded code will never be seen. In particular, the body
# of a `define' definition is not seen, so on the input
#
# define([idem], [OLD(0, [$1])])
#
# autoupdate would never see the `OLD', and wouldn't have updated it.
# Worse yet, if `idem(0)' was used later, then autoupdate sees that
# `OLD' is used, computes the result for `OLD(0, 0)' and sets up a
# dispatcher for `OLD'. Since there was no computed value for `OLD(0,
# [$1])', the dispatcher would have replaced with... nothing, leading
# to
#
# define([idem], [])
#
# With some more thinking, you see that the two step approach is wrong,
# the namespace approach was much saner.
#
# But you learned a lot, in particular you realized that using traces
# can make it possible to simulate namespaces!
#
#
#
# # The fifth implementation: m4 namespaces by files
# # ================================================
#
# The fourth implementation demonstrated something unsurprising: you
# cannot precompute, i.e., the namespace approach was the right one.
# Still, we no longer want them, they're too expensive. Let's have a
# look at the way it worked.
#
# When updating
#
# dnl The Unbelievable Truth
# OLD(1, 2)
# NEW([0, 0], [0])
#
# you evaluate `input.m4':
#
# divert(-1)
# changequote([, ])
# define([OLD],
# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()])
# ...
# m4_disable()
# dnl The Unbelievable Truth
# OLD(1, 2)
# NEW([0, 0], [0])
#
# where `m4_disable' undefines the m4 and m4sugar, and disables the quotes
# and comments:
#
# define([m4_disable],
# [undefine([__file__])
# ...
# changecom(#)
# changequote()])
#
# `m4_enable' does the converse: reestablish quotes and comments
# --easy--, reestablish m4sugar --easy: just load `m4sugar.m4' again-- and
# reenable the builtins. This later task requires that you first save
# the builtins. And BTW, the definition above of `m4_disable' cannot
# work: you undefined `changequote' before using it! So you need to use
# your privates copies of the builtins. Let's introduce three files for
# this:
#
# `m4save.m4'
# moves the m4 builtins into the `_au_' pseudo namespace,
# `unm4.m4'
# undefines the builtins,
# `m4.m4'
# restores them.
#
# So `input.m4' is:
#
# divert(-1)
# changequote([, ])
#
# include([m4save.m4])
#
# # Import AU.
# define([OLD],
# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()])
#
# define([_au_enable],
# [_au_changecom([#])
# _au_include([m4.m4])
# _au_include(m4sugar.m4)])
#
# define([_au_disable],
# [# Disable m4sugar.
# # Disable the m4 builtins.
# _au_include([unm4.m4])
# # 1. Disable special characters.
# _au_changequote()
# _au_changecom()])
#
# m4_disable()
# dnl The Unbelievable Truth
# OLD(1, 2)
# NEW([0, 0], [0])
#
# Based on what we learned in the fourth implementation we know that we
# have to enable the quotes *before* any AU macro, and we know we need
# to build autoquoting versions of the AC macros. But the autoquoting
# AC definitions must be disabled in the rest of the file, and enabled
# inside AU macros.
#
# Using `autoconf --trace' it is easy to build the files
#
# `ac.m4'
# define the autoquoting AC fake macros
# `disable.m4'
# undefine the m4sugar and AC autoquoting macros.
# `au.m4'
# definitions of the AU macros (such as `OLD' above).
#
# Now, `input.m4' is:
#
# divert(-1)
# changequote([, ])
#
# include([m4save.m4])
# # Import AU.
# include([au.m4])
#
# define([_au_enable],
# [_au_changecom([#])
# _au_include([m4.m4])
# _au_include(m4sugar.m4)
# _au_include(ac.m4)])
#
# define([_au_disable],
# [_au_include([disable.m4])
# _au_include([unm4.m4])
# # 1. Disable special characters.
# _au_changequote()
# _au_changecom()])
#
# m4_disable()
# dnl The Unbelievable Truth
# _au_changequote([, ])OLD(1, 2)
# NEW([0, 0], [0])
#
# Finally, version V is ready.
#
# Well... almost.
#
# There is a slight problem that remains: if an AU macro OUTER includes
# an AU macro INNER, then _au_enable will be run when entering OUTER
# and when entering INNER (not good, but not too bad yet). But when
# getting out of INNER, _au_disable will disable everything while we
# were still in OUTER. Badaboom.
#
# Therefore _au_enable and _au_disable have to be written to work by
# pairs: each _au_enable pushdef's _au_enabled, and each _au_disable
# popdef's _au_enabled. And of course _au_enable and _au_disable are
# effective when _au_enabled is *not* defined.
#
# Finally, version V' is ready. And there is much rejoicing. (And I
# have free time again. I think. Yeah, right.)
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b811000041ed0000000000000000000000054f7aa049000000000000010000010007ffffffffffffffff0000001500000000root/usr/local/share 0707010009b812000041ed0000000000000000000000074f7aa049000000000000010000010007ffffffffffffffff0000001e00000000root/usr/local/share/autoconf 0707010009b813000041ed0000000000000000000000024f7aa049000000000000010000010007ffffffffffffffff0000002700000000root/usr/local/share/autoconf/Autom4te 0707010009b81c000081a40000000000000000000000014f7aa02c00001e790000010000010007ffffffffffffffff0000003000000000root/usr/local/share/autoconf/Autom4te/XFile.pm # Copyright (C) 2001, 2003, 2004, 2006, 2008, 2009, 2010 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, see .
# Written by Akim Demaille .
###############################################################
# The main copy of this file is in Automake's CVS repository. #
# Updates should be sent to automake-patches@gnu.org. #
###############################################################
package Autom4te::XFile;
=head1 NAME
Autom4te::XFile - supply object methods for filehandles with error handling
=head1 SYNOPSIS
use Autom4te::XFile;
$fh = new Autom4te::XFile;
$fh->open ("< file");
# No need to check $FH: we died if open failed.
print <$fh>;
$fh->close;
# No need to check the return value of close: we died if it failed.
$fh = new Autom4te::XFile "> file";
# No need to check $FH: we died if new failed.
print $fh "bar\n";
$fh->close;
$fh = new Autom4te::XFile "file", "r";
# No need to check $FH: we died if new failed.
defined $fh
print <$fh>;
undef $fh; # automatically closes the file and checks for errors.
$fh = new Autom4te::XFile "file", O_WRONLY | O_APPEND;
# No need to check $FH: we died if new failed.
print $fh "corge\n";
$pos = $fh->getpos;
$fh->setpos ($pos);
undef $fh; # automatically closes the file and checks for errors.
autoflush STDOUT 1;
=head1 DESCRIPTION
C inherits from C. It provides the method
C returning the file name. It provides dying versions of the
methods C, C (corresponding to C), C,
C, C, and C. It also overrides the C
and C methods to translate C<\r\n> to C<\n>.
=cut
require 5.000;
use strict;
use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA);
use Carp;
use Errno;
use IO::File;
use File::Basename;
use Autom4te::ChannelDefs;
use Autom4te::Channels qw(msg);
use Autom4te::FileUtils;
require Exporter;
require DynaLoader;
@ISA = qw(IO::File Exporter DynaLoader);
$VERSION = "1.2";
@EXPORT = @IO::File::EXPORT;
eval {
# Make all Fcntl O_XXX and LOCK_XXX constants available for importing
require Fcntl;
my @O = grep /^(LOCK|O)_/, @Fcntl::EXPORT, @Fcntl::EXPORT_OK;
Fcntl->import (@O); # first we import what we want to export
push (@EXPORT, @O);
};
=head2 Methods
=over
=item C<$fh = new Autom4te::XFile ([$expr, ...]>
Constructor a new XFile object. Additional arguments
are passed to C, if any.
=cut
sub new
{
my $type = shift;
my $class = ref $type || $type || "Autom4te::XFile";
my $fh = $class->SUPER::new ();
if (@_)
{
$fh->open (@_);
}
$fh;
}
=item C<$fh-Eopen ([$file, ...])>
Open a file, passing C<$file> and further arguments to C.
Die if opening fails. Store the name of the file. Use binmode for writing.
=cut
sub open
{
my $fh = shift;
my ($file) = @_;
# WARNING: Gross hack: $FH is a typeglob: use its hash slot to store
# the `name' of the file we are opening. See the example with
# io_socket_timeout in IO::Socket for more, and read Graham's
# comment in IO::Handle.
${*$fh}{'autom4te_xfile_file'} = "$file";
if (!$fh->SUPER::open (@_))
{
fatal "cannot open $file: $!";
}
# In case we're running under MSWindows, don't write with CRLF.
# (This circumvents a bug in at least Cygwin bash where the shell
# parsing fails on lines ending with the continuation character '\'
# and CRLF).
binmode $fh if $file =~ /^\s*>/;
}
=item C<$fh-Eclose>
Close the file, handling errors.
=cut
sub close
{
my $fh = shift;
if (!$fh->SUPER::close (@_))
{
my $file = $fh->name;
Autom4te::FileUtils::handle_exec_errors $file
unless $!;
fatal "cannot close $file: $!";
}
}
=item C<$line = $fh-Egetline>
Read and return a line from the file. Ensure C<\r\n> is translated to
C<\n> on input files.
=cut
# Some Win32/perl installations fail to translate \r\n to \n on input
# so we do that here.
sub getline
{
local $_ = $_[0]->SUPER::getline;
# Perform a _global_ replacement: $_ may can contains many lines
# in slurp mode ($/ = undef).
s/\015\012/\n/gs if defined $_;
return $_;
}
=item C<@lines = $fh-Egetlines>
Slurp lines from the files.
=cut
sub getlines
{
my @res = ();
my $line;
push @res, $line while $line = $_[0]->getline;
return @res;
}
=item C<$name = $fh-Ename>
Return the name of the file.
=cut
sub name
{
my $fh = shift;
return ${*$fh}{'autom4te_xfile_file'};
}
=item C<$fh-Elock>
Lock the file using C. If locking fails for reasons other than
C being unsupported, then error out if C<$ENV{'MAKEFLAGS'}> indicates
that we are spawned from a parallel C.
=cut
sub lock
{
my ($fh, $mode) = @_;
# Cannot use @_ here.
# Unless explicitly configured otherwise, Perl implements its `flock' with the
# first of flock(2), fcntl(2), or lockf(3) that works. These can fail on
# NFS-backed files, with ENOLCK (GNU/Linux) or EOPNOTSUPP (FreeBSD); we
# usually ignore these errors. If $ENV{MAKEFLAGS} suggests that a parallel
# invocation of `make' has invoked the tool we serve, report all locking
# failures and abort.
#
# On Unicos, flock(2) and fcntl(2) over NFS hang indefinitely when `lockd' is
# not running. NetBSD NFS clients silently grant all locks. We do not
# attempt to defend against these dangers.
#
# -j is for parallel BSD make, -P is for parallel HP-UX make.
if (!flock ($fh, $mode))
{
my $make_j = (exists $ENV{'MAKEFLAGS'}
&& " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*[jP]|--[jP]|---?jobs)/);
my $note = "\nforgo `make -j' or use a file system that supports locks";
my $file = $fh->name;
msg ($make_j ? 'fatal' : 'unsupported',
"cannot lock $file with mode $mode: $!" . ($make_j ? $note : ""))
if $make_j || !($!{ENOLCK} || $!{EOPNOTSUPP});
}
}
=item C<$fh-Eseek ($position, [$whence])>
Seek file to C<$position>. Die if seeking fails.
=cut
sub seek
{
my $fh = shift;
# Cannot use @_ here.
if (!seek ($fh, $_[0], $_[1]))
{
my $file = $fh->name;
fatal "cannot rewind $file with @_: $!";
}
}
=item C<$fh-Etruncate ($len)>
Truncate the file to length C<$len>. Die on failure.
=cut
sub truncate
{
my ($fh, $len) = @_;
if (!truncate ($fh, $len))
{
my $file = $fh->name;
fatal "cannot truncate $file at $len: $!";
}
}
=back
=head1 SEE ALSO
L,
L,
L
L
L
=head1 HISTORY
Derived from IO::File.pm by Akim Demaille EFE.
=cut
1;
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b817000081a40000000000000000000000014f7aa02c00000d290000010000010007ffffffffffffffff0000003700000000root/usr/local/share/autoconf/Autom4te/Configure_ac.pm # Copyright (C) 2003, 2005, 2006, 2009, 2010 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, see .
###############################################################
# The main copy of this file is in Automake's CVS repository. #
# Updates should be sent to automake-patches@gnu.org. #
###############################################################
package Autom4te::Configure_ac;
use strict;
use Exporter;
use Autom4te::Channels;
use Autom4te::ChannelDefs;
use vars qw (@ISA @EXPORT);
@ISA = qw (Exporter);
@EXPORT = qw (&find_configure_ac &require_configure_ac);
=head1 NAME
Autom4te::Configure_ac - Locate configure.ac or configure.in.
=head1 SYNOPSIS
use Autom4te::Configure_ac;
# Try to locate configure.in or configure.ac in the current
# directory. It may be absent. Complain if both files exist.
my $file_name = find_configure_ac;
# Likewise, but bomb out if the file does not exist.
my $file_name = require_configure_ac;
# Likewise, but in $dir.
my $file_name = find_configure_ac ($dir);
my $file_name = require_configure_ac ($dir);
=over 4
=back
=head2 Functions
=over 4
=item C<$configure_ac = find_configure_ac ([$directory])>
Find a F or F file in C<$directory>,
defaulting to the current directory. Complain if both files are present.
Return the name of the file found, or the former if neither is present.
=cut
sub find_configure_ac (;@)
{
my ($directory) = @_;
$directory ||= '.';
my $configure_ac =
File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.ac'));
my $configure_in =
File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.in'));
if (-f $configure_ac)
{
if (-f $configure_in)
{
msg ('unsupported',
"`$configure_ac' and `$configure_in' both present.\n"
. "proceeding with `$configure_ac'");
}
return $configure_ac
}
elsif (-f $configure_in)
{
return $configure_in;
}
return $configure_ac;
}
=item C<$configure_ac = require_configure_ac ([$directory])>
Like C, but fail if neither is present.
=cut
sub require_configure_ac (;$)
{
my $res = find_configure_ac (@_);
fatal "`configure.ac' or `configure.in' is required"
unless -f $res;
return $res
}
1;
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:
0707010009b819000081a40000000000000000000000014f7aa02c000025a00000010000010007ffffffffffffffff0000003200000000root/usr/local/share/autoconf/Autom4te/General.pm # autoconf -- create `configure' using m4 macros
# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2009, 2010 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 3 of the License, 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, see .
package Autom4te::General;
=head1 NAME
Autom4te::General - general support functions for Autoconf and Automake
=head1 SYNOPSIS
use Autom4te::General
=head1 DESCRIPTION
This perl module provides various general purpose support functions
used in several executables of the Autoconf and Automake packages.
=cut
use 5.005_03;
use Exporter;
use Autom4te::ChannelDefs;
use Autom4te::Channels;
use File::Basename;
use File::Path ();
use File::stat;
use IO::File;
use Carp;
use strict;
use vars qw (@ISA @EXPORT);
@ISA = qw (Exporter);
# Variables we define and export.
my @export_vars =
qw ($debug $force $help $me $tmp $verbose $version);
# Functions we define and export.
my @export_subs =
qw (&debug
&getopt &shell_quote &mktmpdir
&uniq);
# Functions we forward (coming from modules we use).
my @export_forward_subs =
qw (&basename &dirname &fileparse);
@EXPORT = (@export_vars, @export_subs, @export_forward_subs);
# Variable we share with the main package. Be sure to have a single
# copy of them: using `my' together with multiple inclusion of this
# package would introduce several copies.
=head2 Global Variables
=over 4
=item C<$debug>
Set this variable to 1 if debug messages should be enabled. Debug
messages are meant for developpers only, or when tracking down an
incorrect execution.
=cut
use vars qw ($debug);
$debug = 0;
=item C<$force>
Set this variable to 1 to recreate all the files, or to consider all
the output files are obsolete.
=cut
use vars qw ($force);
$force = undef;
=item C<$help>
Set to the help message associated with the option C<--help>.
=cut
use vars qw ($help);
$help = undef;
=item C<$me>
The name of this application, for diagnostic messages.
=cut
use vars qw ($me);
$me = basename ($0);
=item C<$tmp>
The name of the temporary directory created by C. Left
C otherwise.
=cut
# Our tmp dir.
use vars qw ($tmp);
$tmp = undef;
=item C<$verbose>
Enable verbosity messages. These messages are meant for ordinary
users, and typically make explicit the steps being performed.
=cut
use vars qw ($verbose);
$verbose = 0;
=item C<$version>
Set to the version message associated to the option C<--version>.
=cut
use vars qw ($version);
$version = undef;
=back
=cut
## ----- ##
## END. ##
## ----- ##
=head2 Functions
=over 4
=item C
Filter Perl's exit codes, delete any temporary directory (unless
C<$debug>), and exit nonzero whenever closing C fails.
=cut
# END
# ---
sub END
{
# $? contains the exit status we will return.
# It was set using one of the following ways:
#
# 1) normal termination
# this sets $? = 0
# 2) calling `exit (n)'
# this sets $? = n
# 3) calling die or friends (croak, confess...):
# a) when $! is non-0
# this set $? = $!
# b) when $! is 0 but $? is not
# this sets $? = ($? >> 8) (i.e., the exit code of the
# last program executed)
# c) when both $! and $? are 0
# this sets $? = 255
#
# Cases 1), 2), and 3b) are fine, but we prefer $? = 1 for 3a) and 3c).
my $status = $?;
$status = 1 if ($! && $! == $?) || $? == 255;
# (Note that we cannot safely distinguish calls to `exit (n)'
# from calls to die when `$! = n'. It's not big deal because
# we only call `exit (0)' or `exit (1)'.)
if (!$debug && defined $tmp && -d $tmp)
{
local $SIG{__WARN__} = sub { $status = 1; warn $_[0] };
File::Path::rmtree $tmp;
}
# This is required if the code might send any output to stdout
# E.g., even --version or --help. So it's best to do it unconditionally.
if (! close STDOUT)
{
print STDERR "$me: closing standard output: $!\n";
$? = 1;
return;
}
$? = $status;
}
## ----------- ##
## Functions. ##
## ----------- ##
=item C
If the debug mode is enabled (C<$debug> and C<$verbose>), report the
C<@message> on C, signed with the name of the program.
=cut
# &debug(@MESSAGE)
# ----------------
# Messages displayed only if $DEBUG and $VERBOSE.
sub debug (@)
{
print STDERR "$me: ", @_, "\n"
if $verbose && $debug;
}
=item C
Wrapper around C. In addition to the user C