jbig2dec

Ralph Giles <[email protected]> Tue, 04 Mar 2003 07:25:01 -0800
Newsgroups gmane.comp.printing.ghostscript.jbig2dec.cvs
Message-ID <[email protected]>
Update of /cvsroot/jbig2dec/jbig2dec
In directory sc8-pr-cvs1:/tmp/cvs-serv11395

Modified Files:
	autogen.sh 
Log Message:
Try to make autogen.sh smarter about automake version mismatch.

This is really silly, but there's a serious problem with incompatibility 
between the various versions of automake, and while there is a mechanism 
for requesting a particular version in the Makefile.am, most 
installations don't make use of this information, and you're supposed to 
know which automake to call. Since this obviates the point of autogen, 
we attempt to match a requested version in AUTOMAKE_HEADERS to likely 
executables. Probably not very robust.


Index: autogen.sh
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/autogen.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- autogen.sh	8 Jul 2002 13:40:15 -0000	1.2
+++ autogen.sh	4 Mar 2003 15:24:58 -0000	1.3
@@ -19,10 +19,59 @@
 	exit 1
 }
 
+VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
+
+# do we need automake?
+if test -r Makefile.am; then
+  AM_NEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $VERSIONGREP`
+  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 "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
+      ($am --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$am --version < /dev/null | head -1 | $VERSIONGREP`
+      if test 0$ver = 0$AM_NEEDED; then
+        AUTOMAKE=$am
+        echo $AUTOMAKE
+        break
+      fi
+    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
+      ($ac --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$ac --version < /dev/null | head -1 | $VERSIONGREP`
+      if test 0$ver = $AM_NEEDED; then
+        ACLOCAL=$ac
+        echo $ACLOCAL
+        break
+      fi
+    done
+    test -z $ACLOCAL && echo "no"
+  fi
+  test -z $AUTOMAKE && {
+        echo
+        echo "You must have automake installed to compile $package."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+	exit 1
+  }
+fi  
+
+
 echo "Generating configuration files for $package, please wait...."
 
-echo "  aclocal $ACLOCAL_FLAGS"
-aclocal $ACLOCAL_FLAGS
+echo "  $ACLOCAL $ACLOCAL_FLAGS"
+$ACLOCAL $ACLOCAL_FLAGS
 
 echo "  autoheader"
 autoheader
@@ -50,8 +99,8 @@
 #endif /* HAVE_STDINT_H */
 EOF
     
-echo "  automake --add-missing $AUTOMAKE_FLAGS"
-automake --add-missing $AUTOMAKE_FLAGS 
+echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
+$AUTOMAKE --add-missing $AUTOMAKE_FLAGS 
 echo "  running autoconf"
 
 autoconf