Rewrite substantial part of lib/autoconf/status.m4.
[autoconf/tsuna.git] / tests / torture.at
blobcfb2008510a920c98c61a0462b627f4699c730c2
1 #                                                       -*- Autotest -*-
3 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
4 # 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 2, or (at your option)
9 # 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, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
22 AT_BANNER([[Testing config.status.]])
25 ## ---------------------------------------- ##
26 ## AC_CONFIG_COMMANDS with empty commands.  ##
27 ## ---------------------------------------- ##
29 AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
30 [[AC_CONFIG_COMMANDS([foo], [], [:])
31 ]])
34 ## -------------------------- ##
35 ## Multiple AC_CONFIG_FILES.  ##
36 ## -------------------------- ##
38 AT_SETUP([Multiple AC_CONFIG_FILES])
40 AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
41 AT_CHECK_AUTOCONF([], 1, [], [ignore])
43 AT_CLEANUP
47 ## ------------ ##
48 ## AC_ARG_VAR.  ##
49 ## ------------ ##
51 # AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
52 # ----------------------------------------------
53 # Check that AC_ARG_VAR caches the latest values, diagnoses
54 # inconsistencies, and arms config.status.
55 m4_define([AT_CHECK_AC_ARG_VAR],
56 [rm -f config.cache
58 # Initial value.
59 m4_ifval([$1],
60          [precious='$1'; export precious],
61          [unset precious])
62 AT_CHECK_CONFIGURE([--config-cache -q])
63 AT_CHECK([cat file], [], [`$1'
66 # Testing --recheck: 1. have the environment `forget' about PRECIOUS.
67 unset precious
68 # 2. Rerun config.status to recreate `file'.
69 AT_CHECK([./config.status --recheck], [], [ignore])
70 AT_CHECK([./config.status], [], [ignore])
71 # 3. Check that file contains the old value of PRECIOUS.
72 AT_CHECK([cat file], [], [`$1'
75 # Second value: we should issue an error here: the value
76 # has changed!
77 m4_ifval([$2],
78          [precious='$2'; export precious],
79          [unset precious])
80 AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
82 ])# AT_CHECK_AC_ARG_VAR
85 AT_SETUP([AC_ARG_VAR])
87 # We don't want to run this test if this shell doesn't support
88 # `unset'.
89 AT_CHECK([
90 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
91   exit 0
92 else
93   exit 77
97 AT_DATA([configure.ac],
98 [[AC_INIT
99 AC_ARG_VAR([precious], [this variable costs a lot])
100 echo "precious:$precious"
101 AC_OUTPUT(file)
104 AT_DATA([file.in],
105 [[`@precious@'
108 AT_CHECK_AUTOCONF
110 # Set a precious variable
111 AT_CHECK_AC_ARG_VAR([], [apple of my eye])
113 # Unset a precious variable
114 AT_CHECK_AC_ARG_VAR([apple of my eye], [])
116 # Change a precious variable
117 AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
119 AT_CLEANUP
124 ## ---------------------------------------------- ##
125 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS.  ##
126 ## ---------------------------------------------- ##
128 AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
130 AT_DATA([configure.ac],
131 [[AC_INIT
132 rm -f -r header var-header file var-file link var-link command var-command
133 echo 'OK' >input
135 # Be sure to also stress the associated INIT-CMDS.
136 case $what_to_test in
137  header)
138    AC_CONFIG_HEADERS(header:input);;
139  var-header)
140    AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
142  file)
143    AC_CONFIG_FILES(file:input);;
144  var-file)
145    AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
147  command)
148    AC_CONFIG_COMMANDS(command,
149                       [cp input command]);;
150  var-command)
151    AC_CONFIG_COMMANDS(var-command,
152                       [cp $command_in var-command], [command_in=input]);;
154  link)
155    AC_CONFIG_LINKS(link:input);;
156  var-link)
157    AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
158 esac
159 AC_OUTPUT
162 AT_CHECK_AUTOCONF
165 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
166 # ------------------------------------------------------------------
167 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
168 # are properly created, with the right content.
169 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
170 # AC_CONFIG_HEADERS.
171 m4_define([AT_CHECK_CONFIG_CREATION],
172 [AT_CHECK_CONFIGURE([what_to_test=$1])
173 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
174          [ignore], [$1
176 AT_CHECK([grep OK $1], [], [OK
179 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
180 # config.status might be stupidly expecting data on stdin, if it's
181 # really broken...
182 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
183 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
184          [ignore], [var-$1
186 AT_CHECK([grep OK var-$1], [], [OK
188 ])# AT_CHECK_CONFIG_CREATION
191 # Create a file
192 AT_CHECK_CONFIG_CREATION(file)
194 # Create a header
195 AT_CHECK_CONFIG_CREATION(header)
197 # Execute a command
198 AT_CHECK_CONFIG_CREATION(command)
200 # Create a link
201 AT_CHECK_CONFIG_CREATION(link)
203 AT_CLEANUP
207 ## ------------------- ##
208 ## Missing templates.  ##
209 ## ------------------- ##
211 # Check that config.status detects missing input files
212 AT_SETUP([Missing templates])
214 AT_DATA([configure.ac],
215 [[AC_INIT
216 AC_CONFIG_FILES([nonexistent])
217 AC_OUTPUT
220 AT_CHECK_AUTOCONF
221 AT_CHECK_CONFIGURE([], [1], [],
222 [[config.status: error: cannot find input file: nonexistent.in
224 # Make sure that the output file doesn't exist
225 AT_CHECK([test -f nonexistent], 1)
227 AT_CLEANUP
232 ## ---------------------- ##
233 ## configure invocation.  ##
234 ## ---------------------- ##
236 # Check that `configure' and `config.status' honor their interface.
238 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
239 # and verify that (i) `configure' correctly receives the arguments and
240 # (ii) correctly passes them to `config.status', which we check by
241 # running `config.status --recheck'.
243 AT_SETUP([configure invocation])
245 AT_DATA([configure.ac],
246 [[AC_INIT
247 echo "result=$one$enable_two$with_three"
248 AC_OUTPUT
251 AT_CHECK_AUTOCONF
253 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
254                      sed -n -e 's/^result=//p'], 0,
255                    [onetwothree
257 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
258          [onetwothree
261 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
262                       sed -n -e 's/^result=//p'], 0,
263                    ["'$ " ' $ "'$
265 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
266          ["'$ " ' $ "'$
269 AT_CLEANUP
273 ## -------------------------------------------- ##
274 ## Check that `#define' templates are honored.  ##
275 ## -------------------------------------------- ##
277 # Use various forms of `#define' templates, and make sure there are no
278 # problems when a symbol is prefix of another.
280 AT_SETUP([#define header templates])
282 AT_DATA([configure.ac],
283 [[AC_INIT
284 AC_CONFIG_HEADERS(config.h:config.hin)
286 # I18n of dummy variables: their French translations.
287 AC_DEFINE(foo, toto)
288 AC_DEFINE(bar, tata)
289 AC_DEFINE(baz, titi)
290 AC_DEFINE(fubar, tutu)
292 # Symbols which are prefixes of another.
293 AC_DEFINE(a, A)
294 AC_DEFINE(aaa, AAA)
295 AC_DEFINE(aa, AA)
296 AC_CONFIG_FILES(defs)
298 # Things included in confdefs.h, but which make no sense in
299 # config.h, nor in $DEFS.
300 cat <<\EOF >>confdefs.h
301 /* Hi Mum! Look, I am doing C++! */
302 #ifdef __cplusplus
303 void exit (int status);
304 #endif
307 # In addition of config.h output a full DEFS
308 AC_OUTPUT_MAKE_DEFS
309 DEFS_SAVED=$DEFS
310 AC_SUBST(DEFS_SAVED)
311 AC_OUTPUT
314 AT_DATA([defs.in],
315 [[@DEFS_SAVED@
318 AT_DATA([config.hin],
319 [[#define foo   0
320 #  define bar bar
321 #  define baz   "Archimedes was sinking in his baz"
322 #  define fubar                         tutu
323 #define a B
324 #define aa BB
325 #define aaa BBB
326 #undef a
327 #undef aa
328 #undef aaa
331 AT_CHECK_AUTOCONF
332 AT_CHECK_CONFIGURE
334 AT_DATA([expout],
335 [[/* config.h.  Generated from config.hin by configure.  */
336 #define foo toto
337 #  define bar tata
338 #  define baz titi
339 #  define fubar tutu
340 #define a A
341 #define aa AA
342 #define aaa AAA
343 #define a A
344 #define aa AA
345 #define aaa AAA
347 AT_CHECK([cat config.h], 0, expout)
349 # Check the value of DEFS.
350 AT_DATA([expout],
351 [[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA
354 # Because we strip trailing spaces in `testsuite' we can't leave one in
355 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
356 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
358 AT_CLEANUP
362 ## ------------------------- ##
363 ## Torturing config.status.  ##
364 ## ------------------------- ##
366 ## Require 100 AC_DEFINE and AC_SUBST with a significantly big value.
367 ## This is mostly to check that Autoconf produces portable sed scripts
368 ## in config.status.  sed is used to skip the first two lines
369 ## `Generated by...'.
371 # We use m4_for many times.
372 m4_pattern_allow([^m4_for$])
374 AT_SETUP([Torturing config.status])
376 dnl The value used as a big value for AC_DEFINE.
377 dnl Don't use sh active chars here, below it is also used in a sh
378 dnl assignment.
379 m4_define([AT_BIG_VALUE],
380 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
382 m4_define([AT_DESCRIPTION],
383 [Define to a long string if your `Autoconf' works properly.])
386 # AT_DUMMY_VAR(NUMBER)
387 # --------------------
388 # Build a name used for AC_SUBST and AC_DEFINE.  Put ac_ in it
389 # so that the check for user name space invasion does not complain
390 # of the new variables defined.
392 # Note that you should not use the name ac_dummy, because it will be
393 # turned into ac_uummy during the construction of config.status.  Yes,
394 # this is admittedly a bug, but it would be too hard to fix this.
395 # There is really no point in AC_DEFINE a var named ac_d.*.
396 m4_pattern_allow([^m4_bpatsubst$])
397 m4_define([AT_DUMMY_VAR],
398 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
402 AT_DATA([dummy.in],
403 [m4_for([AT_Count], 1, 100, 1,
404 [@AT_DUMMY_VAR(AT_Count)@
405 ])])
408 # ------------ #
409 # configure.ac #
410 # ------------ #
412 m4_pattern_allow([^m4_(define|defun)$])
413 AT_DATA([configure.ac],
414 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
415 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
416 [[m4_define([AC_DUMMY_VAR],]
417 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
419 [[m4_define([AC_DESCRIPTION],]
420 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
422 [[m4_define([AC_BIG_VALUE],]
423 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
425 [[# AC_DEFUBST(NAME)
426 # ----------------
427 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE.  This is
428 # used in the torture tests.
429 m4_defun([AC_DEFUBST],
430 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
431 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)",
432                    AC_DESCRIPTION)
433 AC_SUBST(AC_DUMMY_VAR($1))])
435 AC_INIT
436 AC_CONFIG_HEADERS(config.h:config.hin)
437 AC_CONFIG_FILES(dummy)
438 m4_for(AC_Count, 1, 100, 1,
439        [AC_DEFUBST(AC_Count)])
440 AC_OUTPUT
441 ]])# configure.ac
443 AT_CHECK_AUTOCONF
444 AT_CHECK_AUTOHEADER
445 AT_CHECK_CONFIGURE
447 # Checking that AC_DEFINE worked properly.
448 AT_DATA([expout],
449 [/* Define to the address where bug reports for this package should be sent. */
450 #define PACKAGE_BUGREPORT ""
452 /* Define to the full name of this package. */
453 #define PACKAGE_NAME ""
455 /* Define to the full name and version of this package. */
456 #define PACKAGE_STRING ""
458 /* Define to the one symbol short name of this package. */
459 #define PACKAGE_TARNAME ""
461 /* Define to the version of this package. */
462 #define PACKAGE_VERSION ""
463 m4_for(AT_Count, 1, 100, 1,
465 /* AT_DESCRIPTION */
466 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE"
467 ])])
468 AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
470 # Checking that AC_SUBST worked properly.
471 AT_DATA([expout],
472 [m4_for(AT_Count, 1, 100, 1,
473 [AT_BIG_VALUE
474 ])])
476 AT_CLEANUP
479 ## ------------------------------- ##
480 ## Substitute a 2000-byte string.  ##
481 ## ------------------------------- ##
483 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes.  HP/UX
484 # sed dumps core around 8 KiB.  However, POSIX says that sed need not
485 # handle lines longer than 2048 bytes (including the trailing newline).
486 # So we'll just test a 2000-byte value.
488 AT_SETUP([Substitute a 2000-byte string])
490 AT_DATA([Foo.in], [@foo@
493 AT_DATA([configure.ac],
494 [[AC_INIT
495 AC_CONFIG_AUX_DIR($top_srcdir/config)
496 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
497 AC_CONFIG_FILES([Foo])
498 AC_OUTPUT
501 AT_CHECK_AUTOCONF
502 AT_CHECK_CONFIGURE
503 AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
505 AT_CLEANUP
508 ## ------------------------------ ##
509 ## Define to a 2000-byte string.  ##
510 ## ------------------------------ ##
512 AT_SETUP([Define to a 2000-byte string])
514 AT_CONFIGURE_AC(
516 AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
519 AT_CHECK_AUTOCONF
520 AT_CHECK_AUTOHEADER
521 AT_CHECK_CONFIGURE
522 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
524 AT_CLEANUP
527 ## ------------------------------------------ ##
528 ## Substitute and define special characters.  ##
529 ## ------------------------------------------ ##
531 # Use characters special to the shell, sed, and M4.
533 AT_SETUP([Substitute and define special characters])
535 AT_DATA([Foo.in], [@foo@
538 AT_CONFIGURE_AC(
539 [[foo="AS@&t@_ESCAPE([[X*'[]+ ", `\($foo]])"
540 AC_SUBST([foo])
541 AC_DEFINE([foo], [[X*'[]+ ", `\($foo]], [Awful value.])
542 AC_CONFIG_FILES([Foo])]])
544 AT_CHECK_AUTOCONF
545 AT_CHECK_AUTOHEADER
546 AT_CHECK_CONFIGURE
547 AT_CHECK([cat Foo], 0, [[X*'[]+ ", `\($foo
549 AT_CHECK_DEFINES([[#define foo X*'[]+ ", `\($foo
551 AT_CLEANUP
554 ## ---------------------- ##
555 ## Substitute a newline.  ##
556 ## ---------------------- ##
558 AT_SETUP([Substitute a newline])
560 AT_DATA([Foo.in],
561 [@foo@
564 AT_DATA([configure.ac],
565 [[AC_INIT
566 AC_CONFIG_AUX_DIR($top_srcdir/config)
567 foo='one
568 two'
569 AC_SUBST([foo])
570 AC_CONFIG_FILES([Foo])
571 AC_OUTPUT
574 AT_CHECK_AUTOCONF
575 AT_CHECK_CONFIGURE
576 AT_CHECK([cat Foo], 0, [one
579 AT_CLEANUP
582 ## ------------------ ##
583 ## Define a newline.  ##
584 ## ------------------ ##
586 AT_SETUP([Define a newline])
587 AT_XFAIL_IF(:)
588 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
589 two], [This spans two lines.])
591 AT_CHECK_AUTOCONF
592 AT_CHECK_AUTOHEADER
593 AT_CHECK_CONFIGURE
594 AT_CHECK_DEFINES([[#define foo one
597 AT_CLEANUP
600 ## -------- ##
601 ## srcdir.  ##
602 ## -------- ##
604 AT_SETUP([srcdir])
606 rm -f -r at-dir
607 mkdir at-dir
608 : >at-dir/bar.in
609 : >foo.in
611 AT_DATA([configure.ac],
612 [[AC_INIT
614 AC_CONFIG_FILES([foo at-dir/bar])
616 AC_CONFIG_COMMANDS([report],
617 [test -f $srcdir/configure.ac ||
618    AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
619                    [srcdir=$srcdir])
621 AC_OUTPUT
622 rm -f -r foo at-dir/bar
625 AT_CHECK_AUTOCONF
627 # In place.
628 AT_CHECK([./configure], [], [ignore])
630 # Relative name.
631 AT_CHECK([cd at-dir && ../configure], [], [ignore])
633 # Absolute name.
634 at_here=`pwd`
635 AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
637 AT_CLEANUP
640 ## ----------------- ##
641 ## Signal handling.  ##
642 ## ----------------- ##
644 AT_SETUP([Signal handling])
646 AT_DATA([configure.ac],
647 [[AC_INIT
648 kill -2 $$
649 exit 77
652 AT_CHECK_AUTOCONF
653 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
655 AT_CLEANUP
659 AT_BANNER([autoreconf.])
661 ## ---------------------------- ##
662 ## Configuring subdirectories.  ##
663 ## ---------------------------- ##
665 # .
666 # |-- builddir
667 # |   |-- config.log
668 # |   |-- config.status
669 # |   `-- inner
670 # |       |-- config.log
671 # |       |-- config.status
672 # |       `-- innermost
673 # |           `-- config
674 # |-- configure
675 # |-- configure.ac
676 # |-- inner
677 # |   |-- configure
678 # |   |-- configure.ac
679 # |   `-- innermost
680 # |       `-- config.in
681 # `-- install-sh
683 AT_SETUP([Configuring subdirectories])
684 AT_KEYWORDS(autoreconf)
686 # We use aclocal (via autoreconf).
687 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
688 # It should understand configure.ac.
689 AT_CHECK([[grep '1.[01234]' stdout && exit 77]], [1], [ignore])
691 # The contents of `inner/', and `inner/innermost/'.
692 AS_MKDIR_P([inner/innermost])
694 # We have to use configure.in, not configure.ac, if we still want to
695 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
696 # die because it can't find configure.in.
697 AT_DATA([inner/configure.in],
698 [[AC_INIT(GNU Inner, 1.0)
699 AC_CONFIG_SRCDIR([innermost/config.in])
700 AC_ARG_VAR([INNER], [an inner variable])
701 AC_SUBST([INNER])
702 if test "x$INNER" = x; then
703   INNER=inner
705 AC_CONFIG_FILES([innermost/config])
706 AC_OUTPUT
709 AT_DATA([inner/innermost/config.in],
710 [INNER=@INNER@
711 srcdir=@srcdir@
712 top_srcdir=@top_srcdir@
713 prefix=@prefix@
716 # The contents of `.'
717 AT_DATA([install-sh], [])
719 # nonexistent is allowed not to exist.
720 AT_DATA([configure.in],
721 [[AC_INIT(GNU Outer, 1.0)
722 AC_ARG_VAR([OUTER], [an outer variable])
723 if false; then
724   AC_CONFIG_SUBDIRS([nonexistent])
726 AC_CONFIG_SUBDIRS([inner])
727 AC_OUTPUT
730 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
731 # they trigger warnings from aclocal 1.8, so ignore stderr.
732 AT_CHECK([autoreconf], [], [], [ignore])
733 AT_CHECK([test -f inner/configure])
735 # Running the outer configure recursively should provide the innermost
736 # help strings.
737 AT_CHECK([./configure --help=recursive | grep INNER], 0, [ignore])
739 # Running the outer configure should trigger the inner.
740 AT_CHECK_CONFIGURE
741 AT_CHECK([cat inner/innermost/config], 0,
742 [INNER=inner
743 srcdir=.
744 top_srcdir=..
745 prefix=/usr/local
748 # The same, but from a builddir.
749 AS_MKDIR_P([builddir])
750 AT_CHECK([cd builddir && ../configure], 0, [ignore])
751 AT_CHECK([cat builddir/inner/innermost/config], 0,
752 [INNER=inner
753 srcdir=../../../inner/innermost
754 top_srcdir=../../../inner
755 prefix=/usr/local
758 # Make sure precious variables and command line options are properly
759 # passed, even when there are duplicates.  Run another directory so
760 # that if the user has set config.site to have a config.cache, then
761 # the two runs don't have colliding caches.
762 AS_MKDIR_P([builddir2])
763 AT_CHECK([cd builddir2 && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
764 AT_CHECK([cat builddir2/inner/innermost/config], 0,
765 [INNER=good
766 srcdir=../../../inner/innermost
767 top_srcdir=../../../inner
768 prefix=/good
771 AT_CLEANUP
775 ## -------------- ##
776 ## Deep Package.  ##
777 ## -------------- ##
779 AT_SETUP([Deep Package])
780 AT_KEYWORDS(autoreconf)
782 # We use aclocal (via autoreconf).
783 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
785 # The contents of `.'
786 AT_DATA([install-sh], [])
787 AT_DATA([configure.in],
788 [[AC_INIT(GNU Outer, 1.0)
789 AC_ARG_VAR([OUTER], [an outer variable])
790 AC_CONFIG_SUBDIRS([inner])
791 AC_OUTPUT
794 # The contents of `inner/', and `inner/innermost/'.
795 AS_MKDIR_P([inner/innermost])
797 AT_DATA([inner/configure.in],
798 [[AC_INIT(GNU Inner, 1.0)
799 AC_ARG_VAR([INNER], [an inner variable])
800 AC_CONFIG_SUBDIRS(innermost)
801 AC_OUTPUT
804 AT_DATA([inner/innermost/configure.in],
805 [[AC_INIT(GNU Innermost, 1.0)
806 AC_ARG_VAR([INNERMOST], [an innermost variable])
807 AC_CONFIG_HEADERS(config.h:config.hin)
808 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
809 AC_OUTPUT
812 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
813 AT_CHECK([test -f inner/configure])
814 AT_CHECK([test -f inner/innermost/configure])
815 AT_CHECK([test -f inner/innermost/config.hin])
817 # Running the outer configure recursively should provide the innermost
818 # help strings.
819 AT_CHECK([./configure --help=recursive | grep " INNER "],     0, [ignore])
820 AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
822 # Running the outer configure should trigger the inner.
823 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
824 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
825 [[#define INNERMOST tsomrenni
828 # The same, but from a builddir.
829 AS_MKDIR_P([builddir])
830 AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
831 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
832 [[#define INNERMOST build/tsomrenni
835 AT_CLEANUP
839 ## -------------------------------- ##
840 ## Non-Autoconf AC_CONFIG_SUBDIRS.  ##
841 ## -------------------------------- ##
843 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
844 AT_KEYWORDS([autoreconf])
846 # We use aclocal (via autoreconf).
847 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
849 AT_DATA([install-sh], [])
850 AT_DATA([configure.in],
851 [[AC_INIT(GNU Outer, 1.0)
852 AC_CONFIG_SUBDIRS([inner])
853 AC_OUTPUT
856 AS_MKDIR_P([inner])
858 AT_DATA([inner/configure],
859 [[#! /bin/sh
860 case "$*" in
861     *--help*) echo 'No Autoconf here, folks!' ;;
862     *)        echo got_it >myfile ;;
863 esac
864 exit 0
866 chmod +x inner/configure
868 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
870 # Running the outer configure recursively should provide the innermost
871 # help strings.
872 AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
874 # Running the outer configure should trigger the inner.
875 AT_CHECK([./configure], 0, [ignore])
876 AT_CHECK([test -f inner/myfile], 0)
878 AT_CLEANUP
882 ## ----------------- ##
883 ## Empty directory.  ##
884 ## ----------------- ##
886 AT_SETUP([Empty directory])
887 AT_KEYWORDS([autoreconf])
889 # We use aclocal (via autoreconf).
890 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
892 # The test group directory is not necessarily _empty_, but it does not contain
893 # files meaningful to `autoreconf'.
895 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
897 AT_CLEANUP
901 ## ------------------------------ ##
902 ## Unusual Automake input files.  ##
903 ## ------------------------------ ##
905 # This parallels gnumake.test in Automake.
907 AT_SETUP([Unusual Automake input files])
908 AT_KEYWORDS([autoreconf])
910 # We use aclocal and automake via autoreconf.
911 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
913 AT_DATA([configure.in],
914 [[AC_INIT(GNU foo, 1.0)
915 AM_INIT_AUTOMAKE
916 AC_CONFIG_FILES([HeeHee])
917 AC_OUTPUT
920 AT_DATA([HeeHee.am],
921 [[# Humans do no worse than `GNUmakefile.am'.
922 AUTOMAKE_OPTIONS = foreign
925 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [ignore])
926 AT_CHECK([test -f HeeHee.in])
928 AT_CLEANUP