#!/bin/sh -x
# also:
# with-system-type=XXX
# with-shlib-version=X
if [ $# != 0 ]
then
	if [ ! -d $1 ] ; then
		echo "not a directory $1"
		exit 1
	fi
	OUT=build-opt-`partition`-`pd`.log
	cat >>$OUT <<EOF/
** `date`
** run: $*
EOF/
	( cd $1 && eval $0 2>&1 ) | tee -a $OUT
	exit
fi

test -d options || mkdir options
for OPT in `all-opts-ncurses`
do
	if test -f options/$OPT ; then
		echo SKIP options/$OPT
		continue
	fi
	echo MAKE $OPT
	OPTS="--$OPT"
	test "$OPT" = disable-database && OPTS="$OPTS --with-fallbacks=vt100"
	DST=`echo "$OPT" |sed -e 's@/@_@g'`
	if test -f Makefile ; then
		make distclean
		rm *.out
	fi
	cfg-normal $OPTS && \
	make-out all && touch options/$DST
done
