1 | # -*- Autotest -*-
|
---|
2 |
|
---|
3 | AT_BANNER([Executables (autoheader, autoupdate...).])
|
---|
4 |
|
---|
5 | # Copyright (C) 2000, 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
|
---|
6 | #
|
---|
7 | # This program is free software; you can redistribute it and/or modify
|
---|
8 | # it under the terms of the GNU General Public License as published by
|
---|
9 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
10 | # any later version.
|
---|
11 | #
|
---|
12 | # This program is distributed in the hope that it will be useful,
|
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | # GNU General Public License for more details.
|
---|
16 | #
|
---|
17 | # You should have received a copy of the GNU General Public License
|
---|
18 | # along with this program; if not, write to the Free Software
|
---|
19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
---|
20 | # 02110-1301, USA.
|
---|
21 |
|
---|
22 |
|
---|
23 | ## ----------------------------- ##
|
---|
24 | ## Syntax of the shell scripts. ##
|
---|
25 | ## ----------------------------- ##
|
---|
26 |
|
---|
27 | # We use `/bin/sh -n script' to check that there are no syntax errors
|
---|
28 | # in the scripts. Although incredible, there are /bin/sh that go into
|
---|
29 | # endless loops with `-n', e.g., SunOS's:
|
---|
30 | #
|
---|
31 | # $ uname -a
|
---|
32 | # SunOS ondine 4.1.3 2 sun4m unknown
|
---|
33 | # $ cat endless.sh
|
---|
34 | # while false
|
---|
35 | # do
|
---|
36 | # :
|
---|
37 | # done
|
---|
38 | # exit 0
|
---|
39 | # $ time sh endless.sh
|
---|
40 | # sh endless.sh 0,02s user 0,03s system 78% cpu 0,064 total
|
---|
41 | # $ time sh -nx endless.sh
|
---|
42 | # ^Csh -nx endless.sh 3,67s user 0,03s system 63% cpu 5,868 total
|
---|
43 | #
|
---|
44 | # So before using `/bin/sh -n' to check our scripts, we first check
|
---|
45 | # that `/bin/sh -n' is not broken to death.
|
---|
46 |
|
---|
47 | AT_SETUP([Syntax of the shell scripts])
|
---|
48 |
|
---|
49 | AT_CHECK([test "$ac_cv_sh_n_works" = yes || exit 77])
|
---|
50 |
|
---|
51 | # Specify the absolute name of the tool, as some shells don't honor PATH when
|
---|
52 | # running `sh PROG'.
|
---|
53 |
|
---|
54 | AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/bin/autoconf])
|
---|
55 | AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/autoconf])
|
---|
56 | AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/testsuite])
|
---|
57 |
|
---|
58 | # These are not built, they are in the src tree.
|
---|
59 | AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/build-aux/install-sh])
|
---|
60 | AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/build-aux/missing])
|
---|
61 |
|
---|
62 | AT_CLEANUP
|
---|
63 |
|
---|
64 |
|
---|
65 |
|
---|
66 |
|
---|
67 | ## ---------------------------- ##
|
---|
68 | ## Syntax of the Perl scripts. ##
|
---|
69 | ## ---------------------------- ##
|
---|
70 |
|
---|
71 | AT_SETUP([Syntax of the Perl scripts])
|
---|
72 |
|
---|
73 | AT_CHECK_PERL_SYNTAX([autoheader])
|
---|
74 | AT_CHECK_PERL_SYNTAX([autom4te])
|
---|
75 | AT_CHECK_PERL_SYNTAX([autoreconf])
|
---|
76 | AT_CHECK_PERL_SYNTAX([autoscan])
|
---|
77 | AT_CHECK_PERL_SYNTAX([autoupdate])
|
---|
78 | AT_CHECK_PERL_SYNTAX([ifnames])
|
---|
79 |
|
---|
80 | AT_CLEANUP
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 | ## ------------------ ##
|
---|
86 | ## autom4te's cache. ##
|
---|
87 | ## ------------------ ##
|
---|
88 |
|
---|
89 | AT_SETUP([autom4te cache])
|
---|
90 |
|
---|
91 | AT_DATA_M4SUGAR([[script.4s]],
|
---|
92 | [[m4_include([foo])
|
---|
93 | ]])
|
---|
94 |
|
---|
95 | # Everything is OK.
|
---|
96 | touch foo
|
---|
97 | AT_CHECK_M4SUGAR
|
---|
98 |
|
---|
99 | # We moved a file: it should fail
|
---|
100 | mkdir sub
|
---|
101 | mv foo sub
|
---|
102 | AT_CHECK_M4SUGAR([], [1], [],
|
---|
103 | [m4:script.4s:1: cannot open `foo': No such file or directory
|
---|
104 | autom4te: m4 failed with exit status: 1
|
---|
105 | ])
|
---|
106 |
|
---|
107 | # But if we change the main file, then we should no longer complain of
|
---|
108 | # missing files.
|
---|
109 | AT_DATA_M4SUGAR([[script.4s]],
|
---|
110 | [[m4_include([sub/foo])
|
---|
111 | ]])
|
---|
112 | AT_CHECK_M4SUGAR
|
---|
113 |
|
---|
114 | AT_CLEANUP
|
---|
115 |
|
---|
116 |
|
---|
117 | # autom4te --force
|
---|
118 | # ----------------
|
---|
119 |
|
---|
120 | AT_SETUP([autom4te --force])
|
---|
121 |
|
---|
122 | AT_DATA([file.m4],
|
---|
123 | [[right
|
---|
124 | ]])
|
---|
125 | AT_CHECK_AUTOM4TE([-o file file.m4])
|
---|
126 |
|
---|
127 | # Create a file whose time stamp is in the future.
|
---|
128 | # (next year)-01-01 00:01 UTC should always be in the future,
|
---|
129 | # even on slow machines.
|
---|
130 | echo BAD >file
|
---|
131 | this_year=`TZ=UTC0 date +%Y`
|
---|
132 | TZ=UTC0 touch -t `expr $this_year + 1`01010001 file
|
---|
133 |
|
---|
134 | AT_CHECK_AUTOM4TE([--force -o file file.m4])
|
---|
135 | AT_CHECK([cat file], 0,
|
---|
136 | [[right
|
---|
137 | ]])
|
---|
138 |
|
---|
139 | AT_CLEANUP
|
---|
140 |
|
---|
141 |
|
---|
142 |
|
---|
143 |
|
---|
144 | ## ------------------ ##
|
---|
145 | ## autoconf --trace. ##
|
---|
146 | ## ------------------ ##
|
---|
147 |
|
---|
148 |
|
---|
149 | # autoconf --trace: user macros
|
---|
150 | # -----------------------------
|
---|
151 | AT_SETUP([autoconf --trace: user macros])
|
---|
152 |
|
---|
153 | AT_DATA([configure.ac],
|
---|
154 | [[m4_define([active], [ACTIVE])
|
---|
155 | m4_define([TRACE1], [TRACE2(m4_shift($@))])
|
---|
156 | m4_define([TRACE2], [[$2], $1])
|
---|
157 |
|
---|
158 | # No arguments.
|
---|
159 | TRACE1
|
---|
160 | TRACE2
|
---|
161 |
|
---|
162 | # With arguments, single line.
|
---|
163 | TRACE1(foo, @bar, @baz)
|
---|
164 | TRACE1(foo, TRACE1(bar, baz))
|
---|
165 | TRACE1(foo, active, baz)
|
---|
166 | TRACE1(foo, [active], TRACE1(active, [active]))
|
---|
167 | ]])
|
---|
168 |
|
---|
169 | # Several --traces.
|
---|
170 | AT_CHECK_AUTOCONF([-t TRACE1 -t TRACE2], 0,
|
---|
171 | [[configure.ac:6:TRACE1:
|
---|
172 | configure.ac:6:TRACE2:
|
---|
173 | configure.ac:7:TRACE2:
|
---|
174 | configure.ac:10:TRACE1:foo:@bar:@baz
|
---|
175 | configure.ac:10:TRACE2:@bar:@baz
|
---|
176 | configure.ac:11:TRACE1:bar:baz
|
---|
177 | configure.ac:11:TRACE2:baz
|
---|
178 | configure.ac:11:TRACE1:foo::baz
|
---|
179 | configure.ac:11:TRACE2::baz
|
---|
180 | configure.ac:12:TRACE1:foo:ACTIVE:baz
|
---|
181 | configure.ac:12:TRACE2:ACTIVE:baz
|
---|
182 | configure.ac:13:TRACE1:ACTIVE:active
|
---|
183 | configure.ac:13:TRACE2:active
|
---|
184 | configure.ac:13:TRACE1:foo:active::ACTIVE
|
---|
185 | configure.ac:13:TRACE2:active::ACTIVE
|
---|
186 | ]])
|
---|
187 |
|
---|
188 | # Several line requests.
|
---|
189 | AT_CHECK_AUTOCONF([[-t TRACE1:'
|
---|
190 | [$1], [$2], [$3].']], 0,
|
---|
191 | [[
|
---|
192 | [], [], [].
|
---|
193 |
|
---|
194 | [foo], [@bar], [@baz].
|
---|
195 |
|
---|
196 | [bar], [baz], [].
|
---|
197 |
|
---|
198 | [foo], [], [baz].
|
---|
199 |
|
---|
200 | [foo], [ACTIVE], [baz].
|
---|
201 |
|
---|
202 | [ACTIVE], [active], [].
|
---|
203 |
|
---|
204 | [foo], [active], [].
|
---|
205 | ]])
|
---|
206 |
|
---|
207 | # ${sep}@.
|
---|
208 | AT_CHECK_AUTOCONF([-t TRACE2:'${)===(}@'], 0,
|
---|
209 | [[[]
|
---|
210 | []
|
---|
211 | [@bar])===([@baz]
|
---|
212 | [baz]
|
---|
213 | [])===([baz]
|
---|
214 | [ACTIVE])===([baz]
|
---|
215 | [active]
|
---|
216 | [active])===([])===([ACTIVE]
|
---|
217 | ]])
|
---|
218 |
|
---|
219 | # Arguments spanning multiple lines.
|
---|
220 | AT_DATA([configure.ac],
|
---|
221 | [[m4_define([TRACE], [])
|
---|
222 | TRACE(foo
|
---|
223 | bar,
|
---|
224 | bar
|
---|
225 | foo)
|
---|
226 | ]])
|
---|
227 |
|
---|
228 | AT_CHECK_AUTOCONF([-t TRACE:'$%'], 0,
|
---|
229 | [[foo bar:bar foo
|
---|
230 | ]])
|
---|
231 |
|
---|
232 | AT_CLEANUP
|
---|
233 |
|
---|
234 |
|
---|
235 | # autoconf --trace: builtins
|
---|
236 | # --------------------------
|
---|
237 | AT_SETUP([autoconf --trace: builtins])
|
---|
238 |
|
---|
239 | AT_DATA([configure.ac],
|
---|
240 | [[define([active], [ACTIVE])
|
---|
241 | ]])
|
---|
242 |
|
---|
243 | AT_CHECK_AUTOCONF([[-t define | sed -n '$p']],
|
---|
244 | 0,
|
---|
245 | [[configure.ac:1:define:active:ACTIVE
|
---|
246 | ]])
|
---|
247 |
|
---|
248 | # FIXME: Without `$1' the following test dies. Groumphf, once again to
|
---|
249 | # dive into obscure feature interaction...
|
---|
250 | # Note that using `-i' means we need the *.m4 files, not the *.m4f files,
|
---|
251 | # hence we need srcdir, not builddir.
|
---|
252 | AT_CHECK_AUTOCONF([[-t define:'$1' -i| sed -n '$p']],
|
---|
253 | 0,
|
---|
254 | [[active
|
---|
255 | ]])
|
---|
256 |
|
---|
257 | AT_CLEANUP
|
---|
258 |
|
---|
259 |
|
---|
260 |
|
---|
261 | ## ---------------------------- ##
|
---|
262 | ## autoconf: forbidden tokens. ##
|
---|
263 | ## ---------------------------- ##
|
---|
264 |
|
---|
265 |
|
---|
266 | # autoconf: forbidden tokens, basic
|
---|
267 | # ---------------------------------
|
---|
268 | AT_SETUP([autoconf: forbidden tokens, basic])
|
---|
269 |
|
---|
270 | AT_DATA_M4SH([configure.ac],
|
---|
271 | [[AS_INIT
|
---|
272 | m4_foo
|
---|
273 | _m4_bar
|
---|
274 | AS_FOO
|
---|
275 | _AS_BAR
|
---|
276 | [dnl]
|
---|
277 | ]])
|
---|
278 |
|
---|
279 | AT_CHECK_AUTOCONF([], 1, [],
|
---|
280 | [[configure.ac:2: error: possibly undefined macro: m4@&t@_foo
|
---|
281 | If this token and others are legitimate, please use m4@&t@_pattern_allow.
|
---|
282 | See the Autoconf documentation.
|
---|
283 | configure.ac:3: error: possibly undefined macro: _m4@&t@_bar
|
---|
284 | configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
|
---|
285 | configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
|
---|
286 | configure.ac:6: error: possibly undefined macro: d@&t@nl
|
---|
287 | ]])
|
---|
288 |
|
---|
289 | AT_CLEANUP
|
---|
290 |
|
---|
291 |
|
---|
292 | # autoconf: forbidden tokens, exceptions
|
---|
293 | # --------------------------------------
|
---|
294 | AT_SETUP([autoconf: forbidden tokens, exceptions])
|
---|
295 |
|
---|
296 | AT_DATA_M4SH([configure.ac],
|
---|
297 | [[AS_INIT
|
---|
298 |
|
---|
299 | # This is allowed in spite of the name.
|
---|
300 | # It is on purpose that we check the case where there are several
|
---|
301 | # tokens on the same line.
|
---|
302 | m4_pattern_allow([^AS_ALLOWED$])
|
---|
303 | NOT_AS_ALLOWED AS_ALLOWED AS_ALLOWED_NOT
|
---|
304 |
|
---|
305 | # Test forbidding.
|
---|
306 | m4_pattern_forbid([^FORBIDDEN$])
|
---|
307 | NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
|
---|
308 |
|
---|
309 | # Test Autoconf's patterns.
|
---|
310 | AS_THIS_IS_INVALID and _AS_THIS_IS_INVALID_TOO
|
---|
311 | BUT_AZ_THIS_IS_NOT ALTHOUGH_AS_THIS_IS
|
---|
312 | # This is legal, although there is `AS_DEFINE' in there.
|
---|
313 | BAS_DEFINE
|
---|
314 | # AS_THIS_IS_A_COMMENT so just shut up.
|
---|
315 | It would be very bad if Autoconf forgot to expand [AS_]INIT!
|
---|
316 | ]])
|
---|
317 |
|
---|
318 | AT_CHECK_AUTOCONF([], 1, [],
|
---|
319 | [[configure.ac:1: error: possibly undefined macro: AS@&t@_INIT
|
---|
320 | If this token and others are legitimate, please use m4@&t@_pattern_allow.
|
---|
321 | See the Autoconf documentation.
|
---|
322 | configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT
|
---|
323 | configure.ac:10: error: possibly undefined macro: FORBIDDEN
|
---|
324 | configure.ac:14: error: possibly undefined macro: AS@&t@_THIS_IS_INVALID
|
---|
325 | configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO
|
---|
326 | ]])
|
---|
327 |
|
---|
328 | AT_CLEANUP
|
---|
329 |
|
---|
330 |
|
---|
331 | # autoconf: automatically allowed tokens
|
---|
332 | # --------------------------------------
|
---|
333 | AT_SETUP([autoconf: automatically allowed tokens])
|
---|
334 |
|
---|
335 | AT_DATA_M4SH([configure.ac],
|
---|
336 | [[AC_INIT
|
---|
337 | m4_pattern_forbid([^FB_])
|
---|
338 | AC_DEFINE([FB_ONE])
|
---|
339 | AC_SUBST([FB_TWO])
|
---|
340 | AC_OUTPUT
|
---|
341 | ]])
|
---|
342 |
|
---|
343 | AT_CHECK_AUTOCONF
|
---|
344 |
|
---|
345 | AT_CLEANUP
|
---|
346 |
|
---|
347 |
|
---|
348 | # autoconf: do not forbid the empty token
|
---|
349 | # ---------------------------------------
|
---|
350 | AT_SETUP([autoconf: the empty token])
|
---|
351 |
|
---|
352 | AT_DATA_M4SH([configure.ac],
|
---|
353 | [[m4_pattern_allow([^foo$])
|
---|
354 | m4_divert([0])dnl
|
---|
355 | line that begins with a space
|
---|
356 | ]])
|
---|
357 |
|
---|
358 | AT_CHECK_AUTOCONF
|
---|
359 |
|
---|
360 | AT_CLEANUP
|
---|
361 |
|
---|
362 |
|
---|
363 | # autoconf: subdirectories
|
---|
364 | # ------------------------
|
---|
365 | AT_SETUP([autoconf: subdirectories])
|
---|
366 |
|
---|
367 | AT_DATA([configure.ac],
|
---|
368 | [[AC_INIT
|
---|
369 | AC_PROG_MKDIR_P
|
---|
370 | AC_CONFIG_FILES(sub/foo)
|
---|
371 | AC_OUTPUT
|
---|
372 | ]])
|
---|
373 |
|
---|
374 | mkdir sub
|
---|
375 |
|
---|
376 | AT_DATA([sub/foo.in],
|
---|
377 | [[@MKDIR_P@
|
---|
378 | ]])
|
---|
379 |
|
---|
380 | AT_DATA([install-sh])
|
---|
381 |
|
---|
382 | AT_CHECK_AUTOCONF
|
---|
383 | AT_CHECK_CONFIGURE
|
---|
384 | AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
|
---|
385 |
|
---|
386 | AT_CLEANUP
|
---|
387 |
|
---|
388 |
|
---|
389 |
|
---|
390 |
|
---|
391 |
|
---|
392 | ## --------- ##
|
---|
393 | ## ifnames. ##
|
---|
394 | ## --------- ##
|
---|
395 |
|
---|
396 | AT_SETUP([ifnames])
|
---|
397 |
|
---|
398 | AT_DATA([iftest1.c],
|
---|
399 | [[#ifdef DEF1
|
---|
400 | #ifndef DEF2
|
---|
401 | #if ! defined DEF3 && defined DEF4 /* but not defined DEF5 */
|
---|
402 | # if SPACES
|
---|
403 | # if TABS
|
---|
404 | /* #if C_COMMENTS */
|
---|
405 | // #if CXX_COMMENTS
|
---|
406 | #if LINE1 = \
|
---|
407 | LINE2
|
---|
408 | #if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
|
---|
409 | ]])
|
---|
410 |
|
---|
411 | AT_DATA([iftest2.c],
|
---|
412 | [[#ifdef IFTEST2
|
---|
413 | #if VAL1
|
---|
414 | ]])
|
---|
415 |
|
---|
416 | AT_CHECK([ifnames iftest1.c iftest2.c], 0,
|
---|
417 | [DEF1 iftest1.c
|
---|
418 | DEF2 iftest1.c
|
---|
419 | DEF3 iftest1.c
|
---|
420 | DEF4 iftest1.c
|
---|
421 | IFTEST2 iftest2.c
|
---|
422 | LINE1 iftest1.c
|
---|
423 | LINE2 iftest1.c
|
---|
424 | SPACES iftest1.c
|
---|
425 | TABS iftest1.c
|
---|
426 | VAL1 iftest1.c iftest2.c
|
---|
427 | VAL2 iftest1.c
|
---|
428 | VAL3 iftest1.c
|
---|
429 | VAL4 iftest1.c
|
---|
430 | ], [])
|
---|
431 |
|
---|
432 | AT_CLEANUP
|
---|
433 |
|
---|
434 |
|
---|
435 |
|
---|
436 | ## ------------ ##
|
---|
437 | ## autoheader. ##
|
---|
438 | ## ------------ ##
|
---|
439 |
|
---|
440 | # autoheader is intensively used in its modern form throughout this
|
---|
441 | # test suite. But we also have to check that acconfig.h still works.
|
---|
442 | # autoheader uses autoconf --trace, so traces first.
|
---|
443 |
|
---|
444 | AT_SETUP([autoheader])
|
---|
445 |
|
---|
446 | AT_DATA([acconfig.h],
|
---|
447 | [[/* Define this to whatever you want. */
|
---|
448 | #undef this
|
---|
449 | ]])
|
---|
450 |
|
---|
451 |
|
---|
452 | # 1. Check that `acconfig.h' is still honored.
|
---|
453 | AT_DATA([configure.ac],
|
---|
454 | [[AC_INIT
|
---|
455 | AC_CONFIG_HEADERS(config.h:config.hin)
|
---|
456 | AC_DEFINE(this, "whatever you want.")
|
---|
457 | ]])
|
---|
458 |
|
---|
459 | AT_CHECK_AUTOHEADER([], [], [], [ignore])
|
---|
460 | AT_CHECK([cat config.hin], 0,
|
---|
461 | [[/* config.hin. Generated from configure.ac by autoheader. */
|
---|
462 | /* Define this to whatever you want. */
|
---|
463 | #undef this
|
---|
464 |
|
---|
465 | /* Define to the address where bug reports for this package should be sent. */
|
---|
466 | #undef PACKAGE_BUGREPORT
|
---|
467 |
|
---|
468 | /* Define to the full name of this package. */
|
---|
469 | #undef PACKAGE_NAME
|
---|
470 |
|
---|
471 | /* Define to the full name and version of this package. */
|
---|
472 | #undef PACKAGE_STRING
|
---|
473 |
|
---|
474 | /* Define to the one symbol short name of this package. */
|
---|
475 | #undef PACKAGE_TARNAME
|
---|
476 |
|
---|
477 | /* Define to the version of this package. */
|
---|
478 | #undef PACKAGE_VERSION
|
---|
479 | ]])
|
---|
480 |
|
---|
481 |
|
---|
482 | # 2. Check that missing templates are a fatal error.
|
---|
483 | AT_DATA([configure.ac],
|
---|
484 | [[AC_INIT
|
---|
485 | AC_CONFIG_HEADERS(config.h:config.hin)
|
---|
486 | AC_DEFINE(that, "whatever you want.")
|
---|
487 | ]])
|
---|
488 |
|
---|
489 | # The test suite goes too fast for the cache time stamps...
|
---|
490 | # Pass --force.
|
---|
491 | AT_CHECK_AUTOHEADER([--force], [1], [], [ignore])
|
---|
492 |
|
---|
493 |
|
---|
494 | # 3. Check TOP and BOTTOM.
|
---|
495 | AT_DATA([acconfig.h],
|
---|
496 | [[/* Top from acconfig.h. */
|
---|
497 | @TOP@
|
---|
498 | /* Middle from acconfig.h. */
|
---|
499 | @BOTTOM@
|
---|
500 | /* Bottom from acconfig.h. */
|
---|
501 | ]])
|
---|
502 |
|
---|
503 | AT_DATA([configure.ac],
|
---|
504 | [[AC_INIT
|
---|
505 | AC_CONFIG_HEADERS(config.h:config.hin)
|
---|
506 | AH_TOP([Top1 from configure.ac.])
|
---|
507 | AH_TOP([Top2 from configure.ac.])
|
---|
508 | AH_TOP([The Cat in a h@t.])
|
---|
509 | AH_VERBATIM([Middle], [Middle from configure.ac.])
|
---|
510 | AH_VERBATIM([Mouse], [The Mouse in a h@t.])
|
---|
511 | AH_BOTTOM([Bottom1 from configure.ac.])
|
---|
512 | AH_BOTTOM([Bottom2 from configure.ac.])
|
---|
513 | AH_BOTTOM([The Dog in a h@t.])
|
---|
514 |
|
---|
515 | AC_DEFINE([ANT], [@], [The Ant in a h@t.])
|
---|
516 | ]])
|
---|
517 |
|
---|
518 |
|
---|
519 | # Yes, that's right: the `middle' part of `acconfig.h' is still before
|
---|
520 | # the AH_TOP part. But so what, you're not supposed to use the two
|
---|
521 | # together.
|
---|
522 | # Ignore STDERR which is the longuish complaint against autoheader junk
|
---|
523 | # files.
|
---|
524 | AT_CHECK_AUTOHEADER([--force], [], [], [ignore])
|
---|
525 | AT_CHECK([cat config.hin], 0,
|
---|
526 | [[/* config.hin. Generated from configure.ac by autoheader. */
|
---|
527 | /* Top from acconfig.h. */
|
---|
528 | /* Middle from acconfig.h. */
|
---|
529 |
|
---|
530 | Top1 from configure.ac.
|
---|
531 |
|
---|
532 | Top2 from configure.ac.
|
---|
533 |
|
---|
534 | The Cat in a h@t.
|
---|
535 |
|
---|
536 | /* The Ant in a h@t. */
|
---|
537 | #undef ANT
|
---|
538 |
|
---|
539 | Middle from configure.ac.
|
---|
540 |
|
---|
541 | The Mouse in a h@t.
|
---|
542 |
|
---|
543 | /* Define to the address where bug reports for this package should be sent. */
|
---|
544 | #undef PACKAGE_BUGREPORT
|
---|
545 |
|
---|
546 | /* Define to the full name of this package. */
|
---|
547 | #undef PACKAGE_NAME
|
---|
548 |
|
---|
549 | /* Define to the full name and version of this package. */
|
---|
550 | #undef PACKAGE_STRING
|
---|
551 |
|
---|
552 | /* Define to the one symbol short name of this package. */
|
---|
553 | #undef PACKAGE_TARNAME
|
---|
554 |
|
---|
555 | /* Define to the version of this package. */
|
---|
556 | #undef PACKAGE_VERSION
|
---|
557 |
|
---|
558 | Bottom1 from configure.ac.
|
---|
559 |
|
---|
560 | Bottom2 from configure.ac.
|
---|
561 |
|
---|
562 | The Dog in a h@t.
|
---|
563 | /* Bottom from acconfig.h. */
|
---|
564 | ]])
|
---|
565 |
|
---|
566 | AT_CLEANUP
|
---|
567 |
|
---|
568 |
|
---|
569 |
|
---|
570 |
|
---|
571 | ## ------------ ##
|
---|
572 | ## autoupdate. ##
|
---|
573 | ## ------------ ##
|
---|
574 |
|
---|
575 | # Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
|
---|
576 | AT_SETUP([autoupdate])
|
---|
577 |
|
---|
578 | AT_DATA([configure.ac],
|
---|
579 | [[AC_INIT(Test, 1.0)
|
---|
580 | AC_CANONICAL_SYSTEM
|
---|
581 | # The doc says 27 is a valid fubar.
|
---|
582 | fubar=27
|
---|
583 | AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
|
---|
584 | ]])
|
---|
585 |
|
---|
586 | AT_DATA([expout],
|
---|
587 | [[AC_INIT([Test],[1.0])
|
---|
588 | AC_CANONICAL_TARGET
|
---|
589 | # The doc says 27 is a valid fubar.
|
---|
590 | fubar=27
|
---|
591 | AC_CONFIG_FILES([Makefile])
|
---|
592 | AC_CONFIG_COMMANDS([default],[echo $fubar],[fubar=$fubar])
|
---|
593 | AC_OUTPUT
|
---|
594 | ]])
|
---|
595 |
|
---|
596 | # Checking `autoupdate'.
|
---|
597 | AT_CHECK_AUTOUPDATE
|
---|
598 | AT_CHECK([cat configure.ac], 0, [expout])
|
---|
599 | # Checking that `autoupdate' is idempotent
|
---|
600 | AT_CHECK_AUTOUPDATE
|
---|
601 | AT_CHECK([cat configure.ac], 0, [expout])
|
---|
602 |
|
---|
603 | AT_CLEANUP(configure.ac~)
|
---|
604 |
|
---|
605 |
|
---|
606 | # autoupdating AC_LINK_FILES
|
---|
607 | # --------------------------
|
---|
608 | AT_SETUP([autoupdating AC_LINK_FILES])
|
---|
609 |
|
---|
610 | AT_DATA([configure.ac],
|
---|
611 | [[AC_INIT
|
---|
612 | AC_LINK_FILES(dst1 dst2, src1 src2)
|
---|
613 | AC_OUTPUT
|
---|
614 | ]])
|
---|
615 |
|
---|
616 | AT_DATA([dst1], dst1
|
---|
617 | )
|
---|
618 | AT_DATA([dst2], dst2
|
---|
619 | )
|
---|
620 |
|
---|
621 | # Checking `autoupdate'.
|
---|
622 | AT_CHECK_AUTOUPDATE([], 0, [], ignore)
|
---|
623 | AT_CHECK_AUTOCONF
|
---|
624 | AT_CHECK_CONFIGURE
|
---|
625 | AT_CHECK([cat src1], 0, [dst1
|
---|
626 | ])
|
---|
627 | AT_CHECK([cat src2], 0, [dst2
|
---|
628 | ])
|
---|
629 |
|
---|
630 | AT_CLEANUP(src1 src2 configure.ac~)
|
---|
631 |
|
---|
632 |
|
---|
633 | # autoupdating AC_PREREQ
|
---|
634 | # ----------------------
|
---|
635 | AT_SETUP([autoupdating AC_PREREQ])
|
---|
636 |
|
---|
637 | # Produce `AC_PREREQ(<AUTOUPDATE VERSION>)'.
|
---|
638 | AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
|
---|
639 | autoupdate_version=`cat stdout`
|
---|
640 | echo "AC_PREREQ($autoupdate_version)" >expout
|
---|
641 |
|
---|
642 | AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
|
---|
643 | 0, [expout], [])
|
---|
644 |
|
---|
645 | AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
|
---|
646 | 0, [expout], [])
|
---|
647 |
|
---|
648 | AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
|
---|
649 | 63, [], [ignore])
|
---|
650 |
|
---|
651 | AT_CLEANUP
|
---|
652 |
|
---|
653 |
|
---|
654 | # autoupdating AU_ALIAS
|
---|
655 | # ---------------------
|
---|
656 | AT_SETUP([autoupdating AU_ALIAS])
|
---|
657 |
|
---|
658 | AT_DATA([configure.ac],
|
---|
659 | [[AC_INIT
|
---|
660 | AC_DEFUN([FOO], [$#])
|
---|
661 | AU_ALIAS([BAZ],[FOO])
|
---|
662 | test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
|
---|
663 | AC_PROG_CC
|
---|
664 | AC_STDC_HEADERS
|
---|
665 | AC_OUTPUT
|
---|
666 | ]])
|
---|
667 |
|
---|
668 | # Checking `autoupdate'.
|
---|
669 | AT_CHECK_AUTOUPDATE
|
---|
670 | AT_CHECK_AUTOCONF
|
---|
671 | AT_CHECK_CONFIGURE
|
---|
672 | AT_CHECK([grep 'AC_HEADER_STDC(' configure.ac], 1, [ignore], [ignore])
|
---|
673 | AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
|
---|
674 |
|
---|
675 | AT_CLEANUP
|
---|
676 |
|
---|
677 |
|
---|
678 | # autoupdating OLD to NEW
|
---|
679 | # -----------------------
|
---|
680 |
|
---|
681 | # The example taken from the code comments.
|
---|
682 | AT_SETUP([autoupdating OLD to NEW])
|
---|
683 |
|
---|
684 | AT_DATA([aclocal.m4],
|
---|
685 | [[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
|
---|
686 | AC_DEFUN([NEW], [echo "sum($1) = $2"])
|
---|
687 | ]])
|
---|
688 |
|
---|
689 | AT_DATA([configure.ac],
|
---|
690 | [[AC_INIT
|
---|
691 | OLD(1, 2)
|
---|
692 | NEW([0, 0], [0])
|
---|
693 | ]])
|
---|
694 |
|
---|
695 | # Checking `autoupdate'.
|
---|
696 | AT_CHECK_AUTOUPDATE
|
---|
697 | AT_CHECK_AUTOCONF
|
---|
698 | AT_CHECK_CONFIGURE
|
---|
699 | AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
|
---|
700 | AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
|
---|
701 |
|
---|
702 | AT_CLEANUP
|
---|
703 |
|
---|
704 |
|
---|
705 | # autoupdating AC_HELP_STRING
|
---|
706 | # ---------------------------
|
---|
707 | AT_SETUP([autoupdating AC_HELP_STRING])
|
---|
708 |
|
---|
709 | AT_DATA([configure.ac],
|
---|
710 | [[AC_INIT
|
---|
711 | AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
|
---|
712 | ]])
|
---|
713 |
|
---|
714 | # Checking `autoupdate'.
|
---|
715 | AT_CHECK_AUTOUPDATE([], [], [], [ignore])
|
---|
716 | AT_CHECK_AUTOCONF
|
---|
717 | AT_CHECK_CONFIGURE([], [], [], [ignore])
|
---|
718 | AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
|
---|
719 |
|
---|
720 | AT_CLEANUP
|
---|
721 |
|
---|
722 |
|
---|
723 | # autoupdating with m4sugar
|
---|
724 | # -------------------------
|
---|
725 | AT_SETUP([autoupdating with m4sugar])
|
---|
726 |
|
---|
727 | AT_DATA([aclocal.m4],
|
---|
728 | [[AU_DEFUN([OLD],
|
---|
729 | [m4@&t@_pushdef([foo], [bar])dn@&t@l
|
---|
730 | echo "foo $1 foo"
|
---|
731 | m4@&t@_popdef([foo])dn@&t@l
|
---|
732 | ])
|
---|
733 | ]])
|
---|
734 |
|
---|
735 | touch foo.in
|
---|
736 |
|
---|
737 | AT_DATA([configure.ac],
|
---|
738 | [[AC_PREREQ(2.54)
|
---|
739 | m4_define([gnumeric_version_epoch], [1])
|
---|
740 | AC_INIT
|
---|
741 | OLD([ bla bla ])
|
---|
742 | AC_FOREACH([name], [n1 n2],
|
---|
743 | [echo name
|
---|
744 | ])
|
---|
745 | AC_CHECKING([for feature])
|
---|
746 | AC_MSG_RESULT_UNQUOTED([`echo done`])
|
---|
747 |
|
---|
748 | AC_OUTPUT([foo])
|
---|
749 | ]])
|
---|
750 |
|
---|
751 | # Checking `autoupdate'.
|
---|
752 | AT_CHECK_AUTOUPDATE([], [], [], [ignore])
|
---|
753 | AT_CHECK_AUTOCONF
|
---|
754 | AT_CHECK_CONFIGURE([], [], [], [ignore])
|
---|
755 |
|
---|
756 | AT_CLEANUP
|
---|
757 |
|
---|
758 |
|
---|
759 | # autoupdating AC_LANG_SAVE
|
---|
760 | # -------------------------
|
---|
761 | AT_SETUP([autoupdating AC_LANG_SAVE])
|
---|
762 |
|
---|
763 | AT_DATA([configure.ac],
|
---|
764 | [[AC_INIT
|
---|
765 | AC_LANG_SAVE
|
---|
766 | AC_LANG_RESTORE
|
---|
767 | AC_LANG_SAVE
|
---|
768 | AC_LANG_RESTORE
|
---|
769 | ]])
|
---|
770 |
|
---|
771 | # Checking `autoupdate'.
|
---|
772 | AT_CHECK_AUTOUPDATE([], [], [], [ignore])
|
---|
773 | AT_CHECK_AUTOCONF
|
---|
774 | AT_CHECK_CONFIGURE([], [], [], [ignore])
|
---|
775 |
|
---|
776 | AT_CLEANUP
|
---|
777 |
|
---|
778 |
|
---|
779 | # autoupdating AC_FOREACH
|
---|
780 | # -----------------------
|
---|
781 | AT_SETUP([autoupdating AC_FOREACH])
|
---|
782 |
|
---|
783 | AT_DATA([aclocal.m4],
|
---|
784 | [[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
|
---|
785 | ]])
|
---|
786 |
|
---|
787 | AT_DATA([configure.ac],
|
---|
788 | [[AC_INIT
|
---|
789 | echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
|
---|
790 | ]])
|
---|
791 |
|
---|
792 | # Checking `autoupdate'.
|
---|
793 | AT_CHECK_AUTOUPDATE
|
---|
794 | AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
|
---|
795 | AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
|
---|
796 | AT_CHECK_AUTOCONF
|
---|
797 | AT_CHECK_CONFIGURE([], [0], [stdout])
|
---|
798 | AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
|
---|
799 |
|
---|
800 | AT_CLEANUP
|
---|
801 |
|
---|
802 |
|
---|
803 | # autoupdating with aclocal and m4_include
|
---|
804 | # ----------------------------------------
|
---|
805 | AT_SETUP([autoupdating with aclocal and m4@&t@_include])
|
---|
806 |
|
---|
807 | # We use aclocal.
|
---|
808 | AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
|
---|
809 |
|
---|
810 | mkdir m4 aclocal
|
---|
811 | AT_DATA([configure.in],
|
---|
812 | [[AC_INIT(x,0)
|
---|
813 | AC_UNCHANGED_MACRO
|
---|
814 | AC_OLD_MACRO
|
---|
815 | AC_OUTPUT
|
---|
816 | ]])
|
---|
817 | AT_DATA([m4/stuff.m4],
|
---|
818 | [[AU_ALIAS([AC_OLD_MACRO], [AC_NEW_MACRO])
|
---|
819 | AC_DEFUN([AC_NEW_MACRO], [echo hi])
|
---|
820 | AC_DEFUN([AC_UNCHANGED_MACRO], [echo one])
|
---|
821 | ]])
|
---|
822 | cp m4/stuff.m4 aclocal/stuff.m4
|
---|
823 | AT_CHECK([aclocal -I aclocal], [0], [ignore], [ignore])
|
---|
824 | # Checking `autoupdate'.
|
---|
825 | AT_CHECK_AUTOUPDATE
|
---|
826 | AT_CHECK([aclocal -I m4], [0], [ignore], [ignore])
|
---|
827 | AT_CHECK_AUTOUPDATE
|
---|
828 |
|
---|
829 | AT_CLEANUP
|
---|