From 2e0e0324cf27f661134213000e7ca1361a643e3f Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Sat, 8 Sep 2007 01:11:43 -0500 Subject: [PATCH] Build docs automatically if xsltproc is working --- m4/moo-docs.m4 | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/m4/moo-docs.m4 b/m4/moo-docs.m4 index 80f719fd..d74f2d33 100644 --- a/m4/moo-docs.m4 +++ b/m4/moo-docs.m4 @@ -1,9 +1,58 @@ +AC_DEFUN([_MOO_AC_CHECK_XSLT_DOCBOOK],[ + AC_ARG_VAR([XSLTPROC],[path to xsltproc utility]) + AC_CHECK_PROG([XSLTPROC],[xsltproc],[xsltproc]) + + if test -z "$XSLTPROC"; then + $2 + fi + + if test -n "$XSLTPROC"; then + AC_MSG_CHECKING([whether xsltproc works]) + cat > conftest.docbook << EOFEOF + + +
+ +Title + + +A section +Blah blah blah. + +
+EOFEOF + if ($XSLTPROC http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl conftest.docbook 2>/dev/null >/dev/null); then + AC_MSG_RESULT([yes]) + rm -f conftest.docbook + $1 + else + AC_MSG_RESULT([no]) + rm -f conftest.docbook + $2 + fi + fi +]) + AC_DEFUN([MOO_DOCS],[ AC_REQUIRE([MOO_AC_SET_DIRS]) AC_ARG_ENABLE([help], - AC_HELP_STRING(--enable-help, [build html help files (default = NO). Will not work on all systems]), - [:],[enable_help=no]) + AC_HELP_STRING(--disable-help, [Disable building html help files (default = auto).]), + [:],[enable_help=auto]) + + if test "x$enable_help" = xauto -o "x$enable_help" = xyes; then + _MOO_AC_CHECK_XSLT_DOCBOOK([_moo_xslt_working=yes],[_moo_xslt_working=no]) + if test $_moo_xslt_working = yes; then + enable_help=yes + elif test "x$enable_help" = xauto; then + enable_help=no + else + AC_MSG_ERROR([xsltproc will not work]) + fi + fi + AM_CONDITIONAL(MOO_ENABLE_HELP, test "x$enable_help" = xyes) if test "x$enable_help" = xyes; then AC_DEFINE(MOO_ENABLE_HELP, [1], [enable help functionality])