Home | History | Annotate | Download | only in m4
      1 dnl AX_CHECK_DOCBOOK
      2 AC_DEFUN([AX_CHECK_DOCBOOK], [
      3 # It's just rude to go over the net to build
      4 XSLTPROC_FLAGS=--nonet
      5 DOCBOOK_ROOT=
      6 if test ! -f /etc/xml/catalog; then
      7 	for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/;
      8 	do
      9 		if test -d "$i"; then
     10 			DOCBOOK_ROOT=$i
     11 		fi
     12 	done
     13 
     14 	# Last resort - try net
     15 	if test -z "$DOCBOOK_ROOT"; then
     16 		XSLTPROC_FLAGS=
     17 	fi
     18 else
     19 	XML_CATALOG=/etc/xml/catalog
     20 	CAT_ENTRY_START='<!--'
     21 	CAT_ENTRY_END='-->'
     22 fi
     23 
     24 AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
     25 XSLTPROC_WORKS=no
     26 if test -n "$XSLTPROC"; then
     27 	AC_MSG_CHECKING([whether xsltproc works])
     28 
     29 	if test -n "$XML_CATALOG"; then
     30 		DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
     31 	else
     32 		DB_FILE="$DOCBOOK_ROOT/docbook.xsl"
     33 	fi
     34 
     35 	$XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
     36 <?xml version="1.0" encoding='ISO-8859-1'?>
     37 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
     38 <book id="test">
     39 </book>
     40 END
     41 	if test "$?" = 0; then
     42 		XSLTPROC_WORKS=yes
     43 	fi
     44 	AC_MSG_RESULT($XSLTPROC_WORKS)
     45 fi
     46 AM_CONDITIONAL(have_xsltproc, test "$XSLTPROC_WORKS" = "yes")
     47 
     48 AC_SUBST(XML_CATALOG)
     49 AC_SUBST(XSLTPROC_FLAGS)
     50 AC_SUBST(DOCBOOK_ROOT)
     51 AC_SUBST(CAT_ENTRY_START)
     52 AC_SUBST(CAT_ENTRY_END)
     53 ])
     54