3 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free
4 # 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], [], [:])
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])
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],
58 [precious='m4_bpatsubst($1, [[']], ['\\''])'; export precious],
60 AT_CHECK_CONFIGURE([--config-cache -q])
61 AT_CHECK([cat file], [], [`$1'
64 # Testing --recheck: 1. have the environment `forget' about 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
76 [precious='$2'; export 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
88 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
95 AT_DATA([configure.ac],
97 AC_ARG_VAR([precious], [this variable costs a lot])
98 echo "precious:$precious"
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])
128 ## ---------------------------------------------- ##
129 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
130 ## ---------------------------------------------- ##
132 AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
134 AT_DATA([configure.ac],
136 rm -f -r header var-header file var-file link var-link command var-command
139 # Be sure to also stress the associated INIT-CMDS.
140 case $what_to_test in
142 AC_CONFIG_HEADERS(header:input);;
144 AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
147 AC_CONFIG_FILES(file:input);;
149 AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
152 AC_CONFIG_COMMANDS(command,
153 [cp input command]);;
155 AC_CONFIG_COMMANDS(var-command,
156 [cp $command_in var-command], [command_in=input]);;
159 AC_CONFIG_LINKS(link:input);;
161 AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
169 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
170 # ------------------------------------------------------------------
171 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
172 # are properly created, with the right content.
173 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
175 m4_define([AT_CHECK_CONFIG_CREATION],
176 [AT_CHECK_CONFIGURE([what_to_test=$1])
177 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
180 AT_CHECK([grep OK $1], [], [OK
183 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
184 # config.status might be stupidly expecting data on stdin, if it's
186 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
187 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
190 AT_CHECK([grep OK var-$1], [], [OK
192 ])# AT_CHECK_CONFIG_CREATION
196 AT_CHECK_CONFIG_CREATION(file)
199 AT_CHECK_CONFIG_CREATION(header)
202 AT_CHECK_CONFIG_CREATION(command)
205 AT_CHECK_CONFIG_CREATION(link)
211 ## ---------------------------------------- ##
212 ## Macro calls in AC_CONFIG_COMMANDS tags. ##
213 ## ---------------------------------------- ##
215 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
217 AT_DATA_M4SUGAR([configure.ac],
219 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
230 ## ------------------- ##
231 ## Missing templates. ##
232 ## ------------------- ##
234 # Check that config.status detects missing input files
235 AT_SETUP([Missing templates])
237 AT_DATA([configure.ac],
239 AC_CONFIG_FILES([nonexistent])
244 AT_CHECK_CONFIGURE([], [1], [],
245 [[config.status: error: cannot find input file: nonexistent.in
247 # Make sure that the output file doesn't exist
248 AT_CHECK([test -f nonexistent], 1)
255 ## ---------------------- ##
256 ## configure invocation. ##
257 ## ---------------------- ##
259 # Check that `configure' and `config.status' honor their interface.
261 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
262 # and verify that (i) `configure' correctly receives the arguments,
263 # (ii) correctly passes them to `config.status', which we check by
264 # running `config.status --recheck', and (iii) correctly passes them
265 # to sub-configure scripts.
267 AT_SETUP([configure invocation])
271 AT_DATA([configure.ac],
273 AC_CONFIG_SUBDIRS([sub])
274 echo "result=$one$enable_two$with_three"
278 AT_DATA([sub/configure.ac],
280 echo "result=$one$enable_two$with_three"
284 echo fake install-sh script >install-sh
291 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
292 sed -n -e 's/^result=//p'], 0,
296 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
300 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
301 sed -n -e 's/^result=//p'], 0,
302 [m4_do(["'$ " ' $ "'$
305 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
313 ## -------------------------------------------- ##
314 ## Check that `#define' templates are honored. ##
315 ## -------------------------------------------- ##
317 # Use various forms of `#define' templates, and make sure there are no
318 # problems when a symbol is prefix of another.
320 AT_SETUP([[#define header templates]])
322 AT_DATA([configure.ac],
324 AC_CONFIG_HEADERS(config.h:config.hin)
326 # I18n of dummy variables: their French translations.
330 AC_DEFINE(fubar, tutu)
332 # Symbols which are prefixes of another.
336 AC_CONFIG_FILES(defs)
338 # Things included in confdefs.h, but which make no sense in
339 # config.h, nor in $DEFS.
340 cat <<\EOF >>confdefs.h
341 /* Hi Mum! Look, I am doing C++! */
343 void exit (int status);
347 # In addition of config.h output a full DEFS
358 AT_DATA([config.hin],
361 # define baz "Archimedes was sinking in his baz"
375 [[/* config.h. Generated from config.hin by configure. */
387 AT_CHECK([cat config.h], 0, expout)
389 # Check the value of DEFS.
391 [[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA
394 # Because we strip trailing spaces in `testsuite' we can't leave one in
395 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
396 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
402 ## ------------------------- ##
403 ## Torturing config.status. ##
404 ## ------------------------- ##
406 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
407 ## big value. This is mostly to check that Autoconf produces portable sed
408 ## scripts in config.status. sed is used to skip the first two lines
409 ## `Generated by...'.
411 # We use m4_for many times.
412 m4_pattern_allow([^m4_for$])
414 AT_SETUP([Torturing config.status])
416 dnl The value used as a big value for AC_DEFINE.
417 dnl Don't use sh active chars here, below it is also used in a sh
419 m4_define([AT_BIG_VALUE],
420 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
422 m4_define([AT_DESCRIPTION],
423 [Define to a long string if your `Autoconf' works properly.])
426 # AT_DUMMY_VAR(NUMBER)
427 # --------------------
428 # Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
429 # so that the check for user name space invasion does not complain
430 # of the new variables defined.
432 # Note that you should not use the name ac_dummy, because it will be
433 # turned into ac_uummy during the construction of config.status. Yes,
434 # this is admittedly a bug, but it would be too hard to fix this.
435 # There is really no point in AC_DEFINE a var named ac_d.*.
436 m4_pattern_allow([^m4_bpatsubst$])
437 m4_define([AT_DUMMY_VAR],
438 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
443 [m4_for([AT_Count], 1, 100, 1,
444 [@AT_DUMMY_VAR(AT_Count)@
450 while test $i != 101; do
451 echo "content of file $i" > file_$i
460 m4_pattern_allow([^m4_(define|defun)$])
461 AT_DATA([configure.ac],
462 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
463 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
464 [[m4_define([AC_DUMMY_VAR],]
465 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
467 [[m4_define([AC_DESCRIPTION],]
468 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
470 [[m4_define([AC_BIG_VALUE],]
471 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
475 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
476 # used in the torture tests.
477 m4_defun([AC_DEFUBST],
478 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
479 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)",
481 AC_SUBST(AC_DUMMY_VAR($1))
487 AC_CONFIG_HEADERS(config.h:config.hin)
488 AC_CONFIG_FILES(dummy)
489 m4_for(AC_Count, 1, 100, 1,
490 [AC_DEFUBST(AC_Count)])
497 # Check both awk and the result of AC_PROG_AWK
498 for awk_arg in FOO= AWK=awk; do
499 AT_CHECK_CONFIGURE([$awk_arg])
501 # Checking that AC_DEFINE worked properly.
503 [/* Define to the address where bug reports for this package should be sent. */
504 #define PACKAGE_BUGREPORT ""
506 /* Define to the full name of this package. */
507 #define PACKAGE_NAME ""
509 /* Define to the full name and version of this package. */
510 #define PACKAGE_STRING ""
512 /* Define to the one symbol short name of this package. */
513 #define PACKAGE_TARNAME ""
515 /* Define to the version of this package. */
516 #define PACKAGE_VERSION ""
517 m4_for(AT_Count, 1, 100, 1,
520 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE"
523 AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
525 # Checking that AC_SUBST worked properly.
527 [m4_for(AT_Count, 1, 100, 1,
529 content of file AT_Count
532 AT_CHECK([cat dummy], 0, expout)
538 ## ------------------------------- ##
539 ## Substitute a 2000-byte string. ##
540 ## ------------------------------- ##
542 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
543 # sed dumps core around 8 KiB. However, POSIX says that sed need not
544 # handle lines longer than 2048 bytes (including the trailing newline).
545 # So we'll just test a 2000-byte value, and for awk, we test a line with
546 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
547 # multi-line values should allow to get around the limitations.
549 AT_SETUP([Substitute a 2000-byte string])
551 AT_DATA([Foo.in], [@foo@
553 AT_DATA([Bar.in], [@bar@
555 AT_DATA([Baz.in], [@baz@
558 AT_DATA([configure.ac],
560 AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
561 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
562 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
563 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
565 baz=$baz$baz$baz$baz$baz
568 AC_CONFIG_FILES([Foo Bar Baz])
573 # Check both awk and the result of AC_PROG_AWK
574 for awk_arg in Foo= AWK=awk; do
575 AT_CHECK_CONFIGURE([$awk_arg])
576 AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
578 AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
581 [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
583 AT_CHECK([cat Baz], 0, [stdout])
588 ## ------------------------------ ##
589 ## Define to a 2000-byte string. ##
590 ## ------------------------------ ##
592 AT_SETUP([Define to a 2000-byte string])
596 AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
602 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
607 ## ------------------------------------------ ##
608 ## Substitute and define special characters. ##
609 ## ------------------------------------------ ##
611 # Use characters special to the shell, sed, awk, and M4.
613 AT_SETUP([Substitute and define special characters])
615 AT_DATA([Foo.in], [@foo@
616 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
633 AT_DATA([Zardoz.in], [@zardoz@
637 [[foo="AS@&t@_ESCAPE([[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
640 ( for i in 0 1 2 3; do
641 for j in 0 1 2 3 4 5 6 7; do
642 for k in 0 1 2 3 4 5 6 7; do
645 *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
652 zardoz=`cat allowed-chars`
658 AC_SUBST_FILE([file])
659 AC_DEFINE([foo], [[X*'[]+ ",& &`\($foo !]], [Awful value.])
661 AC_CONFIG_FILES([Foo Zardoz])]])
665 # Check both awk and the result of AC_PROG_AWK
666 for awk_arg in FOO= AWK=awk; do
667 AT_CHECK_CONFIGURE([$awk_arg])
668 AT_CHECK([cat Foo], 0, [[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
669 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
670 abc@foo@ @baz@baz@baz
672 abc@foo@ @baz@blabaz@
681 AT_CHECK([cmp allowed-chars Zardoz])
682 AT_CHECK_DEFINES([[#define foo X*'[]+ ",& &`\($foo !
688 ## ---------------------- ##
689 ## Substitute a newline. ##
690 ## ---------------------- ##
692 AT_SETUP([Substitute a newline])
699 AT_DATA([configure.ac],
701 AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
708 AC_CONFIG_FILES([Foo])
719 # Check both awk and the result of AC_PROG_AWK
720 for awk_arg in FOO= AWK=awk; do
721 AT_CHECK_CONFIGURE([$awk_arg])
722 AT_CHECK([cat Foo], 0, [expout])
727 ## ------------------ ##
728 ## Define a newline. ##
729 ## ------------------ ##
731 AT_SETUP([Define a newline])
733 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
734 two], [This spans two lines.])
739 AT_CHECK_DEFINES([[#define foo one
745 ## ------------------------------------ ##
746 ## AC_SUBST: variable name validation. ##
747 ## ------------------------------------ ##
749 AT_SETUP([AC_SUBST: variable name validation])
751 AT_CONFIGURE_AC([[AC_SUBST(, [])
752 AC_CONFIG_FILES([Makefile])
754 AT_DATA([Makefile.in], [[
756 mv -f configure.ac configure.tmpl
759 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
760 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
761 AT_CHECK_AUTOCONF([], [1], [], [ignore])
765 for var in ab a4 'a@@&t@\&t@b'; do
766 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
775 ## ------------------------ ##
776 ## datarootdir workaround. ##
777 ## ------------------------ ##
779 AT_SETUP([datarootdir workaround])
793 AT_DATA([configure.ac],
795 d@&t@nl The following line silences the warnings, if uncommented:
796 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
797 AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
799 # This substitution is wrong and bogus! Don't use it in your own code!
800 # Read `info Autoconf "Defining Directories"'!
801 AC_SUBST([mydatadir], [${datadir}/my])
803 AC_CONFIG_FILES([Foo Bar])
808 AT_CHECK_CONFIGURE([], [], [],
809 [config.status: WARNING: Foo.in seems to ignore the --datarootdir setting
810 config.status: WARNING: Bar contains a reference to the variable `datarootdir'
811 which seems to be undefined. Please make sure it is defined.
813 AT_CHECK([grep datarootdir Foo], 1, [])
816 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
836 AT_DATA([configure.ac],
839 AC_CONFIG_FILES([foo at-dir/bar])
841 AC_CONFIG_COMMANDS([report],
842 [test -f $srcdir/configure.ac ||
843 AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
847 rm -f -r foo at-dir/bar
853 AT_CHECK([./configure], [], [ignore])
856 AT_CHECK([cd at-dir && ../configure], [], [ignore])
860 AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
865 ## ----------------- ##
866 ## Signal handling. ##
867 ## ----------------- ##
869 AT_SETUP([Signal handling])
871 AT_DATA([configure.ac],
878 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
884 AT_BANNER([autoreconf.])
886 ## ---------------------------- ##
887 ## Configuring subdirectories. ##
888 ## ---------------------------- ##
893 # | |-- config.status
896 # | |-- config.status
908 AT_SETUP([Configuring subdirectories])
909 AT_KEYWORDS(autoreconf)
911 # We use aclocal (via autoreconf).
912 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
913 # It should understand configure.ac.
914 AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
916 # Set CONFIG_SITE to a nonexistent file, so that there are
917 # no worries about nonstandard values for 'prefix'.
918 CONFIG_SITE=no-such-file
921 # The contents of `inner/', and `inner/innermost/'.
922 AS_MKDIR_P([inner/innermost])
924 # We have to use configure.in, not configure.ac, if we still want to
925 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
926 # die because it can't find configure.in.
927 AT_DATA([inner/configure.in],
928 [[AC_INIT(GNU Inner, 1.0)
929 AC_CONFIG_SRCDIR([innermost/config.in])
930 AC_ARG_VAR([INNER], [an inner variable])
932 if test "x$INNER" = x; then
935 AC_CONFIG_FILES([innermost/config])
939 AT_DATA([inner/innermost/config.in],
942 top_srcdir=@top_srcdir@
946 # The contents of `.'
947 AT_DATA([install-sh], [])
949 # nonexistent is allowed not to exist.
950 AT_DATA([configure.in],
951 [[AC_INIT(GNU Outer, 1.0)
952 AC_ARG_VAR([OUTER], [an outer variable])
954 AC_CONFIG_SUBDIRS([nonexistent])
956 AC_CONFIG_SUBDIRS([inner])
960 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
961 # they trigger warnings from aclocal 1.8, so ignore stderr.
962 AT_CHECK([autoreconf], [], [], [ignore])
963 AT_CHECK([test -f inner/configure])
965 # Running the outer configure recursively should provide the innermost
967 AT_CHECK([./configure --help=recursive | grep INNER], 0, [ignore])
969 # Running the outer configure should trigger the inner.
971 AT_CHECK([cat inner/innermost/config], 0,
978 # The same, but from a builddir.
979 AS_MKDIR_P([builddir])
980 AT_CHECK([cd builddir && ../configure], 0, [ignore])
981 AT_CHECK([cat builddir/inner/innermost/config], 0,
983 srcdir=../../../inner/innermost
984 top_srcdir=../../../inner
988 # Make sure precious variables and command line options are properly
989 # passed, even when there are duplicates.
990 AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
991 AT_CHECK([cat builddir/inner/innermost/config], 0,
993 srcdir=../../../inner/innermost
994 top_srcdir=../../../inner
998 # Make sure --prefix is properly quoted
999 AT_CHECK([cd builddir && ../configure --prefix "/a b c$ 'd"], 0, [ignore])
1000 AT_CHECK([cat builddir/inner/innermost/config], 0,
1002 srcdir=../../../inner/innermost
1003 top_srcdir=../../../inner
1007 # Make sure --silent is properly passed...
1008 AT_CHECK([cd builddir && ../configure --silent], 0, [])
1009 # ...but not stored in config.status.
1010 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1011 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1013 # Make sure we can run autoreconf on a subdirectory
1014 rm -f configure configure.in
1015 AT_CHECK([autoreconf inner], [], [], [ignore])
1017 # Make sure we can pass a configure.ac name
1018 AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
1019 AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
1025 ## -------------- ##
1027 ## -------------- ##
1029 AT_SETUP([Deep Package])
1030 AT_KEYWORDS(autoreconf)
1032 # We use aclocal (via autoreconf).
1033 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1035 # The contents of `.'
1036 AT_DATA([install-sh], [])
1037 AT_DATA([configure.in],
1038 [[AC_INIT(GNU Outer, 1.0)
1039 AC_ARG_VAR([OUTER], [an outer variable])
1040 AC_CONFIG_SUBDIRS([inner])
1044 # The contents of `inner/', and `inner/innermost/'.
1045 AS_MKDIR_P([inner/innermost])
1047 AT_DATA([inner/configure.in],
1048 [[AC_INIT(GNU Inner, 1.0)
1049 AC_ARG_VAR([INNER], [an inner variable])
1050 AC_CONFIG_SUBDIRS(innermost)
1054 AT_DATA([inner/innermost/configure.in],
1055 [[AC_INIT(GNU Innermost, 1.0)
1056 AC_ARG_VAR([INNERMOST], [an innermost variable])
1057 AC_CONFIG_HEADERS(config.h:config.hin)
1058 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1062 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
1063 AT_CHECK([test -f inner/configure])
1064 AT_CHECK([test -f inner/innermost/configure])
1065 AT_CHECK([test -f inner/innermost/config.hin])
1067 # Running the outer configure recursively should provide the innermost
1069 AT_CHECK([./configure --help=recursive | grep " INNER "], 0, [ignore])
1070 AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
1072 # Running the outer configure should trigger the inner.
1073 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1074 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1075 [[#define INNERMOST tsomrenni
1078 # The same, but from a builddir.
1079 AS_MKDIR_P([builddir])
1080 AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
1081 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1082 [[#define INNERMOST build/tsomrenni
1089 ## -------------------------------- ##
1090 ## Non-Autoconf AC_CONFIG_SUBDIRS. ##
1091 ## -------------------------------- ##
1093 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1094 AT_KEYWORDS([autoreconf])
1096 # We use aclocal (via autoreconf).
1097 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1099 AT_DATA([install-sh], [])
1100 AT_DATA([configure.in],
1101 [[AC_INIT(GNU Outer, 1.0)
1102 AC_CONFIG_SUBDIRS([inner])
1108 AT_DATA([inner/configure],
1111 *--help*) echo 'No Autoconf here, folks!' ;;
1112 *) echo got_it >myfile ;;
1116 chmod +x inner/configure
1118 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
1120 # Running the outer configure recursively should provide the innermost
1122 AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
1124 # Running the outer configure should trigger the inner.
1125 AT_CHECK([./configure], 0, [ignore])
1126 AT_CHECK([test -f inner/myfile], 0)
1132 ## ----------------- ##
1133 ## Empty directory. ##
1134 ## ----------------- ##
1136 AT_SETUP([Empty directory])
1137 AT_KEYWORDS([autoreconf])
1139 # We use aclocal (via autoreconf).
1140 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1142 # The test group directory is not necessarily _empty_, but it does not contain
1143 # files meaningful to `autoreconf'.
1145 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1151 ## ------------------------------ ##
1152 ## Unusual Automake input files. ##
1153 ## ------------------------------ ##
1155 # This parallels gnumake.test in Automake.
1157 AT_SETUP([Unusual Automake input files])
1158 AT_KEYWORDS([autoreconf])
1160 # We use aclocal and automake via autoreconf.
1161 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1163 AT_DATA([configure.in],
1164 [[AC_INIT(GNU foo, 1.0)
1166 AC_CONFIG_FILES([HeeHee])
1170 AT_DATA([HeeHee.am],
1171 [[# Humans do no worse than `GNUmakefile.am'.
1172 AUTOMAKE_OPTIONS = foreign 1.8
1175 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1176 [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1177 AT_CHECK([test -f HeeHee.in])