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
196 # AT_CHECK_CONFIG_CREATION_NOWRITE(THING = (header | link | file | command))
197 # ------------------------------------------------------------------
198 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
199 # are properly created, with the right content.
200 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
202 m4_define([AT_CHECK_CONFIG_CREATION_NOWRITE],
203 [AT_CHECK_CONFIGURE([what_to_test=$1])
204 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
207 AT_CHECK([grep OK $1], [], [OK
210 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
211 # config.status might be stupidly expecting data on stdin, if it's
214 AT_CHECK([./config.status var-$1 </dev/null], [1], [ignore], [ignore])
216 ])# AT_CHECK_CONFIG_CREATION_NOWRITE
220 AT_CHECK_CONFIG_CREATION(file)
223 AT_CHECK_CONFIG_CREATION(header)
226 AT_CHECK_CONFIG_CREATION(command)
229 AT_CHECK_CONFIG_CREATION(link)
231 # Now check for write errors
234 AT_CHECK_CONFIG_CREATION_NOWRITE(file)
235 # Create a file with bits from stdin
236 AT_CHECK([echo from-stdin | ./config.status --file=file:-],
238 AT_CHECK([grep from-stdin file], [], [from-stdin
240 # Force write error creating a file on stdout
241 AT_CHECK([./config.status --file=-:input </dev/null >/dev/full],
242 [1], [ignore], [ignore])
245 AT_CHECK_CONFIG_CREATION_NOWRITE(header)
246 # Create a header on stdout
247 AT_CHECK([./config.status --header=-:input </dev/null],
248 [0], [stdout], [ignore])
249 AT_CHECK([grep OK stdout], [], [OK
251 # Force write error creating a header on stdout
252 AT_CHECK([./config.status --header=-:input </dev/null >/dev/full],
253 [1], [ignore], [ignore])
256 AT_CHECK_CONFIG_CREATION_NOWRITE(command)
259 AT_CHECK_CONFIG_CREATION_NOWRITE(link)
261 # Check that no use of `ac_write_fail' escaped into config.status
262 AT_CHECK([grep ac_write_fail config.status], [1])
264 # Check that --file and --header accept funny file names
265 file='file with funny \ '\'' \'\'' $ & #!*? name'
266 cat >"$file.in" <<'END'
269 # skip if we cannot create such a file
270 AT_CHECK([test -f "$file.in" || exit 77])
271 AT_CHECK([./config.status "--file=$file:$file.in"],
273 AT_CHECK([grep OK "$file"], [], [OK
275 AT_CHECK([./config.status "--header=$file:$file.in"],
277 AT_CHECK([grep OK "$file"], [], [OK
283 ## ---------------------------------------- ##
284 ## Macro calls in AC_CONFIG_COMMANDS tags. ##
285 ## ---------------------------------------- ##
287 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
289 AT_DATA_M4SUGAR([configure.ac],
291 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
302 ## ------------------- ##
303 ## Missing templates. ##
304 ## ------------------- ##
306 # Check that config.status detects missing input files
307 AT_SETUP([Missing templates])
309 AT_DATA([configure.ac],
311 AC_CONFIG_FILES([nonexistent])
316 AT_CHECK_CONFIGURE([], [1], [],
317 [[config.status: error: cannot find input file: nonexistent.in
319 # Make sure that the output file doesn't exist
320 AT_CHECK([test -f nonexistent], 1)
327 ## ---------------------- ##
328 ## configure invocation. ##
329 ## ---------------------- ##
331 # Check that `configure' and `config.status' honor their interface.
333 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
334 # and verify that (i) `configure' correctly receives the arguments,
335 # (ii) correctly passes them to `config.status', which we check by
336 # running `config.status --recheck', and (iii) correctly passes them
337 # to sub-configure scripts.
339 AT_SETUP([configure invocation])
343 AT_DATA([configure.ac],
345 AC_CONFIG_SUBDIRS([sub])
346 echo "result=$one$enable_two$with_three"
350 AT_DATA([sub/configure.ac],
352 echo "result=$one$enable_two$with_three"
356 echo fake install-sh script >install-sh
363 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
364 sed -n -e 's/^result=//p'], 0,
368 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
372 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
373 sed -n -e 's/^result=//p'], 0,
374 [m4_do(["'$ " ' $ "'$
377 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
380 dnl restore font-lock: "
386 ## -------------------------------------------- ##
387 ## Check that `#define' templates are honored. ##
388 ## -------------------------------------------- ##
390 # Use various forms of `#define' templates, and make sure there are no
391 # problems when a symbol is prefix of another.
393 AT_SETUP([@%:@define header templates])
395 AT_DATA([configure.ac],
397 AC_CONFIG_HEADERS(config.h:config.hin)
399 # I18n of dummy variables: their French translations.
403 AC_DEFINE(fubar, tutu)
405 # Symbols which are prefixes of another.
410 # backslash-newline combinations
411 AC_DEFINE([multiline], [line1\
415 AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
417 AC_CONFIG_FILES(defs)
419 # Things included in confdefs.h, but which make no sense in
420 # config.h, nor in $DEFS.
421 cat <<\EOF >>confdefs.h
422 /* Hi Mum! Look, I am doing C++! */
424 void exit (int status);
428 # In addition of config.h output a full DEFS
439 AT_DATA([config.hin],
442 # define baz "Archimedes was sinking in his baz"
450 #define aaa(a, aa) aa a
452 #define aaac(a, aa) aa a
454 # undef multiline_args
456 #define str(define) \
458 #define stringify(arg) str(arg)
465 [[/* config.h. Generated from config.hin by configure. */
478 #define aaac(a, aa) aa a
479 #define multiline line1\
483 # define multiline_args(ARG1, ARG2) ARG2 \
486 #define str(define) \
488 #define stringify(arg) str(arg)
490 AT_CHECK([cat config.h], 0, expout)
492 # Check the value of DEFS.
494 [[-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
497 # Because we strip trailing spaces in `testsuite' we can't leave one in
498 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
499 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
505 ## ------------------------- ##
506 ## Torturing config.status. ##
507 ## ------------------------- ##
509 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
510 ## big value. This is mostly to check that Autoconf produces portable sed
511 ## scripts in config.status. sed is used to skip the first two lines
512 ## `Generated by...'.
514 # We use m4_for many times.
515 m4_pattern_allow([^m4_for$])
517 AT_SETUP([Torturing config.status])
519 dnl The value used as a big value for AC_DEFINE.
520 dnl Don't use sh active chars here, below it is also used in a sh
522 m4_define([AT_BIG_VALUE],
523 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
525 m4_define([AT_DESCRIPTION],
526 [Define to a long string if your `Autoconf' works properly.])
529 # AT_DUMMY_VAR(NUMBER)
530 # --------------------
531 # Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
532 # so that the check for user name space invasion does not complain
533 # of the new variables defined.
535 # Note that you should not use the name ac_dummy, because it will be
536 # turned into ac_uummy during the construction of config.status. Yes,
537 # this is admittedly a bug, but it would be too hard to fix this.
538 # There is really no point in AC_DEFINE a var named ac_d.*.
539 m4_pattern_allow([^m4_bpatsubst$])
540 m4_define([AT_DUMMY_VAR],
541 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
546 [m4_for([AT_Count], 1, 100, 1,
547 [@AT_DUMMY_VAR(AT_Count)@
553 while test $i != 101; do
554 echo "content of file $i" > file_$i
563 m4_pattern_allow([^m4_(define|defun)$])
564 AT_DATA([configure.ac],
565 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
566 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
567 [[m4_define([AC_DUMMY_VAR],]
568 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
570 [[m4_define([AC_DESCRIPTION],]
571 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
573 [[m4_define([AC_BIG_VALUE],]
574 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
578 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
579 # used in the torture tests.
580 m4_defun([AC_DEFUBST],
581 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
582 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
584 AC_SUBST(AC_DUMMY_VAR($1))
590 AC_CONFIG_HEADERS(config.h:config.hin)
591 AC_CONFIG_FILES(dummy)
592 m4_for(AC_Count, 1, 100, 1,
593 [AC_DEFUBST(AC_Count)])
600 # Check both awk and the result of AC_PROG_AWK
601 for awk_arg in FOO= AWK=awk; do
602 AT_CHECK_CONFIGURE([$awk_arg])
604 # Checking that AC_DEFINE worked properly.
606 [/* Define to the address where bug reports for this package should be sent. */
607 #define PACKAGE_BUGREPORT ""
609 /* Define to the full name of this package. */
610 #define PACKAGE_NAME ""
612 /* Define to the full name and version of this package. */
613 #define PACKAGE_STRING ""
615 /* Define to the one symbol short name of this package. */
616 #define PACKAGE_TARNAME ""
618 /* Define to the version of this package. */
619 #define PACKAGE_VERSION ""
620 m4_for(AT_Count, 1, 100, 1,
623 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
626 AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
628 # Checking that AC_SUBST worked properly.
630 [m4_for(AT_Count, 1, 100, 1,
632 content of file AT_Count
635 AT_CHECK([cat dummy], 0, expout)
641 ## ------------------------------- ##
642 ## Substitute a 2000-byte string. ##
643 ## ------------------------------- ##
645 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
646 # sed dumps core around 8 KiB. However, POSIX says that sed need not
647 # handle lines longer than 2048 bytes (including the trailing newline).
648 # So we'll just test a 2000-byte value, and for awk, we test a line with
649 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
650 # multi-line values should allow to get around the limitations.
652 AT_SETUP([Substitute a 2000-byte string])
654 AT_DATA([Foo.in], [@foo@
656 AT_DATA([Bar.in], [@bar@
658 AT_DATA([Baz.in], [@baz@
661 AT_DATA([configure.ac],
663 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
664 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
665 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
667 baz=$baz$baz$baz$baz$baz
670 AC_CONFIG_FILES([Foo Bar Baz])
674 cp "$abs_top_srcdir/build-aux/install-sh" .
677 # Check both awk and the result of AC_PROG_AWK
678 for awk_arg in Foo= AWK=awk; do
679 AT_CHECK_CONFIGURE([$awk_arg])
680 AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
682 AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
685 [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
687 AT_CHECK([cat Baz], 0, [stdout])
692 ## ------------------------------ ##
693 ## Define to a 2000-byte string. ##
694 ## ------------------------------ ##
696 AT_SETUP([Define to a 2000-byte string])
700 AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
706 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
711 ## ------------------------------------------ ##
712 ## Substitute and define special characters. ##
713 ## ------------------------------------------ ##
715 # Use characters special to the shell, sed, awk, and M4.
717 AT_SETUP([Substitute and define special characters])
719 AT_DATA([Foo.in], [@foo@
720 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
737 AT_DATA([Zardoz.in], [@zardoz@
741 [[foo="AS@&t@_ESCAPE([[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
744 ( for i in 0 1 2 3; do
745 for j in 0 1 2 3 4 5 6 7; do
746 for k in 0 1 2 3 4 5 6 7; do
749 *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
756 zardoz=`cat allowed-chars`
762 AC_SUBST_FILE([file])
763 AC_DEFINE([foo], [[X*'[]+ ",& &`\($foo !]], [Awful value.])
764 AC_DEFINE([bar], [[%!_!# X]], [Value that is used as special delimiter.])
766 AC_CONFIG_FILES([Foo Zardoz])]])
770 # Check both awk and the result of AC_PROG_AWK
771 for awk_arg in FOO= AWK=awk; do
772 AT_CHECK_CONFIGURE([$awk_arg])
773 AT_CHECK([cat Foo], 0, [[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
774 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
775 abc@foo@ @baz@baz@baz
777 abc@foo@ @baz@blabaz@
786 AT_CHECK([cmp allowed-chars Zardoz])
787 AT_CHECK_DEFINES([[#define bar %!_!# X
788 #define foo X*'[]+ ",& &`\($foo !
794 ## ---------------------- ##
795 ## Substitute a newline. ##
796 ## ---------------------- ##
798 AT_SETUP([Substitute a newline])
805 AT_DATA([configure.ac],
813 AC_CONFIG_FILES([Foo])
818 cp "$abs_top_srcdir/build-aux/install-sh" .
826 # Check both awk and the result of AC_PROG_AWK
827 for awk_arg in FOO= AWK=awk; do
828 AT_CHECK_CONFIGURE([$awk_arg])
829 AT_CHECK([cat Foo], 0, [expout])
834 ## ------------------ ##
835 ## Define a newline. ##
836 ## ------------------ ##
838 AT_SETUP([Define a newline])
839 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
840 two], [This spans two lines.])
842 AT_CHECK_AUTOCONF([], [], [], [stderr])
843 dnl Older versions of m4 report error at line 5 (end of macro);
844 dnl newer versions report it at line 4 (start of macro).
845 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
846 [[warning: AC_DEFINE: `one
847 two' is not a valid preprocessor define value
849 AT_CHECK_AUTOHEADER([], [], [], [stderr])
850 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
851 [[warning: AC_DEFINE: `one
852 two' is not a valid preprocessor define value
855 AT_CHECK_DEFINES([[#define foo one
858 AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
859 two], [This spans two lines.])
861 AT_CHECK_AUTOCONF([], [], [], [stderr])
862 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
863 [[warning: AC_DEFINE_UNQUOTED: `one
864 two' is not a valid preprocessor define value
866 AT_CHECK_AUTOHEADER([], [], [], [stderr])
867 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
868 [[warning: AC_DEFINE_UNQUOTED: `one
869 two' is not a valid preprocessor define value
872 AT_CHECK_DEFINES([[#define foo one
878 ## ------------------------------------ ##
879 ## AC_SUBST: variable name validation. ##
880 ## ------------------------------------ ##
882 AT_SETUP([AC_SUBST: variable name validation])
884 AT_CONFIGURE_AC([[AC_SUBST(, [])
885 AC_CONFIG_FILES([Makefile])
887 AT_DATA([Makefile.in], [[
889 mv -f configure.ac configure.tmpl
892 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
893 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
894 AT_CHECK_AUTOCONF([], [1], [], [ignore])
898 for var in ab a4 'a@@&t@\&t@b'; do
899 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
908 ## ------------------------ ##
909 ## datarootdir workaround. ##
910 ## ------------------------ ##
912 AT_SETUP([datarootdir workaround])
926 AT_DATA([configure.ac],
928 d@&t@nl The following line silences the warnings, if uncommented:
929 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
931 # This substitution is wrong and bogus! Don't use it in your own code!
932 # Read `info Autoconf "Defining Directories"'!
933 AC_SUBST([mydatadir], [${datadir}/my])
935 AC_CONFIG_FILES([Foo Bar])
939 cp "$abs_top_srcdir/build-aux/install-sh" .
942 AT_CHECK_CONFIGURE([], [], [],
943 [config.status: WARNING: 'Foo.in' seems to ignore the --datarootdir setting
944 config.status: WARNING: Bar contains a reference to the variable `datarootdir'
945 which seems to be undefined. Please make sure it is defined.
947 AT_CHECK([grep datarootdir Foo], 1, [])
950 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
970 AT_DATA([configure.ac],
973 AC_CONFIG_FILES([foo at-dir/bar])
975 AC_CONFIG_COMMANDS([report],
976 [test -f $srcdir/configure.ac ||
977 AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
981 rm -f -r foo at-dir/bar
987 AT_CHECK([./configure], [], [ignore])
990 AT_CHECK([cd at-dir && ../configure], [], [ignore])
994 AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
999 ## ----------------- ##
1000 ## Signal handling. ##
1001 ## ----------------- ##
1003 AT_SETUP([Signal handling])
1005 AT_DATA([configure.ac],
1012 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
1017 ## ------------------------------------- ##
1018 ## AC_CONFIG_LINKS and identical files. ##
1019 ## ------------------------------------- ##
1020 AT_SETUP([AC_CONFIG_LINKS and identical files])
1022 AT_DATA([configure.ac],
1024 AC_CONFIG_LINKS([src/s:src/s])
1025 test "$srcdir" != '.' && AC_CONFIG_LINKS([src/t:src/t])
1034 AT_CHECK([../configure && ../configure], 0, [ignore])
1035 AT_CHECK([cat src/s src/t], 0, [file1
1039 AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
1040 AT_CHECK([grep src/t stderr], 1)
1041 AT_CHECK([cat src/s src/t], 0, [file1
1044 AT_CHECK(["`pwd`"/configure && "`pwd`"/configure], 0, [ignore], [ignore])
1045 AT_CHECK([cat src/s src/t], 0, [file1
1052 AT_BANNER([autoreconf.])
1054 ## ---------------------------- ##
1055 ## Configuring subdirectories. ##
1056 ## ---------------------------- ##
1061 # | |-- config.status
1064 # | |-- config.status
1071 # | |-- configure.ac
1076 AT_SETUP([Configuring subdirectories])
1077 AT_KEYWORDS(autoreconf)
1079 # We use aclocal (via autoreconf).
1080 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
1081 # It should understand configure.ac.
1082 AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
1084 # Set CONFIG_SITE to a nonexistent file, so that there are
1085 # no worries about nonstandard values for 'prefix'.
1086 CONFIG_SITE=no-such-file
1089 # The contents of `inner/', and `inner/innermost/'.
1090 AS_MKDIR_P([inner/innermost])
1092 # We have to use configure.in, not configure.ac, if we still want to
1093 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
1094 # die because it can't find configure.in.
1095 AT_DATA([inner/configure.in],
1096 [[AC_INIT(GNU Inner, 1.0)
1097 AC_CONFIG_SRCDIR([innermost/config.in])
1098 AC_ARG_VAR([INNER], [an inner variable])
1100 if test "x$INNER" = x; then
1103 AC_CONFIG_FILES([innermost/config])
1107 AT_DATA([inner/innermost/config.in],
1110 top_srcdir=@top_srcdir@
1114 # The contents of `.'
1115 AT_DATA([install-sh], [])
1117 # nonexistent is allowed not to exist.
1118 AT_DATA([configure.in],
1119 [[AC_INIT(GNU Outer, 1.0)
1120 AC_ARG_VAR([OUTER], [an outer variable])
1122 AC_CONFIG_SUBDIRS([nonexistent])
1124 AC_CONFIG_SUBDIRS([inner])
1128 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
1129 # they trigger warnings from aclocal 1.8, so ignore stderr.
1130 AT_CHECK([autoreconf], [], [], [ignore])
1131 AT_CHECK([test -f inner/configure])
1133 # Running the outer configure recursively should provide the innermost
1135 chmod a-w inner/innermost inner .
1136 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep INNER], 0,
1138 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1139 chmod u+w . inner inner/innermost
1141 # Running the outer configure should trigger the inner.
1143 AT_CHECK([cat inner/innermost/config], 0,
1150 # The same, but from a builddir.
1151 AS_MKDIR_P([builddir])
1152 AT_CHECK([cd builddir && ../configure], 0, [ignore])
1153 AT_CHECK([cat builddir/inner/innermost/config], 0,
1155 srcdir=../../../inner/innermost
1156 top_srcdir=../../../inner
1160 # Make sure precious variables and command line options are properly
1161 # passed, even when there are duplicates.
1162 AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
1163 AT_CHECK([cat builddir/inner/innermost/config], 0,
1165 srcdir=../../../inner/innermost
1166 top_srcdir=../../../inner
1170 # Make sure --prefix is properly quoted
1171 AT_CHECK([cd builddir && ../configure --prefix "/a b c$ 'd"], 0, [ignore])
1172 AT_CHECK([cat builddir/inner/innermost/config], 0,
1174 srcdir=../../../inner/innermost
1175 top_srcdir=../../../inner
1179 # Make sure --silent is properly passed...
1180 AT_CHECK([cd builddir && ../configure --silent], 0, [])
1181 # ...but not stored in config.status.
1182 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1183 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1185 # Make sure we can run autoreconf on a subdirectory
1186 rm -f configure configure.in
1187 AT_CHECK([autoreconf inner], [], [], [ignore])
1189 # Make sure we can pass a configure.ac name
1190 AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
1191 AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
1197 ## -------------- ##
1199 ## -------------- ##
1201 AT_SETUP([Deep Package])
1202 AT_KEYWORDS(autoreconf)
1204 # We use aclocal (via autoreconf).
1205 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1207 # The contents of `.'
1208 AT_DATA([install-sh], [])
1209 AT_DATA([configure.in],
1210 [[AC_INIT(GNU Outer, 1.0)
1211 AC_ARG_VAR([OUTER], [an outer variable])
1212 AC_CONFIG_SUBDIRS([inner])
1216 # The contents of `inner/', and `inner/innermost/'.
1217 AS_MKDIR_P([inner/innermost])
1219 AT_DATA([inner/configure.in],
1220 [[AC_INIT(GNU Inner, 1.0)
1221 AC_ARG_VAR([INNER], [an inner variable])
1222 AC_CONFIG_SUBDIRS(innermost)
1226 AT_DATA([inner/innermost/configure.in],
1227 [[AC_INIT(GNU Innermost, 1.0)
1228 AC_ARG_VAR([INNERMOST], [an innermost variable])
1229 AC_CONFIG_HEADERS(config.h:config.hin)
1230 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1234 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
1235 AT_CHECK([test -f inner/configure])
1236 AT_CHECK([test -f inner/innermost/configure])
1237 AT_CHECK([test -f inner/innermost/config.hin])
1239 # Running the outer configure recursively should provide the innermost
1241 chmod a-w inner/innermost inner
1242 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER "],
1243 0, [ignore], [stderr],
1244 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1246 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1247 0, [ignore], [stderr],
1248 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1250 AT_CHECK([{ /bin/sh ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1251 0, [ignore], [stderr],
1252 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1254 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure --help=recursive; chmod +w .; } | grep " INNERMOST "],
1255 0, [ignore], [stderr],
1256 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1258 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1259 0, [ignore], [stderr],
1260 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1261 chmod u+w inner inner/innermost
1263 # Running the outer configure should trigger the inner.
1264 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1265 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1266 [[#define INNERMOST tsomrenni
1269 # The same, but from a builddir.
1270 AS_MKDIR_P([builddir])
1271 chmod a-w builddir inner/innermost inner
1272 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNER "],
1273 0, [ignore], [stderr],
1274 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1276 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1277 0, [ignore], [stderr],
1278 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1280 AT_CHECK([cd builddir && { /bin/sh ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1281 0, [ignore], [stderr],
1282 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1284 # Not all shells search $PATH for scripts.
1285 if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help) >/dev/null 2>&1; then
1286 AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help=recursive | grep " INNERMOST "], 0, [ignore])
1288 AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1289 0, [ignore], [stderr],
1290 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1291 chmod u+w builddir inner inner/innermost
1292 AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
1293 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1294 [[#define INNERMOST build/tsomrenni
1301 ## -------------------------------- ##
1302 ## Non-Autoconf AC_CONFIG_SUBDIRS. ##
1303 ## -------------------------------- ##
1305 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1306 AT_KEYWORDS([autoreconf])
1308 # We use aclocal (via autoreconf).
1309 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1311 AT_DATA([install-sh], [])
1312 AT_DATA([configure.in],
1313 [[AC_INIT(GNU Outer, 1.0)
1314 AC_CONFIG_SUBDIRS([inner])
1320 AT_DATA([inner/configure],
1323 *--help*) echo 'No Autoconf here, folks!' ;;
1324 *) echo got_it >myfile ;;
1328 chmod +x inner/configure
1330 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
1332 # Running the outer configure recursively should provide the innermost
1334 AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
1336 # Running the outer configure should trigger the inner.
1337 AT_CHECK([./configure], 0, [ignore])
1338 AT_CHECK([test -f inner/myfile], 0)
1344 ## ----------------- ##
1345 ## Empty directory. ##
1346 ## ----------------- ##
1348 AT_SETUP([Empty directory])
1349 AT_KEYWORDS([autoreconf])
1351 # We use aclocal (via autoreconf).
1352 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1354 # The test group directory is not necessarily _empty_, but it does not contain
1355 # files meaningful to `autoreconf'.
1357 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1363 ## ------------------------------ ##
1364 ## Unusual Automake input files. ##
1365 ## ------------------------------ ##
1367 # This parallels gnumake.test in Automake.
1369 AT_SETUP([Unusual Automake input files])
1370 AT_KEYWORDS([autoreconf])
1372 # We use aclocal and automake via autoreconf.
1373 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1375 AT_DATA([configure.in],
1376 [[AC_INIT(GNU foo, 1.0)
1378 AC_CONFIG_FILES([HeeHee])
1382 AT_DATA([HeeHee.am],
1383 [[# Humans do no worse than `GNUmakefile.am'.
1384 AUTOMAKE_OPTIONS = foreign 1.8
1387 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1388 [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1389 AT_CHECK([test -f HeeHee.in])