#! /bin/sh

if test ! -f configure.ac ; then
  echo "*** Please invoke this script from directory containing configure.ac."
  exit 1
fi

MACROFILE=aclocal.m4
MACRODIR=mk/autoconf

rm -f $MACROFILE
for i in $MACRODIR/*.m4 ; do
  cat $i >> $MACROFILE
done

/usr/local/bin/autoheader-2.61
rc=$?

if test $rc -eq 0; then
  /usr/local/bin/autoconf-2.61
  rc=$?
fi

rm -f $MACROFILE
if test $rc -eq 0; then
  echo "Now please run ./configure"
  else
  echo "Autogen failed"
fi
exit $rc
