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])
122 dnl restore font-lock: "
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],
137 rm -f -r header var-header file var-file link var-link command var-command
140 # Be sure to also stress the associated INIT-CMDS.
141 case $what_to_test in
143 AC_CONFIG_HEADERS(header:input);;
145 AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
148 AC_CONFIG_FILES(file:input);;
150 AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
153 AC_CONFIG_COMMANDS(command,
154 [cp input command]);;
156 AC_CONFIG_COMMANDS(var-command,
157 [cp $command_in var-command], [command_in=input]);;
160 AC_CONFIG_LINKS(link:input);;
162 AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
170 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
171 # ------------------------------------------------------------------
172 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
173 # are properly created, with the right content.
174 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
176 m4_define([AT_CHECK_CONFIG_CREATION],
177 [AT_CHECK_CONFIGURE([what_to_test=$1])
178 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
181 AT_CHECK([grep OK $1], [], [OK
184 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
185 # config.status might be stupidly expecting data on stdin, if it's
187 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
188 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
191 AT_CHECK([grep OK var-$1], [], [OK
193 ])# AT_CHECK_CONFIG_CREATION
197 AT_CHECK_CONFIG_CREATION(file)
200 AT_CHECK_CONFIG_CREATION(header)
203 AT_CHECK_CONFIG_CREATION(command)
206 AT_CHECK_CONFIG_CREATION(link)
212 ## ---------------------------------------- ##
213 ## Macro calls in AC_CONFIG_COMMANDS tags. ##
214 ## ---------------------------------------- ##
216 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
218 AT_DATA_M4SUGAR([configure.ac],
220 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
231 ## ------------------- ##
232 ## Missing templates. ##
233 ## ------------------- ##
235 # Check that config.status detects missing input files
236 AT_SETUP([Missing templates])
238 AT_DATA([configure.ac],
240 AC_CONFIG_FILES([nonexistent])
245 AT_CHECK_CONFIGURE([], [1], [],
246 [[config.status: error: cannot find input file: nonexistent.in
248 # Make sure that the output file doesn't exist
249 AT_CHECK([test -f nonexistent], 1)
256 ## ---------------------- ##
257 ## configure invocation. ##
258 ## ---------------------- ##
260 # Check that `configure' and `config.status' honor their interface.
262 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
263 # and verify that (i) `configure' correctly receives the arguments,
264 # (ii) correctly passes them to `config.status', which we check by
265 # running `config.status --recheck', and (iii) correctly passes them
266 # to sub-configure scripts.
268 AT_SETUP([configure invocation])
272 AT_DATA([configure.ac],
274 AC_CONFIG_SUBDIRS([sub])
275 echo "result=$one$enable_two$with_three"
279 AT_DATA([sub/configure.ac],
281 echo "result=$one$enable_two$with_three"
285 echo fake install-sh script >install-sh
292 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
293 sed -n -e 's/^result=//p'], 0,
297 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
301 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
302 sed -n -e 's/^result=//p'], 0,
303 [m4_do(["'$ " ' $ "'$
306 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
309 dnl restore font-lock: "
315 ## -------------------------------------------- ##
316 ## Check that `#define' templates are honored. ##
317 ## -------------------------------------------- ##
319 # Use various forms of `#define' templates, and make sure there are no
320 # problems when a symbol is prefix of another.
322 AT_SETUP([@%:@define header templates])
324 AT_DATA([configure.ac],
326 AC_CONFIG_HEADERS(config.h:config.hin)
328 # I18n of dummy variables: their French translations.
332 AC_DEFINE(fubar, tutu)
334 # Symbols which are prefixes of another.
339 # backslash-newline combinations
340 AC_DEFINE([multiline], [line1\
344 AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
346 AC_CONFIG_FILES(defs)
348 # Things included in confdefs.h, but which make no sense in
349 # config.h, nor in $DEFS.
350 cat <<\EOF >>confdefs.h
351 /* Hi Mum! Look, I am doing C++! */
353 void exit (int status);
357 # In addition of config.h output a full DEFS
368 AT_DATA([config.hin],
371 # define baz "Archimedes was sinking in his baz"
379 #define aaa(a, aa) aa a
381 #define aaac(a, aa) aa a
383 # undef multiline_args
385 #define str(define) \
387 #define stringify(arg) str(arg)
394 [[/* config.h. Generated from config.hin by configure. */
407 #define aaac(a, aa) aa a
408 #define multiline line1\
412 # define multiline_args(ARG1, ARG2) ARG2 \
415 #define str(define) \
417 #define stringify(arg) str(arg)
419 AT_CHECK([cat config.h], 0, expout)
421 # Check the value of DEFS.
423 [[-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
426 # Because we strip trailing spaces in `testsuite' we can't leave one in
427 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
428 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
434 ## ------------------------- ##
435 ## Torturing config.status. ##
436 ## ------------------------- ##
438 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
439 ## big value. This is mostly to check that Autoconf produces portable sed
440 ## scripts in config.status. sed is used to skip the first two lines
441 ## `Generated by...'.
443 # We use m4_for many times.
444 m4_pattern_allow([^m4_for$])
446 AT_SETUP([Torturing config.status])
448 dnl The value used as a big value for AC_DEFINE.
449 dnl Don't use sh active chars here, below it is also used in a sh
451 m4_define([AT_BIG_VALUE],
452 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
454 m4_define([AT_DESCRIPTION],
455 [Define to a long string if your `Autoconf' works properly.])
458 # AT_DUMMY_VAR(NUMBER)
459 # --------------------
460 # Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
461 # so that the check for user name space invasion does not complain
462 # of the new variables defined.
464 # Note that you should not use the name ac_dummy, because it will be
465 # turned into ac_uummy during the construction of config.status. Yes,
466 # this is admittedly a bug, but it would be too hard to fix this.
467 # There is really no point in AC_DEFINE a var named ac_d.*.
468 m4_pattern_allow([^m4_bpatsubst$])
469 m4_define([AT_DUMMY_VAR],
470 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
475 [m4_for([AT_Count], 1, 100, 1,
476 [@AT_DUMMY_VAR(AT_Count)@
482 while test $i != 101; do
483 echo "content of file $i" > file_$i
492 m4_pattern_allow([^m4_(define|defun)$])
493 AT_DATA([configure.ac],
494 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
495 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
496 [[m4_define([AC_DUMMY_VAR],]
497 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
499 [[m4_define([AC_DESCRIPTION],]
500 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
502 [[m4_define([AC_BIG_VALUE],]
503 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
507 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
508 # used in the torture tests.
509 m4_defun([AC_DEFUBST],
510 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
511 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
513 AC_SUBST(AC_DUMMY_VAR($1))
519 AC_CONFIG_HEADERS(config.h:config.hin)
520 AC_CONFIG_FILES(dummy)
521 m4_for(AC_Count, 1, 100, 1,
522 [AC_DEFUBST(AC_Count)])
529 # Check both awk and the result of AC_PROG_AWK
530 for awk_arg in FOO= AWK=awk; do
531 AT_CHECK_CONFIGURE([$awk_arg])
533 # Checking that AC_DEFINE worked properly.
535 [/* Define to the address where bug reports for this package should be sent. */
536 #define PACKAGE_BUGREPORT ""
538 /* Define to the full name of this package. */
539 #define PACKAGE_NAME ""
541 /* Define to the full name and version of this package. */
542 #define PACKAGE_STRING ""
544 /* Define to the one symbol short name of this package. */
545 #define PACKAGE_TARNAME ""
547 /* Define to the version of this package. */
548 #define PACKAGE_VERSION ""
549 m4_for(AT_Count, 1, 100, 1,
552 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
555 AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
557 # Checking that AC_SUBST worked properly.
559 [m4_for(AT_Count, 1, 100, 1,
561 content of file AT_Count
564 AT_CHECK([cat dummy], 0, expout)
570 ## ------------------------------- ##
571 ## Substitute a 2000-byte string. ##
572 ## ------------------------------- ##
574 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
575 # sed dumps core around 8 KiB. However, POSIX says that sed need not
576 # handle lines longer than 2048 bytes (including the trailing newline).
577 # So we'll just test a 2000-byte value, and for awk, we test a line with
578 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
579 # multi-line values should allow to get around the limitations.
581 AT_SETUP([Substitute a 2000-byte string])
583 AT_DATA([Foo.in], [@foo@
585 AT_DATA([Bar.in], [@bar@
587 AT_DATA([Baz.in], [@baz@
590 AT_DATA([configure.ac],
592 AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
593 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
594 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
595 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
597 baz=$baz$baz$baz$baz$baz
600 AC_CONFIG_FILES([Foo Bar Baz])
605 # Check both awk and the result of AC_PROG_AWK
606 for awk_arg in Foo= AWK=awk; do
607 AT_CHECK_CONFIGURE([$awk_arg])
608 AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
610 AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
613 [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
615 AT_CHECK([cat Baz], 0, [stdout])
620 ## ------------------------------ ##
621 ## Define to a 2000-byte string. ##
622 ## ------------------------------ ##
624 AT_SETUP([Define to a 2000-byte string])
628 AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
634 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
639 ## ------------------------------------------ ##
640 ## Substitute and define special characters. ##
641 ## ------------------------------------------ ##
643 # Use characters special to the shell, sed, awk, and M4.
645 AT_SETUP([Substitute and define special characters])
647 AT_DATA([Foo.in], [@foo@
648 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
665 AT_DATA([Zardoz.in], [@zardoz@
669 [[foo="AS@&t@_ESCAPE([[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
672 ( for i in 0 1 2 3; do
673 for j in 0 1 2 3 4 5 6 7; do
674 for k in 0 1 2 3 4 5 6 7; do
677 *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
684 zardoz=`cat allowed-chars`
690 AC_SUBST_FILE([file])
691 AC_DEFINE([foo], [[X*'[]+ ",& &`\($foo !]], [Awful value.])
692 AC_DEFINE([bar], [[%!_!# X]], [Value that is used as special delimiter.])
694 AC_CONFIG_FILES([Foo Zardoz])]])
698 # Check both awk and the result of AC_PROG_AWK
699 for awk_arg in FOO= AWK=awk; do
700 AT_CHECK_CONFIGURE([$awk_arg])
701 AT_CHECK([cat Foo], 0, [[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
702 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
703 abc@foo@ @baz@baz@baz
705 abc@foo@ @baz@blabaz@
714 AT_CHECK([cmp allowed-chars Zardoz])
715 AT_CHECK_DEFINES([[#define bar %!_!# X
716 #define foo X*'[]+ ",& &`\($foo !
722 ## ---------------------- ##
723 ## Substitute a newline. ##
724 ## ---------------------- ##
726 AT_SETUP([Substitute a newline])
733 AT_DATA([configure.ac],
735 AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
742 AC_CONFIG_FILES([Foo])
753 # Check both awk and the result of AC_PROG_AWK
754 for awk_arg in FOO= AWK=awk; do
755 AT_CHECK_CONFIGURE([$awk_arg])
756 AT_CHECK([cat Foo], 0, [expout])
761 ## ------------------ ##
762 ## Define a newline. ##
763 ## ------------------ ##
765 AT_SETUP([Define a newline])
766 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
767 two], [This spans two lines.])
769 AT_CHECK_AUTOCONF([], [], [], [stderr])
770 dnl Older versions of m4 report error at line 6 (end of macro);
771 dnl newer versions report it at line 5 (start of macro).
772 AT_CHECK([[sed 's/^configure.ac:[56]: //' stderr]], [],
773 [[warning: AC_DEFINE: `one
774 two' is not a valid preprocessor define value
776 AT_CHECK_AUTOHEADER([], [], [], [stderr])
777 AT_CHECK([[sed 's/^configure.ac:[56]: //' stderr]], [],
778 [[warning: AC_DEFINE: `one
779 two' is not a valid preprocessor define value
782 AT_CHECK_DEFINES([[#define foo one
785 AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
786 two], [This spans two lines.])
788 AT_CHECK_AUTOCONF([], [], [], [stderr])
789 AT_CHECK([[sed 's/^configure.ac:[56]: //' stderr]], [],
790 [[warning: AC_DEFINE_UNQUOTED: `one
791 two' is not a valid preprocessor define value
793 AT_CHECK_AUTOHEADER([], [], [], [stderr])
794 AT_CHECK([[sed 's/^configure.ac:[56]: //' stderr]], [],
795 [[warning: AC_DEFINE_UNQUOTED: `one
796 two' is not a valid preprocessor define value
799 AT_CHECK_DEFINES([[#define foo one
805 ## ------------------------------------ ##
806 ## AC_SUBST: variable name validation. ##
807 ## ------------------------------------ ##
809 AT_SETUP([AC_SUBST: variable name validation])
811 AT_CONFIGURE_AC([[AC_SUBST(, [])
812 AC_CONFIG_FILES([Makefile])
814 AT_DATA([Makefile.in], [[
816 mv -f configure.ac configure.tmpl
819 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
820 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
821 AT_CHECK_AUTOCONF([], [1], [], [ignore])
825 for var in ab a4 'a@@&t@\&t@b'; do
826 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
835 ## ------------------------ ##
836 ## datarootdir workaround. ##
837 ## ------------------------ ##
839 AT_SETUP([datarootdir workaround])
853 AT_DATA([configure.ac],
855 d@&t@nl The following line silences the warnings, if uncommented:
856 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
857 AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
859 # This substitution is wrong and bogus! Don't use it in your own code!
860 # Read `info Autoconf "Defining Directories"'!
861 AC_SUBST([mydatadir], [${datadir}/my])
863 AC_CONFIG_FILES([Foo Bar])
868 AT_CHECK_CONFIGURE([], [], [],
869 [config.status: WARNING: Foo.in seems to ignore the --datarootdir setting
870 config.status: WARNING: Bar contains a reference to the variable `datarootdir'
871 which seems to be undefined. Please make sure it is defined.
873 AT_CHECK([grep datarootdir Foo], 1, [])
876 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
896 AT_DATA([configure.ac],
899 AC_CONFIG_FILES([foo at-dir/bar])
901 AC_CONFIG_COMMANDS([report],
902 [test -f $srcdir/configure.ac ||
903 AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
907 rm -f -r foo at-dir/bar
913 AT_CHECK([./configure], [], [ignore])
916 AT_CHECK([cd at-dir && ../configure], [], [ignore])
920 AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
925 ## ----------------- ##
926 ## Signal handling. ##
927 ## ----------------- ##
929 AT_SETUP([Signal handling])
931 AT_DATA([configure.ac],
938 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
943 ## ------------------------------------- ##
944 ## AC_CONFIG_LINKS and identical files. ##
945 ## ------------------------------------- ##
946 AT_SETUP([AC_CONFIG_LINKS and identical files])
948 AT_DATA([configure.ac],
950 AC_CONFIG_LINKS([src/s:src/s])
951 test "$srcdir" != '.' && AC_CONFIG_LINKS([src/t:src/t])
960 AT_CHECK([../configure && ../configure], 0, [ignore])
961 AT_CHECK([cat src/s src/t], 0, [file1
965 AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
966 AT_CHECK([grep src/t stderr], 1)
967 AT_CHECK([cat src/s src/t], 0, [file1
970 AT_CHECK(["`pwd`"/configure && "`pwd`"/configure], 0, [ignore], [ignore])
971 AT_CHECK([cat src/s src/t], 0, [file1
978 AT_BANNER([autoreconf.])
980 ## ---------------------------- ##
981 ## Configuring subdirectories. ##
982 ## ---------------------------- ##
987 # | |-- config.status
990 # | |-- config.status
1002 AT_SETUP([Configuring subdirectories])
1003 AT_KEYWORDS(autoreconf)
1005 # We use aclocal (via autoreconf).
1006 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
1007 # It should understand configure.ac.
1008 AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
1010 # Set CONFIG_SITE to a nonexistent file, so that there are
1011 # no worries about nonstandard values for 'prefix'.
1012 CONFIG_SITE=no-such-file
1015 # The contents of `inner/', and `inner/innermost/'.
1016 AS_MKDIR_P([inner/innermost])
1018 # We have to use configure.in, not configure.ac, if we still want to
1019 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
1020 # die because it can't find configure.in.
1021 AT_DATA([inner/configure.in],
1022 [[AC_INIT(GNU Inner, 1.0)
1023 AC_CONFIG_SRCDIR([innermost/config.in])
1024 AC_ARG_VAR([INNER], [an inner variable])
1026 if test "x$INNER" = x; then
1029 AC_CONFIG_FILES([innermost/config])
1033 AT_DATA([inner/innermost/config.in],
1036 top_srcdir=@top_srcdir@
1040 # The contents of `.'
1041 AT_DATA([install-sh], [])
1043 # nonexistent is allowed not to exist.
1044 AT_DATA([configure.in],
1045 [[AC_INIT(GNU Outer, 1.0)
1046 AC_ARG_VAR([OUTER], [an outer variable])
1048 AC_CONFIG_SUBDIRS([nonexistent])
1050 AC_CONFIG_SUBDIRS([inner])
1054 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
1055 # they trigger warnings from aclocal 1.8, so ignore stderr.
1056 AT_CHECK([autoreconf], [], [], [ignore])
1057 AT_CHECK([test -f inner/configure])
1059 # Running the outer configure recursively should provide the innermost
1061 chmod a-w inner/innermost inner .
1062 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep INNER], 0,
1064 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1065 chmod u+w . inner inner/innermost
1067 # Running the outer configure should trigger the inner.
1069 AT_CHECK([cat inner/innermost/config], 0,
1076 # The same, but from a builddir.
1077 AS_MKDIR_P([builddir])
1078 AT_CHECK([cd builddir && ../configure], 0, [ignore])
1079 AT_CHECK([cat builddir/inner/innermost/config], 0,
1081 srcdir=../../../inner/innermost
1082 top_srcdir=../../../inner
1086 # Make sure precious variables and command line options are properly
1087 # passed, even when there are duplicates.
1088 AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
1089 AT_CHECK([cat builddir/inner/innermost/config], 0,
1091 srcdir=../../../inner/innermost
1092 top_srcdir=../../../inner
1096 # Make sure --prefix is properly quoted
1097 AT_CHECK([cd builddir && ../configure --prefix "/a b c$ 'd"], 0, [ignore])
1098 AT_CHECK([cat builddir/inner/innermost/config], 0,
1100 srcdir=../../../inner/innermost
1101 top_srcdir=../../../inner
1105 # Make sure --silent is properly passed...
1106 AT_CHECK([cd builddir && ../configure --silent], 0, [])
1107 # ...but not stored in config.status.
1108 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1109 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1111 # Make sure we can run autoreconf on a subdirectory
1112 rm -f configure configure.in
1113 AT_CHECK([autoreconf inner], [], [], [ignore])
1115 # Make sure we can pass a configure.ac name
1116 AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
1117 AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
1123 ## -------------- ##
1125 ## -------------- ##
1127 AT_SETUP([Deep Package])
1128 AT_KEYWORDS(autoreconf)
1130 # We use aclocal (via autoreconf).
1131 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1133 # The contents of `.'
1134 AT_DATA([install-sh], [])
1135 AT_DATA([configure.in],
1136 [[AC_INIT(GNU Outer, 1.0)
1137 AC_ARG_VAR([OUTER], [an outer variable])
1138 AC_CONFIG_SUBDIRS([inner])
1142 # The contents of `inner/', and `inner/innermost/'.
1143 AS_MKDIR_P([inner/innermost])
1145 AT_DATA([inner/configure.in],
1146 [[AC_INIT(GNU Inner, 1.0)
1147 AC_ARG_VAR([INNER], [an inner variable])
1148 AC_CONFIG_SUBDIRS(innermost)
1152 AT_DATA([inner/innermost/configure.in],
1153 [[AC_INIT(GNU Innermost, 1.0)
1154 AC_ARG_VAR([INNERMOST], [an innermost variable])
1155 AC_CONFIG_HEADERS(config.h:config.hin)
1156 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1160 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
1161 AT_CHECK([test -f inner/configure])
1162 AT_CHECK([test -f inner/innermost/configure])
1163 AT_CHECK([test -f inner/innermost/config.hin])
1165 # Running the outer configure recursively should provide the innermost
1167 chmod a-w inner/innermost inner
1168 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER "],
1169 0, [ignore], [stderr],
1170 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1172 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1173 0, [ignore], [stderr],
1174 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1176 AT_CHECK([{ /bin/sh ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1177 0, [ignore], [stderr],
1178 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1180 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure --help=recursive; chmod +w .; } | grep " INNERMOST "],
1181 0, [ignore], [stderr],
1182 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1184 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1185 0, [ignore], [stderr],
1186 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1187 chmod u+w inner inner/innermost
1189 # Running the outer configure should trigger the inner.
1190 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1191 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1192 [[#define INNERMOST tsomrenni
1195 # The same, but from a builddir.
1196 AS_MKDIR_P([builddir])
1197 chmod a-w builddir inner/innermost inner
1198 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNER "],
1199 0, [ignore], [stderr],
1200 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1202 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1203 0, [ignore], [stderr],
1204 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1206 AT_CHECK([cd builddir && { /bin/sh ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1207 0, [ignore], [stderr],
1208 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1210 # Not all shells search $PATH for scripts.
1211 if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help) >/dev/null 2>&1; then
1212 AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help=recursive | grep " INNERMOST "], 0, [ignore])
1214 AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1215 0, [ignore], [stderr],
1216 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1217 chmod u+w builddir inner inner/innermost
1218 AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
1219 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1220 [[#define INNERMOST build/tsomrenni
1227 ## -------------------------------- ##
1228 ## Non-Autoconf AC_CONFIG_SUBDIRS. ##
1229 ## -------------------------------- ##
1231 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1232 AT_KEYWORDS([autoreconf])
1234 # We use aclocal (via autoreconf).
1235 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1237 AT_DATA([install-sh], [])
1238 AT_DATA([configure.in],
1239 [[AC_INIT(GNU Outer, 1.0)
1240 AC_CONFIG_SUBDIRS([inner])
1246 AT_DATA([inner/configure],
1249 *--help*) echo 'No Autoconf here, folks!' ;;
1250 *) echo got_it >myfile ;;
1254 chmod +x inner/configure
1256 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
1258 # Running the outer configure recursively should provide the innermost
1260 AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
1262 # Running the outer configure should trigger the inner.
1263 AT_CHECK([./configure], 0, [ignore])
1264 AT_CHECK([test -f inner/myfile], 0)
1270 ## ----------------- ##
1271 ## Empty directory. ##
1272 ## ----------------- ##
1274 AT_SETUP([Empty directory])
1275 AT_KEYWORDS([autoreconf])
1277 # We use aclocal (via autoreconf).
1278 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1280 # The test group directory is not necessarily _empty_, but it does not contain
1281 # files meaningful to `autoreconf'.
1283 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1289 ## ------------------------------ ##
1290 ## Unusual Automake input files. ##
1291 ## ------------------------------ ##
1293 # This parallels gnumake.test in Automake.
1295 AT_SETUP([Unusual Automake input files])
1296 AT_KEYWORDS([autoreconf])
1298 # We use aclocal and automake via autoreconf.
1299 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1301 AT_DATA([configure.in],
1302 [[AC_INIT(GNU foo, 1.0)
1304 AC_CONFIG_FILES([HeeHee])
1308 AT_DATA([HeeHee.am],
1309 [[# Humans do no worse than `GNUmakefile.am'.
1310 AUTOMAKE_OPTIONS = foreign 1.8
1313 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1314 [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1315 AT_CHECK([test -f HeeHee.in])
1319 ## --------------------- ##
1320 ## Unbootstrap (--clean) ##
1321 ## --------------------- ##
1323 AT_SETUP([Unbootstrap with --clean])
1324 AT_KEYWORDS([autoreconf])
1326 # We use aclocal (via autoreconf).
1327 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1328 # We need a version of aclocal that is recent enough to support --clean
1329 AT_CHECK([aclocal --help | grep ' --clean' || exit 77], [], [ignore], [ignore])
1331 AT_DATA([configure.ac],
1333 AC_CONFIG_HEADERS(config.h:config.hin)
1338 AT_DATA([config.hin], [])
1340 # Save the result of `find' to see whether we properly cleaned everything.
1341 AT_DATA([list.after], [])
1342 AT_DATA([list.before], [])
1344 # Save the list of files in the current directory.
1345 find . | sort >list.before
1347 AT_CHECK([autoreconf], [0], [ignore], [ignore])
1349 AT_CHECK([autoreconf --clean], [0], [ignore], [ignore])
1350 find . | sort >list.after
1351 AT_CMP([list.before], [list.after])