#!/bin/sh
-autoreconf --symlink --install
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ (
+ rm -rf autom4te.cache
+ rm -f aclocal.m4 ltmain.sh config.cache
-if [ -z "$NOCONFIGURE" ]; then
- exec ./configure -C "$@"
-fi
+ autoreconf --symlink --install || exit 1
+ )
+)
+
+test -n "$NOCONFIGURE" || exec $srcdir/configure -C "$@"
+
+exit 0