autoconf-patches
[Top][All Lists]
Advanced

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

Fix exit status of expr version of as_func_arith.


From: Ralf Wildenhues
Subject: Fix exit status of expr version of as_func_arith.
Date: Sun, 16 Nov 2008 20:53:57 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

OK?  Posix rules are: zero exit status for nonzero result, 1 for zero
result, other for other errors (such as invalid input).  The Autoconf
manual lists that QNX expr may exit 1 instead of 0.  Other pitfalls
we may have overlooked?

Thanks,
Ralf

    Fix exit status of expr version of as_func_arith.
    
    * lib/m4sugar/m4sh.m4 (_AS_VAR_ARITH_PREPARE): Count an exit
    status of 1 of expr also as success, to avoid failure of the
    computation result is zero.  Fixes test failures with IRIX sh,
    where the expr variant of as_func_arith is used.

diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index f106e2d..56697ad 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1743,6 +1743,7 @@ 
AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_ARITH_WORKS))"])],
 [as_func_arith ()
   {
     as_val=`expr "$[]@"`
+    case $? in 0|1) :;; *) false;; esac
   }]) # as_func_arith
 ])
 




reply via email to

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