#!/bin/sh
# written by Malte.Thoma@awi.de

MAKE=`which gnumake`
if test ! -x "$MAKE" ; then MAKE=`which gmake` ; fi
if test ! -x "$MAKE" ; then MAKE=`which make` ; fi
HAVE_GNU_MAKE=`$MAKE --version|grep -c "Free Software Foundation"`

if test "$HAVE_GNU_MAKE" != "1"; then
echo Using non GNU Make at $MAKE
else
echo Found GNU Make at $MAKE ... good.
fi

echo This script runs configure and make...
echo You did remember necessary arguments for configure, right?

if test ! -x `which aclocal`
then echo you need autoconfig and automake to generate the Makefile
fi
if test ! -x `which automake`
then echo you need automake to generate the Makefile
fi

#if test ! -x `which /usr/local/bin/libtoolize`; then
#/usr/local/bin/libtoolize  --force --copy
#else 
#libtoolize  --force --copy
#fi

autoheader
aclocal   

touch NEWS AUTHORS README ChangeLog # otherwise automake has problems
automake --add-missing --copy --gnu
autoconf
./configure $*
make
