Tweak m4_wrap to force FIFO or LIFO semantics.
[autoconf.git] / tests / torture.at
blob0d7509ee53d0ef8222475c9217279f4e44e30274
1 #                                                       -*- Autotest -*-
3 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 # Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 AT_BANNER([[Testing config.status.]])
23 ## ---------------------------------------- ##
24 ## AC_CONFIG_COMMANDS with empty commands.  ##
25 ## ---------------------------------------- ##
27 AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
28 [[AC_CONFIG_COMMANDS([foo], [], [:])
29 ]])
32 ## -------------------------- ##
33 ## Multiple AC_CONFIG_FILES.  ##
34 ## -------------------------- ##
36 AT_SETUP([Multiple AC_CONFIG_FILES])
38 AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
39 AT_CHECK_AUTOCONF([], 1, [], [ignore])
41 AT_CLEANUP
45 ## ------------ ##
46 ## AC_ARG_VAR.  ##
47 ## ------------ ##
49 # AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
50 # ----------------------------------------------
51 # Check that AC_ARG_VAR caches the latest values, diagnoses
52 # inconsistencies, and arms config.status.
53 m4_define([AT_CHECK_AC_ARG_VAR],
54 [rm -f config.cache
56 # Initial value.
57 m4_ifval([$1],
58          [precious='m4_bpatsubst($1, [[']], ['\\''])'; export precious],
59          [unset precious])
60 AT_CHECK_CONFIGURE([--config-cache -q])
61 AT_CHECK([cat file], [], [`$1'
64 # Testing --recheck: 1. have the environment `forget' about PRECIOUS.
65 unset precious
66 # 2. Rerun config.status to recreate `file'.
67 AT_CHECK([./config.status --recheck], [], [ignore])
68 AT_CHECK([./config.status], [], [ignore])
69 # 3. Check that file contains the old value of PRECIOUS.
70 AT_CHECK([cat file], [], [`$1'
73 # Second value: we should issue an error here: the value
74 # has changed!
75 m4_ifval([$2],
76          [precious='$2'; export precious],
77          [unset precious])
78 AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
80 ])# AT_CHECK_AC_ARG_VAR
83 AT_SETUP([AC_ARG_VAR])
85 # We don't want to run this test if this shell doesn't support
86 # `unset'.
87 AT_CHECK([
88 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
89   exit 0
90 else
91   exit 77
95 AT_DATA([configure.ac],
96 [[AC_INIT
97 AC_ARG_VAR([precious], [this variable costs a lot])
98 echo "precious:$precious"
99 AC_OUTPUT(file)
102 AT_DATA([file.in],
103 [[`@precious@'
106 AT_CHECK_AUTOCONF
108 # Set a precious variable
109 AT_CHECK_AC_ARG_VAR([], [apple of my eye])
111 # Unset a precious variable
112 AT_CHECK_AC_ARG_VAR([apple of my eye], [])
114 # Change a precious variable
115 AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
117 # Change a precious variable that contains braces
118 AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
120 # Change a precious variable that contains all kinds of fun
121 AT_CHECK_AC_ARG_VAR(['p  r      ec"iou$], [orange of my eye])
122 dnl restore font-lock: "
124 AT_CLEANUP
129 ## ---------------------------------------------- ##
130 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS.  ##
131 ## ---------------------------------------------- ##
133 AT_SETUP([[AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]])
135 AT_DATA([configure.ac],
136 [[AC_INIT
137 AC_PROG_FGREP
138 rm -f -r header var-header file var-file link var-link command var-command
139 echo 'OK' >input
141 # Be sure to also stress the associated INIT-CMDS.
142 case $what_to_test in
143  header)
144    AC_CONFIG_HEADERS(header:input);;
145  var-header)
146    AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
148  file)
149    AC_CONFIG_FILES(file:input);;
150  var-file)
151    AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
153  command)
154    AC_CONFIG_COMMANDS(command,
155                       [cp input command]);;
156  var-command)
157    AC_CONFIG_COMMANDS(var-command,
158                       [cp $command_in var-command], [command_in=input]);;
160  link)
161    AC_CONFIG_LINKS(link:input);;
162  var-link)
163    AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
164 esac
165 AC_OUTPUT
168 AT_CHECK_AUTOCONF
171 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
172 # ------------------------------------------------------------------
173 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
174 # are properly created, with the right content.
175 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
176 # AC_CONFIG_HEADERS.
177 m4_define([AT_CHECK_CONFIG_CREATION],
178 [AT_CHECK_CONFIGURE([what_to_test=$1])
179 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
180          [ignore], [$1
182 AT_CHECK([grep OK $1], [], [OK
185 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
186 # config.status might be stupidly expecting data on stdin, if it's
187 # really broken...
188 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
189 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
190          [ignore], [var-$1
192 AT_CHECK([grep OK var-$1], [], [OK
194 ])# AT_CHECK_CONFIG_CREATION
197 # AT_CHECK_CONFIG_CREATION_NOWRITE(THING = (header | link | file | command))
198 # ------------------------------------------------------------------
199 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
200 # are properly created, with the right content.
201 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
202 # AC_CONFIG_HEADERS.
203 m4_define([AT_CHECK_CONFIG_CREATION_NOWRITE],
204 [AT_CHECK_CONFIGURE([what_to_test=$1])
205 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
206          [ignore], [$1
208 AT_CHECK([grep OK $1], [], [OK
211 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
212 # config.status might be stupidly expecting data on stdin, if it's
213 # really broken...
214 # Skip check if user can rename files into a read-only directory (when
215 # run by root or on w32).
216 touch t
217 chmod a-w .
218 mv t t1 >/dev/null 2>&1 \
219   || AT_CHECK([./config.status var-$1 </dev/null], [1], [ignore], [ignore])
220 chmod u+w .
221 rm -rf t t1
222 ])# AT_CHECK_CONFIG_CREATION_NOWRITE
225 # Create a file
226 AT_CHECK_CONFIG_CREATION(file)
228 # Create a header
229 AT_CHECK_CONFIG_CREATION(header)
231 # Execute a command
232 AT_CHECK_CONFIG_CREATION(command)
234 # Create a link
235 AT_CHECK_CONFIG_CREATION(link)
237 # Now check for write errors
239 # Create a file
240 AT_CHECK_CONFIG_CREATION_NOWRITE(file)
241 # Create a file with bits from stdin
242 AT_CHECK([echo from-stdin | ./config.status --file=file:-],
243          [0], [ignore])
244 AT_CHECK([grep from-stdin file], [], [from-stdin
246 # Force write error creating a file on stdout
247 if test -w /dev/full && test -c /dev/full; then
248   AT_CHECK([./config.status --file=-:input </dev/null >/dev/full],
249            [1], [ignore], [ignore])
252 # Create a header
253 AT_CHECK_CONFIG_CREATION_NOWRITE(header)
254 # Create a header on stdout
255 AT_CHECK([./config.status --header=-:input </dev/null],
256          [0], [stdout], [ignore])
257 AT_CHECK([grep OK stdout], [], [OK
259 # Force write error creating a header on stdout
260 if test -w /dev/full && test -c /dev/full; then
261   AT_CHECK([./config.status --header=-:input </dev/null >/dev/full],
262            [1], [ignore], [ignore])
265 # Execute a command
266 AT_CHECK_CONFIG_CREATION_NOWRITE(command)
268 # Create a link
269 AT_CHECK_CONFIG_CREATION_NOWRITE(link)
271 # Check that no use of `ac_write_fail' escaped into config.status
272 AT_CHECK([grep ac_write_fail config.status], [1])
274 # Check that --file and --header accept funny file names
275 AT_DATA([fgrep.in],
276 [[FGREP="@FGREP@"
278 ./config.status --file=fgrep:fgrep.in
279 . ./fgrep
282 export x
283 for file in \
284   'with  funny '\'' $x & #! name' \
285   'file with  funny \ '\'' \'\'' $ & #!*? name' \
286   'with  funny \ '\'' \'\'' " | <a >b & * ? name ' # "restore font-lock
288   # The function func_sanitize_file_name comes from tools.at
289   file=`func_sanitize_file_name "$file"`
290   cat >"$file.in" <<'END'
291 @configure_input@
293   AT_CHECK([./config.status "--file=$file:$file.in"],
294            [0], [ignore])
295   AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
296   AT_CHECK([./config.status "--header=$file:$file.in"],
297            [0], [ignore])
298   # Run the same test a 2nd time to see that config.status does not recreate
299   # the header (regression test)
300   AT_CHECK_NOESCAPE([./config.status "--header=$file:$file.in"],
301                     [0], [config.status: creating $file
302 config.status: $file is unchanged
304   AT_CHECK_NOESCAPE([grep ' & ' "$file"], [],
305 [/* $file.  Generated from $file.in by configure.  */
307   AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
308 done
309 AT_CLEANUP
313 ## ---------------------------------------- ##
314 ## Macro calls in AC_CONFIG_COMMANDS tags.  ##
315 ## ---------------------------------------- ##
317 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
319 AT_DATA_M4SUGAR([configure.ac],
320 [[AC_INIT
321 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
322 AC_OUTPUT
325 AT_CHECK_AUTOCONF
326 AT_CHECK_CONFIGURE
328 AT_CLEANUP
332 ## ------------------- ##
333 ## Missing templates.  ##
334 ## ------------------- ##
336 # Check that config.status detects missing input files
337 AT_SETUP([Missing templates])
339 AT_DATA([configure.ac],
340 [[AC_INIT
341 AC_CONFIG_FILES([nonexistent])
342 AC_OUTPUT
345 AT_CHECK_AUTOCONF
346 AT_CHECK_CONFIGURE([], [1], [],
347 [[config.status: error: cannot find input file: nonexistent.in
349 # Make sure that the output file doesn't exist
350 AT_CHECK([test -f nonexistent], 1)
352 AT_CLEANUP
357 ## ---------------------- ##
358 ## configure invocation.  ##
359 ## ---------------------- ##
361 # Check that `configure' and `config.status' honor their interface.
363 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
364 # and verify that (i) `configure' correctly receives the arguments,
365 # (ii) correctly passes them to `config.status', which we check by
366 # running `config.status --recheck', and (iii) correctly passes them
367 # to sub-configure scripts.
369 AT_SETUP([configure invocation])
371 mkdir sub
373 AT_DATA([configure.ac],
374 [[AC_INIT
375 AC_CONFIG_SUBDIRS([sub])
376 echo "result=$one$enable_two$with_three"
377 AC_OUTPUT
380 AT_DATA([sub/configure.ac],
381 [[AC_INIT
382 echo "result=$one$enable_two$with_three"
383 AC_OUTPUT
386 echo fake install-sh script >install-sh
388 AT_CHECK_AUTOCONF
389 cd sub
390 AT_CHECK_AUTOCONF
391 cd ..
393 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
394                      sed -n -e 's/^result=//p'], 0,
395                    [m4_do([onetwothree
396 ],                        [onetwothree
397 ])])
398 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
399          [onetwothree
402 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" '  $" --with-three="   \"'$"|
403                       sed -n -e 's/^result=//p'], 0,
404                    [m4_do(["'$ " '  $   "'$
405 ],                        ["'$ " '  $   "'$
406 ])])
407 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
408          ["'$ " '  $    "'$
410 dnl restore font-lock: "
412 AT_CLEANUP
416 ## -------------------------------------------- ##
417 ## Check that `#define' templates are honored.  ##
418 ## -------------------------------------------- ##
420 # Use various forms of `#define' templates, and make sure there are no
421 # problems when a symbol is prefix of another.
423 AT_SETUP([@%:@define header templates])
425 AT_DATA([configure.ac],
426 [[AC_INIT
427 AC_CONFIG_HEADERS(config.h:config.hin)
429 # I18n of dummy variables: their French translations.
430 AC_DEFINE(foo, toto)
431 AC_DEFINE(bar, tata)
432 AC_DEFINE(baz, titi)
433 AC_DEFINE(fubar, tutu)
435 # Symbols which are prefixes of another.
436 AC_DEFINE(a, A)
437 AC_DEFINE(aaa, AAA)
438 AC_DEFINE(aa, AA)
440 # backslash-newline combinations
441 AC_DEFINE([multiline], [line1\
442 line2\
443 line3 \
444 line4])
445 AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
446 ARG1])
447 AC_CONFIG_FILES(defs)
449 # Things included in confdefs.h, but which make no sense in
450 # config.h, nor in $DEFS.
451 cat <<\EOF >>confdefs.h
452 /* Hi Mum! Look, I am doing C++! */
453 #ifdef __cplusplus
454 void exit (int status);
455 #endif
458 # In addition of config.h output a full DEFS
459 AC_OUTPUT_MAKE_DEFS
460 DEFS_SAVED=$DEFS
461 AC_SUBST(DEFS_SAVED)
462 AC_OUTPUT
465 AT_DATA([defs.in],
466 [[@DEFS_SAVED@
469 AT_DATA([config.hin],
470 [[#define foo   0
471 #  define bar bar
472 #  define baz   "Archimedes was sinking in his baz"
473   #  define fubar                               tutu
474 #define a B
475  #define aa BB
476  #  define aaa BBB
477 #undef a
478  #  undef aa
479 #undef aaa
480 #define aaa(a, aa) aa a
481 #define aaab
482 #define aaac(a, aa) aa a
483 #undef multiline
484 #  undef multiline_args
485 /* an ugly one: */
486 #define str(define) \
487 #define
488 #define stringify(arg) str(arg)
491 AT_CHECK_AUTOCONF
492 AT_CHECK_CONFIGURE
494 AT_DATA([expout],
495 [[/* config.h.  Generated from config.hin by configure.  */
496 #define foo toto
497 #  define bar tata
498 #  define baz titi
499   #  define fubar tutu
500 #define a A
501  #define aa AA
502  #  define aaa AAA
503 #define a A
504  #  define aa AA
505 #define aaa AAA
506 #define aaa AAA
507 #define aaab
508 #define aaac(a, aa) aa a
509 #define multiline line1\
510 line2\
511 line3 \
512 line4
513 #  define multiline_args(ARG1, ARG2) ARG2 \
514 ARG1
515 /* an ugly one: */
516 #define str(define) \
517 #define
518 #define stringify(arg) str(arg)
520 AT_CHECK([cat config.h], 0, expout)
522 # Check the value of DEFS.
523 AT_DATA([expout],
524 [[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA -Dmultiline=line1line2line3\ line4 -Dmultiline_args\(ARG1,\ ARG2\)=ARG2\ ARG1
527 # Because we strip trailing spaces in `testsuite' we can't leave one in
528 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
529 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
531 AT_CLEANUP
535 ## ------------------------- ##
536 ## Torturing config.status.  ##
537 ## ------------------------- ##
539 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
540 ## big value.  This is mostly to check that Autoconf produces portable sed
541 ## scripts in config.status.  sed is used to skip the first two lines
542 ## `Generated by...'.
544 # We use m4_for many times.
545 m4_pattern_allow([^m4_for$])
547 AT_SETUP([Torturing config.status])
549 dnl The value used as a big value for AC_DEFINE.
550 dnl Don't use sh active chars here, below it is also used in a sh
551 dnl assignment.
552 m4_define([AT_BIG_VALUE],
553 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
555 m4_define([AT_DESCRIPTION],
556 [Define to a long string if your `Autoconf' works properly.])
559 # AT_DUMMY_VAR(NUMBER)
560 # --------------------
561 # Build a name used for AC_SUBST and AC_DEFINE.  Put ac_ in it
562 # so that the check for user name space invasion does not complain
563 # of the new variables defined.
565 # Note that you should not use the name ac_dummy, because it will be
566 # turned into ac_uummy during the construction of config.status.  Yes,
567 # this is admittedly a bug, but it would be too hard to fix this.
568 # There is really no point in AC_DEFINE a var named ac_d.*.
569 m4_pattern_allow([^m4_bpatsubst$])
570 m4_define([AT_DUMMY_VAR],
571 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
575 AT_DATA([dummy.in],
576 [m4_for([AT_Count], 1, 100, 1,
577 [@AT_DUMMY_VAR(AT_Count)@
578 @[f]AT_Count@
579 ])])
583 while test $i != 101; do
584   echo "content of file $i" > file_$i
585   i=`expr $i + 1`
586 done
589 # ------------ #
590 # configure.ac #
591 # ------------ #
593 m4_pattern_allow([^m4_(define|defun)$])
594 AT_DATA([configure.ac],
595 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
596 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
597 [[m4_define([AC_DUMMY_VAR],]
598 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
600 [[m4_define([AC_DESCRIPTION],]
601 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
603 [[m4_define([AC_BIG_VALUE],]
604 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
606 [[# AC_DEFUBST(NAME)
607 # ----------------
608 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE.  This is
609 # used in the torture tests.
610 m4_defun([AC_DEFUBST],
611 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
612 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
613                    AC_DESCRIPTION)
614 AC_SUBST(AC_DUMMY_VAR($1))
615 AC_SUBST_FILE([f]$1)
616 f$1=file_$1
619 AC_INIT
620 AC_CONFIG_HEADERS(config.h:config.hin)
621 AC_CONFIG_FILES(dummy)
622 m4_for(AC_Count, 1, 100, 1,
623        [AC_DEFUBST(AC_Count)])
624 AC_PROG_AWK
625 AC_OUTPUT
626 ]])# configure.ac
628 AT_CHECK_AUTOCONF
629 AT_CHECK_AUTOHEADER
630 # Check both awk and the result of AC_PROG_AWK
631 for awk_arg in FOO= AWK=awk; do
632   AT_CHECK_CONFIGURE([$awk_arg])
634   # Checking that AC_DEFINE worked properly.
635   AT_DATA([expout],
636 [/* Define to the address where bug reports for this package should be sent. */
637 #define PACKAGE_BUGREPORT ""
639 /* Define to the full name of this package. */
640 #define PACKAGE_NAME ""
642 /* Define to the full name and version of this package. */
643 #define PACKAGE_STRING ""
645 /* Define to the one symbol short name of this package. */
646 #define PACKAGE_TARNAME ""
648 /* Define to the version of this package. */
649 #define PACKAGE_VERSION ""
650 m4_for(AT_Count, 1, 100, 1,
652 /* AT_DESCRIPTION */
653 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
654 ])])
656   AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
658   # Checking that AC_SUBST worked properly.
659   AT_DATA([expout],
660 [m4_for(AT_Count, 1, 100, 1,
661 [AT_BIG_VALUE
662 content of file AT_Count
663 ])])
665   AT_CHECK([cat dummy], 0, expout)
666 done
668 AT_CLEANUP
671 ## ------------------------------- ##
672 ## Substitute a 2000-byte string.  ##
673 ## ------------------------------- ##
675 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes.  HP/UX
676 # sed dumps core around 8 KiB.  However, POSIX says that sed need not
677 # handle lines longer than 2048 bytes (including the trailing newline).
678 # So we'll just test a 2000-byte value, and for awk, we test a line with
679 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
680 # multi-line values should allow to get around the limitations.
682 AT_SETUP([Substitute a 2000-byte string])
684 AT_DATA([Foo.in], [@foo@
686 AT_DATA([Bar.in], [@bar@
688 AT_DATA([Baz.in], [@baz@
691 AT_DATA([configure.ac],
692 [[AC_INIT
693 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
694 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
695 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
697 baz=$baz$baz$baz$baz$baz
698 AC_SUBST([baz])
699 AC_PROG_AWK
700 AC_CONFIG_FILES([Foo Bar Baz])
701 AC_OUTPUT
704 cp "$abs_top_srcdir/build-aux/install-sh" .
706 AT_CHECK_AUTOCONF
707 # Check both awk and the result of AC_PROG_AWK
708 for awk_arg in Foo= AWK=awk; do
709   AT_CHECK_CONFIGURE([$awk_arg])
710   AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
712   AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
714   AT_DATA([stdout],
715   [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
717   AT_CHECK([cat Baz], 0, [stdout])
718 done
719 AT_CLEANUP
722 ## ------------------------------ ##
723 ## Define to a 2000-byte string.  ##
724 ## ------------------------------ ##
726 AT_SETUP([Define to a 2000-byte string])
728 AT_CONFIGURE_AC(
730 AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
733 AT_CHECK_AUTOCONF
734 AT_CHECK_AUTOHEADER
735 AT_CHECK_CONFIGURE
736 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
738 AT_CLEANUP
741 ## ------------------------------------------ ##
742 ## Substitute and define special characters.  ##
743 ## ------------------------------------------ ##
745 # Use characters special to the shell, sed, awk, and M4.
747 AT_SETUP([Substitute and define special characters])
749 AT_DATA([Foo.in], [@foo@
750 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
751 abc@bar@baz@baz
752 abc@bar@@baz@baz
753 abc@bar@@baz@baz@
754 abc@bar @baz@baz
755 abc@bar @baz@baz@
756 abc@bar @baz@@baz@
757 @file@
758          @file@
759 X@file@
760 @file@X
763 AT_DATA([File],
764 [@foo@@bar@
767 AT_DATA([Zardoz.in], [@zardoz@
770 AT_CONFIGURE_AC(
771 [[foo="AS@&t@_ESCAPE([[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
772 bar="@foo@ @baz@"
773 baz=bla
774 ( for i in 0 1 2 3; do
775     for j in 0 1 2 3 4 5 6 7; do
776       for k in 0 1 2 3 4 5 6 7; do
777         case $i$j$k in #(
778         000 | 015 | 377) ;; # MinGW awk dislikes 0xFF, and the test does
779                             # the wrong thing for CR on MinGW.
780                             #(
781         *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
782         esac
783       done
784     done
785   done
786   printf \\n
787 ) >allowed-chars
788 zardoz=`cat allowed-chars`
789 AC_SUBST([foo])
790 AC_SUBST([bar])
791 AC_SUBST([baz])
792 AC_SUBST([zardoz])
793 file=File
794 AC_SUBST_FILE([file])
795 AC_DEFINE([foo], [[X*'[]+ ",& &`\($foo !]], [Awful value.])
796 AC_DEFINE([bar], [[%!_!# X]], [Value that is used as special delimiter.])
797 AC_PROG_AWK
798 AC_CONFIG_FILES([Foo Zardoz])]])
800 AT_CHECK_AUTOCONF
801 AT_CHECK_AUTOHEADER
802 # Check both awk and the result of AC_PROG_AWK
803 for awk_arg in FOO= AWK=awk; do
804   AT_CHECK_CONFIGURE([$awk_arg])
805   AT_CHECK([cat Foo], 0, [[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
806 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
807 abc@foo@ @baz@baz@baz
808 abc@foo@ @baz@blabaz
809 abc@foo@ @baz@blabaz@
810 abc@bar blabaz
811 abc@bar blabaz@
812 abc@bar blabla
813 @foo@@bar@
814 @foo@@bar@
815 X@file@
816 @file@X
818   AT_CHECK([cmp allowed-chars Zardoz])
819   AT_CHECK_DEFINES([[#define bar %!_!# X
820 #define foo X*'[]+ ",& &`\($foo !
822 done
823 AT_CLEANUP
826 ## ---------------------- ##
827 ## Substitute a newline.  ##
828 ## ---------------------- ##
830 AT_SETUP([Substitute a newline])
832 AT_DATA([Foo.in],
833 [@foo@
834 @bar@
837 AT_DATA([configure.ac],
838 [[AC_INIT
839 foo='one
840 two'
841 bar='%!_!# ''
843 AC_SUBST([foo])
844 AC_SUBST([bar])
845 AC_CONFIG_FILES([Foo])
846 AC_PROG_AWK
847 AC_OUTPUT
850 cp "$abs_top_srcdir/build-aux/install-sh" .
852 echo 'one
854 %!_!# ''
855 x' >expout
857 AT_CHECK_AUTOCONF
858 # Check both awk and the result of AC_PROG_AWK
859 for awk_arg in FOO= AWK=awk; do
860   AT_CHECK_CONFIGURE([$awk_arg])
861   AT_CHECK([cat Foo], 0, [expout])
862 done
863 AT_CLEANUP
866 ## ------------------ ##
867 ## Define a newline.  ##
868 ## ------------------ ##
870 AT_SETUP([Define a newline])
871 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
872 two], [This spans two lines.])
874 AT_CHECK_AUTOCONF([], [], [], [stderr])
875 dnl Older versions of m4 report error at line 5 (end of macro);
876 dnl newer versions report it at line 4 (start of macro).
877 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
878 [[warning: AC_DEFINE: `one
879 two' is not a valid preprocessor define value
881 AT_CHECK_AUTOHEADER([], [], [], [stderr])
882 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
883 [[warning: AC_DEFINE: `one
884 two' is not a valid preprocessor define value
886 AT_CHECK_CONFIGURE
887 AT_CHECK_DEFINES([[#define foo one
890 AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
891 two], [This spans two lines.])
893 AT_CHECK_AUTOCONF([], [], [], [stderr])
894 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
895 [[warning: AC_DEFINE_UNQUOTED: `one
896 two' is not a valid preprocessor define value
898 AT_CHECK_AUTOHEADER([], [], [], [stderr])
899 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
900 [[warning: AC_DEFINE_UNQUOTED: `one
901 two' is not a valid preprocessor define value
903 AT_CHECK_CONFIGURE
904 AT_CHECK_DEFINES([[#define foo one
907 AT_CLEANUP
910 ## ------------------------------------ ##
911 ## AC_SUBST: variable name validation.  ##
912 ## ------------------------------------ ##
914 AT_SETUP([AC_SUBST: variable name validation])
916 AT_CONFIGURE_AC([[AC_SUBST(, [])
917 AC_CONFIG_FILES([Makefile])
919 AT_DATA([Makefile.in], [[
921 mv -f configure.ac configure.tmpl
923 # Invalid names.
924 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
925   sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
926   AT_CHECK_AUTOCONF([], [1], [], [ignore])
927 done
929 # Valid names.
930 for var in ab a4 'a@@&t@\&t@b'; do
931   sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
932   AT_CHECK_AUTOCONF
933   AT_CHECK_AUTOHEADER
934   AT_CHECK_CONFIGURE
935 done
937 AT_CLEANUP
940 ## ------------------------ ##
941 ## datarootdir workaround.  ##
942 ## ------------------------ ##
944 AT_SETUP([datarootdir workaround])
946 AT_DATA([Foo.in],
947 [@datadir@
948 @docdir@
949 @infodir@
950 @localedir@
951 @mandir@
954 AT_DATA([Bar.in],
955 [@mydatadir@
958 AT_DATA([configure.ac],
959 [[AC_INIT
960 d@&t@nl The following line silences the warnings, if uncommented:
961 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
963 # This substitution is wrong and bogus!  Don't use it in your own code!
964 # Read `info Autoconf "Defining Directories"'!
965 AC_SUBST([mydatadir], [${datadir}/my])
967 AC_CONFIG_FILES([Foo Bar])
968 AC_OUTPUT
971 cp "$abs_top_srcdir/build-aux/install-sh" .
973 AT_CHECK_AUTOCONF
974 AT_CHECK_CONFIGURE([], [], [],
975   [config.status: WARNING:  'Foo.in' seems to ignore the --datarootdir setting
976 config.status: WARNING: Bar contains a reference to the variable `datarootdir'
977 which seems to be undefined.  Please make sure it is defined.
979 AT_CHECK([grep datarootdir Foo], 1, [])
981 rm configure
982 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
983 mv t configure.ac
985 AT_CHECK_AUTOCONF
986 AT_CHECK_CONFIGURE
988 AT_CLEANUP
991 ## -------- ##
992 ## srcdir.  ##
993 ## -------- ##
995 AT_SETUP([srcdir])
997 rm -f -r at-dir
998 mkdir at-dir
999 : >at-dir/bar.in
1000 : >foo.in
1002 AT_DATA([configure.ac],
1003 [[AC_INIT
1005 AC_CONFIG_FILES([foo at-dir/bar])
1007 # Use quotes in the INIT-COMMANDS to accommodate a value of $srcdir
1008 # containing e.g., spaces or shell meta-characters.
1009 # Use *single* quotes because the context is an unquoted here-doc.
1010 AC_CONFIG_COMMANDS([report],
1011 [test -f "$srcdir/configure.ac" ||
1012    AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
1013                    [srcdir='$srcdir'])
1015 AC_OUTPUT
1016 rm -f -r foo at-dir/bar
1019 AT_CHECK_AUTOCONF
1021 # In place.
1022 AT_CHECK([./configure], [], [ignore])
1024 # Relative name.
1025 AT_CHECK([cd at-dir && ../configure], [], [ignore])
1027 # Absolute name.
1028 at_here=`pwd`
1029 AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
1031 AT_CLEANUP
1034 ## ----------------- ##
1035 ## Signal handling.  ##
1036 ## ----------------- ##
1038 AT_SETUP([Signal handling])
1040 AT_DATA([configure.ac],
1041 [[AC_INIT
1042 kill -2 $$
1043 exit 77
1046 AT_CHECK_AUTOCONF
1047 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
1049 AT_CLEANUP
1052 ## ------------------------------------- ##
1053 ## AC_CONFIG_LINKS and identical files.  ##
1054 ## ------------------------------------- ##
1055 AT_SETUP([AC_CONFIG_LINKS and identical files])
1057 AT_DATA([configure.ac],
1058 [[AC_INIT
1059 AC_CONFIG_LINKS([src/s:src/s])
1060 test "$srcdir" != '.' && AC_CONFIG_LINKS([src/t:src/t])
1061 AC_OUTPUT
1064 mkdir src build
1065 echo file1 > src/s
1066 echo file2 > src/t
1067 AT_CHECK_AUTOCONF
1068 cd build
1069 AT_CHECK([../configure && ../configure], 0, [ignore])
1070 AT_CHECK([cat src/s src/t], 0, [file1
1071 file2
1073 cd ..
1074 AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
1075 AT_CHECK([grep src/t stderr], 1)
1076 AT_CHECK([cat src/s src/t], 0, [file1
1077 file2
1079 AT_CHECK(["`pwd`"/configure && "`pwd`"/configure], 0, [ignore], [ignore])
1080 AT_CHECK([cat src/s src/t], 0, [file1
1081 file2
1084 AT_CLEANUP
1087 AT_BANNER([autoreconf.])
1089 ## ---------------------------- ##
1090 ## Configuring subdirectories.  ##
1091 ## ---------------------------- ##
1093 # .
1094 # |-- builddir
1095 # |   |-- config.log
1096 # |   |-- config.status
1097 # |   `-- inner
1098 # |       |-- config.log
1099 # |       |-- config.status
1100 # |       `-- innermost
1101 # |           `-- config
1102 # |-- configure
1103 # |-- configure.ac
1104 # |-- inner
1105 # |   |-- configure
1106 # |   |-- configure.ac
1107 # |   `-- innermost
1108 # |       `-- config.in
1109 # `-- install-sh
1111 AT_SETUP([Configuring subdirectories])
1112 AT_KEYWORDS(autoreconf)
1114 # We use aclocal (via autoreconf).
1115 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
1116 # It should understand configure.ac.
1117 AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
1119 # Set CONFIG_SITE to a nonexistent file, so that there are
1120 # no worries about nonstandard values for 'prefix'.
1121 CONFIG_SITE=no-such-file
1122 export CONFIG_SITE
1124 # The contents of `inner/', and `inner/innermost/'.
1125 AS_MKDIR_P([inner/innermost])
1127 # We have to use configure.in, not configure.ac, if we still want to
1128 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
1129 # die because it can't find configure.in.
1130 AT_DATA([inner/configure.in],
1131 [[AC_INIT(GNU Inner, 1.0)
1132 AC_CONFIG_SRCDIR([innermost/config.in])
1133 AC_ARG_VAR([INNER], [an inner variable])
1134 AC_SUBST([INNER])
1135 if test "x$INNER" = x; then
1136   INNER=inner
1138 AC_CONFIG_FILES([innermost/config])
1139 AC_OUTPUT
1142 AT_DATA([inner/innermost/config.in],
1143 [INNER=@INNER@
1144 srcdir=@srcdir@
1145 top_srcdir=@top_srcdir@
1146 prefix=@prefix@
1149 # The contents of `.'
1150 AT_DATA([install-sh], [])
1152 # nonexistent is allowed not to exist.
1153 AT_DATA([configure.in],
1154 [[AC_INIT(GNU Outer, 1.0)
1155 AC_ARG_VAR([OUTER], [an outer variable])
1156 if false; then
1157   AC_CONFIG_SUBDIRS([nonexistent])
1159 AC_CONFIG_SUBDIRS([inner])
1160 AC_OUTPUT
1163 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
1164 # they trigger warnings from aclocal 1.8, so ignore stderr.
1165 AT_CHECK([autoreconf], [], [], [ignore])
1166 AT_CHECK([test -f inner/configure])
1168 # Running the outer configure recursively should provide the innermost
1169 # help strings.
1170 chmod a-w inner/innermost inner .
1171 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep INNER], 0,
1172          [ignore], [stderr],
1173          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1174 chmod u+w . inner inner/innermost
1176 # Running the outer configure should trigger the inner.
1177 AT_CHECK_CONFIGURE
1178 AT_CHECK([cat inner/innermost/config], 0,
1179 [INNER=inner
1180 srcdir=.
1181 top_srcdir=..
1182 prefix=/usr/local
1185 # The same, but from a builddir.
1186 AS_MKDIR_P([builddir])
1187 AT_CHECK([cd builddir && ../configure], 0, [ignore])
1188 AT_CHECK([cat builddir/inner/innermost/config], 0,
1189 [INNER=inner
1190 srcdir=../../../inner/innermost
1191 top_srcdir=../../../inner
1192 prefix=/usr/local
1195 # Make sure precious variables and command line options are properly
1196 # passed, even when there are duplicates.
1197 AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
1198 AT_CHECK([cat builddir/inner/innermost/config], 0,
1199 [INNER=good
1200 srcdir=../../../inner/innermost
1201 top_srcdir=../../../inner
1202 prefix=/good
1205 # Make sure --prefix is properly quoted
1206 AT_CHECK([cd builddir && ../configure --prefix "/a  b c$ 'd"], 0, [ignore])
1207 AT_CHECK([cat builddir/inner/innermost/config], 0,
1208 [INNER=inner
1209 srcdir=../../../inner/innermost
1210 top_srcdir=../../../inner
1211 prefix=/a  b c$ 'd
1214 # Make sure --silent is properly passed...
1215 AT_CHECK([cd builddir && ../configure --silent], 0, [])
1216 # ...but not stored in config.status.
1217 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1218 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1220 # Make sure we can run autoreconf on a subdirectory
1221 rm -f configure configure.in
1222 AT_CHECK([autoreconf inner], [], [], [ignore])
1224 # Make sure we can pass a configure.ac name
1225 AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
1226 AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
1228 AT_CLEANUP
1232 ## -------------- ##
1233 ## Deep Package.  ##
1234 ## -------------- ##
1236 AT_SETUP([Deep Package])
1237 AT_KEYWORDS(autoreconf)
1239 # We use aclocal (via autoreconf).
1240 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1242 # The contents of `.'
1243 AT_DATA([install-sh], [])
1244 AT_DATA([configure.in],
1245 [[AC_INIT(GNU Outer, 1.0)
1246 AC_ARG_VAR([OUTER], [an outer variable])
1247 AC_CONFIG_SUBDIRS([inner inner2])
1248 AC_OUTPUT
1251 # The contents of `inner/', and `inner/innermost/'.
1252 AS_MKDIR_P([inner/innermost])
1253 AS_MKDIR_P([inner2])
1255 AT_DATA([inner/configure.in],
1256 [[AC_INIT(GNU Inner, 1.0)
1257 AC_ARG_VAR([INNER], [an inner variable])
1258 AC_CONFIG_SUBDIRS(innermost)
1259 AC_OUTPUT
1262 AT_DATA([inner/innermost/configure.in],
1263 [[AC_INIT(GNU Innermost, 1.0)
1264 AC_ARG_VAR([INNERMOST], [an innermost variable])
1265 AC_CONFIG_HEADERS(config.h:config.hin)
1266 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1267 AC_OUTPUT
1270 AT_DATA([inner2/configure.in],
1271 [[AC_INIT(GNU Inner 2, 1.0)
1272 AC_ARG_VAR([INNER2], [an inner2 variable])
1273 AC_OUTPUT
1276 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
1277 AT_CHECK([test -f inner/configure])
1278 AT_CHECK([test -f inner/innermost/configure])
1279 AT_CHECK([test -f inner/innermost/config.hin])
1280 AT_CHECK([test -f inner2/configure])
1282 # Running the outer configure recursively should provide the innermost
1283 # help strings.
1284 chmod a-w inner/innermost inner
1285 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER "],
1286          0, [ignore], [stderr],
1287          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1288 chmod a-w .
1289 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER2 "],
1290          0, [ignore], [stderr],
1291          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1292 chmod a-w .
1293 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1294          0, [ignore], [stderr],
1295          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1296 chmod a-w .
1297 AT_CHECK([{ /bin/sh ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1298          0, [ignore], [stderr],
1299          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1300 chmod a-w .
1301 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure --help=recursive; chmod +w .; } | grep " INNERMOST "],
1302          0, [ignore], [stderr],
1303          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1304 chmod a-w .
1305 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1306          0, [ignore], [stderr],
1307          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1308 chmod u+w inner inner/innermost
1310 # Running the outer configure should trigger the inner.
1311 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1312 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1313 [[#define INNERMOST tsomrenni
1316 # The same, but from a builddir.
1317 AS_MKDIR_P([builddir])
1318 chmod a-w builddir inner/innermost inner
1319 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNER "],
1320          0, [ignore], [stderr],
1321          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1322 chmod a-w builddir
1323 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNER2 "],
1324          0, [ignore], [stderr],
1325          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1326 chmod a-w builddir
1327 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1328          0, [ignore], [stderr],
1329          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1330 chmod a-w builddir
1331 AT_CHECK([cd builddir && { /bin/sh ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1332          0, [ignore], [stderr],
1333          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1334 chmod a-w builddir
1335 # Not all shells search $PATH for scripts.
1336 if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help) >/dev/null 2>&1; then
1337   AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help=recursive | grep " INNERMOST "], 0, [ignore])
1339 AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1340          0, [ignore], [stderr],
1341          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1342 chmod u+w builddir inner inner/innermost
1343 AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
1344 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1345 [[#define INNERMOST build/tsomrenni
1348 AT_CLEANUP
1352 ## -------------------------------- ##
1353 ## Non-Autoconf AC_CONFIG_SUBDIRS.  ##
1354 ## -------------------------------- ##
1356 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1357 AT_KEYWORDS([autoreconf])
1359 # We use aclocal (via autoreconf).
1360 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1362 AT_DATA([install-sh], [])
1363 AT_DATA([configure.in],
1364 [[AC_INIT(GNU Outer, 1.0)
1365 AC_CONFIG_SUBDIRS([inner])
1366 AC_OUTPUT
1369 AS_MKDIR_P([inner])
1371 AT_DATA([inner/configure],
1372 [[#! /bin/sh
1373 case "$*" in
1374     *--help*) echo 'No Autoconf here, folks!' ;;
1375     *)        echo got_it >myfile ;;
1376 esac
1377 exit 0
1379 chmod +x inner/configure
1381 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
1383 # Running the outer configure recursively should provide the innermost
1384 # help strings.
1385 AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
1387 # Running the outer configure should trigger the inner.
1388 AT_CHECK([./configure], 0, [ignore])
1389 AT_CHECK([test -f inner/myfile], 0)
1391 AT_CLEANUP
1395 ## ----------------- ##
1396 ## Empty directory.  ##
1397 ## ----------------- ##
1399 AT_SETUP([Empty directory])
1400 AT_KEYWORDS([autoreconf])
1402 # We use aclocal (via autoreconf).
1403 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1405 # The test group directory is not necessarily _empty_, but it does not contain
1406 # files meaningful to `autoreconf'.
1408 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1410 AT_CLEANUP
1414 ## ------------------------------ ##
1415 ## Unusual Automake input files.  ##
1416 ## ------------------------------ ##
1418 # This parallels gnumake.test in Automake.
1420 AT_SETUP([Unusual Automake input files])
1421 AT_KEYWORDS([autoreconf])
1423 # We use aclocal and automake via autoreconf.
1424 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1426 AT_DATA([configure.in],
1427 [[AC_INIT(GNU foo, 1.0)
1428 AM_INIT_AUTOMAKE
1429 AC_CONFIG_FILES([HeeHee])
1430 AC_OUTPUT
1433 AT_DATA([HeeHee.am],
1434 [[# Humans do no worse than `GNUmakefile.am'.
1435 AUTOMAKE_OPTIONS = foreign 1.8
1438 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1439          [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1440 AT_CHECK([test -f HeeHee.in])
1442 AT_CLEANUP