#! /bin/sh

# checking for the GLOBUS_LOCATION

if test "x$GLOBUS_LOCATION" = "x"; then
    echo "ERROR Please specify GLOBUS_LOCATION" >&2
    exit 1
fi

# install globus_automake_pre even if we're not goint to really bootstrap


for file in 'globus_automake_pre' \
    'globus_automake_post' \
    'globus_automake_pre_top' \
    'globus_automake_post_top'
do
    if test ! -f "${file}" ; then
        if test -h "${file}" ; then
            rm ${file}
        fi
        echo "installing ${file} link"
        ln -s $GLOBUS_LOCATION/share/globus_aclocal/${file} ${file}
    fi
done

automake_version=`automake --version | grep "automake (GNU automake) 1.6.3"`
#
#if test "x$automake_version" = "x"; then
#    echo "You are not using automake 1.6.3.  Automake 1.6.3 and libtool 1.4.3 are required to re-bootstrap this package." >&2
#    exit 0
#fi

if [ ! -f ${GLOBUS_LOCATION}/libexec/globus-bootstrap.sh ]; then
    echo "ERROR: Unable to locate \${GLOBUS_LOCATION}/libexec/globus-bootstrap.sh"
    echo "       Please ensure that you have installed the globus-core package and"
    echo "       that GLOBUS_LOCATION is set to the proper directory"
    exit
fi

#echo "WARNING: bootstrap is not running globus-bootstrap.sh.  Uncomment the command to regenerate configure files."
. ${GLOBUS_LOCATION}/libexec/globus-bootstrap.sh
