#! /bin/sh
# $Id$

set -x

rm -rf admin
mkdir admin

if glibtoolize --version >/dev/null; then
    LIBTOOLIZE=glibtoolize
elif libtoolize --version >/dev/null; then
    LIBTOOLIZE=libtoolize
else
   echo "ERROR: I cannot find libtoolize or glibtoolize!"
   exit 1
fi

ACLOCALDIR=
if [ -e /usr/local/share/aclocal ] ; then
   ACLOCALDIR=/usr/local/share/aclocal
elif [ -e /usr/share/aclocal ] ; then
   ACLOCALDIR=/usr/share/aclocal
else
   echo >&2 "ERROR: No aclocal directory found!"
   exit 1
fi

ACLOCAL=${ACLOCAL:-aclocal}
AUTOHEADER=${AUTOHEADER:-autoheader}
AUTOMAKE=${AUTOMAKE:-automake}
AUTOCONF=${AUTOCONF:-autoconf}

"$LIBTOOLIZE" --force
"$ACLOCAL" -I "$ACLOCALDIR"
"$AUTOHEADER"
"$AUTOMAKE" --gnu --add-missing --copy
"$AUTOCONF"
