AC_INIT(Makefile.in)
AC_COPYRIGHT([Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)])

XINC=xinc
XEP=xep
FOP=fop
XSLTPROC=xsltproc
XMLLINT=xmllint

AC_ARG_WITH(xep, [  --with-xep   Where to find RenderX XEP],
	[
		if test "x$withval" != "xno"; then
			XEP="$withval"
		fi
	]
)
AC_PATH_PROG(XEP,  $XEP)

AC_ARG_WITH(xinc, [  --with-xinc  Where to find lunasil XINC],
	[
		if test "x$withval" != "xno"; then
			XINC="$withval"
		fi
	]
)
AC_PATH_PROG(XINC, $XINC)

AC_ARG_WITH(fop, [  --with-fop  Where to find Apache FOP],
	[
		if test "x$withval" != "xno"; then
			FOP="$withval"
		fi
	]
)
AC_PATH_PROG(FOP,  $FOP)

AC_ARG_WITH(xsltproc, [  --with-xsltproc  Where to find xsltproc],
	[
		if test "x$withval" != "xno"; then
			XSLTPROC="$withval"
		fi
	]
)
AC_PATH_PROG(XSLTPROC,  $XSLTPROC)

AC_ARG_WITH(xmllint, [  --with-xmllint  Where to find xmllint],
	[
		if test "x$withval" != "xno"; then
			XMLLINT="$withval"
		fi
	]
)
AC_PATH_PROG(XMLLINT,  $XMLLINT)

ECSRC=../trunk
AC_ARG_WITH(ecsrc, [  --with-ecsrc  Where to find the ecelerity source],
	[
		if test "x$withval" != "xno"; then
			ECSRC="$withval"
		fi
	]
)

AC_SUBST(XINC)
AC_SUBST(XEP)
AC_SUBST(FOP)
AC_SUBST(XSLTPROC)
AC_SUBST(XMLLINT)
AC_SUBST(ECSRC)
HERE=`pwd`
AC_SUBST(HERE)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

cat > config.nice <<EOT
#!/bin/sh
./configure \
    --with-ecsrc='$ECSRC' \
    --with-xsltproc='$XSLTPROC' \
    --with-xmllint='$XMLLINT' \
    --with-fop='$FOP' \
    --with-xinc='$XINC' \
    --with-xep='$XEP'

EOT
chmod +x config.nice

