[openib-general] [PATCH] opensm: autogen.sh: tools version verification fixes

Sasha Khapyorsky sashak at voltaire.com
Mon Oct 23 14:40:11 PDT 2006


This fixes couple of things related to tools version verifications in
autogen.sh. Originally autogen.sh was claiming that automake-1.10 is
older that automake-1.6.3 and was failing with zero exit status, so:

- regular expression fix - proper version string separation
- numeric camparison for extracted version elements
- non-zero exit status when old tools are detected
- slightly improved condition statements

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/autogen.sh |   47 +++++++++++++++++++++--------------------------
 1 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/osm/autogen.sh b/osm/autogen.sh
index 658d377..6570426 100755
--- a/osm/autogen.sh
+++ b/osm/autogen.sh
@@ -1,4 +1,4 @@
-#!/bin/bash 
+#!/bin/bash
 
 # We change dir since the later utilities assume to work in the project dir
 cd ${0%*/*}
@@ -7,49 +7,44 @@ # make sure autoconf is up-to-date
 ac_ver=`autoconf --version | head -n 1 | awk '{print $NF}'`
 ac_maj=`echo $ac_ver|sed 's/\..*//'`
 ac_min=`echo $ac_ver|sed 's/.*\.//'`
-if [[ $ac_maj < 2 ]]; then 
+if [[ $ac_maj -lt 2 ]]; then
     echo Min autoconf version is 2.57
-    exit
-fi
-if [[ $ac_maj = 2 && $ac_min < 57 ]]; then 
+    exit 1
+elif [[ $ac_maj -eq 2 && $ac_min -lt 57 ]]; then
     echo Min autoconf version is 2.57
-    exit
+    exit 1
 fi
 
 # make sure automake is up-to-date
 am_ver=`automake --version | head -n 1 | awk '{print $NF}'`
 am_maj=`echo $am_ver|sed 's/\..*//'`
-am_min=`echo $am_ver|sed 's/.*\.\([^\.]*\)\..*/\1/'`
-am_sub=`echo $am_ver|sed 's/.*\.//'`
-if [[ $am_maj < 1 ]]; then 
+am_min=`echo $am_ver|sed 's/[^\.]*\.\([^\.]*\)\.*.*/\1/'`
+am_sub=`echo $am_ver|sed 's/[^\.]*\.[^\.]*\.*//'`
+if [[ $am_maj -lt 1 ]]; then
     echo Min automake version is 1.6.3
-    exit
-fi
-if [[ $am_maj = 1 && $am_min < 6 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -lt 6 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.6.3"
-    exit
-fi
-if [[ $am_maj = 1 && $am_min = 6 && $am_sub < 3 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -eq 6 && $am_sub -lt 3 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.6.3"
-    exit
+    exit 1
 fi
 
 # make sure libtool is up-to-date
 lt_ver=`libtool --version | head -n 1 | awk '{print $4}'`
 lt_maj=`echo $lt_ver|sed 's/\..*//'`
-lt_min=`echo $lt_ver|sed 's/.*\.\([^\.]*\)\..*/\1/'`
-lt_sub=`echo $lt_ver|sed 's/.*\.//'`
-if [[ $lt_maj < 1 ]]; then 
+lt_min=`echo $lt_ver|sed 's/[^\.]*\.\([^\.]*\)\.*.*/\1/'`
+lt_sub=`echo $lt_ver|sed 's/[^\.]*\.[^\.]*\.*//'`
+if [[ $lt_maj -lt 1 ]]; then
     echo Min libtool version is 1.4.2
-    exit
-fi
-if [[ $lt_maj = 1 && $lt_min < 4 ]]; then 
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -lt 4 ]]; then
     echo "automake version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
-    exit
-fi
-if [[ $lt_maj = 1 && $lt_min = 4 && $lt_sub < 2 ]]; then 
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -eq 4 && $lt_sub -lt 2 ]]; then
     echo "automake version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
-    exit
+    exit 1
 fi
 
 # cleanup
-- 
1.4.3.g7768





More information about the general mailing list