#!/bin/sh
# $Id: cfg-normal,v 1.28 2015/08/06 00:08:18 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/

case .$SHELL in
.*/sh)
	;;
*)
	SHELL=/bin/sh
	test -f /usr/xpg4/bin/sh && SHELL=/usr/xpg4/bin/sh 
	;;
esac

export SHELL
CONFIG_SHELL=$SHELL
export CONFIG_SHELL

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

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