Mercurial > geeqie
comparison acinclude.m4 @ 1454:fbd02e4d709e
Preliminary support for doxygen: make doxygen-doc will create documentation from sources in doc/doxygen directory.
author | zas_ |
---|---|
date | Tue, 17 Mar 2009 00:05:13 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1453:bc3f5c0432f6 | 1454:fbd02e4d709e |
---|---|
1 # This file is part of Autoconf. -*- Autoconf -*- | |
2 | |
3 # Copyright (C) 2004 Oren Ben-Kiki | |
4 # This file is distributed under the same terms as the Autoconf macro files. | |
5 | |
6 ########## CHANGELOG ################## | |
7 # 2009-01-14 Martin Mann | |
8 # * DX_ARG_ABLE : new variable 'DX_FLAG_DX_CURRENT_FEATURE' | |
9 # * DX_CLEAR_DEPEND : use of explicit variable 'DX_FLAG_DX_CURRENT_FEATURE' | |
10 # in AC_SUBST instead of 'DX_FLAG[]DX_CURRENT_FEATURE' which is rejected by | |
11 # newer autotools | |
12 | |
13 # Generate automatic documentation using Doxygen. Works in concert with the | |
14 # aminclude.m4 file and a compatible doxygen configuration file. Defines the | |
15 # following public macros: | |
16 # | |
17 # DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature. | |
18 # Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics, | |
19 # 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI' | |
20 # for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF', | |
21 # 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment | |
22 # variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide' | |
23 # paper size. | |
24 # | |
25 # By default, HTML, PDF and PS documentation is generated as this seems to be | |
26 # the most popular and portable combination. MAN pages created by Doxygen are | |
27 # usually problematic, though by picking an appropriate subset and doing some | |
28 # massaging they might be better than nothing. CHM and RTF are specific for MS | |
29 # (note that you can't generate both HTML and CHM at the same time). The XML is | |
30 # rather useless unless you apply specialized post-processing to it. | |
31 # | |
32 # The macro mainly controls the default state of the feature. The use can | |
33 # override the default by specifying --enable or --disable. The macros ensure | |
34 # that contradictory flags are not given (e.g., --enable-doxygen-html and | |
35 # --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.) | |
36 # Finally, each feature will be automatically disabled (with a warning) if the | |
37 # required programs are missing. | |
38 # | |
39 # Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with | |
40 # the following parameters: a one-word name for the project for use as a | |
41 # filename base etc., an optional configuration file name (the default is | |
42 # 'Doxyfile', the same as Doxygen's default), and an optional output directory | |
43 # name (the default is 'doxygen-doc'). | |
44 | |
45 ## ----------## | |
46 ## Defaults. ## | |
47 ## ----------## | |
48 | |
49 DX_ENV="" | |
50 AC_DEFUN([DX_FEATURE_doc], ON) | |
51 AC_DEFUN([DX_FEATURE_dot], ON) | |
52 AC_DEFUN([DX_FEATURE_man], OFF) | |
53 AC_DEFUN([DX_FEATURE_html], ON) | |
54 AC_DEFUN([DX_FEATURE_chm], OFF) | |
55 AC_DEFUN([DX_FEATURE_chi], OFF) | |
56 AC_DEFUN([DX_FEATURE_rtf], OFF) | |
57 AC_DEFUN([DX_FEATURE_xml], OFF) | |
58 AC_DEFUN([DX_FEATURE_pdf], ON) | |
59 AC_DEFUN([DX_FEATURE_ps], ON) | |
60 | |
61 ## --------------- ## | |
62 ## Private macros. ## | |
63 ## --------------- ## | |
64 | |
65 # DX_ENV_APPEND(VARIABLE, VALUE) | |
66 # ------------------------------ | |
67 # Append VARIABLE="VALUE" to DX_ENV for invoking doxygen. | |
68 AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])]) | |
69 | |
70 # DX_DIRNAME_EXPR | |
71 # --------------- | |
72 # Expand into a shell expression prints the directory part of a path. | |
73 AC_DEFUN([DX_DIRNAME_EXPR], | |
74 [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) | |
75 | |
76 # DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) | |
77 # ------------------------------------- | |
78 # Expands according to the M4 (static) status of the feature. | |
79 AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) | |
80 | |
81 # DX_REQUIRE_PROG(VARIABLE, PROGRAM) | |
82 # ---------------------------------- | |
83 # Require the specified program to be found for the DX_CURRENT_FEATURE to work. | |
84 AC_DEFUN([DX_REQUIRE_PROG], [ | |
85 AC_PATH_TOOL([$1], [$2]) | |
86 if test "$DX_FLAG_DX_CURRENT_FEATURE$$1" = 1; then | |
87 AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) | |
88 AC_SUBST([DX_FLAG_DX_CURRENT_FEATURE], 0) | |
89 fi | |
90 ]) | |
91 | |
92 # DX_TEST_FEATURE(FEATURE) | |
93 # ------------------------ | |
94 # Expand to a shell expression testing whether the feature is active. | |
95 AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) | |
96 | |
97 # DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) | |
98 # ------------------------------------------------- | |
99 # Verify that a required features has the right state before trying to turn on | |
100 # the DX_CURRENT_FEATURE. | |
101 AC_DEFUN([DX_CHECK_DEPEND], [ | |
102 test "$DX_FLAG_$1" = "$2" \ | |
103 || AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, | |
104 requires, contradicts) doxygen-DX_CURRENT_FEATURE]) | |
105 ]) | |
106 | |
107 # DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) | |
108 # ---------------------------------------------------------- | |
109 # Turn off the DX_CURRENT_FEATURE if the required feature is off. | |
110 AC_DEFUN([DX_CLEAR_DEPEND], [ | |
111 test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_DX_CURRENT_FEATURE], 0) | |
112 ]) | |
113 | |
114 | |
115 # DX_FEATURE_ARG(FEATURE, DESCRIPTION, | |
116 # CHECK_DEPEND, CLEAR_DEPEND, | |
117 # REQUIRE, DO-IF-ON, DO-IF-OFF) | |
118 # -------------------------------------------- | |
119 # Parse the command-line option controlling a feature. CHECK_DEPEND is called | |
120 # if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), | |
121 # otherwise CLEAR_DEPEND is called to turn off the default state if a required | |
122 # feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional | |
123 # requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and | |
124 # DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. | |
125 AC_DEFUN([DX_ARG_ABLE], [ | |
126 AC_DEFUN([DX_CURRENT_FEATURE], [$1]) | |
127 AC_DEFUN([DX_FLAG_DX_CURRENT_FEATURE], [DX_FLAG_$1]) | |
128 AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) | |
129 AC_ARG_ENABLE(doxygen-$1, | |
130 [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], | |
131 [--enable-doxygen-$1]), | |
132 DX_IF_FEATURE([$1], [don't $2], [$2]))], | |
133 [ | |
134 case "$enableval" in | |
135 #( | |
136 y|Y|yes|Yes|YES) | |
137 AC_SUBST([DX_FLAG_$1], 1) | |
138 $3 | |
139 ;; #( | |
140 n|N|no|No|NO) | |
141 AC_SUBST([DX_FLAG_$1], 0) | |
142 ;; #( | |
143 *) | |
144 AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) | |
145 ;; | |
146 esac | |
147 ], [ | |
148 AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) | |
149 $4 | |
150 ]) | |
151 if DX_TEST_FEATURE([$1]); then | |
152 $5 | |
153 : | |
154 fi | |
155 if DX_TEST_FEATURE([$1]); then | |
156 AM_CONDITIONAL(DX_COND_$1, :) | |
157 $6 | |
158 : | |
159 else | |
160 AM_CONDITIONAL(DX_COND_$1, false) | |
161 $7 | |
162 : | |
163 fi | |
164 ]) | |
165 | |
166 ## -------------- ## | |
167 ## Public macros. ## | |
168 ## -------------- ## | |
169 | |
170 # DX_XXX_FEATURE(DEFAULT_STATE) | |
171 # ----------------------------- | |
172 AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) | |
173 AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) | |
174 AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) | |
175 AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) | |
176 AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) | |
177 AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) | |
178 AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) | |
179 AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) | |
180 AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) | |
181 AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) | |
182 | |
183 # DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR]) | |
184 # --------------------------------------------------------- | |
185 # PROJECT also serves as the base name for the documentation files. | |
186 # The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc". | |
187 AC_DEFUN([DX_INIT_DOXYGEN], [ | |
188 | |
189 # Files: | |
190 AC_SUBST([DX_PROJECT], [$1]) | |
191 AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])]) | |
192 AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])]) | |
193 | |
194 # Environment variables used inside doxygen.cfg: | |
195 DX_ENV_APPEND(SRCDIR, $srcdir) | |
196 DX_ENV_APPEND(PROJECT, $DX_PROJECT) | |
197 DX_ENV_APPEND(DOCDIR, $DX_DOCDIR) | |
198 DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) | |
199 | |
200 # Doxygen itself: | |
201 DX_ARG_ABLE(doc, [generate any doxygen documentation], | |
202 [], | |
203 [], | |
204 [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) | |
205 DX_REQUIRE_PROG([DX_PERL], perl)], | |
206 [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) | |
207 | |
208 # Dot for graphics: | |
209 DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], | |
210 [DX_CHECK_DEPEND(doc, 1)], | |
211 [DX_CLEAR_DEPEND(doc, 1)], | |
212 [DX_REQUIRE_PROG([DX_DOT], dot)], | |
213 [DX_ENV_APPEND(HAVE_DOT, YES) | |
214 DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], | |
215 [DX_ENV_APPEND(HAVE_DOT, NO)]) | |
216 | |
217 # Man pages generation: | |
218 DX_ARG_ABLE(man, [generate doxygen manual pages], | |
219 [DX_CHECK_DEPEND(doc, 1)], | |
220 [DX_CLEAR_DEPEND(doc, 1)], | |
221 [], | |
222 [DX_ENV_APPEND(GENERATE_MAN, YES)], | |
223 [DX_ENV_APPEND(GENERATE_MAN, NO)]) | |
224 | |
225 # RTF file generation: | |
226 DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], | |
227 [DX_CHECK_DEPEND(doc, 1)], | |
228 [DX_CLEAR_DEPEND(doc, 1)], | |
229 [], | |
230 [DX_ENV_APPEND(GENERATE_RTF, YES)], | |
231 [DX_ENV_APPEND(GENERATE_RTF, NO)]) | |
232 | |
233 # XML file generation: | |
234 DX_ARG_ABLE(xml, [generate doxygen XML documentation], | |
235 [DX_CHECK_DEPEND(doc, 1)], | |
236 [DX_CLEAR_DEPEND(doc, 1)], | |
237 [], | |
238 [DX_ENV_APPEND(GENERATE_XML, YES)], | |
239 [DX_ENV_APPEND(GENERATE_XML, NO)]) | |
240 | |
241 # (Compressed) HTML help generation: | |
242 DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], | |
243 [DX_CHECK_DEPEND(doc, 1)], | |
244 [DX_CLEAR_DEPEND(doc, 1)], | |
245 [DX_REQUIRE_PROG([DX_HHC], hhc)], | |
246 [DX_ENV_APPEND(HHC_PATH, $DX_HHC) | |
247 DX_ENV_APPEND(GENERATE_HTML, YES) | |
248 DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], | |
249 [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) | |
250 | |
251 # Seperate CHI file generation. | |
252 DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file], | |
253 [DX_CHECK_DEPEND(chm, 1)], | |
254 [DX_CLEAR_DEPEND(chm, 1)], | |
255 [], | |
256 [DX_ENV_APPEND(GENERATE_CHI, YES)], | |
257 [DX_ENV_APPEND(GENERATE_CHI, NO)]) | |
258 | |
259 # Plain HTML pages generation: | |
260 DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], | |
261 [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], | |
262 [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], | |
263 [], | |
264 [DX_ENV_APPEND(GENERATE_HTML, YES)], | |
265 [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) | |
266 | |
267 # PostScript file generation: | |
268 DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], | |
269 [DX_CHECK_DEPEND(doc, 1)], | |
270 [DX_CLEAR_DEPEND(doc, 1)], | |
271 [DX_REQUIRE_PROG([DX_LATEX], latex) | |
272 DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) | |
273 DX_REQUIRE_PROG([DX_DVIPS], dvips) | |
274 DX_REQUIRE_PROG([DX_EGREP], egrep)]) | |
275 | |
276 # PDF file generation: | |
277 DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], | |
278 [DX_CHECK_DEPEND(doc, 1)], | |
279 [DX_CLEAR_DEPEND(doc, 1)], | |
280 [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) | |
281 DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) | |
282 DX_REQUIRE_PROG([DX_EGREP], egrep)]) | |
283 | |
284 # LaTeX generation for PS and/or PDF: | |
285 if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then | |
286 AM_CONDITIONAL(DX_COND_latex, :) | |
287 DX_ENV_APPEND(GENERATE_LATEX, YES) | |
288 else | |
289 AM_CONDITIONAL(DX_COND_latex, false) | |
290 DX_ENV_APPEND(GENERATE_LATEX, NO) | |
291 fi | |
292 | |
293 # Paper size for PS and/or PDF: | |
294 AC_ARG_VAR(DOXYGEN_PAPER_SIZE, | |
295 [a4wide (default), a4, letter, legal or executive]) | |
296 case "$DOXYGEN_PAPER_SIZE" in | |
297 #( | |
298 "") | |
299 AC_SUBST(DOXYGEN_PAPER_SIZE, "") | |
300 ;; #( | |
301 a4wide|a4|letter|legal|executive) | |
302 DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) | |
303 ;; #( | |
304 *) | |
305 AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) | |
306 ;; | |
307 esac | |
308 | |
309 #For debugging: | |
310 #echo DX_FLAG_doc=$DX_FLAG_doc | |
311 #echo DX_FLAG_dot=$DX_FLAG_dot | |
312 #echo DX_FLAG_man=$DX_FLAG_man | |
313 #echo DX_FLAG_html=$DX_FLAG_html | |
314 #echo DX_FLAG_chm=$DX_FLAG_chm | |
315 #echo DX_FLAG_chi=$DX_FLAG_chi | |
316 #echo DX_FLAG_rtf=$DX_FLAG_rtf | |
317 #echo DX_FLAG_xml=$DX_FLAG_xml | |
318 #echo DX_FLAG_pdf=$DX_FLAG_pdf | |
319 #echo DX_FLAG_ps=$DX_FLAG_ps | |
320 #echo DX_ENV=$DX_ENV | |
321 ]) |