Code

fix 1630193
[inkscape.git] / autogen.sh
index 9342738d6cc55b3ae604761a4dc7ca86101faa6d..b37c09b526d04fa5719848b6a08c0c1e437c8d6d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh 
+#!/bin/bash 
 
 # This script does all the magic calls to automake/autoconf and
 # friends that are needed to configure a cvs checkout.  As described in
@@ -19,16 +19,22 @@ AUTOMAKE_REQUIRED_VERSION=1.7
 GLIB_REQUIRED_VERSION=2.0.0
 INTLTOOL_REQUIRED_VERSION=0.17
 
-srcdir=`dirname $0`
+srcdir=`dirname "$0"`
 test -z "$srcdir" && srcdir=.
 ORIGDIR=`pwd`
-cd $srcdir
+cd "$srcdir"
 
-${srcdir}/tools-version.sh
+./tools-version.sh
 
 check_version ()
 {
-    if expr $1 \>= $2 > /dev/null; then
+MAJOR1=`echo "$1" | cut -d"." -f1`;
+MINOR1=`echo "$1" | cut -s -d"." -f2`;
+MAJOR2=`echo "$2" | cut -d"." -f1`;
+MINOR2=`echo "$2" | cut -d"." -f2;`
+test -z "$MINOR1" && MINOR1="0";
+
+if (("$MAJOR1" > "$MAJOR2"))||(((("$MAJOR1" == "$MAJOR2")) && (("$MINOR1" \>= "$MINOR2")))); then
         echo "yes (version $1)"
     else
         echo "Too old (found version $1)!"
@@ -58,7 +64,7 @@ attempt_command () {
 }
 
 echo
-echo "I am testing that you have the required versions of libtool, autoconf," 
+echo "I am testing that you have the required versions of autoconf," 
 echo "automake, glib-gettextize and intltoolize. This test is not foolproof and"
 echo "if anything goes wrong, there may be guidance in the file HACKING.txt"
 echo
@@ -68,8 +74,8 @@ DIE=0
 echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
 if (autoconf --version) < /dev/null > /dev/null 2>&1; then
     VER=`autoconf --version \
-         | grep -iw autoconf | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
-    check_version $VER $AUTOCONF_REQUIRED_VERSION
+         | grep -iw autoconf | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'`
+    check_version "$VER" "$AUTOCONF_REQUIRED_VERSION"
 else
     echo
     echo "  You must have autoconf installed to compile $PROJECT."
@@ -102,8 +108,8 @@ else
 fi
 if test x$AUTOMAKE != x; then
     VER=`$AUTOMAKE --version \
-         | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
-    check_version $VER $AUTOMAKE_REQUIRED_VERSION
+         | grep automake | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'`
+    check_version "$VER" "$AUTOMAKE_REQUIRED_VERSION"
 
     # Exclude automake 1.9.[0-6]
     if expr $VER \>= 1.9.0 >/dev/null && expr $VER \<= 1.9.6 >/dev/null ; then
@@ -118,8 +124,8 @@ fi
 echo -n "checking for glib-gettextize >= $GLIB_REQUIRED_VERSION ... "
 if (glib-gettextize --version) < /dev/null > /dev/null 2>&1; then
     VER=`glib-gettextize --version \
-         | grep glib-gettextize | sed "s/.* \([0-9.]*\)/\1/"`
-    check_version $VER $GLIB_REQUIRED_VERSION
+         | grep glib-gettextize | sed -n 's/.* \([0-9.]*\)/\1/p'`
+    check_version "$VER" "$GLIB_REQUIRED_VERSION"
 else
     echo
     echo "  You must have glib-gettextize installed to compile $PROJECT."
@@ -131,8 +137,8 @@ fi
 echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
 if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
     VER=`intltoolize --version \
-         | grep intltoolize | sed "s/.* \([0-9.]*\)/\1/"`
-    check_version $VER $INTLTOOL_REQUIRED_VERSION
+         | grep intltoolize | sed -n 's/.* \([0-9.]*\)/\1/p'`
+    check_version "$VER" "$INTLTOOL_REQUIRED_VERSION"
 else
     echo
     echo "  You must have intltool installed to compile $PROJECT."
@@ -187,7 +193,6 @@ attempt_command 'underquoted definition of|[\)\#]Extending' \
        attempt_command '' autoheader
 }
 
-attempt_command '' libtoolize --copy --force
 attempt_command '' $AUTOMAKE --add-missing
 attempt_command '' autoconf
 attempt_command '^(Please add the files|  codeset|  progtest|from the|or directly|You will also|ftp://ftp.gnu.org|$)' \
@@ -196,5 +201,3 @@ attempt_command '' intltoolize --copy --force --automake
 
 echo ""
 echo "Done!  Please run './configure' now."
-
-cd $ORIGDIR