#! /bin/sh

PATH=/usr/um/bin:/usr/um/gnu/bin:/usr/itd/gnubin:/bin:/usr/vice/bin:/usr/afs/bin
export PATH

CONFIGURE="../src/configure"
CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --with-rsaref=no --enable-krb5"
#CONFIGURE_OPTIONS="--srcdir=../src --enable-srclinks --with-rsaref=no --enable-krb5=no"

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}"
# CFLAGS='-g -DDEBUG' ../src/configure --enable-srclinks
CFLAGS='-g' ${CONFIGURE} ${CONFIGURE_OPTIONS}

if [ -x /usr/um/gnu/bin/gmake ]; then
	/usr/um/gnu/bin/gmake
elif [ -x /usr/um/gnu/bin/make ]; then
	/usr/um/gnu/bin/make
else
	echo 'Could not find GNU make in /usr/um/gnu/bin as either make nor gmake'
fi

# allow *binaries* to be seen by members of x509:friends

fs sa lib x509:friends rl
