* doc/autoconf.texi (Generic Compiler Characteristics): Fix typo
[autoconf/tsuna.git] / tests / tools.at
blob79fc66f45f872e5f0ee85144bc8e6278f9f744c0
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 2, or (at your option)
10 # 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, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 # 02110-1301, USA.
23 ## ----------------------------- ##
24 ## Syntax of the shell scripts.  ##
25 ## ----------------------------- ##
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:
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
44 # So before using `/bin/sh -n' to check our scripts, we first check
45 # that `/bin/sh -n' is not broken to death.
47 AT_SETUP([Syntax of the shell scripts])
49 AT_CHECK([test "$ac_cv_sh_n_works" = yes || exit 77])
51 # Specify the absolute name of the tool, as some shells don't honor PATH when
52 # running `sh PROG'.
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])
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])
62 AT_CLEANUP
67 ## ---------------------------- ##
68 ## Syntax of the Perl scripts.  ##
69 ## ---------------------------- ##
71 AT_SETUP([Syntax of the Perl scripts])
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])
80 AT_CLEANUP
85 ## ------------------ ##
86 ## autom4te's cache.  ##
87 ## ------------------ ##
89 AT_SETUP([autom4te cache])
91 AT_DATA_M4SUGAR([[script.4s]],
92 [[m4_include([foo])
93 ]])
95 # Everything is OK.
96 touch foo
97 AT_CHECK_M4SUGAR
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
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])
112 AT_CHECK_M4SUGAR
114 AT_CLEANUP
117 # autom4te --force
118 # ----------------
120 AT_SETUP([autom4te --force])
122 AT_DATA([file.m4],
123 [[right
125 AT_CHECK_AUTOM4TE([-o file file.m4])
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
134 AT_CHECK_AUTOM4TE([--force -o file file.m4])
135 AT_CHECK([cat file], 0,
136 [[right
139 AT_CLEANUP
144 ## ------------------ ##
145 ## autoconf --trace.  ##
146 ## ------------------ ##
149 # autoconf --trace: user macros
150 # -----------------------------
151 AT_SETUP([autoconf --trace: user macros])
153 AT_DATA([configure.ac],
154 [[m4_define([active], [ACTIVE])
155 m4_define([TRACE1], [TRACE2(m4_shift($@))])
156 m4_define([TRACE2], [[$2], $1])
158 # No arguments.
159 TRACE1
160 TRACE2
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]))
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
188 # Several line requests.
189 AT_CHECK_AUTOCONF([[-t TRACE1:'
190 [$1], [$2], [$3].']], 0,
192 [], [], [].
194 [foo], [@bar], [@baz].
196 [bar], [baz], [].
198 [foo], [], [baz].
200 [foo], [ACTIVE], [baz].
202 [ACTIVE], [active], [].
204 [foo], [active], [].
207 # ${sep}@.
208 AT_CHECK_AUTOCONF([-t TRACE2:'${)===(}@'], 0,
209 [[[]
211 [@bar])===([@baz]
212 [baz]
213 [])===([baz]
214 [ACTIVE])===([baz]
215 [active]
216 [active])===([])===([ACTIVE]
219 # Arguments spanning multiple lines.
220 AT_DATA([configure.ac],
221 [[m4_define([TRACE], [])
222 TRACE(foo
223 bar,
225 foo)
228 AT_CHECK_AUTOCONF([-t TRACE:'$%'], 0,
229 [[foo bar:bar foo
232 AT_CLEANUP
235 # autoconf --trace: builtins
236 # --------------------------
237 AT_SETUP([autoconf --trace: builtins])
239 AT_DATA([configure.ac],
240 [[define([active], [ACTIVE])
243 AT_CHECK_AUTOCONF([[-t define | sed -n '$p']],
244          0,
245 [[configure.ac:1:define:active:ACTIVE
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
257 AT_CLEANUP
261 ## ---------------------------- ##
262 ## autoconf: forbidden tokens.  ##
263 ## ---------------------------- ##
266 # autoconf: forbidden tokens, basic
267 # ---------------------------------
268 AT_SETUP([autoconf: forbidden tokens, basic])
270 AT_DATA_M4SH([configure.ac],
271 [[AS_INIT
272 m4_foo
273 _m4_bar
274 AS_FOO
275 _AS_BAR
276 [dnl]
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
288 # Second run should succeed and yield no output.
289 AT_CHECK([autoconf])
291 AT_CLEANUP
294 # autoconf: forbidden tokens, exceptions
295 # --------------------------------------
296 AT_SETUP([autoconf: forbidden tokens, exceptions])
298 AT_DATA_M4SH([configure.ac],
299 [[AS_INIT
301 # This is allowed in spite of the name.
302 # It is on purpose that we check the case where there are several
303 # tokens on the same line.
304 m4_pattern_allow([^AS_ALLOWED$])
305 NOT_AS_ALLOWED AS_ALLOWED AS_ALLOWED_NOT
307 # Test forbidding.
308 m4_pattern_forbid([^FORBIDDEN$])
309 NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
311 # Test Autoconf's patterns.
312 AS_THIS_IS_INVALID and _AS_THIS_IS_INVALID_TOO
313 BUT_AZ_THIS_IS_NOT ALTHOUGH_AS_THIS_IS
314 # This is legal, although there is `AS_DEFINE' in there.
315 BAS_DEFINE
316 # AS_THIS_IS_A_COMMENT so just shut up.
317 It would be very bad if Autoconf forgot to expand [AS_]INIT!
320 AT_CHECK_AUTOCONF([], 1, [],
321 [[configure.ac:1: error: possibly undefined macro: AS@&t@_INIT
322       If this token and others are legitimate, please use m4@&t@_pattern_allow.
323       See the Autoconf documentation.
324 configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT
325 configure.ac:10: error: possibly undefined macro: FORBIDDEN
326 configure.ac:14: error: possibly undefined macro: AS@&t@_THIS_IS_INVALID
327 configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO
330 AT_CLEANUP
333 # autoconf: automatically allowed tokens
334 # --------------------------------------
335 AT_SETUP([autoconf: automatically allowed tokens])
337 AT_DATA_M4SH([configure.ac],
338 [[AC_INIT
339 m4_pattern_forbid([^FB_])
340 AC_DEFINE([FB_ONE])
341 AC_SUBST([FB_TWO])
342 AC_OUTPUT
345 AT_CHECK_AUTOCONF
347 AT_CLEANUP
350 # autoconf: do not forbid the empty token
351 # ---------------------------------------
352 AT_SETUP([autoconf: the empty token])
354 AT_DATA_M4SH([configure.ac],
355 [[m4_pattern_allow([^foo$])
356 m4_divert([0])dnl
357  line that begins with a space
360 AT_CHECK_AUTOCONF
362 AT_CLEANUP
365 # autoconf: subdirectories
366 # ------------------------
367 AT_SETUP([autoconf: subdirectories])
369 AT_DATA([configure.ac],
370 [[AC_INIT
371 AC_PROG_MKDIR_P
372 AC_CONFIG_FILES(sub/foo)
373 AC_OUTPUT
376 mkdir sub
378 AT_DATA([sub/foo.in],
379 [[@MKDIR_P@
382 AT_DATA([install-sh])
384 AT_CHECK_AUTOCONF
385 AT_CHECK_CONFIGURE
386 AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
388 AT_CLEANUP
391 # autoconf: input from stdin
392 # --------------------------
393 AT_SETUP([autoconf: input from stdin])
395 # Past Autoconf versions failed to read from stdin when other, non-frozen input
396 # files were present.
397 AT_DATA([aclocal.m4])
399 AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
400          0, [stdin:1:AC_INIT:X:1.0:bug-autoconf@gnu.org
402 AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
403          0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org
406 AT_CLEANUP
411 ## --------- ##
412 ## ifnames.  ##
413 ## --------- ##
415 AT_SETUP([ifnames])
417 AT_DATA([iftest1.c],
418 [[#ifdef DEF1
419 #ifndef DEF2
420 #if ! defined DEF3 && defined DEF4 /* but not defined DEF5 */
421     # if SPACES
422         #       if      TABS
423 /* #if C_COMMENTS */
424 // #if CXX_COMMENTS
425 #if LINE1 = \
426 LINE2
427 #if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
430 AT_DATA([iftest2.c],
431 [[#ifdef IFTEST2
432 #if VAL1
435 AT_CHECK([ifnames iftest1.c iftest2.c], 0,
436 [DEF1 iftest1.c
437 DEF2 iftest1.c
438 DEF3 iftest1.c
439 DEF4 iftest1.c
440 IFTEST2 iftest2.c
441 LINE1 iftest1.c
442 LINE2 iftest1.c
443 SPACES iftest1.c
444 TABS iftest1.c
445 VAL1 iftest1.c iftest2.c
446 VAL2 iftest1.c
447 VAL3 iftest1.c
448 VAL4 iftest1.c
449 ], [])
451 AT_CLEANUP
455 ## ------------ ##
456 ## autoheader.  ##
457 ## ------------ ##
459 # autoheader is intensively used in its modern form throughout this
460 # test suite.  But we also have to check that acconfig.h still works.
461 # autoheader uses autoconf --trace, so traces first.
463 AT_SETUP([autoheader])
465 AT_DATA([acconfig.h],
466 [[/* Define this to whatever you want. */
467 #undef this
471 # 1. Check that `acconfig.h' is still honored.
472 AT_DATA([configure.ac],
473 [[AC_INIT
474 AC_CONFIG_HEADERS(config.h:config.hin)
475 AC_DEFINE(this, "whatever you want.")
478 AT_CHECK_AUTOHEADER([], [], [], [ignore])
479 AT_CHECK([cat config.hin], 0,
480 [[/* config.hin.  Generated from configure.ac by autoheader.  */
481 /* Define this to whatever you want. */
482 #undef this
484 /* Define to the address where bug reports for this package should be sent. */
485 #undef PACKAGE_BUGREPORT
487 /* Define to the full name of this package. */
488 #undef PACKAGE_NAME
490 /* Define to the full name and version of this package. */
491 #undef PACKAGE_STRING
493 /* Define to the one symbol short name of this package. */
494 #undef PACKAGE_TARNAME
496 /* Define to the version of this package. */
497 #undef PACKAGE_VERSION
501 # 2. Check that missing templates are a fatal error.
502 AT_DATA([configure.ac],
503 [[AC_INIT
504 AC_CONFIG_HEADERS(config.h:config.hin)
505 AC_DEFINE(that, "whatever you want.")
508 # The test suite goes too fast for the cache time stamps...
509 # Pass --force.
510 AT_CHECK_AUTOHEADER([--force], [1], [], [ignore])
513 # 3. Check TOP and BOTTOM.
514 AT_DATA([acconfig.h],
515 [[/* Top from acconfig.h. */
516 @TOP@
517 /* Middle from acconfig.h. */
518 @BOTTOM@
519 /* Bottom from acconfig.h. */
522 AT_DATA([configure.ac],
523 [[AC_INIT
524 AC_CONFIG_HEADERS(config.h:config.hin)
525 AH_TOP([Top1 from configure.ac.])
526 AH_TOP([Top2 from configure.ac.])
527 AH_TOP([The Cat in a h@t.])
528 AH_VERBATIM([Middle], [Middle from configure.ac.])
529 AH_VERBATIM([Mouse],  [The Mouse in a h@t.])
530 AH_BOTTOM([Bottom1 from configure.ac.])
531 AH_BOTTOM([Bottom2 from configure.ac.])
532 AH_BOTTOM([The Dog in a h@t.])
534 AC_DEFINE([ANT], [@], [The Ant in a h@t.])
538 # Yes, that's right: the `middle' part of `acconfig.h' is still before
539 # the AH_TOP part.  But so what, you're not supposed to use the two
540 # together.
541 # Ignore STDERR which is the longuish complaint against autoheader junk
542 # files.
543 AT_CHECK_AUTOHEADER([--force], [], [], [ignore])
544 AT_CHECK([cat config.hin], 0,
545 [[/* config.hin.  Generated from configure.ac by autoheader.  */
546 /* Top from acconfig.h. */
547 /* Middle from acconfig.h. */
549 Top1 from configure.ac.
551 Top2 from configure.ac.
553 The Cat in a h@t.
555 /* The Ant in a h@t. */
556 #undef ANT
558 Middle from configure.ac.
560 The Mouse in a h@t.
562 /* Define to the address where bug reports for this package should be sent. */
563 #undef PACKAGE_BUGREPORT
565 /* Define to the full name of this package. */
566 #undef PACKAGE_NAME
568 /* Define to the full name and version of this package. */
569 #undef PACKAGE_STRING
571 /* Define to the one symbol short name of this package. */
572 #undef PACKAGE_TARNAME
574 /* Define to the version of this package. */
575 #undef PACKAGE_VERSION
577 Bottom1 from configure.ac.
579 Bottom2 from configure.ac.
581 The Dog in a h@t.
582 /* Bottom from acconfig.h. */
585 AT_CLEANUP
590 ## ------------ ##
591 ## autoupdate.  ##
592 ## ------------ ##
594 # Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
595 AT_SETUP([autoupdate])
597 AT_DATA([configure.ac],
598 [[AC_INIT(Test, 1.0)
599 AC_CANONICAL_SYSTEM
600 # The doc says 27 is a valid fubar.
601 fubar=27
602 AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
605 AT_DATA([expout],
606 [[AC_INIT([Test],[1.0])
607 AC_CANONICAL_TARGET
608 # The doc says 27 is a valid fubar.
609 fubar=27
610 AC_CONFIG_FILES([Makefile])
611 AC_CONFIG_COMMANDS([default],[echo $fubar],[fubar=$fubar])
612 AC_OUTPUT
615 # Checking `autoupdate'.
616 AT_CHECK_AUTOUPDATE
617 AT_CHECK([cat configure.ac], 0, [expout])
618 # Checking that `autoupdate' is idempotent
619 AT_CHECK_AUTOUPDATE
620 AT_CHECK([cat configure.ac], 0, [expout])
622 AT_CLEANUP
625 # autoupdating AC_LINK_FILES
626 # --------------------------
627 AT_SETUP([autoupdating AC_LINK_FILES])
629 AT_DATA([configure.ac],
630 [[AC_INIT
631 AC_LINK_FILES(dst1 dst2, src1 src2)
632 AC_OUTPUT
635 AT_DATA([dst1], dst1
637 AT_DATA([dst2], dst2
640 # Checking `autoupdate'.
641 AT_CHECK_AUTOUPDATE([], 0, [], ignore)
642 AT_CHECK_AUTOCONF
643 AT_CHECK_CONFIGURE
644 AT_CHECK([cat src1], 0, [dst1
646 AT_CHECK([cat src2], 0, [dst2
649 AT_CLEANUP
652 # autoupdating AC_PREREQ
653 # ----------------------
654 AT_SETUP([autoupdating AC_PREREQ])
656 # Produce `AC_PREREQ(<AUTOUPDATE VERSION>)'.
657 AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
658 autoupdate_version=`cat stdout`
659 echo "AC_PREREQ($autoupdate_version)" >expout
661 AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
662          0, [expout], [])
664 AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
665          0, [expout], [])
667 AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
668          63, [], [ignore])
670 AT_CLEANUP
673 # autoupdating AU_ALIAS
674 # ---------------------
675 AT_SETUP([autoupdating AU_ALIAS])
677 AT_DATA([configure.ac],
678 [[AC_INIT
679 AC_DEFUN([FOO], [$#])
680 AU_ALIAS([BAZ],[FOO])
681 test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
682 AC_PROG_CC
683 AC_STDC_HEADERS
684 AC_OUTPUT
687 # Checking `autoupdate'.
688 AT_CHECK_AUTOUPDATE
689 AT_CHECK_AUTOCONF
690 AT_CHECK_CONFIGURE
691 AT_CHECK([grep 'AC_HEADER_STDC(' configure.ac], 1, [ignore], [ignore])
692 AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
694 AT_CLEANUP
697 # autoupdating OLD to NEW
698 # -----------------------
700 # The example taken from the code comments.
701 AT_SETUP([autoupdating OLD to NEW])
703 AT_DATA([aclocal.m4],
704 [[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
705 AC_DEFUN([NEW], [echo "sum($1) = $2"])
708 AT_DATA([configure.ac],
709 [[AC_INIT
710 OLD(1, 2)
711 NEW([0, 0], [0])
714 # Checking `autoupdate'.
715 AT_CHECK_AUTOUPDATE
716 AT_CHECK_AUTOCONF
717 AT_CHECK_CONFIGURE
718 AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
719 AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
721 AT_CLEANUP
724 # autoupdating AC_HELP_STRING
725 # ---------------------------
726 AT_SETUP([autoupdating AC_HELP_STRING])
728 AT_DATA([configure.ac],
729 [[AC_INIT
730 AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
733 # Checking `autoupdate'.
734 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
735 AT_CHECK_AUTOCONF
736 AT_CHECK_CONFIGURE([], [], [], [ignore])
737 AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
739 AT_CLEANUP
742 # autoupdating with m4sugar
743 # -------------------------
744 AT_SETUP([autoupdating with m4sugar])
746 AT_DATA([aclocal.m4],
747 [[AU_DEFUN([OLD],
748 [m4@&t@_pushdef([foo], [bar])dn@&t@l
749 echo "foo $1 foo"
750 m4@&t@_popdef([foo])dn@&t@l
754 touch foo.in
756 AT_DATA([configure.ac],
757 [[AC_PREREQ(2.54)
758 m4_define([gnumeric_version_epoch], [1])
759 AC_INIT
760 OLD([ bla  bla ])
761 AC_FOREACH([name], [n1 n2],
762            [echo name
764 AC_CHECKING([for feature])
765 AC_MSG_RESULT_UNQUOTED([`echo done`])
767 AC_OUTPUT([foo])
770 # Checking `autoupdate'.
771 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
772 AT_CHECK_AUTOCONF
773 AT_CHECK_CONFIGURE([], [], [], [ignore])
775 AT_CLEANUP
778 # autoupdating AC_LANG_SAVE
779 # -------------------------
780 AT_SETUP([autoupdating AC_LANG_SAVE])
782 AT_DATA([configure.ac],
783 [[AC_INIT
784 AC_LANG_SAVE
785 AC_LANG_RESTORE
786 AC_LANG_SAVE
787 AC_LANG_RESTORE
790 # Checking `autoupdate'.
791 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
792 AT_CHECK_AUTOCONF
793 AT_CHECK_CONFIGURE([], [], [], [ignore])
795 AT_CLEANUP
798 # autoupdating AC_FOREACH
799 # -----------------------
800 AT_SETUP([autoupdating AC_FOREACH])
802 AT_DATA([aclocal.m4],
803 [[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
806 AT_DATA([configure.ac],
807 [[AC_INIT
808 echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
811 # Checking `autoupdate'.
812 AT_CHECK_AUTOUPDATE
813 AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
814 AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
815 AT_CHECK_AUTOCONF
816 AT_CHECK_CONFIGURE([], [0], [stdout])
817 AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
819 AT_CLEANUP
822 # autoupdating with aclocal and m4_include
823 # ----------------------------------------
824 AT_SETUP([autoupdating with aclocal and m4@&t@_include])
826 # We use aclocal.
827 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
829 mkdir m4 aclocal
830 AT_DATA([configure.in],
831 [[AC_INIT(x,0)
832 AC_UNCHANGED_MACRO
833 AC_OLD_MACRO
834 AC_OUTPUT
836 AT_DATA([m4/stuff.m4],
837 [[AU_ALIAS([AC_OLD_MACRO], [AC_NEW_MACRO])
838 AC_DEFUN([AC_NEW_MACRO], [echo hi])
839 AC_DEFUN([AC_UNCHANGED_MACRO], [echo one])
841 cp m4/stuff.m4 aclocal/stuff.m4
842 AT_CHECK([aclocal -I aclocal], [0], [ignore], [ignore])
843 # Checking `autoupdate'.
844 AT_CHECK_AUTOUPDATE
845 AT_CHECK([aclocal -I m4], [0], [ignore], [ignore])
846 AT_CHECK_AUTOUPDATE
848 AT_CLEANUP
851 # Keeping autom4te.cfg complete
852 # -----------------------------
854 AT_SETUP([autom4te preselections])
855 : ${sleep='sleep 1'}    # Command to force different time stamps.
856 # If this test should run on FAT file systems and older w32,
857 # then setting $sleep correctly needs to be revisited.
859 # We use aclocal and automake.
860 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
861 AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
863 AT_DATA([configure.in],
864 [[AC_INIT(GNU foo, 1.0)
865 AM_INIT_AUTOMAKE
866 AC_CONFIG_FILES([Makefile])
867 AC_OUTPUT
870 AT_DATA([Makefile.am],
871 [[AUTOMAKE_OPTIONS = foreign
874 $sleep # `aclocal.m4' should be strictly younger than its inputs
876 # If Autoconf is too old, or the user has turned caching off, skip:
877 AT_CHECK([aclocal || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }],
878          [], [], [ignore])
879 AT_CHECK([test -d autom4te.cache || exit 77])
880 AT_CHECK([autoconf])
882 # If this test fails due to missing entries in lib/autom4te.in, then
883 # comparing the old and new requests is a good place to start debugging:
884 cp autom4te.cache/requests old-requests
885 echo newer >newer
886 $sleep # if `configure' is regenerated, we want it to be strictly newer,
887        # to catch the error consistently.
888 AT_CHECK([aclocal], [], [], [ignore])
889 AT_CHECK([automake --no-force --add-missing], [], [], [ignore])
890 AT_CHECK([autoconf])
891 AT_CHECK([test "`find configure -newer newer`" = "" ||
892           { diff old-requests autom4te.cache/requests; exit 1; }])
894 AT_CLEANUP