* 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-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
[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)
# 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]))])
_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
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
## --------------------------------- ##
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
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
## --------------------------------- ##
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
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
## --------------------------------- ##
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
[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)
# 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]))])
_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
])])
-# 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]))])
[])])
+## ------------- ##
+## 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. ##
## ------------------- ##
# 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)])])
## ------------------------------------ ##
-## 4. Additional branching constructs. ##
+## 5. Additional branching constructs. ##
## ------------------------------------ ##
# Both `ifval' and `ifset' tests against the empty string. The
## ---------------------------------------- ##
-## 5. Enhanced version of some primitives. ##
+## 6. Enhanced version of some primitives. ##
## ---------------------------------------- ##
# m4_do(STRING, ...)
## -------------------------- ##
-## 6. Implementing m4 loops. ##
+## 7. Implementing m4 loops. ##
## -------------------------- ##
## --------------------------- ##
-## 7. More diversion support. ##
+## 8. More diversion support. ##
## --------------------------- ##
## -------------------- ##
-## 8. Text processing. ##
+## 9. Text processing. ##
## -------------------- ##
# m4_tolower(STRING)
-## ---------------------- ##
-## 9. Number processing. ##
-## ---------------------- ##
+## ----------------------- ##
+## 10. Number processing. ##
+## ----------------------- ##
# m4_sign(A)
# ----------
## ------------------------ ##
-## 10. Version processing. ##
+## 11. Version processing. ##
## ------------------------ ##
])])
-# 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]))])
[])])
+## ------------- ##
+## 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. ##
## ------------------- ##
# 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)])])
## ------------------------------------ ##
-## 4. Additional branching constructs. ##
+## 5. Additional branching constructs. ##
## ------------------------------------ ##
# Both `ifval' and `ifset' tests against the empty string. The
## ---------------------------------------- ##
-## 5. Enhanced version of some primitives. ##
+## 6. Enhanced version of some primitives. ##
## ---------------------------------------- ##
# m4_do(STRING, ...)
## -------------------------- ##
-## 6. Implementing m4 loops. ##
+## 7. Implementing m4 loops. ##
## -------------------------- ##
## --------------------------- ##
-## 7. More diversion support. ##
+## 8. More diversion support. ##
## --------------------------- ##
## -------------------- ##
-## 8. Text processing. ##
+## 9. Text processing. ##
## -------------------- ##
# m4_tolower(STRING)
-## ---------------------- ##
-## 9. Number processing. ##
-## ---------------------- ##
+## ----------------------- ##
+## 10. Number processing. ##
+## ----------------------- ##
# m4_sign(A)
# ----------
## ------------------------ ##
-## 10. Version processing. ##
+## 11. Version processing. ##
## ------------------------ ##