1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
3 # ===========================================================================
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)
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 seperate .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.
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.
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.
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 'Doxyfile', the same as Doxygen's default), and an optional
49 # output directory name (the default is 'doxygen-doc').
53 # The following is a template aminclude.am file for use with Automake.
54 # Make targets and variables values are controlled by the various
55 # DX_COND_* conditionals set by autoconf.
57 # The provided targets are:
59 # doxygen-doc: Generate all doxygen documentation.
61 # doxygen-run: Run doxygen, which will generate some of the
62 # documentation (HTML, CHM, CHI, MAN, RTF, XML)
63 # but will not do the post processing required
64 # for the rest of it (PS, PDF, and some MAN).
66 # doxygen-man: Rename some doxygen generated man pages.
68 # doxygen-ps: Generate doxygen PostScript documentation.
70 # doxygen-pdf: Generate doxygen PDF documentation.
72 # Note that by default these are not integrated into the automake targets.
73 # If doxygen is used to generate man pages, you can achieve this
74 # integration by setting man3_MANS to the list of man pages generated and
75 # then adding the dependency:
77 # $(man3_MANS): doxygen-doc
79 # This will cause make to run doxygen and generate all the documentation.
81 # The following variable is intended for use in Makefile.am:
83 # DX_CLEANFILES = everything to clean.
85 # Then add this variable to MOSTLYCLEANFILES.
87 # ----- begin aminclude.am -------------------------------------
89 # ## --------------------------------- ##
90 # ## Format-independent Doxygen rules. ##
91 # ## --------------------------------- ##
95 # ## ------------------------------- ##
96 # ## Rules specific for HTML output. ##
97 # ## ------------------------------- ##
101 # DX_CLEAN_HTML = @DX_DOCDIR@/html
105 # ## ------------------------------ ##
106 # ## Rules specific for CHM output. ##
107 # ## ------------------------------ ##
111 # DX_CLEAN_CHM = @DX_DOCDIR@/chm
115 # DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
121 # ## ------------------------------ ##
122 # ## Rules specific for MAN output. ##
123 # ## ------------------------------ ##
127 # DX_CLEAN_MAN = @DX_DOCDIR@/man
131 # ## ------------------------------ ##
132 # ## Rules specific for RTF output. ##
133 # ## ------------------------------ ##
137 # DX_CLEAN_RTF = @DX_DOCDIR@/rtf
141 # ## ------------------------------ ##
142 # ## Rules specific for XML output. ##
143 # ## ------------------------------ ##
147 # DX_CLEAN_XML = @DX_DOCDIR@/xml
151 # ## ----------------------------- ##
152 # ## Rules specific for PS output. ##
153 # ## ----------------------------- ##
157 # DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
159 # DX_PS_GOAL = doxygen-ps
161 # doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
163 # @DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
164 # cd @DX_DOCDIR@/latex; \
165 # rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
166 # $(DX_LATEX) refman.tex; \
167 # $(MAKEINDEX_PATH) refman.idx; \
168 # $(DX_LATEX) refman.tex; \
170 # while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
171 # refman.log > /dev/null 2>&1 \
172 # && test $$countdown -gt 0; do \
173 # $(DX_LATEX) refman.tex; \
174 # countdown=`expr $$countdown - 1`; \
176 # $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
180 # ## ------------------------------ ##
181 # ## Rules specific for PDF output. ##
182 # ## ------------------------------ ##
186 # DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
188 # DX_PDF_GOAL = doxygen-pdf
190 # doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
192 # @DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
193 # cd @DX_DOCDIR@/latex; \
194 # rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
195 # $(DX_PDFLATEX) refman.tex; \
196 # $(DX_MAKEINDEX) refman.idx; \
197 # $(DX_PDFLATEX) refman.tex; \
199 # while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
200 # refman.log > /dev/null 2>&1 \
201 # && test $$countdown -gt 0; do \
202 # $(DX_PDFLATEX) refman.tex; \
203 # countdown=`expr $$countdown - 1`; \
205 # mv refman.pdf ../@PACKAGE@.pdf
209 # ## ------------------------------------------------- ##
210 # ## Rules specific for LaTeX (shared for PS and PDF). ##
211 # ## ------------------------------------------------- ##
215 # DX_CLEAN_LATEX = @DX_DOCDIR@/latex
217 # endif DX_COND_latex
219 # .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
221 # .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
223 # doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
225 # doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
227 # @DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
229 # $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
232 # @DX_DOCDIR@/@PACKAGE@.tag \
246 # ----- end aminclude.am ---------------------------------------
250 # Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
252 # Copying and distribution of this file, with or without modification, are
253 # permitted in any medium without royalty provided the copyright notice
254 # and this notice are preserved. This file is offered as-is, without any
264 AC_DEFUN([DX_FEATURE_doc], ON)
265 AC_DEFUN([DX_FEATURE_dot], OFF)
266 AC_DEFUN([DX_FEATURE_man], OFF)
267 AC_DEFUN([DX_FEATURE_html], ON)
268 AC_DEFUN([DX_FEATURE_chm], OFF)
269 AC_DEFUN([DX_FEATURE_chi], OFF)
270 AC_DEFUN([DX_FEATURE_rtf], OFF)
271 AC_DEFUN([DX_FEATURE_xml], OFF)
272 AC_DEFUN([DX_FEATURE_pdf], ON)
273 AC_DEFUN([DX_FEATURE_ps], ON)
275 # Compatibility with older autoconf versions.
276 m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
278 ## --------------- ##
279 ## Private macros. ##
280 ## --------------- ##
282 # DX_ENV_APPEND(VARIABLE, VALUE)
283 # ------------------------------
284 # Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
285 AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
289 # Expand into a shell expression prints the directory part of a path.
290 AC_DEFUN([DX_DIRNAME_EXPR],
291 [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
293 # DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
294 # -------------------------------------
295 # Expands according to the M4 (static) status of the feature.
296 AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
298 # DX_REQUIRE_PROG(VARIABLE, PROGRAM)
299 # ----------------------------------
300 # Require the specified program to be found for the DX_CURRENT_FEATURE to work.
301 AC_DEFUN([DX_REQUIRE_PROG], [
302 AC_PATH_TOOL([$1], [$2])
303 if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
304 AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
305 AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
309 # DX_TEST_FEATURE(FEATURE)
310 # ------------------------
311 # Expand to a shell expression testing whether the feature is active.
312 AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
314 # DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
315 # -------------------------------------------------
316 # Verify that a required features has the right state before trying to turn on
317 # the DX_CURRENT_FEATURE.
318 AC_DEFUN([DX_CHECK_DEPEND], [
319 test "$DX_FLAG_$1" = "$2" \
320 || AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
321 requires, contradicts) doxygen-DX_CURRENT_FEATURE])
324 # DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
325 # ----------------------------------------------------------
326 # Turn off the DX_CURRENT_FEATURE if the required feature is off.
327 AC_DEFUN([DX_CLEAR_DEPEND], [
328 test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
331 # DX_FEATURE_ARG(FEATURE, DESCRIPTION,
332 # CHECK_DEPEND, CLEAR_DEPEND,
333 # REQUIRE, DO-IF-ON, DO-IF-OFF)
334 # --------------------------------------------
335 # Parse the command-line option controlling a feature. CHECK_DEPEND is called
336 # if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
337 # otherwise CLEAR_DEPEND is called to turn off the default state if a required
338 # feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
339 # requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
340 # DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
341 AC_DEFUN([DX_ARG_ABLE], [
342 AC_DEFUN([DX_CURRENT_FEATURE], [$1])
343 AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
344 AC_ARG_ENABLE(doxygen-$1,
345 [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
346 [--enable-doxygen-$1]),
347 DX_IF_FEATURE([$1], [don't $2], [$2]))],
352 AC_SUBST([DX_FLAG_$1], 1)
356 AC_SUBST([DX_FLAG_$1], 0)
359 AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
363 AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
366 if DX_TEST_FEATURE([$1]); then
370 if DX_TEST_FEATURE([$1]); then
371 AM_CONDITIONAL(DX_COND_$1, :)
375 AM_CONDITIONAL(DX_COND_$1, false)
385 # DX_XXX_FEATURE(DEFAULT_STATE)
386 # -----------------------------
387 AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
388 AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])])
389 AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
390 AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
391 AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
392 AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
393 AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
394 AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
395 AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
396 AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
397 AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
399 # DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
400 # ---------------------------------------------------------
401 # PROJECT also serves as the base name for the documentation files.
402 # The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
403 AC_DEFUN([DX_INIT_DOXYGEN], [
406 AC_SUBST([DX_PROJECT], [$1])
407 AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
408 AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
410 # Environment variables used inside doxygen.cfg:
411 DX_ENV_APPEND(SRCDIR, $srcdir)
412 DX_ENV_APPEND(PROJECT, $DX_PROJECT)
413 DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
414 DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
417 DX_ARG_ABLE(doc, [generate any doxygen documentation],
420 [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
421 DX_REQUIRE_PROG([DX_PERL], perl)],
422 [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
425 DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
426 [DX_CHECK_DEPEND(doc, 1)],
427 [DX_CLEAR_DEPEND(doc, 1)],
428 [DX_REQUIRE_PROG([DX_DOT], dot)],
429 [DX_ENV_APPEND(HAVE_DOT, YES)
430 DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
431 [DX_ENV_APPEND(HAVE_DOT, NO)])
433 # Man pages generation:
434 DX_ARG_ABLE(man, [generate doxygen manual pages],
435 [DX_CHECK_DEPEND(doc, 1)],
436 [DX_CLEAR_DEPEND(doc, 1)],
438 [DX_ENV_APPEND(GENERATE_MAN, YES)],
439 [DX_ENV_APPEND(GENERATE_MAN, NO)])
441 # RTF file generation:
442 DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
443 [DX_CHECK_DEPEND(doc, 1)],
444 [DX_CLEAR_DEPEND(doc, 1)],
446 [DX_ENV_APPEND(GENERATE_RTF, YES)],
447 [DX_ENV_APPEND(GENERATE_RTF, NO)])
449 # XML file generation:
450 DX_ARG_ABLE(xml, [generate doxygen XML documentation],
451 [DX_CHECK_DEPEND(doc, 1)],
452 [DX_CLEAR_DEPEND(doc, 1)],
454 [DX_ENV_APPEND(GENERATE_XML, YES)],
455 [DX_ENV_APPEND(GENERATE_XML, NO)])
457 # (Compressed) HTML help generation:
458 DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
459 [DX_CHECK_DEPEND(doc, 1)],
460 [DX_CLEAR_DEPEND(doc, 1)],
461 [DX_REQUIRE_PROG([DX_HHC], hhc)],
462 [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
463 DX_ENV_APPEND(GENERATE_HTML, YES)
464 DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
465 [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
467 # Seperate CHI file generation.
468 DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
469 [DX_CHECK_DEPEND(chm, 1)],
470 [DX_CLEAR_DEPEND(chm, 1)],
472 [DX_ENV_APPEND(GENERATE_CHI, YES)],
473 [DX_ENV_APPEND(GENERATE_CHI, NO)])
475 # Plain HTML pages generation:
476 DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
477 [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
478 [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
480 [DX_ENV_APPEND(GENERATE_HTML, YES)],
481 [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
483 # PostScript file generation:
484 DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
485 [DX_CHECK_DEPEND(doc, 1)],
486 [DX_CLEAR_DEPEND(doc, 1)],
487 [DX_REQUIRE_PROG([DX_LATEX], latex)
488 DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
489 DX_REQUIRE_PROG([DX_DVIPS], dvips)
490 DX_REQUIRE_PROG([DX_EGREP], egrep)])
492 # PDF file generation:
493 DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
494 [DX_CHECK_DEPEND(doc, 1)],
495 [DX_CLEAR_DEPEND(doc, 1)],
496 [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
497 DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
498 DX_REQUIRE_PROG([DX_EGREP], egrep)])
500 # LaTeX generation for PS and/or PDF:
501 if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
502 AM_CONDITIONAL(DX_COND_latex, :)
503 DX_ENV_APPEND(GENERATE_LATEX, YES)
505 AM_CONDITIONAL(DX_COND_latex, false)
506 DX_ENV_APPEND(GENERATE_LATEX, NO)
509 # Paper size for PS and/or PDF:
510 AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
511 [a4wide (default), a4, letter, legal or executive])
512 case "$DOXYGEN_PAPER_SIZE" in
515 AC_SUBST(DOXYGEN_PAPER_SIZE, "")
517 a4wide|a4|letter|legal|executive)
518 DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
521 AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
526 #echo DX_FLAG_doc=$DX_FLAG_doc
527 #echo DX_FLAG_dot=$DX_FLAG_dot
528 #echo DX_FLAG_man=$DX_FLAG_man
529 #echo DX_FLAG_html=$DX_FLAG_html
530 #echo DX_FLAG_chm=$DX_FLAG_chm
531 #echo DX_FLAG_chi=$DX_FLAG_chi
532 #echo DX_FLAG_rtf=$DX_FLAG_rtf
533 #echo DX_FLAG_xml=$DX_FLAG_xml
534 #echo DX_FLAG_pdf=$DX_FLAG_pdf
535 #echo DX_FLAG_ps=$DX_FLAG_ps