Add findDisplayItemByTarget in MovieTester
[gnash.git] / macros / docbook.m4
blob2db013e07765d39d731a5c511c1d2962b2fdde37
1 dnl  
2 dnl    Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3 dnl  
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.
8 dnl  
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
21     yes) docbook=yes ;;
22     no)  docbook=no ;;
23     *)   AC_MSG_ERROR([bad value ${enableval} for enable-docbook option]) ;;
24   esac], docbook=no)
26   DB2X_VERSION=
27   if test x"$docbook" = x"yes"; then
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)
34     docbook_styles=
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
37       if test -f ${with_docbook_styles}/html/docbook.xsl ; then
38         docbook_styles="`(cd ${with_docbook_styles}; pwd)`"
39       else
40         AC_MSG_ERROR([${with_docbook_styles}/html directory doesn't contain docbook.xsl])
41       fi
42     else
43       AC_CACHE_CHECK([for docbook styles path],[gnash_cv_path_docbook_styles],[
44       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"
45       for i in $dirlist; do
46         if test -f $i/html/docbook.xsl; then
47           gnash_cv_path_docbook_styles="`(cd $i; pwd)`"
48         break
49         fi
50       done
51       ])
52       if test x$gnash_cv_path_docbook_styles != x; then
53         docbook_styles=$gnash_cv_path_docbook_styles
54       fi
55     fi
58     AC_MSG_NOTICE([checking for other programs needed to process the DocBook files])
59     AC_PATH_PROG(FOP, fop.sh, [],
60         [$PATH:/usr/local/fop-0.20.5/:/usr/fop-0.20.5/:/usr/local/fop:/usr/lib/java/fop])
61     if test x"$FOP" = x; then
62         AC_PATH_PROG(FOP, fop, [],
63             [$PATH:/usr/local/fop-0.20.5/:/usr/fop-0.20.5/:/usr/local/fop:/usr/lib/java/fop])
64     fi
65     if test x"$FOP" != x; then
66       dirlist="/usr /usr/lib/jre /usr/jre /opt/local/Java/JavaSDK ~/ReQuest/jre $J2REDIR"
67       JAVA=
68       for i in $dirlist; do
69         if test -f $i/bin/java; then
70           version=`$i/bin/java -version 2>&1`
71           dnl See if it's Sun Java
72           tmp="`echo $version | grep -c "java version" `"
73           if test $tmp -gt 0; then
74             version=sun
75             JAVA=$i/bin/java
76             break;
77           fi
78           dnl See if it's GCJ
79           tmp="`echo $version | grep -c "java version" `"
80           if test $tmp -gt 0; then
81             AC_MSG_WARN([$i/bin/java not Sun version!])
82             version=gcj
83           fi
84         fi
85       done
87       AC_MSG_CHECKING(for Sun java runtime)
88       if test x"$JAVA" = x; then
89         AC_MSG_RESULT(not found)
90         AC_MSG_WARN([You need to install Sun Java and the JAI toolkit to run fop])
91       else
92         AC_MSG_RESULT([$JAVA])
93       fi
94     fi
96     AC_PATH_PROG(PDFXMLTEX, pdfxmltex, [],
97         [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
99 dnl    AC_PATH_PROG(DBLATEX, dblatex, [],
100 dnl     [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
102     AC_PATH_PROG(XSLTPROC, xsltproc, [],
103         [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
105     AC_PATH_PROG(DB2X_XSLTPROC, db2x_xsltproc, [],
106      [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
108     if test x$DB2X_XSLTPROC = x; then
109       AC_PATH_PROG(DB2X_XSLTPROC, db2x_xsltproc.pl, [],
110           [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
111     fi
113     dnl Find the programs we need to convert docbook into Texi for
114     dnl making info pages. The first catagory are the wrapper
115     dnl utilities included in most docbook2x packages.
116     dnl It turns out there are two sets of wrapper functions, the good
117     dnl ones from the newer DocBook2X tools are written in perl, and
118     dnl actually work correctly. There are other versions of the same
119     dnl tools ,but they are merely a 1 line wrapper for the OpenJade
120     dnl tools. These versions have big problems, namely they don't
121     dnl support the encoding of entities, so we get massive warnings
122     dnl about entities in included files we never heard about.
123     scripts="db2x_docbook2texi docbook2texi docbook2texi.pl"
124     for i in $scripts; do
125       AC_PATH_PROG(DB2X_TEXI, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
126       if test x$DB2X_TEXI != x; then
127         type="`file $DB2X_TEXI  | grep -ic " perl " 2>&1`"
128         if test $type -gt 0; then
129           break
130         else
131           DB2X_TEXI=
132         fi
133       fi
134     done
136     dnl These look for the seperate utilities used by the wrapper
137     dnl scripts. If we don't find the wrappers, then we use the lower
138     dnl level utilities directly. 
140     scripts="db2x_texixml db2x_texixml.pl"
141     for i in $scripts; do
142       AC_PATH_PROG(DB2X_TEXIXML, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
143       if test x$DB2X_TEXIXML != x; then
144         break
145       fi
146     done
148     dnl Find the programs we need to convert docbook into man pages.
149     scripts="db2x_docbook2man docbook2man docbook2man.pl"
150     for i in $scripts; do
151       AC_PATH_PROG(DB2X_MAN, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
152       if test x$DB2X_MAN != x; then 
153         type="`file $DB2X_MAN  | grep -ic " perl " 2>&1`"
154         if test $type -gt 0; then
155           break
156         else
157           DB2X_MAN=
158         fi
159       fi
160     done
162     scripts="db2x_manxml db2x_manxml.pl"
163     for i in $scripts; do
164       AC_PATH_PROG(DB2X_MANXML, $i, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
165       if test x$DB2X_MANXML != x; then
166         break
167       fi
168     done
170     AC_PATH_PROG(MAKEINFO, makeinfo, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
172     if test x"$XSLTPROC" = x -o x"$docbook_styles" = x ; then
173       AC_MSG_WARN([You need to install xsltproc and docbook style sheets before HTML output can be generated])
174     fi
175     if test x"$DB2X_XSLTPROC" = x -o x"$DB2X_TEXIXML" = x  -o x"$DB2X_MANXML" = x -o x"$MAKEINFO" = x ; then
176       AC_MSG_WARN([You need to install the docbook2X package before Texi output can be generated])
177     fi
179     AC_PATH_PROG(DB2X_PDF, docbook2pdf, [], [$PATH:/usr/bin:/usr/bin/X11:/usr/local/X11/bin])
182     if test x"$FOP" != x -a x"$docbook_styles" != x ; then :
183     elif test x"$PDFXMLTEX" != x -a x"$XSLTPROC" != x -a x"$docbook_styles" != x ; then :
184     else
185       AC_MSG_WARN([No suitable fop nor pdfxmltex, PDF format files can't be generated - hint: apt-get install xmltex fop])
186     fi
187   fi
189 dnl  AM_CONDITIONAL(HAVE_JAVA, [test x$JAVA != x])
190   AM_CONDITIONAL(ENABLE_TEXI, [ test x"$DB2X_TEXI" != x -o x"$DB2X_TEXIXML" != x ])
191   AM_CONDITIONAL(ENABLE_PDF, [ test x"$DB2X_PDF" ])
192   AM_CONDITIONAL(ENABLE_HTML, [ test x"$XSLTPROC" != x -a x"$docbook_styles" != x ])
193   AM_CONDITIONAL(ENABLE_FOP, [ test x"$FOP" != x -a x"$docbook_styles" != x ])
194   AM_CONDITIONAL(ENABLE_XMLTEX, [ test x"$PDFXMLTEX" != x -a x"$XSLTPROC" != x -a x"$docbook_styles" != x ])
195 dnl  AM_CONDITIONAL(ENABLE_DBLATEX, [ test x"$DBLATEX" != x ])
196   AM_CONDITIONAL(ENABLE_MAN, [ test x"$DB2X_MAN" != x -o x"$DB2X_MANXML" != x ])
197   AC_SUBST(JAVA)
199 dnl See which version of the DocBook2x tools we have, because it
200 dnl forces a command line change in the Makefile.
202 dnl db2x_texixml (part of docbook2X 0.8.3)
203 dnl db2x_texixml (part of docbook2X 0.8.5)
204 dnl docbook2texi (part of docbook2X 0.8.8)
205   if test x"${DB2X_TEXIXML}" != x; then
206     db2x_version=`${DB2X_TEXIXML} --version | head -1 | sed -e 's/^.*docbook2X //' -e 's/).*$//' 2>&1`
207     DB2X_VERSION="${db2x_version}"
208     AC_SUBST(DB2X_VERSION)
209   fi
211 dnl  AM_CONDITIONAL(NEW_DOCBOOK2X, [test "$db2x_version" = "0.8.5"])
212   AC_SUBST(docbook_styles)
213   AC_SUBST(XSLTPROC)
214   AC_SUBST(DB2X_XSLTPROC)
215   AC_SUBST(DB2X_TEXIXML)
216   AC_SUBST(PDFXMLTEX)
217   AC_SUBST(FOP)
220 # Local Variables:
221 # c-basic-offset: 2
222 # tab-width: 2
223 # indent-tabs-mode: nil
224 # End: