leo_sobral@2: # This file is part of Autoconf. -*- Autoconf -*- leo_sobral@2: leo_sobral@2: # Copyright (C) 2004 Oren Ben-Kiki leo_sobral@2: # This file is distributed under the same terms as the Autoconf macro files. leo_sobral@2: leo_sobral@2: # Generate automatic documentation using Doxygen. Works in concert with the leo_sobral@2: # aminclude.m4 file and a compatible doxygen configuration file. Defines the leo_sobral@2: # following public macros: leo_sobral@2: # leo_sobral@2: # DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature. leo_sobral@2: # Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics, leo_sobral@2: # 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI' leo_sobral@2: # for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF', leo_sobral@2: # 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment leo_sobral@2: # variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide' leo_sobral@2: # paper size. leo_sobral@2: # leo_sobral@2: # By default, HTML, PDF and PS documentation is generated as this seems to be leo_sobral@2: # the most popular and portable combination. MAN pages created by Doxygen are leo_sobral@2: # usually problematic, though by picking an appropriate subset and doing some leo_sobral@2: # massaging they might be better than nothing. CHM and RTF are specific for MS leo_sobral@2: # (note that you can't generate both HTML and CHM at the same time). The XML is leo_sobral@2: # rather useless unless you apply specialized post-processing to it. leo_sobral@2: # leo_sobral@2: # The macro mainly controls the default state of the feature. The use can leo_sobral@2: # override the default by specifying --enable or --disable. The macros ensure leo_sobral@2: # that contradictory flags are not given (e.g., --enable-doxygen-html and leo_sobral@2: # --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.) leo_sobral@2: # Finally, each feature will be automatically disabled (with a warning) if the leo_sobral@2: # required programs are missing. leo_sobral@2: # leo_sobral@2: # Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with leo_sobral@2: # the following parameters: a one-word name for the project for use as a leo_sobral@2: # filename base etc., an optional configuration file name (the default is leo_sobral@2: # 'Doxyfile', the same as Doxygen's default), and an optional output directory leo_sobral@2: # name (the default is 'doxygen-doc'). leo_sobral@2: leo_sobral@2: ## ----------## leo_sobral@2: ## Defaults. ## leo_sobral@2: ## ----------## leo_sobral@2: leo_sobral@2: DX_ENV="" leo_sobral@2: AC_DEFUN([DX_FEATURE_doc], ON) leo_sobral@2: AC_DEFUN([DX_FEATURE_dot], ON) leo_sobral@2: AC_DEFUN([DX_FEATURE_man], OFF) leo_sobral@2: AC_DEFUN([DX_FEATURE_html], ON) leo_sobral@2: AC_DEFUN([DX_FEATURE_chm], OFF) leo_sobral@2: AC_DEFUN([DX_FEATURE_chi], OFF) leo_sobral@2: AC_DEFUN([DX_FEATURE_rtf], OFF) leo_sobral@2: AC_DEFUN([DX_FEATURE_xml], OFF) leo_sobral@2: AC_DEFUN([DX_FEATURE_pdf], ON) leo_sobral@2: AC_DEFUN([DX_FEATURE_ps], ON) leo_sobral@2: leo_sobral@2: ## --------------- ## leo_sobral@2: ## Private macros. ## leo_sobral@2: ## --------------- ## leo_sobral@2: leo_sobral@2: # DX_ENV_APPEND(VARIABLE, VALUE) leo_sobral@2: # ------------------------------ leo_sobral@2: # Append VARIABLE="VALUE" to DX_ENV for invoking doxygen. leo_sobral@2: AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])]) leo_sobral@2: leo_sobral@2: # DX_DIRNAME_EXPR leo_sobral@2: # --------------- leo_sobral@2: # Expand into a shell expression prints the directory part of a path. leo_sobral@2: AC_DEFUN([DX_DIRNAME_EXPR], leo_sobral@2: [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) leo_sobral@2: leo_sobral@2: # DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) leo_sobral@2: # ------------------------------------- leo_sobral@2: # Expands according to the M4 (static) status of the feature. leo_sobral@2: AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) leo_sobral@2: leo_sobral@2: # DX_REQUIRE_PROG(VARIABLE, PROGRAM) leo_sobral@2: # ---------------------------------- leo_sobral@2: # Require the specified program to be found for the DX_CURRENT_FEATURE to work. leo_sobral@2: AC_DEFUN([DX_REQUIRE_PROG], [ leo_sobral@2: AC_PATH_TOOL([$1], [$2]) leo_sobral@2: if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then leo_sobral@2: AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) leo_sobral@2: AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0) leo_sobral@2: fi leo_sobral@2: ]) leo_sobral@2: leo_sobral@2: # DX_TEST_FEATURE(FEATURE) leo_sobral@2: # ------------------------ leo_sobral@2: # Expand to a shell expression testing whether the feature is active. leo_sobral@2: AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) leo_sobral@2: leo_sobral@2: # DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) leo_sobral@2: # ------------------------------------------------- leo_sobral@2: # Verify that a required features has the right state before trying to turn on leo_sobral@2: # the DX_CURRENT_FEATURE. leo_sobral@2: AC_DEFUN([DX_CHECK_DEPEND], [ leo_sobral@2: test "$DX_FLAG_$1" = "$2" \ leo_sobral@2: || AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, leo_sobral@2: requires, contradicts) doxygen-DX_CURRENT_FEATURE]) leo_sobral@2: ]) leo_sobral@2: leo_sobral@2: # DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) leo_sobral@2: # ---------------------------------------------------------- leo_sobral@2: # Turn off the DX_CURRENT_FEATURE if the required feature is off. leo_sobral@2: AC_DEFUN([DX_CLEAR_DEPEND], [ leo_sobral@2: test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0) leo_sobral@2: ]) leo_sobral@2: leo_sobral@2: # DX_FEATURE_ARG(FEATURE, DESCRIPTION, leo_sobral@2: # CHECK_DEPEND, CLEAR_DEPEND, leo_sobral@2: # REQUIRE, DO-IF-ON, DO-IF-OFF) leo_sobral@2: # -------------------------------------------- leo_sobral@2: # Parse the command-line option controlling a feature. CHECK_DEPEND is called leo_sobral@2: # if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), leo_sobral@2: # otherwise CLEAR_DEPEND is called to turn off the default state if a required leo_sobral@2: # feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional leo_sobral@2: # requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and leo_sobral@2: # DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. leo_sobral@2: AC_DEFUN([DX_ARG_ABLE], [ leo_sobral@2: AC_DEFUN([DX_CURRENT_FEATURE], [$1]) leo_sobral@2: AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) leo_sobral@2: AC_ARG_ENABLE(doxygen-$1, leo_sobral@2: [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], leo_sobral@2: [--enable-doxygen-$1]), leo_sobral@2: DX_IF_FEATURE([$1], [don't $2], [$2]))], leo_sobral@2: [ leo_sobral@2: case "$enableval" in leo_sobral@2: #( leo_sobral@2: y|Y|yes|Yes|YES) leo_sobral@2: AC_SUBST([DX_FLAG_$1], 1) leo_sobral@2: $3 leo_sobral@2: ;; #( leo_sobral@2: n|N|no|No|NO) leo_sobral@2: AC_SUBST([DX_FLAG_$1], 0) leo_sobral@2: ;; #( leo_sobral@2: *) leo_sobral@2: AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) leo_sobral@2: ;; leo_sobral@2: esac leo_sobral@2: ], [ leo_sobral@2: AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) leo_sobral@2: $4 leo_sobral@2: ]) leo_sobral@2: if DX_TEST_FEATURE([$1]); then leo_sobral@2: $5 leo_sobral@2: : leo_sobral@2: fi leo_sobral@2: if DX_TEST_FEATURE([$1]); then leo_sobral@2: AM_CONDITIONAL(DX_COND_$1, :) leo_sobral@2: $6 leo_sobral@2: : leo_sobral@2: else leo_sobral@2: AM_CONDITIONAL(DX_COND_$1, false) leo_sobral@2: $7 leo_sobral@2: : leo_sobral@2: fi leo_sobral@2: ]) leo_sobral@2: leo_sobral@2: ## -------------- ## leo_sobral@2: ## Public macros. ## leo_sobral@2: ## -------------- ## leo_sobral@2: leo_sobral@2: # DX_XXX_FEATURE(DEFAULT_STATE) leo_sobral@2: # ----------------------------- leo_sobral@2: AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) leo_sobral@2: AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) leo_sobral@2: AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) leo_sobral@2: AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) leo_sobral@2: AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) leo_sobral@2: AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) leo_sobral@2: AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) leo_sobral@2: AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) leo_sobral@2: AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) leo_sobral@2: AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) leo_sobral@2: leo_sobral@2: # DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR]) leo_sobral@2: # --------------------------------------------------------- leo_sobral@2: # PROJECT also serves as the base name for the documentation files. leo_sobral@2: # The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc". leo_sobral@2: AC_DEFUN([DX_INIT_DOXYGEN], [ leo_sobral@2: leo_sobral@2: # Files: leo_sobral@2: AC_SUBST([DX_PROJECT], [$1]) leo_sobral@2: AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])]) leo_sobral@2: AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])]) leo_sobral@2: leo_sobral@2: # Environment variables used inside doxygen.cfg: leo_sobral@2: DX_ENV_APPEND(SRCDIR, $srcdir) leo_sobral@2: DX_ENV_APPEND(PROJECT, $DX_PROJECT) leo_sobral@2: DX_ENV_APPEND(DOCDIR, $DX_DOCDIR) leo_sobral@2: DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) leo_sobral@2: leo_sobral@2: # Doxygen itself: leo_sobral@2: DX_ARG_ABLE(doc, [generate any doxygen documentation], leo_sobral@2: [], leo_sobral@2: [], leo_sobral@2: [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) leo_sobral@2: DX_REQUIRE_PROG([DX_PERL], perl)], leo_sobral@2: [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) leo_sobral@2: leo_sobral@2: # Dot for graphics: leo_sobral@2: DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1)], leo_sobral@2: [DX_REQUIRE_PROG([DX_DOT], dot)], leo_sobral@2: [DX_ENV_APPEND(HAVE_DOT, YES) leo_sobral@2: DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], leo_sobral@2: [DX_ENV_APPEND(HAVE_DOT, NO)]) leo_sobral@2: leo_sobral@2: # Man pages generation: leo_sobral@2: DX_ARG_ABLE(man, [generate doxygen manual pages], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1)], leo_sobral@2: [], leo_sobral@2: [DX_ENV_APPEND(GENERATE_MAN, YES)], leo_sobral@2: [DX_ENV_APPEND(GENERATE_MAN, NO)]) leo_sobral@2: leo_sobral@2: # RTF file generation: leo_sobral@2: DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1)], leo_sobral@2: [], leo_sobral@2: [DX_ENV_APPEND(GENERATE_RTF, YES)], leo_sobral@2: [DX_ENV_APPEND(GENERATE_RTF, NO)]) leo_sobral@2: leo_sobral@2: # XML file generation: leo_sobral@2: DX_ARG_ABLE(xml, [generate doxygen XML documentation], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1)], leo_sobral@2: [], leo_sobral@2: [DX_ENV_APPEND(GENERATE_XML, YES)], leo_sobral@2: [DX_ENV_APPEND(GENERATE_XML, NO)]) leo_sobral@2: leo_sobral@2: # (Compressed) HTML help generation: leo_sobral@2: DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1)], leo_sobral@2: [DX_REQUIRE_PROG([DX_HHC], hhc)], leo_sobral@2: [DX_ENV_APPEND(HHC_PATH, $DX_HHC) leo_sobral@2: DX_ENV_APPEND(GENERATE_HTML, YES) leo_sobral@2: DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], leo_sobral@2: [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) leo_sobral@2: leo_sobral@2: # Seperate CHI file generation. leo_sobral@2: DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file], leo_sobral@2: [DX_CHECK_DEPEND(chm, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(chm, 1)], leo_sobral@2: [], leo_sobral@2: [DX_ENV_APPEND(GENERATE_CHI, YES)], leo_sobral@2: [DX_ENV_APPEND(GENERATE_CHI, NO)]) leo_sobral@2: leo_sobral@2: # Plain HTML pages generation: leo_sobral@2: DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], leo_sobral@2: [], leo_sobral@2: [DX_ENV_APPEND(GENERATE_HTML, YES)], leo_sobral@2: [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) leo_sobral@2: leo_sobral@2: # PostScript file generation: leo_sobral@2: DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1)], leo_sobral@2: [DX_REQUIRE_PROG([DX_LATEX], latex) leo_sobral@2: DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) leo_sobral@2: DX_REQUIRE_PROG([DX_DVIPS], dvips) leo_sobral@2: DX_REQUIRE_PROG([DX_EGREP], egrep)]) leo_sobral@2: leo_sobral@2: # PDF file generation: leo_sobral@2: DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], leo_sobral@2: [DX_CHECK_DEPEND(doc, 1)], leo_sobral@2: [DX_CLEAR_DEPEND(doc, 1)], leo_sobral@2: [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) leo_sobral@2: DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) leo_sobral@2: DX_REQUIRE_PROG([DX_EGREP], egrep)]) leo_sobral@2: leo_sobral@2: # LaTeX generation for PS and/or PDF: leo_sobral@2: if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then leo_sobral@2: AM_CONDITIONAL(DX_COND_latex, :) leo_sobral@2: DX_ENV_APPEND(GENERATE_LATEX, YES) leo_sobral@2: else leo_sobral@2: AM_CONDITIONAL(DX_COND_latex, false) leo_sobral@2: DX_ENV_APPEND(GENERATE_LATEX, NO) leo_sobral@2: fi leo_sobral@2: leo_sobral@2: # Paper size for PS and/or PDF: leo_sobral@2: AC_ARG_VAR(DOXYGEN_PAPER_SIZE, leo_sobral@2: [a4wide (default), a4, letter, legal or executive]) leo_sobral@2: case "$DOXYGEN_PAPER_SIZE" in leo_sobral@2: #( leo_sobral@2: "") leo_sobral@2: AC_SUBST(DOXYGEN_PAPER_SIZE, "") leo_sobral@2: ;; #( leo_sobral@2: a4wide|a4|letter|legal|executive) leo_sobral@2: DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) leo_sobral@2: ;; #( leo_sobral@2: *) leo_sobral@2: AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) leo_sobral@2: ;; leo_sobral@2: esac leo_sobral@2: leo_sobral@2: #For debugging: leo_sobral@2: #echo DX_FLAG_doc=$DX_FLAG_doc leo_sobral@2: #echo DX_FLAG_dot=$DX_FLAG_dot leo_sobral@2: #echo DX_FLAG_man=$DX_FLAG_man leo_sobral@2: #echo DX_FLAG_html=$DX_FLAG_html leo_sobral@2: #echo DX_FLAG_chm=$DX_FLAG_chm leo_sobral@2: #echo DX_FLAG_chi=$DX_FLAG_chi leo_sobral@2: #echo DX_FLAG_rtf=$DX_FLAG_rtf leo_sobral@2: #echo DX_FLAG_xml=$DX_FLAG_xml leo_sobral@2: #echo DX_FLAG_pdf=$DX_FLAG_pdf leo_sobral@2: #echo DX_FLAG_ps=$DX_FLAG_ps leo_sobral@2: #echo DX_ENV=$DX_ENV leo_sobral@2: ])