Rename as...
* autoconf.in, autoreconf.in, autoheader.in, autoscan.in, ifnames.in:
these.
+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.
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:
## 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
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
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:
$(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
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
------------------------------------------------------------------------------
-* Autoconf 2.50
+* Autoconf 2.51
** --target & AC_ARG_PROGRAM
Shouldn't *any* `program' be installed as `$target_alias-program' even
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
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.
------------------------------------------------------------------------------
+++ /dev/null
-#! @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
+++ /dev/null
-#! @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
+++ /dev/null
-#! @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:
+++ /dev/null
-#! @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;
+++ /dev/null
-#! @PERL@ -w
-# autoupdate - modernize an Autoconf file.
-# 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.
-
-# Originally written by David MacKenzie <djm@gnu.ai.mit.edu>.
-# Rewritten by Akim Demaille <akim@freefriends.org>.
-
-use 5.005;
-use Getopt::Long;
-use File::Basename;
-use strict;
-
-(my $me = $0) =~ s,.*[\\/],,;
-
-# Lib files.
-my $autoconf_dir = $ENV{"AC_MACRODIR"} || "@datadir@";
-my $autoconf = '';
-my $debug = 0;
-my $localdir = '.';
-# m4.
-my $m4 = $ENV{"M4"} || "@M4@";
-my $verbose = 0;
-my $SIMPLE_BACKUP_SUFFIX = $ENV{'SIMPLE_BACKUP_SUFFIX'} || '~';
-my $tmp = '';
-
-
-## ---------- ##
-## Routines. ##
-## ---------- ##
-
-
-# &mktmpdir ()
-# ------------
-sub mktmpdir ()
-{
- my $TMPDIR = $ENV{'TMPDIR'} || '/tmp';
-
- # If mktemp supports dirs, use it to please Marc E.
- $tmp = `(umask 077 && mktemp -d -q "$TMPDIR/auXXXXXX") 2>/dev/null`;
- chomp $tmp;
-
- if (!$tmp || !-d $tmp)
- {
- $tmp = "$TMPDIR/au" . int (rand 10000) . ".$$";
- mkdir $tmp, 0700
- or die "$me: cannot create $tmp: $!\n";
- }
-
- print STDERR "$me:$$: working in $tmp\n"
- if $debug;
-}
-
-
-# END
-# ---
-# Exit nonzero whenever closing STDOUT fails.
-sub END
-{
- use POSIX qw (_exit);
-
- my ($q) = ($?);
-
- # FIXME: Heelp! Can't find a means to properly catch system's
- # exit status (without hair I mean).
- # my $status = $? >> 8;
-
- if (!$debug && -d $tmp)
- {
- unlink <$tmp/*>
- or warn ("$me: cannot empty $tmp: $!\n"), _exit (1);
- rmdir $tmp
- or warn ("$me: cannot remove $tmp: $!\n"), _exit (1);
- }
-
- # 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);
-
- ($!, $?) = (0, $q);
-}
-
-
-# print_usage ()
-# --------------
-# Display usage (--help).
-sub print_usage ()
-{
- print <<"END";
-Usage: $0 [OPTION] ... [TEMPLATE-FILE...]
-
-Update the 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
-
-Library directories:
- -A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed)
- -l, --localdir=DIR location of \`aclocal.m4'
-
-Environment variables:
- M4 GNU M4 1.4 or above
- AUTOCONF autoconf @VERSION@
-
-Report bugs to <bug-autoconf\@gnu.org>.
-END
- exit 0;
-}
-
-
-# print_version ()
-# ----------------
-# Display version (--version).
-sub print_version
-{
- print <<END;
-autoupdate (@PACKAGE_NAME@) @VERSION@
-Written by David J. MacKenzie and Akim Demaille.
-
-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.
-END
- exit 0;
-}
-
-
-# $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;
-}
-
-
-# parse_args ()
-# -------------
-# Process any command line arguments.
-sub parse_args ()
-{
- my $srcdir;
- # F*k. Getopt seems bogus and dies when given `-' with `bundling'.
- # If fixed some day, use this: '' => sub { push @ARGV, "-" }
- my $update_stdin = grep /^-$/, @ARGV;
- @ARGV = grep !/^-$/, @ARGV;
- Getopt::Long::config ("bundling");
- Getopt::Long::GetOptions ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
- 'l|localdir=s' => \$localdir,
- 'd|debug' => \$debug,
- 'h|help' => \&print_usage,
- 'V|version' => \&print_version,
- 'v|verbose' => \$verbose)
- or exit 1;
- push @ARGV, '-'
- if $update_stdin;
- if (! @ARGV)
- {
- my $configure_ac = find_configure_ac;
- die 'no input file'
- unless $configure_ac;
- push @ARGV, $configure_ac;
- }
-}
-
-
-# find_slaves
-# -----------
-# Find the lib files and autoconf.
-sub find_slaves ()
-{
- # Some non-GNU m4's don't reject the --help option, so give them /dev/null.
- die "Autoconf requires GNU m4 1.4 or later\n"
- if system "$m4 --help </dev/null 2>&1 | fgrep reload-state >/dev/null";
-
- # autoconf.
- (my $dir = $0) =~ s,[^\\/]*$,,;
-
- # 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;
- }
- }
-
- # This is needed because perl's '-x' isn't a smart as bash's; that
- # is, it won't find autoconf.sh.
- $autoconf = 'autoconf'
- if !$autoconf;
-}
-
-
-## -------------- ##
-## Main program. ##
-## -------------- ##
-find_slaves;
-parse_args;
-mktmpdir;
-$autoconf .= " --autoconf-dir $autoconf_dir --localdir $localdir";
-
-
-# @M4_BUILTINS -- M4 builtins and a useful comment.
-my @m4_builtins = `echo dumpdef | $m4 2>&1 >/dev/null`;
-map { s/:.*//;s/\W// } @m4_builtins;
-
-
-# m4.m4 -- enable the m4 builtins.
-# unm4.m4 -- disable the m4 builtins.
-# savem4.m4 -- save the m4 builtins.
-open M4_M4, ">$tmp/m4.m4"
- or die "$me: cannot open: $!\n";
-open UNM4_M4, ">$tmp/unm4.m4"
- or die "$me: cannot open: $!\n";
-open M4SAVE_M4, ">$tmp/m4save.m4"
- or die "$me: cannot open: $!\n";
-foreach (@m4_builtins)
- {
- print M4_M4 "_au_define([$_], _au_defn([_au_$_]))\n";
- print UNM4_M4 "_au_undefine([$_])\n";
- print M4SAVE_M4 "define([_au_$_], defn([$_]))\n";
- }
-close M4SAVE_M4
- or die "$me: cannot close: $!\n";
-close UNM4_M4
- or die "$me: cannot close: $!\n";
-close M4_M4
- or die "$me: cannot close: $!\n";
-
-
-# @AU_MACROS & AC_MACROS -- AU and AC macros and yet another useful comment.
-open MACROS, ("$autoconf "
- . "--trace AU_DEFUN:'AU:\$f:\$1' --trace define:'AC:\$f:\$1' "
- . "-i /dev/null |")
- or die "$me: cannot open: $!\n";
-my (%ac_macros, %au_macros);
-while (<MACROS>)
- {
- chomp;
- /^(AC|AU):(.*):([^:]*)$/ or next;
- my $filename = basename ($2);
- if ($1 eq "AC")
- {
- $ac_macros{$3} = $filename;
- }
- else
- {
- $au_macros{$3} = $filename;
- }
- }
-close MACROS
- or die "$me: cannot close: $!\n";
-# Don't keep AU macros in @AC_MACROS.
-delete $ac_macros{$_}
- foreach (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";
- }
-
-# $au_changequote -- enable the quote `[', `]' right before any AU macro.
-my $au_changequote =
- 's/\b(' . join ('|', keys %au_macros) . ')\b/_au_changequote([,])$1/g';
-
-# au.m4 -- definitions the AU macros.
-system ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:\@\$1\@:>\@,
-\@<:\@\$2\@:>\@)' -i /dev/null "
- . ">$tmp/au.m4");
-
-# ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded).
-# disable.m4 -- undefine the macros of AC and m4sugar.
-open AC_M4, ">$tmp/ac.m4"
- or die "$me: cannot open: $!\n";
-open DISABLE_M4, ">$tmp/disable.m4"
- or die "$me: cannot open: $!\n";
-foreach (sort keys %ac_macros)
- {
- print AC_M4 "_au_define([$_], [[\$0(\$\@)]])\n"
- unless $ac_macros{$_} eq "m4sugar.m4";
- print DISABLE_M4 "_au_undefine([$_])\n";
- }
-close DISABLE_M4
- or die "$me: cannot close: $!\n";
-close AC_M4
- or die "$me: cannot close: $!\n";
-
-
-
-## ------------------- ##
-## Process the files. ##
-## ------------------- ##
-
-foreach my $file (@ARGV)
- {
- my $filename = $file;
- # We need an actual file.
- if ($file eq '-')
- {
- $file = "$tmp/stdin";
- system "cat >$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([, ])
-
- # Move all the builtins into the \`_au_' pseudo namespace
- include([$tmp/m4save.m4])
-
- # _au_defun(NAME, BODY)
- # ---------------------
- # Define NAME to BODY, plus AU activation/deactivation.
- _au_define([_au_defun],
- [_au_define([\$1],
- [_au_enable()dnl
- \$2[]dnl
- _au_disable()])])
-
- # Import the definition of the obsolete macros.
- _au_include([$tmp/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). But since AU macros might use AU macros, which should
- # enable/disable only for the outter AU macros.
- #
- # \`_au_enabled' is used to this end, condionning whether we really
- # enable/disable.
-
-
- # __au_enable
- # -----------
- # Reenable the builtins, and m4sugar.
- _au_define([__au_enable],
- [_au_divert(-1)
- # Enable special characters.
- _au_changecom([#])
-
- # Enable the m4 builtins, m4sugar and the autoquoting AC macros.
- _au_include([$tmp/m4.m4])
- _au_include([$autoconf_dir/m4sugar.m4])
- _au_include([$tmp/ac.m4])
-
- _au_divert(0)])
-
- # _au_enable
- # ----------
- # Called at the beginning of all the obsolete macros. Reenable the
- # builtins, and m4sugar if needed.
- _au_define([_au_enable],
- [_au_ifdef([_au_enabled],
- [],
- [__au_enable()])_au_dnl
- _au_pushdef([_au_enabled])])
-
-
- # __au_disable
- # ------------
- # Disable the builtins, and m4sugar.
- _au_define([__au_disable],
- [_au_divert(-1)
- # Disable m4sugar, the AC autoquoting macros, and m4.
- _au_include([$tmp/disable.m4])
- _au_include([$tmp/unm4.m4])
-
- # Disable special characters.
- _au_changequote()
- _au_changecom()
-
- _au_divert(0)])
-
- # _au_disable
- # -----------
- # Called at the end of all the obsolete macros. Disable the
- # builtins, and m4sugar if needed..
- _au_define([_au_disable],
- [_au_popdef([_au_enabled])_au_dnl
- _au_ifdef([_au_enabled],
- [],
- [__au_disable()])])
-
-
- ## ------------------------------- ##
- ## Disable, and process the file. ##
- ## ------------------------------- ##
- _au_disable()_au_dnl
-EOF
-
- $input_m4 =~ s/^ //mg;
-
- # prepared input -- input, but reenables the quote before each AU macro.
- open INPUT_M4, ">$tmp/input.m4"
- or die "$me: cannot open: $!\n";
- open FILE, "<$file"
- or die "$me: cannot open: $!\n";
- print INPUT_M4 "$input_m4";
- while (<FILE>)
- {
- eval $au_changequote;
- print INPUT_M4;
- }
- close FILE
- or die "$me: cannot close: $!\n";
- close INPUT_M4
- or die "$me: cannot close: $!\n";
-
- # Now ask m4 to perform the update.
- print STDERR "$me: running $m4 $tmp/input.m4\n"
- if $verbose;
- if (system ("$m4 $tmp/input.m4 >$tmp/updated"))
- {
- # Exit status of system() is in the upper byte.
- $! >>= 8;
- die "$me: cannot update \`$filename'\n";
- };
-
- if ("$file" eq "$tmp/stdin")
- {
- system ("cat $tmp/updated");
- }
- elsif (! system ("cmp -s $tmp/updated $file"))
- {
- # File didn't change, so don't update its mod time.
- print STDERR "$me: \`$file' is unchanged\n"
- }
- else
- {
- # Back up and install the new one.
- if (system ("mv $file $file${SIMPLE_BACKUP_SUFFIX} && "
- . "mv $tmp/updated $file") == 0)
- {
- print STDERR "$me: \`$file' is updated\n";
- }
- else
- {
- die "$me: cannot update \`$file'\n";
- }
- }
- }
-
-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 fourth implementation of `autoupdate'.
-#
-# Below, we will use a simple example of 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 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 to extend the
-# `sed' scripts with specialized code for complex macros. But 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 from sed.
-#
-# 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), which 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 to design 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 has probably $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' as 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 we 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
-# `yipeee!'.
-#
-#
-# # 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... nothinhg, 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 OUTTER includes
-# an AU macro INNER, then _au_enable will be run when entering OUTTER
-# 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 OUTTER. 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.)
+++ /dev/null
-#! @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
# 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
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