Include program counter on action limit notification log
[gnash.git] / macros / docbook.m4
blobe757b91e96a5e64289f508fcf18106b6a9a00966
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 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)
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 dnl## {
38       if test -f ${with_docbook_styles}/html/docbook.xsl ; then dnl## {
39         docbook_styles="`(cd ${with_docbook_styles}; pwd)`"
40       else dnl## }{
41         AC_MSG_ERROR([${with_docbook_styles}/html directory doesn't contain docbook.xsl])
42       fi dnl## }
44     else dnl## }{
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"
47       for i in $dirlist; do
48         if test -f $i/html/docbook.xsl; then
49           gnash_cv_path_docbook_styles="`(cd $i; pwd)`"
50           break
51         fi
52       done
53       ])
55       if test x$gnash_cv_path_docbook_styles != x; then dnl## {
56         docbook_styles=$gnash_cv_path_docbook_styles
57       fi dnl## }
59     fi dnl## }
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])
68     fi dnl## }
70     if test x"$FOP" != x; then dnl## {
71       dirlist="/usr /usr/lib/jre /usr/jre /opt/local/Java/JavaSDK ~/ReQuest/jre $J2REDIR"
72       JAVA=
73       for i in $dirlist; do
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## {
79             version=sun
80             JAVA=$i/bin/java
81             break;
82           fi dnl## }
84           dnl See if it's GCJ
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!])
88             version=gcj
89           fi dnl## }
91         fi dnl## }
93       done
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])
99       else dnl## }{
100         AC_MSG_RESULT([$JAVA])
101       fi dnl## }
103     fi dnl## }
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])
120     fi dnl## }
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
138           break
139         else
140           DB2X_TEXI=
141         fi
142       fi
143     done dnl## }
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
153         break
154       fi
155     done
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
164           break
165         else
166           DB2X_MAN=
167         fi
168       fi
169     done
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
175         break
176       fi
177     done
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])
183     fi
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])
187     fi
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 :
194     else
195       AC_MSG_WARN([No suitable fop nor pdfxmltex, PDF format files can't be generated - hint: apt-get install xmltex fop])
196     fi
198   fi dnl## }
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 ])
208   AC_SUBST(JAVA)
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)
220   fi dnl## }
222 dnl  AM_CONDITIONAL(NEW_DOCBOOK2X, [test "$db2x_version" = "0.8.5"])
223   AC_SUBST(docbook_styles)
224   AC_SUBST(XSLTPROC)
225   AC_SUBST(DB2X_XSLTPROC)
226   AC_SUBST(DB2X_TEXIXML)
227   AC_SUBST(PDFXMLTEX)
228   AC_SUBST(FOP)
231 # Local Variables:
232 # c-basic-offset: 2
233 # tab-width: 2
234 # indent-tabs-mode: nil
235 # End: