2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program; if not, write to the Free Software
15 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 AC_DEFUN([GNASH_DOCBOOK], [
19 AC_ARG_ENABLE(docbook, AC_HELP_STRING([--enable-docbook], [Enable support for building documentation with "make html" and "make pdf"]),
20 [case "${enableval}" in
23 *) AC_MSG_ERROR([bad value ${enableval} for enable-docbook option]) ;;
27 if test x"$docbook" = x"yes"; then dnl## {
28 dnl install-info is used to update entries in the dirs file, used by
29 dnl info to find all of it files.
30 AC_PATH_PROG(INSTALL_INFO, install-info, $PATH:/usr/sbin)
31 AC_SUBST(INSTALL_INFO)
32 AM_CONDITIONAL(ENABLE_INFO, test x${INSTALL_INFO} != x)
35 AC_ARG_WITH(docbook_styles, AC_HELP_STRING([--with-docbook-styles], [directory where Docbook stylesheets are]), with_docbook_styles=${withval})
36 if test x"${with_docbook_styles}" != x ; then dnl## {
38 if test -f ${with_docbook_styles}/html/docbook.xsl ; then dnl## {
39 docbook_styles="`(cd ${with_docbook_styles}; pwd)`"
41 AC_MSG_ERROR([${with_docbook_styles}/html directory doesn't contain docbook.xsl])
45 AC_CACHE_CHECK([for docbook styles path],[gnash_cv_path_docbook_styles],[
46 dirlist="/usr/share/xml/docbook/stylesheet/nwalsh /usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/sgml/docbook/xsl-stylesheets /usr/local/share/sgml/docbook/xsl-stylesheets /opt/share/sgml/docbook/xsl-stylesheets /home/latest/share/sgml/docbook/xsl-stylesheets /usr/share/sgml/docbook/stylesheet/xsl/nwalsh"
48 if test -f $i/html/docbook.xsl; then
49 gnash_cv_path_docbook_styles="`(cd $i; pwd)`"
55 if test x$gnash_cv_path_docbook_styles != x; then dnl## {
56 docbook_styles=$gnash_cv_path_docbook_styles
62 AC_MSG_NOTICE([checking for other programs needed to process the DocBook files])
63 AC_PATH_PROG(FOP, fop.sh, [],
64 [$PATH:/usr/local/fop-0.20.5/:/usr/fop-0.20.5/:/usr/local/fop:/usr/lib/java/fop])
65 if test x"$FOP" = x; then dnl## {
66 AC_PATH_PROG(FOP, fop, [],
67 [$PATH:/usr/local/fop-0.20.5/:/usr/fop-0.20.5/:/usr/local/fop:/usr/lib/java/fop])
70 if test x"$FOP" != x; then dnl## {
71 dirlist="/usr /usr/lib/jre /usr/jre /opt/local/Java/JavaSDK ~/ReQuest/jre $J2REDIR"
74 if test -f $i/bin/java; then dnl## {
75 version=`$i/bin/java -version 2>&1`
76 dnl See if it's Sun Java
77 tmp="`echo $version | grep -c "java version" `"
78 if test $tmp -gt 0; then dnl## {
85 tmp="`echo $version | grep -c "java version" `"
86 if test $tmp -gt 0; then dnl## {
87 AC_MSG_WARN([$i/bin/java not Sun version!])
95 AC_MSG_CHECKING(for Sun java runtime)
96 if test x"$JAVA" = x; then dnl## {
97 AC_MSG_RESULT(not found)
98 AC_MSG_WARN([You need to install Sun Java and the JAI toolkit to run fop])
100 AC_MSG_RESULT([$JAVA])
105 AC_PATH_PROG(PDFXMLTEX, pdfxmltex, [],
106 [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
108 dnl AC_PATH_PROG(DBLATEX, dblatex, [],
109 dnl [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
111 AC_PATH_PROG(XSLTPROC, xsltproc, [],
112 [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
114 AC_PATH_PROG(DB2X_XSLTPROC, db2x_xsltproc, [],
115 [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
117 if test x$DB2X_XSLTPROC = x; then dnl## {
118 AC_PATH_PROG(DB2X_XSLTPROC, db2x_xsltproc.pl, [],
119 [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
122 dnl Find the programs we need to convert docbook into Texi for
123 dnl making info pages. The first catagory are the wrapper
124 dnl utilities included in most docbook2x packages.
125 dnl It turns out there are two sets of wrapper functions, the good
126 dnl ones from the newer DocBook2X tools are written in perl, and
127 dnl actually work correctly. There are other versions of the same
128 dnl tools ,but they are merely a 1 line wrapper for the OpenJade
129 dnl tools. These versions have big problems, namely they don't
130 dnl support the encoding of entities, so we get massive warnings
131 dnl about entities in included files we never heard about.
132 scripts="db2x_docbook2texi docbook2texi docbook2texi.pl"
133 for i in $scripts; do dnl## {
134 AC_PATH_PROG(DB2X_TEXI, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
135 if test x$DB2X_TEXI != x; then
136 type="`file $DB2X_TEXI | grep -ic "perl " 2>&1`"
137 if test $type -gt 0; then
145 dnl These look for the seperate utilities used by the wrapper
146 dnl scripts. If we don't find the wrappers, then we use the lower
147 dnl level utilities directly.
149 scripts="db2x_texixml db2x_texixml.pl"
150 for i in $scripts; do
151 AC_PATH_PROG(DB2X_TEXIXML, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
152 if test x$DB2X_TEXIXML != x; then
157 dnl Find the programs we need to convert docbook into man pages.
158 scripts="db2x_docbook2man docbook2man docbook2man.pl"
159 for i in $scripts; do
160 AC_PATH_PROG(DB2X_MAN, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
161 if test x$DB2X_MAN != x; then
162 type="`file $DB2X_MAN | grep -ic "perl " 2>&1`"
163 if test $type -gt 0; then
171 scripts="db2x_manxml db2x_manxml.pl"
172 for i in $scripts; do
173 AC_PATH_PROG(DB2X_MANXML, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
174 if test x$DB2X_MANXML != x; then
179 AC_PATH_PROG(MAKEINFO, makeinfo, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
181 if test x"$XSLTPROC" = x -o x"$docbook_styles" = x ; then
182 AC_MSG_WARN([You need to install xsltproc and docbook style sheets before HTML output can be generated])
185 if test x"$DB2X_XSLTPROC" = x -o x"$DB2X_TEXIXML" = x -o x"$DB2X_MANXML" = x -o x"$MAKEINFO" = x ; then
186 AC_MSG_WARN([You need to install the docbook2X package before Texi output can be generated])
189 AC_PATH_PROG(DB2X_PDF, docbook2pdf, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
192 if test x"$FOP" != x -a x"$docbook_styles" != x ; then :
193 elif test x"$PDFXMLTEX" != x -a x"$XSLTPROC" != x -a x"$docbook_styles" != x ; then :
195 AC_MSG_WARN([No suitable fop nor pdfxmltex, PDF format files can't be generated - hint: apt-get install xmltex fop])
200 dnl AM_CONDITIONAL(HAVE_JAVA, [test x$JAVA != x])
201 AM_CONDITIONAL(ENABLE_TEXI, [ test x"$DB2X_TEXI" != x -o x"$DB2X_TEXIXML" != x ])
202 AM_CONDITIONAL(ENABLE_PDF, [ test x"$DB2X_PDF" ])
203 AM_CONDITIONAL(ENABLE_HTML, [ test x"$XSLTPROC" != x -a x"$docbook_styles" != x ])
204 AM_CONDITIONAL(ENABLE_FOP, [ test x"$FOP" != x -a x"$docbook_styles" != x ])
205 AM_CONDITIONAL(ENABLE_XMLTEX, [ test x"$PDFXMLTEX" != x -a x"$XSLTPROC" != x -a x"$docbook_styles" != x ])
206 dnl AM_CONDITIONAL(ENABLE_DBLATEX, [ test x"$DBLATEX" != x ])
207 AM_CONDITIONAL(ENABLE_MAN, [ test x"$DB2X_MAN" != x -o x"$DB2X_MANXML" != x ])
210 dnl See which version of the DocBook2x tools we have, because it
211 dnl forces a command line change in the Makefile.
213 dnl db2x_texixml (part of docbook2X 0.8.3)
214 dnl db2x_texixml (part of docbook2X 0.8.5)
215 dnl docbook2texi (part of docbook2X 0.8.8)
216 if test x"${DB2X_TEXIXML}" != x; then dnl## {
217 db2x_version=`${DB2X_TEXIXML} --version | head -1 | sed -e 's/^.*docbook2X //' -e 's/).*$//' 2>&1`
218 DB2X_VERSION="${db2x_version}"
219 AC_SUBST(DB2X_VERSION)
222 dnl AM_CONDITIONAL(NEW_DOCBOOK2X, [test "$db2x_version" = "0.8.5"])
223 AC_SUBST(docbook_styles)
225 AC_SUBST(DB2X_XSLTPROC)
226 AC_SUBST(DB2X_TEXIXML)
234 # indent-tabs-mode: nil