1AC_DEFUN([AG_GST_DOCBOOK_CHECK],
2[
3  dnl choose a location to install docbook docs in
4  if test "x$PACKAGE_TARNAME" = "x"
5  then
6    AC_MSG_ERROR([Internal error - PACKAGE_TARNAME not set])
7  fi
8  docdir="\$(datadir)/doc/$PACKAGE_TARNAME-$GST_API_VERSION"
9
10  dnl enable/disable docbook documentation building
11  AC_ARG_ENABLE(docbook,
12  AC_HELP_STRING([--enable-docbook],
13                 [use docbook to build documentation [default=no]]),,
14                 enable_docbook=no)
15
16  have_docbook=no
17
18  if test x$enable_docbook = xyes; then
19    dnl check if we actually have everything we need
20
21    dnl check for docbook tools
22    AC_CHECK_PROG(HAVE_DOCBOOK2PS, docbook2ps, yes, no)
23    AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, yes, no)
24    AC_CHECK_PROG(HAVE_JADETEX, jadetex, yes, no)
25    AC_CHECK_PROG(HAVE_PS2PDF, ps2pdf, yes, no)
26
27    dnl check if we can process docbook stuff
28    AS_DOCBOOK(have_docbook=yes, have_docbook=no)
29
30    dnl check for extra tools
31    AC_CHECK_PROG(HAVE_DVIPS, dvips, yes, no)
32    AC_CHECK_PROG(HAVE_XMLLINT, xmllint, yes, no)
33
34    AC_CHECK_PROG(HAVE_PNGTOPNM, pngtopnm, yes, no)
35    AC_CHECK_PROG(HAVE_PNMTOPS,  pnmtops,  yes, no)
36    AC_CHECK_PROG(HAVE_EPSTOPDF, epstopdf, yes, no)
37
38    dnl check if we can generate HTML
39    if test "x$HAVE_XSLTPROC" = "xyes" && \
40       test "x$enable_docbook" = "xyes" && \
41       test "x$HAVE_XMLLINT" = "xyes"; then
42      DOC_HTML=yes
43      AC_MSG_NOTICE(Will output HTML documentation)
44     else
45      DOC_HTML=no
46      AC_MSG_NOTICE(Will not output HTML documentation)
47    fi
48
49    dnl check if we can generate PS
50    if test "x$HAVE_DOCBOOK2PS" = "xyes" && \
51       test "x$enable_docbook" = "xyes" && \
52       test "x$HAVE_XMLLINT" = "xyes" && \
53       test "x$HAVE_JADETEX" = "xyes" && \
54       test "x$HAVE_DVIPS" = "xyes" && \
55       test "x$HAVE_PNGTOPNM" = "xyes" && \
56       test "x$HAVE_PNMTOPS" = "xyes"; then
57      DOC_PS=yes
58      AC_MSG_NOTICE(Will output PS documentation)
59    else
60      DOC_PS=no
61      AC_MSG_NOTICE(Will not output PS documentation)
62    fi
63
64    dnl check if we can generate PDF - using only ps2pdf
65    if test "x$DOC_PS" = "xyes" && \
66       test "x$enable_docbook" = "xyes" && \
67       test "x$HAVE_XMLLINT" = "xyes" && \
68       test "x$HAVE_PS2PDF" = "xyes"; then
69      DOC_PDF=yes
70      AC_MSG_NOTICE(Will output PDF documentation)
71    else
72      DOC_PDF=no
73      AC_MSG_NOTICE(Will not output PDF documentation)
74    fi
75
76    dnl if we don't have everything, we should disable
77    if test "x$have_docbook" != "xyes"; then
78      enable_docbook=no
79    fi
80  fi
81
82  dnl if we're going to install documentation, tell us where
83  if test "x$have_docbook" = "xyes"; then
84    AC_MSG_NOTICE(Installing documentation in $docdir)
85    AC_SUBST(docdir)
86  fi
87
88  AM_CONDITIONAL(ENABLE_DOCBOOK,      test x$enable_docbook = xyes)
89  AM_CONDITIONAL(DOC_HTML,            test x$DOC_HTML = xyes)
90  AM_CONDITIONAL(DOC_PDF,             test x$DOC_PDF = xyes)
91  AM_CONDITIONAL(DOC_PS,              test x$DOC_PS = xyes)
92])
93