#! /bin/sh

# For OpenBSD, the server is not supported
CONFIGURE="../src/configure"
CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --with-rsaref=no --enable-krb5 --with-krb5=/usr/um/krb5/1.1.1 --with-umich --enable-debug"
#CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --with-rsaref=no --enable-krb5 --with-umich --enable-debug"
#CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --with-rsaref=no --enable-krb5 --with-umich"
#CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --with-rsaref=no --enable-krb5=no"

# Remove any existing directories and re-create them
rm -rf sun4x_56 sun_56 build
mkdir sun4x_56
ln -s @sys build
ln -s sun4x_56 sun_56

#
# ONLY re-create configure from configure.in if script is invoke with --autoconf
#
if [ "$1" = "--autoconf" ]; then
	(cd src; \
		autoheader ; \
		rm -f configure; \
		autoconf configure.in >configure; \
		chmod a+rx configure \
	)
fi


cd build

echo "${CONFIGURE} ${CONFIGURE_OPTIONS}"
${CONFIGURE} ${CONFIGURE_OPTIONS}
gmake
