]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Move the handling of classified warnings into M4sugar.
authorAkim Demaille <akim@epita.fr>
Tue, 31 Oct 2000 15:20:15 +0000 (15:20 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 31 Oct 2000 15:20:15 +0000 (15:20 +0000)
* m4sugar.m4 (m4_diagnose): Remove.
(m4_warning): New.
* acgeneral.m4 (AC_WARNING_IFELSE, _AC_WARNING_IFELSE)
(_AC_WARNING_ERROR_IFELSE, __AC_WARNING_ERROR_IFELSE)
(_AC_DIAGNOSE, AC_DIAGNOSE): Rename as...
* m4sugar.m4 (m4_warning_ifelse, _m4_warning_ifelse)
(_m4_warning_error_ifelse, __m4_warning_error_ifelse)
(_m4_warn, m4_warn): these.
* acgeneral.m4 (AC_DIAGNOSE): Wrapper around `m4_warn'.
* autoconf.sh: Define `m4_warnings' instead of `_AC_WARNINGS'.

ChangeLog
acgeneral.m4
autoconf.in
autoconf.sh
bin/autoconf.in
lib/autoconf/general.m4
lib/m4sugar/m4sugar.m4
m4sugar.m4

index 6a66a163cf4ea841e7f597a2e24e1d351d6b5b62..0e30e7547769769aae462dfb110c3801988863eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-10-31  Akim Demaille  <akim@epita.fr>
+
+       Move the handling of classified warnings into M4sugar.
+
+       * m4sugar.m4 (m4_diagnose): Remove.
+       (m4_warning): New.
+       * acgeneral.m4 (AC_WARNING_IFELSE, _AC_WARNING_IFELSE)
+       (_AC_WARNING_ERROR_IFELSE, __AC_WARNING_ERROR_IFELSE)
+       (_AC_DIAGNOSE, AC_DIAGNOSE): Rename as...
+       * m4sugar.m4 (m4_warning_ifelse, _m4_warning_ifelse)
+       (_m4_warning_error_ifelse, __m4_warning_error_ifelse)
+       (_m4_warn, m4_warn): these.
+       * acgeneral.m4 (AC_DIAGNOSE): Wrapper around `m4_warn'.
+       * autoconf.sh: Define `m4_warnings' instead of `_AC_WARNINGS'.
+
 2000-10-30  Pavel Roskin  <proski@gnu.org>
 
        * acspecific.m4 (AC_PATH_XTRA): Use AC_LANG_PROGRAM() as the
index d27e1c50ebb2519c2aba7bfbab1e2c63fbf79f32..179358abb720712f157d789dcb1524f1ed4f7761 100644 (file)
@@ -521,7 +521,7 @@ define([_AC_EXPANSION_STACK_DUMP],
        [m4_errprint(defn([_AC_EXPANSION_STACK]))dnl
 popdef([_AC_EXPANSION_STACK])dnl
 _AC_EXPANSION_STACK_DUMP()],
-       [m4_diagnose([the top level])])])
+       [m4_errprint(m4_location[: the top level])])])
 
 
 # _AC_DEFUN_PRO(MACRO-NAME)
@@ -2589,81 +2589,26 @@ s,@$1@,,;t t])])
 # 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.
-#
-# 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],
-[_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_WARNING_ERROR_IFELSE(IF-TRUE, IF-FALSE)
-# -------------------------------------------
-# The same as AC_WARNING_IFELSE, but scan for `error' only.
-define([_AC_WARNING_ERROR_IFELSE],
-[__AC_WARNING_ERROR_IFELSE([$1], [$2], _AC_WARNINGS)])
-
-
-# __AC_WARNING_ERROR_IFELSE(IF-TRUE, IF-FALSE)
-# --------------------------------------------
-# The same as _AC_WARNING_IFELSE, but scan for `error' only.
-define([__AC_WARNING_ERROR_IFELSE],
-[ifelse([$3],  [error],    [$1],
-        [$3],  [],         [$2],
-        [$3],  [no-error], [$2],
-        [$0([$1], [$2], m4_shiftn(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],
-[_AC_WARNING_ERROR_IFELSE([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).
+# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
+# specified.
 define([AC_DIAGNOSE],
-[AC_WARNING_IFELSE([$1], [_AC_DIAGNOSE([$2])])])
+[m4_warn($@)])
 
 
 # AC_WARNING(MESSAGE)
 # -------------------
 # Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
 # specified.
-define([AC_WARNING], [AC_DIAGNOSE([syntax], [$1])])
+define([AC_WARNING],
+[AC_DIAGNOSE([syntax], [$1])])
 
 
 # AC_FATAL(MESSAGE, [EXIT-STATUS])
 # --------------------------------
 define([AC_FATAL],
-[m4_diagnose([$1])
+[m4_errprint(m4_location[: $1])
 _AC_EXPANSION_STACK_DUMP()
 m4exit(m4_default([$2], [1]))])
 
@@ -3906,7 +3851,8 @@ AC_DEFUN([AC_CHECK_TYPE],
         _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1,
            [_AC_CHECK_TYPE_OLD($@)],
         _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1,
-           [m4_warn([$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
+           [AC_DIAGNOSE([syntax],
+                    [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
         [_AC_CHECK_TYPE_NEW($@)])[]dnl
 ])# AC_CHECK_TYPE
 
index 237075f36e1aa94b5be57f0778137657d73b5659..9505ccf31814b6e57d3a5ee99f7993db6e93e997 100644 (file)
@@ -226,12 +226,12 @@ ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 NUMBERS='0123456789'
 WORDCHAR=_$alphabet$ALPHABET$NUMBERS
 
-_ac_warnings=
+m4__warnings=
 for warning in `IFS=,; echo syntax,$WARNINGS,$warnings |
                          tr $ALPHABET $alphabet`
 do
   test -n $warning || continue
-  _ac_warnings="$warning"`test -n "$_ac_warnings" && echo ",$_ac_warnings"`
+  m4__warnings="$warning"`test -n "$m4__warnings" && echo ",$m4_warnings"`
 done
 
 
@@ -303,7 +303,7 @@ case $task in
   ## --------------------------------- ##
   script)
   # M4 expansion.
-  $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure ||
+  $run_m4f -Dm4_warnings=$m4_warnings $infile >$tmp/configure ||
     { (exit 1); exit; }
 
   if test "x$outfile" != x-; then
index 237075f36e1aa94b5be57f0778137657d73b5659..9505ccf31814b6e57d3a5ee99f7993db6e93e997 100644 (file)
@@ -226,12 +226,12 @@ ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 NUMBERS='0123456789'
 WORDCHAR=_$alphabet$ALPHABET$NUMBERS
 
-_ac_warnings=
+m4__warnings=
 for warning in `IFS=,; echo syntax,$WARNINGS,$warnings |
                          tr $ALPHABET $alphabet`
 do
   test -n $warning || continue
-  _ac_warnings="$warning"`test -n "$_ac_warnings" && echo ",$_ac_warnings"`
+  m4__warnings="$warning"`test -n "$m4__warnings" && echo ",$m4_warnings"`
 done
 
 
@@ -303,7 +303,7 @@ case $task in
   ## --------------------------------- ##
   script)
   # M4 expansion.
-  $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure ||
+  $run_m4f -Dm4_warnings=$m4_warnings $infile >$tmp/configure ||
     { (exit 1); exit; }
 
   if test "x$outfile" != x-; then
index 237075f36e1aa94b5be57f0778137657d73b5659..9505ccf31814b6e57d3a5ee99f7993db6e93e997 100644 (file)
@@ -226,12 +226,12 @@ ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 NUMBERS='0123456789'
 WORDCHAR=_$alphabet$ALPHABET$NUMBERS
 
-_ac_warnings=
+m4__warnings=
 for warning in `IFS=,; echo syntax,$WARNINGS,$warnings |
                          tr $ALPHABET $alphabet`
 do
   test -n $warning || continue
-  _ac_warnings="$warning"`test -n "$_ac_warnings" && echo ",$_ac_warnings"`
+  m4__warnings="$warning"`test -n "$m4__warnings" && echo ",$m4_warnings"`
 done
 
 
@@ -303,7 +303,7 @@ case $task in
   ## --------------------------------- ##
   script)
   # M4 expansion.
-  $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure ||
+  $run_m4f -Dm4_warnings=$m4_warnings $infile >$tmp/configure ||
     { (exit 1); exit; }
 
   if test "x$outfile" != x-; then
index d27e1c50ebb2519c2aba7bfbab1e2c63fbf79f32..179358abb720712f157d789dcb1524f1ed4f7761 100644 (file)
@@ -521,7 +521,7 @@ define([_AC_EXPANSION_STACK_DUMP],
        [m4_errprint(defn([_AC_EXPANSION_STACK]))dnl
 popdef([_AC_EXPANSION_STACK])dnl
 _AC_EXPANSION_STACK_DUMP()],
-       [m4_diagnose([the top level])])])
+       [m4_errprint(m4_location[: the top level])])])
 
 
 # _AC_DEFUN_PRO(MACRO-NAME)
@@ -2589,81 +2589,26 @@ s,@$1@,,;t t])])
 # 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.
-#
-# 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],
-[_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_WARNING_ERROR_IFELSE(IF-TRUE, IF-FALSE)
-# -------------------------------------------
-# The same as AC_WARNING_IFELSE, but scan for `error' only.
-define([_AC_WARNING_ERROR_IFELSE],
-[__AC_WARNING_ERROR_IFELSE([$1], [$2], _AC_WARNINGS)])
-
-
-# __AC_WARNING_ERROR_IFELSE(IF-TRUE, IF-FALSE)
-# --------------------------------------------
-# The same as _AC_WARNING_IFELSE, but scan for `error' only.
-define([__AC_WARNING_ERROR_IFELSE],
-[ifelse([$3],  [error],    [$1],
-        [$3],  [],         [$2],
-        [$3],  [no-error], [$2],
-        [$0([$1], [$2], m4_shiftn(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],
-[_AC_WARNING_ERROR_IFELSE([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).
+# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
+# specified.
 define([AC_DIAGNOSE],
-[AC_WARNING_IFELSE([$1], [_AC_DIAGNOSE([$2])])])
+[m4_warn($@)])
 
 
 # AC_WARNING(MESSAGE)
 # -------------------
 # Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
 # specified.
-define([AC_WARNING], [AC_DIAGNOSE([syntax], [$1])])
+define([AC_WARNING],
+[AC_DIAGNOSE([syntax], [$1])])
 
 
 # AC_FATAL(MESSAGE, [EXIT-STATUS])
 # --------------------------------
 define([AC_FATAL],
-[m4_diagnose([$1])
+[m4_errprint(m4_location[: $1])
 _AC_EXPANSION_STACK_DUMP()
 m4exit(m4_default([$2], [1]))])
 
@@ -3906,7 +3851,8 @@ AC_DEFUN([AC_CHECK_TYPE],
         _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1,
            [_AC_CHECK_TYPE_OLD($@)],
         _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1,
-           [m4_warn([$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
+           [AC_DIAGNOSE([syntax],
+                    [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
         [_AC_CHECK_TYPE_NEW($@)])[]dnl
 ])# AC_CHECK_TYPE
 
index d8ead3b29e750aba0fb8825f1a0fa911e149f3cc..3cee360087f8e136962e5c8a9979e36244dd5b42 100644 (file)
@@ -98,24 +98,18 @@ define([m4_errprint], [errprint([$1
 ])])
 
 
-# m4_diagnose(MSG)
-# ----------------
-# Same as `m4_errprint', but reports the file and line.
-define([m4_diagnose],
-[m4_errprint(m4_location: [$1])])
-
-
-# m4_warn(MSG)
-# ------------
+# m4_warning(MSG)
+# ---------------
 # Warn the user.
-define([m4_warn], [m4_diagnose([warning: $1])])
+define([m4_warning],
+[m4_errprint(m4_location[: warning: $1])])
 
 
 # m4_fatal(MSG, [EXIT-STATUS])
 # ----------------------------
 # Fatal the user.                                                      :)
 define([m4_fatal],
-[m4_diagnose([error: $1])dnl
+[m4_errprint(m4_location[: error: $1])dnl
 m4exit(ifelse([$2],, 1, [$2]))])
 
 
@@ -129,8 +123,78 @@ define([m4_assert],
         [])])
 
 
+## ------------- ##
+## 3. Warnings.  ##
+## ------------- ##
+
+
+# m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE)
+# ----------------------------------------------
+# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise
+# IF-FALSE.
+#
+# The variable `m4_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',
+# `m4_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([m4_warning_ifelse],
+[_m4_warning_ifelse([$1], [$2], [$3], m4_warnings)])
+
+
+# _m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...)
+# --------------------------------------------------------------
+# Implementation of the loop described above.
+define([_m4_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, $@))])])
+
+
+# _m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
+# -------------------------------------------
+# The same as m4_warning_ifelse, but scan for `error' only.
+define([_m4_warning_error_ifelse],
+[__m4_warning_error_ifelse([$1], [$2], m4_warnings)])
+
+
+# __m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
+# --------------------------------------------
+# The same as _m4_warning_ifelse, but scan for `error' only.
+define([__m4_warning_error_ifelse],
+[ifelse([$3],  [error],    [$1],
+        [$3],  [],         [$2],
+        [$3],  [no-error], [$2],
+        [$0([$1], [$2], m4_shiftn(3, $@))])])
+
+
+
+# _m4_warn(MESSAGE)
+# -----------------
+# Report MESSAGE as a warning, unless the user requested -W error,
+# in which case report a fatal error.
+define([_m4_warn],
+[_m4_warning_error_ifelse([m4_fatal([$1])],
+                          [m4_warning([$1])])])
+
+
+# m4_warn(CATEGORY, MESSAGE)
+# --------------------------
+# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
+# is requested (in fact, not disabled).
+define([m4_warn],
+[m4_warning_ifelse([$1], [_m4_warn([$2])])])
+
+
+
 ## ------------------- ##
-## 3. File inclusion.  ##
+## 4. File inclusion.  ##
 ## ------------------- ##
 
 
@@ -151,7 +215,8 @@ define([m4_assert],
 # been included.
 define([m4_include_unique],
 [ifdef([m4_include($1)],
-       [m4_warn([file `$1' included several times])])dnl
+       [m4_warn([syntax],
+                [file `$1' included several times])])dnl
 define([m4_include($1)])])
 
 
@@ -177,7 +242,7 @@ undefine([sinclude])
 
 
 ## ------------------------------------ ##
-## 4. Additional branching constructs.  ##
+## 5. Additional branching constructs.  ##
 ## ------------------------------------ ##
 
 # Both `ifval' and `ifset' tests against the empty string.  The
@@ -279,7 +344,7 @@ define([m4_match],
 
 
 ## ---------------------------------------- ##
-## 5. Enhanced version of some primitives.  ##
+## 6. Enhanced version of some primitives.  ##
 ## ---------------------------------------- ##
 
 # m4_do(STRING, ...)
@@ -364,7 +429,7 @@ define([m4_noquote],
 
 
 ## -------------------------- ##
-## 6. Implementing m4 loops.  ##
+## 7. Implementing m4 loops.  ##
 ## -------------------------- ##
 
 
@@ -499,7 +564,7 @@ define([_m4_foreach],
 
 
 ## --------------------------- ##
-## 7. More diversion support.  ##
+## 8. More diversion support.  ##
 ## --------------------------- ##
 
 
@@ -545,7 +610,7 @@ m4_divert_pop()dnl
 
 
 ## -------------------- ##
-## 8. Text processing.  ##
+## 9. Text processing.  ##
 ## -------------------- ##
 
 # m4_tolower(STRING)
@@ -770,9 +835,9 @@ popdef([m4_Prefix])dnl
 
 
 
-## ---------------------- ##
-## 9. Number processing.  ##
-## ---------------------- ##
+## ----------------------- ##
+## 10. Number processing.  ##
+## ----------------------- ##
 
 # m4_sign(A)
 # ----------
@@ -818,7 +883,7 @@ define([m4_list_cmp],
 
 
 ## ------------------------ ##
-## 10. Version processing.  ##
+## 11. Version processing.  ##
 ## ------------------------ ##
 
 
index d8ead3b29e750aba0fb8825f1a0fa911e149f3cc..3cee360087f8e136962e5c8a9979e36244dd5b42 100644 (file)
@@ -98,24 +98,18 @@ define([m4_errprint], [errprint([$1
 ])])
 
 
-# m4_diagnose(MSG)
-# ----------------
-# Same as `m4_errprint', but reports the file and line.
-define([m4_diagnose],
-[m4_errprint(m4_location: [$1])])
-
-
-# m4_warn(MSG)
-# ------------
+# m4_warning(MSG)
+# ---------------
 # Warn the user.
-define([m4_warn], [m4_diagnose([warning: $1])])
+define([m4_warning],
+[m4_errprint(m4_location[: warning: $1])])
 
 
 # m4_fatal(MSG, [EXIT-STATUS])
 # ----------------------------
 # Fatal the user.                                                      :)
 define([m4_fatal],
-[m4_diagnose([error: $1])dnl
+[m4_errprint(m4_location[: error: $1])dnl
 m4exit(ifelse([$2],, 1, [$2]))])
 
 
@@ -129,8 +123,78 @@ define([m4_assert],
         [])])
 
 
+## ------------- ##
+## 3. Warnings.  ##
+## ------------- ##
+
+
+# m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE)
+# ----------------------------------------------
+# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise
+# IF-FALSE.
+#
+# The variable `m4_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',
+# `m4_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([m4_warning_ifelse],
+[_m4_warning_ifelse([$1], [$2], [$3], m4_warnings)])
+
+
+# _m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...)
+# --------------------------------------------------------------
+# Implementation of the loop described above.
+define([_m4_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, $@))])])
+
+
+# _m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
+# -------------------------------------------
+# The same as m4_warning_ifelse, but scan for `error' only.
+define([_m4_warning_error_ifelse],
+[__m4_warning_error_ifelse([$1], [$2], m4_warnings)])
+
+
+# __m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
+# --------------------------------------------
+# The same as _m4_warning_ifelse, but scan for `error' only.
+define([__m4_warning_error_ifelse],
+[ifelse([$3],  [error],    [$1],
+        [$3],  [],         [$2],
+        [$3],  [no-error], [$2],
+        [$0([$1], [$2], m4_shiftn(3, $@))])])
+
+
+
+# _m4_warn(MESSAGE)
+# -----------------
+# Report MESSAGE as a warning, unless the user requested -W error,
+# in which case report a fatal error.
+define([_m4_warn],
+[_m4_warning_error_ifelse([m4_fatal([$1])],
+                          [m4_warning([$1])])])
+
+
+# m4_warn(CATEGORY, MESSAGE)
+# --------------------------
+# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
+# is requested (in fact, not disabled).
+define([m4_warn],
+[m4_warning_ifelse([$1], [_m4_warn([$2])])])
+
+
+
 ## ------------------- ##
-## 3. File inclusion.  ##
+## 4. File inclusion.  ##
 ## ------------------- ##
 
 
@@ -151,7 +215,8 @@ define([m4_assert],
 # been included.
 define([m4_include_unique],
 [ifdef([m4_include($1)],
-       [m4_warn([file `$1' included several times])])dnl
+       [m4_warn([syntax],
+                [file `$1' included several times])])dnl
 define([m4_include($1)])])
 
 
@@ -177,7 +242,7 @@ undefine([sinclude])
 
 
 ## ------------------------------------ ##
-## 4. Additional branching constructs.  ##
+## 5. Additional branching constructs.  ##
 ## ------------------------------------ ##
 
 # Both `ifval' and `ifset' tests against the empty string.  The
@@ -279,7 +344,7 @@ define([m4_match],
 
 
 ## ---------------------------------------- ##
-## 5. Enhanced version of some primitives.  ##
+## 6. Enhanced version of some primitives.  ##
 ## ---------------------------------------- ##
 
 # m4_do(STRING, ...)
@@ -364,7 +429,7 @@ define([m4_noquote],
 
 
 ## -------------------------- ##
-## 6. Implementing m4 loops.  ##
+## 7. Implementing m4 loops.  ##
 ## -------------------------- ##
 
 
@@ -499,7 +564,7 @@ define([_m4_foreach],
 
 
 ## --------------------------- ##
-## 7. More diversion support.  ##
+## 8. More diversion support.  ##
 ## --------------------------- ##
 
 
@@ -545,7 +610,7 @@ m4_divert_pop()dnl
 
 
 ## -------------------- ##
-## 8. Text processing.  ##
+## 9. Text processing.  ##
 ## -------------------- ##
 
 # m4_tolower(STRING)
@@ -770,9 +835,9 @@ popdef([m4_Prefix])dnl
 
 
 
-## ---------------------- ##
-## 9. Number processing.  ##
-## ---------------------- ##
+## ----------------------- ##
+## 10. Number processing.  ##
+## ----------------------- ##
 
 # m4_sign(A)
 # ----------
@@ -818,7 +883,7 @@ define([m4_list_cmp],
 
 
 ## ------------------------ ##
-## 10. Version processing.  ##
+## 11. Version processing.  ##
 ## ------------------------ ##