#! /bin/sh
# Remove the files created by this script before running it.
#rm -f config.cache config.status config.log
rm -f src/Makefile include/autoconf.h

if test ! -f configure
then
	autoconf
fi

OUT=td-conf.out
cat >>$OUT <<EOF/
** `date`
** node: `uname -a`
** from: `pwd`
** user: `id`
** conf: $*
EOF/
OPTS="$*"

CC="${CC-cc}"

# set
#	--with-domain-name=doma.in
# and
#	--with-nntp-default-server=news.doma.in
# to your local needs
# if your like to use pgp and you have more then method installed on your
# system _disable_ two of the three offered pgp/pgp supports, i.e. use:
# 	-without-pgpk --without-gpg
# for pgp-2 support

if test -z "$SHELL"; then
	case `./config.guess` in
	*solaris2.10)
		SHELL=/usr/xpg4/bin/sh
		;;
	*)
		SHELL=/bin/sh
		;;
	esac
else
	case "$SHELL" in
	*[cz]sh)
		SHELL=/bin/sh
		;;
	esac
fi

echo "Making with $CC $CFLAGS"
CFLAGS="$CFLAGS" \
CC="$CC" \
$SHELL ./configure --verbose \
	--disable-echo \
	--enable-prototypes \
	--enable-nntp-only \
	--with-pcre \
	--with-domain-name=/etc/NNTP_INEWS_DOMAIN \
	--with-coffee \
        $OPTS $* 2>&1 |tee -a $OUT
