summaryrefslogtreecommitdiff
path: root/lib/m4sugar/m4sugar.m4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/m4sugar/m4sugar.m4')
-rw-r--r--lib/m4sugar/m4sugar.m421
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 6a191345..b42fc1a6 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -2412,6 +2412,27 @@ m4_define([m4_normalize],
[m4_strip(m4_flatten([$1]))])
+# m4_validate_w(STRING)
+# ---------------------
+# Expands into m4_normalize(m4_expand([STRING])), but if that is not
+# the same as just m4_normalize([STRING]), issue a warning.
+#
+# This is used in several Autoconf macros that take a
+# whitespace-separated list of symbols as an argument. Ideally that
+# list would not be expanded before use, but several packages used
+# `dnl' to put comments inside those lists, so they must be expanded
+# for compatibility's sake.
+m4_define([m4_validate_w],
+[_m4_validate_w(m4_normalize([$1]), m4_normalize(m4_expand([$1])))])
+
+m4_define([_m4_validate_w],
+[m4_if([$1], [$2], [],
+ [m4_warn([obsolete], [whitespace-separated list contains macros;
+in a future version of Autoconf they will not be expanded]dnl
+m4_if(m4_bregexp([$1], [\bdn[l]\b]), -1, [], [
+note: `dn@&t@l' is a macro]))])dnl
+[$2]])
+
# m4_join(SEP, ARG1, ARG2...)
# ---------------------------