#!/bin/sh
# Run this to generate all the initial makefiles, etc.

aclocal_flags=
autoheader_flags=
automake_flags="--gnu --add-missing"
autoconf_flags=
DIE=0

(autoconf --version) < /dev/null > /dev/null 2>&1 || {
  echo
  echo "**Error**: You must have \`autoconf' installed to."
  echo "Download the appropriate package for your distribution,"
  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/"
  DIE=1
}

(automake --version) < /dev/null > /dev/null 2>&1 || {
  echo
  echo "**Error**: You must have \`automake' installed."
  echo "Download the appropriate package for your distribution,"
  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
  DIE=1
  NO_AUTOMAKE=yes
}


# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
  echo
  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
  echo "installed doesn't appear recent enough."
  echo "Download the appropriate package for your distribution,"
  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
  DIE=1
}

if test "$DIE" -eq 1; then
  exit 1
fi

echo "Running aclocal $aclocal_flags..."
aclocal $aclocal_flags
echo "Running autoheader $autoheader_flags..."
autoheader $autoheader_flags
echo "Running automake $automake_flags..."
automake $automake_flags
echo "Running autoconf $autoconf_flags..."
autoconf $autoconf_flags

