dnl Process this file with autoconf to produce a configure script.
AC_INIT(mail2tdf.pl.in)

dnl We use a path for perl so the #! line in autoscan will work.
AC_PATH_PROGS(PERL5, perl5 perl, no)
AC_SUBST(PERL5)dnl
if test "$PERL5" != no; then
	$PERL5 -e 'require 5'
	if test $? != 0 ; then
		PERL5=no
		AC_MSG_WARN(perl version 5 required)
		exit
	fi
fi

AC_PATH_PROGS(WHOAMI, whoami)
AC_SUBST(WHOAMI)
AC_SUBST(USER)
USER=`$WHOAMI`

if test $prefix = "NONE"; then
	prefix=/usr/local
fi

AC_SUBST(WEB_DIARY_DIR)
if test -f ${HOME}/.tdssetup ; then
	WEB_DIARY_DIR=`sed -n '/^WebDiaryDir	/s///p' ${HOME}/.tdssetup`
else
	WEB_DIARY_DIR=$prefix/share/tds/web_diary_dir
fi

AC_SUBST(LIBDIR)
if test -f ${HOME}/.tdssetup ; then
	LIBDIR=`sed -n '/^_LibDir	/s///p' ${HOME}/.tdssetup`
else
	LIBDIR=$prefix/share/tds/web_diary_dir/lib
fi

AC_OUTPUT(Makefile)
