#! /bin/sh
# runs autoheader and autoconf with local macros
echo making configure in `pwd`
#if [ ! -s install-sh ] ; then 
#   # bug in AC_CONFIG_SUDIRS requires install-sh (!)
#   cp /homes/gropp/bin/share/automake/install-sh .
#fi
# Check on version of autoconf
#autoconf=autoconf
#autoheader=autoheader
#version=`autoconf --version | sed -e 's/Autoconf version //'`
#mainversion=`expr $version : '\([0-9]\)\..*'`
#subversion=`expr $version : '[0-9]\.\([0-9]*\)'`
## We need a fixed autoconf for the Fortran language support
#if [ "$mainversion" != "2" -o "$subversion" -lt 14 ] ; then
#    echo "Using locally patched autoconf"
#    autoconf=/homes/gropp/bin/autoconf
#    autoheader=/homes/gropp/bin/autoheader
#fi
# Must use patched automake if version is 2.13
if [ -z "$ARCH" ] ; then
    system="`uname -sr | sed -e 's/ /-/g'`"
    case "$system" in 
	SunOS-5*) ARCH=solaris-2 ;;
	Linux*)   ARCH=linux ;;
    esac
fi
larch=$ARCH
case "$larch" in 
    linux*|Linux*|LINUX*) larch=linux ;;
esac
#automake=/homes/gropp/bin/$larch/automake
#aclocal=/homes/gropp/bin/$larch/aclocal
#autoheader=/homes/gropp/bin/$larch/autoheader
autoconf=/homes/gropp/bin/$larch/autoconf
#if [ ! -x $automake ] ; then
#    echo "Could not find working automake"
#    exit 1
#fi
#
# For autoheader, we need to add a few local definitions.  This will ONLY 
# work if
#    cat /homes/gropp/sowing-proj/sowing/confdb/acconfig.h acconfigl.h > \
#	acconfig.h
#    $aclocal -I /homes/gropp/sowing-proj/sowing/confdb
#$autoheader 
$autoconf   -l /homes/gropp/sowing-proj/sowing/confdb
if [ ! -s configure ] ; then
    echo "WARNING: configure was not created!"
    exit 1
fi
rm -f config.cache config.system
#for dir in $SUBDIRS ; do
#    (cd $dir; ./makeconfigure)
#done
