# $Id$
# autogen.sh
-# optional $1 = full path to svn working copy or "clean"
+#
+# optional $1 = optional directory containing build tree or svn working copy
export AUTOCONF=${AUTOCONF:-autoconf}
export AUTOMAKE=${AUTOMAKE:-automake}
export AUTOHEADER=${AUTOHEADER:-autoheader}
export LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
-if [ "$1" = "clean" ]; then
- /bin/rm -f configure.ac
- exit 0
-fi
+# identify svn revision, if an svn working copy
+if test "$1" != "" && test -d "$1/.svn"; then
+ revision=`LC_ALL=C svn info $1 | awk '/^Revision: / {printf "%05d\n", $2}'`;
+elif test -d ".svn"; then
+ revision=`LC_ALL=C svn info | awk '/^Revision: / {printf "%05d\n", $2}'`;
+else
+ revision="NONE"; 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"
+# generate configure.ac with substituted svn revision
+sed -e "s/@REVISION@/${revision}/g" < "configure.ac.in" > "configure.ac"
echo Running $ACLOCAL -I m4 ... && $ACLOCAL -I m4
echo Running $LIBTOOLIZE --force --copy ... && $LIBTOOLIZE --force --copy