]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Reduce forks while searching for better shell.
authorEric Blake <ebb9@byu.net>
Wed, 29 Oct 2008 03:31:12 +0000 (21:31 -0600)
committerEric Blake <ebb9@byu.net>
Wed, 29 Oct 2008 03:33:46 +0000 (21:33 -0600)
* 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 <ebb9@byu.net>
ChangeLog
lib/m4sugar/m4sh.m4

index 3d9d6fdee157b9a823a1767b39f5e05e590a7d21..c1272a3ba892bdaf8a5fce5ca3507ab669a562eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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.
index 7ba1adf0253498bfd3167d5b2319ef6724779d00..9463c61e7e418e6c01540a94a279075589e5bcb6 100644 (file)
@@ -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
 # <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])
@@ -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