3 AT_BANNER([Executables (autoheader, autoupdate...).])
5 # Copyright (C) 2000, 2001, 2003, 2004, 2006, 2007, 2008, 2009 Free
6 # Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ## ----------------------------- ##
23 ## Syntax of the shell scripts. ##
24 ## ----------------------------- ##
26 # We use `/bin/sh -n script' to check that there are no syntax errors
27 # in the scripts. Although incredible, there are /bin/sh that go into
28 # endless loops with `-n', e.g., SunOS's:
31 # SunOS ondine 4.1.3 2 sun4m unknown
38 # $ time sh endless.sh
39 # sh endless.sh 0,02s user 0,03s system 78% cpu 0,064 total
40 # $ time sh -nx endless.sh
41 # ^Csh -nx endless.sh 3,67s user 0,03s system 63% cpu 5,868 total
43 # So before using `/bin/sh -n' to check our scripts, we first check
44 # that `/bin/sh -n' is not broken to death.
46 AT_SETUP([Syntax of the shell scripts])
48 AT_CHECK([test "$ac_cv_sh_n_works" = yes || exit 77])
50 # Specify the absolute name of the tool, as some shells don't honor PATH when
53 AT_CHECK_SHELL_SYNTAX(["$abs_top_builddir/bin/autoconf"])
54 AT_CHECK_SHELL_SYNTAX(["$abs_top_builddir/tests/autoconf"])
55 AT_CHECK_SHELL_SYNTAX(["$abs_top_builddir/tests/testsuite"])
57 # These are not built, they are in the src tree.
58 AT_CHECK_SHELL_SYNTAX(["$abs_top_srcdir/build-aux/install-sh"])
59 AT_CHECK_SHELL_SYNTAX(["$abs_top_srcdir/build-aux/missing"])
66 ## ---------------------------- ##
67 ## Syntax of the Perl scripts. ##
68 ## ---------------------------- ##
70 AT_SETUP([Syntax of the Perl scripts])
72 AT_CHECK_PERL_SYNTAX([autoheader])
73 AT_CHECK_PERL_SYNTAX([autom4te])
74 AT_CHECK_PERL_SYNTAX([autoreconf])
75 AT_CHECK_PERL_SYNTAX([autoscan])
76 AT_CHECK_PERL_SYNTAX([autoupdate])
77 AT_CHECK_PERL_SYNTAX([ifnames])
84 ## ------------------ ##
85 ## autom4te's cache. ##
86 ## ------------------ ##
88 AT_SETUP([autom4te cache])
90 AT_DATA_M4SUGAR([[script.4s]],
98 # We moved a file: it should fail
101 AT_CHECK_M4SUGAR([], [1], [],
102 [m4:script.4s:1: cannot open `foo': No such file or directory
103 autom4te: m4 failed with exit status: 1
106 # But if we change the main file, then we should no longer complain of
108 AT_DATA_M4SUGAR([[script.4s]],
109 [[m4_include([sub/foo])
119 AT_SETUP([autom4te --force])
124 AT_CHECK_AUTOM4TE([-o file file.m4])
126 # Create a file whose time stamp is in the future.
127 # (next year)-01-01 00:01 UTC should always be in the future,
128 # even on slow machines.
130 this_year=`TZ=UTC0 date +%Y`
131 AS_VAR_ARITH([next_year], [$this_year + 1])
132 TZ=UTC0 touch -t ${next_year}01010001 file
134 AT_CHECK_AUTOM4TE([--force -o file file.m4])
135 AT_CHECK([cat file], 0,
142 # autom4te and file names containing whitespace
143 # ---------------------------------------------
145 AT_SETUP([autom4te and whitespace in file names])
151 'with funny '\'' $x & #! name' \
152 'with funny \ '\'' \'\'' " <a >b * ? name ' # "restore font-lock
154 funny=`func_sanitize_file_name "$funny"`
157 dir=`func_sanitize_dir_name " dir $funny"`
158 cachedir=" cache$dir"
162 # skip if we cannot create such a file or directory
163 AT_CHECK([mkdir "$dir" "$cachedir" "$TMPDIR" && touch "$file" || exit 77])
166 [m4@&t@_init[]m4@&t@_include(foo.m4)
167 m4@&t@_divert(0)d@&t@nl
170 cat >"$dir"/foo.m4 <<'END'
171 [m4@&t@_define([FOO], [bar])]
174 AT_CHECK_AUTOM4TE([-C "$cachedir" -B "$dir" --language=m4sugar -o "$outfile" "$file"])
175 AT_CHECK([cat "$outfile"], [],
178 rm -rf "$outfile" "$cachedir"
179 AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar -o "$outfile" "$file"])
180 AT_CHECK([cat "$outfile"], [],
184 # This exercises a slightly different code path and will catch an open with
185 # trailing whitespace:
187 [m4@&t@_init[]m4@&t@_include(foo.m4)
188 m4@&t@_pattern_forbid([^bar$])
189 m4@&t@_divert(0)d@&t@nl
192 rm -rf "$outfile" "$cachedir"
193 AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar -o "$outfile" "$file"],
195 AT_CHECK([grep 'possibly undefined macro' stderr], [], [ignore])
198 [m4@&t@_init[]m4@&t@_include(foo.m4)
199 m4@&t@_divert(0)d@&t@nl]
202 AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar --freeze -o "$file.m4f" "$file"])
203 AT_CHECK([test -s "$file.m4f"])
205 # Check --reload-state
206 AT_CHECK_AUTOM4TE([-C "$cachedir" --language=m4sugar -o "$outfile" "$file.m4f" /dev/null])
214 # autom4te --trace and unusual macro names
215 # ----------------------------------------
217 AT_SETUP([autom4te --trace and unusual macro names])
222 AT_CHECK_AUTOM4TE([-t 'TR A CE' -t 'TR(A)CE' file.m4])
227 AT_SETUP([autom4te --trace and whitespace])
229 dnl line numbering differs between m4 1.4.6 and 1.4.13 if we don't
230 dnl go through a single line wrapper
231 AT_DATA_M4SUGAR([file.m4],
232 [[m4_define([foo], [m4_echo([ a
238 AT_CHECK_AUTOM4TE([--language=m4sugar -t 'm4@&t@_echo' file.m4], [0],
239 [[file.m4:5:m4@&t@_echo: a b c :d
245 ## ------------------ ##
246 ## autoconf --trace. ##
247 ## ------------------ ##
250 # autoconf --trace: user macros
251 # -----------------------------
252 AT_SETUP([autoconf --trace: user macros])
254 AT_DATA([configure.ac],
255 [[m4_define([active], [ACTIVE])
256 m4_define([TRACE1], [TRACE2(m4_shift($@))])
257 m4_define([TRACE2], [[$2], $1])
263 # With arguments, single line.
264 TRACE1(foo, @bar, @baz)
265 TRACE1(foo, TRACE1(bar, baz))
266 TRACE1(foo, active, baz)
267 TRACE1(foo, [active], TRACE1(active, [active]))
271 AT_CHECK_AUTOCONF([-t TRACE1 -t TRACE2], 0,
272 [[configure.ac:6:TRACE1:
273 configure.ac:6:TRACE2:
274 configure.ac:7:TRACE2:
275 configure.ac:10:TRACE1:foo:@bar:@baz
276 configure.ac:10:TRACE2:@bar:@baz
277 configure.ac:11:TRACE1:bar:baz
278 configure.ac:11:TRACE2:baz
279 configure.ac:11:TRACE1:foo::baz
280 configure.ac:11:TRACE2::baz
281 configure.ac:12:TRACE1:foo:ACTIVE:baz
282 configure.ac:12:TRACE2:ACTIVE:baz
283 configure.ac:13:TRACE1:ACTIVE:active
284 configure.ac:13:TRACE2:active
285 configure.ac:13:TRACE1:foo:active::ACTIVE
286 configure.ac:13:TRACE2:active::ACTIVE
289 # Several line requests.
290 AT_CHECK_AUTOCONF([[-t TRACE1:'
291 [$1], [$2], [$3].']], 0,
295 [foo], [@bar], [@baz].
301 [foo], [ACTIVE], [baz].
303 [ACTIVE], [active], [].
309 AT_CHECK_AUTOCONF([-t TRACE2:'${)===(}@'], 0,
317 [active])===([])===([ACTIVE]
320 # Arguments spanning multiple lines.
321 AT_DATA([configure.ac],
322 [[m4_define([TRACE], [])
329 AT_CHECK_AUTOCONF([-t TRACE:'$%'], 0,
336 # autoconf --trace: builtins
337 # --------------------------
338 AT_SETUP([autoconf --trace: builtins])
340 AT_DATA([configure.ac],
341 [[define([active], [ACTIVE])
344 AT_CHECK_AUTOCONF([[-t define | sed -n '$p']],
346 [[configure.ac:1:define:active:ACTIVE
349 # FIXME: Without `$1' the following test dies. Groumphf, once again to
350 # dive into obscure feature interaction...
351 # Note that using `-i' means we need the *.m4 files, not the *.m4f files,
352 # hence we need srcdir, not builddir.
353 AT_CHECK_AUTOCONF([[-t define:'$1' -i| sed -n '$p']],
362 ## ---------------------------- ##
363 ## autoconf: forbidden tokens. ##
364 ## ---------------------------- ##
367 # autoconf: forbidden tokens, basic
368 # ---------------------------------
369 AT_SETUP([autoconf: forbidden tokens,[] basic])
371 AT_DATA_M4SH([configure.ac],
380 dnl This test needs autom4te's cache, in spite of any ~/.autom4te.cfg.
381 AT_DATA([.autom4te.cfg], [[
382 begin-language: "Autoconf"
383 args: --cache=autom4te.cache
384 end-language: "Autoconf"
385 begin-language: "Autoconf-without-aclocal-m4"
386 args: --cache=autom4te.cache
387 end-language: "Autoconf-without-aclocal-m4"
390 AT_CHECK_AUTOCONF([], 1, [],
391 [[configure.ac:2: error: possibly undefined macro: m4@&t@_foo
392 If this token and others are legitimate, please use m4@&t@_pattern_allow.
393 See the Autoconf documentation.
394 configure.ac:3: error: possibly undefined macro: _m4@&t@_bar
395 configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
396 configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
397 configure.ac:6: error: possibly undefined macro: d@&t@nl
399 # Second run should succeed and yield no output.
405 # autoconf: forbidden tokens, exceptions
406 # --------------------------------------
407 AT_SETUP([autoconf: forbidden tokens,[] exceptions])
409 AT_DATA_M4SH([configure.ac],
412 # This is allowed in spite of the name.
413 # It is on purpose that we check the case where there are several
414 # tokens on the same line.
415 m4_pattern_allow([^AS_ALLOWED$])
416 NOT_AS_ALLOWED AS_ALLOWED AS_ALLOWED_NOT
419 m4_pattern_forbid([^FORBIDDEN$])
420 NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
422 # Test Autoconf's patterns.
423 AS_THIS_IS_INVALID and _AS_THIS_IS_INVALID_TOO
424 BUT_AZ_THIS_IS_NOT ALTHOUGH_AS_THIS_IS
425 # This is legal, although there is `AS_DEFINE' in there.
427 # AS_THIS_IS_A_COMMENT so just shut up.
428 It would be very bad if Autoconf forgot to expand [AS_]INIT!
431 AT_CHECK_AUTOCONF([], 1, [],
432 [[configure.ac:1: error: possibly undefined macro: AS@&t@_INIT
433 If this token and others are legitimate, please use m4@&t@_pattern_allow.
434 See the Autoconf documentation.
435 configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT
436 configure.ac:10: error: possibly undefined macro: FORBIDDEN
437 configure.ac:14: error: possibly undefined macro: AS@&t@_THIS_IS_INVALID
438 configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO
444 # autoconf: automatically allowed tokens
445 # --------------------------------------
446 AT_SETUP([autoconf: automatically allowed tokens])
448 AT_DATA_M4SH([configure.ac],
450 m4_pattern_forbid([^FB_])
461 # autoconf: do not forbid the empty token
462 # ---------------------------------------
463 AT_SETUP([autoconf: the empty token])
465 AT_DATA_M4SH([configure.ac],
466 [[m4_init[]m4_pattern_allow([^foo$])
468 line that begins with a space
476 # autoconf: subdirectories
477 # ------------------------
478 AT_SETUP([autoconf: subdirectories])
480 AT_DATA([configure.ac],
483 AC_CONFIG_FILES(sub/foo)
489 AT_DATA([sub/foo.in],
493 AT_DATA([install-sh])
497 AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
502 # autoconf: input from stdin
503 # --------------------------
504 AT_SETUP([autoconf: input from stdin])
506 # Past Autoconf versions failed to read from stdin when other, non-frozen input
507 # files were present.
508 AT_DATA([aclocal.m4])
510 AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
511 0, [stdin:1:AC_INIT:X:1.0:bug-autoconf@gnu.org
513 AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
514 0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org
520 # autoconf: AC_AUTOCONF_VERSION
521 # --------------------------------------
522 AT_SETUP([autoconf: AC_AUTOCONF_VERSION])
524 AT_DATA([configure.ac],
526 version m4@&t@_defn([AC_AUTOCONF_VERSION]) version
531 AT_CHECK([[grep 'version ]]AT_PACKAGE_VERSION[[ version' configure]],
547 #if ! defined DEF3 && defined DEF4 /* but not defined DEF5 */
554 #if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
562 AT_CHECK([ifnames iftest1.c iftest2.c], 0,
572 VAL1 iftest1.c iftest2.c
586 # autoheader is intensively used in its modern form throughout this
587 # test suite. But we also have to check that acconfig.h still works.
588 # autoheader uses autoconf --trace, so traces first.
590 AT_SETUP([autoheader])
592 AT_DATA([acconfig.h],
593 [[/* Define this to whatever you want. */
598 # 1. Check that `acconfig.h' is still honored.
599 AT_DATA([configure.ac],
601 AC_CONFIG_HEADERS(config.h:config.hin)
602 AC_DEFINE(this, "whatever you want.")
605 AT_CHECK_AUTOHEADER([], [], [], [ignore])
606 AT_CHECK([cat config.hin], 0,
607 [[/* config.hin. Generated from configure.ac by autoheader. */
608 /* Define this to whatever you want. */
611 /* Define to the address where bug reports for this package should be sent. */
612 #undef PACKAGE_BUGREPORT
614 /* Define to the full name of this package. */
617 /* Define to the full name and version of this package. */
618 #undef PACKAGE_STRING
620 /* Define to the one symbol short name of this package. */
621 #undef PACKAGE_TARNAME
623 /* Define to the home page for this package. */
626 /* Define to the version of this package. */
627 #undef PACKAGE_VERSION
631 # 2. Check that missing templates are a fatal error.
632 AT_DATA([configure.ac],
634 AC_CONFIG_HEADERS(config.h:config.hin)
635 AC_DEFINE(that, "whatever you want.")
638 # The test suite goes too fast for the cache time stamps...
640 AT_CHECK_AUTOHEADER([--force], [1], [], [ignore])
643 # 3. Check TOP and BOTTOM.
644 AT_DATA([acconfig.h],
645 [[/* Top from acconfig.h. */
647 /* Middle from acconfig.h. */
649 /* Bottom from acconfig.h. */
652 AT_DATA([configure.ac],
654 AC_CONFIG_HEADERS(config.h:config.hin)
655 AH_TOP([Top1 from configure.ac.])
656 AH_TOP([Top2 from configure.ac.])
657 AH_TOP([The Cat in a h@t.])
658 AH_VERBATIM([Middle], [Middle from configure.ac.])
659 AH_VERBATIM([Mouse], [The Mouse in a h@t.])
660 AH_BOTTOM([Bottom1 from configure.ac.])
661 AH_BOTTOM([Bottom2 from configure.ac.])
662 AH_BOTTOM([The Dog in a h@t.])
664 AC_DEFINE([ANT], [@], [The Ant in a h@t.])
668 # Yes, that's right: the `middle' part of `acconfig.h' is still before
669 # the AH_TOP part. But so what, you're not supposed to use the two
671 # Ignore STDERR which is the longuish complaint against autoheader junk
673 AT_CHECK_AUTOHEADER([--force], [], [], [ignore])
674 AT_CHECK([cat config.hin], 0,
675 [[/* config.hin. Generated from configure.ac by autoheader. */
676 /* Top from acconfig.h. */
677 /* Middle from acconfig.h. */
679 Top1 from configure.ac.
681 Top2 from configure.ac.
685 /* The Ant in a h@t. */
688 Middle from configure.ac.
692 /* Define to the address where bug reports for this package should be sent. */
693 #undef PACKAGE_BUGREPORT
695 /* Define to the full name of this package. */
698 /* Define to the full name and version of this package. */
699 #undef PACKAGE_STRING
701 /* Define to the one symbol short name of this package. */
702 #undef PACKAGE_TARNAME
704 /* Define to the home page for this package. */
707 /* Define to the version of this package. */
708 #undef PACKAGE_VERSION
710 Bottom1 from configure.ac.
712 Bottom2 from configure.ac.
715 /* Bottom from acconfig.h. */
721 # autoheader should see through m4 macros, just like autoconf
722 # http://lists.gnu.org/archive/html/bug-autoconf/2009-06/msg00000.html
723 AT_SETUP([autoheader and macros])
725 AT_DATA([configure.ac],
727 AC_CONFIG_HEADER([config.h])
728 m4_define([PETER], [SIMSALABIM])
729 m4_define([PAUL], [OPENSESAME])
730 AC_DEFINE([PETER], [10], [Peter's public info])
731 AC_DEFINE_UNQUOTED([PAUL], [`expr 4 + 6`], [Paul's public info])
737 AT_CHECK([grep -c SIMSALABIM configure config.h.in], [0],
741 AT_CHECK([grep -c OPENSESAME configure config.h.in], [0],
745 AT_CHECK([grep -c PETER configure config.h.in], [1],
749 AT_CHECK([grep -c PAUL configure config.h.in], [1],
763 # Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
764 AT_SETUP([autoupdate])
766 AT_DATA([configure.ac],
769 # The doc says 27 is a valid fubar.
771 AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
775 [[AC_INIT([Test],[1.0])
777 # The doc says 27 is a valid fubar.
779 AC_CONFIG_FILES([Makefile])
780 AC_CONFIG_COMMANDS([default],[echo $fubar],[fubar=$fubar])
784 # Checking `autoupdate'.
786 AT_CHECK([cat configure.ac], 0, [expout])
787 # Checking that `autoupdate' is idempotent
789 AT_CHECK([cat configure.ac], 0, [expout])
794 # autoupdating AC_LINK_FILES
795 # --------------------------
796 AT_SETUP([autoupdating AC_LINK_FILES])
798 AT_DATA([configure.ac],
800 AC_LINK_FILES(dst1 dst2, src1 src2)
809 # Checking `autoupdate'.
810 AT_CHECK_AUTOUPDATE([], 0, [], ignore)
813 AT_CHECK([cat src1], 0, [dst1
815 AT_CHECK([cat src2], 0, [dst2
821 # autoupdating AC_PREREQ
822 # ----------------------
823 AT_SETUP([autoupdating AC_PREREQ])
825 # Produce `AC_PREREQ(<AUTOUPDATE VERSION>)'.
826 AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
827 autoupdate_version=`cat stdout`
828 echo "AC_PREREQ($autoupdate_version)" >expout
830 AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
833 AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
836 AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
842 # autoupdating AU_ALIAS
843 # ---------------------
844 AT_SETUP([autoupdating AU_ALIAS])
846 AT_DATA([configure.ac],
848 AC_DEFUN([FOO], [$#])
849 AU_ALIAS([BAZ],[FOO])
850 test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
856 # Checking `autoupdate'.
860 AT_CHECK([grep 'AC_HEADER_STDC[(]' configure.ac], 1, [ignore], [ignore])
861 AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
866 # autoupdating OLD to NEW
867 # -----------------------
869 # The example taken from the code comments.
870 AT_SETUP([autoupdating OLD to NEW])
872 AT_DATA([aclocal.m4],
873 [[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
874 AC_DEFUN([NEW], [echo "sum($1) = $2"])
877 AT_DATA([configure.ac],
883 # Checking `autoupdate'.
887 AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
888 AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
893 # autoupdating macros recursively
894 # -------------------------------
896 AT_SETUP([autoupdating macros recursively])
900 AT_DATA([configure.ac],
903 AC_TRY_COMPILE([], [choke me], [echo bogus1],
904 [AC_TRY_COMPILE([], [return 0;], [echo good], [echo bogus2])])
908 # Checking `autoupdate'.
910 AT_CHECK([grep changequote configure.ac], [1])
911 AT_CHECK([grep TRY_COMPILE configure.ac], [1])
918 # autoupdating AC_HELP_STRING
919 # ---------------------------
920 AT_SETUP([autoupdating AC_HELP_STRING])
922 AT_DATA([configure.ac],
924 AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
927 # Checking `autoupdate'.
928 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
930 AT_CHECK_CONFIGURE([], [], [], [ignore])
931 AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
936 # autoupdating with m4sugar
937 # -------------------------
938 AT_SETUP([autoupdating with m4sugar])
940 AT_DATA([aclocal.m4],
942 [m4@&t@_pushdef([foo], [bar])dn@&t@l
944 m4@&t@_popdef([foo])dn@&t@l
950 AT_DATA([configure.ac],
952 m4_define([gnumeric_version_epoch], [1])
955 AC_FOREACH([name], [n1 n2],
958 AC_CHECKING([for feature])
959 AC_MSG_RESULT_UNQUOTED([`echo done`])
964 # Checking `autoupdate'.
965 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
967 AT_CHECK_CONFIGURE([], [], [], [ignore])
972 # autoupdating with m4_pushdef
973 # ----------------------------
974 AT_SETUP([autoupdating with m4@&t@_pushdef])
979 AT_DATA([configure.ac],
982 # temporarily override this macro
983 m4@&t@_pushdef([AC_MSG_RESULT_UNQUOTED], [:])
985 m4@&t@_popdef([AC_MSG_RESULT_UNQUOTED])
989 # Checking `autoupdate'.
990 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
991 AT_CHECK([grep changequote configure.ac], [1])
992 AT_CHECK([grep [pushdef.*AC_MSG_RESULT_UNQUOTED] configure.ac], [0], [ignore])
994 AT_CHECK_CONFIGURE([], [], [], [ignore])
999 # autoupdating with AC_REQUIRE
1000 # ----------------------------
1001 AT_SETUP([autoupdating with AC_REQUIRE])
1005 AT_DATA([configure.ac],
1007 [AC_REQUIRE([AC_DECL_SYS_SIGLIST])
1008 AC_CHECK_DECLS([_sys_siglist], [], [], [#include <signal.h>])
1016 # Checking `autoupdate'.
1017 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1019 AT_CHECK_CONFIGURE([], [], [], [ignore])
1024 # autoupdating with complex quoting
1025 # ---------------------------------
1026 AT_SETUP([autoupdating with complex quoting])
1030 AT_DATA([configure.ac],
1031 [[m4_define([MACRO],
1032 [[#define STRING "hello, world\n"
1036 AC_TRY_COMPILE([#include <stdio.h>
1037 ]MACRO[], [printf (STRING);],
1042 # Checking `autoupdate'.
1043 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1045 AT_CHECK([grep MACRO configure], [1])
1046 AT_CHECK_CONFIGURE([], [], [], [ignore])
1051 # autoupdating AC_LANG_SAVE
1052 # -------------------------
1053 AT_SETUP([autoupdating AC_LANG_SAVE])
1055 AT_DATA([configure.ac],
1063 # Checking `autoupdate'.
1064 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1066 AT_CHECK_CONFIGURE([], [], [], [ignore])
1071 # autoupdating AC_FOREACH
1072 # -----------------------
1073 AT_SETUP([autoupdating AC_FOREACH])
1075 AT_DATA([aclocal.m4],
1076 [[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
1079 AT_DATA([configure.ac],
1081 echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
1084 # Checking `autoupdate'.
1086 AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
1087 AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
1089 AT_CHECK_CONFIGURE([], [0], [stdout])
1090 AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
1095 # autoupdating with aclocal and m4_include
1096 # ----------------------------------------
1097 AT_SETUP([autoupdating with aclocal and m4@&t@_include])
1100 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1103 AT_DATA([configure.in],
1109 AT_DATA([m4/stuff.m4],
1110 [[AU_ALIAS([AC_OLD_MACRO], [AC_NEW_MACRO])
1111 AC_DEFUN([AC_NEW_MACRO], [echo hi])
1112 AC_DEFUN([AC_UNCHANGED_MACRO], [echo one])
1114 cp m4/stuff.m4 aclocal/stuff.m4
1115 AT_CHECK([aclocal -I aclocal], [0], [ignore], [ignore])
1116 # Checking `autoupdate'.
1118 AT_CHECK([aclocal -I m4], [0], [ignore], [ignore])
1124 # Keeping autom4te.cfg complete
1125 # -----------------------------
1127 AT_SETUP([autom4te preselections])
1128 : ${sleep='sleep 1'} # Command to force different time stamps.
1129 # If this test should run on FAT file systems and older w32,
1130 # then setting $sleep correctly needs to be revisited.
1132 # We use aclocal and automake.
1133 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1134 AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
1136 AT_DATA([configure.in],
1137 [[AC_INIT(GNU foo, 1.0)
1139 AC_CONFIG_FILES([Makefile])
1143 AT_DATA([Makefile.am],
1144 [[AUTOMAKE_OPTIONS = foreign
1147 $sleep # `aclocal.m4' should be strictly younger than its inputs
1149 # If Autoconf is too old, or the user has turned caching off, skip:
1150 AT_CHECK([aclocal || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }],
1152 AT_CHECK([test -d autom4te.cache || exit 77])
1153 AT_CHECK([autoconf])
1155 # If this test fails due to missing entries in lib/autom4te.in, then
1156 # comparing the old and new requests is a good place to start debugging:
1157 cp autom4te.cache/requests old-requests
1159 $sleep # if `configure' is regenerated, we want it to be strictly newer,
1160 # to catch the error consistently.
1161 AT_CHECK([aclocal], [], [], [ignore])
1162 AT_CHECK([automake --no-force --add-missing], [], [], [ignore])
1163 AT_CHECK([autoconf])
1164 AT_CHECK([test "`find configure -newer newer`" = "" ||
1165 { diff old-requests autom4te.cache/requests; exit 1; }])
1170 # autom4te cache creation
1171 # -----------------------
1172 # Ensure autom4te fails when it cannot create the cache directory
1173 # or create files there.
1174 AT_SETUP([autom4te cache creation])
1176 AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
1178 # Work in a subdirectory so autotest can scribble in the toplevel.
1182 AT_DATA([configure.ac],
1186 AT_DATA([.autom4te.cfg],
1187 [[begin-language: "Autoconf-without-aclocal-m4"
1188 args: --cache=sub/autom4te.cache
1189 end-language: "Autoconf-without-aclocal-m4"
1192 # Do not try this when we are root or on systems without permissions.
1193 AT_CHECK([: > sub/some-file && exit 77], 1, [ignore], [ignore])
1195 # Failure to create cache directory.
1196 AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
1197 AT_CHECK([grep 'cannot create .*autom4te.cache' stderr], [0], [ignore])
1198 AT_CHECK([test -f configure], [1])
1203 rm -f configure sub/autom4te.cache/*
1204 chmod a-w sub/autom4te.cache
1206 # Failure to create a file in the cache directory.
1207 AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
1208 AT_CHECK([grep 'cannot open.*autom4te.cache' stderr], [0], [ignore])
1213 # autom4te cache locking
1214 # ----------------------
1216 AT_SETUP([autom4te cache locking])
1218 # Cannot use AT_CHECK here, autotest internals could be messed up.
1220 (echo AC_INIT; sleep 2; echo) \
1221 | (autom4te --language=autoconf -o configure -; echo $? >&2 ) 2>errlog &
1222 AT_CHECK([echo AC_INIT | autom4te --language=autoconf -o configure -])
1225 # Ignore additional output from shell verbose or xtrace mode.
1226 AT_CHECK([grep 'cannot rename' errlog], [1])
1227 AT_CHECK([grep '^0$' errlog], [], [ignore])
1233 # autotools and file names containing whitespace
1234 # ---------------------------------------------
1236 AT_SETUP([autotools and whitespace in file names])
1239 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1245 'with funny '\'' $x & #! name ' \
1246 'with funny \ '\'' \'\'' " <a >b * ? name '
1248 funny=`func_sanitize_file_name "$funny"`
1250 dir=`func_sanitize_dir_name " dir $funny"`
1254 cat >"$file.in" <<'END'
1256 m4@&t@_include([foo.m4])
1257 AC_CONFIG_HEADERS([config.h:config.hin])
1261 # skip if we cannot create such a file or directory
1262 AT_CHECK([mkdir "$dir" "$TMPDIR" && test -f "$file.in" || exit 77])
1263 cat >"$dir"/foo.m4 <<'END'
1264 [AC_DEFUN([AC_MACRO], [echo hi])]
1267 AT_CHECK_AUTOHEADER([-B "$dir" "$file.in"])
1268 AT_CHECK_AUTOHEADER([--force -I "$dir" "$file.in"])
1269 AT_CHECK_AUTOUPDATE([-B "$dir" "$file.in"])
1270 AT_CHECK_AUTOUPDATE([--force -I "$dir" "$file.in"])
1271 AT_CHECK_AUTOUPDATE([-B "$dir" - < "$file.in"], [], [ignore])
1272 AT_CHECK_AUTOCONF([-B "$dir" -o "$file" "$file.in"])
1273 AT_CHECK_AUTOCONF([-I "$dir" -o "$file" "$file.in"])
1274 # In autoconf, these exercise a slightly different code path:
1275 AT_CHECK_AUTOCONF([--prepend-include="$dir" -o "$file" "$file.in"])
1276 AT_CHECK_AUTOCONF([--include="$dir" -o "$file" "$file.in"])
1277 AT_CHECK([autoscan -B "$dir"], [], [], [ignore])
1278 AT_CHECK([autoscan --force -I "$dir"], [], [], [ignore])
1279 # autoreconf requires a sane input file name. Also, disable aclocal.
1280 mv -f "$file.in" configure.in
1281 AT_DATA([aclocal.m4])
1282 AT_CHECK([autoreconf -B "$dir"])
1283 AT_CHECK([autoreconf --force -I "$dir"])
1285 cat >"$file.c" <<'END'
1289 AT_CHECK([ifnames "$file.c"], [], [ignore])