#!/bin/sh
#
# Copyright (C) 1999-2001 Open Source Telecom Corporation.
#  
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without 
# modifications, as long as this notice is preserved.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

WANT_AUTOCONF_2_5=1
export WANT_AUTOCONF_2_5

if test -f configure ; then  configured="yes" ; else configured="no" ; fi

rm -rf auto* libtool
rm -f include/stamp-h*

if test ! -d autoconf ; then
	mkdir autoconf ; fi

libtoolize="libtoolize"
for lt in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do
        if test -x /usr/bin/$lt ; then
                libtoolize=$lt ; break
        fi
        if test -x /usr/local/bin/$lt ; then
                libtoolize=$lt ; break
        fi
done
$libtoolize --copy --force

ACLOCALDIRS="-I m4"

if test ! -z "$ACLOCAL" ; then
        ACLOCALDIRS="$ACLOCALDIRS -I "${ACLOCAL} 
elif test ! -z "$ACLOCAL_FLAGS" ; then
	ACLOCALDIRS="$ACLOCALDIRS $ACLOCAL_FLAGS" ; fi

if test ! -z "$1" ; then
	if test -d ${1} ; then
		ACLOCALDIRS="$ACLOCALDIRS -I "${1}
	elif test ! -z "$*" ; then
		ACLOCALDIRS="$ACLOCALDIRS $*"
	fi
fi

reconf=""
if test -f ~/.configure ; then
	reconf=`grep ^reconfig: ~/.configure | sed -e s/^reconfig://`
elif test -f /etc/configure.conf ; then
	reconf=`grep ^reconfig: /etc/configure.conf | sed -e s/^reconfig://` ; fi
if test ! -z "$reconf" ; then ACLOCALDIRS="$ACLOCALDIRS $reconf" ; fi

if [ -d ~/share/aclocal ] ; then
    ACLOCALDIRS="$ACLOCALDIRS -I ~/share/aclocal"
elif [ -d /usr/local/share/aclocal ] ; then
    ACLOCALDIRS="$ACLOCALDIRS -I /usr/local/share/aclocal"
fi

aclocal $ACLOCALDIRS
autoheader
automake --add-missing --copy
autoconf
rm -f config.cache

#if test configured == "no" ; then
#	./configure
#	make doxy
#	make manual
#fi


