Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / common / m4 / as-docbook.m4
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
6 dnl and version
7 dnl this macro takes inspiration from
8 dnl http://www.movement.uklinux.net/docs/docbook-autotools/configure.html
9 AC_DEFUN([AS_DOCBOOK],
10 [
11   XSLTPROC_FLAGS=--nonet
12   DOCBOOK_ROOT=
13   TYPE_LC=xml
14   TYPE_UC=XML
15   DOCBOOK_VERSION=4.1.2
16
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/ /usr/local/share/xsl/docbook ;
19     do
20       if test -d "$i"; then
21         DOCBOOK_ROOT=$i
22       fi
23     done
24   else
25     XML_CATALOG=/etc/xml/catalog
26     CAT_ENTRY_START='<!--'
27     CAT_ENTRY_END='-->'
28   fi
29
30   dnl We need xsltproc to process the test
31   AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
32   XSLTPROC_WORKS=no
33   if test -n "$XSLTPROC"; then
34     AC_MSG_CHECKING([whether xsltproc docbook processing works])
35
36     if test -n "$XML_CATALOG"; then
37       DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
38     else
39       DB_FILE="$DOCBOOK_ROOT/xhtml/docbook.xsl"
40     fi
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">
44 <book id="test">
45 </book>
46 END
47     if test "$?" = 0; then
48       XSLTPROC_WORKS=yes
49     fi
50     AC_MSG_RESULT($XSLTPROC_WORKS)
51   fi
52
53   if test "x$XSLTPROC_WORKS" = "xyes"; then
54     dnl execute ACTION-IF-FOUND
55     ifelse([$1], , :, [$1])
56   else
57     dnl execute ACTION-IF-NOT-FOUND
58     ifelse([$2], , :, [$2])
59   fi
60
61   AC_SUBST(XML_CATALOG)
62   AC_SUBST(XSLTPROC_FLAGS)
63   AC_SUBST(DOCBOOK_ROOT)
64   AC_SUBST(CAT_ENTRY_START)
65   AC_SUBST(CAT_ENTRY_END)
66 ])