#! /bin/sh

subconfigure=configure-ac

echo -n "Testing whether we are in the source directory..."
# Test if we are in the srcdir
if test -f configure-ac; then
# if we are, switch to the object dir and rerun configure
    echo "yes"
    objdir="obj-`config/config.guess`"
    echo "Switching to $objdir..."
    # create an objdir if necessary
    test -d "$objdir" || mkdir $objdir
    # restart configure in the objdir
    cd $objdir
    echo "Running configure-ac..."
    case $# in
	0) /bin/sh ../configure-ac --enable-chooser;;
	*) /bin/sh ../configure-ac --enable-chooser "$@";;
    esac
    ec=$?
    cd ..
    exit $ec
else
# otherwise, start subconfigure from the same directory 
# this was called from
    echo "no"
    echo "Running $0-ac..."
    case $# in
	0) /bin/sh $0-ac;;
	*) /bin/sh $0-ac "$@";;
    esac
    echo $cmd
    $cmd
fi
