Multiple `-e' to egrep are not portable. On IRIX 6.5 and Solaris
2.5.1 only the last one is honored:
- > echo "foo\nbar" | egrep -e 'foo' -e 'bar'
+ > printf "foo\nbar" | egrep -e 'foo' -e 'bar'
bar
- > echo "foo\nbar" | egrep -e 'bar' -e 'foo'
+ > printf "foo\nbar" | egrep -e 'bar' -e 'foo'
foo
Reported by Nicolas Joly.
An alternative would have been to use `sed', unfortunately
comment.
* libm4.m4 (m4_quote): s/$@/$*/.
- * acgeneral.m4 (AC_COPYRIGHT): Prepend `# ' to the lines that goes
+ * acgeneral.m4 (AC_COPYRIGHT): Prepend `# ' to the lines that go
on the top of `configure'. Actually, prepend `@%:@ ' so that
there are as many evaluations on both sides.
(_AC_INIT_VERSION): No longer strip `# '.
[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
-# AC_PROG_BINSH
-# -------------
-# Check the maximum length of an here document.
-# FIXME: Is this test really reliable?
-AC_DEFUN(AC_PROG_BINSH,
-[AC_CACHE_CHECK([for max here document length], ac_cv_prog_binsh_max_heredoc,
-[echo >conftest.s1 "\
-ac_test='This is a sample string to test here documents.'"
-dnl 2^8 = 256 lines
-for ac_cnt in 0 1 2 3 4 5 6 7
-do
- cat conftest.s1 conftest.s1 >conftest.sh
- mv conftest.sh conftest.s1
-done
-echo 'cat >conftest.s1 <<CEOF' >conftest.sh
-cat conftest.s1 >>conftest.sh
-echo 'echo "Success"' >>conftest.sh
-echo 'CEOF' >>conftest.sh
-$SHELL ./conftest.sh
-if test "`$SHELL ./conftest.s1`" != Success; then
-dnl Some people say to limit oneself to 12, which seems incredibly small.
- ac_cv_prog_binsh_max_heredoc=12
-else
- ac_cv_prog_binsh_max_heredoc=infinite
-fi
-])dnl
-])# AC_PROG_BINSH
-
-
# AC_PROG_YACC
# ------------
AC_DEFUN(AC_PROG_YACC,
#! @SHELL@
# autoconf -- create `configure' using m4 macros
-# Copyright (C) 1992, 1993, 1994, 1996, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1992, 93, 94, 96, 99, 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
If the option \`--trace' is used, no configuration script is created.
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -m, --macrodir=DIR directory storing Autoconf's macro files
- -l, --localdir=DIR directory storing the \`aclocal.m4' file
- -t, --trace=MACRO report the list of calls to MACRO
- -o, --output=FILE save output in FILE (stdout is the default)
+ -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
+ -m, --macrodir=DIR directory storing Autoconf's macro files
+ -l, --localdir=DIR directory storing the \`aclocal.m4' file
+ -t, --trace=MACRO report the list of calls to MACRO
+ -i, --initialization also trace Autoconf's initialization process
+ -o, --output=FILE save output in FILE (stdout is the default)
Report bugs to <bug-autoconf@gnu.org>."
autoconf (GNU @PACKAGE@) @VERSION@
Written by David J. MacKenzie.
-Copyright (C) 1992, 1993, 1994, 1996, 1999 Free Software Foundation, Inc.
+Copyright (C) 1992, 93, 94, 96, 99, 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."
/*) 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
+case `$M4 --help </dev/null 2>&1` in
*reload-state*);;
*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
esac
: ${AC_MACRODIR=@datadir@}
: ${AC_ACLOCALDIR=`(aclocal --print-ac-dir) 2>/dev/null`}
: ${AWK=@AWK@}
+debug=false
+# Trace Autoconf's initialization?
+initialization=false
localdir=
outfile=
# Tasks:
# Produce the configure script (default)
task=script
: ${TMPDIR=/tmp}
-tmpin=$TMPDIR/acin.$$
-tmpout=$TMPDIR/acout.$$
+tmpin=$TMPDIR/ac$$.in
+tmpout=$TMPDIR/ac$$.out
+silent_m4=$TMPDIR/silent$$.m4
+trace_m4=$TMPDIR/trace$$.m4
+translate_awk=$TMPDIR/trans$$.awk
verbose=:
# Parse command line
echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=:; shift ;;
--localdir=* | --l*=* )
localdir=`echo "$1" | sed -e 's/^[^=]*=//'`
task=install
shift;;
- --verbose | --verb* )
+ --verbose | --verb* | -v )
verbose=echo
shift;;
--trace | -t )
task=trace
shift
- traces="$traces -t $1"
+ test $# -eq 0 && { echo "$help" >&2; exit 1; }
+ traces="$traces '$1'"
shift ;;
--trace=* )
task=trace
- traces="$traces -t `echo \"$1\" | sed -e 's/^[^=]*=//'`"
+ traces="$traces '"`echo "$1" | sed -e 's/^[^=]*=//;s/:.*//'`"'"
shift ;;
+ --initialization | -i )
+ initialization=:
+ shift;;
--output | -o )
shift
+ test $# -eq 0 && { echo "$help" >&2; exit 1; }
outfile="$1"
shift ;;
--output=* )
done
# Running m4.
-if test -n "$localdir"; then
- use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
-fi
-run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
-
+test -n "$localdir" && use_localdir="-I$localdir"
+run_m4="$M4 $use_localdir -I $AC_MACRODIR autoconf.m4"
+run_m4f="$M4 $use_localdir --reload $AC_MACRODIR/autoconf.m4f"
+# Find the input file.
case $# in
0) infile=configure.in
test $task = script && test "x$outfile" = x && outfile=configure;;
exit 1 ;;
esac
-trap 'rm -f $tmpin $tmpout' 0 1 2 15
+# Trap on 0 to stop playing with `rm'.
+if $debug; then
+ trap 'ah_status=$?
+ rm -f $tmpin $tmpout $silent_m4 $trace_m4 && exit $ah_status' 0
+ trap exit 1 2 13 15
+fi
+
if test z$infile = z-; then
infile=$tmpin
cat >$infile
## Generate the script. ##
## --------------------- ##
script)
- $run_m4 $infile > $tmpout || exit 2
+ $run_m4f $infile >$tmpout || exit 2
# You could add your own prefixes to pattern if you wanted to check for
# them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do
pattern="A[CHM]_"
status=0
- if grep "^[^#]*$pattern" $tmpout > /dev/null 2>&1; then
- echo "autoconf: Undefined macros:" >&2
+ if grep "^[^#]*$pattern" $tmpout >/dev/null 2>&1; then
+ echo "$me: undefined macros:" >&2
sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmpout |
while read macro; do
grep -n "^[^#]*$macro" $infile /dev/null
' >&4
;; # End of the task script.
+
+
## -------------- ##
## Trace macros. ##
## -------------- ##
trace)
- $run_m4 $traces -dafl $infile -o $tmpout>/dev/null || exit 2
- # The output looks like this:
- # | m4trace:configure.in:2: -1- AC_CHECK_FUNCS(foo bar
- # | baz, fubar)
- # and should be like this:
- # configure.in:2:AC_CHECK_FUNCS:foo bar baz, fubar
- cat $tmpout |
- # No need to be too verbose
- uniq |
- sed -e 's/m4trace:/@&/' |
- # Join arguments spread on several lines
- tr "$ac_LF_and_DOT" ' .' |
- tr @. "$ac_LF_and_DOT" |
- # Remove m4trace and -1-
- sed -n -e 's/^[^:]*:\([^:]*:[^:]*:\)[^a-zA-Z_]*\([a-zA-Z_]*.*\) $/\1\2/p' |
- # Replace the first `(' by a colon, remove the last `)'.
- sed -e 's/(/:/; s/)$//' >&4
- # The last eof was eaten.
- echo >&4
+ # `errprint' must be silent when we run `m4 --trace', otherwise there
+ # can be warnings mixed with traces in m4's stderr.
+ cat >$silent_m4 <<\EOF
+define(`errprint')dnl
+EOF
+ # A program to trace m4 macros.
+ cat >$trace_m4 <<\EOF
+divert(-1)
+ changequote([, ])
+ define([_at],
+ [ifelse([$#], [1], [],
+ [$#], [2], [[[$2]]],
+ [[[$2]][$1]_at([$1], shift(shift($@)))])])
+ define([_star],
+ [ifelse([$#], [1], [],
+ [$#], [2], [smash([$2])],
+ [smash([$2])[$1]_star([$1], shift(shift($@)))])])
+ define([smash],
+ [patsubst(patsubst(patsubst(patsubst([[[[$1]]]],
+ [\\
+]),
+ [[
+ ]+],
+ [ ]),
+ [^\(..\) ], [\1]),
+ [ \(.\)$], [\1])])
+ define([args],
+ [shift(shift(shift(shift(shift($@)))))])
+ define([at],
+ [_at([$1], args($@))])
+ define([star],
+ [_star([$1], args($@))])
+EOF
+ # A program to translate user tracing requests into m4 macros.
+ cat >$translate_awk <<\EOF
+BEGIN {
+ # File name.
+ trans["f"] = "$1";
+ # Line number.
+ trans["l"] = "$2";
+ # Depth.
+ trans["d"] = "$3";
+ # Name (also available as $0).
+ trans["n"] = "$4";
+ # Escaped dollar.
+ trans["$"] = "$";
+ # $@, list of quoted effective arguments.
+ trans["@"] = "]at([,], $@)[";
+ # $*, list of unquoted effective arguments.
+ trans["*"] = "]star([:], $@)[";
+}
+
+{
+ res = "";
+
+ for (cp = $0; 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$@*]/)
+ {
+ res = res trans[substr (cp, 2, 1)];
+ cp = substr(cp, 2);
+ }
+ else if (substr (cp, 3, 1) == "@")
+ {
+ res = res "]at([" substr (cp, 2, 1) "], $@)[";
+ cp = substr(cp, 3);
+ }
+ else if (substr (cp, 3, 1) == "*")
+ {
+ res = res "]star([" substr (cp, 2, 1) "], $@)[";
+ cp = substr(cp, 3);
+ }
+ else
+ {
+ print "invalid escape: " substr (cp, 1, 2) >"/dev/stderr";
+ exit 1
+ }
+ }
+ else
+ res = res char;
+ }
+ print res;
+}
+EOF
+ # Extract both the m4 program and the m4 options from TRACES.
+ eval set dummy $traces
+ shift
+ for trace
+ do
+ # The request may be several lines long, hence sed has to quit.
+ trace_opt="$trace_opt -t "`echo "$trace" | sed -e 's/:.*//;q'`
+ case "$trace" in
+ *:*)
+ # The `]])' are closing the `define' which is started by sed.
+ # This is to cope with multiple line requests.
+ echo "$trace]])" |
+ sed -e '1s/^\([^:]*\):\(.*\)$/define([AT_\1], [[\2/';;
+ *)
+ # Default request.
+ echo "define([AT_$trace], [[\$f:\$l:\$n:\$*]])";;
+ esac |
+ $AWK -f $translate_awk >>$trace_m4
+ done
+ echo "divert(0)dnl" >>$trace_m4
+
+ # Do we trace the initialization?
+ if $initialization; then
+ run_m4_trace="$run_m4 $trace_opt -daflq $silent"
+ else
+ run_m4_trace="$run_m4f $trace_opt -daflq $silent"
+ fi
+
+ # Run m4 on the input file to get traces.
+ $verbose "Running $run_m4_trace $infile" >&2
+ $run_m4_trace $infile 2>&1 >/dev/null |
+ sed -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/' \
+ -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/' >>$trace_m4
+
+ # Now we are ready to run m4 to process the trace file.
+ $verbose "Running $M4 $trace_m4" >&2
+ $M4 $trace_m4 >&4
;;
dnl this argument will be expanded, and we'll get pure junk out of m4.
define([AC_INCLUDE])
EOF
- # Run m4 with all the library files, save its report on strderr.
- $verbose Running $run_m4 -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile
- $run_m4 -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >the-script 2>$tmpout
+ # Run m4 with all the library files, discard stdout, save stderr.
+ $verbose Running $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
+ $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >/dev/null 2>$tmpout
# Keep only the good lines, there may be other outputs
grep '^[^: ]*:[0-9][0-9]*:[^:]*$' $tmpout >$tmpin
# Extract the files that are not in the local dir, and install the links.
# Save in $tmpout the list of installed links.
>$tmpout
- $verbose "Required macros:"
- $verbose "`sed -e 's/^/| /' $tmpin`"
+ $verbose "Required macros:" >&2
+ $verbose "`sed -e 's/^/| /' $tmpin`" >&2
cat $tmpin |
while read line
do
macro=`echo "$line" | sed -e 's/.*:[ ]*//'`
if test -f "$file" && test "x$file" != "x$infile"; then
if test -f $localdir/$filename; then
- $verbose "$filename already installed"
+ $verbose "$filename already installed" >&2
else
- $verbose "installing $file which provides $macro"
+ $verbose "installing $file which provides $macro" >&2
ln -s "$file" "$localdir/$filename" ||
cp "$file" "$localdir/$filename" ||
{
export AC_ACLOCALDIR
export AC_MACRODIR
# Not m4_s?include, because it would catch acsite and aclocal, which
- # we don't care of.
- $0 -l "$localdir" -t AC_INCLUDE $inline |
+ # we don't care about.
+ $0 -l "$localdir" -t AC_INCLUDE $infile |
sed -e 's/^[^:]*:[^:]*:[^:]*://g' |
sort |
uniq >$tmpin
#! @SHELL@
# autoconf -- create `configure' using m4 macros
-# Copyright (C) 1992, 1993, 1994, 1996, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1992, 93, 94, 96, 99, 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
If the option \`--trace' is used, no configuration script is created.
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -m, --macrodir=DIR directory storing Autoconf's macro files
- -l, --localdir=DIR directory storing the \`aclocal.m4' file
- -t, --trace=MACRO report the list of calls to MACRO
- -o, --output=FILE save output in FILE (stdout is the default)
+ -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
+ -m, --macrodir=DIR directory storing Autoconf's macro files
+ -l, --localdir=DIR directory storing the \`aclocal.m4' file
+ -t, --trace=MACRO report the list of calls to MACRO
+ -i, --initialization also trace Autoconf's initialization process
+ -o, --output=FILE save output in FILE (stdout is the default)
Report bugs to <bug-autoconf@gnu.org>."
autoconf (GNU @PACKAGE@) @VERSION@
Written by David J. MacKenzie.
-Copyright (C) 1992, 1993, 1994, 1996, 1999 Free Software Foundation, Inc.
+Copyright (C) 1992, 93, 94, 96, 99, 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."
/*) 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
+case `$M4 --help </dev/null 2>&1` in
*reload-state*);;
*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
esac
: ${AC_MACRODIR=@datadir@}
: ${AC_ACLOCALDIR=`(aclocal --print-ac-dir) 2>/dev/null`}
: ${AWK=@AWK@}
+debug=false
+# Trace Autoconf's initialization?
+initialization=false
localdir=
outfile=
# Tasks:
# Produce the configure script (default)
task=script
: ${TMPDIR=/tmp}
-tmpin=$TMPDIR/acin.$$
-tmpout=$TMPDIR/acout.$$
+tmpin=$TMPDIR/ac$$.in
+tmpout=$TMPDIR/ac$$.out
+silent_m4=$TMPDIR/silent$$.m4
+trace_m4=$TMPDIR/trace$$.m4
+translate_awk=$TMPDIR/trans$$.awk
verbose=:
# Parse command line
echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=:; shift ;;
--localdir=* | --l*=* )
localdir=`echo "$1" | sed -e 's/^[^=]*=//'`
task=install
shift;;
- --verbose | --verb* )
+ --verbose | --verb* | -v )
verbose=echo
shift;;
--trace | -t )
task=trace
shift
- traces="$traces -t $1"
+ test $# -eq 0 && { echo "$help" >&2; exit 1; }
+ traces="$traces '$1'"
shift ;;
--trace=* )
task=trace
- traces="$traces -t `echo \"$1\" | sed -e 's/^[^=]*=//'`"
+ traces="$traces '"`echo "$1" | sed -e 's/^[^=]*=//;s/:.*//'`"'"
shift ;;
+ --initialization | -i )
+ initialization=:
+ shift;;
--output | -o )
shift
+ test $# -eq 0 && { echo "$help" >&2; exit 1; }
outfile="$1"
shift ;;
--output=* )
done
# Running m4.
-if test -n "$localdir"; then
- use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
-fi
-run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
-
+test -n "$localdir" && use_localdir="-I$localdir"
+run_m4="$M4 $use_localdir -I $AC_MACRODIR autoconf.m4"
+run_m4f="$M4 $use_localdir --reload $AC_MACRODIR/autoconf.m4f"
+# Find the input file.
case $# in
0) infile=configure.in
test $task = script && test "x$outfile" = x && outfile=configure;;
exit 1 ;;
esac
-trap 'rm -f $tmpin $tmpout' 0 1 2 15
+# Trap on 0 to stop playing with `rm'.
+if $debug; then
+ trap 'ah_status=$?
+ rm -f $tmpin $tmpout $silent_m4 $trace_m4 && exit $ah_status' 0
+ trap exit 1 2 13 15
+fi
+
if test z$infile = z-; then
infile=$tmpin
cat >$infile
## Generate the script. ##
## --------------------- ##
script)
- $run_m4 $infile > $tmpout || exit 2
+ $run_m4f $infile >$tmpout || exit 2
# You could add your own prefixes to pattern if you wanted to check for
# them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do
pattern="A[CHM]_"
status=0
- if grep "^[^#]*$pattern" $tmpout > /dev/null 2>&1; then
- echo "autoconf: Undefined macros:" >&2
+ if grep "^[^#]*$pattern" $tmpout >/dev/null 2>&1; then
+ echo "$me: undefined macros:" >&2
sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmpout |
while read macro; do
grep -n "^[^#]*$macro" $infile /dev/null
' >&4
;; # End of the task script.
+
+
## -------------- ##
## Trace macros. ##
## -------------- ##
trace)
- $run_m4 $traces -dafl $infile -o $tmpout>/dev/null || exit 2
- # The output looks like this:
- # | m4trace:configure.in:2: -1- AC_CHECK_FUNCS(foo bar
- # | baz, fubar)
- # and should be like this:
- # configure.in:2:AC_CHECK_FUNCS:foo bar baz, fubar
- cat $tmpout |
- # No need to be too verbose
- uniq |
- sed -e 's/m4trace:/@&/' |
- # Join arguments spread on several lines
- tr "$ac_LF_and_DOT" ' .' |
- tr @. "$ac_LF_and_DOT" |
- # Remove m4trace and -1-
- sed -n -e 's/^[^:]*:\([^:]*:[^:]*:\)[^a-zA-Z_]*\([a-zA-Z_]*.*\) $/\1\2/p' |
- # Replace the first `(' by a colon, remove the last `)'.
- sed -e 's/(/:/; s/)$//' >&4
- # The last eof was eaten.
- echo >&4
+ # `errprint' must be silent when we run `m4 --trace', otherwise there
+ # can be warnings mixed with traces in m4's stderr.
+ cat >$silent_m4 <<\EOF
+define(`errprint')dnl
+EOF
+ # A program to trace m4 macros.
+ cat >$trace_m4 <<\EOF
+divert(-1)
+ changequote([, ])
+ define([_at],
+ [ifelse([$#], [1], [],
+ [$#], [2], [[[$2]]],
+ [[[$2]][$1]_at([$1], shift(shift($@)))])])
+ define([_star],
+ [ifelse([$#], [1], [],
+ [$#], [2], [smash([$2])],
+ [smash([$2])[$1]_star([$1], shift(shift($@)))])])
+ define([smash],
+ [patsubst(patsubst(patsubst(patsubst([[[[$1]]]],
+ [\\
+]),
+ [[
+ ]+],
+ [ ]),
+ [^\(..\) ], [\1]),
+ [ \(.\)$], [\1])])
+ define([args],
+ [shift(shift(shift(shift(shift($@)))))])
+ define([at],
+ [_at([$1], args($@))])
+ define([star],
+ [_star([$1], args($@))])
+EOF
+ # A program to translate user tracing requests into m4 macros.
+ cat >$translate_awk <<\EOF
+BEGIN {
+ # File name.
+ trans["f"] = "$1";
+ # Line number.
+ trans["l"] = "$2";
+ # Depth.
+ trans["d"] = "$3";
+ # Name (also available as $0).
+ trans["n"] = "$4";
+ # Escaped dollar.
+ trans["$"] = "$";
+ # $@, list of quoted effective arguments.
+ trans["@"] = "]at([,], $@)[";
+ # $*, list of unquoted effective arguments.
+ trans["*"] = "]star([:], $@)[";
+}
+
+{
+ res = "";
+
+ for (cp = $0; 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$@*]/)
+ {
+ res = res trans[substr (cp, 2, 1)];
+ cp = substr(cp, 2);
+ }
+ else if (substr (cp, 3, 1) == "@")
+ {
+ res = res "]at([" substr (cp, 2, 1) "], $@)[";
+ cp = substr(cp, 3);
+ }
+ else if (substr (cp, 3, 1) == "*")
+ {
+ res = res "]star([" substr (cp, 2, 1) "], $@)[";
+ cp = substr(cp, 3);
+ }
+ else
+ {
+ print "invalid escape: " substr (cp, 1, 2) >"/dev/stderr";
+ exit 1
+ }
+ }
+ else
+ res = res char;
+ }
+ print res;
+}
+EOF
+ # Extract both the m4 program and the m4 options from TRACES.
+ eval set dummy $traces
+ shift
+ for trace
+ do
+ # The request may be several lines long, hence sed has to quit.
+ trace_opt="$trace_opt -t "`echo "$trace" | sed -e 's/:.*//;q'`
+ case "$trace" in
+ *:*)
+ # The `]])' are closing the `define' which is started by sed.
+ # This is to cope with multiple line requests.
+ echo "$trace]])" |
+ sed -e '1s/^\([^:]*\):\(.*\)$/define([AT_\1], [[\2/';;
+ *)
+ # Default request.
+ echo "define([AT_$trace], [[\$f:\$l:\$n:\$*]])";;
+ esac |
+ $AWK -f $translate_awk >>$trace_m4
+ done
+ echo "divert(0)dnl" >>$trace_m4
+
+ # Do we trace the initialization?
+ if $initialization; then
+ run_m4_trace="$run_m4 $trace_opt -daflq $silent"
+ else
+ run_m4_trace="$run_m4f $trace_opt -daflq $silent"
+ fi
+
+ # Run m4 on the input file to get traces.
+ $verbose "Running $run_m4_trace $infile" >&2
+ $run_m4_trace $infile 2>&1 >/dev/null |
+ sed -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/' \
+ -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/' >>$trace_m4
+
+ # Now we are ready to run m4 to process the trace file.
+ $verbose "Running $M4 $trace_m4" >&2
+ $M4 $trace_m4 >&4
;;
dnl this argument will be expanded, and we'll get pure junk out of m4.
define([AC_INCLUDE])
EOF
- # Run m4 with all the library files, save its report on strderr.
- $verbose Running $run_m4 -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile
- $run_m4 -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >the-script 2>$tmpout
+ # Run m4 with all the library files, discard stdout, save stderr.
+ $verbose Running $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
+ $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >/dev/null 2>$tmpout
# Keep only the good lines, there may be other outputs
grep '^[^: ]*:[0-9][0-9]*:[^:]*$' $tmpout >$tmpin
# Extract the files that are not in the local dir, and install the links.
# Save in $tmpout the list of installed links.
>$tmpout
- $verbose "Required macros:"
- $verbose "`sed -e 's/^/| /' $tmpin`"
+ $verbose "Required macros:" >&2
+ $verbose "`sed -e 's/^/| /' $tmpin`" >&2
cat $tmpin |
while read line
do
macro=`echo "$line" | sed -e 's/.*:[ ]*//'`
if test -f "$file" && test "x$file" != "x$infile"; then
if test -f $localdir/$filename; then
- $verbose "$filename already installed"
+ $verbose "$filename already installed" >&2
else
- $verbose "installing $file which provides $macro"
+ $verbose "installing $file which provides $macro" >&2
ln -s "$file" "$localdir/$filename" ||
cp "$file" "$localdir/$filename" ||
{
export AC_ACLOCALDIR
export AC_MACRODIR
# Not m4_s?include, because it would catch acsite and aclocal, which
- # we don't care of.
- $0 -l "$localdir" -t AC_INCLUDE $inline |
+ # we don't care about.
+ $0 -l "$localdir" -t AC_INCLUDE $infile |
sed -e 's/^[^:]*:[^:]*:[^:]*://g' |
sort |
uniq >$tmpin
#! @SHELL@
# autoconf -- create `configure' using m4 macros
-# Copyright (C) 1992, 1993, 1994, 1996, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1992, 93, 94, 96, 99, 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
If the option \`--trace' is used, no configuration script is created.
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -m, --macrodir=DIR directory storing Autoconf's macro files
- -l, --localdir=DIR directory storing the \`aclocal.m4' file
- -t, --trace=MACRO report the list of calls to MACRO
- -o, --output=FILE save output in FILE (stdout is the default)
+ -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
+ -m, --macrodir=DIR directory storing Autoconf's macro files
+ -l, --localdir=DIR directory storing the \`aclocal.m4' file
+ -t, --trace=MACRO report the list of calls to MACRO
+ -i, --initialization also trace Autoconf's initialization process
+ -o, --output=FILE save output in FILE (stdout is the default)
Report bugs to <bug-autoconf@gnu.org>."
autoconf (GNU @PACKAGE@) @VERSION@
Written by David J. MacKenzie.
-Copyright (C) 1992, 1993, 1994, 1996, 1999 Free Software Foundation, Inc.
+Copyright (C) 1992, 93, 94, 96, 99, 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."
/*) 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
+case `$M4 --help </dev/null 2>&1` in
*reload-state*);;
*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
esac
: ${AC_MACRODIR=@datadir@}
: ${AC_ACLOCALDIR=`(aclocal --print-ac-dir) 2>/dev/null`}
: ${AWK=@AWK@}
+debug=false
+# Trace Autoconf's initialization?
+initialization=false
localdir=
outfile=
# Tasks:
# Produce the configure script (default)
task=script
: ${TMPDIR=/tmp}
-tmpin=$TMPDIR/acin.$$
-tmpout=$TMPDIR/acout.$$
+tmpin=$TMPDIR/ac$$.in
+tmpout=$TMPDIR/ac$$.out
+silent_m4=$TMPDIR/silent$$.m4
+trace_m4=$TMPDIR/trace$$.m4
+translate_awk=$TMPDIR/trans$$.awk
verbose=:
# Parse command line
echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=:; shift ;;
--localdir=* | --l*=* )
localdir=`echo "$1" | sed -e 's/^[^=]*=//'`
task=install
shift;;
- --verbose | --verb* )
+ --verbose | --verb* | -v )
verbose=echo
shift;;
--trace | -t )
task=trace
shift
- traces="$traces -t $1"
+ test $# -eq 0 && { echo "$help" >&2; exit 1; }
+ traces="$traces '$1'"
shift ;;
--trace=* )
task=trace
- traces="$traces -t `echo \"$1\" | sed -e 's/^[^=]*=//'`"
+ traces="$traces '"`echo "$1" | sed -e 's/^[^=]*=//;s/:.*//'`"'"
shift ;;
+ --initialization | -i )
+ initialization=:
+ shift;;
--output | -o )
shift
+ test $# -eq 0 && { echo "$help" >&2; exit 1; }
outfile="$1"
shift ;;
--output=* )
done
# Running m4.
-if test -n "$localdir"; then
- use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
-fi
-run_m4="$M4 --reload $AC_MACRODIR/autoconf.m4f $use_localdir"
-
+test -n "$localdir" && use_localdir="-I$localdir"
+run_m4="$M4 $use_localdir -I $AC_MACRODIR autoconf.m4"
+run_m4f="$M4 $use_localdir --reload $AC_MACRODIR/autoconf.m4f"
+# Find the input file.
case $# in
0) infile=configure.in
test $task = script && test "x$outfile" = x && outfile=configure;;
exit 1 ;;
esac
-trap 'rm -f $tmpin $tmpout' 0 1 2 15
+# Trap on 0 to stop playing with `rm'.
+if $debug; then
+ trap 'ah_status=$?
+ rm -f $tmpin $tmpout $silent_m4 $trace_m4 && exit $ah_status' 0
+ trap exit 1 2 13 15
+fi
+
if test z$infile = z-; then
infile=$tmpin
cat >$infile
## Generate the script. ##
## --------------------- ##
script)
- $run_m4 $infile > $tmpout || exit 2
+ $run_m4f $infile >$tmpout || exit 2
# You could add your own prefixes to pattern if you wanted to check for
# them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do
pattern="A[CHM]_"
status=0
- if grep "^[^#]*$pattern" $tmpout > /dev/null 2>&1; then
- echo "autoconf: Undefined macros:" >&2
+ if grep "^[^#]*$pattern" $tmpout >/dev/null 2>&1; then
+ echo "$me: undefined macros:" >&2
sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmpout |
while read macro; do
grep -n "^[^#]*$macro" $infile /dev/null
' >&4
;; # End of the task script.
+
+
## -------------- ##
## Trace macros. ##
## -------------- ##
trace)
- $run_m4 $traces -dafl $infile -o $tmpout>/dev/null || exit 2
- # The output looks like this:
- # | m4trace:configure.in:2: -1- AC_CHECK_FUNCS(foo bar
- # | baz, fubar)
- # and should be like this:
- # configure.in:2:AC_CHECK_FUNCS:foo bar baz, fubar
- cat $tmpout |
- # No need to be too verbose
- uniq |
- sed -e 's/m4trace:/@&/' |
- # Join arguments spread on several lines
- tr "$ac_LF_and_DOT" ' .' |
- tr @. "$ac_LF_and_DOT" |
- # Remove m4trace and -1-
- sed -n -e 's/^[^:]*:\([^:]*:[^:]*:\)[^a-zA-Z_]*\([a-zA-Z_]*.*\) $/\1\2/p' |
- # Replace the first `(' by a colon, remove the last `)'.
- sed -e 's/(/:/; s/)$//' >&4
- # The last eof was eaten.
- echo >&4
+ # `errprint' must be silent when we run `m4 --trace', otherwise there
+ # can be warnings mixed with traces in m4's stderr.
+ cat >$silent_m4 <<\EOF
+define(`errprint')dnl
+EOF
+ # A program to trace m4 macros.
+ cat >$trace_m4 <<\EOF
+divert(-1)
+ changequote([, ])
+ define([_at],
+ [ifelse([$#], [1], [],
+ [$#], [2], [[[$2]]],
+ [[[$2]][$1]_at([$1], shift(shift($@)))])])
+ define([_star],
+ [ifelse([$#], [1], [],
+ [$#], [2], [smash([$2])],
+ [smash([$2])[$1]_star([$1], shift(shift($@)))])])
+ define([smash],
+ [patsubst(patsubst(patsubst(patsubst([[[[$1]]]],
+ [\\
+]),
+ [[
+ ]+],
+ [ ]),
+ [^\(..\) ], [\1]),
+ [ \(.\)$], [\1])])
+ define([args],
+ [shift(shift(shift(shift(shift($@)))))])
+ define([at],
+ [_at([$1], args($@))])
+ define([star],
+ [_star([$1], args($@))])
+EOF
+ # A program to translate user tracing requests into m4 macros.
+ cat >$translate_awk <<\EOF
+BEGIN {
+ # File name.
+ trans["f"] = "$1";
+ # Line number.
+ trans["l"] = "$2";
+ # Depth.
+ trans["d"] = "$3";
+ # Name (also available as $0).
+ trans["n"] = "$4";
+ # Escaped dollar.
+ trans["$"] = "$";
+ # $@, list of quoted effective arguments.
+ trans["@"] = "]at([,], $@)[";
+ # $*, list of unquoted effective arguments.
+ trans["*"] = "]star([:], $@)[";
+}
+
+{
+ res = "";
+
+ for (cp = $0; 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$@*]/)
+ {
+ res = res trans[substr (cp, 2, 1)];
+ cp = substr(cp, 2);
+ }
+ else if (substr (cp, 3, 1) == "@")
+ {
+ res = res "]at([" substr (cp, 2, 1) "], $@)[";
+ cp = substr(cp, 3);
+ }
+ else if (substr (cp, 3, 1) == "*")
+ {
+ res = res "]star([" substr (cp, 2, 1) "], $@)[";
+ cp = substr(cp, 3);
+ }
+ else
+ {
+ print "invalid escape: " substr (cp, 1, 2) >"/dev/stderr";
+ exit 1
+ }
+ }
+ else
+ res = res char;
+ }
+ print res;
+}
+EOF
+ # Extract both the m4 program and the m4 options from TRACES.
+ eval set dummy $traces
+ shift
+ for trace
+ do
+ # The request may be several lines long, hence sed has to quit.
+ trace_opt="$trace_opt -t "`echo "$trace" | sed -e 's/:.*//;q'`
+ case "$trace" in
+ *:*)
+ # The `]])' are closing the `define' which is started by sed.
+ # This is to cope with multiple line requests.
+ echo "$trace]])" |
+ sed -e '1s/^\([^:]*\):\(.*\)$/define([AT_\1], [[\2/';;
+ *)
+ # Default request.
+ echo "define([AT_$trace], [[\$f:\$l:\$n:\$*]])";;
+ esac |
+ $AWK -f $translate_awk >>$trace_m4
+ done
+ echo "divert(0)dnl" >>$trace_m4
+
+ # Do we trace the initialization?
+ if $initialization; then
+ run_m4_trace="$run_m4 $trace_opt -daflq $silent"
+ else
+ run_m4_trace="$run_m4f $trace_opt -daflq $silent"
+ fi
+
+ # Run m4 on the input file to get traces.
+ $verbose "Running $run_m4_trace $infile" >&2
+ $run_m4_trace $infile 2>&1 >/dev/null |
+ sed -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/' \
+ -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/' >>$trace_m4
+
+ # Now we are ready to run m4 to process the trace file.
+ $verbose "Running $M4 $trace_m4" >&2
+ $M4 $trace_m4 >&4
;;
dnl this argument will be expanded, and we'll get pure junk out of m4.
define([AC_INCLUDE])
EOF
- # Run m4 with all the library files, save its report on strderr.
- $verbose Running $run_m4 -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile
- $run_m4 -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >the-script 2>$tmpout
+ # Run m4 with all the library files, discard stdout, save stderr.
+ $verbose Running $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
+ $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >/dev/null 2>$tmpout
# Keep only the good lines, there may be other outputs
grep '^[^: ]*:[0-9][0-9]*:[^:]*$' $tmpout >$tmpin
# Extract the files that are not in the local dir, and install the links.
# Save in $tmpout the list of installed links.
>$tmpout
- $verbose "Required macros:"
- $verbose "`sed -e 's/^/| /' $tmpin`"
+ $verbose "Required macros:" >&2
+ $verbose "`sed -e 's/^/| /' $tmpin`" >&2
cat $tmpin |
while read line
do
macro=`echo "$line" | sed -e 's/.*:[ ]*//'`
if test -f "$file" && test "x$file" != "x$infile"; then
if test -f $localdir/$filename; then
- $verbose "$filename already installed"
+ $verbose "$filename already installed" >&2
else
- $verbose "installing $file which provides $macro"
+ $verbose "installing $file which provides $macro" >&2
ln -s "$file" "$localdir/$filename" ||
cp "$file" "$localdir/$filename" ||
{
export AC_ACLOCALDIR
export AC_MACRODIR
# Not m4_s?include, because it would catch acsite and aclocal, which
- # we don't care of.
- $0 -l "$localdir" -t AC_INCLUDE $inline |
+ # we don't care about.
+ $0 -l "$localdir" -t AC_INCLUDE $infile |
sed -e 's/^[^:]*:[^:]*:[^:]*://g' |
sort |
uniq >$tmpin
[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
-# AC_PROG_BINSH
-# -------------
-# Check the maximum length of an here document.
-# FIXME: Is this test really reliable?
-AC_DEFUN(AC_PROG_BINSH,
-[AC_CACHE_CHECK([for max here document length], ac_cv_prog_binsh_max_heredoc,
-[echo >conftest.s1 "\
-ac_test='This is a sample string to test here documents.'"
-dnl 2^8 = 256 lines
-for ac_cnt in 0 1 2 3 4 5 6 7
-do
- cat conftest.s1 conftest.s1 >conftest.sh
- mv conftest.sh conftest.s1
-done
-echo 'cat >conftest.s1 <<CEOF' >conftest.sh
-cat conftest.s1 >>conftest.sh
-echo 'echo "Success"' >>conftest.sh
-echo 'CEOF' >>conftest.sh
-$SHELL ./conftest.sh
-if test "`$SHELL ./conftest.s1`" != Success; then
-dnl Some people say to limit oneself to 12, which seems incredibly small.
- ac_cv_prog_binsh_max_heredoc=12
-else
- ac_cv_prog_binsh_max_heredoc=infinite
-fi
-])dnl
-])# AC_PROG_BINSH
-
-
# AC_PROG_YACC
# ------------
AC_DEFUN(AC_PROG_YACC,
DISTCLEANFILES = atconfig testsuite
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES = atconfig
-DIST_COMMON = Makefile.am Makefile.in atconfig.in configure \
-configure.in
+DIST_COMMON = Makefile.am Makefile.in atconfig.in
PACKAGE = @PACKAGE@