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 -n "$XML_CATALOG_FILES"; then
20 for xml_catalog_file in $XML_CATALOG_FILES; do
21 if test -f $xml_catalog_file; then
22 XML_CATALOG=$xml_catalog_file
23 CAT_ENTRY_START='<!--'
29 elif test ! -f /etc/xml/catalog; then
30 for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/ /usr/local/share/xsl/docbook ;
37 XML_CATALOG=/etc/xml/catalog
38 CAT_ENTRY_START='<!--'
42 dnl We need xsltproc to process the test
43 AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
45 if test -n "$XSLTPROC"; then
46 AC_MSG_CHECKING([whether xsltproc docbook processing works])
48 if test -n "$XML_CATALOG"; then
49 DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
51 DB_FILE="$DOCBOOK_ROOT/xhtml/docbook.xsl"
53 $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
54 <?xml version="1.0" encoding='ISO-8859-1'?>
55 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook $TYPE_UC V$DOCBOOK_VERSION//EN" "http://www.oasis-open.org/docbook/$TYPE_LC/$DOCBOOK_VERSION/docbookx.dtd">
59 if test "$?" = 0; then
62 AC_MSG_RESULT($XSLTPROC_WORKS)
65 if test "x$XSLTPROC_WORKS" = "xyes"; then
66 dnl execute ACTION-IF-FOUND
67 ifelse([$1], , :, [$1])
69 dnl execute ACTION-IF-NOT-FOUND
70 ifelse([$2], , :, [$2])
74 AC_SUBST(XSLTPROC_FLAGS)
75 AC_SUBST(DOCBOOK_ROOT)
76 AC_SUBST(CAT_ENTRY_START)
77 AC_SUBST(CAT_ENTRY_END)