mirror of
git://git.sv.gnu.org/autoconf
synced 2025-02-17 14:01:27 +08:00
* autoconf.sh, autoreconf.sh, autoheader.sh, autoscan.pl, ifnames.sh:
Rename as... * autoconf.in, autoreconf.in, autoheader.in, autoscan.in, ifnames.in: these.
This commit is contained in:
parent
54a5d2d5a7
commit
6dff608010
@ -1,3 +1,10 @@
|
||||
2001-05-22 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* autoconf.sh, autoreconf.sh, autoheader.sh, autoscan.pl, ifnames.sh:
|
||||
Rename as...
|
||||
* autoconf.in, autoreconf.in, autoheader.in, autoscan.in, ifnames.in:
|
||||
these.
|
||||
|
||||
2001-05-21 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* configure.in: Bump to 2.50a.
|
||||
|
24
Makefile.am
24
Makefile.am
@ -50,8 +50,8 @@ pkgdata_DATA = $(distpkgdataDATA) $(nodistpkgdataDATA)
|
||||
EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 \
|
||||
BUGS INSTALL.txt \
|
||||
acversion.m4.in \
|
||||
autoconf.sh autoheader.sh autoreconf.sh autoupdate.in ifnames.sh \
|
||||
autoscan.pl \
|
||||
autoconf.in autoheader.in autoreconf.in autoupdate.in ifnames.in \
|
||||
autoscan.in \
|
||||
$(distpkgdataDATA)
|
||||
|
||||
# Files that should be removed, but which Automake does not know:
|
||||
@ -129,21 +129,21 @@ edit = sed \
|
||||
## have additional dependencies, so we have to use explicit rules for
|
||||
## every script.
|
||||
|
||||
autoconf: $(srcdir)/autoconf.sh $(srcdir)/configure.in
|
||||
autoconf: $(srcdir)/autoconf.in $(srcdir)/configure.in
|
||||
rm -f autoconf autoconf.tmp
|
||||
$(edit) $(srcdir)/autoconf.sh >autoconf.tmp
|
||||
$(edit) $(srcdir)/autoconf.in >autoconf.tmp
|
||||
chmod +x autoconf.tmp
|
||||
mv autoconf.tmp autoconf
|
||||
|
||||
autoheader: $(srcdir)/autoheader.sh $(srcdir)/configure.in
|
||||
autoheader: $(srcdir)/autoheader.in $(srcdir)/configure.in
|
||||
rm -f autoheader autoheader.tmp
|
||||
$(edit) $(srcdir)/autoheader.sh >autoheader.tmp
|
||||
$(edit) $(srcdir)/autoheader.in >autoheader.tmp
|
||||
chmod +x autoheader.tmp
|
||||
mv autoheader.tmp autoheader
|
||||
|
||||
autoreconf: $(srcdir)/autoreconf.sh $(srcdir)/configure.in
|
||||
autoreconf: $(srcdir)/autoreconf.in $(srcdir)/configure.in
|
||||
rm -f autoreconf autoreconf.tmp
|
||||
$(edit) $(srcdir)/autoreconf.sh >autoreconf.tmp
|
||||
$(edit) $(srcdir)/autoreconf.in >autoreconf.tmp
|
||||
chmod +x autoreconf.tmp
|
||||
mv autoreconf.tmp autoreconf
|
||||
|
||||
@ -153,15 +153,15 @@ autoupdate: $(srcdir)/autoupdate.in $(srcdir)/configure.in
|
||||
chmod +x autoupdate.tmp
|
||||
mv autoupdate.tmp autoupdate
|
||||
|
||||
ifnames: $(srcdir)/ifnames.sh $(srcdir)/configure.in
|
||||
ifnames: $(srcdir)/ifnames.in $(srcdir)/configure.in
|
||||
rm -f ifnames ifnames.tmp
|
||||
$(edit) $(srcdir)/ifnames.sh >ifnames.tmp
|
||||
$(edit) $(srcdir)/ifnames.in >ifnames.tmp
|
||||
chmod +x ifnames.tmp
|
||||
mv ifnames.tmp ifnames
|
||||
|
||||
autoscan: $(srcdir)/autoscan.pl $(srcdir)/configure.in
|
||||
autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.in
|
||||
rm -f autoscan autoscan.tmp
|
||||
$(edit) $(srcdir)/autoscan.pl >autoscan.tmp
|
||||
$(edit) $(srcdir)/autoscan.in >autoscan.tmp
|
||||
chmod +x autoscan.tmp
|
||||
mv autoscan.tmp autoscan
|
||||
|
||||
|
22
Makefile.in
22
Makefile.in
@ -94,7 +94,7 @@ nodistpkgdataDATA = autoconf.m4f
|
||||
|
||||
pkgdata_DATA = $(distpkgdataDATA) $(nodistpkgdataDATA)
|
||||
|
||||
EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 BUGS INSTALL.txt acversion.m4.in autoconf.sh autoheader.sh autoreconf.sh autoupdate.in ifnames.sh autoscan.pl $(distpkgdataDATA)
|
||||
EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 BUGS INSTALL.txt acversion.m4.in autoconf.in autoheader.in autoreconf.in autoupdate.in ifnames.in autoscan.in $(distpkgdataDATA)
|
||||
|
||||
|
||||
# Files that should be removed, but which Automake does not know:
|
||||
@ -439,21 +439,21 @@ install-data-hook: INSTALL.txt
|
||||
$(INSTALL_DATA) $$d$$p.txt $(DESTDIR)$(pkgdatadir)/$$f; \
|
||||
done
|
||||
|
||||
autoconf: $(srcdir)/autoconf.sh $(srcdir)/configure.in
|
||||
autoconf: $(srcdir)/autoconf.in $(srcdir)/configure.in
|
||||
rm -f autoconf autoconf.tmp
|
||||
$(edit) $(srcdir)/autoconf.sh >autoconf.tmp
|
||||
$(edit) $(srcdir)/autoconf.in >autoconf.tmp
|
||||
chmod +x autoconf.tmp
|
||||
mv autoconf.tmp autoconf
|
||||
|
||||
autoheader: $(srcdir)/autoheader.sh $(srcdir)/configure.in
|
||||
autoheader: $(srcdir)/autoheader.in $(srcdir)/configure.in
|
||||
rm -f autoheader autoheader.tmp
|
||||
$(edit) $(srcdir)/autoheader.sh >autoheader.tmp
|
||||
$(edit) $(srcdir)/autoheader.in >autoheader.tmp
|
||||
chmod +x autoheader.tmp
|
||||
mv autoheader.tmp autoheader
|
||||
|
||||
autoreconf: $(srcdir)/autoreconf.sh $(srcdir)/configure.in
|
||||
autoreconf: $(srcdir)/autoreconf.in $(srcdir)/configure.in
|
||||
rm -f autoreconf autoreconf.tmp
|
||||
$(edit) $(srcdir)/autoreconf.sh >autoreconf.tmp
|
||||
$(edit) $(srcdir)/autoreconf.in >autoreconf.tmp
|
||||
chmod +x autoreconf.tmp
|
||||
mv autoreconf.tmp autoreconf
|
||||
|
||||
@ -463,15 +463,15 @@ autoupdate: $(srcdir)/autoupdate.in $(srcdir)/configure.in
|
||||
chmod +x autoupdate.tmp
|
||||
mv autoupdate.tmp autoupdate
|
||||
|
||||
ifnames: $(srcdir)/ifnames.sh $(srcdir)/configure.in
|
||||
ifnames: $(srcdir)/ifnames.in $(srcdir)/configure.in
|
||||
rm -f ifnames ifnames.tmp
|
||||
$(edit) $(srcdir)/ifnames.sh >ifnames.tmp
|
||||
$(edit) $(srcdir)/ifnames.in >ifnames.tmp
|
||||
chmod +x ifnames.tmp
|
||||
mv ifnames.tmp ifnames
|
||||
|
||||
autoscan: $(srcdir)/autoscan.pl $(srcdir)/configure.in
|
||||
autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.in
|
||||
rm -f autoscan autoscan.tmp
|
||||
$(edit) $(srcdir)/autoscan.pl >autoscan.tmp
|
||||
$(edit) $(srcdir)/autoscan.in >autoscan.tmp
|
||||
chmod +x autoscan.tmp
|
||||
mv autoscan.tmp autoscan
|
||||
|
||||
|
19
TODO
19
TODO
@ -7,7 +7,7 @@ these suggestions... their presence here doesn't imply my endorsement.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
* Autoconf 2.50
|
||||
* Autoconf 2.51
|
||||
|
||||
** --target & AC_ARG_PROGRAM
|
||||
Shouldn't *any* `program' be installed as `$target_alias-program' even
|
||||
@ -15,13 +15,14 @@ if AC_ARG_PROGRAM is not called? That would be much more predictable.
|
||||
Ian?
|
||||
|
||||
** Document
|
||||
Automake, Libtool.
|
||||
Automake, Libtool, AC_ARG_VAR.
|
||||
|
||||
** RedHat's Autoconf page
|
||||
should be removed.
|
||||
|
||||
** AC_CHECK_TOOL...
|
||||
Write a test that checks that it honors the values set by the user.
|
||||
|
||||
* Autoconf 2.51
|
||||
|
||||
** AC_CHECK_FUNCS and AC_TRY_LINK_FUNC
|
||||
I have still not understood what's the difference between the two
|
||||
which requires to have two different sources: AC_LANG_CALL and
|
||||
@ -118,11 +119,11 @@ technology. Should we make this a new language? AC_LANG(ISO C). It
|
||||
would be great to introduce AC_LANG_COMPILER in this release too.
|
||||
|
||||
* autoconf.texi
|
||||
Move the specific macro documentation blocks into the source files, and use
|
||||
a doc-block extraction/merge technique to get docuemntation into texi-file.
|
||||
This should help avoid bit-rot in the doc, and make the doc easier to update
|
||||
when people add/change macros. The name "autodoc" is probably already taken
|
||||
so we probably need another one.
|
||||
Move the specific macro documentation blocks into the source files,
|
||||
and use a doc-block extraction/merge technique to get docuemntation
|
||||
into texi-file. This should help avoid bit-rot in the doc, and make
|
||||
the doc easier to update when people add/change macros. The name
|
||||
"autodoc" is probably already taken so we probably need another one.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
755
autoconf.sh
755
autoconf.sh
@ -1,755 +0,0 @@
|
||||
#! @SHELL@
|
||||
# autoconf -- create `configure' using m4 macros
|
||||
# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*[\\/],,'`
|
||||
|
||||
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
|
||||
-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 variable \`WARNINGS' is honored.
|
||||
|
||||
Library directories:
|
||||
-A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed)
|
||||
-l, --localdir=DIR location of the \`aclocal.m4' file
|
||||
|
||||
Tracing:
|
||||
-t, --trace=MACRO report the list of calls to MACRO
|
||||
-i, --initialization also trace Autoconf's initialization process
|
||||
|
||||
In tracing mode, no configuration script is created.
|
||||
|
||||
Report bugs to <bug-autoconf@gnu.org>."
|
||||
|
||||
version="\
|
||||
autoconf (@PACKAGE_NAME@) @VERSION@
|
||||
Written by David J. MacKenzie.
|
||||
|
||||
Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="\
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
exit_missing_arg="\
|
||||
echo \"$me: option \\\`\$1' requires an argument\" >&2
|
||||
echo \"\$help\" >&2
|
||||
exit 1"
|
||||
|
||||
# NLS nuisances.
|
||||
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
|
||||
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
|
||||
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
|
||||
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
|
||||
|
||||
# ac_LF_and_DOT
|
||||
# We use echo to avoid assuming a particular line-breaking character.
|
||||
# The extra dot is to prevent the shell from consuming trailing
|
||||
# line-breaks from the sub-command output. A line-break within
|
||||
# single-quotes doesn't work because, if this script is created in a
|
||||
# platform that uses two characters for line-breaks (e.g., DOS), tr
|
||||
# would break.
|
||||
ac_LF_and_DOT=`echo; echo .`
|
||||
|
||||
# Find GNU m4.
|
||||
# Handle the case that m4 has moved since we were configured.
|
||||
# It may have been found originally in a build directory.
|
||||
: ${M4=@M4@}
|
||||
case "$M4" in
|
||||
[\\/]* | ?:[\\/]*) test -f "$M4" || M4=m4 ;;
|
||||
esac
|
||||
# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
|
||||
case `$M4 --help </dev/null 2>&1` in
|
||||
*reload-state*);;
|
||||
*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Variables.
|
||||
: ${autoconf_dir=${AC_MACRODIR=@datadir@}}
|
||||
test -z "$AC_ACLOCALDIR" &&
|
||||
AC_ACLOCALDIR=`(aclocal --print-ac-dir) 2>/dev/null`
|
||||
: ${AWK=@AWK@}
|
||||
debug=false
|
||||
# Trace Autoconf's initialization?
|
||||
initialization=false
|
||||
localdir=.
|
||||
outfile=
|
||||
# Exit status.
|
||||
status=0
|
||||
# Tasks:
|
||||
# - trace
|
||||
# Trace the first arguments of some macros
|
||||
# - script
|
||||
# Produce the configure script (default)
|
||||
task=script
|
||||
tmp=
|
||||
verbose=:
|
||||
|
||||
# Parse command line.
|
||||
while test $# -gt 0 ; do
|
||||
optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
|
||||
"x$1" : 'x-.\(.*\)'`
|
||||
case $1 in
|
||||
--version | -V )
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
|
||||
--debug | -d )
|
||||
debug=:; shift ;;
|
||||
--verbose | -v )
|
||||
verbose=echo
|
||||
shift;;
|
||||
|
||||
--localdir=* | -l?* )
|
||||
localdir=$optarg
|
||||
shift ;;
|
||||
--localdir | -l )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
localdir=$1
|
||||
shift ;;
|
||||
|
||||
--autoconf-dir=* | -A?* )
|
||||
autoconf_dir=$optarg
|
||||
shift ;;
|
||||
--autoconf-dir | -A )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
autoconf_dir=$1
|
||||
shift ;;
|
||||
--macrodir=* | -m?* )
|
||||
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
|
||||
autoconf_dir=$optarg
|
||||
shift ;;
|
||||
--macrodir | -m )
|
||||
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
autoconf_dir=$1
|
||||
shift ;;
|
||||
|
||||
--trace=* | -t?* )
|
||||
task=trace
|
||||
traces="$traces '"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
|
||||
shift ;;
|
||||
--trace | -t )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
task=trace
|
||||
shift
|
||||
traces="$traces '"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'"
|
||||
shift ;;
|
||||
--initialization | -i )
|
||||
initialization=:
|
||||
shift;;
|
||||
|
||||
--output=* | -o?* )
|
||||
outfile=$optarg
|
||||
shift ;;
|
||||
--output | -o )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
outfile=$1
|
||||
shift ;;
|
||||
|
||||
--warnings=* | -W?* )
|
||||
warnings=$warnings,$optarg
|
||||
shift ;;
|
||||
--warnings | -W )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
warnings=$warnings,$1
|
||||
shift ;;
|
||||
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
break ;;
|
||||
-* )
|
||||
exec >&2
|
||||
echo "$me: invalid option $1"
|
||||
echo "$help"
|
||||
exit 1 ;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# The warnings are the concatenation of 1. application's defaults,
|
||||
# 2. $WARNINGS, $3 command line options, in that order.
|
||||
# Set them in the order expected by the M4 macros: the converse.
|
||||
alphabet='abcdefghijklmnopqrstuvwxyz'
|
||||
ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
NUMBERS='0123456789'
|
||||
WORDCHAR=_$alphabet$ALPHABET$NUMBERS
|
||||
|
||||
m4_warnings=
|
||||
for warning in `IFS=,; echo syntax,$WARNINGS,$warnings |
|
||||
tr $ALPHABET $alphabet`
|
||||
do
|
||||
test -n $warning || continue
|
||||
m4_warnings="$warning"`test -n "$m4_warnings" && echo ",$m4_warnings"`
|
||||
done
|
||||
|
||||
|
||||
# Trap on 0 to stop playing with `rm'.
|
||||
$debug ||
|
||||
{
|
||||
trap 'status=$?; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
}
|
||||
|
||||
# Create a (secure) tmp directory for tmp files.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/acXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
tmp=$TMPDIR/ac$$
|
||||
(umask 077 && mkdir $tmp)
|
||||
} ||
|
||||
{
|
||||
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
|
||||
(exit 1); exit;
|
||||
}
|
||||
|
||||
# Running m4.
|
||||
test -f "$autoconf_dir/acsite.m4" && acsite_m4="$autoconf_dir/acsite.m4"
|
||||
test -f "$localdir/aclocal.m4" && aclocal_m4="$localdir/aclocal.m4"
|
||||
m4_common="$acsite_m4 $aclocal_m4 -I $autoconf_dir -I $localdir \
|
||||
-Dm4_tmpdir=$tmp"
|
||||
run_m4="$M4 $autoconf_dir/autoconf.m4 $m4_common"
|
||||
run_m4f="$M4 --reload $autoconf_dir/autoconf.m4f $m4_common"
|
||||
|
||||
# Find the input file.
|
||||
case $# in
|
||||
0)
|
||||
case `ls configure.ac configure.in 2>/dev/null` in
|
||||
*ac*in )
|
||||
echo "$me: warning: both \`configure.ac' and \`configure.in' are present." >&2
|
||||
echo "$me: warning: proceeding with \`configure.ac'." >&2
|
||||
infile=configure.ac;;
|
||||
*ac ) infile=configure.ac;;
|
||||
*in ) infile=configure.in;;
|
||||
* )
|
||||
echo "$me: no input file" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
test $task = script && test -z "$outfile" && outfile=configure;;
|
||||
1) infile=$1 ;;
|
||||
*) exec >&2
|
||||
echo "$me: invalid number of arguments."
|
||||
echo "$help"
|
||||
(exit 1); exit ;;
|
||||
esac
|
||||
|
||||
# Unless specified, the output is stdout.
|
||||
test -z "$outfile" && outfile=-
|
||||
|
||||
# We need an actual file.
|
||||
if test z$infile = z-; then
|
||||
infile=$tmp/stdin
|
||||
cat >$infile
|
||||
elif test ! -r "$infile"; then
|
||||
echo "$me: $infile: No such file or directory" >&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
# Output is produced into FD 4. Prepare it.
|
||||
case $outfile in
|
||||
-) # Output to stdout
|
||||
exec 4>&1 ;;
|
||||
* )
|
||||
exec 4>$outfile;;
|
||||
esac
|
||||
|
||||
# Initializations are performed. Proceed to the main task.
|
||||
case $task in
|
||||
|
||||
## --------------------------------- ##
|
||||
## Generate the `configure' script. ##
|
||||
## --------------------------------- ##
|
||||
script)
|
||||
# M4 expansion.
|
||||
: >$tmp/forbidden.rx
|
||||
: >$tmp/allowed.rx
|
||||
$run_m4f -Dm4_warnings=$m4_warnings $infile >$tmp/configure ||
|
||||
{ (exit 1); exit; }
|
||||
|
||||
if test "x$outfile" != x-; then
|
||||
chmod +x $outfile
|
||||
fi
|
||||
|
||||
# Put the real line numbers into configure to make config.log more
|
||||
# helpful. Because quoting can sometimes get really painful in m4,
|
||||
# there are special @tokens@ to substitute.
|
||||
sed 's/^ //' >"$tmp/finalize.awk" <<EOF
|
||||
# Load the list of tokens which escape the forbidden patterns.
|
||||
BEGIN {
|
||||
# Be sure the read GAWK documentation to understand the parens
|
||||
# around \`tmp "/forbidden.rx"'.
|
||||
while ((getline pattern < (tmp "/forbidden.rx")) > 0)
|
||||
forbidden = (forbidden ? forbidden "|" : "") pattern
|
||||
close (tmp "/forbidden.rx")
|
||||
if (verbose)
|
||||
errprint("$me: forbidden: " forbidden)
|
||||
|
||||
while ((getline pattern < (tmp "/allowed.rx")) > 0)
|
||||
allowed = (allowed ? allowed "|" : "") pattern
|
||||
if (!allowed)
|
||||
allowed = "^$"
|
||||
close (tmp "/allowed.rx")
|
||||
if (verbose)
|
||||
errprint("$me: allowed: " allowed)
|
||||
}
|
||||
|
||||
function errprint (message)
|
||||
{
|
||||
# BAD! the pipe to 'cat >&2' doesn't work for DJGPP.
|
||||
# print message | "cat >&2"
|
||||
# Use normal redirection instead:
|
||||
print message > "$tmp/finalize.err"
|
||||
}
|
||||
|
||||
function undefined (file, line, macro)
|
||||
{
|
||||
errprint(file ":" line ": error: possibly undefined macro: " macro)
|
||||
}
|
||||
|
||||
# Body.
|
||||
{
|
||||
sub (/[ \t]*$/, "")
|
||||
if (\$0 == "")
|
||||
{
|
||||
if (!duplicate)
|
||||
{
|
||||
oline++
|
||||
print
|
||||
}
|
||||
duplicate = 1
|
||||
next
|
||||
}
|
||||
duplicate = 0
|
||||
oline++
|
||||
if (\$0 ~ /__oline__/)
|
||||
while (sub (/__oline__/, oline))
|
||||
continue
|
||||
while (sub (/@<:@/, "["))
|
||||
continue
|
||||
while (sub (/@:>@/, "]"))
|
||||
continue
|
||||
while (sub (/@S\|@/, "$"))
|
||||
continue
|
||||
while (sub (/@%:@/, "#"))
|
||||
continue
|
||||
|
||||
print
|
||||
|
||||
# Dubious feature: we tolerate macro names when commented.
|
||||
sub (/#.*/, "")
|
||||
|
||||
# Get the tokens.
|
||||
split (\$0, tokens, /[^$WORDCHAR]*/)
|
||||
|
||||
for (token in tokens)
|
||||
if (match (tokens[token], forbidden) &&
|
||||
!match (tokens[token], allowed))
|
||||
{
|
||||
macros [tokens [token]] = oline
|
||||
some_macros_were_not_expanded = 1
|
||||
}
|
||||
}
|
||||
|
||||
# If there are some macros which are left unexpanded in the output,
|
||||
# try to find the input which is responsible. Otherwise, try to help.
|
||||
END {
|
||||
if (some_macros_were_not_expanded)
|
||||
{
|
||||
line = 0
|
||||
while (getline < "$infile")
|
||||
{
|
||||
line++
|
||||
for (macro in macros)
|
||||
if (index (\$0, macro))
|
||||
{
|
||||
delete macros [macro]
|
||||
undefined("$infile", line, macro)
|
||||
}
|
||||
}
|
||||
close ("$infile")
|
||||
for (macro in macros)
|
||||
undefined("$outfile", macros [macro], macro)
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
EOF
|
||||
$AWK -v tmp="$tmp" \
|
||||
`$verbose "-v verbose=1"` \
|
||||
-f "$tmp/finalize.awk" <$tmp/configure >&4 ||
|
||||
{ test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2
|
||||
(exit 1); exit; }
|
||||
test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2
|
||||
;; # End of the task script.
|
||||
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Trace macros. ##
|
||||
## -------------- ##
|
||||
trace)
|
||||
|
||||
# trace.m4
|
||||
# --------
|
||||
# Routines to process formatted m4 traces.
|
||||
sed 's/^ //' >$tmp/trace.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.
|
||||
define([at_flatten],
|
||||
[at_patsubst(at_patsubst(at_patsubst([[[$1]]],
|
||||
[\\
|
||||
]),
|
||||
[[
|
||||
]+],
|
||||
[ ]),
|
||||
[^ *\(.*\) *$], [[\1]])])
|
||||
|
||||
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
|
||||
|
||||
# If you trace `define', then on `define([m4_exit], defn([m4exit])' you
|
||||
# will produce
|
||||
#
|
||||
# AT_define([m4sugar.m4], [115], [1], [define], [m4_exit], <m4exit>)
|
||||
#
|
||||
# Since `<m4exit>' is not quoted, the outter m4, when processing
|
||||
# `trace.m4' will exit prematurely. Hence, move all the builtins to
|
||||
# the `at_' name space.
|
||||
echo '# Copy the builtins.' >>$tmp/trace.m4
|
||||
echo "dumpdef" |
|
||||
$M4 2>&1 >/dev/null |
|
||||
sed 's/^\([^:]*\):.*/define([at_\1], defn([\1]))/' >>$tmp/trace.m4
|
||||
echo >>$tmp/trace.m4
|
||||
|
||||
echo '# Disable the builtins.' >>$tmp/trace.m4
|
||||
echo "dumpdef" |
|
||||
$M4 2>&1 >/dev/null |
|
||||
sed 's/^\([^:]*\):.*/at_undefine([\1])/' >>$tmp/trace.m4
|
||||
echo >>$tmp/trace.m4
|
||||
|
||||
|
||||
# trace2m4.sed
|
||||
# ------------
|
||||
# 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 `[^:][^:]*'.
|
||||
# The first s/// catches multiline traces, the second, traces as above.
|
||||
preamble='m4trace:\(..*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)-'
|
||||
cat >$tmp/trace2m4.sed <<EOF
|
||||
s/^$preamble \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/
|
||||
s/^$preamble \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/
|
||||
EOF
|
||||
|
||||
# translate.awk
|
||||
# -------------
|
||||
# Translate user tracing requests into m4 macros.
|
||||
cat >$tmp/translate.awk <<\EOF
|
||||
function trans (arg, sep)
|
||||
{
|
||||
# File name.
|
||||
if (arg == "f")
|
||||
return "$1"
|
||||
# Line number.
|
||||
if (arg == "l")
|
||||
return "$2"
|
||||
# Depth.
|
||||
if (arg == "d")
|
||||
return "$3"
|
||||
# Name (also available as $0).
|
||||
if (arg == "n")
|
||||
return "$4"
|
||||
# Escaped dollar.
|
||||
if (arg == "$")
|
||||
return "$"
|
||||
|
||||
# $@, list of quoted effective arguments.
|
||||
if (arg == "@")
|
||||
return "]at_at([" (separator ? separator : ",") "], $@)["
|
||||
# $*, list of unquoted effective arguments.
|
||||
if (arg == "*")
|
||||
return "]at_star([" (separator ? separator : ",") "], $@)["
|
||||
# $%, list of flattened unquoted effective arguments.
|
||||
if (arg == "%")
|
||||
return "]at_percent([" (separator ? separator : ":") "], $@)["
|
||||
}
|
||||
|
||||
function error (message)
|
||||
{
|
||||
print message | "cat >&2"
|
||||
exit 1
|
||||
}
|
||||
|
||||
{
|
||||
# Accumulate the whole input.
|
||||
request = request $0 "\n"
|
||||
}
|
||||
|
||||
END {
|
||||
# Chomp.
|
||||
request = substr (request, 1, length (request) - 1)
|
||||
# The default request is `$f:$l:$n:$*'.
|
||||
colon = index (request, ":")
|
||||
macro = colon ? substr (request, 1, colon - 1) : request
|
||||
request = colon ? substr (request, colon + 1) : "$f:$l:$n:$%"
|
||||
|
||||
res = ""
|
||||
|
||||
for (cp = request; cp; cp = substr (cp, 2))
|
||||
{
|
||||
char = substr (cp, 1, 1)
|
||||
if (char == "$")
|
||||
{
|
||||
if (match (cp, /^\$[0-9]+/))
|
||||
{
|
||||
# $n -> $(n + 4)
|
||||
res = res "$" (substr (cp, 2, RLENGTH - 1) + 4)
|
||||
cp = substr (cp, RLENGTH)
|
||||
}
|
||||
else if (substr (cp, 2, 1) ~ /[fldn$@%*]/)
|
||||
{
|
||||
# $x, no separator given.
|
||||
res = res trans(substr (cp, 2, 1))
|
||||
cp = substr (cp, 2)
|
||||
}
|
||||
else if (substr (cp, 2, 1) == "{")
|
||||
{
|
||||
# ${sep}x, long separator.
|
||||
end = index (cp, "}")
|
||||
if (!end)
|
||||
error("invalid escape: " cp)
|
||||
separator = substr (cp, 3, end - 3)
|
||||
if (substr (cp, end + 1, 1) ~ /[*@%]/)
|
||||
res = res trans(substr (cp, end + 1, 1), separator)
|
||||
else
|
||||
error("invalid escape: " cp)
|
||||
cp = substr (cp, end + 1)
|
||||
}
|
||||
else if (substr (cp, 3, 1) ~ /[*@%]/)
|
||||
{
|
||||
# $sx, short separator `s'.
|
||||
res = res trans(substr (cp, 3, 1), substr (cp, 2, 1))
|
||||
cp = substr(cp, 3)
|
||||
}
|
||||
else
|
||||
{
|
||||
error("invalid escape: " substr (cp, 1, 2))
|
||||
}
|
||||
}
|
||||
else
|
||||
res = res char
|
||||
}
|
||||
|
||||
# Produce the definition of AT_<MACRO> = the translation of the request.
|
||||
print "at_define([AT_" macro "],"
|
||||
print "[[" res "]])"
|
||||
print ""
|
||||
close("cat >&2")
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
# Extract both the m4 program and the m4 options from TRACES.
|
||||
echo "## ------------------------- ##" >>$tmp/trace.m4
|
||||
echo "## Trace processing macros. ##" >>$tmp/trace.m4
|
||||
echo "## ------------------------- ##" >>$tmp/trace.m4
|
||||
echo >>$tmp/trace.m4
|
||||
|
||||
eval set dummy "$traces"
|
||||
shift
|
||||
for trace
|
||||
do
|
||||
echo "# $trace" >>$tmp/trace.m4
|
||||
|
||||
# The request may be several lines long, hence sed has to quit.
|
||||
macro_name=`echo "$trace" | sed 's/:.*//;q'`
|
||||
# If for instance TRACE is `define', be sure to have an empty
|
||||
# TRACE_FORMAT.
|
||||
case $trace in
|
||||
$macro_name:* )
|
||||
trace_format=`echo "$trace" | sed "1s/^$macro_name:/:/"`;;
|
||||
* )
|
||||
trace_format=;;
|
||||
esac
|
||||
|
||||
# GNU M4 1.4's tracing of builtins is buggy. When run on this input:
|
||||
#
|
||||
# | divert(-1)
|
||||
# | changequote([, ])
|
||||
# | define([m4_eval], defn([eval]))
|
||||
# | eval(1)
|
||||
# | m4_eval(2)
|
||||
# | undefine([eval])
|
||||
# | m4_eval(3)
|
||||
#
|
||||
# it behaves this way:
|
||||
#
|
||||
# | % m4 input.m4 -da -t eval
|
||||
# | m4trace: -1- eval(1)
|
||||
# | m4trace: -1- m4_eval(2)
|
||||
# | m4trace: -1- m4_eval(3)
|
||||
# | %
|
||||
#
|
||||
# Conversely:
|
||||
#
|
||||
# | % m4 input.m4 -da -t m4_eval
|
||||
# | %
|
||||
#
|
||||
# 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 render a unique name,
|
||||
# the one specified by the user.
|
||||
base_name=`echo "$macro_name" | sed 's/^m4_//'`
|
||||
if echo "ifdef(\`$base_name', \`', \`m4exit(-1)')" | $M4; then
|
||||
# BASE_NAME is a builtin.
|
||||
trace_opt="$trace_opt -t $base_name -t m4_$base_name"
|
||||
echo "$base_name$trace_format" |
|
||||
$AWK -f $tmp/translate.awk >>$tmp/trace.m4 ||
|
||||
{ (exit 1); exit; }
|
||||
echo "m4_$base_name$trace_format" |
|
||||
$AWK -f $tmp/translate.awk >>$tmp/trace.m4 ||
|
||||
{ (exit 1); exit; }
|
||||
else
|
||||
# MACRO_NAME is not a builtin.
|
||||
trace_opt="$trace_opt -t $macro_name"
|
||||
echo "$trace" |
|
||||
$AWK -f $tmp/translate.awk >>$tmp/trace.m4 ||
|
||||
{ (exit 1); exit; }
|
||||
fi
|
||||
echo >>$tmp/trace.m4
|
||||
done
|
||||
|
||||
echo "## ------------------- ##" >>$tmp/trace.m4
|
||||
echo "## Traces to process. ##" >>$tmp/trace.m4
|
||||
echo "## ------------------- ##" >>$tmp/trace.m4
|
||||
echo >>$tmp/trace.m4
|
||||
echo "at_divert(0)at_dnl" >>$tmp/trace.m4
|
||||
|
||||
# Do we trace the initialization?
|
||||
# `errprint' must be silent, otherwise there can be warnings mixed
|
||||
# with traces in m4's stderr.
|
||||
if $initialization; then
|
||||
run_m4_trace="$run_m4 $trace_opt -daflq -Derrprint"
|
||||
else
|
||||
run_m4_trace="$run_m4f $trace_opt -daflq -Derrprint"
|
||||
fi
|
||||
|
||||
# Run m4 on the input file to get traces.
|
||||
$verbose "$me: running $run_m4_trace $infile | $M4 $tmp/trace.m4" >&2
|
||||
$run_m4_trace $infile 2>&1 >/dev/null |
|
||||
sed -f $tmp/trace2m4.sed |
|
||||
# Now we are ready to run m4 to process the trace file.
|
||||
if $debug; then
|
||||
cat >>$tmp/trace.m4
|
||||
$M4 $tmp/trace.m4
|
||||
else
|
||||
$M4 $tmp/trace.m4 -
|
||||
fi |
|
||||
# It makes no sense to try to transform __oline__.
|
||||
sed '
|
||||
s/@<:@/[/g
|
||||
s/@:>@/]/g
|
||||
s/@S|@/$/g
|
||||
s/@%:@/#/g
|
||||
' >&4 ||
|
||||
{
|
||||
echo "$me: tracing failed" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
;;
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Unknown task ##
|
||||
## ------------ ##
|
||||
|
||||
*) echo "$me: internal error: unknown task: $task" >&2
|
||||
(exit 1); exit
|
||||
esac
|
||||
|
||||
(exit $status); exit
|
359
autoheader.sh
359
autoheader.sh
@ -1,359 +0,0 @@
|
||||
#! @SHELL@
|
||||
# autoheader -- create `config.h.in' from `configure.ac'
|
||||
# Copyright 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# Written by Roland McGrath.
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*[/\\],,'`
|
||||
|
||||
usage="\
|
||||
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
|
||||
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
|
||||
|
||||
Warning categories include:
|
||||
\`obsolete' obsolete constructs
|
||||
\`all' all the warnings
|
||||
\`no-CATEGORY' turn off the warnings on CATEGORY
|
||||
\`none' turn off all the warnings
|
||||
\`error' warnings are error
|
||||
|
||||
Library directories:
|
||||
-A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed)
|
||||
-l, --localdir=DIR location of \`aclocal.m4' and \`acconfig.h'
|
||||
|
||||
Report bugs to <bug-autoconf@gnu.org>."
|
||||
|
||||
version="\
|
||||
autoheader (@PACKAGE_NAME@) @VERSION@
|
||||
Written by Roland McGrath.
|
||||
|
||||
Copyright 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="\
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
exit_missing_arg="\
|
||||
echo \"$me: option \\\`\$1' requires an argument\" >&2
|
||||
echo \"\$help\" >&2
|
||||
exit 1"
|
||||
|
||||
# NLS nuisances.
|
||||
# Only set these to C if already set. These must not be set unconditionally
|
||||
# because not all systems understand e.g. LANG=C (notably SCO).
|
||||
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
|
||||
# Non-C LC_CTYPE values break the ctype check.
|
||||
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
|
||||
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
|
||||
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
|
||||
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
|
||||
|
||||
# Variables.
|
||||
: ${autoconf_dir=${AC_MACRODIR=@datadir@}}
|
||||
dir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||
# We test "$dir/autoconf" in case we are in the build tree, in which case
|
||||
# the names are not transformed yet.
|
||||
for autoconf in "$AUTOCONF" \
|
||||
"$dir/@autoconf-name@" \
|
||||
"$dir/autoconf" \
|
||||
"@bindir@/@autoconf-name@"; do
|
||||
test -f "$autoconf" && break
|
||||
done
|
||||
debug=false
|
||||
localdir=.
|
||||
status=0
|
||||
tmp=
|
||||
verbose=:
|
||||
warning_all=false
|
||||
warning_error=false
|
||||
warning_obsolete=false
|
||||
|
||||
# Parse command line.
|
||||
while test $# -gt 0 ; do
|
||||
optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
|
||||
"x$1" : 'x-.\(.*\)'`
|
||||
case $1 in
|
||||
--version | -V )
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
|
||||
--debug | -d )
|
||||
debug=:; shift ;;
|
||||
--verbose | -v )
|
||||
verbose=echo
|
||||
shift;;
|
||||
|
||||
--localdir=* | -l?* )
|
||||
localdir=$optarg
|
||||
shift ;;
|
||||
--localdir | -l )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
localdir=$1
|
||||
shift ;;
|
||||
|
||||
--autoconf-dir=* | -A?* )
|
||||
autoconf_dir=$optarg
|
||||
shift ;;
|
||||
--autoconf-dir | -A )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
autoconf_dir=$1
|
||||
shift ;;
|
||||
--macrodir=* | -m?* )
|
||||
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
|
||||
autoconf_dir=$optarg
|
||||
shift ;;
|
||||
--macrodir | -m )
|
||||
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
autoconf_dir=$1
|
||||
shift ;;
|
||||
|
||||
--warnings=* | -W?* )
|
||||
warnings=$warnings,$optarg
|
||||
shift ;;
|
||||
--warnings | -W )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
warnings=$warnings,$1
|
||||
shift ;;
|
||||
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
break ;;
|
||||
-* )
|
||||
exec >&2
|
||||
echo "$me: invalid option $1"
|
||||
echo "$help"
|
||||
exit 1 ;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# The warnings are the concatenation of 1. application's defaults
|
||||
# (here, none), 2. $WARNINGS, $3 command line options, in that order.
|
||||
alphabet='abcdefghijklmnopqrstuvwxyz'
|
||||
ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
_ac_warnings=
|
||||
for warning in `IFS=,; echo $WARNINGS,$warnings | tr $ALPHABET $alphabet`
|
||||
do
|
||||
case $warning in
|
||||
'' | ,) continue;;
|
||||
no-*) eval warning_`expr x$warning : 'xno-\(.*\)'`=false;;
|
||||
*) eval warning_$warning=:;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Trap on 0 to stop playing with `rm'.
|
||||
$debug ||
|
||||
{
|
||||
trap 'status=$?; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
}
|
||||
|
||||
# Create a (secure) tmp directory for tmp files.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/ahXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
tmp=$TMPDIR/ah$$
|
||||
(umask 077 && mkdir $tmp)
|
||||
} ||
|
||||
{
|
||||
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
|
||||
# Preach.
|
||||
if ($warning_all || $warning_obsolete) &&
|
||||
(test -f $config_h.top ||
|
||||
test -f $config_h.bot ||
|
||||
test -f $localdir/acconfig.h); then
|
||||
sed -e "s/^ /$me: WARNING: /" >&2 <<\EOF
|
||||
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 to define a template without
|
||||
`acconfig.h':
|
||||
|
||||
AC_DEFINE([NEED_MAIN], 1,
|
||||
[Define if a function `main' is needed.])
|
||||
|
||||
More sophisticated templates can also be produced, see the
|
||||
documentation.
|
||||
EOF
|
||||
$warning_error && { (exit 1); exit; }
|
||||
fi
|
||||
|
||||
acconfigs=
|
||||
test -r $localdir/acconfig.h && acconfigs="$acconfigs $localdir/acconfig.h"
|
||||
|
||||
# Find the input file.
|
||||
case $# in
|
||||
0)
|
||||
case `ls configure.ac configure.in 2>/dev/null` in
|
||||
*ac*in )
|
||||
echo "$me: warning: both \`configure.ac' and \`configure.in' are present." >&2
|
||||
echo "$me: warning: proceeding with \`configure.ac'." >&2
|
||||
infile=configure.ac;;
|
||||
*ac ) infile=configure.ac;;
|
||||
*in ) infile=configure.in;;
|
||||
* )
|
||||
echo "$me: no input file" >&2
|
||||
exit 1;;
|
||||
esac;;
|
||||
1) infile=$1 ;;
|
||||
*) exec >&2
|
||||
echo "$me: invalid number of arguments."
|
||||
echo "$help"
|
||||
(exit 1); exit ;;
|
||||
esac
|
||||
|
||||
# Set up autoconf.
|
||||
autoconf="$autoconf -l $localdir"
|
||||
export autoconf_dir
|
||||
|
||||
# ----------------------- #
|
||||
# Real work starts here. #
|
||||
# ----------------------- #
|
||||
|
||||
# Source what the traces are trying to tell us.
|
||||
$verbose $me: running $autoconf to trace from $infile >&2
|
||||
$autoconf \
|
||||
--trace AC_CONFIG_HEADERS:': $${config_h="$1"}' \
|
||||
--trace AH_OUTPUT:'ac_verbatim_$1="\
|
||||
$2"' \
|
||||
--trace AC_DEFINE_TRACE_LITERAL:'syms="$$syms $1"' \
|
||||
$infile >$tmp/traces.sh || { (exit 1); exit; }
|
||||
|
||||
$verbose $me: sourcing $tmp/traces.sh >&2
|
||||
if (set -e && . $tmp/traces.sh) >/dev/null 2>&1; then
|
||||
. $tmp/traces.sh
|
||||
else
|
||||
echo "$me: error: shell error while sourcing $tmp/traces.sh" >&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
|
||||
# Make SYMS newline-separated rather than blank-separated, and remove dups.
|
||||
# Start each symbol with a blank (to match the blank after "#undef")
|
||||
# to reduce the possibility of mistakenly matching another symbol that
|
||||
# is a substring of it.
|
||||
# Beware that some of the symbols might actually be macro with arguments:
|
||||
# keep only their name.
|
||||
syms=`for sym in $syms; do echo $sym; done |
|
||||
sed -e 's/(.*//' |
|
||||
sort |
|
||||
uniq |
|
||||
sed -e 's@^@ @'`
|
||||
|
||||
|
||||
# We template only the first CONFIG_HEADER.
|
||||
config_h=`set X $config_h; echo $2`
|
||||
# Support "outfile[:infile]", defaulting infile="outfile.in".
|
||||
case "$config_h" in
|
||||
"") echo "$me: error: AC_CONFIG_HEADERS not found in $infile" >&2
|
||||
(exit 1); exit ;;
|
||||
*:*) config_h_in=`echo "$config_h" | sed 's/.*://'`
|
||||
config_h=`echo "$config_h" | sed 's/:.*//'` ;;
|
||||
*) config_h_in="$config_h.in" ;;
|
||||
esac
|
||||
|
||||
# Don't write "do not edit" -- it will get copied into the
|
||||
# config.h, which it's ok to edit.
|
||||
cat <<EOF >$tmp/config.hin
|
||||
/* $config_h_in. Generated automatically from $infile by autoheader. */
|
||||
EOF
|
||||
|
||||
# Dump the top.
|
||||
test -r $config_h.top && cat $config_h.top >>$tmp/config.hin
|
||||
|
||||
# Dump `acconfig.h' but its bottom.
|
||||
test -r $localdir/acconfig.h &&
|
||||
sed '/@BOTTOM@/,$d;s/@TOP@//' $localdir/acconfig.h >>$tmp/config.hin
|
||||
|
||||
# Dump the templates from `configure.ac'.
|
||||
for verb in `(set) 2>&1 | sed -n -e '/^ac_verbatim/s/^\([^=]*\)=.*$/\1/p' | sort`; do
|
||||
eval value=\$$verb
|
||||
cat >>$tmp/config.hin <<EOF
|
||||
|
||||
$value
|
||||
EOF
|
||||
done
|
||||
|
||||
# Handle the case where @BOTTOM@ is the first line of acconfig.h.
|
||||
test -r $localdir/acconfig.h &&
|
||||
grep @BOTTOM@ $localdir/acconfig.h >/dev/null &&
|
||||
sed -n '/@BOTTOM@/,${/@BOTTOM@/!p;}' $localdir/acconfig.h >>$tmp/config.hin
|
||||
test -f $config_h.bot && cat $config_h.bot >>$tmp/config.hin
|
||||
|
||||
|
||||
# Check that all the symbols have a template.
|
||||
$verbose $me: checking completeness of the template >&2
|
||||
# Regexp for a white space.
|
||||
w='[ ]'
|
||||
if test -n "$syms"; then
|
||||
for sym in $syms; do
|
||||
if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.hin >/dev/null; then
|
||||
: # All is well.
|
||||
else
|
||||
echo "$me: No template for symbol \`$sym'" >&2
|
||||
status=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# If the run was successful, output the result.
|
||||
if test $status = 0; then
|
||||
if test $# = 0; then
|
||||
# Output is a file
|
||||
if test -f $config_h_in && cmp -s $tmp/config.hin $config_h_in; then
|
||||
# File didn't change, so don't update its mod time.
|
||||
echo "$me: $config_h_in is unchanged" >&2
|
||||
else
|
||||
mv -f $tmp/config.hin $config_h_in
|
||||
fi
|
||||
else
|
||||
# Output is stdout
|
||||
cat $tmp/config.hin
|
||||
fi
|
||||
fi
|
||||
|
||||
(exit $status); exit
|
417
autoreconf.sh
417
autoreconf.sh
@ -1,417 +0,0 @@
|
||||
#! @SHELL@
|
||||
# autoreconf - remake all Autoconf configure scripts in a directory tree
|
||||
# Copyright 1994, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*[\\/],,'`
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION] ... [TEMPLATE-FILE]
|
||||
|
||||
Run \`autoconf' (and \`autoheader', \`aclocal' and \`automake', where
|
||||
appropriate) repeatedly to remake the Autoconf \`configure' scripts
|
||||
and configuration header templates in the directory tree rooted at the
|
||||
current directory. By default, it only remakes those files that are
|
||||
older than their predecessors. If you install a new version of
|
||||
Autoconf, running \`autoreconf' remakes all of the files by giving it
|
||||
the \`--force' option.
|
||||
|
||||
Operation modes:
|
||||
-h, --help print this help, then exit
|
||||
-V, --version print version number, then exit
|
||||
-v, --verbose verbosely report processing
|
||||
-d, --debug don't remove temporary files
|
||||
-f, --force consider every files are obsolete
|
||||
-i, --install copy missing auxiliary files
|
||||
-s, --symlink instead of copying, install symbolic links
|
||||
|
||||
The option \`--install' is similar to the option \`--add-missing' in
|
||||
other tools.
|
||||
|
||||
Library directories:
|
||||
-A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed)
|
||||
-l, --localdir=DIR location of \`aclocal.m4' and \`acconfig.h'
|
||||
-M, --m4dir=M4DIR this package's Autoconf extensions
|
||||
|
||||
Unless specified, heuristics try to compute \`M4DIR' from the \`Makefile.am',
|
||||
or defaults to \`m4' if it exists.
|
||||
|
||||
The following options are passed to \`automake':
|
||||
--cygnus assume program is part of Cygnus-style tree
|
||||
--foreign set strictness to foreign
|
||||
--gnits set strictness to gnits
|
||||
--gnu set strictness to gnu
|
||||
--include-deps include generated dependencies in Makefile.in
|
||||
|
||||
The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, and ACLOCAL
|
||||
are honored.
|
||||
|
||||
Report bugs to <bug-autoconf@gnu.org>."
|
||||
|
||||
version="\
|
||||
autoreconf (@PACKAGE_NAME@) @VERSION@
|
||||
Written by David J. MacKenzie.
|
||||
|
||||
Copyright 1994, 1999, 2000 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="\
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
exit_missing_arg="\
|
||||
echo \"$me: option \\\`\$1' requires an argument\" >&2
|
||||
echo \"\$help\" >&2
|
||||
exit 1"
|
||||
|
||||
# NLS nuisances.
|
||||
# Only set these to C if already set. These must not be set unconditionally
|
||||
# because not all systems understand e.g. LANG=C (notably SCO).
|
||||
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
|
||||
# Non-C LC_CTYPE values break the ctype check.
|
||||
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
|
||||
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
|
||||
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
|
||||
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
|
||||
|
||||
# Variables.
|
||||
: ${autoconf_dir=${AC_MACRODIR=@datadir@}}
|
||||
debug=false
|
||||
dir=`echo "$0" | sed -e 's,[^\\/]*$,,'`
|
||||
force=false
|
||||
# --install -- as --add-missing in other tools.
|
||||
install=false
|
||||
localdir=.
|
||||
# m4dir -- local Autoconf extensions. Typically `m4'.
|
||||
m4dir=
|
||||
status=0
|
||||
# symlink -- when --install, use symlinks instead.
|
||||
symlink=false
|
||||
verbose=:
|
||||
|
||||
# Looking for autoconf.
|
||||
# We test "$dir/autoconf" in case we are in the build tree, in which case
|
||||
# the names are not transformed yet.
|
||||
for autoconf in "$AUTOCONF" \
|
||||
"$dir/@autoconf-name@" \
|
||||
"$dir/autoconf" \
|
||||
"@bindir@/@autoconf-name@"; do
|
||||
test -f "$autoconf" && break
|
||||
done
|
||||
|
||||
# Looking for autoheader.
|
||||
for autoheader in "$AUTOHEADER" \
|
||||
"$dir/@autoheader-name@" \
|
||||
"$dir/autoheader" \
|
||||
"@bindir@/@autoheader-name@"; do
|
||||
test -f "$autoheader" && break
|
||||
done
|
||||
# Looking for automake.
|
||||
: ${automake=${AUTOMAKE=automake}}
|
||||
# Looking for aclocal.
|
||||
: ${aclocal=${ACLOCAL=aclocal}}
|
||||
|
||||
# Parse command line.
|
||||
while test $# -gt 0; do
|
||||
optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
|
||||
"x$1" : 'x-.\(.*\)'`
|
||||
case "$1" in
|
||||
--version | -V )
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
|
||||
--verbose | -v )
|
||||
verbose=echo
|
||||
shift;;
|
||||
--debug | -d )
|
||||
debug=:; shift ;;
|
||||
|
||||
--localdir=* | -l?* )
|
||||
localdir=$optarg
|
||||
shift ;;
|
||||
--localdir | -l )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
localdir=$1
|
||||
shift ;;
|
||||
|
||||
--autoconf-dir=* | -A?* )
|
||||
autoconf_dir=$optarg
|
||||
shift ;;
|
||||
--autoconf-dir | -A )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
autoconf_dir=$1
|
||||
shift ;;
|
||||
--macrodir=* | -m?* )
|
||||
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
|
||||
autoconf_dir=$optarg
|
||||
shift ;;
|
||||
--macrodir | -m )
|
||||
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
autoconf_dir=$1
|
||||
shift ;;
|
||||
|
||||
--m4dir=* | -M?* )
|
||||
m4dir=$optarg
|
||||
shift ;;
|
||||
--m4dir | -M )
|
||||
test $# = 1 && eval "$exit_missing_arg"
|
||||
shift
|
||||
m4dir=$1
|
||||
shift ;;
|
||||
|
||||
--force | -f )
|
||||
force=:; shift ;;
|
||||
|
||||
--install | -i )
|
||||
install=:; shift ;;
|
||||
--symlink | -s )
|
||||
symlink=:; shift ;;
|
||||
|
||||
# Options of Automake.
|
||||
--cygnus | --foreign | --gnits | --gnu | --include-deps | -i )
|
||||
automake="$automake $1"; shift ;;
|
||||
|
||||
-- ) # Stop option processing.
|
||||
shift; break ;;
|
||||
-* )
|
||||
exec >&2
|
||||
echo "$me: invalid option $1"
|
||||
echo "$help"
|
||||
exit 1 ;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Find the input file.
|
||||
if test $# -ne 0; then
|
||||
exec >&2
|
||||
echo "$me: invalid number of arguments"
|
||||
echo "$help"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If verbose, say what you are going to use.
|
||||
if test $verbose = echo; then
|
||||
$autoconf --version |
|
||||
sed "s,.*)\(.*\)$,$me: using autoconf\1: $autoconf,;1q" >&2
|
||||
$autoheader --version |
|
||||
sed "s,.*)\(.*\)$,$me: using autoheader\1: $autoheader,;1q" >&2
|
||||
$automake --version |
|
||||
sed "s,.*)\(.*\)$,$me: using automake\1: $automake,;1q" >&2
|
||||
$aclocal --version |
|
||||
sed "s,.*)\(.*\)$,$me: using aclocal\1: $aclocal,;1q" >&2
|
||||
fi
|
||||
|
||||
# Dispatch autoreconf's option to the tools.
|
||||
# --localdir
|
||||
autoconf="$autoconf -l $localdir"
|
||||
autoheader="$autoheader -l $localdir"
|
||||
# --force
|
||||
$force || automake="$automake --no-force"
|
||||
# --verbose
|
||||
autoconf="$autoconf `$verbose --verbose`"
|
||||
autoheader="$autoheader `$verbose --verbose`"
|
||||
automake="$automake `$verbose --verbose`"
|
||||
aclocal="$aclocal `$verbose --verbose`"
|
||||
# --debug
|
||||
$debug &&
|
||||
{
|
||||
autoconf="$autoconf --debug"
|
||||
autoheader="$autoheader --debug"
|
||||
}
|
||||
# --macrodir
|
||||
export autoconf_dir
|
||||
# --install and --symlink
|
||||
if $install; then
|
||||
automake="$automake --add-missing `$symlink || echo --copy`"
|
||||
fi
|
||||
|
||||
# Trap on 0 to stop playing with `rm'.
|
||||
$debug ||
|
||||
{
|
||||
trap 'status=$?; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
}
|
||||
|
||||
# Create a (secure) tmp directory for tmp files.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/arXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
tmp=$TMPDIR/ar$$
|
||||
(umask 077 && mkdir $tmp)
|
||||
} ||
|
||||
{
|
||||
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
|
||||
# When debugging, it is convenient that all the related temporary
|
||||
# files be at the same place.
|
||||
TMPDIR=$tmp
|
||||
export TMPDIR
|
||||
|
||||
# alflags.sed -- Fetch the aclocal flags.
|
||||
cat >$tmp/alflags.sed <<EOF
|
||||
#n
|
||||
/^ACLOCAL_[A-Z_]*FLAGS/{
|
||||
s/.*=//
|
||||
p
|
||||
q
|
||||
}
|
||||
EOF
|
||||
|
||||
# update.sh --
|
||||
# Exit 0 if the first argument is not the most recent of all or is missing.
|
||||
cat >$tmp/update.sh <<\EOF
|
||||
test -f "$1" || { :; exit; }
|
||||
test x`ls -1dt "$@" 2>/dev/null | sed 1q` != x"$1"
|
||||
EOF
|
||||
update="@SHELL@ $tmp/update.sh"
|
||||
|
||||
|
||||
# ----------------------- #
|
||||
# Real work starts here. #
|
||||
# ----------------------- #
|
||||
|
||||
# Make a list of directories to process.
|
||||
# The xargs grep filters out Cygnus configure.in files.
|
||||
find . '(' -name configure.ac -o -name configure.in ')' -print |
|
||||
xargs grep -l AC_INIT |
|
||||
sed 's,/configure\.ac$,,;s,/configure\.in$,,;s,^./,,' |
|
||||
while read dir; do
|
||||
(
|
||||
cd $dir || continue
|
||||
|
||||
|
||||
# ----------------- #
|
||||
# Running aclocal. #
|
||||
# ----------------- #
|
||||
|
||||
# uses_aclocal -- is this package using aclocal?
|
||||
uses_aclocal=false
|
||||
grep 'generated .* by aclocal' $localdir/aclocal.m4 >/dev/null 2>&1 &&
|
||||
uses_aclocal=:
|
||||
test -f "$localdir/aclocal.m4" ||
|
||||
uses_aclocal=:
|
||||
if $uses_aclocal &&
|
||||
{ $force ||
|
||||
$update $localdir/aclocal.m4 $localdir/acinclude.m4; } then
|
||||
# If there are flags for aclocal in Makefile.am, use them.
|
||||
aclocal_flags=`sed -f $tmp/alflags.sed Makefile.am 2>/dev/null`
|
||||
|
||||
# If m4dir no specified and these flags do not specify the
|
||||
# location of the local Autoconf extensions, default to `m4'.
|
||||
case $m4dir,$aclocal_flags in
|
||||
,*"-I "* ) ;; # Not overriden and specified.
|
||||
,*) # Not specified at all.
|
||||
test -d "m4" && aclocal_flags="$aclocal_flags -I m4";;
|
||||
* ) # Specified by the user.
|
||||
aclocal_flags="$aclocal_flags -I $m4dir";;
|
||||
esac
|
||||
|
||||
$verbose $me: running $aclocal $aclocal_flags --output=$localdir/aclocal.m4 in $dir >&2
|
||||
$aclocal $aclocal_flags --output=$localdir/aclocal.m4
|
||||
fi
|
||||
|
||||
|
||||
# ------------------ #
|
||||
# Running automake. #
|
||||
# ------------------ #
|
||||
|
||||
# Assumes that there is a Makefile.am in the topmost directory.
|
||||
uses_automake=false
|
||||
test -f "Makefile.am" &&
|
||||
uses_automake=:
|
||||
# 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'.
|
||||
if $uses_automake; then
|
||||
$verbose $me: running $automake in $dir >&2
|
||||
$automake
|
||||
fi
|
||||
|
||||
|
||||
# ------------------ #
|
||||
# Running autoconf. #
|
||||
# ------------------ #
|
||||
|
||||
if $force ||
|
||||
$update configure configure.ac $localdir/aclocal.m4 ||
|
||||
$update configure configure.in $localdir/aclocal.m4; then
|
||||
$verbose $me: running $autoconf in $dir >&2
|
||||
$autoconf
|
||||
fi
|
||||
|
||||
|
||||
# -------------------- #
|
||||
# Running autoheader. #
|
||||
# -------------------- #
|
||||
|
||||
# templates -- arguments of AC_CONFIG_HEADERS.
|
||||
$verbose $me: running $autoconf -t 'AC_CONFIG_HEADERS:$1' >&2
|
||||
templates=`$autoconf -t 'AC_CONFIG_HEADERS:$1'`
|
||||
if test -n "$templates"; then
|
||||
tcount=`set -- $templates; echo $#`
|
||||
template=`set -- $templates; echo $1 | sed '
|
||||
s/.*://
|
||||
t colon
|
||||
s/$/.in/
|
||||
: colon
|
||||
s/:.*//
|
||||
'`
|
||||
template_dir=`echo $template | sed -e 's,[\\/]*[^\\/]*$,,;s,^$,.,'`
|
||||
stamp_num=`test "$tcount" -gt 1 && echo "$tcount"`
|
||||
stamp=$template_dir/stamp-h$stamp_num.in
|
||||
# If config.hin exists, don't override it unless it was really
|
||||
# created by autoheader (users are allowed to write them by hand!).
|
||||
uses_autoheader=false
|
||||
grep autoheader "$template" >/dev/null 2>&1 &&
|
||||
uses_autoheader=:
|
||||
test -f "$template" ||
|
||||
uses_autoheader=:
|
||||
if $uses_autoheader &&
|
||||
{ $force ||
|
||||
$update $template \
|
||||
configure.ac $localdir/aclocal.m4 $localdir/acconfig.h ||
|
||||
$update $template \
|
||||
configure.in $localdir/aclocal.m4 $localdir/acconfig.h ||
|
||||
$update $stamp \
|
||||
configure.ac $localdir/aclocal.m4 $localdir/acconfig.h ||
|
||||
$update $stamp \
|
||||
configure.in $localdir/aclocal.m4 $localdir/acconfig.h; } then
|
||||
$verbose $me: running $autoheader in $dir >&2
|
||||
$autoheader &&
|
||||
$verbose "touching $stamp" >&2 &&
|
||||
touch $stamp
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# End:
|
669
autoscan.pl
669
autoscan.pl
@ -1,669 +0,0 @@
|
||||
#! @PERL@ -w
|
||||
# autoscan - Create configure.scan (a preliminary configure.ac) for a package.
|
||||
# Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# Written by David MacKenzie <djm@gnu.ai.mit.edu>.
|
||||
|
||||
use 5.005;
|
||||
require "find.pl";
|
||||
use Getopt::Long;
|
||||
use strict;
|
||||
|
||||
use vars qw($autoconf $datadir $initfile $me $name $verbose
|
||||
@cfiles @makefiles @shfiles
|
||||
%functions_macros %headers_macros %identifiers_macros
|
||||
%programs_macros %makevars_macros %needed_macros
|
||||
%c_keywords %programs %headers %identifiers %makevars
|
||||
%libraries %functions %printed);
|
||||
|
||||
($me = $0) =~ s,.*/,,;
|
||||
$verbose = 0;
|
||||
|
||||
# Reference these variables to pacify perl -w.
|
||||
%identifiers_macros = ();
|
||||
%makevars_macros = ();
|
||||
%programs_macros = ();
|
||||
%needed_macros = ();
|
||||
|
||||
my @kinds = qw (functions headers identifiers programs makevars);
|
||||
|
||||
# For each kind, the default macro.
|
||||
my %generic_macro =
|
||||
(
|
||||
'functions' => 'AC_CHECK_FUNCS',
|
||||
'headers' => 'AC_CHECK_HEADERS',
|
||||
'identifiers' => 'AC_CHECK_TYPES',
|
||||
'programs' => 'AC_CHECK_PROGS'
|
||||
);
|
||||
|
||||
|
||||
my $configure_scan = 'configure.scan';
|
||||
|
||||
|
||||
# Exit nonzero whenever closing STDOUT fails.
|
||||
sub END
|
||||
{
|
||||
use POSIX qw (_exit);
|
||||
# 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.
|
||||
close STDOUT
|
||||
or (warn "$me: closing standard output: $!\n"), _exit (1);
|
||||
}
|
||||
|
||||
# find_autoconf
|
||||
# -------------
|
||||
# Find the lib files and autoconf.
|
||||
sub find_autoconf
|
||||
{
|
||||
$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
|
||||
(my $dir = $0) =~ s,[^/]*$,,;
|
||||
$autoconf = '';
|
||||
# We test "$dir/autoconf" in case we are in the build tree, in which case
|
||||
# the names are not transformed yet.
|
||||
foreach my $file ($ENV{"AUTOCONF"} || '',
|
||||
"$dir/@autoconf-name@",
|
||||
"$dir/autoconf",
|
||||
"@bindir@/@autoconf-name@")
|
||||
{
|
||||
if (-x $file)
|
||||
{
|
||||
$autoconf = $file;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# $CONFIGURE_AC
|
||||
# &find_configure_ac ()
|
||||
# ---------------------
|
||||
sub find_configure_ac ()
|
||||
{
|
||||
if (-f 'configure.ac')
|
||||
{
|
||||
if (-f 'configure.in')
|
||||
{
|
||||
warn "warning: `configure.ac' and `configure.in' both present.\n";
|
||||
warn "warning: proceeding with `configure.ac'.\n";
|
||||
}
|
||||
return 'configure.ac';
|
||||
}
|
||||
elsif (-f 'configure.in')
|
||||
{
|
||||
return 'configure.in';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# print_usage ()
|
||||
# --------------
|
||||
# Display usage (--help).
|
||||
sub print_usage ()
|
||||
{
|
||||
print "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 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
|
||||
|
||||
Library directories:
|
||||
-A, --autoconf-dir=ACDIR Autoconf's files location (rarely needed)
|
||||
-l, --localdir=DIR location of `aclocal.m4' and `acconfig.h'
|
||||
|
||||
Report bugs to <bug-autoconf\@gnu.org>.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
# print_version ()
|
||||
# ----------------
|
||||
# Display version (--version).
|
||||
sub print_version
|
||||
{
|
||||
print "autoscan (@PACKAGE_NAME@) @VERSION@
|
||||
Written by David J. MacKenzie.
|
||||
|
||||
Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
# parse_args ()
|
||||
# -------------
|
||||
# Process any command line arguments.
|
||||
sub parse_args ()
|
||||
{
|
||||
my $srcdir;
|
||||
Getopt::Long::config ("bundling");
|
||||
Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$datadir,
|
||||
"h|help" => \&print_usage,
|
||||
"V|version" => \&print_version,
|
||||
"v|verbose" => \$verbose)
|
||||
or exit 1;
|
||||
|
||||
die "$me: too many arguments
|
||||
Try `$me --help' for more information.\n"
|
||||
if (@ARGV > 1);
|
||||
($srcdir) = @ARGV;
|
||||
$srcdir = "."
|
||||
if !defined $srcdir;
|
||||
|
||||
print "srcdir=$srcdir\n" if $verbose;
|
||||
chdir $srcdir || die "$me: cannot cd to $srcdir: $!\n";
|
||||
}
|
||||
|
||||
|
||||
# init_tables ()
|
||||
# --------------
|
||||
# Put values in the tables of what to do with each token.
|
||||
sub init_tables ()
|
||||
{
|
||||
# Initialize a table of C keywords (to ignore).
|
||||
# Taken from K&R 1st edition p. 180.
|
||||
# ANSI C, GNU C, and C++ keywords can introduce portability problems,
|
||||
# so don't ignore them.
|
||||
foreach my $word (qw (int char float double struct union long short
|
||||
unsigned auto extern register typedef static
|
||||
goto return sizeof break continue if else for
|
||||
do while switch case default))
|
||||
{
|
||||
$c_keywords{$word} = 0;
|
||||
}
|
||||
|
||||
# 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.
|
||||
|
||||
foreach my $kind (@kinds)
|
||||
{
|
||||
my $file = "$datadir/ac$kind";
|
||||
open TABLE, $file or
|
||||
die "$me: cannot open $file: $!\n";
|
||||
while (<TABLE>)
|
||||
{
|
||||
# Ignore blank lines and comments.
|
||||
next
|
||||
if /^\s*$/ || /^\s*\#/;
|
||||
unless (/^(\S+)\s+(\S.*)$/ || /^(\S+)\s*$/)
|
||||
{
|
||||
die "$me: cannot parse definition in $file:\n$_\n";
|
||||
}
|
||||
my $word = $1;
|
||||
my $macro = $2 || $generic_macro{$kind};
|
||||
eval "\$$kind" . "_macros{\$word} = \$macro";
|
||||
}
|
||||
close(TABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# wanted ()
|
||||
# ---------
|
||||
# Collect names of various kinds of files in the package.
|
||||
# Called by &find on each file.
|
||||
sub wanted ()
|
||||
{
|
||||
# Strip a useless leading `./'.
|
||||
$name =~ s,^\./,,;
|
||||
|
||||
if (/^.*\.[chlymC]$/ || /^.*\.cc$/)
|
||||
{
|
||||
push (@cfiles, $name);
|
||||
}
|
||||
elsif (/^[Mm]akefile$/ || /^GNUmakefile$/)
|
||||
{
|
||||
# Wanted only if there is no corresponding Makefile.in.
|
||||
# Using Find, $_ contains the current filename with the current
|
||||
# directory of the walk through.
|
||||
push (@makefiles, $name)
|
||||
if ! -f "$_.in";
|
||||
}
|
||||
elsif (/^[Mm]akefile\.in$/)
|
||||
{
|
||||
push (@makefiles, $name);
|
||||
}
|
||||
elsif (/^.*\.sh$/)
|
||||
{
|
||||
push (@shfiles, $name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# scan_files ()
|
||||
# -------------
|
||||
# Read through the files and collect lists of tokens in them
|
||||
# that might create nonportabilities.
|
||||
sub scan_files ()
|
||||
{
|
||||
my $file;
|
||||
if (defined $cfiles[0])
|
||||
{
|
||||
$initfile = $cfiles[0]; # Pick one at random.
|
||||
}
|
||||
|
||||
foreach $file (@cfiles)
|
||||
{
|
||||
push (@{$programs{"cc"}}, $file);
|
||||
scan_c_file ($file);
|
||||
}
|
||||
|
||||
foreach $file (@makefiles)
|
||||
{
|
||||
scan_makefile ($file);
|
||||
}
|
||||
|
||||
foreach $file (@shfiles)
|
||||
{
|
||||
scan_sh_file ($file);
|
||||
}
|
||||
|
||||
if ($verbose)
|
||||
{
|
||||
print "cfiles:", join(" ", @cfiles), "\n";
|
||||
print "makefiles:", join(" ", @makefiles), "\n";
|
||||
print "shfiles:", join(" ", @shfiles), "\n";
|
||||
|
||||
foreach my $class (qw (functions identifiers headers
|
||||
makevars libraries programs))
|
||||
{
|
||||
print "\n$class:\n";
|
||||
my $h = eval "\\\%$class";
|
||||
foreach my $word (sort keys %$h)
|
||||
{
|
||||
print "$word: @{$h->{$word}}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# scan_c_file(FILE)
|
||||
# -----------------
|
||||
sub scan_c_file ($)
|
||||
{
|
||||
my ($file) = @_;
|
||||
my ($in_comment) = 0; # Nonzero if in a multiline comment.
|
||||
|
||||
open(CFILE, "<$file") || die "$me: cannot open $file: $!\n";
|
||||
while (<CFILE>)
|
||||
{
|
||||
# Strip out comments, approximately.
|
||||
# Ending on this line.
|
||||
if ($in_comment && m,\*/,)
|
||||
{
|
||||
s,.*\*/,,;
|
||||
$in_comment = 0;
|
||||
}
|
||||
# All on one line.
|
||||
s,/\*.*\*/,,g;
|
||||
# Starting on this line.
|
||||
if (m,/\*,)
|
||||
{
|
||||
$in_comment = 1;
|
||||
}
|
||||
# Continuing on this line.
|
||||
next if $in_comment;
|
||||
|
||||
# Preprocessor directives.
|
||||
if (/^\s*\#\s*include\s*<([^>]*)>/)
|
||||
{
|
||||
push (@{$headers{$1}}, "$file:$.");
|
||||
}
|
||||
# Ignore other preprocessor directives.
|
||||
next if /^\s*\#/;
|
||||
|
||||
# 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*\(/ /)
|
||||
{
|
||||
push (@{$functions{$1}}, "$file:$.")
|
||||
if !defined $c_keywords{$1};
|
||||
}
|
||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||
{
|
||||
push (@{$identifiers{$1}}, "$file:$.")
|
||||
if !defined $c_keywords{$1};
|
||||
}
|
||||
}
|
||||
close(CFILE);
|
||||
}
|
||||
|
||||
|
||||
# scan_makefile(MAKEFILE)
|
||||
# -----------------------
|
||||
sub scan_makefile ($)
|
||||
{
|
||||
my ($file) = @_;
|
||||
|
||||
open(MFILE, "<$file") || die "$me: cannot open $file: $!\n";
|
||||
while (<MFILE>)
|
||||
{
|
||||
# Strip out comments and variable references.
|
||||
s/#.*//;
|
||||
s/\$\([^\)]*\)//g;
|
||||
s/\${[^\}]*}//g;
|
||||
s/@[^@]*@//g;
|
||||
|
||||
# Variable assignments.
|
||||
while (s/\b([a-zA-Z_]\w*)\s*=/ /)
|
||||
{
|
||||
push (@{$makevars{$1}}, "$file:$.");
|
||||
}
|
||||
# Libraries.
|
||||
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
|
||||
{
|
||||
push (@{$libraries{$1}}, "$file:$.");
|
||||
}
|
||||
# Tokens in the code.
|
||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||
{
|
||||
push (@{$programs{$1}}, "$file:$.");
|
||||
}
|
||||
}
|
||||
close(MFILE);
|
||||
}
|
||||
|
||||
|
||||
# scan_sh_file(SHELL-SCRIPT)
|
||||
# --------------------------
|
||||
sub scan_sh_file ($)
|
||||
{
|
||||
my ($file) = @_;
|
||||
|
||||
open(MFILE, "<$file") || die "$me: cannot open $file: $!\n";
|
||||
while (<MFILE>)
|
||||
{
|
||||
# Strip out comments and variable references.
|
||||
s/#.*//;
|
||||
s/\${[^\}]*}//g;
|
||||
s/@[^@]*@//g;
|
||||
|
||||
# Tokens in the code.
|
||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||
{
|
||||
push (@{$programs{$1}}, "$file:$.");
|
||||
}
|
||||
}
|
||||
close(MFILE);
|
||||
}
|
||||
|
||||
|
||||
# print_unique ($MACRO, @WHERE)
|
||||
# -----------------------------
|
||||
# $MACRO is wanted from $WHERE, hence (i) print $MACRO in $configure_scan
|
||||
# if it exists and hasn't been printed already, (ii), remember it's needed.
|
||||
sub print_unique ($@)
|
||||
{
|
||||
my ($macro, @where) = @_;
|
||||
|
||||
if (defined $macro && !defined $printed{$macro})
|
||||
{
|
||||
print CONF "$macro\n";
|
||||
$printed{$macro} = 1;
|
||||
|
||||
push (@{$needed_macros{$macro}}, @where);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# output_programs ()
|
||||
# ------------------
|
||||
sub output_programs ()
|
||||
{
|
||||
print CONF "\n# Checks for programs.\n";
|
||||
foreach my $word (sort keys %programs)
|
||||
{
|
||||
print_unique ($programs_macros{$word}, @{$programs{$word}});
|
||||
}
|
||||
foreach my $word (sort keys %makevars)
|
||||
{
|
||||
print_unique ($makevars_macros{$word}, @{$makevars{$word}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# output_libraries ()
|
||||
# -------------------
|
||||
sub output_libraries ()
|
||||
{
|
||||
print CONF "\n# Checks for libraries.\n";
|
||||
foreach my $word (sort keys %libraries)
|
||||
{
|
||||
print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
|
||||
print CONF "AC_CHECK_LIB([$word], [main])\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# output_headers ()
|
||||
# -----------------
|
||||
sub output_headers ()
|
||||
{
|
||||
my @have_headers;
|
||||
|
||||
print CONF "\n# Checks for header files.\n";
|
||||
foreach my $word (sort keys %headers)
|
||||
{
|
||||
if (defined $headers_macros{$word})
|
||||
{
|
||||
if ($headers_macros{$word} eq 'AC_CHECK_HEADERS')
|
||||
{
|
||||
push (@have_headers, $word);
|
||||
push (@{$needed_macros{"AC_CHECK_HEADERS([$word])"}},
|
||||
@{$headers{$word}});
|
||||
}
|
||||
else
|
||||
{
|
||||
print_unique ($headers_macros{$word}, @{$headers{$word}});
|
||||
}
|
||||
}
|
||||
}
|
||||
print CONF "AC_CHECK_HEADERS([" . join(' ', sort(@have_headers)) . "])\n"
|
||||
if @have_headers;
|
||||
}
|
||||
|
||||
|
||||
# output_identifiers ()
|
||||
# ---------------------
|
||||
sub output_identifiers ()
|
||||
{
|
||||
my @have_types;
|
||||
|
||||
print CONF "\n# Checks for typedefs, structures, and compiler characteristics.\n";
|
||||
foreach my $word (sort keys %identifiers)
|
||||
{
|
||||
if (defined $identifiers_macros{$word})
|
||||
{
|
||||
if ($identifiers_macros{$word} eq 'AC_CHECK_TYPES')
|
||||
{
|
||||
push (@have_types, $word);
|
||||
push (@{$needed_macros{"AC_CHECK_TYPES([$word])"}},
|
||||
@{$identifiers{$word}});
|
||||
}
|
||||
else
|
||||
{
|
||||
print_unique ($identifiers_macros{$word},
|
||||
@{$identifiers{$word}});
|
||||
}
|
||||
}
|
||||
}
|
||||
print CONF "AC_CHECK_TYPES([" . join(', ', sort(@have_types)) . "])\n"
|
||||
if @have_types;
|
||||
}
|
||||
|
||||
|
||||
# output_functions ()
|
||||
# -------------------
|
||||
sub output_functions ()
|
||||
{
|
||||
my @have_funcs;
|
||||
|
||||
print CONF "\n# Checks for library functions.\n";
|
||||
foreach my $word (sort keys %functions)
|
||||
{
|
||||
if (defined $functions_macros{$word})
|
||||
{
|
||||
if ($functions_macros{$word} eq 'AC_CHECK_FUNCS')
|
||||
{
|
||||
push (@have_funcs, $word);
|
||||
push (@{$needed_macros{"AC_CHECK_FUNCS([$word])"}},
|
||||
@{$functions{$word}});
|
||||
}
|
||||
else
|
||||
{
|
||||
print_unique ($functions_macros{$word},
|
||||
@{$functions{$word}});
|
||||
}
|
||||
}
|
||||
}
|
||||
print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n"
|
||||
if @have_funcs;
|
||||
}
|
||||
|
||||
|
||||
# output (CONFIGURE_SCAN)
|
||||
# -----------------------
|
||||
# Print a proto configure.ac.
|
||||
sub output ($)
|
||||
{
|
||||
my $configure_scan = shift;
|
||||
my %unique_makefiles;
|
||||
|
||||
open (CONF, ">$configure_scan") ||
|
||||
die "$me: cannot create $configure_scan: $!\n";
|
||||
|
||||
print CONF "# Process this file with autoconf to produce a configure script.\n";
|
||||
print CONF "AC_INIT\n";
|
||||
if (defined $initfile)
|
||||
{
|
||||
print CONF "AC_CONFIG_SRCDIR([$initfile])\n";
|
||||
}
|
||||
if (defined $cfiles[0])
|
||||
{
|
||||
print CONF "AC_CONFIG_HEADER([config.h])\n";
|
||||
}
|
||||
|
||||
output_programs;
|
||||
output_libraries;
|
||||
output_headers;
|
||||
output_identifiers;
|
||||
output_functions;
|
||||
|
||||
# Change DIR/Makefile.in to DIR/Makefile.
|
||||
foreach my $m (@makefiles)
|
||||
{
|
||||
$m =~ s/\.in$//;
|
||||
$unique_makefiles{$m}++;
|
||||
}
|
||||
print CONF "\nAC_CONFIG_FILES([",
|
||||
join ("\n ", keys(%unique_makefiles)), "])\n";
|
||||
print CONF "AC_OUTPUT\n";
|
||||
|
||||
close CONF ||
|
||||
die "$me: closing $configure_scan: $!\n";
|
||||
}
|
||||
|
||||
|
||||
# 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) = $@;
|
||||
my ($trace_option) = '';
|
||||
|
||||
foreach my $macro (sort keys %needed_macros)
|
||||
{
|
||||
$macro =~ s/\(.*//;
|
||||
$trace_option .= " -t $macro";
|
||||
}
|
||||
|
||||
open (TRACES, "$autoconf -A $datadir $trace_option $configure_ac|") ||
|
||||
die "$me: cannot create read traces: $!\n";
|
||||
|
||||
while (<TRACES>)
|
||||
{
|
||||
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});
|
||||
}
|
||||
}
|
||||
|
||||
close (TRACES) ||
|
||||
die "$me: cannot close traces: $!\n";
|
||||
|
||||
foreach my $macro (sort keys %needed_macros)
|
||||
{
|
||||
warn "$me: warning: missing $macro wanted by: \n";
|
||||
foreach my $need (@{$needed_macros{$macro}})
|
||||
{
|
||||
warn "\t$need\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Main program. ##
|
||||
## -------------- ##
|
||||
|
||||
# Find the lib files and autoconf.
|
||||
find_autoconf;
|
||||
my $configure_ac = find_configure_ac;
|
||||
parse_args;
|
||||
init_tables;
|
||||
find ('.');
|
||||
scan_files;
|
||||
output ('configure.scan');
|
||||
if ($configure_ac)
|
||||
{
|
||||
check_configure_ac ($configure_ac);
|
||||
}
|
||||
|
||||
exit 0;
|
1134
autoupdate.sh
1134
autoupdate.sh
File diff suppressed because it is too large
Load Diff
133
ifnames.sh
133
ifnames.sh
@ -1,133 +0,0 @@
|
||||
#! @SHELL@
|
||||
# ifnames - print the identifiers used in C preprocessor conditionals
|
||||
# Copyright 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# Reads from stdin if no files are given.
|
||||
# Writes to stdout.
|
||||
|
||||
# Written by David MacKenzie <djm@gnu.ai.mit.edu>
|
||||
# and Paul Eggert <eggert@twinsun.com>.
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
usage="\
|
||||
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 <bug-autoconf@gnu.org>."
|
||||
|
||||
version="\
|
||||
ifnames (@PACKAGE_NAME@) @VERSION@
|
||||
Written by David J. MacKenzie and Paul Eggert.
|
||||
|
||||
Copyright 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="\
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
--help | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
--version | -V )
|
||||
echo "$version"; exit 0 ;;
|
||||
--) # Stop option processing.
|
||||
shift; break ;;
|
||||
-*)
|
||||
exec >&2
|
||||
echo "$me: invalid option $1"
|
||||
echo "$help"
|
||||
exit 1 ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Variables.
|
||||
: ${AWK=@AWK@}
|
||||
|
||||
$AWK '
|
||||
# Record that sym was found in FILENAME.
|
||||
function file_sym(sym, i, fs)
|
||||
{
|
||||
if (sym ~ /^[A-Za-z_]/)
|
||||
{
|
||||
if (!found[sym,FILENAME])
|
||||
{
|
||||
found[sym,FILENAME] = 1
|
||||
|
||||
# Insert FILENAME into files[sym], keeping the list sorted.
|
||||
i = 1
|
||||
fs = files[sym]
|
||||
while (match(substr(fs, i), /^ [^ ]*/) \
|
||||
&& substr(fs, i + 1, RLENGTH - 1) < FILENAME)
|
||||
{
|
||||
i += RLENGTH
|
||||
}
|
||||
files[sym] = substr(fs, 1, i - 1) " " FILENAME substr(fs, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
while (sub(/\\$/, "", $0) > 0)
|
||||
{
|
||||
if ((getline tmp) > 0)
|
||||
$0 = $0 tmp
|
||||
else
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/^[\t ]*#/ {
|
||||
if (sub(/^[\t ]*#[\t ]*ifn?def[\t ]+/, "", $0))
|
||||
{
|
||||
sub(/[^A-Za-z_0-9].*/, "", $0)
|
||||
file_sym($0)
|
||||
}
|
||||
if (sub(/^[\t ]*#[\t ]*(el)?if[\t ]+/, "", $0))
|
||||
{
|
||||
# Remove comments. Not perfect, but close enough.
|
||||
gsub(/\/\*[^\/]*(\*\/)?/, "", $0)
|
||||
|
||||
for (i = split($0, field, /[^A-Za-z_0-9]+/); 1 <= i; i--)
|
||||
{
|
||||
if (field[i] != "defined")
|
||||
{
|
||||
file_sym(field[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
for (sym in files)
|
||||
{
|
||||
print sym files[sym]
|
||||
}
|
||||
}
|
||||
' ${1+"$@"} | sort
|
@ -29,12 +29,12 @@ MAINTAINERCLEANFILES = $(man_MANS)
|
||||
|
||||
# Depend on configure.in to get version number changes.
|
||||
common_dep = $(top_srcdir)/configure.in $(srcdir)/common.x
|
||||
autoconf.1: $(common_dep) $(srcdir)/autoconf.x $(top_srcdir)/autoconf.sh
|
||||
autoreconf.1: $(common_dep) $(srcdir)/autoreconf.x $(top_srcdir)/autoreconf.sh
|
||||
autoheader.1: $(common_dep) $(srcdir)/autoheader.x $(top_srcdir)/autoheader.sh
|
||||
autoconf.1: $(common_dep) $(srcdir)/autoconf.x $(top_srcdir)/autoconf.in
|
||||
autoreconf.1: $(common_dep) $(srcdir)/autoreconf.x $(top_srcdir)/autoreconf.in
|
||||
autoheader.1: $(common_dep) $(srcdir)/autoheader.x $(top_srcdir)/autoheader.in
|
||||
autoupdate.1: $(common_dep) $(srcdir)/autoupdate.x $(top_srcdir)/autoupdate.in
|
||||
ifnames.1: $(common_dep) $(srcdir)/ifnames.x $(top_srcdir)/ifnames.sh
|
||||
autoscan.1: $(common_dep) $(srcdir)/autoscan.x $(top_srcdir)/autoscan.pl
|
||||
ifnames.1: $(common_dep) $(srcdir)/ifnames.x $(top_srcdir)/ifnames.in
|
||||
autoscan.1: $(common_dep) $(srcdir)/autoscan.x $(top_srcdir)/autoscan.in
|
||||
|
||||
# Independent from this package.
|
||||
config.guess.1: $(srcdir)/config.guess.x $(top_srcdir)/config.guess
|
||||
|
@ -229,12 +229,12 @@ install-am install uninstall-am uninstall all-redirect all-am all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
autoconf.1: $(common_dep) $(srcdir)/autoconf.x $(top_srcdir)/autoconf.sh
|
||||
autoreconf.1: $(common_dep) $(srcdir)/autoreconf.x $(top_srcdir)/autoreconf.sh
|
||||
autoheader.1: $(common_dep) $(srcdir)/autoheader.x $(top_srcdir)/autoheader.sh
|
||||
autoconf.1: $(common_dep) $(srcdir)/autoconf.x $(top_srcdir)/autoconf.in
|
||||
autoreconf.1: $(common_dep) $(srcdir)/autoreconf.x $(top_srcdir)/autoreconf.in
|
||||
autoheader.1: $(common_dep) $(srcdir)/autoheader.x $(top_srcdir)/autoheader.in
|
||||
autoupdate.1: $(common_dep) $(srcdir)/autoupdate.x $(top_srcdir)/autoupdate.in
|
||||
ifnames.1: $(common_dep) $(srcdir)/ifnames.x $(top_srcdir)/ifnames.sh
|
||||
autoscan.1: $(common_dep) $(srcdir)/autoscan.x $(top_srcdir)/autoscan.pl
|
||||
ifnames.1: $(common_dep) $(srcdir)/ifnames.x $(top_srcdir)/ifnames.in
|
||||
autoscan.1: $(common_dep) $(srcdir)/autoscan.x $(top_srcdir)/autoscan.in
|
||||
|
||||
# Independent from this package.
|
||||
config.guess.1: $(srcdir)/config.guess.x $(top_srcdir)/config.guess
|
||||
|
Loading…
Reference in New Issue
Block a user