3 AT_BANNER([Executables (autoheader, autoupdate...).])
5 # Copyright (C) 2000-2001, 2003-2004, 2006-2017, 2020-2023 Free Software
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 <https://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 "$SHELL_N" != none || 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/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"])
65 ## ---------------------------- ##
66 ## Syntax of the Perl scripts. ##
67 ## ---------------------------- ##
69 AT_SETUP([Syntax of the Perl scripts])
71 AT_CHECK_PERL_SYNTAX([autoconf])
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: error: 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 timestamp 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([])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([])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([])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']],
361 # autoconf --trace: AC_CONFIG_MACRO_DIRS
362 # --------------------------------------
363 AT_SETUP([autoconf --trace: AC_CONFIG_MACRO_DIRS])
364 AT_KEYWORDS([AC_CONFIG_MACRO_DIR AC_CONFIG_MACRO_DIR_TRACE])
366 AT_DATA([configure.ac],
368 AC_CONFIG_MACRO_DIR([dir1])
369 AC_CONFIG_MACRO_DIRS([dir2 dir3 \
371 AC_CONFIG_MACRO_DIRS([dir5])
375 AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR], 0,
376 [[configure.ac:2:AC_CONFIG_MACRO_DIR:dir1
380 AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR_TRACE], 0,
381 [[configure.ac:2:AC_CONFIG_MACRO_DIR_TRACE:dir1
382 configure.ac:3:AC_CONFIG_MACRO_DIR_TRACE:dir2
383 configure.ac:3:AC_CONFIG_MACRO_DIR_TRACE:dir3
384 configure.ac:3:AC_CONFIG_MACRO_DIR_TRACE:dir4
385 configure.ac:5:AC_CONFIG_MACRO_DIR_TRACE:dir5
388 # Legacy macro can only be used once
389 AT_DATA([configure.ac],
391 AC_CONFIG_MACRO_DIR([dir1])
392 AC_CONFIG_MACRO_DIR([dir2])
395 AT_CHECK_AUTOCONF([], [1], [], [stderr])
396 AT_CHECK([grep 'error: AC_CONFIG_MACRO_DIR can only be used once' stderr],
399 # Legacy macro must be used first, if present
400 AT_DATA([configure.ac],
402 AC_CONFIG_MACRO_DIRS([dir1])
403 AC_CONFIG_MACRO_DIR([dir2])
405 AT_CHECK_AUTOCONF([], [1], [], [stderr])
406 AT_CHECK([grep 'error: AC_CONFIG_MACRO_DIR can only be used once' stderr],
409 # Only use the public macros
410 AT_DATA([configure.ac],
412 AC_CONFIG_MACRO_DIR_TRACE([dir1])
414 AT_CHECK_AUTOCONF([], [1], [],
415 [[configure.ac:2: error: Do not invoke AC_CONFIG_MACRO_DIR_TRACE directly
416 configure.ac:2: the top level
417 autom4te: error: m4 failed with exit status: 1
420 # Legacy macro use is not required, but still gets traced
421 AT_DATA([configure.ac],
423 AC_CONFIG_MACRO_DIRS([dir1])
424 AC_CONFIG_MACRO_DIRS([dir2])
427 AT_CHECK_AUTOCONF([], [0], [], [])
428 AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR], [0],
429 [[configure.ac:2:AC_CONFIG_MACRO_DIR:dir1
435 ## ---------------------------- ##
436 ## autoconf: forbidden tokens. ##
437 ## ---------------------------- ##
440 # autoconf: forbidden tokens, basic
441 # ---------------------------------
442 AT_SETUP([autoconf: forbidden tokens,[] basic])
444 AT_DATA_M4SH([configure.ac],
453 # This test needs autom4te's cache, in spite of any ~/.autom4te.cfg.
454 AT_DATA([.autom4te.cfg], [[
455 begin-language: "Autoconf"
456 args: --cache=autom4te.cache
457 end-language: "Autoconf"
458 begin-language: "Autoconf-without-aclocal-m4"
459 args: --cache=autom4te.cache
460 end-language: "Autoconf-without-aclocal-m4"
463 # Delay to make sure the cache files generated by the next command are
464 # considered newer than configure.ac.
467 AT_CHECK_AUTOCONF([], 1, [],
468 [[trailer.m4: warning: AC_INIT was never used
469 trailer.m4: warning: AC_OUTPUT was never used
470 configure.ac:2: error: possibly undefined macro: m4@&t@_foo
471 If this token and others are legitimate, please use m4@&t@_pattern_allow.
472 See the Autoconf documentation.
473 configure.ac:3: error: possibly undefined macro: _m4@&t@_bar
474 configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
475 configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
476 configure.ac:6: error: possibly undefined macro: d@&t@nl
479 # Delay to make sure the cache files generated by the previous command
480 # are considered to have been created in the past.
483 # A second run (without --force) should succeed and yield only the
484 # warnings about AC_INIT and AC_OUTPUT.
485 AT_CHECK_M4([autoconf], 0, [],
486 [[trailer.m4: warning: AC_INIT was never used
487 trailer.m4: warning: AC_OUTPUT was never used
493 # autoconf: forbidden tokens, exceptions
494 # --------------------------------------
495 AT_SETUP([autoconf: forbidden tokens,[] exceptions])
497 AT_DATA_M4SH([configure.ac],
500 # This is allowed in spite of the name.
501 # It is on purpose that we check the case where there are several
502 # tokens on the same line.
503 m4_pattern_allow([^AS_ALLOWED$])
504 NOT_AS_ALLOWED AS_ALLOWED AS_ALLOWED_NOT
507 m4_pattern_forbid([^FORBIDDEN$])
508 NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
510 # Test Autoconf's patterns.
511 AS_THIS_IS_INVALID and _AS_THIS_IS_INVALID_TOO
512 BUT_AZ_THIS_IS_NOT ALTHOUGH_AS_THIS_IS
513 # This is legal, although there is 'AS_DEFINE' in there.
515 # AS_THIS_IS_A_COMMENT so just shut up.
516 It would be very bad if Autoconf forgot to expand [AS_]INIT!
519 AT_CHECK_AUTOCONF([], 1, [],
520 [[trailer.m4: warning: AC_INIT was never used
521 trailer.m4: warning: AC_OUTPUT was never used
522 configure.ac:1: error: possibly undefined macro: AS@&t@_INIT
523 If this token and others are legitimate, please use m4@&t@_pattern_allow.
524 See the Autoconf documentation.
525 configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT
526 configure.ac:10: error: possibly undefined macro: FORBIDDEN
527 configure.ac:14: error: possibly undefined macro: AS@&t@_THIS_IS_INVALID
528 configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO
534 # autoconf: automatically allowed tokens
535 # --------------------------------------
536 AT_SETUP([autoconf: automatically allowed tokens])
538 AT_DATA_M4SH([configure.ac],
540 m4_pattern_forbid([^FB_])
551 # autoconf: do not forbid the empty token
552 # ---------------------------------------
553 AT_SETUP([autoconf: the empty token])
555 AT_DATA_M4SH([configure.ac],
556 [[m4_init[]m4_pattern_allow([^foo$])
558 line that begins with a space
561 AT_CHECK_AUTOCONF([], 0, [],
562 [[trailer.m4: warning: AC_INIT was never used
563 trailer.m4: warning: AC_OUTPUT was never used
569 # autoconf: subdirectories
570 # ------------------------
571 AT_SETUP([autoconf: subdirectories])
573 AT_DATA([configure.ac],
576 AC_CONFIG_FILES(sub/foo)
582 AT_DATA([sub/foo.in],
586 AT_DATA([install-sh])
590 AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
595 # autoconf: input from stdin
596 # --------------------------
597 AT_SETUP([autoconf: input from stdin])
599 # Past Autoconf versions failed to read from stdin when other, non-frozen input
600 # files were present.
601 AT_DATA([aclocal.m4])
603 AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
604 0, [stdin:1:AC_INIT:X:1.0:bug-autoconf@gnu.org
606 AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
607 0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org
613 # autoconf: AC_AUTOCONF_VERSION
614 # -----------------------------
615 AT_SETUP([autoconf: AC_AUTOCONF_VERSION])
617 AT_DATA([configure.ac],
619 version m4@&t@_defn([AC_AUTOCONF_VERSION]) version
624 AT_CHECK([[grep 'version ]]AT_PACKAGE_VERSION[[ version' configure]],
631 # autoconf: AC_PRESERVE_HELP_ORDER
632 # --------------------------------
633 AT_SETUP([autoconf: AC_PRESERVE_HELP_ORDER])
634 AT_KEYWORDS([m4@&t@_divert_text])
636 AT_DATA_AUTOCONF([configure.ac],
638 AC_PRESERVE_HELP_ORDER
639 AC_ARG_WITH([one], [ --with-one])
640 AC_ARG_ENABLE([two], [ --enable-two])
641 m4_divert_text([HELP_ENABLE], [arbitrary $text])
642 AC_ARG_WITH([three], [ --with-three])
647 AT_CHECK_CONFIGURE([--help], [], [stdout])
648 AT_CHECK([sed -n '/^Optional/,/^$/p' stdout], [],
649 [[Optional Features and Packages:
650 --disable-option-checking ignore unrecognized --enable/--with options
651 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
652 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
653 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
654 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
665 # autoconf: timestamp changes
666 # ---------------------------
667 # Automake needs autoconf to update the timestamp on the configure script
668 # whenever configure.ac or aclocal.m4 changes, even if the contents of the
669 # configure script have not changed.
670 AT_SETUP([autoconf: timestamp changes])
672 AT_DATA([aclocal.m4],
673 [[AC_DEFUN([local_KILROY], [# kilroy was here
677 AT_DATA_AUTOCONF([configure.ac],
686 cp configure configure.1
688 printf '%s\n' 'AC_LIBSOURCES([foo.c])dn@&t@l' >> configure.ac
690 # This step must not use --force.
691 # We don't need to check shell syntax, because if all goes well,
692 # the script will be unchanged from what it was in the first autoconf
693 # pass, and that was already checked.
694 AT_CHECK_M4([autoconf])
695 AT_CHECK([cmp configure configure.1])
696 AT_CHECK([test configure -nt configure.1])
698 cp configure configure.2
701 'AC_DEFUN([unused_MACRO], [# bob was there too' \
705 AT_CHECK_M4([autoconf])
706 AT_CHECK([cmp configure configure.2])
707 AT_CHECK([test configure -nt configure.2])
721 #if ! defined DEF3 && defined DEF4 /* but not defined DEF5 */
728 #if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
736 AT_CHECK([ifnames iftest1.c iftest2.c], 0,
746 VAL1 iftest1.c iftest2.c
760 # autoheader is intensively used in its modern form throughout this
761 # test suite. But we also have to check that acconfig.h still works.
762 # autoheader uses autoconf --trace, so traces first.
764 AT_SETUP([autoheader])
766 AT_DATA([acconfig.h],
767 [[/* Define this to whatever you want. */
772 # 1. Check that 'acconfig.h' is still honored.
773 AT_DATA([configure.ac],
775 AC_CONFIG_HEADERS(config.h:config.hin)
776 AC_DEFINE(this, "whatever you want.")
779 AT_CHECK_AUTOHEADER([], [this], [0], [], [ignore])
780 AT_CHECK([cat config.hin], 0,
781 [[/* config.hin. Generated from configure.ac by autoheader. */
782 /* Define this to whatever you want. */
785 /* Define to the address where bug reports for this package should be sent. */
786 #undef PACKAGE_BUGREPORT
788 /* Define to the full name of this package. */
791 /* Define to the full name and version of this package. */
792 #undef PACKAGE_STRING
794 /* Define to the one symbol short name of this package. */
795 #undef PACKAGE_TARNAME
797 /* Define to the home page for this package. */
800 /* Define to the version of this package. */
801 #undef PACKAGE_VERSION
805 # 2. Check that missing templates are a fatal error.
806 AT_DATA([configure.ac],
808 AC_CONFIG_HEADERS(config.h:config.hin)
809 AC_DEFINE(that, "whatever you want.")
812 # The test suite goes too fast for the cache timestamps...
814 AT_CHECK_AUTOHEADER([--force], [], [1], [], [ignore])
817 # 3. Check TOP and BOTTOM.
818 AT_DATA([acconfig.h],
819 [[/* Top from acconfig.h. */
821 /* Middle from acconfig.h. */
823 /* Bottom from acconfig.h. */
826 AT_DATA([configure.ac],
828 AC_CONFIG_HEADERS(config.h:config.hin)
829 AH_TOP([Top1 from configure.ac.])
830 AH_TOP([Top2 from configure.ac.])
831 AH_TOP([The Cat in a h@t.])
832 AH_VERBATIM([Middle], [Middle from configure.ac.])
833 AH_VERBATIM([Mouse], [The Mouse in a h@t.])
834 AH_BOTTOM([Bottom1 from configure.ac.])
835 AH_BOTTOM([Bottom2 from configure.ac.])
836 AH_BOTTOM([The Dog in a h@t.])
838 AC_DEFINE([ANT], [@], [The Ant in a h@t.])
842 # Yes, that's right: the 'middle' part of 'acconfig.h' is still before
843 # the AH_TOP part. But so what, you're not supposed to use the two
845 # Ignore STDERR which is the longish complaint against autoheader junk
847 AT_CHECK_AUTOHEADER([--force], [ANT], [], [], [ignore])
848 AT_CHECK([cat config.hin], 0,
849 [[/* config.hin. Generated from configure.ac by autoheader. */
850 /* Top from acconfig.h. */
851 /* Middle from acconfig.h. */
853 Top1 from configure.ac.
855 Top2 from configure.ac.
859 /* The Ant in a h@t. */
862 Middle from configure.ac.
866 /* Define to the address where bug reports for this package should be sent. */
867 #undef PACKAGE_BUGREPORT
869 /* Define to the full name of this package. */
872 /* Define to the full name and version of this package. */
873 #undef PACKAGE_STRING
875 /* Define to the one symbol short name of this package. */
876 #undef PACKAGE_TARNAME
878 /* Define to the home page for this package. */
881 /* Define to the version of this package. */
882 #undef PACKAGE_VERSION
884 Bottom1 from configure.ac.
886 Bottom2 from configure.ac.
889 /* Bottom from acconfig.h. */
895 # autoheader should see through m4 macros, just like autoconf
896 # https://lists.gnu.org/archive/html/bug-autoconf/2009-06/msg00000.html
897 AT_SETUP([autoheader and macros])
899 AT_DATA([configure.ac],
901 AC_CONFIG_HEADERS([config.h])
902 m4_define([PETER], [SIMSALABIM])
903 m4_define([PAUL], [OPENSESAME])
904 AC_DEFINE([PETER], [10], [Peter's public info])
905 AC_DEFINE_UNQUOTED([PAUL], [`expr 4 + 6`], [Paul's public info])
910 AT_CHECK_AUTOHEADER([], [OPENSESAME SIMSALABIM])
911 AT_CHECK([grep -c SIMSALABIM configure config.h.in], [0],
915 AT_CHECK([grep -c OPENSESAME configure config.h.in], [0],
919 AT_CHECK([grep -c PETER configure config.h.in], [1],
923 AT_CHECK([grep -c PAUL configure config.h.in], [1],
931 # autoheader should take all config header inputs into account when
932 # checking for missing templates.
933 AT_SETUP([autoheader with multiple headers])
935 AT_DATA([config-extra.h.in],
936 [[/* Define this to whatever you want. */
939 AT_DATA([configure.ac],
941 AC_CONFIG_HEADERS([config.h config-extra.h])
942 AC_DEFINE([HANNA], ["Hanna"])
943 AC_DEFINE([SEAN], ["Sean"], [Sean's name])
948 AT_CHECK_AUTOHEADER([], [SEAN])
949 AT_CHECK([grep HANNA configure], [0], [ignore], [ignore])
950 AT_CHECK([grep HANNA config.h.in], [1], [ignore], [ignore])
951 AT_CHECK([grep SEAN configure], [0], [ignore], [ignore])
952 AT_CHECK([grep SEAN config.h.in], [0], [ignore], [ignore])
962 # Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
963 AT_SETUP([autoupdate])
965 AT_DATA([configure.ac],
968 # The doc says 27 is a valid fubar.
970 AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
974 [[AC_INIT([Test],[1.0])
976 # The doc says 27 is a valid fubar.
978 AC_CONFIG_FILES([Makefile])
979 AC_CONFIG_COMMANDS([default],[echo $fubar],[fubar=$fubar])
983 # Checking 'autoupdate'.
985 AT_CHECK([cat configure.ac], 0, [expout])
986 # Checking that 'autoupdate' is idempotent
988 AT_CHECK([cat configure.ac], 0, [expout])
993 # autoupdating AC_LINK_FILES
994 # --------------------------
995 AT_SETUP([autoupdating AC_LINK_FILES])
997 AT_DATA([configure.ac],
999 AC_LINK_FILES(dst1 dst2, src1 src2)
1003 AT_DATA([dst1], dst1
1005 AT_DATA([dst2], dst2
1008 # Checking 'autoupdate'.
1009 AT_CHECK_AUTOUPDATE([], 0, [], ignore)
1011 # The replacement for AC_LINK_FILES includes a forced -Wobsolete
1012 # warning, because it needs to be manually adjusted afterward.
1013 # Look for it in the autoconf output.
1014 AT_CHECK_AUTOCONF([], 0, [], stderr)
1015 AT_CHECK([grep 'AC_LINK_FILES' stderr], 0, ignore, ignore)
1016 AT_CHECK([grep 'AC_CONFIG_LINKS' stderr], 0, ignore, ignore)
1017 AT_CHECK([grep 'warning: It is technically impossible' stderr],
1019 AT_CHECK([grep 'tune the result yourself' stderr], 0, ignore, ignore)
1022 AT_CHECK([cat src1], 0, [dst1
1024 AT_CHECK([cat src2], 0, [dst2
1030 # autoupdating AC_PREREQ
1031 # ----------------------
1032 AT_SETUP([autoupdating AC_PREREQ])
1034 # Produce 'AC_PREREQ(<AUTOUPDATE VERSION>)'.
1035 AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
1036 autoupdate_version=`cat stdout`
1037 [echo "AC_PREREQ([$autoupdate_version])" >expout]
1039 AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
1042 AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
1045 AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
1051 # autoupdating AU_ALIAS
1052 # ---------------------
1053 AT_SETUP([autoupdating AU_ALIAS])
1055 AT_DATA([configure.ac],
1057 AC_DEFUN([FOO], [$#])
1058 AU_ALIAS([BAZ],[FOO])
1059 test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
1062 AC_CONFIG_HEADERS([config.h])
1066 # Checking 'autoupdate'.
1069 # autoupdate does not replace AU_DEFUNs/AU_ALIASes defined by
1070 # configure.ac itself, nor by aclocal.m4, so BAZ will still be present
1071 # in the updated configure.ac. This is actually desirable for this
1072 # test: the point of that part of the above configure.ac is to
1073 # verify that the expansion of an AU_ALIAS definition handles $#
1074 # correctly. If BAZ got turned into FOO by the above call to
1075 # autoupdate, we would need to run autoconf and configure twice in
1076 # this test. However, it does also mean that by default we get a
1077 # -Wobsolete warning because of BAZ, so turn that off so it doesn't
1078 # cause a spurious failure.
1079 AT_CHECK_AUTOCONF([-Wno-obsolete])
1080 AT_CHECK_AUTOHEADER([-Wno-obsolete], [
1081 AC_APPLE_UNIVERSAL_BUILD
1095 AT_CHECK([grep 'AC_C_BIGENDIAN[(]' configure.ac], 1, [ignore], [ignore])
1096 AT_CHECK([grep 'AC_C_BIGENDIAN' configure.ac], 0, [ignore], [ignore])
1101 # autoupdating OLD to NEW
1102 # -----------------------
1104 # The example taken from the code comments.
1105 AT_SETUP([autoupdating OLD to NEW])
1107 AT_DATA([aclocal.m4],
1108 [[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
1109 AC_DEFUN([NEW], [echo "sum($1) = $2"])
1112 AT_DATA([configure.ac],
1119 # Checking 'autoupdate'.
1123 AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
1124 AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
1129 # autoupdating macros recursively
1130 # -------------------------------
1132 AT_SETUP([autoupdating macros recursively])
1136 AT_DATA([configure.ac],
1139 AC_TRY_COMPILE([], [choke me], [echo bogus1],
1140 [AC_TRY_COMPILE([], [return 0;], [echo good], [echo bogus2])])
1144 # Checking 'autoupdate'.
1146 AT_CHECK([grep changequote configure.ac], [1])
1147 AT_CHECK([grep TRY_COMPILE configure.ac], [1])
1154 # autoupdating AC_HELP_STRING
1155 # ---------------------------
1156 AT_SETUP([autoupdating AC_HELP_STRING])
1158 AT_DATA([configure.ac],
1160 AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
1164 # Checking 'autoupdate'.
1165 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1167 AT_CHECK_CONFIGURE([], [], [], [ignore])
1168 AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
1173 # autoupdating with m4sugar
1174 # -------------------------
1175 AT_SETUP([autoupdating with m4sugar])
1177 AT_DATA([aclocal.m4],
1179 [m4@&t@_pushdef([foo], [bar])dn@&t@l
1181 m4@&t@_popdef([foo])dn@&t@l
1187 AT_DATA([configure.ac],
1189 m4_define([gnumeric_version_epoch], [1])
1192 AC_FOREACH([name], [n1 n2],
1195 AC_CHECKING([for feature])
1196 AC_MSG_RESULT_UNQUOTED([`echo done`])
1201 # Checking 'autoupdate'.
1202 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1204 AT_CHECK_CONFIGURE([], [], [], [ignore])
1209 # autoupdating with m4_pushdef
1210 # ----------------------------
1211 AT_SETUP([autoupdating with m4@&t@_pushdef])
1216 AT_DATA([configure.ac],
1219 # temporarily override this macro
1220 m4@&t@_pushdef([AC_MSG_RESULT_UNQUOTED], [:])
1222 m4@&t@_popdef([AC_MSG_RESULT_UNQUOTED])
1226 # Checking 'autoupdate'.
1227 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1228 AT_CHECK([grep changequote configure.ac], [1])
1229 AT_CHECK([grep [pushdef.*AC_MSG_RESULT_UNQUOTED] configure.ac], [0], [ignore])
1231 AT_CHECK_CONFIGURE([], [], [], [ignore])
1236 # autoupdating with AC_REQUIRE
1237 # ----------------------------
1238 AT_SETUP([autoupdating with AC_REQUIRE])
1242 AT_DATA([configure.ac],
1244 [AC_REQUIRE([AC_DECL_SYS_SIGLIST])
1245 AC_CHECK_DECLS([_sys_siglist], [], [], [#include <signal.h>])
1253 # Checking 'autoupdate'.
1254 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1256 AT_CHECK_CONFIGURE([], [], [], [ignore])
1261 # autoupdating with complex quoting
1262 # ---------------------------------
1263 AT_SETUP([autoupdating with complex quoting])
1267 AT_DATA([configure.ac],
1268 [[m4_define([MACRO],
1269 [[#define STRING "hello, world\n"
1273 AC_TRY_COMPILE([#include <stdio.h>
1274 ]MACRO[], [printf (STRING);],
1279 # Checking 'autoupdate'.
1280 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1282 AT_CHECK([grep MACRO configure], [1])
1283 AT_CHECK_CONFIGURE([], [], [], [ignore])
1288 # autoupdating AC_LANG_SAVE
1289 # -------------------------
1290 AT_SETUP([autoupdating AC_LANG_SAVE])
1292 AT_DATA([configure.ac],
1301 # Checking 'autoupdate'.
1303 # Both the autoupdate and autoconf invocations will complain about
1304 # AC_LANG_SAVE being obsolete, because autoupdate cannot replace
1305 # two-macro sequences (e.g. AC_LANG_SAVE \n AC_LANG([C]) ideally would
1306 # become AC_LANG_PUSH([C]) but we can't do that) so an m4_warn
1307 # is left in place to remind people they need to do some hand edits.
1308 # Ignore these diagnostics.
1309 AT_CHECK_AUTOUPDATE([], [], [], [ignore])
1310 AT_CHECK_AUTOCONF([], [], [], [ignore])
1316 # autoupdating AC_FOREACH
1317 # -----------------------
1318 AT_SETUP([autoupdating AC_FOREACH])
1320 AT_DATA([aclocal.m4],
1321 [[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
1324 AT_DATA([configure.ac],
1326 echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
1330 # Checking 'autoupdate'.
1331 # AC_FOREACH is replaced with an m4sugar macro, so we must make sure
1332 # the m4sugar macro wasn't expanded.
1334 AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
1335 AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
1336 AT_CHECK([[grep "echo ' 1'' 2'' 3'' 4'' 5'' 6'" configure.ac]], 1,
1339 AT_CHECK_CONFIGURE([], [0], [stdout])
1340 AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
1344 # autoupdating AC_OBSOLETE
1345 # ------------------------
1346 AT_SETUP([autoupdating AC_OBSOLETE])
1348 AT_DATA([aclocal.m4],
1350 [AC_OBSOLETE([$0], [; convert to NEW])
1353 [AS@&t@_ECHO(["dst=$1 src=$2"])])
1356 AT_DATA([configure.ac],
1362 AT_CHECK_AUTOCONF([-Werror], 1, [],
1363 [[configure.ac:2: warning: OLD is obsolete; convert to NEW
1364 general.m4: AC_OBSOLETE is expanded from...
1365 aclocal.m4:1: OLD is expanded from...
1366 configure.ac:2: the top level
1367 configure.ac:2: warning: The macro 'AC_OBSOLETE' is obsolete.
1368 configure.ac:2: You should run autoupdate.
1369 general.m4: AC_OBSOLETE is expanded from...
1370 aclocal.m4:1: OLD is expanded from...
1371 configure.ac:2: the top level
1374 # autoupdate does not know how to replace OLD with NEW
1376 AT_CHECK([[grep OLD configure.ac]], 0, [ignore], [ignore])
1378 # autoupdate _does_ know how to remove AC_OBSOLETE from aclocal.m4
1379 AT_CHECK_AUTOUPDATE([aclocal.m4], 0, [],
1380 [[aclocal.m4:2: warning: if possible, define this macro using AU_DEFUN.
1383 # AC_OBSOLETE is replaced with an m4sugar macro, so we must make sure
1384 # the m4sugar macro wasn't expanded.
1385 AT_CHECK([[grep 'm4@&t@_warn' aclocal.m4]], 0, [ignore], [ignore])
1386 AT_CHECK([[grep 'if possible, define this' aclocal.m4]], 0, [ignore], [ignore])
1387 AT_CHECK([[grep 'AC_OBSOLETE(' aclocal.m4]], 1, [ignore], [ignore])
1389 AT_CHECK_AUTOCONF([-Wobsolete -Wno-error], 0, [],
1390 [[configure.ac:2: warning: if possible, define this macro using AU_DEFUN.
1391 aclocal.m4:1: OLD is expanded from...
1392 configure.ac:2: the top level
1393 configure.ac:2: warning: OLD is obsolete; convert to NEW
1394 aclocal.m4:1: OLD is expanded from...
1395 configure.ac:2: the top level
1398 AT_CHECK_CONFIGURE([], 0,
1400 configure: creating ./config.status
1406 # autoupdating AC_DIAGNOSE and AC_WARNING
1407 -----------------------------------------
1408 AT_SETUP([autoupdating AC_DIAGNOSE and AC_WARNING])
1410 AT_DATA([configure.ac],
1412 AC_DIAGNOSE([gnu], [The gnu has escaped])
1413 AC_WARNING([funny punctu&tion])
1417 # Checking 'autoupdate'.
1418 # AC_DIAGNOSE and AC_WARNING are replaced with m4sugar macros, so we
1419 # must make sure the m4sugar macros weren't expanded.
1421 AT_CHECK([[grep 'm4@&t@_warn' configure.ac]], 0, [ignore], [ignore])
1422 AT_CHECK([[grep 'The gnu has escaped' configure.ac]], 0, [ignore], [ignore])
1423 AT_CHECK([[grep 'funny punctu&tion' configure.ac]], 0, [ignore], [ignore])
1425 # The diagnostics should appear when autoconf is run.
1426 AT_CHECK_AUTOCONF([-Wall], [0], [],
1427 [[configure.ac:2: warning: The gnu has escaped
1428 configure.ac:3: warning: funny punctu&tion
1435 # autoupdating AC_FATAL
1436 -----------------------
1437 AT_SETUP([autoupdating AC_FATAL])
1439 AT_DATA([configure.ac],
1441 AC_FATAL([what did you do this time])
1445 # Checking 'autoupdate'.
1446 # AC_FATAL is replaced with a m4sugar macro, so we
1447 # must make sure the m4sugar macro wasn't expanded.
1449 AT_CHECK([[grep 'm4@&t@_fatal' configure.ac]], 0, [ignore], [ignore])
1450 AT_CHECK([[grep 'what did you do this time' configure.ac]],
1451 0, [ignore], [ignore])
1453 # The diagnostic should appear when autoconf is run.
1454 AT_CHECK_AUTOCONF([-Wall], [1], [],
1455 [[configure.ac:2: error: what did you do this time
1456 configure.ac:2: the top level
1457 autom4te: error: m4 failed with exit status: 1
1459 AT_CHECK([[test \! -f configure]])
1464 # autoupdating with aclocal and m4_include
1465 # ----------------------------------------
1466 AT_SETUP([autoupdating with aclocal and m4@&t@_include])
1469 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1471 # Prevent aclocal from reading third-party macros, in case they are buggy.
1473 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1477 AT_DATA([configure.ac],
1483 AT_DATA([m4/stuff.m4],
1484 [[AU_ALIAS([AC_OLD_MACRO], [AC_NEW_MACRO])
1485 AC_DEFUN([AC_NEW_MACRO], [echo hi])
1486 AC_DEFUN([AC_UNCHANGED_MACRO], [echo one])
1488 cp m4/stuff.m4 aclocal/stuff.m4
1489 AT_CHECK([$ACLOCAL -I aclocal], [0], [ignore], [ignore])
1490 # Checking 'autoupdate'.
1492 AT_CHECK([$ACLOCAL -I m4], [0], [ignore], [ignore])
1498 # Keeping autom4te.cfg complete
1499 # -----------------------------
1501 AT_SETUP([autom4te preselections])
1502 : ${sleep='sleep 1'} # Command to force different timestamps.
1503 # If this test should run on FAT file systems and older w32,
1504 # then setting $sleep correctly needs to be revisited.
1506 # We use aclocal and automake. Skip broken automake wrappers.
1507 AT_CHECK([automake --version || exit 77], [], [stdout], [ignore])
1508 AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
1509 AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
1511 # Prevent aclocal from reading third-party macros, in case they are buggy.
1512 # (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.)
1514 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1517 AT_DATA([configure.ac],
1518 [[AC_INIT(GNU foo, 1.0)
1520 AC_CONFIG_FILES([Makefile])
1524 AT_DATA([Makefile.am],
1525 [[AUTOMAKE_OPTIONS = foreign
1528 $sleep # 'aclocal.m4' should be strictly younger than its inputs
1530 # If Autoconf is too old, or the user has turned caching off, skip:
1531 AT_CHECK([$ACLOCAL || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }],
1533 AT_CHECK([test -d autom4te.cache || exit 77])
1534 AT_CHECK([autoconf])
1536 # If this test fails due to missing entries in lib/autom4te.in, then
1537 # comparing the old and new requests is a good place to start debugging:
1538 sort autom4te.cache/requests >old-requests
1540 $sleep # if 'configure' is regenerated, we want it to be strictly newer,
1541 # to catch the error consistently.
1542 AT_CHECK([$ACLOCAL], [],[], [ignore])
1543 AT_CHECK([automake --no-force --add-missing], [], [], [ignore])
1544 AT_CHECK([autoconf])
1545 AT_CHECK([test "`find configure -newer newer`" = "" ||
1546 { sort autom4te.cache/requests | diff old-requests -; exit 1; }],
1548 [extract_version=['s/^[^0-9]*\([0-9][^ ]*\).*/\1/;q']
1549 automake_version=`automake --version | sed "$extract_version"`
1550 used_automake_version=`sed "$extract_version" "$abs_top_srcdir/Makefile.in"`
1551 AT_CHECK([if test "$automake_version" = "$used_automake_version"; ]dnl
1552 [then exit 1; else exit 77; fi])])
1556 # autom4te cache creation
1557 # -----------------------
1558 # Ensure autom4te fails when it cannot create the cache directory
1559 # or create files there.
1560 AT_SETUP([autom4te cache creation])
1562 AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
1564 # Work in a subdirectory so autotest can scribble in the toplevel.
1568 AT_DATA([configure.ac],
1573 AT_DATA([.autom4te.cfg],
1574 [[begin-language: "Autoconf-without-aclocal-m4"
1575 args: --cache=sub/autom4te.cache
1576 end-language: "Autoconf-without-aclocal-m4"
1579 # Do not try this when we are root or on systems without permissions.
1580 # A failed redirection may cause a status of 2 with FreeBSD sh.
1581 AT_CHECK([(: > sub/some-file) || exit 1 && exit 77], 1, [ignore], [ignore])
1583 # Failure to create cache directory due to access permissions.
1584 AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
1585 AT_CHECK([grep 'cannot create .*autom4te.cache' stderr], [0], [ignore])
1586 AT_CHECK([grep ': Permission denied' stderr], [0], [ignore])
1587 AT_CHECK([test -f configure], [1])
1589 # Failure to create cache directory due to something else in the way.
1591 : > sub/autom4te.cache
1592 AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
1593 AT_CHECK([grep 'cannot create .*autom4te.cache' stderr], [0], [ignore])
1594 AT_CHECK([grep ': File exists' stderr], [0], [ignore])
1595 AT_CHECK([test -f configure], [1])
1597 # This time, creation should succeed.
1598 rm -f sub/autom4te.cache
1600 AT_CHECK([test -d sub/autom4te.cache])
1602 rm -f configure sub/autom4te.cache/*
1603 chmod a-w sub/autom4te.cache
1605 # Failure to create a file in the cache directory.
1606 AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
1607 AT_CHECK([grep 'cannot open .*autom4te.cache' stderr], [0], [ignore])
1608 AT_CHECK([test -f configure], [1])
1610 # If the directory already exists, that should be fine.
1611 chmod u+w sub/autom4te.cache
1617 # autom4te cache locking
1618 # ----------------------
1620 AT_SETUP([autom4te cache locking])
1622 # Expect this test to fail if Perl file locking does not work.
1623 AT_XFAIL_IF([$PERL -I "$top_srcdir/lib" -e '
1624 use Autom4te::XFile;
1625 my $fh = new Autom4te::XFile "lockfile", O_RDWR|O_CREAT;
1626 flock ($fh, LOCK_EX) && exit 1;
1629 # Cannot use AT_CHECK here, autotest internals could be messed up.
1631 (echo AC_INIT; sleep 2; echo) \
1632 | (autom4te --language=autoconf -o configure -; echo $? >&2 ) 2>errlog &
1633 AT_CHECK([echo AC_INIT | autom4te --language=autoconf -o configure -])
1636 # Ignore additional output from shell verbose or xtrace mode.
1637 AT_CHECK([grep 'cannot rename' errlog], [1])
1638 AT_CHECK([grep '^0$' errlog], [], [ignore])
1644 # autotools and file names containing whitespace
1645 # ----------------------------------------------
1647 AT_SETUP([autotools and whitespace in file names])
1649 # Prevent autoreconf from running aclocal, which might not exist,
1650 # or could barf over warnings in third-party macro files.
1658 'with funny '\'' $x & #! name ' \
1659 'with funny \ '\'' \'\'' " <a >b * ? name ' #"
1661 funny=`func_sanitize_file_name "$funny"`
1663 dir=`func_sanitize_dir_name " dir $funny"`
1667 # skip if we cannot create such a file or directory
1668 AT_CHECK([mkdir "$dir" "$TMPDIR" && touch "$file.ac" || exit 77])
1670 cat >"$file.ac" <<'END'
1672 m4@&t@_include([foo.m4])
1673 AC_CONFIG_HEADERS([config.h:config.hin])
1677 cat >"$dir"/foo.m4 <<'END'
1678 [AC_DEFUN([AC_MACRO], [echo hi])]
1681 AT_CHECK_AUTOHEADER([-B "$dir" "$file.ac"])
1682 AT_CHECK_AUTOHEADER([--force -I "$dir" "$file.ac"])
1683 AT_CHECK_AUTOUPDATE([-B "$dir" "$file.ac"])
1684 AT_CHECK_AUTOUPDATE([--force -I "$dir" "$file.ac"])
1685 AT_CHECK_AUTOUPDATE([-B "$dir" - < "$file.ac"], [], [ignore])
1686 AT_CHECK_AUTOCONF([-B "$dir" -o "$file" "$file.ac"])
1687 AT_CHECK_AUTOCONF([-I "$dir" -o "$file" "$file.ac"])
1688 # In autoconf, these exercise a slightly different code path:
1689 AT_CHECK_AUTOCONF([--prepend-include="$dir" -o "$file" "$file.ac"])
1690 AT_CHECK_AUTOCONF([--include="$dir" -o "$file" "$file.ac"])
1691 AT_CHECK([autoscan -B "$dir"], [], [], [ignore])
1692 AT_CHECK([autoscan --force -I "$dir"], [], [], [ignore])
1693 # autoreconf requires a sane input file name.
1694 mv -f "$file.ac" configure.ac
1695 # Since aclocal is disabled, provide a stub aclocal.m4.
1696 AT_DATA([aclocal.m4])
1697 AT_CHECK([autoreconf -B "$dir"])
1698 AT_CHECK([autoreconf --force -I "$dir"])
1700 cat >"$file.c" <<'END'
1704 AT_CHECK([ifnames "$file.c"], [], [ignore])
1711 # autotools and file names containing whitespace
1712 # ----------------------------------------------
1714 AT_SETUP([autotools and relative TMPDIR])
1717 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1719 # Prevent aclocal from reading third-party macros, in case they are buggy.
1721 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1728 AT_DATA([configure.ac],
1730 AC_CONFIG_HEADERS([config.h:config.hin])
1736 AT_DATA([m4/foo.m4],
1737 [[AC_DEFUN([AC_MACRO],
1738 [AC_DEFINE([HAVE_MACROS], 1, [Define if you have macros.])])
1741 AT_CHECK([$ACLOCAL -I m4])
1742 AT_CHECK_AUTOHEADER([], [HAVE_MACROS])