Reword the copyright notices to match what's suggested in GPLv3.
[autoconf/tsuna.git] / tests / tools.at
blob80a84a1ec854f36c667dcb408c336c2607cd5c07
1 #                                                       -*- Autotest -*-
3 AT_BANNER([Executables (autoheader, autoupdate...).])
5 # Copyright (C) 2000, 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
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 3 of the License, or
10 # (at your option) any later version.
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.
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 ## ----------------------------- ##
22 ## Syntax of the shell scripts.  ##
23 ## ----------------------------- ##
25 # We use `/bin/sh -n script' to check that there are no syntax errors
26 # in the scripts.  Although incredible, there are /bin/sh that go into
27 # endless loops with `-n', e.g., SunOS's:
29 #   $ uname -a
30 #   SunOS ondine 4.1.3 2 sun4m unknown
31 #   $ cat endless.sh
32 #   while false
33 #   do
34 #     :
35 #   done
36 #   exit 0
37 #   $ time sh endless.sh
38 #   sh endless.sh  0,02s user 0,03s system 78% cpu 0,064 total
39 #   $ time sh -nx endless.sh
40 #   ^Csh -nx endless.sh  3,67s user 0,03s system 63% cpu 5,868 total
42 # So before using `/bin/sh -n' to check our scripts, we first check
43 # that `/bin/sh -n' is not broken to death.
45 AT_SETUP([Syntax of the shell scripts])
47 AT_CHECK([test "$ac_cv_sh_n_works" = yes || exit 77])
49 # Specify the absolute name of the tool, as some shells don't honor PATH when
50 # running `sh PROG'.
52 AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/bin/autoconf])
53 AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/autoconf])
54 AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/testsuite])
56 # These are not built, they are in the src tree.
57 AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/build-aux/install-sh])
58 AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/build-aux/missing])
60 AT_CLEANUP
65 ## ---------------------------- ##
66 ## Syntax of the Perl scripts.  ##
67 ## ---------------------------- ##
69 AT_SETUP([Syntax of the Perl scripts])
71 AT_CHECK_PERL_SYNTAX([autoheader])
72 AT_CHECK_PERL_SYNTAX([autom4te])
73 AT_CHECK_PERL_SYNTAX([autoreconf])
74 AT_CHECK_PERL_SYNTAX([autoscan])
75 AT_CHECK_PERL_SYNTAX([autoupdate])
76 AT_CHECK_PERL_SYNTAX([ifnames])
78 AT_CLEANUP
83 ## ------------------ ##
84 ## autom4te's cache.  ##
85 ## ------------------ ##
87 AT_SETUP([autom4te cache])
89 AT_DATA_M4SUGAR([[script.4s]],
90 [[m4_include([foo])
91 ]])
93 # Everything is OK.
94 touch foo
95 AT_CHECK_M4SUGAR
97 # We moved a file: it should fail
98 mkdir sub
99 mv foo sub
100 AT_CHECK_M4SUGAR([], [1], [],
101 [m4:script.4s:1: cannot open `foo': No such file or directory
102 autom4te: m4 failed with exit status: 1
105 # But if we change the main file, then we should no longer complain of
106 # missing files.
107 AT_DATA_M4SUGAR([[script.4s]],
108 [[m4_include([sub/foo])
110 AT_CHECK_M4SUGAR
112 AT_CLEANUP
115 # autom4te --force
116 # ----------------
118 AT_SETUP([autom4te --force])
120 AT_DATA([file.m4],
121 [[right
123 AT_CHECK_AUTOM4TE([-o file file.m4])
125 # Create a file whose time stamp is in the future.
126 # (next year)-01-01 00:01 UTC should always be in the future,
127 # even on slow machines.
128 echo BAD >file
129 this_year=`TZ=UTC0 date +%Y`
130 TZ=UTC0 touch -t `expr $this_year + 1`01010001 file
132 AT_CHECK_AUTOM4TE([--force -o file file.m4])
133 AT_CHECK([cat file], 0,
134 [[right
137 AT_CLEANUP
142 ## ------------------ ##
143 ## autoconf --trace.  ##
144 ## ------------------ ##
147 # autoconf --trace: user macros
148 # -----------------------------
149 AT_SETUP([autoconf --trace: user macros])
151 AT_DATA([configure.ac],
152 [[m4_define([active], [ACTIVE])
153 m4_define([TRACE1], [TRACE2(m4_shift($@))])
154 m4_define([TRACE2], [[$2], $1])
156 # No arguments.
157 TRACE1
158 TRACE2
160 # With arguments, single line.
161 TRACE1(foo, @bar, @baz)
162 TRACE1(foo, TRACE1(bar, baz))
163 TRACE1(foo, active, baz)
164 TRACE1(foo, [active], TRACE1(active, [active]))
167 # Several --traces.
168 AT_CHECK_AUTOCONF([-t TRACE1 -t TRACE2], 0,
169 [[configure.ac:6:TRACE1:
170 configure.ac:6:TRACE2:
171 configure.ac:7:TRACE2:
172 configure.ac:10:TRACE1:foo:@bar:@baz
173 configure.ac:10:TRACE2:@bar:@baz
174 configure.ac:11:TRACE1:bar:baz
175 configure.ac:11:TRACE2:baz
176 configure.ac:11:TRACE1:foo::baz
177 configure.ac:11:TRACE2::baz
178 configure.ac:12:TRACE1:foo:ACTIVE:baz
179 configure.ac:12:TRACE2:ACTIVE:baz
180 configure.ac:13:TRACE1:ACTIVE:active
181 configure.ac:13:TRACE2:active
182 configure.ac:13:TRACE1:foo:active::ACTIVE
183 configure.ac:13:TRACE2:active::ACTIVE
186 # Several line requests.
187 AT_CHECK_AUTOCONF([[-t TRACE1:'
188 [$1], [$2], [$3].']], 0,
190 [], [], [].
192 [foo], [@bar], [@baz].
194 [bar], [baz], [].
196 [foo], [], [baz].
198 [foo], [ACTIVE], [baz].
200 [ACTIVE], [active], [].
202 [foo], [active], [].
205 # ${sep}@.
206 AT_CHECK_AUTOCONF([-t TRACE2:'${)===(}@'], 0,
207 [[[]
209 [@bar])===([@baz]
210 [baz]
211 [])===([baz]
212 [ACTIVE])===([baz]
213 [active]
214 [active])===([])===([ACTIVE]
217 # Arguments spanning multiple lines.
218 AT_DATA([configure.ac],
219 [[m4_define([TRACE], [])
220 TRACE(foo
221 bar,
223 foo)
226 AT_CHECK_AUTOCONF([-t TRACE:'$%'], 0,
227 [[foo bar:bar foo
230 AT_CLEANUP
233 # autoconf --trace: builtins
234 # --------------------------
235 AT_SETUP([autoconf --trace: builtins])
237 AT_DATA([configure.ac],
238 [[define([active], [ACTIVE])
241 AT_CHECK_AUTOCONF([[-t define | sed -n '$p']],
242          0,
243 [[configure.ac:1:define:active:ACTIVE
246 # FIXME: Without `$1' the following test dies.  Groumphf, once again to
247 # dive into obscure feature interaction...
248 # Note that using `-i' means we need the *.m4 files, not the *.m4f files,
249 # hence we need srcdir, not builddir.
250 AT_CHECK_AUTOCONF([[-t define:'$1' -i| sed -n '$p']],
251          0,
252 [[active
255 AT_CLEANUP
259 ## ---------------------------- ##
260 ## autoconf: forbidden tokens.  ##
261 ## ---------------------------- ##
264 # autoconf: forbidden tokens, basic
265 # ---------------------------------
266 AT_SETUP([autoconf: forbidden tokens, basic])
268 AT_DATA_M4SH([configure.ac],
269 [[AS_INIT
270 m4_foo
271 _m4_bar
272 AS_FOO
273 _AS_BAR
274 [dnl]
277 AT_CHECK_AUTOCONF([], 1, [],
278 [[configure.ac:2: error: possibly undefined macro: m4@&t@_foo
279       If this token and others are legitimate, please use m4@&t@_pattern_allow.
280       See the Autoconf documentation.
281 configure.ac:3: error: possibly undefined macro: _m4@&t@_bar
282 configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
283 configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
284 configure.ac:6: error: possibly undefined macro: d@&t@nl
286 # Second run should succeed and yield no output.
287 AT_CHECK([autoconf])
289 AT_CLEANUP
292 # autoconf: forbidden tokens, exceptions
293 # --------------------------------------
294 AT_SETUP([autoconf: forbidden tokens, exceptions])
296 AT_DATA_M4SH([configure.ac],
297 [[AS_INIT
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
305 # Test forbidding.
306 m4_pattern_forbid([^FORBIDDEN$])
307 NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
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!
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
328 AT_CLEANUP
331 # autoconf: automatically allowed tokens
332 # --------------------------------------
333 AT_SETUP([autoconf: automatically allowed tokens])
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
343 AT_CHECK_AUTOCONF
345 AT_CLEANUP
348 # autoconf: do not forbid the empty token
349 # ---------------------------------------
350 AT_SETUP([autoconf: the empty token])
352 AT_DATA_M4SH([configure.ac],
353 [[m4_pattern_allow([^foo$])
354 m4_divert([0])dnl
355  line that begins with a space
358 AT_CHECK_AUTOCONF
360 AT_CLEANUP
363 # autoconf: subdirectories
364 # ------------------------
365 AT_SETUP([autoconf: subdirectories])
367 AT_DATA([configure.ac],
368 [[AC_INIT
369 AC_PROG_MKDIR_P
370 AC_CONFIG_FILES(sub/foo)
371 AC_OUTPUT
374 mkdir sub
376 AT_DATA([sub/foo.in],
377 [[@MKDIR_P@
380 AT_DATA([install-sh])
382 AT_CHECK_AUTOCONF
383 AT_CHECK_CONFIGURE
384 AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
386 AT_CLEANUP
389 # autoconf: input from stdin
390 # --------------------------
391 AT_SETUP([autoconf: input from stdin])
393 # Past Autoconf versions failed to read from stdin when other, non-frozen input
394 # files were present.
395 AT_DATA([aclocal.m4])
397 AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
398          0, [stdin:1:AC_INIT:X:1.0:bug-autoconf@gnu.org
400 AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
401          0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org
404 AT_CLEANUP
409 ## --------- ##
410 ## ifnames.  ##
411 ## --------- ##
413 AT_SETUP([ifnames])
415 AT_DATA([iftest1.c],
416 [[#ifdef DEF1
417 #ifndef DEF2
418 #if ! defined DEF3 && defined DEF4 /* but not defined DEF5 */
419     # if SPACES
420         #       if      TABS
421 /* #if C_COMMENTS */
422 // #if CXX_COMMENTS
423 #if LINE1 = \
424 LINE2
425 #if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
428 AT_DATA([iftest2.c],
429 [[#ifdef IFTEST2
430 #if VAL1
433 AT_CHECK([ifnames iftest1.c iftest2.c], 0,
434 [DEF1 iftest1.c
435 DEF2 iftest1.c
436 DEF3 iftest1.c
437 DEF4 iftest1.c
438 IFTEST2 iftest2.c
439 LINE1 iftest1.c
440 LINE2 iftest1.c
441 SPACES iftest1.c
442 TABS iftest1.c
443 VAL1 iftest1.c iftest2.c
444 VAL2 iftest1.c
445 VAL3 iftest1.c
446 VAL4 iftest1.c
447 ], [])
449 AT_CLEANUP
453 ## ------------ ##
454 ## autoheader.  ##
455 ## ------------ ##
457 # autoheader is intensively used in its modern form throughout this
458 # test suite.  But we also have to check that acconfig.h still works.
459 # autoheader uses autoconf --trace, so traces first.
461 AT_SETUP([autoheader])
463 AT_DATA([acconfig.h],
464 [[/* Define this to whatever you want. */
465 #undef this
469 # 1. Check that `acconfig.h' is still honored.
470 AT_DATA([configure.ac],
471 [[AC_INIT
472 AC_CONFIG_HEADERS(config.h:config.hin)
473 AC_DEFINE(this, "whatever you want.")
476 AT_CHECK_AUTOHEADER([], [], [], [ignore])
477 AT_CHECK([cat config.hin], 0,
478 [[/* config.hin.  Generated from configure.ac by autoheader.  */
479 /* Define this to whatever you want. */
480 #undef this
482 /* Define to the address where bug reports for this package should be sent. */
483 #undef PACKAGE_BUGREPORT
485 /* Define to the full name of this package. */
486 #undef PACKAGE_NAME
488 /* Define to the full name and version of this package. */
489 #undef PACKAGE_STRING
491 /* Define to the one symbol short name of this package. */
492 #undef PACKAGE_TARNAME
494 /* Define to the version of this package. */
495 #undef PACKAGE_VERSION
499 # 2. Check that missing templates are a fatal error.
500 AT_DATA([configure.ac],
501 [[AC_INIT
502 AC_CONFIG_HEADERS(config.h:config.hin)
503 AC_DEFINE(that, "whatever you want.")
506 # The test suite goes too fast for the cache time stamps...
507 # Pass --force.
508 AT_CHECK_AUTOHEADER([--force], [1], [], [ignore])
511 # 3. Check TOP and BOTTOM.
512 AT_DATA([acconfig.h],
513 [[/* Top from acconfig.h. */
514 @TOP@
515 /* Middle from acconfig.h. */
516 @BOTTOM@
517 /* Bottom from acconfig.h. */
520 AT_DATA([configure.ac],
521 [[AC_INIT
522 AC_CONFIG_HEADERS(config.h:config.hin)
523 AH_TOP([Top1 from configure.ac.])
524 AH_TOP([Top2 from configure.ac.])
525 AH_TOP([The Cat in a h@t.])
526 AH_VERBATIM([Middle], [Middle from configure.ac.])
527 AH_VERBATIM([Mouse],  [The Mouse in a h@t.])
528 AH_BOTTOM([Bottom1 from configure.ac.])
529 AH_BOTTOM([Bottom2 from configure.ac.])
530 AH_BOTTOM([The Dog in a h@t.])
532 AC_DEFINE([ANT], [@], [The Ant in a h@t.])
536 # Yes, that's right: the `middle' part of `acconfig.h' is still before
537 # the AH_TOP part.  But so what, you're not supposed to use the two
538 # together.
539 # Ignore STDERR which is the longuish complaint against autoheader junk
540 # files.
541 AT_CHECK_AUTOHEADER([--force], [], [], [ignore])
542 AT_CHECK([cat config.hin], 0,
543 [[/* config.hin.  Generated from configure.ac by autoheader.  */
544 /* Top from acconfig.h. */
545 /* Middle from acconfig.h. */
547 Top1 from configure.ac.
549 Top2 from configure.ac.
551 The Cat in a h@t.
553 /* The Ant in a h@t. */
554 #undef ANT
556 Middle from configure.ac.
558 The Mouse in a h@t.
560 /* Define to the address where bug reports for this package should be sent. */
561 #undef PACKAGE_BUGREPORT
563 /* Define to the full name of this package. */
564 #undef PACKAGE_NAME
566 /* Define to the full name and version of this package. */
567 #undef PACKAGE_STRING
569 /* Define to the one symbol short name of this package. */
570 #undef PACKAGE_TARNAME
572 /* Define to the version of this package. */
573 #undef PACKAGE_VERSION
575 Bottom1 from configure.ac.
577 Bottom2 from configure.ac.
579 The Dog in a h@t.
580 /* Bottom from acconfig.h. */
583 AT_CLEANUP
588 ## ------------ ##
589 ## autoupdate.  ##
590 ## ------------ ##
592 # Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
593 AT_SETUP([autoupdate])
595 AT_DATA([configure.ac],
596 [[AC_INIT(Test, 1.0)
597 AC_CANONICAL_SYSTEM
598 # The doc says 27 is a valid fubar.
599 fubar=27
600 AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
603 AT_DATA([expout],
604 [[AC_INIT([Test],[1.0])
605 AC_CANONICAL_TARGET
606 # The doc says 27 is a valid fubar.
607 fubar=27
608 AC_CONFIG_FILES([Makefile])
609 AC_CONFIG_COMMANDS([default],[echo $fubar],[fubar=$fubar])
610 AC_OUTPUT
613 # Checking `autoupdate'.
614 AT_CHECK_AUTOUPDATE
615 AT_CHECK([cat configure.ac], 0, [expout])
616 # Checking that `autoupdate' is idempotent
617 AT_CHECK_AUTOUPDATE
618 AT_CHECK([cat configure.ac], 0, [expout])
620 AT_CLEANUP
623 # autoupdating AC_LINK_FILES
624 # --------------------------
625 AT_SETUP([autoupdating AC_LINK_FILES])
627 AT_DATA([configure.ac],
628 [[AC_INIT
629 AC_LINK_FILES(dst1 dst2, src1 src2)
630 AC_OUTPUT
633 AT_DATA([dst1], dst1
635 AT_DATA([dst2], dst2
638 # Checking `autoupdate'.
639 AT_CHECK_AUTOUPDATE([], 0, [], ignore)
640 AT_CHECK_AUTOCONF
641 AT_CHECK_CONFIGURE
642 AT_CHECK([cat src1], 0, [dst1
644 AT_CHECK([cat src2], 0, [dst2
647 AT_CLEANUP
650 # autoupdating AC_PREREQ
651 # ----------------------
652 AT_SETUP([autoupdating AC_PREREQ])
654 # Produce `AC_PREREQ(<AUTOUPDATE VERSION>)'.
655 AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
656 autoupdate_version=`cat stdout`
657 echo "AC_PREREQ($autoupdate_version)" >expout
659 AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
660          0, [expout], [])
662 AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
663          0, [expout], [])
665 AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
666          63, [], [ignore])
668 AT_CLEANUP
671 # autoupdating AU_ALIAS
672 # ---------------------
673 AT_SETUP([autoupdating AU_ALIAS])
675 AT_DATA([configure.ac],
676 [[AC_INIT
677 AC_DEFUN([FOO], [$#])
678 AU_ALIAS([BAZ],[FOO])
679 test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
680 AC_PROG_CC
681 AC_STDC_HEADERS
682 AC_OUTPUT
685 # Checking `autoupdate'.
686 AT_CHECK_AUTOUPDATE
687 AT_CHECK_AUTOCONF
688 AT_CHECK_CONFIGURE
689 AT_CHECK([grep 'AC_HEADER_STDC(' configure.ac], 1, [ignore], [ignore])
690 AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
692 AT_CLEANUP
695 # autoupdating OLD to NEW
696 # -----------------------
698 # The example taken from the code comments.
699 AT_SETUP([autoupdating OLD to NEW])
701 AT_DATA([aclocal.m4],
702 [[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
703 AC_DEFUN([NEW], [echo "sum($1) = $2"])
706 AT_DATA([configure.ac],
707 [[AC_INIT
708 OLD(1, 2)
709 NEW([0, 0], [0])
712 # Checking `autoupdate'.
713 AT_CHECK_AUTOUPDATE
714 AT_CHECK_AUTOCONF
715 AT_CHECK_CONFIGURE
716 AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
717 AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
719 AT_CLEANUP
722 # autoupdating AC_HELP_STRING
723 # ---------------------------
724 AT_SETUP([autoupdating AC_HELP_STRING])
726 AT_DATA([configure.ac],
727 [[AC_INIT
728 AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
731 # Checking `autoupdate'.
732 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
733 AT_CHECK_AUTOCONF
734 AT_CHECK_CONFIGURE([], [], [], [ignore])
735 AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
737 AT_CLEANUP
740 # autoupdating with m4sugar
741 # -------------------------
742 AT_SETUP([autoupdating with m4sugar])
744 AT_DATA([aclocal.m4],
745 [[AU_DEFUN([OLD],
746 [m4@&t@_pushdef([foo], [bar])dn@&t@l
747 echo "foo $1 foo"
748 m4@&t@_popdef([foo])dn@&t@l
752 touch foo.in
754 AT_DATA([configure.ac],
755 [[AC_PREREQ(2.54)
756 m4_define([gnumeric_version_epoch], [1])
757 AC_INIT
758 OLD([ bla  bla ])
759 AC_FOREACH([name], [n1 n2],
760            [echo name
762 AC_CHECKING([for feature])
763 AC_MSG_RESULT_UNQUOTED([`echo done`])
765 AC_OUTPUT([foo])
768 # Checking `autoupdate'.
769 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
770 AT_CHECK_AUTOCONF
771 AT_CHECK_CONFIGURE([], [], [], [ignore])
773 AT_CLEANUP
776 # autoupdating AC_LANG_SAVE
777 # -------------------------
778 AT_SETUP([autoupdating AC_LANG_SAVE])
780 AT_DATA([configure.ac],
781 [[AC_INIT
782 AC_LANG_SAVE
783 AC_LANG_RESTORE
784 AC_LANG_SAVE
785 AC_LANG_RESTORE
788 # Checking `autoupdate'.
789 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
790 AT_CHECK_AUTOCONF
791 AT_CHECK_CONFIGURE([], [], [], [ignore])
793 AT_CLEANUP
796 # autoupdating AC_FOREACH
797 # -----------------------
798 AT_SETUP([autoupdating AC_FOREACH])
800 AT_DATA([aclocal.m4],
801 [[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
804 AT_DATA([configure.ac],
805 [[AC_INIT
806 echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
809 # Checking `autoupdate'.
810 AT_CHECK_AUTOUPDATE
811 AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
812 AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
813 AT_CHECK_AUTOCONF
814 AT_CHECK_CONFIGURE([], [0], [stdout])
815 AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
817 AT_CLEANUP
820 # autoupdating with aclocal and m4_include
821 # ----------------------------------------
822 AT_SETUP([autoupdating with aclocal and m4@&t@_include])
824 # We use aclocal.
825 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
827 mkdir m4 aclocal
828 AT_DATA([configure.in],
829 [[AC_INIT(x,0)
830 AC_UNCHANGED_MACRO
831 AC_OLD_MACRO
832 AC_OUTPUT
834 AT_DATA([m4/stuff.m4],
835 [[AU_ALIAS([AC_OLD_MACRO], [AC_NEW_MACRO])
836 AC_DEFUN([AC_NEW_MACRO], [echo hi])
837 AC_DEFUN([AC_UNCHANGED_MACRO], [echo one])
839 cp m4/stuff.m4 aclocal/stuff.m4
840 AT_CHECK([aclocal -I aclocal], [0], [ignore], [ignore])
841 # Checking `autoupdate'.
842 AT_CHECK_AUTOUPDATE
843 AT_CHECK([aclocal -I m4], [0], [ignore], [ignore])
844 AT_CHECK_AUTOUPDATE
846 AT_CLEANUP
849 # Keeping autom4te.cfg complete
850 # -----------------------------
852 AT_SETUP([autom4te preselections])
853 : ${sleep='sleep 1'}    # Command to force different time stamps.
854 # If this test should run on FAT file systems and older w32,
855 # then setting $sleep correctly needs to be revisited.
857 # We use aclocal and automake.
858 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
859 AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
861 AT_DATA([configure.in],
862 [[AC_INIT(GNU foo, 1.0)
863 AM_INIT_AUTOMAKE
864 AC_CONFIG_FILES([Makefile])
865 AC_OUTPUT
868 AT_DATA([Makefile.am],
869 [[AUTOMAKE_OPTIONS = foreign
872 $sleep # `aclocal.m4' should be strictly younger than its inputs
874 # If Autoconf is too old, or the user has turned caching off, skip:
875 AT_CHECK([aclocal || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }],
876          [], [], [ignore])
877 AT_CHECK([test -d autom4te.cache || exit 77])
878 AT_CHECK([autoconf])
880 # If this test fails due to missing entries in lib/autom4te.in, then
881 # comparing the old and new requests is a good place to start debugging:
882 cp autom4te.cache/requests old-requests
883 echo newer >newer
884 $sleep # if `configure' is regenerated, we want it to be strictly newer,
885        # to catch the error consistently.
886 AT_CHECK([aclocal], [], [], [ignore])
887 AT_CHECK([automake --no-force --add-missing], [], [], [ignore])
888 AT_CHECK([autoconf])
889 AT_CHECK([test "`find configure -newer newer`" = "" ||
890           { diff old-requests autom4te.cache/requests; exit 1; }])
892 AT_CLEANUP