2008-10-28 Eric Blake <ebb9@byu.net>
+ Reduce forks while searching for better shell.
+ * lib/m4sugar/m4sh.m4 (_AS_DETECT_REQUIRED)
+ (_AS_DETECT_SUGGESTED): No need to provide extra subshell; _AS_RUN
+ already does the job.
+ (_AS_DETECT_BETTER_SHELL): Simplify AS_EXIT when not run in a trap
+ 0 context.
+
Undo needless efforts to protect $2 in $2_t.
* lib/autoconf/types.m4 (_AC_TYPE_INT_BODY)
(_AC_TYPE_UNSIGNED_INT_BODY): Reduce extra quoting.
# Refuse to execute under a shell that does not pass the given TEST.
# Does not do AS_REQUIRE for the better-shell detection code.
m4_defun([_AS_DETECT_REQUIRED],
-[m4_set_add([_AS_DETECT_REQUIRED_BODY],
- [($1) || AS_EXIT(1)
-])])
+[m4_set_add([_AS_DETECT_REQUIRED_BODY], [$1 || AS_EXIT])])
# _AS_DETECT_SUGGESTED(TEST)
# Prefer to execute under a shell that passes the given TEST.
# Does not do AS_REQUIRE for the better-shell detection code.
m4_defun([_AS_DETECT_SUGGESTED],
-[m4_set_add([_AS_DETECT_SUGGESTED_BODY],
- [($1) || AS_EXIT(1)
-])])
+[m4_set_add([_AS_DETECT_SUGGESTED_BODY], [$1 || AS_EXIT])])
# _AS_DETECT_SUGGESTED_PRUNE(TEST)
# FIXME: The code should test for the OSF bug described in
# <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
#
+# This code is run outside any trap 0 context, hence we can simplify AS_EXIT.
m4_defun([_AS_DETECT_BETTER_SHELL],
dnl Remove any tests from suggested that are also required
[m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])]dnl
+[m4_pushdef([AS_EXIT], [exit m4_default([$1], 1)])]dnl
[if test "x$CONFIG_SHELL" = x; then
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_required="AS_ESCAPE(m4_expand(m4_set_contents([_AS_DETECT_REQUIRED_BODY],
+ m4_newline)))"
+ as_suggested="AS_ESCAPE(m4_expand(m4_set_contents([_AS_DETECT_SUGGESTED_BODY],
+ m4_newline)))"
AS_IF([_AS_RUN(["$as_required"])],
[as_have_required=yes],
[as_have_required=no])
echo shell if you do have one.
AS_EXIT(1)])])
fi
-])# _AS_DETECT_BETTER_SHELL
+_m4_popdef([AS_EXIT])])# _AS_DETECT_BETTER_SHELL
# _AS_PREPARE