]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Provide a fine grained control over autoconf's warnings.
authorAkim Demaille <akim@epita.fr>
Thu, 13 Apr 2000 08:25:11 +0000 (08:25 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 13 Apr 2000 08:25:11 +0000 (08:25 +0000)
* acgeneral.m4 (AC_WARNING_IFELSE, _AC_DIAGNOSE, AC_DIAGNOSE):
New macros.
(AC_DEFUN_ONCE, AC_OBSOLETE, AC_BEFORE, AU_DEFUN, AC_PREREQ,
AC_WARNING, AC_FATAL, AC_TRY_RUN): Use AC_DIAGNOSE.
* autoconf.sh: Provide support for `--warnings', `-W'.
* doc/autoconf.texi (Invoking autoconf): Adjust.
(Reporting Messages): New section.

ChangeLog
acgeneral.m4
autoconf.in
autoconf.sh
bin/autoconf.in
doc/autoconf.texi
lib/autoconf/general.m4
man/autoconf.1
man/autoheader.1

index e7c46e00c1228dce4d75f0e234942114f5e3e5c6..f7e78e012e8e62d0ca94becfd6fe914dcfa3e007 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2000-04-12  Akim Demaille  <akim@epita.fr>
+
+       Provide a fine grained control over autoconf's warnings.
+
+       * acgeneral.m4 (AC_WARNING_IFELSE, _AC_DIAGNOSE, AC_DIAGNOSE):
+       New macros.
+       (AC_DEFUN_ONCE, AC_OBSOLETE, AC_BEFORE, AU_DEFUN, AC_PREREQ,
+       AC_WARNING, AC_FATAL, AC_TRY_RUN): Use AC_DIAGNOSE.
+       * autoconf.sh: Provide support for `--warnings', `-W'.
+       * doc/autoconf.texi (Invoking autoconf): Adjust.
+       (Reporting Messages): New section.
+
 2000-04-12  Akim Demaille  <akim@epita.fr>
 
        * acgeneral.m4 (_AC_INIT_HELP): Move --srcdir in the first
index 999d0df26ce297283e9337ffb8052fdd9f81a357..729619c679e35ebd0c66f23781fdfff0e5f1cac8 100644 (file)
@@ -240,7 +240,7 @@ define([$1], [AC_PRO([$1])$4[]AC_EPI()])])])
 define([AC_DEFUN_ONCE],
 [define([$1],
 [AC_PROVIDE_IFELSE([$1],
-                   [AC_WARNING([$1 invoked multiple times])],
+                   [AC_DIAGNOSE([syntax], [$1 invoked multiple times])],
                    [AC_PRO([$1])$2[]AC_EPI()])])])
 
 
@@ -254,7 +254,7 @@ define([AC_DEFUNCT],
 # AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION])
 # ------------------------------------------
 define(AC_OBSOLETE,
-[AC_WARNING([$1 is obsolete$2])])
+[AC_DIAGNOSE([obsolete], [$1 is obsolete$2])])
 
 
 # AC_SPECIALIZE(MACRO, ARG1 [, ARGS...])
@@ -280,7 +280,7 @@ define(AC_SPECIALIZE,
 # AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)
 # ---------------------------------------------
 define(AC_BEFORE,
-[AC_PROVIDE_IFELSE([$2], [AC_WARNING([$2 was called before $1])])])
+[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
 
 
 # AC_REQUIRE(MACRO-NAME)
@@ -360,7 +360,7 @@ m4_changequote(, )m4_dnl
 # See `acobsolete.m4' for a longer description.
 define(AU_DEFUN,
 [define([$1],
-[m4_warn([The macro `$1' is obsolete.
+[AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
 You should run autoupdate.])dnl
 $2])dnl
 AU_DEFINE([$1], [$2], [$3])dnl
@@ -500,22 +500,22 @@ define(AC_VAR_IF_SET,
 # --------------------------------
 #
 
-# The idea behind these macros is that we may sometimes have to handle
-# manifest values (e.g. `stdlib.h'), while at other moments, the same
-# code may have to get the value from a variable (e.g., `ac_header').
-# To have a uniform handling of both case, when a new value is about to
-# be processed, declare a local variable, e.g.:
+# Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
+# other moments, the same code may have to get the value from a
+# variable (e.g., `ac_header').  To have a uniform handling of both
+# cases, when a new value is about to be processed, declare a local
+# variable, e.g.:
 #
 #   AC_VAR_PUSHDEF([header], [ac_cv_header_$1])
 #
-# and then in the body of the macro, use `header' as is.  It is of first
-# importance to use `AC_VAR_*' to access this variable.  Don't quote its
-# name: it must be used right away by m4.
+# and then in the body of the macro, use `header' as is.  It is of
+# first importance to use `AC_VAR_*' to access this variable.  Don't
+# quote its name: it must be used right away by m4.
 #
-# If the value `$1' was manifest (e.g. `stdlib.h'), then `header' is in
-# fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect, then
-# `header's value in m4 is in fact `$ac_header', the shell variable that
-# holds all of the magic to get the expansion right.
+# If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
+# in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
+# then `header's value in m4 is in fact `$ac_header', the shell
+# variable that holds all of the magic to get the expansion right.
 #
 # At the end of the block, free the variable with
 #
@@ -548,7 +548,7 @@ define(AC_VAR_POPDEF,
 
 # The point of this section is to provide high level functions
 # comparable to m4's `translit' primitive, but m4:sh polymorphic.
-# Transliteration of manifest strings should be handled by m4, while
+# Transliteration of literal strings should be handled by m4, while
 # shell variables' content will be translated at runtime (tr or sed).
 
 # AC_TR_CPP(EXPRESSION)
@@ -762,7 +762,7 @@ define(_AC_VERSION_COMPARE,
 # Complain and exit if the Autoconf version is less than VERSION.
 define(AC_PREREQ,
 [ifelse(_AC_VERSION_COMPARE([AC_ACVERSION], [$1]), -1,
-       [AC_FATAL(Autoconf version $1 or higher is required for this script)])])
+     [AC_FATAL([Autoconf version $1 or higher is required for this script])])])
 
 
 
@@ -2081,11 +2081,45 @@ s%@$1@%%;t t])])
 # directly.  This will also avoid to some people to get it wrong
 # between AC_FATAL and AC_MSG_ERROR.
 
+
+# AC_WARNING_IFELSE(CATEGORY, IF-TRUE, IF-FALSE)
+# ----------------------------------------------
+# 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.
+define([AC_WARNING_IFELSE],
+[ifdef([AC_WARNING_ENABLE($1)], [$2],
+       [ifdef([AC_WARNING_ENABLE(all)], [$2], [$3])])])
+
+
+# _AC_DIAGNOSE(MESSAGE)
+# ---------------------
+# Report MESSAGE as a warning, unless the user requested -W error,
+# in which case report a fatal error.
+define([_AC_DIAGNOSE],
+[ifdef([AC_WARNING_ENABLE(error)],
+       [m4_fatal([$1])],
+       [m4_warn([$1])])])
+
+
+# AC_DIAGNOSE(CATEGORY, MESSAGE)
+# ------------------------------
+# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
+# is requested (in fact, not disabled).
+define([AC_DIAGNOSE],
+[AC_WARNING_IFELSE([$1], [_AC_DIAGNOSE([$2])])])
+
+
 # AC_WARNING(MESSAGE)
-define(AC_WARNING, [m4_warn([$1])])
+# -------------------
+# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
+# specified.
+define([AC_WARNING], [AC_DIAGNOSE([], [$1])])
+
 
 # AC_FATAL(MESSAGE, [EXIT-STATUS])
-define(AC_FATAL, [m4_fatal([$1], [$2])])
+# --------------------------------
+define([AC_FATAL], [m4_fatal([$1], [$2])])
 
 
 
@@ -2112,7 +2146,8 @@ define(AC_FATAL, [m4_fatal([$1], [$2])])
 define([_AC_SH_QUOTE],
 [ifelse(regexp([[$1]], [\\`]),
         -1, [patsubst([[$1]], [`], [\\`])],
-        [AC_WARNING([backquotes should not be backslashed in: $1])dnl
+        [AC_DIAGNOSE([syntax],
+                     [backquotes should not be backslashed in: $1])dnl
 [$1]])])
 
 
@@ -2289,13 +2324,12 @@ define(AC_INCLUDES_DEFAULT,
 # AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell
 # variables are not a valid argument.
 AC_DEFUN(AC_CHECK_MEMBER,
-[AC_REQUIRE([AC_HEADER_STDC])dnl
-AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
-dnl Extract the aggregate name, and the member name
-AC_VAR_IF_INDIR([$1],
-[AC_FATAL([$0: requires manifest arguments])])
+[AC_VAR_IF_INDIR([$1], [AC_FATAL([$0: requires literal arguments])])dnl
 ifelse(regexp([$1], [\.]), -1,
        [AC_FATAL([$0: Did not see any dot in `$1'])])dnl
+AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
+dnl Extract the aggregate name, and the member name
 AC_CACHE_CHECK([for $1], ac_Member,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
 [dnl AGGREGATE foo;
@@ -2867,10 +2901,10 @@ rm -f conftest*[]dnl
 # --------------------------------------------------------
 AC_DEFUN([AC_TRY_RUN],
 [if test "$cross_compiling" = yes; then
-  ifelse([$4], ,
-   [AC_WARNING([AC_TRY_RUN called without default to allow cross compiling])dnl
-  AC_MSG_ERROR(cannot run test program while cross compiling)],
-   [$4])
+  m4_default([$4],
+   [AC_DIAGNOSE([cross],
+            [AC_TRY_RUN called without default to allow cross compiling])dnl
+AC_MSG_ERROR(cannot run test program while cross compiling)])
 else
   AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3])
 fi
@@ -2925,13 +2959,13 @@ done
 #
 # Check for the existence of FILE.
 AC_DEFUN(AC_CHECK_FILE,
-[AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
+[AC_DIAGNOSE([cross],
+             [Cannot check for file existence when cross compiling])dnl
+AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
 dnl FIXME: why was there this line? AC_REQUIRE([AC_PROG_CC])dnl
 AC_CACHE_CHECK([for $1], ac_File,
-[if test "$cross_compiling" = yes; then
-  AC_WARNING([Cannot check for file existence when cross compiling])dnl
+[test "$cross_compiling" = yes &&
   AC_MSG_ERROR([Cannot check for file existence when cross compiling])
-fi
 if test -r "[$1]"; then
   AC_VAR_SET(ac_File, yes)
 else
index f74c747a42d6a9c1c943d4596a0661accc622582..1ac4240982748113ccb35f10dc67baddbe96221b 100644 (file)
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: autoconf [OPTION] ... [TEMPLATE-FILE]
+Usage: $0 [OPTION] ... [TEMPLATE-FILE]
 
 Generate a configuration script from a TEMPLATE-FILE if given, or
 \`configure.in' by default.  Output is sent to the standard output if
 TEMPLATE-FILE is given, else into \`configure'.
 
-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
-  -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
+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
+  -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
+
+Warning categories include:
+  \`cross'      cross compilation issues
+  \`obsolete'   use of obsolete macros
+  \`syntax'     dubious syntactic constructs
+  \`all'        all the warnings
+  \`error'      warnings are error
+
+Tracing:
   -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)
+
+In tracing mode, no configuration script is created.
 
 Report bugs to <bug-autoconf@gnu.org>."
 
@@ -168,6 +179,18 @@ while test $# -gt 0 ; do
        outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
        shift ;;
 
+    --warnings | -W )
+       shift
+       test $# = 0 && { echo "$help" >&2; exit 1; }
+       warnings="$warnings "`echo $1 | sed -e 's/,/ /g'`
+       shift ;;
+    --warnings=* )
+       warnings="$warnings "`echo "$1" | sed -e 's/^[^=]*=//;s/,/ /g'`
+       shift ;;
+    -W* ) # People are used to -Wall, -Werror etc.
+       warnings="$warnings "`echo "$1" | sed -e 's/^.//;s/,/ /g'`
+       shift ;;
+
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -182,6 +205,9 @@ while test $# -gt 0 ; do
   esac
 done
 
+# Support $WARNINGS.
+: ${warnings=`echo $WARNINGS | sed -e 's/,/ /g'`}
+
 # Trap on 0 to stop playing with `rm'.
 $debug ||
 {
@@ -239,11 +265,14 @@ esac
 # Initializations are performed.  Proceed to the main task.
 case $task in
 
-  ## --------------------- ##
-  ## Generate the script.  ##
-  ## --------------------- ##
+  ## --------------------------------- ##
+  ## Generate the `configure' script.  ##
+  ## --------------------------------- ##
   script)
-  $run_m4f $infile >$tmp/configure || exit 2
+  # 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
 
   # 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
index f74c747a42d6a9c1c943d4596a0661accc622582..1ac4240982748113ccb35f10dc67baddbe96221b 100644 (file)
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: autoconf [OPTION] ... [TEMPLATE-FILE]
+Usage: $0 [OPTION] ... [TEMPLATE-FILE]
 
 Generate a configuration script from a TEMPLATE-FILE if given, or
 \`configure.in' by default.  Output is sent to the standard output if
 TEMPLATE-FILE is given, else into \`configure'.
 
-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
-  -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
+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
+  -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
+
+Warning categories include:
+  \`cross'      cross compilation issues
+  \`obsolete'   use of obsolete macros
+  \`syntax'     dubious syntactic constructs
+  \`all'        all the warnings
+  \`error'      warnings are error
+
+Tracing:
   -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)
+
+In tracing mode, no configuration script is created.
 
 Report bugs to <bug-autoconf@gnu.org>."
 
@@ -168,6 +179,18 @@ while test $# -gt 0 ; do
        outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
        shift ;;
 
+    --warnings | -W )
+       shift
+       test $# = 0 && { echo "$help" >&2; exit 1; }
+       warnings="$warnings "`echo $1 | sed -e 's/,/ /g'`
+       shift ;;
+    --warnings=* )
+       warnings="$warnings "`echo "$1" | sed -e 's/^[^=]*=//;s/,/ /g'`
+       shift ;;
+    -W* ) # People are used to -Wall, -Werror etc.
+       warnings="$warnings "`echo "$1" | sed -e 's/^.//;s/,/ /g'`
+       shift ;;
+
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -182,6 +205,9 @@ while test $# -gt 0 ; do
   esac
 done
 
+# Support $WARNINGS.
+: ${warnings=`echo $WARNINGS | sed -e 's/,/ /g'`}
+
 # Trap on 0 to stop playing with `rm'.
 $debug ||
 {
@@ -239,11 +265,14 @@ esac
 # Initializations are performed.  Proceed to the main task.
 case $task in
 
-  ## --------------------- ##
-  ## Generate the script.  ##
-  ## --------------------- ##
+  ## --------------------------------- ##
+  ## Generate the `configure' script.  ##
+  ## --------------------------------- ##
   script)
-  $run_m4f $infile >$tmp/configure || exit 2
+  # 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
 
   # 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
index f74c747a42d6a9c1c943d4596a0661accc622582..1ac4240982748113ccb35f10dc67baddbe96221b 100644 (file)
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: autoconf [OPTION] ... [TEMPLATE-FILE]
+Usage: $0 [OPTION] ... [TEMPLATE-FILE]
 
 Generate a configuration script from a TEMPLATE-FILE if given, or
 \`configure.in' by default.  Output is sent to the standard output if
 TEMPLATE-FILE is given, else into \`configure'.
 
-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
-  -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
+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
+  -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
+
+Warning categories include:
+  \`cross'      cross compilation issues
+  \`obsolete'   use of obsolete macros
+  \`syntax'     dubious syntactic constructs
+  \`all'        all the warnings
+  \`error'      warnings are error
+
+Tracing:
   -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)
+
+In tracing mode, no configuration script is created.
 
 Report bugs to <bug-autoconf@gnu.org>."
 
@@ -168,6 +179,18 @@ while test $# -gt 0 ; do
        outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
        shift ;;
 
+    --warnings | -W )
+       shift
+       test $# = 0 && { echo "$help" >&2; exit 1; }
+       warnings="$warnings "`echo $1 | sed -e 's/,/ /g'`
+       shift ;;
+    --warnings=* )
+       warnings="$warnings "`echo "$1" | sed -e 's/^[^=]*=//;s/,/ /g'`
+       shift ;;
+    -W* ) # People are used to -Wall, -Werror etc.
+       warnings="$warnings "`echo "$1" | sed -e 's/^.//;s/,/ /g'`
+       shift ;;
+
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -182,6 +205,9 @@ while test $# -gt 0 ; do
   esac
 done
 
+# Support $WARNINGS.
+: ${warnings=`echo $WARNINGS | sed -e 's/,/ /g'`}
+
 # Trap on 0 to stop playing with `rm'.
 $debug ||
 {
@@ -239,11 +265,14 @@ esac
 # Initializations are performed.  Proceed to the main task.
 case $task in
 
-  ## --------------------- ##
-  ## Generate the script.  ##
-  ## --------------------- ##
+  ## --------------------------------- ##
+  ## Generate the `configure' script.  ##
+  ## --------------------------------- ##
   script)
-  $run_m4f $infile >$tmp/configure || exit 2
+  # 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
 
   # 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
index 3504ebd5b5715e514ce4787d74b0ef4a199af616..b4446011f41f55ec0985c0b9f5b3857d76b4dc03 100644 (file)
@@ -260,7 +260,7 @@ Results of Tests
 * Defining Symbols::            Defining C preprocessor symbols
 * Setting Output Variables::    Replacing variables in output files
 * Caching Results::             Speeding up subsequent @code{configure} runs
-* Printing Messages::           Notifying users of progress or problems
+* Printing Messages::           Notifying @code{configure} users
 
 Caching Results
 
@@ -272,6 +272,7 @@ Writing Macros
 * Macro Definitions::           Basic format of an Autoconf macro
 * Macro Names::                 What to call your new macros
 * Quoting::                     Protecting macros from unwanted expansion
+* Reporting Messages::          Notifying @code{autoconf} users
 * Dependencies Between Macros::  What to do when macros depend on other macros
 
 Quoting
@@ -869,10 +870,17 @@ definition it reads overrides the earlier ones.
 @itemx -h
 Print a summary of the command line options and exit.
 
-@item --localdir=@var{dir}
-@itemx -l @var{dir}
-Look for the package file @file{aclocal.m4} in directory @var{dir}
-instead of in the current directory.
+@item --version
+@itemx -V
+Print the version number of Autoconf and exit.
+
+@item --verbose
+@itemx -v
+Report processing steps.
+
+@item --debug
+@itemx -d
+Don't remove the temporary files.
 
 @item --macrodir=@var{dir}
 @itemx -m @var{dir}
@@ -881,31 +889,52 @@ Look for the installed macro files in directory @var{dir}.  You can also
 set the @code{AC_MACRODIR} environment variable to a directory; this
 option overrides the environment variable.
 
-@item --version
-@itemx -V
-Print the version number of Autoconf and exit.
-
-@item --trace=@var{macro}[:@var{format}]
-@itemx -t @var{macro}[:@var{format}]
-List the calls to @var{macro} according to the @var{format}.  Multiple
-@samp{--trace} list several macros.  Multiple @samp{--trace} for a
-single macro do not accumulate, nevertheless, @var{format} can be
-arbitrarily long.
-
-It is often needed to check the content of a @file{configure.in} file,
-but it is extremely fragile and error prone to try to parse it.  It is
-suggested to rely upon @samp{--trace} to scan @file{configure.in}.
-
-The @var{format} is a regular string, with new lines if wanted.  It
-defaults to @samp{$f:$l:$n:$@@}.
+@item --localdir=@var{dir}
+@itemx -l @var{dir}
+Look for the package file @file{aclocal.m4} in directory @var{dir}
+instead of in the current directory.
 
 @item --output=@var{file}
 @itemx -o @var{file}
 Save output (script or trace) to @var{file}.  The file @samp{-} stands
 for the standard output.
+
+@item --warnings=@var{category}
+@itemx -W @var{category}
+@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.
+
+The soon-do-be-standard environment variable @code{WARNINGS} is
+supported: it consists in a comma separated list of categories.  It is
+honored iff @samp{--warnings} was not used.
+
+@item --trace=@var{macro}[:@var{format}]
+@itemx -t @var{macro}[:@var{format}]
+Do not create the @code{configure} script, but list the calls to
+@var{macro} according to the @var{format}.  Multiple @samp{--trace} list
+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
+@var{format}.
+
+@item --initialization
+@itemx -i
+By default @samp{--trace} does not trace the initialization of the
+Autoconf macros (typically the @code{AC_DEFUN} definitions).  This
+results in a noticeable speedup, but can be disabled by this option.
 @end table
 
 
+It is often needed to check the content of a @file{configure.in} file,
+but it is extremely fragile and error prone to try to parse it.  It is
+suggested to rely upon @samp{--trace} to scan @file{configure.in}.
+
 The @var{format} of @samp{--trace} can use the following special
 escapes:
 
@@ -4548,7 +4577,7 @@ print a message letting the user know the result of the test.
 * Defining Symbols::            Defining C preprocessor symbols
 * Setting Output Variables::    Replacing variables in output files
 * Caching Results::             Speeding up subsequent @code{configure} runs
-* Printing Messages::           Notifying users of progress or problems
+* Printing Messages::           Notifying @code{configure} users
 @end menu
 
 @node Defining Symbols, Setting Output Variables, Results, Results
@@ -4873,17 +4902,13 @@ AM_PATH_GTKMM(0.9.5,, exit 1)
 
 @node Printing Messages,  , Caching Results, Results
 @section Printing Messages
+@cindex Messages, from @code{configure}
 
 @code{configure} scripts need to give users running them several kinds
 of information.  The following macros print messages in ways appropriate
 for each kind.  The arguments to all of them get enclosed in shell
-double quotes, so the shell performs variable and back quote substitution
-on them.  You can print a message containing a comma by quoting the
-message with the @code{m4} quote characters:
-
-@example
-AC_MSG_RESULT([never mind, I found the BASIC compiler])
-@end example
+double quotes, so the shell performs variable and back quote
+substitution on them.
 
 These macros are all wrappers around the @code{echo} shell command.
 @code{configure} scripts should rarely need to run @code{echo} directly
@@ -4892,6 +4917,9 @@ change how and when each kind of message is printed; such changes need
 only be made to the macro definitions, and all of the callers change
 automatically.
 
+To diagnose static issues, i.e., when @code{autoconf} is run, see
+@ref{Reporting Messages}.
+
 @defmac AC_MSG_CHECKING (@var{feature-description})
 @maindex MSG_CHECKING
 Notify the user that @code{configure} is checking for a particular
@@ -4953,6 +4981,7 @@ Here are some instructions and guidelines for writing Autoconf macros.
 * Macro Definitions::           Basic format of an Autoconf macro
 * Macro Names::                 What to call your new macros
 * Quoting::                     Protecting macros from unwanted expansion
+* Reporting Messages::          Notifying @code{autoconf} users
 * Dependencies Between Macros::  What to do when macros depend on other macros
 @end menu
 
@@ -5053,7 +5082,7 @@ other macro, followed by one or more words saying what the internal
 macro does.  For example, @code{AC_PATH_X} has internal macros
 @code{_AC_PATH_X_XMKMF} and @code{_AC_PATH_X_DIRECT}.
 
-@node Quoting, Dependencies Between Macros, Macro Names, Writing Macros
+@node Quoting, Reporting Messages, Macro Names, Writing Macros
 @section Quoting
 @cindex quotation
 
@@ -5413,7 +5442,53 @@ this happens, the resulting @code{configure} script will contain
 unexpanded macros.  The @code{autoconf} program checks for this problem
 by doing @samp{grep AC_ configure}.
 
-@node Dependencies Between Macros,  , Quoting, Writing Macros
+
+@node Reporting Messages, Dependencies Between Macros, Quoting, Writing Macros
+@section Reporting Messages
+@cindex Messages, from @code{autoconf}
+
+When macros statically diagnose abnormal situations, benign or fatal,
+they should report them using these macros.  For dynamic issues, i.e.,
+when @code{configure} is run, see @ref{Printing Messages}.
+
+@defmac AC_DIAGNOSE (@var{category}, @var{message})
+@maindex DIAGNOSE
+Report @var{message} as a warning (or as an error if requested by the
+user) if it falls into the @var{category}.  You are encouraged to use
+standard categories, which currently include:
+
+@table @samp
+@item all
+messages that don't fall into one of the following category.  Use of an
+empty @var{category} is equivalent.
+
+@item cross
+related to cross compilation issues.
+
+@item obsolete
+use of an obsolete construct.
+
+@item syntax
+dubious syntactic constructs, incorrectly ordered macro calls.
+@end table
+@end defmac
+
+@defmac AC_WARNING (@var{message})
+@maindex WARNING
+Equivalent to @samp{AC_DIAGNOSE([], @var{message})}, but you are
+strongly encouraged to use a finer grained category.
+@end defmac
+
+@defmac AC_FATAL (@var{message})
+@maindex FATAL
+Report a severe error @var{message}, and have @code{autoconf} die.
+@end defmac
+
+When the user runs @samp{autoconf -W error}, warnings from
+@code{AC_DIAGNOSE} and @code{AC_WARNING} are reported as error, see
+@ref{Invoking autoconf}.
+
+@node Dependencies Between Macros,  , Reporting Messages, Writing Macros
 @section Dependencies Between Macros
 
 Some Autoconf macros depend on other macros having been called first in
index 999d0df26ce297283e9337ffb8052fdd9f81a357..729619c679e35ebd0c66f23781fdfff0e5f1cac8 100644 (file)
@@ -240,7 +240,7 @@ define([$1], [AC_PRO([$1])$4[]AC_EPI()])])])
 define([AC_DEFUN_ONCE],
 [define([$1],
 [AC_PROVIDE_IFELSE([$1],
-                   [AC_WARNING([$1 invoked multiple times])],
+                   [AC_DIAGNOSE([syntax], [$1 invoked multiple times])],
                    [AC_PRO([$1])$2[]AC_EPI()])])])
 
 
@@ -254,7 +254,7 @@ define([AC_DEFUNCT],
 # AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION])
 # ------------------------------------------
 define(AC_OBSOLETE,
-[AC_WARNING([$1 is obsolete$2])])
+[AC_DIAGNOSE([obsolete], [$1 is obsolete$2])])
 
 
 # AC_SPECIALIZE(MACRO, ARG1 [, ARGS...])
@@ -280,7 +280,7 @@ define(AC_SPECIALIZE,
 # AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)
 # ---------------------------------------------
 define(AC_BEFORE,
-[AC_PROVIDE_IFELSE([$2], [AC_WARNING([$2 was called before $1])])])
+[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
 
 
 # AC_REQUIRE(MACRO-NAME)
@@ -360,7 +360,7 @@ m4_changequote(, )m4_dnl
 # See `acobsolete.m4' for a longer description.
 define(AU_DEFUN,
 [define([$1],
-[m4_warn([The macro `$1' is obsolete.
+[AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
 You should run autoupdate.])dnl
 $2])dnl
 AU_DEFINE([$1], [$2], [$3])dnl
@@ -500,22 +500,22 @@ define(AC_VAR_IF_SET,
 # --------------------------------
 #
 
-# The idea behind these macros is that we may sometimes have to handle
-# manifest values (e.g. `stdlib.h'), while at other moments, the same
-# code may have to get the value from a variable (e.g., `ac_header').
-# To have a uniform handling of both case, when a new value is about to
-# be processed, declare a local variable, e.g.:
+# Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
+# other moments, the same code may have to get the value from a
+# variable (e.g., `ac_header').  To have a uniform handling of both
+# cases, when a new value is about to be processed, declare a local
+# variable, e.g.:
 #
 #   AC_VAR_PUSHDEF([header], [ac_cv_header_$1])
 #
-# and then in the body of the macro, use `header' as is.  It is of first
-# importance to use `AC_VAR_*' to access this variable.  Don't quote its
-# name: it must be used right away by m4.
+# and then in the body of the macro, use `header' as is.  It is of
+# first importance to use `AC_VAR_*' to access this variable.  Don't
+# quote its name: it must be used right away by m4.
 #
-# If the value `$1' was manifest (e.g. `stdlib.h'), then `header' is in
-# fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect, then
-# `header's value in m4 is in fact `$ac_header', the shell variable that
-# holds all of the magic to get the expansion right.
+# If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
+# in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
+# then `header's value in m4 is in fact `$ac_header', the shell
+# variable that holds all of the magic to get the expansion right.
 #
 # At the end of the block, free the variable with
 #
@@ -548,7 +548,7 @@ define(AC_VAR_POPDEF,
 
 # The point of this section is to provide high level functions
 # comparable to m4's `translit' primitive, but m4:sh polymorphic.
-# Transliteration of manifest strings should be handled by m4, while
+# Transliteration of literal strings should be handled by m4, while
 # shell variables' content will be translated at runtime (tr or sed).
 
 # AC_TR_CPP(EXPRESSION)
@@ -762,7 +762,7 @@ define(_AC_VERSION_COMPARE,
 # Complain and exit if the Autoconf version is less than VERSION.
 define(AC_PREREQ,
 [ifelse(_AC_VERSION_COMPARE([AC_ACVERSION], [$1]), -1,
-       [AC_FATAL(Autoconf version $1 or higher is required for this script)])])
+     [AC_FATAL([Autoconf version $1 or higher is required for this script])])])
 
 
 
@@ -2081,11 +2081,45 @@ s%@$1@%%;t t])])
 # directly.  This will also avoid to some people to get it wrong
 # between AC_FATAL and AC_MSG_ERROR.
 
+
+# AC_WARNING_IFELSE(CATEGORY, IF-TRUE, IF-FALSE)
+# ----------------------------------------------
+# 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.
+define([AC_WARNING_IFELSE],
+[ifdef([AC_WARNING_ENABLE($1)], [$2],
+       [ifdef([AC_WARNING_ENABLE(all)], [$2], [$3])])])
+
+
+# _AC_DIAGNOSE(MESSAGE)
+# ---------------------
+# Report MESSAGE as a warning, unless the user requested -W error,
+# in which case report a fatal error.
+define([_AC_DIAGNOSE],
+[ifdef([AC_WARNING_ENABLE(error)],
+       [m4_fatal([$1])],
+       [m4_warn([$1])])])
+
+
+# AC_DIAGNOSE(CATEGORY, MESSAGE)
+# ------------------------------
+# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
+# is requested (in fact, not disabled).
+define([AC_DIAGNOSE],
+[AC_WARNING_IFELSE([$1], [_AC_DIAGNOSE([$2])])])
+
+
 # AC_WARNING(MESSAGE)
-define(AC_WARNING, [m4_warn([$1])])
+# -------------------
+# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
+# specified.
+define([AC_WARNING], [AC_DIAGNOSE([], [$1])])
+
 
 # AC_FATAL(MESSAGE, [EXIT-STATUS])
-define(AC_FATAL, [m4_fatal([$1], [$2])])
+# --------------------------------
+define([AC_FATAL], [m4_fatal([$1], [$2])])
 
 
 
@@ -2112,7 +2146,8 @@ define(AC_FATAL, [m4_fatal([$1], [$2])])
 define([_AC_SH_QUOTE],
 [ifelse(regexp([[$1]], [\\`]),
         -1, [patsubst([[$1]], [`], [\\`])],
-        [AC_WARNING([backquotes should not be backslashed in: $1])dnl
+        [AC_DIAGNOSE([syntax],
+                     [backquotes should not be backslashed in: $1])dnl
 [$1]])])
 
 
@@ -2289,13 +2324,12 @@ define(AC_INCLUDES_DEFAULT,
 # AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell
 # variables are not a valid argument.
 AC_DEFUN(AC_CHECK_MEMBER,
-[AC_REQUIRE([AC_HEADER_STDC])dnl
-AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
-dnl Extract the aggregate name, and the member name
-AC_VAR_IF_INDIR([$1],
-[AC_FATAL([$0: requires manifest arguments])])
+[AC_VAR_IF_INDIR([$1], [AC_FATAL([$0: requires literal arguments])])dnl
 ifelse(regexp([$1], [\.]), -1,
        [AC_FATAL([$0: Did not see any dot in `$1'])])dnl
+AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
+dnl Extract the aggregate name, and the member name
 AC_CACHE_CHECK([for $1], ac_Member,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
 [dnl AGGREGATE foo;
@@ -2867,10 +2901,10 @@ rm -f conftest*[]dnl
 # --------------------------------------------------------
 AC_DEFUN([AC_TRY_RUN],
 [if test "$cross_compiling" = yes; then
-  ifelse([$4], ,
-   [AC_WARNING([AC_TRY_RUN called without default to allow cross compiling])dnl
-  AC_MSG_ERROR(cannot run test program while cross compiling)],
-   [$4])
+  m4_default([$4],
+   [AC_DIAGNOSE([cross],
+            [AC_TRY_RUN called without default to allow cross compiling])dnl
+AC_MSG_ERROR(cannot run test program while cross compiling)])
 else
   AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3])
 fi
@@ -2925,13 +2959,13 @@ done
 #
 # Check for the existence of FILE.
 AC_DEFUN(AC_CHECK_FILE,
-[AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
+[AC_DIAGNOSE([cross],
+             [Cannot check for file existence when cross compiling])dnl
+AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
 dnl FIXME: why was there this line? AC_REQUIRE([AC_PROG_CC])dnl
 AC_CACHE_CHECK([for $1], ac_File,
-[if test "$cross_compiling" = yes; then
-  AC_WARNING([Cannot check for file existence when cross compiling])dnl
+[test "$cross_compiling" = yes &&
   AC_MSG_ERROR([Cannot check for file existence when cross compiling])
-fi
 if test -r "[$1]"; then
   AC_VAR_SET(ac_File, yes)
 else
index 9f61ebb210287871f0fd4349cfa7cbc7f6b6bf1c..f67748f0473a0f9e1a9e01047bb7036192d09e05 100644 (file)
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.020.
-.TH AUTOCONF "1" "March 2000" "GNU autoconf 2.14a" FSF
+.TH AUTOCONF "1" "April 2000" "GNU autoconf 2.14a" FSF
 .SH NAME
 autoconf \- Generate configuration scripts
 .SH SYNOPSIS
@@ -9,8 +9,7 @@ autoconf \- Generate configuration scripts
 Generate a configuration script from a TEMPLATE-FILE if given, or
 `configure.in' by default.  Output is sent to the standard output if
 TEMPLATE-FILE is given, else into `configure'.
-.PP
-If the option `--trace' is used, no configuration script is created.
+.SS "Operation modes:"
 .TP
 \fB\-h\fR, \fB\-\-help\fR
 print this help, then exit
@@ -30,14 +29,36 @@ directory storing Autoconf's macro files
 \fB\-l\fR, \fB\-\-localdir\fR=\fIDIR\fR
 directory storing the `aclocal.m4' file
 .TP
+\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
+save output in FILE (stdout is the default)
+.TP
+\fB\-W\fR, \fB\-\-warnings\fR=\fICATEGORY\fR
+report the warnings falling in CATEGORY
+.SS "Warning categories include:"
+.TP
+`cross'
+cross compilation issues
+.TP
+`obsolete'
+use of obsolete macros
+.TP
+`syntax'
+dubious syntactic constructs
+.TP
+`all'
+all the warnings
+.TP
+`error'
+warnings are error
+.SS "Tracing:"
+.TP
 \fB\-t\fR, \fB\-\-trace\fR=\fIMACRO\fR
 report the list of calls to MACRO
 .TP
 \fB\-i\fR, \fB\-\-initialization\fR
 also trace Autoconf's initialization process
-.TP
-\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
-save output in FILE (stdout is the default)
+.PP
+In tracing mode, no configuration script is created.
 .SH AUTHOR
 Written by David J. MacKenzie.
 .SH "REPORTING BUGS"
index d745d58c8018f5dcba6fdd7d851b64ab8e29fe63..0050fc7f758526b2f4db8bbff03b6b414475f579 100644 (file)
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.020.
-.TH AUTOHEADER "1" "March 2000" "GNU autoconf 2.14a" FSF
+.TH AUTOHEADER "1" "April 2000" "GNU autoconf 2.14a" FSF
 .SH NAME
 autoheader \- Create a template header for configure
 .SH SYNOPSIS