2 dnl check where to install documentation
4 dnl determines documentation "root directory", i.e. the directory
5 dnl where all documentation will be placed in
8 AC_DEFUN([GP_CHECK_DOCDIR],
11 AC_ARG_WITH(doc-dir, [ --with-doc-dir=PATH Where to install docs [default=autodetect]])dnl
13 # check for the main ("root") documentation directory
14 AC_MSG_CHECKING([main docdir])
16 if test "x${with_doc_dir}" != "x"
17 then # docdir is given as parameter
18 docdir="${with_doc_dir}"
19 AC_MSG_RESULT([${docdir} (from parameter)])
20 else # otherwise invent a docdir hopefully compatible with system policy
21 if test -d "/usr/share/doc"
23 maindocdir='${prefix}/share/doc'
24 AC_MSG_RESULT([${maindocdir} (FHS style)])
25 elif test -d "/usr/doc"
27 maindocdir='${prefix}/doc'
28 AC_MSG_RESULT([${maindocdir} (old style)])
30 maindocdir='${datadir}/doc'
31 AC_MSG_RESULT([${maindocdir} (default value)])
33 AC_MSG_CHECKING(package docdir)
34 # check whether to include package version into documentation path
35 # FIXME: doesn't work properly.
36 if ls -d /usr/{share/,}doc/*-[[]0-9[]]* > /dev/null 2>&1
38 docdir="${maindocdir}/${PACKAGE}-${VERSION}"
39 AC_MSG_RESULT([${docdir} (redhat style)])
41 docdir="${maindocdir}/${PACKAGE}"
42 AC_MSG_RESULT([${docdir} (default style)])
50 dnl Solaris hack for grep and tr
51 AC_DEFUN([GP_CHECK_TR],
53 if test -n "`echo $host_os | grep '[sS]olaris'`"; then
55 GREP=/usr/xpg4/bin/grep
63 dnl check whether to build docs and where to:
65 dnl * determine presence of prerequisites (only gtk-doc for now)
66 dnl * determine destination directory for HTML files
69 AC_DEFUN([GP_BUILD_DOCS],
71 # doc dir has to be determined in advance
72 AC_REQUIRE([GP_CHECK_DOCDIR])
73 AC_REQUIRE([GP_CHECK_GTK_DOC])
74 AC_REQUIRE([GP_CHECK_FIG2DEV])
75 AC_REQUIRE([GP_CHECK_DOCBOOK_XML])
76 AC_REQUIRE([GP_CHECK_TR])
77 AC_REQUIRE([GP_CHECK_PSTOIMG])
78 AC_REQUIRE([GP_CHECK_DOT])
79 AC_REQUIRE([GP_CHECK_W3M])
81 gphoto2xml='$(top_srcdir)/src/gphoto2.xml'
84 dnl ---------------------------------------------------------------------------
85 dnl Give the user the possibility to install documentation in
86 dnl user-defined locations.
87 dnl ---------------------------------------------------------------------------
88 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Where to install html docs [default=autodetect]])
89 AC_MSG_CHECKING([for html dir])
90 if test "x${with_html_dir}" = "x" ; then
91 htmldir="${docdir}/html"
92 AC_MSG_RESULT([${htmldir} (default)])
94 htmldir="${with_html_dir}"
95 AC_MSG_RESULT([${htmldir} (from parameter)])
99 AC_ARG_WITH(xhtml-dir, [ --with-xhtml-dir=PATH Where to install xhtml docs [default=autodetect]])
100 AC_MSG_CHECKING([for xhtml dir])
101 if test "x${with_xhtml_dir}" = "x" ; then
102 xhtmldir="${docdir}/xhtml"
103 AC_MSG_RESULT([${xhtmldir} (default)])
105 xhtmldir="${with_xhtml_dir}"
106 AC_MSG_RESULT([${xhtmldir} (from parameter)])
110 AC_ARG_WITH(html-nochunks-dir, [ --with-html-nochunks-dir=PATH Where to install html-nochunks docs [default=autodetect]])
111 AC_MSG_CHECKING([for html-nochunks dir])
112 if test "x${with_html_nochunks_dir}" = "x" ; then
113 htmlnochunksdir="${docdir}/html-nochunks"
114 AC_MSG_RESULT([${htmlnochunksdir} (default)])
116 htmlnochunksdir="${with_html_nochunks_dir}"
117 AC_MSG_RESULT([${htmlnochunksdir} (from parameter)])
119 AC_SUBST(htmlnochunksdir)
121 AC_ARG_WITH(xhtml-nochunks-dir, [ --with-xhtml-nochunks-dir=PATH Where to install xhtml-nochunks docs [default=autodetect]])
122 AC_MSG_CHECKING([for xhtml-nochunks dir])
123 if test "x${with_xhtml_nochunks_dir}" = "x" ; then
124 xhtmlnochunksdir="${docdir}/xhtml-nochunks"
125 AC_MSG_RESULT([${xhtmlnochunksdir} (default)])
127 xhtmlnochunksdir="${with_xhtml_nochunks_dir}"
128 AC_MSG_RESULT([${xhtmlnochunksdir} (from parameter)])
130 AC_SUBST(xhtmlnochunksdir)
132 AC_ARG_WITH(xml-dir, [ --with-xml-dir=PATH Where to install xml docs [default=autodetect]])
133 AC_MSG_CHECKING([for xml dir])
134 if test "x${with_xml_dir}" = "x" ; then
135 xmldir="${docdir}/xml"
136 AC_MSG_RESULT([${xmldir} (default)])
138 xmldir="${with_xml_dir}"
139 AC_MSG_RESULT([${xmldir} (from parameter)])
142 xmlcssdir="${xmldir}/css"
145 AC_ARG_WITH(txt-dir, [ --with-txt-dir=PATH Where to install txt docs [default=autodetect]])
146 AC_MSG_CHECKING([for txt dir])
147 if test "x${with_txt_dir}" = "x" ; then
148 txtdir="${docdir}/txt"
149 AC_MSG_RESULT([${txtdir} (default)])
151 txtdir="${with_txt_dir}"
152 AC_MSG_RESULT([${txtdir} (from parameter)])
156 AC_ARG_WITH(man-dir, [ --with-man-dir=PATH Where to install man docs [default=autodetect]])
157 AC_MSG_CHECKING([for man dir])
158 if test "x${with_man_dir}" = "x" ; then
159 manmandir="${docdir}/man"
160 AC_MSG_RESULT([${manmandir} (default)])
162 manmandir="${with_man_dir}"
163 AC_MSG_RESULT([${manmandir} (from parameter)])
167 AC_ARG_WITH(pdf-dir, [ --with-pdf-dir=PATH Where to install pdf docs [default=autodetect]])
168 AC_MSG_CHECKING([for pdf dir])
169 if test "x${with_pdf_dir}" = "x" ; then
170 pdfdir="${docdir}/pdf"
171 AC_MSG_RESULT([${pdfdir} (default)])
173 pdfdir="${with_pdf_dir}"
174 AC_MSG_RESULT([${pdfdir} (from parameter)])
178 AC_ARG_WITH(ps-dir, [ --with-ps-dir=PATH Where to install ps docs [default=autodetect]])
179 AC_MSG_CHECKING([for ps dir])
180 if test "x${with_ps_dir}" = "x" ; then
182 AC_MSG_RESULT([${psdir} (default)])
184 psdir="${with_ps_dir}"
185 AC_MSG_RESULT([${psdir} (from parameter)])
189 AC_ARG_WITH(figure-dir, [ --with-figure-dir=PATH Where to install figures [default=autodetect]])
190 AC_MSG_CHECKING([for figure dir])
191 if test "x${with_figure_dir}" = "x" ; then
192 figuredir="${docdir}/figures"
193 AC_MSG_RESULT([${figuredir} (default)])
195 figuredir="${with_figure_dir}"
196 AC_MSG_RESULT([${figuredir} (from parameter)])
200 AC_ARG_WITH(screenshots-dir, [ --with-screenshots-dir=PATH Where to install screenshotss [default=autodetect]])
201 AC_MSG_CHECKING([for screenshots dir])
202 if test "x${with_screenshots_dir}" = "x" ; then
203 screenshotsdir="${docdir}/screenshots"
204 AC_MSG_RESULT([${screenshotsdir} (default)])
206 screenshotsdir="${with_screenshots_dir}"
207 AC_MSG_RESULT([${screenshotsdir} (from parameter)])
209 AC_SUBST(screenshotsdir)
210 screenshotsgtkamdir="${screenshotsdir}/gtkam"
211 AC_SUBST(screenshotsgtkamdir)
213 doc_formats_list='man html txt ps pdf'
215 # initialize have_xmlto* to false
216 for i in $doc_formats_list; do
217 d=`echo $i | $TR A-Z a-z`
218 eval "have_xmlto$d=false"
221 AC_MSG_CHECKING(checking doc formats)
222 AC_ARG_WITH(doc_formats,
223 [ --with-doc-formats=<list> create doc with format in <list>; ]
224 [ 'all' build all doc formats; ]
225 [ possible formats are: ]
226 [ man, html, ps, pdf ],
227 doc_formats="$withval", doc_formats="man html txt")
229 if test "$doc_formats" = "all"; then
230 doc_formats=$doc_formats_list
232 doc_formats=`echo $doc_formats | sed 's/,/ /g'`
235 # set have_xmlto* to true if requested and possible
237 for i in $doc_formats; do
238 if test -n "`echo $doc_formats_list | $GREP -E \"(^| )$i( |\$)\"`"; then
239 eval "have_xmlto$i=true"
241 AC_ERROR(Unknown doc format $i!)
244 AC_MSG_RESULT($doc_formats)
246 AC_MSG_RESULT([deactivated (requires xmlto)])
249 # Make sure that xmltopdf actually works
250 if $have_xmltopdf; then
251 AC_MSG_CHECKING([whether pdf creation works])
253 top_srcdir() { echo "$srcdir"; }
257 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
258 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
261 <title>Foo Title</title>
263 <chapter id="foochapter">
264 <title>Foo Chapter</title>
267 <!--ulink url="https://www.hypothetical-url.invalid/with&ersand">ampersand</ulink-->.
272 ${PURE_XMLTO} pdf -o . test-db.xml --searchpath ..
273 if test -s test-db.pdf; then
274 AC_MSG_RESULT([yes, look at $(pwd)/test-db.pdf to verify])
276 if $have_xmltopdf; then
277 AC_MSG_ERROR([PDF creation requested, but failed. See $(pwd) ...])
279 AC_MSG_RESULT([no, but not requested])
286 AM_CONDITIONAL(XMLTOHTML,$have_xmltohtml)
287 AM_CONDITIONAL(XMLTOMAN,$have_xmltoman)
288 AM_CONDITIONAL(XMLTOTXT,$have_xmltotxt)
289 AM_CONDITIONAL(XMLTOTXT2,$have_xmltotxt && $have_w3m)
290 AM_CONDITIONAL(XMLTOPDF,$have_xmltopdf)
291 AM_CONDITIONAL(XMLTOPS,$have_xmltops)
293 # create list of supported formats
294 AC_MSG_CHECKING([for manual formats to recreate])
299 if $have_xmltohtml; then
302 if $have_xmltoman; then
305 if $have_xmltopdf; then
308 if $have_xmltops; then
311 if $have_xmltotxt; then
314 AC_SUBST(manual_html)
319 if test "x$xxx" != "x"
321 if $have_fig2dev; then
326 manual_msg="in (${xxx} ) formats with${fig_out} figures"