]> git.meshlink.io Git - meshlink/blob - m4/ax_prog_doxygen.m4
Ensure aux field is initialized in RST packets.
[meshlink] / m4 / ax_prog_doxygen.m4
1 # ===========================================================================
2 #     https://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 #   DX_INIT_DOXYGEN(PROJECT-NAME, [DOXYFILE-PATH], [OUTPUT-DIR], ...)
8 #   DX_DOXYGEN_FEATURE(ON|OFF)
9 #   DX_DOT_FEATURE(ON|OFF)
10 #   DX_HTML_FEATURE(ON|OFF)
11 #   DX_CHM_FEATURE(ON|OFF)
12 #   DX_CHI_FEATURE(ON|OFF)
13 #   DX_MAN_FEATURE(ON|OFF)
14 #   DX_RTF_FEATURE(ON|OFF)
15 #   DX_XML_FEATURE(ON|OFF)
16 #   DX_PDF_FEATURE(ON|OFF)
17 #   DX_PS_FEATURE(ON|OFF)
18 #
19 # DESCRIPTION
20 #
21 #   The DX_*_FEATURE macros control the default setting for the given
22 #   Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
23 #   generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
24 #   help (for MS users), 'CHI' for generating a separate .chi file by the
25 #   .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
26 #   output formats. The environment variable DOXYGEN_PAPER_SIZE may be
27 #   specified to override the default 'a4wide' paper size.
28 #
29 #   By default, HTML, PDF and PS documentation is generated as this seems to
30 #   be the most popular and portable combination. MAN pages created by
31 #   Doxygen are usually problematic, though by picking an appropriate subset
32 #   and doing some massaging they might be better than nothing. CHM and RTF
33 #   are specific for MS (note that you can't generate both HTML and CHM at
34 #   the same time). The XML is rather useless unless you apply specialized
35 #   post-processing to it.
36 #
37 #   The macros mainly control the default state of the feature. The use can
38 #   override the default by specifying --enable or --disable. The macros
39 #   ensure that contradictory flags are not given (e.g.,
40 #   --enable-doxygen-html and --enable-doxygen-chm,
41 #   --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each
42 #   feature will be automatically disabled (with a warning) if the required
43 #   programs are missing.
44 #
45 #   Once all the feature defaults have been specified, call DX_INIT_DOXYGEN
46 #   with the following parameters: a one-word name for the project for use
47 #   as a filename base etc., an optional configuration file name (the
48 #   default is '$(srcdir)/Doxyfile', the same as Doxygen's default), and an
49 #   optional output directory name (the default is 'doxygen-doc'). To run
50 #   doxygen multiple times for different configuration files and output
51 #   directories provide more parameters: the second, forth, sixth, etc
52 #   parameter are configuration file names and the third, fifth, seventh,
53 #   etc parameter are output directories. No checking is done to catch
54 #   duplicates.
55 #
56 #   Automake Support
57 #
58 #   The DX_RULES substitution can be used to add all needed rules to the
59 #   Makefile. Note that this is a substitution without being a variable:
60 #   only the @DX_RULES@ syntax will work.
61 #
62 #   The provided targets are:
63 #
64 #     doxygen-doc: Generate all doxygen documentation.
65 #
66 #     doxygen-run: Run doxygen, which will generate some of the
67 #                  documentation (HTML, CHM, CHI, MAN, RTF, XML)
68 #                  but will not do the post processing required
69 #                  for the rest of it (PS, PDF).
70 #
71 #     doxygen-ps:  Generate doxygen PostScript documentation.
72 #
73 #     doxygen-pdf: Generate doxygen PDF documentation.
74 #
75 #   Note that by default these are not integrated into the automake targets.
76 #   If doxygen is used to generate man pages, you can achieve this
77 #   integration by setting man3_MANS to the list of man pages generated and
78 #   then adding the dependency:
79 #
80 #     $(man3_MANS): doxygen-doc
81 #
82 #   This will cause make to run doxygen and generate all the documentation.
83 #
84 #   The following variable is intended for use in Makefile.am:
85 #
86 #     DX_CLEANFILES = everything to clean.
87 #
88 #   Then add this variable to MOSTLYCLEANFILES.
89 #
90 # LICENSE
91 #
92 #   Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
93 #   Copyright (c) 2015 Olaf Mandel <olaf@mandel.name>
94 #
95 #   Copying and distribution of this file, with or without modification, are
96 #   permitted in any medium without royalty provided the copyright notice
97 #   and this notice are preserved. This file is offered as-is, without any
98 #   warranty.
99
100 #serial 24
101
102 ## ----------##
103 ## Defaults. ##
104 ## ----------##
105
106 DX_ENV=""
107 AC_DEFUN([DX_FEATURE_doc],  ON)
108 AC_DEFUN([DX_FEATURE_dot],  OFF)
109 AC_DEFUN([DX_FEATURE_man],  OFF)
110 AC_DEFUN([DX_FEATURE_html], ON)
111 AC_DEFUN([DX_FEATURE_chm],  OFF)
112 AC_DEFUN([DX_FEATURE_chi],  OFF)
113 AC_DEFUN([DX_FEATURE_rtf],  OFF)
114 AC_DEFUN([DX_FEATURE_xml],  OFF)
115 AC_DEFUN([DX_FEATURE_pdf],  ON)
116 AC_DEFUN([DX_FEATURE_ps],   ON)
117
118 ## --------------- ##
119 ## Private macros. ##
120 ## --------------- ##
121
122 # DX_ENV_APPEND(VARIABLE, VALUE)
123 # ------------------------------
124 # Append VARIABLE="VALUE" to DX_ENV for invoking doxygen and add it
125 # as a substitution (but not a Makefile variable). The substitution
126 # is skipped if the variable name is VERSION.
127 AC_DEFUN([DX_ENV_APPEND],
128 [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])dnl
129 m4_if([$1], [VERSION], [], [AC_SUBST([$1], [$2])dnl
130 AM_SUBST_NOTMAKE([$1])])dnl
131 ])
132
133 # DX_DIRNAME_EXPR
134 # ---------------
135 # Expand into a shell expression prints the directory part of a path.
136 AC_DEFUN([DX_DIRNAME_EXPR],
137          [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
138
139 # DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
140 # -------------------------------------
141 # Expands according to the M4 (static) status of the feature.
142 AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
143
144 # DX_REQUIRE_PROG(VARIABLE, PROGRAM)
145 # ----------------------------------
146 # Require the specified program to be found for the DX_CURRENT_FEATURE to work.
147 AC_DEFUN([DX_REQUIRE_PROG], [
148 AC_PATH_TOOL([$1], [$2])
149 if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
150     AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
151     AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
152 fi
153 ])
154
155 # DX_TEST_FEATURE(FEATURE)
156 # ------------------------
157 # Expand to a shell expression testing whether the feature is active.
158 AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
159
160 # DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
161 # -------------------------------------------------
162 # Verify that a required features has the right state before trying to turn on
163 # the DX_CURRENT_FEATURE.
164 AC_DEFUN([DX_CHECK_DEPEND], [
165 test "$DX_FLAG_$1" = "$2" \
166 || AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
167                             requires, contradicts) doxygen-$1])
168 ])
169
170 # DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
171 # ----------------------------------------------------------
172 # Turn off the DX_CURRENT_FEATURE if the required feature is off.
173 AC_DEFUN([DX_CLEAR_DEPEND], [
174 test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
175 ])
176
177 # DX_FEATURE_ARG(FEATURE, DESCRIPTION,
178 #                CHECK_DEPEND, CLEAR_DEPEND,
179 #                REQUIRE, DO-IF-ON, DO-IF-OFF)
180 # --------------------------------------------
181 # Parse the command-line option controlling a feature. CHECK_DEPEND is called
182 # if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
183 # otherwise CLEAR_DEPEND is called to turn off the default state if a required
184 # feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
185 # requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
186 # DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
187 AC_DEFUN([DX_ARG_ABLE], [
188     AC_DEFUN([DX_CURRENT_FEATURE], [$1])
189     AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
190     AC_ARG_ENABLE(doxygen-$1,
191                   [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
192                                                       [--enable-doxygen-$1]),
193                                   DX_IF_FEATURE([$1], [don't $2], [$2]))],
194                   [
195 case "$enableval" in
196 #(
197 y|Y|yes|Yes|YES)
198     AC_SUBST([DX_FLAG_$1], 1)
199     $3
200 ;; #(
201 n|N|no|No|NO)
202     AC_SUBST([DX_FLAG_$1], 0)
203 ;; #(
204 *)
205     AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
206 ;;
207 esac
208 ], [
209 AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
210 $4
211 ])
212 if DX_TEST_FEATURE([$1]); then
213     $5
214     :
215 fi
216 if DX_TEST_FEATURE([$1]); then
217     $6
218     :
219 else
220     $7
221     :
222 fi
223 ])
224
225 ## -------------- ##
226 ## Public macros. ##
227 ## -------------- ##
228
229 # DX_XXX_FEATURE(DEFAULT_STATE)
230 # -----------------------------
231 AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc],  [$1])])
232 AC_DEFUN([DX_DOT_FEATURE],     [AC_DEFUN([DX_FEATURE_dot], [$1])])
233 AC_DEFUN([DX_MAN_FEATURE],     [AC_DEFUN([DX_FEATURE_man],  [$1])])
234 AC_DEFUN([DX_HTML_FEATURE],    [AC_DEFUN([DX_FEATURE_html], [$1])])
235 AC_DEFUN([DX_CHM_FEATURE],     [AC_DEFUN([DX_FEATURE_chm],  [$1])])
236 AC_DEFUN([DX_CHI_FEATURE],     [AC_DEFUN([DX_FEATURE_chi],  [$1])])
237 AC_DEFUN([DX_RTF_FEATURE],     [AC_DEFUN([DX_FEATURE_rtf],  [$1])])
238 AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
239 AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
240 AC_DEFUN([DX_PDF_FEATURE],     [AC_DEFUN([DX_FEATURE_pdf],  [$1])])
241 AC_DEFUN([DX_PS_FEATURE],      [AC_DEFUN([DX_FEATURE_ps],   [$1])])
242
243 # DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR], ...)
244 # --------------------------------------------------------------
245 # PROJECT also serves as the base name for the documentation files.
246 # The default CONFIG-FILE is "$(srcdir)/Doxyfile" and OUTPUT-DOC-DIR is
247 # "doxygen-doc".
248 # More arguments are interpreted as interleaved CONFIG-FILE and
249 # OUTPUT-DOC-DIR values.
250 AC_DEFUN([DX_INIT_DOXYGEN], [
251
252 # Files:
253 AC_SUBST([DX_PROJECT], [$1])
254 AC_SUBST([DX_CONFIG], ['ifelse([$2], [], [$(srcdir)/Doxyfile], [$2])'])
255 AC_SUBST([DX_DOCDIR], ['ifelse([$3], [], [doxygen-doc], [$3])'])
256 m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2,
257       [AC_SUBST([DX_CONFIG]m4_eval(DX_i[/2]),
258                 'm4_default_nblank_quoted(m4_argn(DX_i, $@),
259                                           [$(srcdir)/Doxyfile])')])])dnl
260 m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 5, m4_count($@,), 2,
261       [AC_SUBST([DX_DOCDIR]m4_eval([(]DX_i[-1)/2]),
262                 'm4_default_nblank_quoted(m4_argn(DX_i, $@),
263                                           [doxygen-doc])')])])dnl
264 m4_define([DX_loop], m4_dquote(m4_if(m4_eval(3 < m4_count($@)), 1,
265           [m4_for([DX_i], 4, m4_count($@), 2, [, m4_eval(DX_i[/2])])],
266           [])))dnl
267
268 # Environment variables used inside doxygen.cfg:
269 DX_ENV_APPEND(SRCDIR, $srcdir)
270 DX_ENV_APPEND(PROJECT, $DX_PROJECT)
271 DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
272
273 # Doxygen itself:
274 DX_ARG_ABLE(doc, [generate any doxygen documentation],
275             [],
276             [],
277             [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
278              DX_REQUIRE_PROG([DX_PERL], perl)],
279             [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
280
281 # Dot for graphics:
282 DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
283             [DX_CHECK_DEPEND(doc, 1)],
284             [DX_CLEAR_DEPEND(doc, 1)],
285             [DX_REQUIRE_PROG([DX_DOT], dot)],
286             [DX_ENV_APPEND(HAVE_DOT, YES)
287              DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
288             [DX_ENV_APPEND(HAVE_DOT, NO)])
289
290 # Man pages generation:
291 DX_ARG_ABLE(man, [generate doxygen manual pages],
292             [DX_CHECK_DEPEND(doc, 1)],
293             [DX_CLEAR_DEPEND(doc, 1)],
294             [],
295             [DX_ENV_APPEND(GENERATE_MAN, YES)],
296             [DX_ENV_APPEND(GENERATE_MAN, NO)])
297
298 # RTF file generation:
299 DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
300             [DX_CHECK_DEPEND(doc, 1)],
301             [DX_CLEAR_DEPEND(doc, 1)],
302             [],
303             [DX_ENV_APPEND(GENERATE_RTF, YES)],
304             [DX_ENV_APPEND(GENERATE_RTF, NO)])
305
306 # XML file generation:
307 DX_ARG_ABLE(xml, [generate doxygen XML documentation],
308             [DX_CHECK_DEPEND(doc, 1)],
309             [DX_CLEAR_DEPEND(doc, 1)],
310             [],
311             [DX_ENV_APPEND(GENERATE_XML, YES)],
312             [DX_ENV_APPEND(GENERATE_XML, NO)])
313
314 # (Compressed) HTML help generation:
315 DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
316             [DX_CHECK_DEPEND(doc, 1)],
317             [DX_CLEAR_DEPEND(doc, 1)],
318             [DX_REQUIRE_PROG([DX_HHC], hhc)],
319             [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
320              DX_ENV_APPEND(GENERATE_HTML, YES)
321              DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
322             [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
323
324 # Separate CHI file generation.
325 DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file],
326             [DX_CHECK_DEPEND(chm, 1)],
327             [DX_CLEAR_DEPEND(chm, 1)],
328             [],
329             [DX_ENV_APPEND(GENERATE_CHI, YES)],
330             [DX_ENV_APPEND(GENERATE_CHI, NO)])
331
332 # Plain HTML pages generation:
333 DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
334             [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
335             [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
336             [],
337             [DX_ENV_APPEND(GENERATE_HTML, YES)],
338             [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
339
340 # PostScript file generation:
341 DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
342             [DX_CHECK_DEPEND(doc, 1)],
343             [DX_CLEAR_DEPEND(doc, 1)],
344             [DX_REQUIRE_PROG([DX_LATEX], latex)
345              DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
346              DX_REQUIRE_PROG([DX_DVIPS], dvips)
347              DX_REQUIRE_PROG([DX_EGREP], egrep)])
348
349 # PDF file generation:
350 DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
351             [DX_CHECK_DEPEND(doc, 1)],
352             [DX_CLEAR_DEPEND(doc, 1)],
353             [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
354              DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
355              DX_REQUIRE_PROG([DX_EGREP], egrep)])
356
357 # LaTeX generation for PS and/or PDF:
358 if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
359     DX_ENV_APPEND(GENERATE_LATEX, YES)
360 else
361     DX_ENV_APPEND(GENERATE_LATEX, NO)
362 fi
363
364 # Paper size for PS and/or PDF:
365 AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
366            [a4wide (default), a4, letter, legal or executive])
367 case "$DOXYGEN_PAPER_SIZE" in
368 #(
369 "")
370     AC_SUBST(DOXYGEN_PAPER_SIZE, "")
371 ;; #(
372 a4wide|a4|letter|legal|executive)
373     DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
374 ;; #(
375 *)
376     AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
377 ;;
378 esac
379
380 # Rules:
381 AS_IF([[test $DX_FLAG_html -eq 1]],
382 [[DX_SNIPPET_html="## ------------------------------- ##
383 ## Rules specific for HTML output. ##
384 ## ------------------------------- ##
385
386 DX_CLEAN_HTML = \$(DX_DOCDIR)/html]dnl
387 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
388                 \$(DX_DOCDIR]DX_i[)/html]])[
389
390 "]],
391 [[DX_SNIPPET_html=""]])
392 AS_IF([[test $DX_FLAG_chi -eq 1]],
393 [[DX_SNIPPET_chi="
394 DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi]dnl
395 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
396                \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).chi]])["]],
397 [[DX_SNIPPET_chi=""]])
398 AS_IF([[test $DX_FLAG_chm -eq 1]],
399 [[DX_SNIPPET_chm="## ------------------------------ ##
400 ## Rules specific for CHM output. ##
401 ## ------------------------------ ##
402
403 DX_CLEAN_CHM = \$(DX_DOCDIR)/chm]dnl
404 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
405                \$(DX_DOCDIR]DX_i[)/chm]])[\
406 ${DX_SNIPPET_chi}
407
408 "]],
409 [[DX_SNIPPET_chm=""]])
410 AS_IF([[test $DX_FLAG_man -eq 1]],
411 [[DX_SNIPPET_man="## ------------------------------ ##
412 ## Rules specific for MAN output. ##
413 ## ------------------------------ ##
414
415 DX_CLEAN_MAN = \$(DX_DOCDIR)/man]dnl
416 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
417                \$(DX_DOCDIR]DX_i[)/man]])[
418
419 "]],
420 [[DX_SNIPPET_man=""]])
421 AS_IF([[test $DX_FLAG_rtf -eq 1]],
422 [[DX_SNIPPET_rtf="## ------------------------------ ##
423 ## Rules specific for RTF output. ##
424 ## ------------------------------ ##
425
426 DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf]dnl
427 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
428                \$(DX_DOCDIR]DX_i[)/rtf]])[
429
430 "]],
431 [[DX_SNIPPET_rtf=""]])
432 AS_IF([[test $DX_FLAG_xml -eq 1]],
433 [[DX_SNIPPET_xml="## ------------------------------ ##
434 ## Rules specific for XML output. ##
435 ## ------------------------------ ##
436
437 DX_CLEAN_XML = \$(DX_DOCDIR)/xml]dnl
438 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
439                \$(DX_DOCDIR]DX_i[)/xml]])[
440
441 "]],
442 [[DX_SNIPPET_xml=""]])
443 AS_IF([[test $DX_FLAG_ps -eq 1]],
444 [[DX_SNIPPET_ps="## ----------------------------- ##
445 ## Rules specific for PS output. ##
446 ## ----------------------------- ##
447
448 DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps]dnl
449 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
450               \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps]])[
451
452 DX_PS_GOAL = doxygen-ps
453
454 doxygen-ps: \$(DX_CLEAN_PS)
455
456 ]m4_foreach([DX_i], [DX_loop],
457 [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag
458         \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\
459         rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\
460         \$(DX_LATEX) refman.tex; \\
461         \$(DX_MAKEINDEX) refman.idx; \\
462         \$(DX_LATEX) refman.tex; \\
463         countdown=5; \\
464         while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\
465                           refman.log > /dev/null 2>&1 \\
466            && test \$\$countdown -gt 0; do \\
467             \$(DX_LATEX) refman.tex; \\
468             countdown=\`expr \$\$countdown - 1\`; \\
469         done; \\
470         \$(DX_DVIPS) -o ../\$(PACKAGE).ps refman.dvi
471
472 ]])["]],
473 [[DX_SNIPPET_ps=""]])
474 AS_IF([[test $DX_FLAG_pdf -eq 1]],
475 [[DX_SNIPPET_pdf="## ------------------------------ ##
476 ## Rules specific for PDF output. ##
477 ## ------------------------------ ##
478
479 DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf]dnl
480 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
481                \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf]])[
482
483 DX_PDF_GOAL = doxygen-pdf
484
485 doxygen-pdf: \$(DX_CLEAN_PDF)
486
487 ]m4_foreach([DX_i], [DX_loop],
488 [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag
489         \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\
490         rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\
491         \$(DX_PDFLATEX) refman.tex; \\
492         \$(DX_MAKEINDEX) refman.idx; \\
493         \$(DX_PDFLATEX) refman.tex; \\
494         countdown=5; \\
495         while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\
496                           refman.log > /dev/null 2>&1 \\
497            && test \$\$countdown -gt 0; do \\
498             \$(DX_PDFLATEX) refman.tex; \\
499             countdown=\`expr \$\$countdown - 1\`; \\
500         done; \\
501         mv refman.pdf ../\$(PACKAGE).pdf
502
503 ]])["]],
504 [[DX_SNIPPET_pdf=""]])
505 AS_IF([[test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1]],
506 [[DX_SNIPPET_latex="## ------------------------------------------------- ##
507 ## Rules specific for LaTeX (shared for PS and PDF). ##
508 ## ------------------------------------------------- ##
509
510 DX_V_LATEX = \$(_DX_v_LATEX_\$(V))
511 _DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY))
512 _DX_v_LATEX_0 = @echo \"  LATEX \" \$][@;
513
514 DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex]dnl
515 m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
516                  \$(DX_DOCDIR]DX_i[)/latex]])[
517
518 "]],
519 [[DX_SNIPPET_latex=""]])
520
521 AS_IF([[test $DX_FLAG_doc -eq 1]],
522 [[DX_SNIPPET_doc="## --------------------------------- ##
523 ## Format-independent Doxygen rules. ##
524 ## --------------------------------- ##
525
526 ${DX_SNIPPET_html}\
527 ${DX_SNIPPET_chm}\
528 ${DX_SNIPPET_man}\
529 ${DX_SNIPPET_rtf}\
530 ${DX_SNIPPET_xml}\
531 ${DX_SNIPPET_ps}\
532 ${DX_SNIPPET_pdf}\
533 ${DX_SNIPPET_latex}\
534 DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V))
535 _DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY))
536 _DX_v_DXGEN_0 = @echo \"  DXGEN \" \$<;
537
538 .PHONY: doxygen-run doxygen-doc \$(DX_PS_GOAL) \$(DX_PDF_GOAL)
539
540 .INTERMEDIATE: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL)
541
542 doxygen-run:]m4_foreach([DX_i], [DX_loop],
543                          [[ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag]])[
544
545 doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL)
546
547 ]m4_foreach([DX_i], [DX_loop],
548 [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag: \$(DX_CONFIG]DX_i[) \$(pkginclude_HEADERS)
549         \$(A""M_V_at)rm -rf \$(DX_DOCDIR]DX_i[)
550         \$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR]DX_i[) \$(DX_DOXYGEN) \$(DX_CONFIG]DX_i[)
551         \$(A""M_V_at)echo Timestamp >\$][@
552
553 ]])dnl
554 [DX_CLEANFILES = \\]
555 m4_foreach([DX_i], [DX_loop],
556 [[      \$(DX_DOCDIR]DX_i[)/doxygen_sqlite3.db \\
557         \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\
558 ]])dnl
559 [       -r \\
560         \$(DX_CLEAN_HTML) \\
561         \$(DX_CLEAN_CHM) \\
562         \$(DX_CLEAN_CHI) \\
563         \$(DX_CLEAN_MAN) \\
564         \$(DX_CLEAN_RTF) \\
565         \$(DX_CLEAN_XML) \\
566         \$(DX_CLEAN_PS) \\
567         \$(DX_CLEAN_PDF) \\
568         \$(DX_CLEAN_LATEX)"]],
569 [[DX_SNIPPET_doc=""]])
570 AC_SUBST([DX_RULES],
571 ["${DX_SNIPPET_doc}"])dnl
572 AM_SUBST_NOTMAKE([DX_RULES])
573
574 #For debugging:
575 #echo DX_FLAG_doc=$DX_FLAG_doc
576 #echo DX_FLAG_dot=$DX_FLAG_dot
577 #echo DX_FLAG_man=$DX_FLAG_man
578 #echo DX_FLAG_html=$DX_FLAG_html
579 #echo DX_FLAG_chm=$DX_FLAG_chm
580 #echo DX_FLAG_chi=$DX_FLAG_chi
581 #echo DX_FLAG_rtf=$DX_FLAG_rtf
582 #echo DX_FLAG_xml=$DX_FLAG_xml
583 #echo DX_FLAG_pdf=$DX_FLAG_pdf
584 #echo DX_FLAG_ps=$DX_FLAG_ps
585 #echo DX_ENV=$DX_ENV
586 ])