#!/bin/sh
# $Id: cfg-normal,v 1.26 2011/07/31 00:08:33 tom Exp $
OUT=configure.out

case "$*" in
*enable-debug*)
	;;
*)
	CFLAGS="-O $CFLAGS"
	;;
esac
export CFLAGS

rm -f config.log config.status config.cache *.out
# LDFLAGS="-Xlinker -warn-common"; export LDFLAGS
case `pwd` in
*ncurses*)
	OPTS="\
	--enable-hard-tabs \
	--disable-termcap \
	--disable-getcap"
	;;
*)
	OPTS=""
	;;
esac

if test -h .@ ; then
	OPTS="$OPTS --srcdir=.@"
fi

case ".$1" in
.cfg*)
eval "$*"
;;
*)
test -z "$ME" && ME=`partition 2>/dev/null`
cat >>$OUT <<EOF/
** `date`
** node: `hostname`
** node: $ME
** user: `id`
** conf: $*
EOF/

SRCDIR=.
SRCOPT=no
for i in $*
do
	case $i in
	--srcdir)
		SRCOPT=yes
		;;
	--srcdir=*)
		SRCDIR=`echo "x$i" | sed -e 's/^[^=]*=//'`
		SRCOPT=no
		;;
	*)
		test $SRCOPT = yes && SRCDIR=$i
		SRCOPT=no
		;;
	esac
done

sh $SRCDIR/configure \
	--verbose \
	--disable-echo \
	--enable-warnings \
	--with-warnings \
	$OPTS \
	"$@" 2>&1 | tee -a $OUT
;;
esac
