fix doc build fix autogen
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 23 Jan 2004 13:16:34 +0000 (13:16 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 23 Jan 2004 13:16:34 +0000 (13:16 +0000)
Original commit message from CVS:
fix doc build
fix autogen

m4/as-docbook.m4 [new file with mode: 0644]
m4/gst-doc.m4

diff --git a/m4/as-docbook.m4 b/m4/as-docbook.m4
new file mode 100644 (file)
index 0000000..a44855d
--- /dev/null
@@ -0,0 +1,66 @@
+dnl AS_DOCBOOK([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl checks if xsltproc can build docbook documentation
+dnl (which is possible if the catalog is set up properly
+dnl I also tried checking for a specific version and type of docbook
+dnl but xsltproc seemed to happily run anyway, so we can't check for that
+dnl and version
+dnl this macro takes inspiration from
+dnl http://www.movement.uklinux.net/docs/docbook-autotools/configure.html
+AC_DEFUN(AS_DOCBOOK,
+[
+  XSLTPROC_FLAGS=--nonet
+  DOCBOOK_ROOT=
+  TYPE_LC=xml
+  TYPE_UC=XML
+  VERSION=4.1.2
+
+  if test ! -f /etc/xml/catalog; then
+    for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/;
+    do
+      if test -d "$i"; then
+        DOCBOOK_ROOT=$i
+      fi
+    done
+  else
+    XML_CATALOG=/etc/xml/catalog
+    CAT_ENTRY_START='<!--'
+    CAT_ENTRY_END='-->'
+  fi
+
+  dnl We need xsltproc to process the test
+  AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
+  XSLTPROC_WORKS=no
+  if test -n "$XSLTPROC"; then
+    AC_MSG_CHECKING([whether xsltproc docbook processing works])
+
+    if test -n "$XML_CATALOG"; then
+      DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
+    else
+      DB_FILE="$DOCBOOK_ROOT/docbook.xsl"
+    fi
+    $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
+<?xml version="1.0" encoding='ISO-8859-1'?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook $TYPE_UC V$VERSION//EN" "http://www.oasis-open.org/docbook/$TYPE_LC/$VERSION/docbookx.dtd">
+<book id="test">
+</book>
+END
+    if test "$?" = 0; then
+      XSLTPROC_WORKS=yes
+    fi
+    AC_MSG_RESULT($XSLTPROC_WORKS)
+  fi
+
+  if test "x$XSLTPROC_WORKS" == "xyes"; then
+    dnl execute ACTION-IF-FOUND
+    ifelse([$1], , :, [$1])
+  else
+    dnl execute ACTION-IF-NOT-FOUND
+    ifelse([$2], , :, [$2])
+  fi
+
+  AC_SUBST(XML_CATALOG)
+  AC_SUBST(XSLTPROC_FLAGS)
+  AC_SUBST(DOCBOOK_ROOT)
+  AC_SUBST(CAT_ENTRY_START)
+  AC_SUBST(CAT_ENTRY_END)
+])
index 44ee079..c4747a1 100644 (file)
@@ -30,6 +30,7 @@ EOF
       HAVE_GTK_DOC=false
    fi
 fi
+
 # don't you love undocumented command line options?
 GTK_DOC_SCANOBJ="gtkdoc-scangobj --nogtkinit"
 AC_SUBST(HAVE_GTK_DOC)
@@ -41,6 +42,9 @@ AC_CHECK_PROG(HAVE_DOCBOOK2HTML, docbook2html, true, false)
 AC_CHECK_PROG(HAVE_JADETEX, jadetex, true, false)
 AC_CHECK_PROG(HAVE_PS2PDF, ps2pdf, true, false)
 
+dnl check if we can process docbook stuff
+AS_DOCBOOK(HAVE_DOCBOOK=true, HAVE_DOCBOOK=false)
+
 dnl check for image conversion tools
 AC_CHECK_PROG(HAVE_FIG2DEV, fig2dev, true, false)
 if test "x$HAVE_FIG2DEV" = "xfalse" ; then
@@ -77,6 +81,7 @@ AC_CHECK_PROG(HAVE_EPSTOPDF, epstopdf, true, false)
 
 dnl check if we can generate HTML
 if test "x$HAVE_DOCBOOK2HTML" = "xtrue" && \
+   test "x$HAVE_DOCBOOK" = "xtrue" && \
    test "x$HAVE_FIG2DEV_PNG" = "xtrue"; then
   DOC_HTML=true
   AC_MSG_NOTICE(Will output HTML documentation)
@@ -87,6 +92,7 @@ fi
 
 dnl check if we can generate PS
 if test "x$HAVE_DOCBOOK2PS" = "xtrue" && \
+   test "x$HAVE_DOCBOOK" = "xtrue" && \
    test "x$HAVE_JADETEX" = "xtrue" && \
    test "x$HAVE_FIG2DEV_EPS" = "xtrue" && \
    test "x$HAVE_PNGTOPNM" = "xtrue" && \
@@ -100,6 +106,7 @@ fi
 
 dnl check if we can generate PDF - using only ps2pdf
 if test "x$DOC_PS" = "xtrue" && \
+   test "x$HAVE_DOCBOOK" = "xtrue" && \
    test "x$HAVE_PS2PDF" = "xtrue"; then
   DOC_PDF=true
   AC_MSG_NOTICE(Will output PDF documentation)
@@ -115,7 +122,8 @@ AC_ARG_ENABLE(docs-build,
 AC_HELP_STRING([--enable-docs-build],[enable building of documentation]),
 [case "${enableval}" in
   yes)
-    if test "x$HAVE_GTK_DOC" = "xtrue" ; then
+    if test "x$HAVE_GTK_DOC" = "xtrue" && \
+       test "x$HAVE_DOCBOOK" = "xtrue"; then
       BUILD_DOCS=yes
     else
       BUILD_DOCS=no
@@ -137,6 +145,7 @@ dnl [BUILD_PLUGIN_DOCS=yes]) dnl Default value
 BUILD_PLUGIN_DOCS=no
 
 AM_CONDITIONAL(HAVE_GTK_DOC,        $HAVE_GTK_DOC)
+AM_CONDITIONAL(HAVE_DOCBOOK,        $HAVE_DOCBOOK)
 AM_CONDITIONAL(BUILD_DOCS,          test "x$BUILD_DOCS" = "xyes")
 AM_CONDITIONAL(BUILD_PLUGIN_DOCS,   test "x$BUILD_PLUGIN_DOCS" = "xyes")
 AM_CONDITIONAL(DOC_HTML,            $DOC_HTML)