autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] trim down the size of the better-shell test


From: Paolo Bonzini
Subject: [PATCH] trim down the size of the better-shell test
Date: Tue, 14 Oct 2008 11:16:47 +0200

I decided that the size of the prolog was too much...  It's better to
use variables for the common parts of the better-shell tests.  I also
moved the 2>/dev/null into _AS_RUN, since we always do it.  This saves
~70 lines in the prolog.

Ok?

Paolo

2008-10-14  Paolo Bonzini  <address@hidden>

        * lib/m4sugar/m4sh.at (_AT_DETECT_BETTER_SHELL): Store the common
        snippets into shell variables.
        (_AS_RUN): Rewrite.
---
 lib/m4sugar/m4sh.m4 |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index dec9f37..1552281 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -196,11 +196,13 @@ dnl Remove any tests from suggested that are also required
                                  [m4_set_remove([_AS_DETECT_SUGGESTED_BODY],
                                                 _m4_defn([AS_snippet]))])])dnl
   m4_set_empty([_AS_DETECT_REQUIRED_BODY], [as_have_required=yes],
-    [AS_IF([_AS_RUN(m4_set_contents([_AS_DETECT_REQUIRED_BODY])) 2>/dev/null],
+    [as_bourne_compatible="AS_ESCAPE(m4_quote(_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 $as_have_required = yes &&dnl
-        _AS_RUN(m4_set_contents([_AS_DETECT_SUGGESTED_BODY])) 2> /dev/null],
+  AS_IF([test $as_have_required = yes && _AS_RUN(["$as_suggested"])],
     [],
     [as_candidate_shells=
     _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
@@ -214,14 +216,11 @@ dnl Remove any tests from suggested that are also required
       for as_shell in $as_candidate_shells $SHELL; do
         # Try only shells that exist, to save several forks.
         AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-               _AS_RUN(m4_set_contents([_AS_DETECT_REQUIRED_BODY]),
-                       [("$as_shell") 2> /dev/null])],
+               _AS_RUN(["$as_required"], ["$as_shell"])],
               [CONFIG_SHELL=$as_shell
               as_have_required=yes
               m4_set_empty([_AS_DETECT_SUGGESTED_BODY], [break],
-                [AS_IF([_AS_RUN(m4_set_contents([_AS_DETECT_SUGGESTED_BODY]),
-                                ["$as_shell" 2> /dev/null])],
-                       [break])])])
+                [AS_IF([_AS_RUN(["$as_suggested"], ["$as_shell"])], 
[break])])])
       done
 
       AS_IF([test "x$CONFIG_SHELL" != x],
@@ -362,13 +361,8 @@ $2
 # Run TEST under the current shell (if one parameter is used)
 # or under the given SHELL, protecting it from syntax errors.
 m4_define([_AS_RUN],
-[m4_ifval([$2],
-[{ $2 <<\_ASEOF
-_AS_BOURNE_COMPATIBLE
-$1
-_ASEOF
-}],
-[(eval "AS_ESCAPE(m4_expand([$1]))")])])
+[m4_ifval([$2], [(echo "$as_bourne_compatible"$1 | $2)],
+               [(eval $1)]) 2>/dev/null])
 
 
 # _AS_SHELL_FN_WORK
-- 
1.5.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]