#!/bin/sh
+# $Id$
-alocver=1.9
-aheadver=2.59
-amakever=1.9
-aconfver=2.59
+# autogen.sh
+# optional $1 = full path to svn working copy or "clean"
-if [ -x aclocal-$alocver ]
-then
- aclocal-$alocver
-else
- aclocal
-fi
+AUTOCONF=${AUTOCONF:-autoconf}
+AUTOMAKE=${AUTOMAKE:-automake}
+ACLOCAL=${ACLOCAL:-aclocal}
+AUTOHEADER=${AUTOHEADER:-autoheader}
+LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
-if [ -x autoheader-$aheadver ]
-then
- autoheader-$aheadver
-else
- autoheader
+if [ "$1" == "clean" ]; then
+ /bin/rm -f configure.ac
+ exit 0
fi
-if [ -x automake-$amakever ]
-then
- automake-$amakever -a
-else
- automake -a
-fi
+# substitute svn revision
+revision=`LC_ALL=C svn info $1 | awk '/^Revision: / {printf "%05d\n", $2}'`
+sed -e "s/@REVISION@/${revision}/g" \
+ < "configure.ac.in" > "configure.ac"
-if [ -x autoconf-$aconfver ]
-then
- autoconf-$aconfver
-else
- autoconf
-fi
+echo Running $ACLOCAL ... && $ACLOCAL
+echo Running $LIBTOOLIZE --force --copy ... && $LIBTOOLIZE --force --copy
+echo Running $AUTOHEADER ... && $AUTOHEADER
+echo Running $AUTOMAKE --add-missing --copy --gnu ... && $AUTOMAKE --add-missing --copy --gnu
+echo Running $AUTOCONF ... && $AUTOCONF