From: Eric Blake Date: Wed, 29 Oct 2008 03:31:12 +0000 (-0600) Subject: Reduce forks while searching for better shell. X-Git-Tag: v2.63b~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63ec266226a0ceb591bd84bc1cef152cdb20a513;p=thirdparty%2Fautoconf.git 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. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 3d9d6fdee..c1272a3ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-10-28 Eric Blake + 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. diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 7ba1adf02..9463c61e7 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -158,9 +158,7 @@ $1], [^], [@%:@ ])])]) # 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) @@ -168,9 +166,7 @@ m4_defun([_AS_DETECT_REQUIRED], # 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) @@ -195,13 +191,17 @@ m4_define([_AS_DETECT_SUGGESTED_PRUNE], # FIXME: The code should test for the OSF bug described in # . # +# 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]) @@ -243,7 +243,7 @@ dnl Remove any tests from suggested that are also required 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