AC_INIT(global.ent)

AC_PATH_PROG(XSLTPROC, xsltproc)
if test "x$XSLTPROC" = x; then
   AC_MSG_ERROR("xsltproc is required")
fi
AC_PATH_PROG(PDFLATEX, pdflatex)
if test "x$PDFLATEX" = x; then
   AC_MSG_ERROR("pdflatex is required")
fi
AC_PATH_PROG(MAKEINDEX, makeindex)
if test "x$MAKEINDEX" = x; then
	AC_MSG_ERROR("makeindex is required")
fi

PAPERSIZE=""
TEXSTYLESHEET=xslt/latex.xsl
DUPLICATE_ULINKS=""

CROP="--stringparam docrop 0"

AC_ARG_ENABLE(crop,
[ --enable-crop					    Whether to use a crop template],
[ test "$withval" && CROP="--stringparam docrop 1" ])

PAPERSIZE="--stringparam papersize a4paper"

AC_ARG_WITH(papersize,
[ --with-papersize					Specify papersize (a4paper,letter) ],
[ test "$withval" && PAPERSIZE="--stringparam papersize $withval" ])

FONTSIZE="--stringparam fontsize 10.5"

AC_ARG_WITH(fontsize,
[ --with-fontsize	              Specify the fontsize in points (default: 10.5) ],
[ test "$withval" && FONTSIZE="--stringparam fontsize $withval" ])

AC_PATH_PROG(LATEX, latex)
AC_PATH_PROG(DVIPS, dvips)
AC_PATH_PROG(PNGTOPNM, pngtopnm)
AC_PATH_PROG(PNMTOPS, pnmtops)
AC_PATH_PROG(PERL, perl)
AC_PATH_PROG(XMLTO, xmlto)

DOC_BUILD_DATE=`date '+%d-%m-%Y'`
AC_SUBST(DOC_BUILD_DATE)
AC_SUBST(TEXSTYLESHEET)
AC_SUBST(PAPERSIZE)
AC_SUBST(DUPLICATE_ULINKS)
AC_SUBST(FONTSIZE)
AC_SUBST(CROP)

AC_OUTPUT( Makefile )
