1 dnl AS_DOCBOOK([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2 dnl checks if xsltproc can build docbook documentation
3 dnl (which is possible if the catalog is set up properly
4 dnl I also tried checking for a specific version and type of docbook
5 dnl but xsltproc seemed to happily run anyway, so we can't check for that
7 dnl this macro takes inspiration from
8 dnl http://www.movement.uklinux.net/docs/docbook-autotools/configure.html
11 XSLTPROC_FLAGS=--nonet
17 if test ! -f /etc/xml/catalog; then
18 for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/;
25 XML_CATALOG=/etc/xml/catalog
26 CAT_ENTRY_START='<!--'
30 dnl We need xsltproc to process the test
31 AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
33 if test -n "$XSLTPROC"; then
34 AC_MSG_CHECKING([whether xsltproc docbook processing works])
36 if test -n "$XML_CATALOG"; then
37 DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
39 DB_FILE="$DOCBOOK_ROOT/docbook.xsl"
41 $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
42 <?xml version="1.0" encoding='ISO-8859-1'?>
43 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook $TYPE_UC V$DOCBOOK_VERSION//EN" "http://www.oasis-open.org/docbook/$TYPE_LC/$DOCBOOK_VERSION/docbookx.dtd">
47 if test "$?" = 0; then
50 AC_MSG_RESULT($XSLTPROC_WORKS)
53 if test "x$XSLTPROC_WORKS" = "xyes"; then
54 dnl execute ACTION-IF-FOUND
55 ifelse([$1], , :, [$1])
57 dnl execute ACTION-IF-NOT-FOUND
58 ifelse([$2], , :, [$2])
62 AC_SUBST(XSLTPROC_FLAGS)
63 AC_SUBST(DOCBOOK_ROOT)
64 AC_SUBST(CAT_ENTRY_START)
65 AC_SUBST(CAT_ENTRY_END)