[openib-general] [PATCH] ibutils: autogen.sh(s) fixes

Sasha Khapyorsky sashak at voltaire.com
Mon Dec 18 13:18:14 PST 2006


Couple of fixes around of tools version detections and verifications
(similar to r9976):
- regular expression fix - proper version string separation
- numeric comparison for extracted version elements
- non-zero exit status when old tools are detected
- slightly improved condition statements

Originally autogen.sh was claiming that automake-1.10 is older that
automake-1.9.2

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 autogen.sh          |   57 +++++++++++++++++++++--------------------------
 ibdiag/autogen.sh   |   61 +++++++++++++++++++++++---------------------------
 ibdm/autogen.sh     |   61 +++++++++++++++++++++++---------------------------
 ibis/autogen.sh     |   55 +++++++++++++++++++++-------------------------
 ibmgtsim/autogen.sh |   55 +++++++++++++++++++++-------------------------
 5 files changed, 132 insertions(+), 157 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 30727a8..3a560b5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,53 +1,48 @@
-#!/bin/bash 
+#!/bin/bash
 cd ${0%*/*}
 
 # make sure autoconf is up-to-date
-ac_ver=`autoconf --version | head -1 | awk '{print $NF}'`
+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.59
-    exit
-fi
-if [[ $ac_maj = 2 && $ac_min < 59 ]]; then 
+    exit 1
+elif [[ $ac_maj -eq 2 && $ac_min -lt 59 ]]; then
     echo Min autoconf version is 2.59
-    exit
+    exit 1
 fi
 
 # make sure automake is up-to-date
-am_ver=`automake --version | head -1 | awk '{print $NF}'`
+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.9.2
-    exit
-fi
-if [[ $am_maj = 1 && $am_min < 9 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -lt 9 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
-fi
-if [[ $am_maj = 1 && $am_min = 9 && $am_sub < 2 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -eq 9 && $am_sub -lt 2 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
+    exit 1
 fi
 
 # make sure libtool is up-to-date
-lt_ver=`libtool --version | head -1 | awk '{print $4}'`
+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 
-    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 
-    echo "automake version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
-    exit
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -lt 4 ]]; then
+    echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -eq 4 && $lt_sub -lt 2 ]]; then
+    echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
+    exit 1
 fi
 
 # cleanup
diff --git a/ibdiag/autogen.sh b/ibdiag/autogen.sh
index 60732a8..0ce2866 100755
--- a/ibdiag/autogen.sh
+++ b/ibdiag/autogen.sh
@@ -1,57 +1,52 @@
-#!/bin/bash 
+#!/bin/bash
 
 # We change dir since the later utilities assume to work in the project dir
 cd ${0%*/*}
 # remove previous
-\rm -rf autom4te.cache 
+\rm -rf autom4te.cache
 \rm -rf aclocal.m4
 # make sure autoconf is up-to-date
-ac_ver=`autoconf --version | head -1 | awk '{print $NF}'`
+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.59
-    exit
-fi
-if [[ $ac_maj = 2 && $ac_min < 59 ]]; then 
+    exit 1
+elif [[ $ac_maj -eq 2 && $ac_min -lt 59 ]]; then
     echo Min autoconf version is 2.59
-    exit
+    exit 1
 fi
 # make sure automake is up-to-date
-am_ver=`automake --version | head -1 | awk '{print $NF}'`
+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.9.2
-    exit
-fi
-if [[ $am_maj = 1 && $am_min < 9 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -lt 9 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
-fi
-if [[ $am_maj = 1 && $am_min = 9 && $am_sub < 2 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -eq 9 && $am_sub -lt 2 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
+    exit 1
 fi
 # make sure libtool is up-to-date
-lt_ver=`libtool --version | head -1 | awk '{print $4}'`
+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
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -lt 4 ]]; then
+    echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -eq 4 && $lt_sub -lt 2 ]]; then
+    echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
+    exit 1
 fi
-if [[ $lt_maj = 1 && $lt_min < 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 
-    echo "automake version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
-    exit
-fi
-    
+
 aclocal -I config 2>&1 | grep -v "warning: underquoted definition "
 libtoolize --automake
 automake --add-missing --gnu
diff --git a/ibdm/autogen.sh b/ibdm/autogen.sh
index d8f08d8..51163c9 100755
--- a/ibdm/autogen.sh
+++ b/ibdm/autogen.sh
@@ -1,57 +1,52 @@
-#!/bin/bash 
+#!/bin/bash
 
 # We change dir since the later utilities assume to work in the project dir
 cd ${0%*/*}
 # remove previous
-\rm -rf autom4te.cache 
+\rm -rf autom4te.cache
 \rm -rf aclocal.m4
 # make sure autoconf is up-to-date
-ac_ver=`autoconf --version | head -1 | awk '{print $NF}'`
+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.59
-    exit
-fi
-if [[ $ac_maj = 2 && $ac_min < 59 ]]; then 
+    exit 1
+elif [[ $ac_maj -eq 2 && $ac_min -lt 59 ]]; then
     echo Min autoconf version is 2.59
-    exit
+    exit 1
 fi
 # make sure automake is up-to-date
-am_ver=`automake --version | head -1 | awk '{print $NF}'`
+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.9.2
-    exit
-fi
-if [[ $am_maj = 1 && $am_min < 9 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -lt 9 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
-fi
-if [[ $am_maj = 1 && $am_min = 9 && $am_sub < 2 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -eq 9 && $am_sub -lt 2 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
+    exit 1
 fi
 # make sure libtool is up-to-date
-lt_ver=`libtool --version | head -1 | awk '{print $4}'`
+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
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -lt 4 ]]; then
+    echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
+    exit 1
+elif [[ $lt_maj -eq 1 && $lt_min -eq 4 && $lt_sub -lt 2 ]]; then
+    echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
+    exit 1
 fi
-if [[ $lt_maj = 1 && $lt_min < 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 
-    echo "automake version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2"
-    exit
-fi
-    
+
 aclocal -I config 2>&1 | grep -v "warning: underquoted definition "
 libtoolize --automake --copy
 automake --add-missing --gnu --copy
diff --git a/ibis/autogen.sh b/ibis/autogen.sh
index f3ed611..ae545b5 100755
--- a/ibis/autogen.sh
+++ b/ibis/autogen.sh
@@ -1,57 +1,52 @@
-#!/bin/sh 
+#!/bin/sh
 
 cd ${0%*/*}
 \rm -rf autom4te.cache
 \rm -rf aclocal.m4
 \rm -f config/missing config/install-sh config/depcomp config/mkinstalldirs config/ltmain.sh config/config.sub config/config.guess
 # make sure autoconf is up-to-date
-ac_ver=`autoconf --version | head -1 | awk '{print $NF}'`
+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 "autoconf version is too old:$ac_maj.$ac_min < required 2.59"
-    exit
-fi
-if [[ $ac_maj = 2 && $ac_min < 59 ]]; then 
+    exit 1
+elif [[ $ac_maj -eq 2 && $ac_min -lt 59 ]]; then
     echo "autoconf version is too old:$ac_maj.$ac_min < required 2.59"
-    exit
+    exit 1
 fi
 # make sure automake is up-to-date
-am_ver=`automake --version | head -1 | awk '{print $NF}'`
+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.9.2
-    exit
-fi
-if [[ $am_maj = 1 && $am_min < 9 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -lt 9 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
-fi
-if [[ $am_maj = 1 && $am_min = 9 && $am_sub < 2 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -eq 9 && $am_sub -lt 2 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
+    exit 1
 fi
 # make sure libtool is up-to-date
-lt_ver=`libtool --version | head -1 | awk '{print $4}'`
+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
 
 aclocal -I config 2>&1 |  grep -v "arning: underquoted definition of"
-libtoolize --automake --copy 
+libtoolize --automake --copy
 automake --add-missing --gnu --copy --force
 autoconf
diff --git a/ibmgtsim/autogen.sh b/ibmgtsim/autogen.sh
index 456c203..e48b0ac 100755
--- a/ibmgtsim/autogen.sh
+++ b/ibmgtsim/autogen.sh
@@ -1,57 +1,52 @@
-#!/bin/sh 
+#!/bin/sh
 
 cd ${0%*/*}
 \rm -rf autom4te.cache
 \rm -rf aclocal.m4
 \rm -f config/missing config/install-sh config/depcomp config/mkinstalldirs config/ltmain.sh config/config.sub config/config.guess
 # make sure autoconf is up-to-date
-ac_ver=`autoconf --version | head -1 | awk '{print $NF}'`
+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 "autoconf version is too old:$ac_maj.$ac_min < required 2.59"
-    exit
-fi
-if [[ $ac_maj = 2 && $ac_min < 59 ]]; then 
+    exit 1
+elif [[ $ac_maj -eq 2 && $ac_min -lt 59 ]]; then
     echo "autoconf version is too old:$ac_maj.$ac_min < required 2.59"
-    exit
+    exit 1
 fi
 # make sure automake is up-to-date
-am_ver=`automake --version | head -1 | awk '{print $NF}'`
+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.9.2
-    exit
-fi
-if [[ $am_maj = 1 && $am_min < 9 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -lt 9 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
-fi
-if [[ $am_maj = 1 && $am_min = 9 && $am_sub < 2 ]]; then 
+    exit 1
+elif [[ $am_maj -eq 1 && $am_min -eq 9 && $am_sub -lt 2 ]]; then
     echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.9.2"
-    exit
+    exit 1
 fi
 # make sure libtool is up-to-date
-lt_ver=`libtool --version | head -1 | awk '{print $4}'`
+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
 
 aclocal -I config 2>&1 | grep -v "warning: underquoted definition "
-libtoolize --automake --copy --force 
+libtoolize --automake --copy --force
 automake --add-missing --copy --gnu --force
 autoconf
-- 
1.4.4.2.gfc82d





More information about the general mailing list