shithub: jbig2

Download patch

ref: 639e20afb817afd493b3802643f3dcf363962fce
parent: 6f92ef3754dff5fdf82a809662476c330b25e20c
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Thu Oct 25 18:13:23 EDT 2007

Update autogen.sh to detect automake 1.10 and later.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@456 ded80894-8fb9-0310-811b-c03f3676ab4d

--- a/autogen.sh
+++ b/autogen.sh
@@ -20,29 +20,38 @@
 	exit 1
 }
 
-VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
-VERSIONMKINT="sed -e s/[^0-9]//"
+VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
+VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
+VERSIONMKMIN="sed -e s/.*[0-9][0-9]*\.//"
 
 # do we need automake?
 if test -r Makefile.am; then
-  AM_NEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $VERSIONGREP`
-  if test -z $AM_NEEDED; then
+  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
+  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
+  if test "x$AM_NEEDED" = "x$AM_OPTIONS"; then
+    AM_NEEDED=""
+  fi
+  if test -z "$AM_NEEDED"; then
     echo -n "checking for automake... "
     AUTOMAKE=automake
     ACLOCAL=aclocal
     if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
+      echo "yes"
+    else
       echo "no"
       AUTOMAKE=
-    else
-      echo "yes"
     fi
   else
     echo -n "checking for automake $AM_NEEDED or later... "
-    for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
-      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
+    majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
+    minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
+    for am in automake-$AM_NEEDED automake$AM_NEEDED automake \
+	automake-1.7 automake-1.8 automake-1.9 automake-1.10; do
       ($am --version < /dev/null > /dev/null 2>&1) || continue
-      ver=`$am --version < /dev/null | head -1 | $VERSIONGREP | $VERSIONMKINT`
-      if test $ver -ge $verneeded; then
+      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP`
+      maj=`echo $ver | $VERSIONMKMAJ`
+      min=`echo $ver | $VERSIONMKMIN`
+      if test $maj -eq $majneeded -a $min -ge $minneeded; then
         AUTOMAKE=$am
         echo $AUTOMAKE
         break
@@ -50,11 +59,13 @@
     done
     test -z $AUTOMAKE &&  echo "no"
     echo -n "checking for aclocal $AM_NEEDED or later... "
-    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
-      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
+    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal\
+	aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
       ($ac --version < /dev/null > /dev/null 2>&1) || continue
-      ver=`$ac --version < /dev/null | head -1 | $VERSIONGREP | $VERSIONMKINT`
-      if test $ver -ge $verneeded; then
+      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP`
+      maj=`echo $ver | $VERSIONMKMAJ`
+      min=`echo $ver | $VERSIONMKMIN`
+      if test $maj -eq $majneeded -a $min -ge $minneeded; then
         ACLOCAL=$ac
         echo $ACLOCAL
         break