#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

#AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, DEB_VERSION, DATE, BUG-REPORT-ADDRESS)

#VERSION="2.0-2"
AC_CANONICAL_HOST
AC_CANONICAL_SYSTEM

# Checks for programs.
AC_PROG_INSTALL
AC_PROG_MAKE_SET
# AC_PROG_AWK
# AC_CHECK_PROG(SED,sed,sed)
AC_CHECK_PROG(PDF_CMD,dblatex,dblatex)
AC_CHECK_PROG(XMLTO_CMD,xmlto,xmlto)
AC_PROG_EGREP
AC_PROG_LN_S

# bail if some of our necessary files are not installed
if test "$PDF_CMD" = ""; then
	AC_MSG_ERROR([
  *** dblatex could not be found.  Please install the package dblatex
  ***  and rerun ./configure ...exiting... ])
fi
if test "$XMLTO_CMD" = ""; then
	AC_MSG_ERROR([
  *** xmlto could not be found. Please install the package xmlto
  ***  and rerun ./configure.  ...exiting... ])
fi
#if test "$SED" != ""; then
#	#VERSION=`read junk version <./ChangeLog && echo ${version//[()]/}`
#	VERSION=`$SED -n "1s/.*(\(.*\)).*/\1/p" ChangeLog`
#	DEB_VERSION=`$SED -n "1s/.*(\(.*\)).*/\1/p" debian/changelog`
#else
#	AC_MSG_ERROR([
#*** Need to have sed installed to configure properly ])
#fi

DATE="`date +\"%B%e, %Y\"`"

AC_SUBST(VERSION)
AC_SUBST(DEB_VERSION)
AC_SUBST(DATE)
CONFIGS="Makefile"
AC_SUBST(CONFIGS)
AC_CONFIG_FILES([$CONFIGS])
AC_OUTPUT
