xref: /freebsd/contrib/ntp/sntp/libevent/m4/ax_prog_doxygen.m4 (revision a466cc55373fc3cf86837f09da729535b57e69a1)
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
106DX_ENV=""
107AC_DEFUN([DX_FEATURE_doc],  OFF)
108AC_DEFUN([DX_FEATURE_dot],  OFF)
109AC_DEFUN([DX_FEATURE_man],  OFF)
110AC_DEFUN([DX_FEATURE_html], ON)
111AC_DEFUN([DX_FEATURE_chm],  OFF)
112AC_DEFUN([DX_FEATURE_chi],  OFF)
113AC_DEFUN([DX_FEATURE_rtf],  OFF)
114AC_DEFUN([DX_FEATURE_xml],  OFF)
115AC_DEFUN([DX_FEATURE_pdf],  ON)
116AC_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.
127AC_DEFUN([DX_ENV_APPEND],
128[AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])dnl
129m4_if([$1], [VERSION], [], [AC_SUBST([$1], [$2])dnl
130AM_SUBST_NOTMAKE([$1])])dnl
131])
132
133# DX_DIRNAME_EXPR
134# ---------------
135# Expand into a shell expression prints the directory part of a path.
136AC_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.
142AC_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.
147AC_DEFUN([DX_REQUIRE_PROG], [
148AC_PATH_TOOL([$1], [$2])
149if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
150    if test "x$2" = "xdoxygen"; then
151        AC_MSG_ERROR([$2 not found - will not DX_CURRENT_DESCRIPTION])
152    else
153        AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
154    fi
155    AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
156fi
157])
158
159# DX_TEST_FEATURE(FEATURE)
160# ------------------------
161# Expand to a shell expression testing whether the feature is active.
162AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
163
164# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
165# -------------------------------------------------
166# Verify that a required features has the right state before trying to turn on
167# the DX_CURRENT_FEATURE.
168AC_DEFUN([DX_CHECK_DEPEND], [
169test "$DX_FLAG_$1" = "$2" \
170|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
171                            requires, contradicts) doxygen-$1])
172])
173
174# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
175# ----------------------------------------------------------
176# Turn off the DX_CURRENT_FEATURE if the required feature is off.
177AC_DEFUN([DX_CLEAR_DEPEND], [
178test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
179])
180
181# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
182#                CHECK_DEPEND, CLEAR_DEPEND,
183#                REQUIRE, DO-IF-ON, DO-IF-OFF)
184# --------------------------------------------
185# Parse the command-line option controlling a feature. CHECK_DEPEND is called
186# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
187# otherwise CLEAR_DEPEND is called to turn off the default state if a required
188# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
189# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
190# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
191AC_DEFUN([DX_ARG_ABLE], [
192    AC_DEFUN([DX_CURRENT_FEATURE], [$1])
193    AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
194    AC_ARG_ENABLE(doxygen-$1,
195                  [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
196                                                      [--enable-doxygen-$1]),
197                                  DX_IF_FEATURE([$1], [don't $2], [$2]))],
198                  [
199case "$enableval" in
200#(
201y|Y|yes|Yes|YES)
202    AC_SUBST([DX_FLAG_$1], 1)
203    $3
204;; #(
205n|N|no|No|NO)
206    AC_SUBST([DX_FLAG_$1], 0)
207;; #(
208*)
209    AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
210;;
211esac
212], [
213AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
214$4
215])
216if DX_TEST_FEATURE([$1]); then
217    $5
218    :
219fi
220if DX_TEST_FEATURE([$1]); then
221    $6
222    :
223else
224    $7
225    :
226fi
227])
228
229## -------------- ##
230## Public macros. ##
231## -------------- ##
232
233# DX_XXX_FEATURE(DEFAULT_STATE)
234# -----------------------------
235AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc],  [$1])])
236AC_DEFUN([DX_DOT_FEATURE],     [AC_DEFUN([DX_FEATURE_dot], [$1])])
237AC_DEFUN([DX_MAN_FEATURE],     [AC_DEFUN([DX_FEATURE_man],  [$1])])
238AC_DEFUN([DX_HTML_FEATURE],    [AC_DEFUN([DX_FEATURE_html], [$1])])
239AC_DEFUN([DX_CHM_FEATURE],     [AC_DEFUN([DX_FEATURE_chm],  [$1])])
240AC_DEFUN([DX_CHI_FEATURE],     [AC_DEFUN([DX_FEATURE_chi],  [$1])])
241AC_DEFUN([DX_RTF_FEATURE],     [AC_DEFUN([DX_FEATURE_rtf],  [$1])])
242AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
243AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
244AC_DEFUN([DX_PDF_FEATURE],     [AC_DEFUN([DX_FEATURE_pdf],  [$1])])
245AC_DEFUN([DX_PS_FEATURE],      [AC_DEFUN([DX_FEATURE_ps],   [$1])])
246
247# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR], ...)
248# --------------------------------------------------------------
249# PROJECT also serves as the base name for the documentation files.
250# The default CONFIG-FILE is "$(srcdir)/Doxyfile" and OUTPUT-DOC-DIR is
251# "doxygen-doc".
252# More arguments are interpreted as interleaved CONFIG-FILE and
253# OUTPUT-DOC-DIR values.
254AC_DEFUN([DX_INIT_DOXYGEN], [
255
256# Files:
257AC_SUBST([DX_PROJECT], [$1])
258AC_SUBST([DX_CONFIG], ['ifelse([$2], [], [$(srcdir)/Doxyfile], [$2])'])
259AC_SUBST([DX_DOCDIR], ['ifelse([$3], [], [doxygen-doc], [$3])'])
260m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2,
261      [AC_SUBST([DX_CONFIG]m4_eval(DX_i[/2]),
262                'm4_default_nblank_quoted(m4_argn(DX_i, $@),
263                                          [$(srcdir)/Doxyfile])')])])dnl
264m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 5, m4_count($@,), 2,
265      [AC_SUBST([DX_DOCDIR]m4_eval([(]DX_i[-1)/2]),
266                'm4_default_nblank_quoted(m4_argn(DX_i, $@),
267                                          [doxygen-doc])')])])dnl
268m4_define([DX_loop], m4_dquote(m4_if(m4_eval(3 < m4_count($@)), 1,
269          [m4_for([DX_i], 4, m4_count($@), 2, [, m4_eval(DX_i[/2])])],
270          [])))dnl
271
272# Environment variables used inside doxygen.cfg:
273DX_ENV_APPEND(SRCDIR, $srcdir)
274DX_ENV_APPEND(PROJECT, $DX_PROJECT)
275DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
276
277# Doxygen itself:
278DX_ARG_ABLE(doc, [generate any doxygen documentation],
279            [],
280            [],
281            [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
282             DX_REQUIRE_PROG([DX_PERL], perl)],
283            [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
284
285# Dot for graphics:
286DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
287            [DX_CHECK_DEPEND(doc, 1)],
288            [DX_CLEAR_DEPEND(doc, 1)],
289            [DX_REQUIRE_PROG([DX_DOT], dot)],
290            [DX_ENV_APPEND(HAVE_DOT, YES)
291             DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
292            [DX_ENV_APPEND(HAVE_DOT, NO)])
293
294# Man pages generation:
295DX_ARG_ABLE(man, [generate doxygen manual pages],
296            [DX_CHECK_DEPEND(doc, 1)],
297            [DX_CLEAR_DEPEND(doc, 1)],
298            [],
299            [DX_ENV_APPEND(GENERATE_MAN, YES)],
300            [DX_ENV_APPEND(GENERATE_MAN, NO)])
301
302# RTF file generation:
303DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
304            [DX_CHECK_DEPEND(doc, 1)],
305            [DX_CLEAR_DEPEND(doc, 1)],
306            [],
307            [DX_ENV_APPEND(GENERATE_RTF, YES)],
308            [DX_ENV_APPEND(GENERATE_RTF, NO)])
309
310# XML file generation:
311DX_ARG_ABLE(xml, [generate doxygen XML documentation],
312            [DX_CHECK_DEPEND(doc, 1)],
313            [DX_CLEAR_DEPEND(doc, 1)],
314            [],
315            [DX_ENV_APPEND(GENERATE_XML, YES)],
316            [DX_ENV_APPEND(GENERATE_XML, NO)])
317
318# (Compressed) HTML help generation:
319DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
320            [DX_CHECK_DEPEND(doc, 1)],
321            [DX_CLEAR_DEPEND(doc, 1)],
322            [DX_REQUIRE_PROG([DX_HHC], hhc)],
323            [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
324             DX_ENV_APPEND(GENERATE_HTML, YES)
325             DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
326            [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
327
328# Separate CHI file generation.
329DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file],
330            [DX_CHECK_DEPEND(chm, 1)],
331            [DX_CLEAR_DEPEND(chm, 1)],
332            [],
333            [DX_ENV_APPEND(GENERATE_CHI, YES)],
334            [DX_ENV_APPEND(GENERATE_CHI, NO)])
335
336# Plain HTML pages generation:
337DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
338            [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
339            [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
340            [],
341            [DX_ENV_APPEND(GENERATE_HTML, YES)],
342            [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
343
344# PostScript file generation:
345DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
346            [DX_CHECK_DEPEND(doc, 1)],
347            [DX_CLEAR_DEPEND(doc, 1)],
348            [DX_REQUIRE_PROG([DX_LATEX], latex)
349             DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
350             DX_REQUIRE_PROG([DX_DVIPS], dvips)
351             DX_REQUIRE_PROG([DX_EGREP], egrep)])
352
353# PDF file generation:
354DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
355            [DX_CHECK_DEPEND(doc, 1)],
356            [DX_CLEAR_DEPEND(doc, 1)],
357            [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
358             DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
359             DX_REQUIRE_PROG([DX_EGREP], egrep)])
360
361# LaTeX generation for PS and/or PDF:
362if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
363    DX_ENV_APPEND(GENERATE_LATEX, YES)
364else
365    DX_ENV_APPEND(GENERATE_LATEX, NO)
366fi
367
368# Paper size for PS and/or PDF:
369AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
370           [a4wide (default), a4, letter, legal or executive])
371case "$DOXYGEN_PAPER_SIZE" in
372#(
373"")
374    AC_SUBST(DOXYGEN_PAPER_SIZE, "")
375;; #(
376a4wide|a4|letter|legal|executive)
377    DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
378;; #(
379*)
380    AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
381;;
382esac
383
384# Rules:
385AS_IF([[test $DX_FLAG_html -eq 1]],
386[[DX_SNIPPET_html="## ------------------------------- ##
387## Rules specific for HTML output. ##
388## ------------------------------- ##
389
390DX_CLEAN_HTML = \$(DX_DOCDIR)/html]dnl
391m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
392                \$(DX_DOCDIR]DX_i[)/html]])[
393
394"]],
395[[DX_SNIPPET_html=""]])
396AS_IF([[test $DX_FLAG_chi -eq 1]],
397[[DX_SNIPPET_chi="
398DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi]dnl
399m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
400               \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).chi]])["]],
401[[DX_SNIPPET_chi=""]])
402AS_IF([[test $DX_FLAG_chm -eq 1]],
403[[DX_SNIPPET_chm="## ------------------------------ ##
404## Rules specific for CHM output. ##
405## ------------------------------ ##
406
407DX_CLEAN_CHM = \$(DX_DOCDIR)/chm]dnl
408m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
409               \$(DX_DOCDIR]DX_i[)/chm]])[\
410${DX_SNIPPET_chi}
411
412"]],
413[[DX_SNIPPET_chm=""]])
414AS_IF([[test $DX_FLAG_man -eq 1]],
415[[DX_SNIPPET_man="## ------------------------------ ##
416## Rules specific for MAN output. ##
417## ------------------------------ ##
418
419DX_CLEAN_MAN = \$(DX_DOCDIR)/man]dnl
420m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
421               \$(DX_DOCDIR]DX_i[)/man]])[
422
423"]],
424[[DX_SNIPPET_man=""]])
425AS_IF([[test $DX_FLAG_rtf -eq 1]],
426[[DX_SNIPPET_rtf="## ------------------------------ ##
427## Rules specific for RTF output. ##
428## ------------------------------ ##
429
430DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf]dnl
431m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
432               \$(DX_DOCDIR]DX_i[)/rtf]])[
433
434"]],
435[[DX_SNIPPET_rtf=""]])
436AS_IF([[test $DX_FLAG_xml -eq 1]],
437[[DX_SNIPPET_xml="## ------------------------------ ##
438## Rules specific for XML output. ##
439## ------------------------------ ##
440
441DX_CLEAN_XML = \$(DX_DOCDIR)/xml]dnl
442m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
443               \$(DX_DOCDIR]DX_i[)/xml]])[
444
445"]],
446[[DX_SNIPPET_xml=""]])
447AS_IF([[test $DX_FLAG_ps -eq 1]],
448[[DX_SNIPPET_ps="## ----------------------------- ##
449## Rules specific for PS output. ##
450## ----------------------------- ##
451
452DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps]dnl
453m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
454              \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps]])[
455
456DX_PS_GOAL = doxygen-ps
457
458doxygen-ps: \$(DX_CLEAN_PS)
459
460]m4_foreach([DX_i], [DX_loop],
461[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag
462	\$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\
463	rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\
464	\$(DX_LATEX) refman.tex; \\
465	\$(DX_MAKEINDEX) refman.idx; \\
466	\$(DX_LATEX) refman.tex; \\
467	countdown=5; \\
468	while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\
469	                  refman.log > /dev/null 2>&1 \\
470	   && test \$\$countdown -gt 0; do \\
471	    \$(DX_LATEX) refman.tex; \\
472            countdown=\`expr \$\$countdown - 1\`; \\
473	done; \\
474	\$(DX_DVIPS) -o ../\$(PACKAGE).ps refman.dvi
475
476]])["]],
477[[DX_SNIPPET_ps=""]])
478AS_IF([[test $DX_FLAG_pdf -eq 1]],
479[[DX_SNIPPET_pdf="## ------------------------------ ##
480## Rules specific for PDF output. ##
481## ------------------------------ ##
482
483DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf]dnl
484m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
485               \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf]])[
486
487DX_PDF_GOAL = doxygen-pdf
488
489doxygen-pdf: \$(DX_CLEAN_PDF)
490
491]m4_foreach([DX_i], [DX_loop],
492[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag
493	\$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\
494	rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\
495	\$(DX_PDFLATEX) refman.tex; \\
496	\$(DX_MAKEINDEX) refman.idx; \\
497	\$(DX_PDFLATEX) refman.tex; \\
498	countdown=5; \\
499	while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\
500	                  refman.log > /dev/null 2>&1 \\
501	   && test \$\$countdown -gt 0; do \\
502	    \$(DX_PDFLATEX) refman.tex; \\
503	    countdown=\`expr \$\$countdown - 1\`; \\
504	done; \\
505	mv refman.pdf ../\$(PACKAGE).pdf
506
507]])["]],
508[[DX_SNIPPET_pdf=""]])
509AS_IF([[test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1]],
510[[DX_SNIPPET_latex="## ------------------------------------------------- ##
511## Rules specific for LaTeX (shared for PS and PDF). ##
512## ------------------------------------------------- ##
513
514DX_V_LATEX = \$(_DX_v_LATEX_\$(V))
515_DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY))
516_DX_v_LATEX_0 = @echo \"  LATEX \" \$][@;
517
518DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex]dnl
519m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\
520                 \$(DX_DOCDIR]DX_i[)/latex]])[
521
522"]],
523[[DX_SNIPPET_latex=""]])
524
525AS_IF([[test $DX_FLAG_doc -eq 1]],
526[[DX_SNIPPET_doc="## --------------------------------- ##
527## Format-independent Doxygen rules. ##
528## --------------------------------- ##
529
530${DX_SNIPPET_html}\
531${DX_SNIPPET_chm}\
532${DX_SNIPPET_man}\
533${DX_SNIPPET_rtf}\
534${DX_SNIPPET_xml}\
535${DX_SNIPPET_ps}\
536${DX_SNIPPET_pdf}\
537${DX_SNIPPET_latex}\
538DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V))
539_DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY))
540_DX_v_DXGEN_0 = @echo \"  DXGEN \" \$<;
541
542.PHONY: doxygen-run doxygen-doc \$(DX_PS_GOAL) \$(DX_PDF_GOAL)
543
544.INTERMEDIATE: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL)
545
546doxygen-run:]m4_foreach([DX_i], [DX_loop],
547                         [[ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag]])[
548
549doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL)
550
551]m4_foreach([DX_i], [DX_loop],
552[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag: \$(DX_CONFIG]DX_i[) \$(pkginclude_HEADERS)
553	\$(A""M_V_at)rm -rf \$(DX_DOCDIR]DX_i[)
554	\$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR]DX_i[) \$(DX_DOXYGEN) \$(DX_CONFIG]DX_i[)
555	\$(A""M_V_at)echo Timestamp >\$][@
556
557]])dnl
558[DX_CLEANFILES = \\]
559m4_foreach([DX_i], [DX_loop],
560[[	\$(DX_DOCDIR]DX_i[)/doxygen_sqlite3.db \\
561	\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\
562]])dnl
563[	-r \\
564	\$(DX_CLEAN_HTML) \\
565	\$(DX_CLEAN_CHM) \\
566	\$(DX_CLEAN_CHI) \\
567	\$(DX_CLEAN_MAN) \\
568	\$(DX_CLEAN_RTF) \\
569	\$(DX_CLEAN_XML) \\
570	\$(DX_CLEAN_PS) \\
571	\$(DX_CLEAN_PDF) \\
572	\$(DX_CLEAN_LATEX)
573DX_INSTALL_DOCS = \\
574	\$(DX_CLEAN_HTML) \\
575	\$(DX_CLEAN_CHM) \\
576	\$(DX_CLEAN_CHI) \\
577	\$(DX_CLEAN_RTF) \\
578	\$(DX_CLEAN_XML) \\
579	\$(DX_CLEAN_PS) \\
580	\$(DX_CLEAN_PDF) \\
581	\$(DX_CLEAN_LATEX)
582    "]],
583[[DX_SNIPPET_doc=""]])
584AC_SUBST([DX_RULES],
585["${DX_SNIPPET_doc}"])dnl
586AM_SUBST_NOTMAKE([DX_RULES])
587
588#For debugging:
589#echo DX_FLAG_doc=$DX_FLAG_doc
590#echo DX_FLAG_dot=$DX_FLAG_dot
591#echo DX_FLAG_man=$DX_FLAG_man
592#echo DX_FLAG_html=$DX_FLAG_html
593#echo DX_FLAG_chm=$DX_FLAG_chm
594#echo DX_FLAG_chi=$DX_FLAG_chi
595#echo DX_FLAG_rtf=$DX_FLAG_rtf
596#echo DX_FLAG_xml=$DX_FLAG_xml
597#echo DX_FLAG_pdf=$DX_FLAG_pdf
598#echo DX_FLAG_ps=$DX_FLAG_ps
599#echo DX_ENV=$DX_ENV
600])
601