Don't double quote in AC_MSG_*.

* acgeneral.m4 (_AC_SH_QUOTE): Don't double quote.  Escape the
double quotes too.
(_AC_ECHO_UNQUOTED): Don't double quote :).
(_AC_ECHO, _AC_ECHO_N): Quote the call to _AC_SH_QUOTE.

The autoheader chain needs to be adjusted.

* acgeneral.m4 (AH_VERBATIM): Just pass two arguments to AH_OUTPUT
instead of trying to build what `autoheader' needs: let it handle
the format by itself.
* autoheader.m4: Adjust.
s,tmp/config.h,tmp/config.hin.

The adjustment revealed that `autoconf --trace' is not robust to
single quotes in its argument.

* autoconf.sh: Fix this issue.
Rename the escape `$*' as `$%'.  Implement `$@'.
* doc/autoconf.texi: Adjust.
This commit is contained in:
Akim Demaille 2000-05-03 08:53:06 +00:00
parent 2df476bb0c
commit 27aaac5d86
11 changed files with 290 additions and 189 deletions

View File

@ -1,3 +1,27 @@
2000-04-28 Akim Demaille <akim@epita.fr>
Don't double quote in AC_MSG_*.
* acgeneral.m4 (_AC_SH_QUOTE): Don't double quote. Escape the
double quotes too.
(_AC_ECHO_UNQUOTED): Don't double quote :).
(_AC_ECHO, _AC_ECHO_N): Quote the call to _AC_SH_QUOTE.
The autoheader chain needs to be adjusted.
* acgeneral.m4 (AH_VERBATIM): Just pass two arguments to AH_OUTPUT
instead of trying to build what `autoheader' needs: let it handle
the format by itself.
* autoheader.m4: Adjust.
s,tmp/config.h,tmp/config.hin.
The adjustment revealed that `autoconf --trace' is not robust to
single quotes in its argument.
* autoconf.sh: Fix this issue.
Rename the escape `$*' as `$%'. Implement `$@'.
* doc/autoconf.texi: Adjust.
2000-04-28 Akim Demaille <akim@epita.fr>
mawk suffers a severe performance loss when using `sub' with a

56
INSTALL
View File

@ -8,16 +8,21 @@ various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=./config.cache') that saves the results
of its tests to speed up reconfiguring. (Caching is disabled by
default to prevent problems with accidental use of stale cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
@ -75,7 +80,7 @@ directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
@ -158,15 +163,21 @@ environment passed to configure. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it
is overridden in the site shell script).
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
Please, note that the former interface:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
or
or
env CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
should be avoided.
should be avoided.
Operation Controls
==================
@ -174,14 +185,20 @@ Operation Controls
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `./config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--quiet'
`--silent'
`-q'
@ -193,9 +210,6 @@ operates.
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@ -388,11 +388,8 @@ define([AH_OUTPUT], [])
# output as is, with no formating.
define([AH_VERBATIM],
[AC_VAR_IF_INDIR([$1],,
[#
AH_OUTPUT(ac_verbatim_$1="\
_AC_SH_QUOTE([$2])"
)
])])
[AH_OUTPUT([$1], _AC_SH_QUOTE([[$2]]))])
])
# AH_TEMPLATE(KEY, DESCRIPTION)
@ -1685,7 +1682,7 @@ test "$program_suffix" != NONE &&
program_transform_name="s,\$\$,${program_suffix},;$program_transform_name"
# sed with no file args requires a program.
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
test -z "$program_transform_name" && program_transform_name="s,x,x,"
])# AC_ARG_PROGRAM
@ -2128,48 +2125,54 @@ define([AC_FATAL], [m4_fatal([$1], [$2])])
## Printing messages at configure runtime. ##
## ---------------------------------------- ##
# _AC_SH_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)
# ------------------------------------------------------------------
# Compatibility glue between the old AC_MSG suite which did not
# quote anything, and the modern suite which quotes the quotes.
# If STRING contains `\\' or `\$', it's modern.
# If STRING contains `\"' or `\`', it's old.
# Otherwise it's modern.
# We use two quotes in the pattern to keep highlighting tools at peace.
define([_AC_SH_QUOTE_IFELSE],
[ifelse(regexp([$1], [\\[\\$]]),
[-1], [ifelse(regexp([$1], [\\[`""]]),
[-1], [$2],
[$3])],
[$2])])
# _AC_SH_QUOTE(STRING)
# --------------------
# If there are quoted (via backslash) backquotes do nothing, else
# backslash all the quotes. This macro is robust to active symbols.
# Both cases (with or without back quotes) *must* evaluate STRING the
# same number of times.
#
# | define(active, ACTIVE)
# | _AC_SH_QUOTE([`active'])
# | => \`active'
# | _AC_SH_QUOTE([\`active'])
# | => \`active'
# | error-->c.in:8: warning: backquotes should not be backslashed\
# ... in: \`active'
#
# backslash all the quotes.
define([_AC_SH_QUOTE],
[ifelse(regexp([[$1]], [\\`]),
-1, [patsubst([[$1]], [`], [\\`])],
[AC_DIAGNOSE([syntax],
[backquotes should not be backslashed in: $1])dnl
[$1]])])
[_AC_SH_QUOTE_IFELSE([$1],
[patsubst([$1], [\([`""]\)], [\\\1])],
[AC_DIAGNOSE([syntax],
[backquotes and double quotes should not be backslashed in: $1])dnl
$1])])
# _AC_ECHO_UNQUOTED(STRING, [FD = AC_FD_MSG])
# -------------------------------------------
# Perform shell expansions on STRING and echo the string to FD.
define([_AC_ECHO_UNQUOTED],
[echo "[$1]" >&m4_default([$2], [AC_FD_MSG])])
[echo "$1" >&m4_default([$2], [AC_FD_MSG])])
# _AC_ECHO(STRING, [FD = AC_FD_MSG])
# ----------------------------------
# Protect STRING from backquote expansion, echo the result to FD.
define([_AC_ECHO],
[_AC_ECHO_UNQUOTED(_AC_SH_QUOTE([$1]), $2)])
[_AC_ECHO_UNQUOTED([_AC_SH_QUOTE([$1])], $2)])
# _AC_ECHO_N(STRING, [FD = AC_FD_MSG])
# ------------------------------------
# Same as _AC_ECHO, but echo doesn't return to a new line.
define([_AC_ECHO_N],
[echo $ECHO_N "_AC_SH_QUOTE($1)$ECHO_C" >&m4_default([$2], [AC_FD_MSG])])
[echo $ECHO_N "_AC_SH_QUOTE([$1])$ECHO_C" >&m4_default([$2], [AC_FD_MSG])])
# AC_MSG_CHECKING(FEATURE)
@ -2190,7 +2193,7 @@ AU_DEFUN([AC_CHECKING],
# ---------------------
define([AC_MSG_RESULT],
[_AC_ECHO([configure:__oline__: result: $1], AC_FD_LOG)
_AC_ECHO([$ECHO_T""$1])[]dnl
_AC_ECHO([${ECHO_T}$1])[]dnl
])
@ -2199,7 +2202,7 @@ _AC_ECHO([$ECHO_T""$1])[]dnl
# Likewise, but perform $ ` \ shell substitutions.
define([AC_MSG_RESULT_UNQUOTED],
[_AC_ECHO_UNQUOTED([configure:__oline__: result: $1], AC_FD_LOG)
_AC_ECHO_UNQUOTED([$ECHO_T""$1])[]dnl
_AC_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl
])
@ -4013,7 +4016,7 @@ dnl Here, there are 2 cmd per line, and two cmd are added later.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_lines # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
ac_sed_cmds=
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" $ac_cs_root.subs >$ac_cs_root.sfrag

View File

@ -160,11 +160,12 @@ while test $# -gt 0 ; do
task=trace
shift
test $# = 0 && { echo "$help" >&2; exit 1; }
traces="$traces '$1'"
traces="$traces '"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--trace=* )
task=trace
traces="$traces '"`echo "$1" | sed -e 's/^[^=]*=//;s/:.*//'`"'"
traces="$traces '"`echo "$1" |
sed -e "s/^[^=]*=//;s/:.*//;s/'/'\\\\\\\\''/g"`"'"
shift ;;
--initialization | -i )
initialization=:
@ -333,30 +334,40 @@ case $task in
cat >$tmp/trace.m4 <<\EOF
divert(-1)
changequote([, ])
# _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 `smashed': spaces are singled out,
# and no new line remains.
define([_at],
[ifelse([$#], [1], [],
[$#], [2], [[[$2]]],
[[[$2]][$1]_at([$1], shift(shift($@)))])])
define([_star],
[[[$2]][$1]$0([$1], shift(shift($@)))])])
define([_percent],
[ifelse([$#], [1], [],
[$#], [2], [smash([$2])],
[smash([$2])[$1]_star([$1], shift(shift($@)))])])
[smash([$2])[$1]$0([$1], shift(shift($@)))])])
define([_star],
[ifelse([$#], [1], [],
[$#], [2], [[$2]],
[[$2][$1]$0([$1], shift(shift($@)))])])
# Smash quotes its result.
define([smash],
[patsubst(patsubst(patsubst([[[$1]]],
[\\
]),
[[
[[
]+],
[ ]),
[ ]),
[^ *\(.*\) *$], [[\1]])])
define([args],
[shift(shift(shift(shift(shift($@)))))])
define([at],
[_at([$1], args($@))])
define([star],
[_star([$1], args($@))])
define([args], [shift(shift(shift(shift(shift($@)))))])
define([at], [_$0([$1], args($@))])
define([percent], [_$0([$1], args($@))])
define([star], [_$0([$1], args($@))])
EOF
# A program to translate user tracing requests into m4 macros.
cat >$tmp/translate.awk <<\EOF
@ -383,7 +394,10 @@ function trans (arg, sep)
return "]at([" (separator ? separator : ",") "], $@)["
# $*, list of unquoted effective arguments.
if (arg == "*")
return "]star([" (separator ? separator : ":") "], $@)["
return "]star([" (separator ? separator : ",") "], $@)["
# $%, list of smashed unquoted effective arguments.
if (arg == "%")
return "]percent([" (separator ? separator : ":") "], $@)["
}
function error (message)
@ -403,7 +417,7 @@ END {
# 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:$*"
request = colon ? substr (request, colon + 1) : "$f:$l:$n:$%"
res = ""
@ -418,7 +432,7 @@ END {
res = res "$" (substr (cp, 2, RLENGTH - 1) + 4)
cp = substr (cp, RLENGTH)
}
else if (substr (cp, 2, 1) ~ /[fldn$@*]/)
else if (substr (cp, 2, 1) ~ /[fldn$@%*]/)
{
# $x, no separator given.
res = res trans(substr (cp, 2, 1))
@ -431,13 +445,13 @@ END {
if (!end)
error("invalid escape: " cp)
separator = substr (cp, 3, end - 3)
if (substr (cp, end + 1, 1) ~ /[*@]/)
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) ~ /[$@]/)
else if (substr (cp, 3, 1) ~ /[*@%]/)
{
# $sx, short separator `s'.
res = res trans(substr (cp, 3, 1), substr (cp, 2, 1))

View File

@ -160,11 +160,12 @@ while test $# -gt 0 ; do
task=trace
shift
test $# = 0 && { echo "$help" >&2; exit 1; }
traces="$traces '$1'"
traces="$traces '"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--trace=* )
task=trace
traces="$traces '"`echo "$1" | sed -e 's/^[^=]*=//;s/:.*//'`"'"
traces="$traces '"`echo "$1" |
sed -e "s/^[^=]*=//;s/:.*//;s/'/'\\\\\\\\''/g"`"'"
shift ;;
--initialization | -i )
initialization=:
@ -333,30 +334,40 @@ case $task in
cat >$tmp/trace.m4 <<\EOF
divert(-1)
changequote([, ])
# _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 `smashed': spaces are singled out,
# and no new line remains.
define([_at],
[ifelse([$#], [1], [],
[$#], [2], [[[$2]]],
[[[$2]][$1]_at([$1], shift(shift($@)))])])
define([_star],
[[[$2]][$1]$0([$1], shift(shift($@)))])])
define([_percent],
[ifelse([$#], [1], [],
[$#], [2], [smash([$2])],
[smash([$2])[$1]_star([$1], shift(shift($@)))])])
[smash([$2])[$1]$0([$1], shift(shift($@)))])])
define([_star],
[ifelse([$#], [1], [],
[$#], [2], [[$2]],
[[$2][$1]$0([$1], shift(shift($@)))])])
# Smash quotes its result.
define([smash],
[patsubst(patsubst(patsubst([[[$1]]],
[\\
]),
[[
[[
]+],
[ ]),
[ ]),
[^ *\(.*\) *$], [[\1]])])
define([args],
[shift(shift(shift(shift(shift($@)))))])
define([at],
[_at([$1], args($@))])
define([star],
[_star([$1], args($@))])
define([args], [shift(shift(shift(shift(shift($@)))))])
define([at], [_$0([$1], args($@))])
define([percent], [_$0([$1], args($@))])
define([star], [_$0([$1], args($@))])
EOF
# A program to translate user tracing requests into m4 macros.
cat >$tmp/translate.awk <<\EOF
@ -383,7 +394,10 @@ function trans (arg, sep)
return "]at([" (separator ? separator : ",") "], $@)["
# $*, list of unquoted effective arguments.
if (arg == "*")
return "]star([" (separator ? separator : ":") "], $@)["
return "]star([" (separator ? separator : ",") "], $@)["
# $%, list of smashed unquoted effective arguments.
if (arg == "%")
return "]percent([" (separator ? separator : ":") "], $@)["
}
function error (message)
@ -403,7 +417,7 @@ END {
# 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:$*"
request = colon ? substr (request, colon + 1) : "$f:$l:$n:$%"
res = ""
@ -418,7 +432,7 @@ END {
res = res "$" (substr (cp, 2, RLENGTH - 1) + 4)
cp = substr (cp, RLENGTH)
}
else if (substr (cp, 2, 1) ~ /[fldn$@*]/)
else if (substr (cp, 2, 1) ~ /[fldn$@%*]/)
{
# $x, no separator given.
res = res trans(substr (cp, 2, 1))
@ -431,13 +445,13 @@ END {
if (!end)
error("invalid escape: " cp)
separator = substr (cp, 3, end - 3)
if (substr (cp, end + 1, 1) ~ /[*@]/)
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) ~ /[$@]/)
else if (substr (cp, 3, 1) ~ /[*@%]/)
{
# $sx, short separator `s'.
res = res trans(substr (cp, 3, 1), substr (cp, 2, 1))

View File

@ -165,7 +165,9 @@ syms=
autoconf=`echo "$0" | sed -e 's/autoheader$/autoconf/'`
test -n "$localdir" && autoconf="$autoconf -l $localdir"
export AC_MACRODIR
$autoconf --trace AH_OUTPUT:'$1' --trace AC_CONFIG_HEADERS:'config_h="$1"' \
$autoconf --trace AC_CONFIG_HEADERS:'config_h="$1"' \
--trace AH_OUTPUT:'ac_verbatim_$1="\
$2"' \
$infile >$tmp/traces.sh
. $tmp/traces.sh
@ -189,14 +191,14 @@ 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.h
cat <<EOF >$tmp/config.hin
/* $config_h_in. Generated automatically from $infile by autoheader. */
EOF
test -r ${config_h}.top && cat ${config_h}.top >>$tmp/config.h
test -r ${config_h}.top && cat ${config_h}.top >>$tmp/config.hin
test -r $localdir/acconfig.h &&
grep @TOP@ $localdir/acconfig.h >/dev/null &&
sed '/@TOP@/,$d' $localdir/acconfig.h >>$tmp/config.h
sed '/@TOP@/,$d' $localdir/acconfig.h >>$tmp/config.hin
# This puts each template paragraph on its own line, separated by @s.
if test -n "$syms"; then
@ -232,19 +234,19 @@ if test -n "$syms"; then
$syms
EOF
fgrep -f $tmp/syms.fgrep) |
tr @. "$ac_LF_and_DOT" >>$tmp/config.h
tr @. "$ac_LF_and_DOT" >>$tmp/config.hin
fi
for verb in `(set) 2>&1 | sed -n -e '/^ac_verbatim/s/^\([^=]*\)=.*$/\1/p'`; do
echo >>$tmp/config.h
eval echo '"${'$verb'}"' >>$tmp/config.h
echo >>$tmp/config.hin
eval echo '"${'$verb'}"' >>$tmp/config.hin
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.h
test -f ${config_h}.bot && cat ${config_h}.bot >>$tmp/config.h
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.
@ -253,7 +255,7 @@ status=0
w='[ ]'
if test -n "$syms"; then
for sym in $syms; do
if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.h >/dev/null; then
if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.hin >/dev/null; then
: # All is well.
else
echo "$0: No template for symbol \`$sym'" >&2
@ -267,15 +269,15 @@ fi
if test $status = 0; then
if test $# = 0; then
# Output is a file
if test -f $config_h_in && cmp -s $tmp/config.h $config_h_in; then
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 "$0: $config_h_in is unchanged" >&2
else
mv -f $tmp/config.h $config_h_in
mv -f $tmp/config.hin $config_h_in
fi
else
# Output is stdout
cat $tmp/config.h
cat $tmp/config.hin
fi
fi

View File

@ -165,7 +165,9 @@ syms=
autoconf=`echo "$0" | sed -e 's/autoheader$/autoconf/'`
test -n "$localdir" && autoconf="$autoconf -l $localdir"
export AC_MACRODIR
$autoconf --trace AH_OUTPUT:'$1' --trace AC_CONFIG_HEADERS:'config_h="$1"' \
$autoconf --trace AC_CONFIG_HEADERS:'config_h="$1"' \
--trace AH_OUTPUT:'ac_verbatim_$1="\
$2"' \
$infile >$tmp/traces.sh
. $tmp/traces.sh
@ -189,14 +191,14 @@ 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.h
cat <<EOF >$tmp/config.hin
/* $config_h_in. Generated automatically from $infile by autoheader. */
EOF
test -r ${config_h}.top && cat ${config_h}.top >>$tmp/config.h
test -r ${config_h}.top && cat ${config_h}.top >>$tmp/config.hin
test -r $localdir/acconfig.h &&
grep @TOP@ $localdir/acconfig.h >/dev/null &&
sed '/@TOP@/,$d' $localdir/acconfig.h >>$tmp/config.h
sed '/@TOP@/,$d' $localdir/acconfig.h >>$tmp/config.hin
# This puts each template paragraph on its own line, separated by @s.
if test -n "$syms"; then
@ -232,19 +234,19 @@ if test -n "$syms"; then
$syms
EOF
fgrep -f $tmp/syms.fgrep) |
tr @. "$ac_LF_and_DOT" >>$tmp/config.h
tr @. "$ac_LF_and_DOT" >>$tmp/config.hin
fi
for verb in `(set) 2>&1 | sed -n -e '/^ac_verbatim/s/^\([^=]*\)=.*$/\1/p'`; do
echo >>$tmp/config.h
eval echo '"${'$verb'}"' >>$tmp/config.h
echo >>$tmp/config.hin
eval echo '"${'$verb'}"' >>$tmp/config.hin
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.h
test -f ${config_h}.bot && cat ${config_h}.bot >>$tmp/config.h
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.
@ -253,7 +255,7 @@ status=0
w='[ ]'
if test -n "$syms"; then
for sym in $syms; do
if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.h >/dev/null; then
if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.hin >/dev/null; then
: # All is well.
else
echo "$0: No template for symbol \`$sym'" >&2
@ -267,15 +269,15 @@ fi
if test $status = 0; then
if test $# = 0; then
# Output is a file
if test -f $config_h_in && cmp -s $tmp/config.h $config_h_in; then
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 "$0: $config_h_in is unchanged" >&2
else
mv -f $tmp/config.h $config_h_in
mv -f $tmp/config.hin $config_h_in
fi
else
# Output is stdout
cat $tmp/config.h
cat $tmp/config.hin
fi
fi

View File

@ -160,11 +160,12 @@ while test $# -gt 0 ; do
task=trace
shift
test $# = 0 && { echo "$help" >&2; exit 1; }
traces="$traces '$1'"
traces="$traces '"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--trace=* )
task=trace
traces="$traces '"`echo "$1" | sed -e 's/^[^=]*=//;s/:.*//'`"'"
traces="$traces '"`echo "$1" |
sed -e "s/^[^=]*=//;s/:.*//;s/'/'\\\\\\\\''/g"`"'"
shift ;;
--initialization | -i )
initialization=:
@ -333,30 +334,40 @@ case $task in
cat >$tmp/trace.m4 <<\EOF
divert(-1)
changequote([, ])
# _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 `smashed': spaces are singled out,
# and no new line remains.
define([_at],
[ifelse([$#], [1], [],
[$#], [2], [[[$2]]],
[[[$2]][$1]_at([$1], shift(shift($@)))])])
define([_star],
[[[$2]][$1]$0([$1], shift(shift($@)))])])
define([_percent],
[ifelse([$#], [1], [],
[$#], [2], [smash([$2])],
[smash([$2])[$1]_star([$1], shift(shift($@)))])])
[smash([$2])[$1]$0([$1], shift(shift($@)))])])
define([_star],
[ifelse([$#], [1], [],
[$#], [2], [[$2]],
[[$2][$1]$0([$1], shift(shift($@)))])])
# Smash quotes its result.
define([smash],
[patsubst(patsubst(patsubst([[[$1]]],
[\\
]),
[[
[[
]+],
[ ]),
[ ]),
[^ *\(.*\) *$], [[\1]])])
define([args],
[shift(shift(shift(shift(shift($@)))))])
define([at],
[_at([$1], args($@))])
define([star],
[_star([$1], args($@))])
define([args], [shift(shift(shift(shift(shift($@)))))])
define([at], [_$0([$1], args($@))])
define([percent], [_$0([$1], args($@))])
define([star], [_$0([$1], args($@))])
EOF
# A program to translate user tracing requests into m4 macros.
cat >$tmp/translate.awk <<\EOF
@ -383,7 +394,10 @@ function trans (arg, sep)
return "]at([" (separator ? separator : ",") "], $@)["
# $*, list of unquoted effective arguments.
if (arg == "*")
return "]star([" (separator ? separator : ":") "], $@)["
return "]star([" (separator ? separator : ",") "], $@)["
# $%, list of smashed unquoted effective arguments.
if (arg == "%")
return "]percent([" (separator ? separator : ":") "], $@)["
}
function error (message)
@ -403,7 +417,7 @@ END {
# 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:$*"
request = colon ? substr (request, colon + 1) : "$f:$l:$n:$%"
res = ""
@ -418,7 +432,7 @@ END {
res = res "$" (substr (cp, 2, RLENGTH - 1) + 4)
cp = substr (cp, RLENGTH)
}
else if (substr (cp, 2, 1) ~ /[fldn$@*]/)
else if (substr (cp, 2, 1) ~ /[fldn$@%*]/)
{
# $x, no separator given.
res = res trans(substr (cp, 2, 1))
@ -431,13 +445,13 @@ END {
if (!end)
error("invalid escape: " cp)
separator = substr (cp, 3, end - 3)
if (substr (cp, end + 1, 1) ~ /[*@]/)
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) ~ /[$@]/)
else if (substr (cp, 3, 1) ~ /[*@%]/)
{
# $sx, short separator `s'.
res = res trans(substr (cp, 3, 1), substr (cp, 2, 1))

View File

@ -165,7 +165,9 @@ syms=
autoconf=`echo "$0" | sed -e 's/autoheader$/autoconf/'`
test -n "$localdir" && autoconf="$autoconf -l $localdir"
export AC_MACRODIR
$autoconf --trace AH_OUTPUT:'$1' --trace AC_CONFIG_HEADERS:'config_h="$1"' \
$autoconf --trace AC_CONFIG_HEADERS:'config_h="$1"' \
--trace AH_OUTPUT:'ac_verbatim_$1="\
$2"' \
$infile >$tmp/traces.sh
. $tmp/traces.sh
@ -189,14 +191,14 @@ 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.h
cat <<EOF >$tmp/config.hin
/* $config_h_in. Generated automatically from $infile by autoheader. */
EOF
test -r ${config_h}.top && cat ${config_h}.top >>$tmp/config.h
test -r ${config_h}.top && cat ${config_h}.top >>$tmp/config.hin
test -r $localdir/acconfig.h &&
grep @TOP@ $localdir/acconfig.h >/dev/null &&
sed '/@TOP@/,$d' $localdir/acconfig.h >>$tmp/config.h
sed '/@TOP@/,$d' $localdir/acconfig.h >>$tmp/config.hin
# This puts each template paragraph on its own line, separated by @s.
if test -n "$syms"; then
@ -232,19 +234,19 @@ if test -n "$syms"; then
$syms
EOF
fgrep -f $tmp/syms.fgrep) |
tr @. "$ac_LF_and_DOT" >>$tmp/config.h
tr @. "$ac_LF_and_DOT" >>$tmp/config.hin
fi
for verb in `(set) 2>&1 | sed -n -e '/^ac_verbatim/s/^\([^=]*\)=.*$/\1/p'`; do
echo >>$tmp/config.h
eval echo '"${'$verb'}"' >>$tmp/config.h
echo >>$tmp/config.hin
eval echo '"${'$verb'}"' >>$tmp/config.hin
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.h
test -f ${config_h}.bot && cat ${config_h}.bot >>$tmp/config.h
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.
@ -253,7 +255,7 @@ status=0
w='[ ]'
if test -n "$syms"; then
for sym in $syms; do
if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.h >/dev/null; then
if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.hin >/dev/null; then
: # All is well.
else
echo "$0: No template for symbol \`$sym'" >&2
@ -267,15 +269,15 @@ fi
if test $status = 0; then
if test $# = 0; then
# Output is a file
if test -f $config_h_in && cmp -s $tmp/config.h $config_h_in; then
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 "$0: $config_h_in is unchanged" >&2
else
mv -f $tmp/config.h $config_h_in
mv -f $tmp/config.hin $config_h_in
fi
else
# Output is stdout
cat $tmp/config.h
cat $tmp/config.hin
fi
fi

View File

@ -920,7 +920,7 @@ several macros. Multiple @samp{--trace} for a single macro do not
accumulate, nevertheless, @var{format} can be arbitrarily long.
The @var{format} is a regular string, with new lines if wanted. It
defaults to @samp{$f:$l:$n:$@@}, see below for details on the
defaults to @samp{$f:$l:$n:$%}, see below for details on the
@var{format}.
@item --initialization
@ -968,11 +968,17 @@ argument is quoted, i.e. enclosed in a pair of square bracket.
@item $*
@itemx $@var{sep}*
@itemx $@{@var{separator}@}*
As above, but the arguments are not quoted.
@item $%
@itemx $@var{sep}%
@itemx $@{@var{separator}@}%
As above, but the arguments are not quoted, all new line characters in
the arguments are smashed, and the default separator is @samp{:}.
The escape @samp{$*} produces traces that hold in a single line (unless
you put new lines in the @samp{separator}), while @samp{$@@} does not.
The escape @samp{$%} produces traces that hold in a single line (unless
you put new lines in the @samp{separator}), while @samp{$@@} and
@samp{$*} do not.
@end table
For instance, to know the list of variables which are substituted:
@ -988,19 +994,22 @@ configure.in:2:AC_SUBST:ECHO_T
@end example
@noindent
The example below highlights the difference between @samp{$@@} and
@samp{$*} wrt white spaces. One line was wrapped by hand to cope with
the high standards set in typography which state that no line should be
wider that the sheet, but in real life it is not.
The example below highlights the difference between @samp{$@@},
@samp{$*}, and @strong{$%}.
@example
@group
% autoconf -t 'AC_OUTPUT:$@@'
[acversion.m4 Makefile m4/Makefile man/Makefile doc/Makefile
tests/Makefile tests/atconfig]
% autoconf -m . -t 'AC_OUTPUT:$*'
acversion.m4 Makefile m4/Makefile man/Makefile doc/Make
file tests/Makefile tests/atconfig
% cat configure.in
AC_DEFINE(This, is, [an
[example]])
% autoconf -t 'AC_DEFINE:@: $@
*: $*
%: $%'
@@: [This],[is],[an
[example]]
*: This,is,an
[example]
%: This:is:an [example]
@end group
@end example
@ -1023,10 +1032,10 @@ structures:
@example
@group
% autoconf -t 'AM_MISSING_PROG:$@{:::::::@}*'
ACLOCAL:::::::aclocal:::::::$missing_dir
AUTOCONF:::::::autoconf:::::::$missing_dir
AUTOMAKE:::::::automake:::::::$missing_dir
% autoconf -t 'AM_MISSING_PROG:$@{|:::::|@}*'
ACLOCAL|:::::|aclocal|:::::|$missing_dir
AUTOCONF|:::::|autoconf|:::::|$missing_dir
AUTOMAKE|:::::|automake|:::::|$missing_dir
@i{More traces deleted}
@end group
@end example

View File

@ -388,11 +388,8 @@ define([AH_OUTPUT], [])
# output as is, with no formating.
define([AH_VERBATIM],
[AC_VAR_IF_INDIR([$1],,
[#
AH_OUTPUT(ac_verbatim_$1="\
_AC_SH_QUOTE([$2])"
)
])])
[AH_OUTPUT([$1], _AC_SH_QUOTE([[$2]]))])
])
# AH_TEMPLATE(KEY, DESCRIPTION)
@ -1685,7 +1682,7 @@ test "$program_suffix" != NONE &&
program_transform_name="s,\$\$,${program_suffix},;$program_transform_name"
# sed with no file args requires a program.
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
test -z "$program_transform_name" && program_transform_name="s,x,x,"
])# AC_ARG_PROGRAM
@ -2128,48 +2125,54 @@ define([AC_FATAL], [m4_fatal([$1], [$2])])
## Printing messages at configure runtime. ##
## ---------------------------------------- ##
# _AC_SH_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)
# ------------------------------------------------------------------
# Compatibility glue between the old AC_MSG suite which did not
# quote anything, and the modern suite which quotes the quotes.
# If STRING contains `\\' or `\$', it's modern.
# If STRING contains `\"' or `\`', it's old.
# Otherwise it's modern.
# We use two quotes in the pattern to keep highlighting tools at peace.
define([_AC_SH_QUOTE_IFELSE],
[ifelse(regexp([$1], [\\[\\$]]),
[-1], [ifelse(regexp([$1], [\\[`""]]),
[-1], [$2],
[$3])],
[$2])])
# _AC_SH_QUOTE(STRING)
# --------------------
# If there are quoted (via backslash) backquotes do nothing, else
# backslash all the quotes. This macro is robust to active symbols.
# Both cases (with or without back quotes) *must* evaluate STRING the
# same number of times.
#
# | define(active, ACTIVE)
# | _AC_SH_QUOTE([`active'])
# | => \`active'
# | _AC_SH_QUOTE([\`active'])
# | => \`active'
# | error-->c.in:8: warning: backquotes should not be backslashed\
# ... in: \`active'
#
# backslash all the quotes.
define([_AC_SH_QUOTE],
[ifelse(regexp([[$1]], [\\`]),
-1, [patsubst([[$1]], [`], [\\`])],
[AC_DIAGNOSE([syntax],
[backquotes should not be backslashed in: $1])dnl
[$1]])])
[_AC_SH_QUOTE_IFELSE([$1],
[patsubst([$1], [\([`""]\)], [\\\1])],
[AC_DIAGNOSE([syntax],
[backquotes and double quotes should not be backslashed in: $1])dnl
$1])])
# _AC_ECHO_UNQUOTED(STRING, [FD = AC_FD_MSG])
# -------------------------------------------
# Perform shell expansions on STRING and echo the string to FD.
define([_AC_ECHO_UNQUOTED],
[echo "[$1]" >&m4_default([$2], [AC_FD_MSG])])
[echo "$1" >&m4_default([$2], [AC_FD_MSG])])
# _AC_ECHO(STRING, [FD = AC_FD_MSG])
# ----------------------------------
# Protect STRING from backquote expansion, echo the result to FD.
define([_AC_ECHO],
[_AC_ECHO_UNQUOTED(_AC_SH_QUOTE([$1]), $2)])
[_AC_ECHO_UNQUOTED([_AC_SH_QUOTE([$1])], $2)])
# _AC_ECHO_N(STRING, [FD = AC_FD_MSG])
# ------------------------------------
# Same as _AC_ECHO, but echo doesn't return to a new line.
define([_AC_ECHO_N],
[echo $ECHO_N "_AC_SH_QUOTE($1)$ECHO_C" >&m4_default([$2], [AC_FD_MSG])])
[echo $ECHO_N "_AC_SH_QUOTE([$1])$ECHO_C" >&m4_default([$2], [AC_FD_MSG])])
# AC_MSG_CHECKING(FEATURE)
@ -2190,7 +2193,7 @@ AU_DEFUN([AC_CHECKING],
# ---------------------
define([AC_MSG_RESULT],
[_AC_ECHO([configure:__oline__: result: $1], AC_FD_LOG)
_AC_ECHO([$ECHO_T""$1])[]dnl
_AC_ECHO([${ECHO_T}$1])[]dnl
])
@ -2199,7 +2202,7 @@ _AC_ECHO([$ECHO_T""$1])[]dnl
# Likewise, but perform $ ` \ shell substitutions.
define([AC_MSG_RESULT_UNQUOTED],
[_AC_ECHO_UNQUOTED([configure:__oline__: result: $1], AC_FD_LOG)
_AC_ECHO_UNQUOTED([$ECHO_T""$1])[]dnl
_AC_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl
])
@ -4013,7 +4016,7 @@ dnl Here, there are 2 cmd per line, and two cmd are added later.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_lines # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
ac_sed_cmds=
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" $ac_cs_root.subs >$ac_cs_root.sfrag