Re: FYI: [PATCH] libtool: make fork minimisation compatible with dash and zsh.

2011-12-19 Thread Eric Blake
On 12/18/2011 06:49 AM, Gary V. Vaughan wrote:
 * build-aub/general.m4sh (lt_HAVE_PLUSEQ_OP): Instead of using
 $((..)) arithmetic, which causes an error on dash, use a case
 based bash version check.

Dash understands $(( )).  What it doesn't understand is ${BASH_VERSINFO[0]}.

Solaris /bin/sh understands neither, though, so fixing this is
definitely necessary.

 +if test set = ${BASH_VERSION+set}${ZSH_VERSION}; then
  : ${lt_HAVE_ARITH_OP=yes}
  : ${lt_HAVE_XSI_OPS=yes}

If you wanted, you could combine those two into a single statement:

: ${lt_HAVE_ARITH_OP=yes} ${lt_HAVE_XSI_OPS=yes}

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


FYI: [PATCH] libtool: make fork minimisation compatible with dash and zsh.

2011-12-18 Thread Gary V. Vaughan
* build-aub/general.m4sh (lt_HAVE_PLUSEQ_OP): Instead of using
$((..)) arithmetic, which causes an error on dash, use a case
based bash version check.
(lt_HAVE_ARITH_OP, lt_HAVE_XSI_OPS): Also short circuit the
feature probing forks and set these automatically when zsh is
detected.
Reported by Stefano Lattarini.

Signed-off-by: Gary V. Vaughan g...@gnu.org
---
 build-aux/general.m4sh |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/build-aux/general.m4sh b/build-aux/general.m4sh
index e96c0e4..3cfecee 100644
--- a/build-aux/general.m4sh
+++ b/build-aux/general.m4sh
@@ -75,14 +75,16 @@ basename='s|^.*/||'
 
 
 # We should try to minimise forks, especially on Windows where they are
-# unreasonably slow, so skip the feature probes when bash is being used:
-if test set = ${BASH_VERSION+set}; then
+# unreasonably slow, so skip the feature probes when bash or zsh are
+# being used:
+if test set = ${BASH_VERSION+set}${ZSH_VERSION}; then
 : ${lt_HAVE_ARITH_OP=yes}
 : ${lt_HAVE_XSI_OPS=yes}
 # The += operator was introduced in bash 3.1
-test -z $lt_HAVE_PLUSEQ_OP \
-   test 3000 -lt $((${BASH_VERSINFO[0]}*1000 + ${BASH_VERSINFO[1]})) \
-   lt_HAVE_PLUSEQ_OP=yes
+case $BASH_VERSION in
+  [12].* | 3.0 | 3.0.*) ;;
+  *)lt_HAVE_PLUSEQ_OP=yes ;;
+esac
 fi
 
 
-- 
1.7.8

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)