2008-10-17 Eric Blake <ebb9@byu.net>
+ Improve suggested test filtering.
+ * lib/m4sugar/m4sh.m4 (_AS_DETECT_SUGGESTED_PRUNE): New macro,
+ extracted from...
+ (_AS_DETECT_BETTER_SHELL): ...here, to use faster API. No need to
+ check for an empty required set.
+
Add m4_set_map.
* lib/m4sugar/m4sugar.m4 (m4_set_foreach): New macro.
* tests/m4sugar.at (m4@&t@_set): Enhance test.
])])
+# _AS_DETECT_SUGGESTED_PRUNE(TEST)
+# --------------------------------
+# If TEST is also a required test, remove it from the set of suggested tests.
+m4_define([_AS_DETECT_SUGGESTED_PRUNE],
+[m4_set_contains([_AS_DETECT_REQUIRED_BODY], [$1],
+ [m4_set_remove([_AS_DETECT_SUGGESTED_BODY], [$1])])])
+
+
# _AS_DETECT_BETTER_SHELL
# -----------------------
# The real workhorse for detecting a shell with the correct
m4_defun([_AS_DETECT_BETTER_SHELL],
[if test "x$CONFIG_SHELL" = x; then
dnl Remove any tests from suggested that are also required
- m4_set_foreach([_AS_DETECT_SUGGESTED_BODY], [AS_snippet],
- [m4_set_contains([_AS_DETECT_REQUIRED_BODY],
- _m4_defn([AS_snippet]),
- [m4_set_remove([_AS_DETECT_SUGGESTED_BODY],
- _m4_defn([AS_snippet]))])])dnl
- m4_set_empty([_AS_DETECT_REQUIRED_BODY], [as_have_required=yes],
- [as_bourne_compatible="AS_ESCAPE(m4_expand([_AS_BOURNE_COMPATIBLE]))"
- as_required="AS_ESCAPE(m4_expand(m4_set_contents([_AS_DETECT_REQUIRED_BODY])))"
- as_suggested="AS_ESCAPE(m4_expand(m4_set_contents([_AS_DETECT_SUGGESTED_BODY])))"
- AS_IF([_AS_RUN(["$as_required"])],
- [as_have_required=yes],
- [as_have_required=no])])
+ m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])dnl
+ as_bourne_compatible="AS_ESCAPE(m4_expand([_AS_BOURNE_COMPATIBLE]))"
+ as_required="AS_ESCAPE(m4_expand(m4_set_contents([_AS_DETECT_REQUIRED_BODY])))"
+ as_suggested="AS_ESCAPE(m4_expand(m4_set_contents([_AS_DETECT_SUGGESTED_BODY])))"
+ AS_IF([_AS_RUN(["$as_required"])],
+ [as_have_required=yes],
+ [as_have_required=no])
AS_IF([test x$as_have_required = xyes && _AS_RUN(["$as_suggested"])],
[],
[as_candidate_shells=