+2000-07-10 Akim Demaille <akim@epita.fr>
+
+ Set autoconf's default warnings to `syntax'.
+
+ In fact, honor the most recent specification in the concatenation
+ of `syntax',$WARNINGS,<options> in that order.
+ Implement support for `none' and `noCATEGORY' so that the options
+ may override the previous choices.
+ Suggested by Didier Verna.
+
+ * acgeneral.m4 (_AC_WARNING_IFELSE): New macro.
+ (AC_WARNING_IFELSE): Use this macro to implement the new specs.
+ (AC_WARNING): The empty category must not be used, default to
+ `syntax'.
+ * doc/autoconf.texi (autoconf Invocation, Reporting Messages): Adjust.
+ * autoconf.sh: Adjust.
+ Use `optarg' to fetch the arguments of options.
+ Fix a bug in the handling of `--trace='.
+
+ * acgeneral.m4 (AC_CACHE_VAL): Typo: the macro was complaining iff
+ it shouldn't have.
+
2000-07-10 Akim Demaille <akim@epita.fr>
* autoreconf.sh (--install, --symlink): New options.
# The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
# Should be dnl'ed. Try to catch common mistakes.
define([AC_CACHE_VAL],
-[ifelse(regexp([$2], [AC_DEFINE]), [-1],
+[ifelse(regexp([$2], [AC_DEFINE]), [-1], [],
[AC_DIAGNOSE(syntax,
[$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
[where no actions should be taken])])dnl
# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise
# IF-FALSE. CATEGORY is enabled iff `AC_WARNING_ENABLE(CATEGORY)' or
# `AC_WARNING_ENABLE(all)' is defined.
+#
+# The variable `_AC_WARNINGS' contains a comma separated list of
+# warnings which order is the converse from the one specified by
+# the user, i.e., if she specified `-W error,none,obsolete',
+# `_AC_WARNINGS' is `obsolete,none,error'. We read it from left to
+# right, and:
+# - if none or noCATEGORY is met, run IF-FALSE
+# - if all or CATEGORY is met, run IF-TRUE
+# - if there is nothing left, run IF-FALSE.
define([AC_WARNING_IFELSE],
-[ifdef([AC_WARNING_ENABLE($1)], [$2],
- [ifdef([AC_WARNING_ENABLE(all)], [$2], [$3])])])
+[_AC_WARNING_IFELSE([$1], [$2], [$3], _AC_WARNINGS)])
+
+
+# _AC_WARNING_IFELSE(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...)
+# --------------------------------------------------------------
+# Implementation of the loop described above.
+define([_AC_WARNING_IFELSE],
+[ifelse([$4], [$1], [$2],
+ [$4], [all], [$2],
+ [$4], [], [$3],
+ [$4], [none], [$3],
+ [$4], [no$1], [$3],
+ [$0([$1], [$2], [$3], m4_shiftn(4, $@))])])
# _AC_DIAGNOSE(MESSAGE)
# -------------------
# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
# specified.
-define([AC_WARNING], [AC_DIAGNOSE([], [$1])])
+define([AC_WARNING], [AC_DIAGNOSE([syntax], [$1])])
# AC_FATAL(MESSAGE, [EXIT-STATUS])
-m, --macrodir=DIR directory storing Autoconf's macro files
-l, --localdir=DIR directory storing the \`aclocal.m4' file
-o, --output=FILE save output in FILE (stdout is the default)
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY
+ -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
- \`error' warnings are error
+ \`cross' cross compilation issues
+ \`obsolete' obsolete constructs
+ \`syntax' dubious syntactic constructs
+ \`all' all the warnings
+ \`noCATEGORY' turn off the warnings on CATEGORY
+ \`none' turn off all the warnings
+ \`error' warnings are error
+
+The environment variable \`WARNINGS' is honored.
Tracing:
-t, --trace=MACRO report the list of calls to MACRO
# Parse command line.
while test $# -gt 0 ; do
- case "$1" in
+ optarg=`expr "$1" : '--[^=]*=\(.*\)' \| \
+ "$1" : '-.\(.*\)'`
+ case $1 in
--version | --vers* | -V )
echo "$version" ; exit 0 ;;
--help | --h* | -h )
shift;;
--localdir=* | --l*=* )
- localdir=`echo "$1" | sed -e 's/^[^=]*=//'`
+ localdir=$optarg
shift ;;
--localdir | --l* | -l )
test $# = 1 && eval "$exit_missing_arg"
shift ;;
--macrodir=* | --m*=* )
- AC_MACRODIR=`echo "$1" | sed -e 's/^[^=]*=//'`
+ AC_MACRODIR=$optarg
shift ;;
--macrodir | --m* | -m )
test $# = 1 && eval "$exit_missing_arg"
shift ;;
--trace=* )
task=trace
- traces="$traces '"`echo "$1" |
- sed -e "s/^[^=]*=//;s/:.*//;s/'/'\\\\\\\\''/g"`"'"
+ traces="$traces '"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--initialization | -i )
initialization=:
outfile=$1
shift ;;
--output=* )
- outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
+ outfile=$optarg
shift ;;
-o* )
- outfile=`expr "$1" : '-o\(.*\)'`
+ outfile=$optarg
shift ;;
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
shift
- warnings="$warnings "`echo $1 | sed -e 's/,/ /g'`
+ warnings=$warnings,$1
shift ;;
--warnings=* )
- warnings="$warnings "`echo "$1" | sed -e 's/^[^=]*=//;s/,/ /g'`
+ warnings=$warnings,$optarg
shift ;;
-W* ) # People are used to -Wall, -Werror etc.
- warnings="$warnings "`echo "$1" | sed -e 's/^-W//;s/,/ /g'`
+ warnings=$warnings,$optarg
shift ;;
-- ) # Stop option processing
esac
done
-# Support $WARNINGS.
-: ${warnings=`echo $WARNINGS | sed -e 's/,/ /g'`}
+# 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.
+_ac_warnings=
+for warning in `IFS=,; echo syntax,$WARNINGS,$warnings | tr [A-Z] [a-z]`
+do
+ test -n $warning || continue
+ _ac_warnings="$warning"`test -n "$_ac_warnings" && echo ",$_ac_warnings"`
+done
+
# Trap on 0 to stop playing with `rm'.
$debug ||
## Generate the `configure' script. ##
## --------------------------------- ##
script)
- # Enable the requested warnings.
- warnings_opt=`echo "$warnings" |
- sed -e 's/\([^ ][^ ]*\)/-DAC_WARNING_ENABLE(\1) /g'`
- $run_m4f $warnings_opt $infile >$tmp/configure || exit 2
+ # M4 expansion.
+ $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure || 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
-m, --macrodir=DIR directory storing Autoconf's macro files
-l, --localdir=DIR directory storing the \`aclocal.m4' file
-o, --output=FILE save output in FILE (stdout is the default)
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY
+ -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
- \`error' warnings are error
+ \`cross' cross compilation issues
+ \`obsolete' obsolete constructs
+ \`syntax' dubious syntactic constructs
+ \`all' all the warnings
+ \`noCATEGORY' turn off the warnings on CATEGORY
+ \`none' turn off all the warnings
+ \`error' warnings are error
+
+The environment variable \`WARNINGS' is honored.
Tracing:
-t, --trace=MACRO report the list of calls to MACRO
# Parse command line.
while test $# -gt 0 ; do
- case "$1" in
+ optarg=`expr "$1" : '--[^=]*=\(.*\)' \| \
+ "$1" : '-.\(.*\)'`
+ case $1 in
--version | --vers* | -V )
echo "$version" ; exit 0 ;;
--help | --h* | -h )
shift;;
--localdir=* | --l*=* )
- localdir=`echo "$1" | sed -e 's/^[^=]*=//'`
+ localdir=$optarg
shift ;;
--localdir | --l* | -l )
test $# = 1 && eval "$exit_missing_arg"
shift ;;
--macrodir=* | --m*=* )
- AC_MACRODIR=`echo "$1" | sed -e 's/^[^=]*=//'`
+ AC_MACRODIR=$optarg
shift ;;
--macrodir | --m* | -m )
test $# = 1 && eval "$exit_missing_arg"
shift ;;
--trace=* )
task=trace
- traces="$traces '"`echo "$1" |
- sed -e "s/^[^=]*=//;s/:.*//;s/'/'\\\\\\\\''/g"`"'"
+ traces="$traces '"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--initialization | -i )
initialization=:
outfile=$1
shift ;;
--output=* )
- outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
+ outfile=$optarg
shift ;;
-o* )
- outfile=`expr "$1" : '-o\(.*\)'`
+ outfile=$optarg
shift ;;
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
shift
- warnings="$warnings "`echo $1 | sed -e 's/,/ /g'`
+ warnings=$warnings,$1
shift ;;
--warnings=* )
- warnings="$warnings "`echo "$1" | sed -e 's/^[^=]*=//;s/,/ /g'`
+ warnings=$warnings,$optarg
shift ;;
-W* ) # People are used to -Wall, -Werror etc.
- warnings="$warnings "`echo "$1" | sed -e 's/^-W//;s/,/ /g'`
+ warnings=$warnings,$optarg
shift ;;
-- ) # Stop option processing
esac
done
-# Support $WARNINGS.
-: ${warnings=`echo $WARNINGS | sed -e 's/,/ /g'`}
+# 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.
+_ac_warnings=
+for warning in `IFS=,; echo syntax,$WARNINGS,$warnings | tr [A-Z] [a-z]`
+do
+ test -n $warning || continue
+ _ac_warnings="$warning"`test -n "$_ac_warnings" && echo ",$_ac_warnings"`
+done
+
# Trap on 0 to stop playing with `rm'.
$debug ||
## Generate the `configure' script. ##
## --------------------------------- ##
script)
- # Enable the requested warnings.
- warnings_opt=`echo "$warnings" |
- sed -e 's/\([^ ][^ ]*\)/-DAC_WARNING_ENABLE(\1) /g'`
- $run_m4f $warnings_opt $infile >$tmp/configure || exit 2
+ # M4 expansion.
+ $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure || 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
-m, --macrodir=DIR directory storing Autoconf's macro files
-l, --localdir=DIR directory storing the \`aclocal.m4' file
-o, --output=FILE save output in FILE (stdout is the default)
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY
+ -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
- \`error' warnings are error
+ \`cross' cross compilation issues
+ \`obsolete' obsolete constructs
+ \`syntax' dubious syntactic constructs
+ \`all' all the warnings
+ \`noCATEGORY' turn off the warnings on CATEGORY
+ \`none' turn off all the warnings
+ \`error' warnings are error
+
+The environment variable \`WARNINGS' is honored.
Tracing:
-t, --trace=MACRO report the list of calls to MACRO
# Parse command line.
while test $# -gt 0 ; do
- case "$1" in
+ optarg=`expr "$1" : '--[^=]*=\(.*\)' \| \
+ "$1" : '-.\(.*\)'`
+ case $1 in
--version | --vers* | -V )
echo "$version" ; exit 0 ;;
--help | --h* | -h )
shift;;
--localdir=* | --l*=* )
- localdir=`echo "$1" | sed -e 's/^[^=]*=//'`
+ localdir=$optarg
shift ;;
--localdir | --l* | -l )
test $# = 1 && eval "$exit_missing_arg"
shift ;;
--macrodir=* | --m*=* )
- AC_MACRODIR=`echo "$1" | sed -e 's/^[^=]*=//'`
+ AC_MACRODIR=$optarg
shift ;;
--macrodir | --m* | -m )
test $# = 1 && eval "$exit_missing_arg"
shift ;;
--trace=* )
task=trace
- traces="$traces '"`echo "$1" |
- sed -e "s/^[^=]*=//;s/:.*//;s/'/'\\\\\\\\''/g"`"'"
+ traces="$traces '"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--initialization | -i )
initialization=:
outfile=$1
shift ;;
--output=* )
- outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
+ outfile=$optarg
shift ;;
-o* )
- outfile=`expr "$1" : '-o\(.*\)'`
+ outfile=$optarg
shift ;;
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
shift
- warnings="$warnings "`echo $1 | sed -e 's/,/ /g'`
+ warnings=$warnings,$1
shift ;;
--warnings=* )
- warnings="$warnings "`echo "$1" | sed -e 's/^[^=]*=//;s/,/ /g'`
+ warnings=$warnings,$optarg
shift ;;
-W* ) # People are used to -Wall, -Werror etc.
- warnings="$warnings "`echo "$1" | sed -e 's/^-W//;s/,/ /g'`
+ warnings=$warnings,$optarg
shift ;;
-- ) # Stop option processing
esac
done
-# Support $WARNINGS.
-: ${warnings=`echo $WARNINGS | sed -e 's/,/ /g'`}
+# 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.
+_ac_warnings=
+for warning in `IFS=,; echo syntax,$WARNINGS,$warnings | tr [A-Z] [a-z]`
+do
+ test -n $warning || continue
+ _ac_warnings="$warning"`test -n "$_ac_warnings" && echo ",$_ac_warnings"`
+done
+
# Trap on 0 to stop playing with `rm'.
$debug ||
## Generate the `configure' script. ##
## --------------------------------- ##
script)
- # Enable the requested warnings.
- warnings_opt=`echo "$warnings" |
- sed -e 's/\([^ ][^ ]*\)/-DAC_WARNING_ENABLE(\1) /g'`
- $run_m4f $warnings_opt $infile >$tmp/configure || exit 2
+ # M4 expansion.
+ $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure || 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
@evindex WARNINGS
Report the warnings related to @var{category} (which can actually be a
comma separated list). @xref{Reporting Messages}, macro
-@code{AC_DIAGNOSE}, for a comprehensive list of categories. The special
-category @samp{all} will report all the warnings, and @samp{error}
-treats warnings as errors.
+@code{AC_DIAGNOSE}, for a comprehensive list of categories. Special
+values include:
-The soon-do-be-standard environment variable @code{WARNINGS} is
-supported: it consists in a comma separated list of categories. It is
-honored iff @option{--warnings} was not used.
+@table @samp
+@item all
+report all the warnings
+
+@item none
+report none
+
+@item error
+treats warnings as errors
+
+@item no@var{category}
+disable warnings falling into @var{category}
+@end table
+
+Warnings about @samp{syntax} are enabled by default, and the environment
+variable @code{WARNINGS}, a comma separated list of categories, is
+honored. @command{autoconf} will actually behave as if you had run
+
+@example
+autoconf --warnings=syntax,$WARNINGS,@var{categories}
+@end example
+
+@noindent
+If you want to disable @command{autoconf}'s defaults and @code{WARNING}
+but enable the warnings about obsolete constructs, use @samp{-W
+none,obsolete}.
@item --trace=@var{macro}[:@var{format}]
@itemx -t @var{macro}[:@var{format}]
comma separated list). Current categories include:
@table @samp
-@item @samp{obsolete}
+@item obsolete
report the uses of obsolete constructs
-@item @samp{all}
+@item all
report all the warnings
-@item @samp{error}
+@item none
+report none
+
+@item error
treats warnings as errors
+
+@item no@var{category}
+disable warnings falling into @var{category}
@end table
-The soon-do-be-standard environment variable @code{WARNINGS} is
-supported: it consists in a comma separated list of categories. It is
-honored iff @option{--warnings} was not used.
@end table
+
+
@node Autoheader Macros, , autoheader Invocation, Configuration Headers
@subsection Autoheader Macros
@defmac AC_WARNING (@var{message})
@maindex WARNING
-Equivalent to @samp{AC_DIAGNOSE([], @var{message})}, but you are
+Equivalent to @samp{AC_DIAGNOSE([syntax], @var{message})}, but you are
strongly encouraged to use a finer grained category.
@end defmac
# The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
# Should be dnl'ed. Try to catch common mistakes.
define([AC_CACHE_VAL],
-[ifelse(regexp([$2], [AC_DEFINE]), [-1],
+[ifelse(regexp([$2], [AC_DEFINE]), [-1], [],
[AC_DIAGNOSE(syntax,
[$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
[where no actions should be taken])])dnl
# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise
# IF-FALSE. CATEGORY is enabled iff `AC_WARNING_ENABLE(CATEGORY)' or
# `AC_WARNING_ENABLE(all)' is defined.
+#
+# The variable `_AC_WARNINGS' contains a comma separated list of
+# warnings which order is the converse from the one specified by
+# the user, i.e., if she specified `-W error,none,obsolete',
+# `_AC_WARNINGS' is `obsolete,none,error'. We read it from left to
+# right, and:
+# - if none or noCATEGORY is met, run IF-FALSE
+# - if all or CATEGORY is met, run IF-TRUE
+# - if there is nothing left, run IF-FALSE.
define([AC_WARNING_IFELSE],
-[ifdef([AC_WARNING_ENABLE($1)], [$2],
- [ifdef([AC_WARNING_ENABLE(all)], [$2], [$3])])])
+[_AC_WARNING_IFELSE([$1], [$2], [$3], _AC_WARNINGS)])
+
+
+# _AC_WARNING_IFELSE(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...)
+# --------------------------------------------------------------
+# Implementation of the loop described above.
+define([_AC_WARNING_IFELSE],
+[ifelse([$4], [$1], [$2],
+ [$4], [all], [$2],
+ [$4], [], [$3],
+ [$4], [none], [$3],
+ [$4], [no$1], [$3],
+ [$0([$1], [$2], [$3], m4_shiftn(4, $@))])])
# _AC_DIAGNOSE(MESSAGE)
# -------------------
# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
# specified.
-define([AC_WARNING], [AC_DIAGNOSE([], [$1])])
+define([AC_WARNING], [AC_DIAGNOSE([syntax], [$1])])
# AC_FATAL(MESSAGE, [EXIT-STATUS])