#! /bin/sh

# For OpenBSD, the server is not supported
CONFIGURE="../src/configure"
CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --enable-server --with-rsaref=no --enable-krb5 --with-krb5=/usr/um/krb5/1.1.1 --with-umich --enable-debug"
#CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --enable-server --with-rsaref=no --enable-krb5 --enable-ldaplookup --enable-umidlookup"
#CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --enable-server --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 sun4x_56 sun_56
ln -s @sys build

#
# 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}"
CC=/opt/SUNWspro/bin/cc ${CONFIGURE} ${CONFIGURE_OPTIONS}
gmake
