3 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 # 2009, 2010 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 AT_BANNER([[Testing config.status.]])
23 ## ---------------------------------------- ##
24 ## AC_CONFIG_COMMANDS with empty commands. ##
25 ## ---------------------------------------- ##
27 AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
28 [[AC_CONFIG_COMMANDS([foo], [], [:])
32 ## --------------------------------------------- ##
33 ## AC_CONFIG_COMMANDS with temporary directory. ##
34 ## --------------------------------------------- ##
36 AT_CHECK_MACRO([AC_CONFIG_COMMANDS with temporary directory],
37 [[AC_CONFIG_COMMANDS([foo], [
41 test -d "$tmp" || AC_MSG_ERROR([No $tmp directory])
42 echo garbage-in > "$tmp/garbage-out"
52 AT_CHECK([test ! -f tmpdir])
53 AT_CHECK([ACTION=use ./config.status], [], [ignore])
54 AT_CHECK([test -s tmpdir && test ! -d "`cat tmpdir`"])
55 AT_CHECK([ACTION=corrupt ./config.status], [], [ignore])
56 AT_CHECK([test -s tmpdir && test ! -d "`cat tmpdir`"])
60 ## -------------------------- ##
61 ## Multiple AC_CONFIG_FILES. ##
62 ## -------------------------- ##
64 AT_SETUP([Multiple AC_CONFIG_FILES])
66 AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
67 AT_CHECK_AUTOCONF([], 1, [], [ignore])
72 ## ------------------------------- ##
73 ## parameterized AC_CONFIG_FILES. ##
74 ## ------------------------------- ##
76 AT_SETUP([Parameterized AC_CONFIG_FILES])
81 AC_CONFIG_FILES([$files])]])
82 AT_CHECK_AUTOCONF([], [], [], [ignore])
83 touch foo.in bar.in config.hin
94 # AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE, [STATUS = 1])
95 # ------------------------------------------------------------
96 # Check that AC_ARG_VAR caches the latest values, diagnoses
97 # inconsistencies, and arms config.status. Check that recheck
98 # returns STATUS, save configure output in files 'stdout' and 'stderr'
99 # for further inspection.
100 m4_define([AT_CHECK_AC_ARG_VAR],
105 [precious='m4_bpatsubst([$1], [[']], ['\\''])'; export precious],
107 AT_CHECK_CONFIGURE([--config-cache -q])
108 AT_CHECK([cat file], [], [`$1'
111 # Testing --recheck: 1. have the environment `forget' about PRECIOUS.
113 # 2. Rerun config.status to recreate `file'.
114 AT_CHECK([./config.status --recheck], [], [ignore])
115 AT_CHECK([./config.status], [], [ignore])
116 # 3. Check that file contains the old value of PRECIOUS.
117 AT_CHECK([cat file], [], [`$1'
120 # Second value: we should issue an error here: the value
123 [precious='$2'; export precious],
125 AT_CHECK_CONFIGURE([--config-cache], [m4_default([$3], [1])], [stdout], [stderr])
127 ])# AT_CHECK_AC_ARG_VAR
130 AT_SETUP([AC_ARG_VAR])
132 # We don't want to run this test if this shell doesn't support
135 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
142 AT_DATA([configure.ac],
144 AC_ARG_VAR([precious], [this variable costs a lot])
145 echo "precious:$precious"
155 # Set a precious variable
156 AT_CHECK_AC_ARG_VAR([], [apple of my eye])
158 # Unset a precious variable
159 AT_CHECK_AC_ARG_VAR([apple of my eye], [])
161 # Change a precious variable
162 AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
164 # Change a precious variable that contains braces
165 AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
167 # Change a precious variable that contains all kinds of fun
168 AT_CHECK_AC_ARG_VAR(['p r ec"iou$], [orange of my eye])
169 dnl restore font-lock: "
171 # Warn (but do not fail) about a whitespace-only change
172 AT_CHECK_AC_ARG_VAR([ apple of my eye ], [apple of my eye],
173 [0], ["has whitespace changes"])
174 mv stdout configure-output
175 AT_CHECK([grep "ignoring whitespace changes" stderr], [], [ignore])
176 AT_CHECK([grep "precious: apple" configure-output], [], [ignore])
183 ## ---------------------------------------------- ##
184 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
185 ## ---------------------------------------------- ##
187 AT_SETUP([[AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]])
189 AT_DATA([configure.ac],
192 rm -f -r header var-header file var-file link var-link command var-command
195 # Be sure to also stress the associated INIT-CMDS.
196 case $what_to_test in
198 AC_CONFIG_HEADERS(header:input);;
200 AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
203 AC_CONFIG_FILES(file:input);;
205 AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
208 AC_CONFIG_COMMANDS(command,
209 [cp input command]);;
211 AC_CONFIG_COMMANDS(var-command,
212 [cp $command_in var-command], [command_in=input]);;
215 AC_CONFIG_LINKS(link:input);;
217 AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
225 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
226 # ------------------------------------------------------------------
227 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
228 # are properly created, with the right content.
229 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
231 m4_define([AT_CHECK_CONFIG_CREATION],
232 [AT_CHECK_CONFIGURE([what_to_test=$1])
233 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
236 AT_CHECK([grep OK $1], [], [OK
239 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
240 # config.status might be stupidly expecting data on stdin, if it's
242 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
243 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
246 AT_CHECK([grep OK var-$1], [], [OK
248 ])# AT_CHECK_CONFIG_CREATION
251 # AT_CHECK_CONFIG_CREATION_NOWRITE(THING = (header | link | file | command))
252 # --------------------------------------------------------------------------
253 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
254 # are properly created, with the right content.
255 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
257 m4_define([AT_CHECK_CONFIG_CREATION_NOWRITE],
258 [AT_CHECK_CONFIGURE([what_to_test=$1])
259 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
262 AT_CHECK([grep OK $1], [], [OK
265 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
266 # config.status might be stupidly expecting data on stdin, if it's
268 # Skip check if user can rename files into a read-only directory (when
269 # run by root or on w32).
272 mv t t1 >/dev/null 2>&1 \
273 || AT_CHECK([./config.status var-$1 </dev/null || exit 1],
274 [1], [ignore], [ignore])
277 ])# AT_CHECK_CONFIG_CREATION_NOWRITE
281 AT_CHECK_CONFIG_CREATION(file)
284 AT_CHECK_CONFIG_CREATION(header)
287 AT_CHECK_CONFIG_CREATION(command)
290 AT_CHECK_CONFIG_CREATION(link)
292 # Now check for write errors
295 AT_CHECK_CONFIG_CREATION_NOWRITE(file)
296 # Create a file with bits from stdin
297 AT_CHECK([echo from-stdin | ./config.status --file=file:-],
299 AT_CHECK([grep from-stdin file], [], [from-stdin
301 # Force write error creating a file on stdout
302 if test -w /dev/full && test -c /dev/full; then
303 AT_CHECK([./config.status --file=-:input </dev/null >/dev/full || exit 1],
304 [1], [ignore], [ignore])
307 # Validate that --file requires an argument
308 AT_CHECK([./config.status --file], [1], [ignore], [stderr])
309 AT_CHECK([grep 'missing file argument' stderr], [0], [ignore])
310 AT_CHECK([./config.status --file=], [1], [ignore], [stderr])
311 AT_CHECK([grep 'missing file argument' stderr], [0], [ignore])
314 AT_CHECK_CONFIG_CREATION_NOWRITE(header)
315 # Create a header on stdout
316 AT_CHECK([./config.status --header=-:input </dev/null],
317 [0], [stdout], [ignore])
318 AT_CHECK([grep OK stdout], [], [OK
320 # Force write error creating a header on stdout
321 if test -w /dev/full && test -c /dev/full; then
322 AT_CHECK([./config.status --header=-:input </dev/null >/dev/full || exit 1],
323 [1], [ignore], [ignore])
327 AT_CHECK_CONFIG_CREATION_NOWRITE(command)
330 AT_CHECK_CONFIG_CREATION_NOWRITE(link)
332 # Check that no use of `ac_write_fail' escaped into config.status
333 AT_CHECK([grep ac_write_fail config.status], [1])
335 # Check that --file and --header accept funny file names
339 ./config.status --file=fgrep:fgrep.in
345 'with funny '\'' $x & #! name' \
346 'file with funny \ '\'' \'\'' $ & #!*? name' \
347 'with funny \ '\'' \'\'' " | <a >b & * ? name ' # "restore font-lock
349 # The function func_sanitize_file_name comes from tools.at
350 file=`func_sanitize_file_name "$file"`
351 cat >"$file.in" <<'END'
354 AT_CHECK([./config.status "--file=$file:$file.in"],
356 AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
357 AT_CHECK([./config.status "--header=$file:$file.in"],
359 # Run the same test a 2nd time to see that config.status does not recreate
360 # the header (regression test)
361 AT_CHECK_UNQUOTED([./config.status "--header=$file:$file.in"],
362 [0], [config.status: creating $file
363 config.status: $file is unchanged
365 AT_CHECK_UNQUOTED([grep ' & ' "$file"], [],
366 [/* $file. Generated from $file.in by configure. */
368 AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
374 ## ---------------------------------------- ##
375 ## Macro calls in AC_CONFIG_COMMANDS tags. ##
376 ## ---------------------------------------- ##
378 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
380 AT_DATA_M4SUGAR([configure.ac],
382 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
393 ## ------------------- ##
394 ## Missing templates. ##
395 ## ------------------- ##
397 # Check that config.status detects missing input files
398 AT_SETUP([Missing templates])
400 AT_DATA([configure.ac],
402 AC_CONFIG_FILES([nonexistent])
408 AT_CAPTURE_FILE([build/config.log])[]dnl
410 AT_CHECK([../configure], [1], [ignore],
411 [[config.status: error: cannot find input file: `nonexistent.in'
413 # Make sure that the output file doesn't exist
414 AT_CHECK([test -f nonexistent], 1)
416 AT_CHECK_CONFIGURE([], [1], [],
417 [[config.status: error: cannot find input file: `nonexistent.in'
419 # Make sure that the output file doesn't exist
420 AT_CHECK([test -f nonexistent], 1)
427 ## ---------------------- ##
428 ## configure invocation. ##
429 ## ---------------------- ##
431 # Check that `configure' and `config.status' honor their interface.
433 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
434 # and verify that (i) `configure' correctly receives the arguments,
435 # (ii) correctly passes them to `config.status', which we check by
436 # running `config.status --recheck', (iii) correctly passes them
437 # to sub-configure scripts, and (iv) correctly reproduces them with
438 # `config.status --config'.
440 AT_SETUP([configure invocation])
444 AT_DATA([configure.ac],
446 AC_CONFIG_SUBDIRS([sub])
447 echo "result=$one$enable_two$with_three"
451 AT_DATA([sub/configure.ac],
453 echo "result=$one$enable_two$with_three"
457 echo fake install-sh script >install-sh
464 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
465 sed -n -e 's/^result=//p'], 0,
469 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
472 AT_CHECK([args=`./config.status --config` && eval ./configure \$configure_options "$args" |
473 sed -n -e 's/^result=//p'], 0,
478 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
479 sed -n -e 's/^result=//p'], 0,
480 [m4_do(["'$ " ' $ "'$
483 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
486 dnl restore font-lock: "
487 AT_CHECK([args=`./config.status --config` && eval ./configure \$configure_options "$args" |
488 sed -n -e 's/^result=//p'], 0,
489 [m4_do(["'$ " ' $ "'$
497 ## -------------------------------------------- ##
498 ## Check that `#define' templates are honored. ##
499 ## -------------------------------------------- ##
501 # Use various forms of `#define' templates, and make sure there are no
502 # problems when a symbol is prefix of another.
504 AT_SETUP([@%:@define header templates])
505 AT_KEYWORDS([AC@&t@_DEFINE])
507 AT_DATA([configure.ac],
509 AC_CONFIG_HEADERS(config.h:config.hin)
511 # I18n of dummy variables: their French translations.
515 AC_DEFINE(fubar, tutu)
517 # Symbols which are prefixes of another.
522 # backslash-newline combinations
523 AC_DEFINE([multiline], [line1\
527 AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
529 AC_CONFIG_FILES(defs)
532 AC_DEFINE([paste(a,b)], [a##b])
534 # Things included in confdefs.h, but which make no sense in
535 # config.h, nor in $DEFS.
536 cat <<\EOF >>confdefs.h
537 /* Hi Mum! Look, I am doing C++! */
539 void exit (int status);
543 # In addition of config.h output a full DEFS
554 AT_DATA([config.hin],
557 # define baz "Archimedes was sinking in his baz"
565 #define aaa(a, aa) aa a
567 #define aaac(a, aa) aa a
569 # undef multiline_args
570 #define paste(a,b) a##b
572 #define str(define) \
574 #define stringify(arg) str(arg)
575 #undef aaa /* with comments */
576 #undef not_substed /* with comments */
583 [[/* config.h. Generated from config.hin by configure. */
596 #define aaac(a, aa) aa a
597 #define multiline line1\
601 # define multiline_args(ARG1, ARG2) ARG2 \
603 #define paste(a,b) a##b
605 #define str(define) \
607 #define stringify(arg) str(arg)
609 /* #undef not_substed */
611 AT_CHECK([cat config.h], 0, expout)
613 # Check the value of DEFS.
615 [[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA -Dmultiline=line1line2line3\ line4 -Dmultiline_args\(ARG1,\ ARG2\)=ARG2\ ARG1 -Dpaste\(a,b\)=a\#\#b
618 # Because we strip trailing spaces in `testsuite' we can't leave one in
619 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
620 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
626 ## ------------------------- ##
627 ## Torturing config.status. ##
628 ## ------------------------- ##
630 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
631 ## big value. This is mostly to check that Autoconf produces portable sed
632 ## scripts in config.status. sed is used to skip the first two lines
633 ## `Generated by ...'.
635 # We use m4_for many times.
636 m4_pattern_allow([^m4_for$])
638 AT_SETUP([Torturing config.status])
640 dnl The value used as a big value for AC_DEFINE.
641 dnl Don't use sh active chars here, below it is also used in a sh
643 m4_define([AT_BIG_VALUE],
644 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
646 m4_define([AT_DESCRIPTION],
647 [Define to a long string if your `Autoconf' works properly.])
650 # AT_DUMMY_VAR(NUMBER)
651 # --------------------
652 # Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
653 # so that the check for user name space invasion does not complain
654 # of the new variables defined.
656 # Note that you should not use the name ac_dummy, because it will be
657 # turned into ac_uummy during the construction of config.status. Yes,
658 # this is admittedly a bug, but it would be too hard to fix this.
659 # There is really no point in AC_DEFINE a var named ac_d.*.
660 m4_pattern_allow([^m4_bpatsubst$])
661 m4_define([AT_DUMMY_VAR],
662 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
667 [m4_for([AT_Count], 1, 100, 1,
668 [@AT_DUMMY_VAR(AT_Count)@
674 while test $i != 101; do
675 echo "content of file $i" > file_$i
676 AS_VAR_ARITH([i], [$i + 1])
684 m4_pattern_allow([^m4_(define|defun)$])
685 AT_DATA([configure.ac],
686 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
687 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
688 [[m4_define([AC_DUMMY_VAR],]
689 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
691 [[m4_define([AC_DESCRIPTION],]
692 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
694 [[m4_define([AC_BIG_VALUE],]
695 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
699 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
700 # used in the torture tests.
701 m4_defun([AC_DEFUBST],
702 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
703 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
705 AC_SUBST(AC_DUMMY_VAR($1))
711 AC_CONFIG_HEADERS(config.h:config.hin)
712 AC_CONFIG_FILES(dummy)
713 m4_for(AC_Count, 1, 100, 1,
714 [AC_DEFUBST(AC_Count)])
721 # Check both awk and the result of AC_PROG_AWK.
722 # Quote the first word in the for list for Solaris sh.
723 for awk_arg in "FOO=" AWK=awk; do
724 AT_CHECK_CONFIGURE([$awk_arg])
726 # Checking that AC_DEFINE worked properly.
728 [/* Define to the address where bug reports for this package should be sent. */
729 #define PACKAGE_BUGREPORT ""
731 /* Define to the full name of this package. */
732 #define PACKAGE_NAME ""
734 /* Define to the full name and version of this package. */
735 #define PACKAGE_STRING ""
737 /* Define to the one symbol short name of this package. */
738 #define PACKAGE_TARNAME ""
740 /* Define to the home page for this package. */
741 #define PACKAGE_URL ""
743 /* Define to the version of this package. */
744 #define PACKAGE_VERSION ""
745 m4_for(AT_Count, 1, 100, 1,
748 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
751 AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
753 # Checking that AC_SUBST worked properly.
755 [m4_for(AT_Count, 1, 100, 1,
757 content of file AT_Count
760 AT_CHECK([cat dummy], 0, expout)
766 ## ------------------------------- ##
767 ## Substitute a 2000-byte string. ##
768 ## ------------------------------- ##
770 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
771 # sed dumps core around 8 KiB. However, POSIX says that sed need not
772 # handle lines longer than 2048 bytes (including the trailing newline).
773 # So we'll just test a 2000-byte value, and for awk, we test a line with
774 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
775 # multi-line values should allow to get around the limitations.
776 # We also test runs of around 148 backslashes: they need to be escaped,
777 # and 148 is the portable limit for awk string literals. config.status
778 # uses concatenation to generate longer strings.
780 AT_SETUP([Substitute a 2000-byte string])
782 AT_DATA([Foo.in], [@foo@
784 AT_DATA([Bar.in], [@bar@
786 AT_DATA([Baz.in], [@baz@
788 AT_DATA([Boo.in], [@b147@
796 AT_DATA([configure.ac],
798 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
799 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
800 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
802 baz=$baz$baz$baz$baz$baz
804 b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
805 b147=$b29$b29$b29$b29$b29'\\'
818 AC_CONFIG_FILES([Foo Bar Baz Boo])
822 cp "$abs_top_srcdir/build-aux/install-sh" .
824 b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
825 b147=$b29$b29$b29$b29$b29'\\'
837 # Check both awk and the result of AC_PROG_AWK
838 # Quote the first word in the for list for Solaris sh.
839 for awk_arg in "Foo=" AWK=awk; do
840 AT_CHECK_CONFIGURE([$awk_arg])
841 AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
843 AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
846 [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
848 AT_CHECK([cat Baz], 0, [stdout])
849 AT_CHECK([diff Boo-exp Boo])
854 ## ------------------------------ ##
855 ## Define to a 2000-byte string. ##
856 ## ------------------------------ ##
858 AT_SETUP([Define to a 2000-byte string])
859 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
863 AC_DEFINE_UNQUOTED([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
864 AC_DEFINE([fooq], ]m4_for([n], 1, 100,, ....................)[, [desc])
870 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
871 @%:@define fooq m4_for([n], 1, 100,, ....................)
876 ## ------------------------------------------ ##
877 ## Substitute and define special characters. ##
878 ## ------------------------------------------ ##
880 # Use characters special to the shell, sed, awk, and M4.
882 AT_SETUP([Substitute and define special characters])
883 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
885 AT_XFAIL_IF([byte=\\200s; dnl
886 test `{ printf $byte; echo; } | sed -n '/^./p' | wc -l` = 0])
888 AT_DATA([Foo.in], [@foo@
889 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
906 AT_DATA([Zardoz.in], [@zardoz@
910 [[foo="AS@&t@_ESCAPE([[X*'[]+ ", & &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
914 ( for i in 0 1 2 3; do
915 for j in 0 1 2 3 4 5 6 7; do
916 for k in 0 1 2 3 4 5 6 7; do
918 000 | 015 | 377) ;; # MinGW awk dislikes 0xFF, and the test does
919 # the wrong thing for CR on MinGW.
921 *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
928 zardoz=`cat allowed-chars`
934 AC_SUBST_FILE([file])
935 AC_DEFINE([fooq], [[X*'[]+ ", & &`\($foo !]], [Awful value.])
936 AC_DEFINE([barq], [[%!_!# X]], [Value that is used as special delimiter.])
937 AC_DEFINE_UNQUOTED([foo], [[X*'[]+ ", & &\`\\(\$foo !]], [Awful value.])
938 AC_DEFINE_UNQUOTED([bar], [[%!_!# X]], [Value that is used as special delimiter.])
939 AC_DEFINE_UNQUOTED([unq1], [$baz], [unquoted, test 1])
940 AC_DEFINE_UNQUOTED([unq2], [\$baz], [unquoted, test 2])
941 AC_DEFINE_UNQUOTED([unq3], ["$baz"], [unquoted, test 3])
942 AC_DEFINE_UNQUOTED([unq4], [${baz+set}], [unquoted, test 4])
943 AC_DEFINE_UNQUOTED([unq5], ["${baz+`echo "a "' b'`}"], [unquoted, test 5])
944 AC_DEFINE_UNQUOTED([unq6], [`echo hi`], [unquoted, test 6])
945 AC_DEFINE_UNQUOTED([unq7], ['\\"'], [unquoted, test 7])
947 AC_CONFIG_FILES([Foo Zardoz])]])
951 # Check both awk and the result of AC_PROG_AWK
952 # Quote the first word in the for list for Solaris sh.
953 for awk_arg in "FOO=" AWK=awk; do
954 AT_CHECK_CONFIGURE([$awk_arg])
955 AT_CHECK([cat Foo], 0, [[X*'[]+ ", & &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
956 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
957 abc@foo@ @baz@baz@baz
959 abc@foo@ @baz@blabaz@
968 AT_CHECK([cmp allowed-chars Zardoz])
969 AT_CHECK_DEFINES([[#define bar %!_!# X
971 #define foo X*'[]+ ", & &`\($foo !
972 #define fooq X*'[]+ ", & &`\($foo !
985 ## ---------------------- ##
986 ## Substitute a newline. ##
987 ## ---------------------- ##
989 AT_SETUP([Substitute a newline])
996 AT_DATA([configure.ac],
1004 AC_CONFIG_FILES([Foo])
1009 cp "$abs_top_srcdir/build-aux/install-sh" .
1017 # Check both awk and the result of AC_PROG_AWK
1018 # Quote the first word in the for list for Solaris sh.
1019 for awk_arg in "FOO=" AWK=awk; do
1020 AT_CHECK_CONFIGURE([$awk_arg])
1021 AT_CHECK([cat Foo], 0, [expout])
1026 ## ------------------ ##
1027 ## Define a newline. ##
1028 ## ------------------ ##
1030 AT_SETUP([Define a newline])
1031 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
1032 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
1033 two], [This spans two lines.])
1035 AT_CHECK_AUTOCONF([], [], [], [stderr])
1036 dnl Older versions of m4 report error at line 5 (end of macro);
1037 dnl newer versions report it at line 4 (start of macro).
1038 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
1039 [[warning: AC_DEFINE: `one
1040 two' is not a valid preprocessor define value
1042 AT_CHECK_AUTOHEADER([], [], [], [stderr])
1043 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
1044 [[warning: AC_DEFINE: `one
1045 two' is not a valid preprocessor define value
1048 AT_CHECK_DEFINES([[#define foo one
1051 AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
1052 two], [This spans two lines.])
1054 AT_CHECK_AUTOCONF([], [], [], [stderr])
1055 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
1056 [[warning: AC_DEFINE_UNQUOTED: `one
1057 two' is not a valid preprocessor define value
1059 AT_CHECK_AUTOHEADER([], [], [], [stderr])
1060 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
1061 [[warning: AC_DEFINE_UNQUOTED: `one
1062 two' is not a valid preprocessor define value
1065 AT_CHECK_DEFINES([[#define foo one
1071 ## ------------------------------------ ##
1072 ## AC_SUBST: variable name validation. ##
1073 ## ------------------------------------ ##
1075 AT_SETUP([AC_SUBST: variable name validation])
1077 AT_CONFIGURE_AC([[AC_SUBST(, [])
1078 AC_CONFIG_FILES([Makefile])
1080 AT_DATA([Makefile.in], [[
1082 mv -f configure.ac configure.tmpl
1085 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
1086 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
1087 AT_CHECK_AUTOCONF([], [1], [], [ignore])
1091 for var in ab a4 'a@@&t@\&t@b'; do
1092 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
1101 ## ------------------------ ##
1102 ## datarootdir workaround. ##
1103 ## ------------------------ ##
1105 AT_SETUP([datarootdir workaround])
1119 AT_DATA([configure.ac],
1121 d@&t@nl The following line silences the warnings, if uncommented:
1122 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
1124 # This substitution is wrong and bogus! Don't use it in your own code!
1125 # Read `info Autoconf "Defining Directories"'!
1126 AC_SUBST([mydatadir], [${datadir}/my])
1128 AC_CONFIG_FILES([Foo Bar])
1132 cp "$abs_top_srcdir/build-aux/install-sh" .
1135 AT_CHECK_CONFIGURE([], [], [],
1136 [config.status: WARNING: 'Foo.in' seems to ignore the --datarootdir setting
1137 config.status: WARNING: Bar contains a reference to the variable `datarootdir'
1138 which seems to be undefined. Please make sure it is defined
1140 AT_CHECK([grep datarootdir Foo], 1, [])
1143 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
1163 AT_DATA([configure.ac],
1166 AC_CONFIG_FILES([foo at-dir/bar])
1168 # Use quotes in the INIT-COMMANDS to accommodate a value of $srcdir
1169 # containing e.g., spaces or shell meta-characters.
1170 # Use *single* quotes because the context is an unquoted here-doc.
1171 AC_CONFIG_COMMANDS([report],
1172 [test -f "$srcdir/configure.ac" ||
1173 AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
1177 rm -f -r foo at-dir/bar
1183 AT_CHECK([./configure $configure_options], [], [ignore])
1186 AT_CHECK([cd at-dir && ../configure $configure_options], [], [ignore])
1190 AT_CHECK([cd at-dir && "$at_here/configure" $configure_options], [], [ignore])
1201 dirs='at paren brace space'
1202 for dir in $dirs; do
1203 mkdir $dir $dir/s1 $dir/s2
1204 touch $dir/f $dir/s1/f1 $dir/s2/f2
1207 AT_DATA([configure.ac],
1209 AC_CONFIG_FILES([at/Makefile paren/Makefile brace/Makefile space/Makefile])
1213 AT_DATA([at/Makefile.in],
1214 [[# This is what you should use in order to be portable to old makes.
1216 VPATH = @srcdir@/s1:@srcdir@:@srcdir@/s2
1221 AT_DATA([paren/Makefile.in],
1222 [[# This works with some makes but not with old ones.
1224 VPATH = $(srcdir)/s1:$(srcdir):$(srcdir)/s2
1229 AT_DATA([brace/Makefile.in],
1230 [[# This works with some makes but not with old ones.
1232 VPATH = ${srcdir}/s1:${srcdir}:${srcdir}/s2
1237 AT_DATA([space/Makefile.in],
1238 [[# This fails with FreeBSD make, for example.
1240 VPATH = @srcdir@/s1 @srcdir@ @srcdir@/s2
1250 AT_CHECK([./configure $configure_options], [], [ignore])
1251 # Treat BSD make separately, afterwards, for maximal coverage.
1252 dirs='at paren brace'
1253 for dir in $dirs; do
1254 AT_CHECK([cd $dir && $MAKE], [], [ignore], [ignore])
1258 mkdir build absbuild
1261 AT_CHECK([cd build && ../configure $configure_options], [], [ignore])
1262 for dir in $dirs; do
1263 AT_CHECK([cd build/$dir && $MAKE], [], [ignore], [ignore])
1268 AT_CHECK([cd absbuild && "$at_here/configure" $configure_options], [], [ignore])
1269 for dir in $dirs; do
1270 AT_CHECK([cd absbuild/$dir && $MAKE], [], [ignore], [ignore])
1273 # These will not pass with BSD make.
1274 AT_CHECK([cd space && { $MAKE || exit 77; }], [], [ignore], [ignore])
1275 AT_CHECK([cd build/space && $MAKE], [], [ignore], [ignore])
1276 AT_CHECK([cd absbuild/space && $MAKE], [], [ignore], [ignore])
1281 ## ----------------- ##
1282 ## Signal handling. ##
1283 ## ----------------- ##
1285 AT_SETUP([Signal handling])
1287 AT_DATA([configure.ac],
1294 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
1299 ## ----------------- ##
1300 ## AC_CONFIG_LINKS. ##
1301 ## ----------------- ##
1303 AT_SETUP([AC_CONFIG_LINKS])
1305 AT_DATA([configure.ac],
1306 [[AC_INIT([config links to config files test], [1.0])
1307 AC_CONFIG_SRCDIR([sub1/file1.in])
1308 AC_CONFIG_FILES([sub1/file1 file2])
1309 AC_CONFIG_LINKS([file1:sub1/file1 sub2/file2:file2])
1315 AT_DATA([sub1/file1.in],
1316 [[/* @configure_input@ */
1317 #define PACKAGE_STRING "@PACKAGE_STRING@"
1321 [[/* @configure_input@ */
1322 #define PACKAGE_STRING "@PACKAGE_STRING@"
1328 AT_CHECK([../configure && ../configure], 0, [ignore])
1329 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1331 AT_CHECK([../configure && ../configure], 0, [ignore])
1332 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1339 AT_CHECK(["$cwd"/../configure && "$cwd"/../configure], 0, [ignore])
1340 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1343 AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
1344 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1347 AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
1348 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1354 ## ------------------------------------- ##
1355 ## AC_CONFIG_LINKS and identical files. ##
1356 ## ------------------------------------- ##
1357 AT_SETUP([AC_CONFIG_LINKS and identical files])
1359 AT_DATA([configure.ac],
1361 AC_CONFIG_LINKS([src/s:src/s])
1362 test "$srcdir" != '.' && AC_CONFIG_LINKS([src/t:src/t])
1371 AT_CHECK([../configure $configure_options && ../configure $configure_options],
1373 AT_CHECK([cat src/s src/t], 0, [file1
1382 AT_CHECK(["$cwd"/../configure], 0, [ignore])
1383 AT_CHECK([cat src/s src/t], 0, [file1
1386 AT_CHECK(["$cwd"/../configure], 0, [ignore])
1387 AT_CHECK([cat src/s src/t], 0, [file1
1391 AT_CHECK([./configure $configure_options && ./configure $configure_options],
1392 0, [ignore], [stderr])
1393 AT_CHECK([grep src/t stderr], 1)
1394 AT_CHECK([cat src/s src/t], 0, [file1
1398 AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
1399 AT_CHECK([cat src/s src/t], 0, [file1
1406 AT_BANNER([autoreconf.])
1408 ## ---------------------------- ##
1409 ## Configuring subdirectories. ##
1410 ## ---------------------------- ##
1415 # | |-- config.status
1418 # | |-- config.status
1425 # | |-- configure.ac
1430 AT_SETUP([Configuring subdirectories])
1431 AT_KEYWORDS(autoreconf)
1433 # We use aclocal (via autoreconf).
1434 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
1435 AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
1437 # It should understand configure.ac.
1438 AT_CHECK([[grep '[^0-9]1\.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
1440 # Set CONFIG_SITE to a nonexistent file, so that there are
1441 # no worries about nonstandard values for 'prefix'.
1442 CONFIG_SITE=no-such-file
1445 # The contents of `inner/', and `inner/innermost/'.
1446 AS_MKDIR_P([inner/innermost])
1448 # We have to use configure.in, not configure.ac, if we still want to
1449 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
1450 # die because it can't find configure.in.
1451 AT_DATA([inner/configure.in],
1452 [[AC_INIT(GNU Inner, 1.0)
1453 AC_CONFIG_SRCDIR([innermost/config.in])
1454 AC_ARG_VAR([INNER], [an inner variable])
1456 if test "x$INNER" = x; then
1459 AC_CONFIG_FILES([innermost/config])
1463 AT_DATA([inner/innermost/config.in],
1466 top_srcdir=@top_srcdir@
1470 # The contents of `.'
1471 AT_DATA([install-sh], [])
1473 # nonexistent is allowed not to exist.
1474 AT_DATA([configure.in],
1475 [[AC_INIT(GNU Outer, 1.0)
1476 AC_ARG_VAR([OUTER], [an outer variable])
1478 AC_CONFIG_SUBDIRS([nonexistent])
1480 AC_CONFIG_SUBDIRS([inner])
1484 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
1485 # they trigger warnings from aclocal 1.8, so ignore stderr.
1486 AT_CHECK([autoreconf], [], [], [ignore])
1487 AT_CHECK([test -f inner/configure])
1489 # Running the outer configure recursively should provide the innermost
1491 chmod a-w inner/innermost inner .
1492 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep INNER], 0,
1494 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1495 chmod u+w . inner inner/innermost
1497 # Running the outer configure should trigger the inner.
1499 AT_CHECK([cat inner/innermost/config], 0,
1506 # The same, but from a builddir.
1507 AS_MKDIR_P([builddir])
1508 AT_CHECK([cd builddir && ../configure $configure_options], 0, [ignore])
1509 AT_CHECK([cat builddir/inner/innermost/config], 0,
1511 srcdir=../../../inner/innermost
1512 top_srcdir=../../../inner
1516 # Make sure precious variables and command line options are properly
1517 # passed, even when there are duplicates.
1518 AT_CHECK([cd builddir && ../configure $configure_options --prefix /bad --prefix /good INNER=bad INNER=good],
1520 AT_CHECK([cat builddir/inner/innermost/config], 0,
1522 srcdir=../../../inner/innermost
1523 top_srcdir=../../../inner
1527 # Make sure --prefix is properly quoted
1528 AT_CHECK([cd builddir && ../configure --prefix "/a b c$ 'd"], 0, [ignore])
1529 AT_CHECK([cat builddir/inner/innermost/config], 0,
1531 srcdir=../../../inner/innermost
1532 top_srcdir=../../../inner
1536 # Make sure --silent is properly passed...
1537 AT_CHECK([cd builddir && ../configure $configure_options --silent], 0, [])
1538 # ...but not stored in config.status.
1539 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1540 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1542 # --cache-file is adjusted for subdirectories, so the cache is shared.
1543 AT_CHECK([cd builddir && ../configure $configure_options --config-cache],
1545 AT_CHECK([grep 'loading .*\.\./config.cache' stdout], [], [ignore])
1547 # Make sure we can run autoreconf on a subdirectory
1548 rm -f configure configure.in
1549 AT_CHECK([autoreconf inner], [], [], [ignore])
1551 # Make sure we can pass a configure.ac name
1552 AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
1553 AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
1559 ## -------------- ##
1561 ## -------------- ##
1563 AT_SETUP([Deep Package])
1564 AT_KEYWORDS(autoreconf)
1566 # We use aclocal (via autoreconf).
1567 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1569 # The contents of `.'
1570 AT_DATA([install-sh], [])
1571 AT_DATA([configure.in],
1572 [[AC_INIT(GNU Outer, 1.0)
1573 AC_ARG_VAR([OUTER], [an outer variable])
1581 # The contents of `inner/', and `inner/innermost/'.
1582 AS_MKDIR_P([inner/innermost])
1583 AS_MKDIR_P([inner2])
1585 AT_DATA([inner/configure.in],
1586 [[AC_INIT(GNU Inner, 1.0)
1587 AC_ARG_VAR([INNER], [an inner variable])
1588 AC_CONFIG_SUBDIRS(innermost)
1592 AT_DATA([inner/innermost/configure.in],
1593 [[AC_INIT(GNU Innermost, 1.0)
1594 AC_ARG_VAR([INNERMOST], [an innermost variable])
1595 AC_CONFIG_HEADERS(config.h:config.hin)
1596 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1597 if test -n "$innermost_error"; then
1598 AC_MSG_FAILURE([error in $PACKAGE_NAME])
1603 AT_DATA([inner2/configure.in],
1604 [[AC_INIT(GNU Inner 2, 1.0)
1605 AC_ARG_VAR([INNER2], [an inner2 variable])
1609 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [stderr])
1610 # We should not warn about nonliteral argument to AC_CONFIG_SUBDIRS here.
1611 AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [1])
1612 AT_CHECK([test -f inner/configure])
1613 AT_CHECK([test -f inner/innermost/configure])
1614 AT_CHECK([test -f inner/innermost/config.hin])
1615 AT_CHECK([test -f inner2/configure])
1617 # Running the outer configure recursively should provide the innermost
1619 chmod a-w inner/innermost inner
1620 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER "],
1621 0, [ignore], [stderr],
1622 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1624 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER2 "],
1625 0, [ignore], [stderr],
1626 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1628 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1629 0, [ignore], [stderr],
1630 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1632 AT_CHECK([{ /bin/sh ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1633 0, [ignore], [stderr],
1634 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1636 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure $configure_options --help=recursive; chmod +w .; } | grep " INNERMOST "],
1637 0, [ignore], [stderr],
1638 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1640 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1641 0, [ignore], [stderr],
1642 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1643 chmod u+w inner inner/innermost
1645 # Running the outer configure should trigger the inner.
1646 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1647 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1648 [[#define INNERMOST tsomrenni
1651 # Ensure we point to the right config.log file for errors.
1652 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1653 AT_CHECK([grep 'inner/innermost' stderr], [], [ignore])
1655 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1656 AT_CHECK([grep 'innermost' stderr], [], [ignore])
1659 # The same, but from a builddir.
1660 AS_MKDIR_P([builddir])
1661 chmod a-w builddir inner/innermost inner
1662 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER "],
1663 0, [ignore], [stderr],
1664 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1666 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER2 "],
1667 0, [ignore], [stderr],
1668 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1670 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1671 0, [ignore], [stderr],
1672 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1674 AT_CHECK([cd builddir && { /bin/sh ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1675 0, [ignore], [stderr],
1676 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1678 # Not all shells search $PATH for scripts.
1679 if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure $configure_options --help) >/dev/null 2>&1; then
1680 AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure $configure_options --help=recursive | grep " INNERMOST "], 0, [ignore])
1682 AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1683 0, [ignore], [stderr],
1684 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1685 chmod u+w builddir inner inner/innermost
1686 AT_CHECK([cd builddir && ../configure $configure_options INNERMOST=build/tsomrenni], 0, [ignore])
1687 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1688 [[#define INNERMOST build/tsomrenni
1695 ## -------------------------------- ##
1696 ## Non-Autoconf AC_CONFIG_SUBDIRS. ##
1697 ## -------------------------------- ##
1699 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1700 AT_KEYWORDS([autoreconf])
1702 # We use aclocal (via autoreconf).
1703 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1705 AT_DATA([install-sh], [])
1706 AT_DATA([configure.in],
1707 [[AC_INIT(GNU Outer, 1.0)
1708 AC_CONFIG_SUBDIRS([inner])
1714 AT_DATA([inner/configure],
1717 *--help*) echo 'No Autoconf here, folks!' ;;
1718 *) echo got_it >myfile ;;
1722 chmod +x inner/configure
1724 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
1726 # Running the outer configure recursively should provide the innermost
1728 AT_CHECK([./configure $configure_options --help=recursive | grep "folks"], 0, [ignore])
1730 # Running the outer configure should trigger the inner.
1731 AT_CHECK([./configure $configure_options], 0, [ignore])
1732 AT_CHECK([test -f inner/myfile], 0)
1737 ## ------------------------------- ##
1738 ## Non-literal AC_CONFIG_SUBDIRS. ##
1739 ## ------------------------------- ##
1741 AT_SETUP([Non-literal AC_CONFIG_SUBDIRS])
1742 AT_KEYWORDS([autoreconf])
1744 AT_DATA([install-sh], [])
1745 AT_DATA([configure.in],
1746 [[AC_INIT(GNU Outer, 1.0)
1749 # Taken from autoconf.texi:Subdirectories.
1750 if test "x$package_foo_enabled" = xyes; then
1751 my_subdirs="$my_subdirs foo"
1753 AC_CONFIG_SUBDIRS([$my_subdirs])
1757 # Hand-written aclocal.m4, so we don't invoke `aclocal -Werror' which
1758 # could barf over warnings in third-party macro files, or fail over
1759 # warnings with older aclocal which didn't yet understand -W*.
1760 AT_DATA([aclocal.m4])
1764 AT_DATA([foo/configure],
1769 chmod +x foo/configure
1771 # autoreconf should warn without -Wno-syntax, but should not fail without -Werror.
1772 AT_CHECK([autoreconf -Werror -v], [1], [ignore], [stderr])
1773 AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [0], [ignore])
1774 AT_CHECK([autoreconf -v], [0], [ignore], [stderr])
1775 AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [0], [ignore])
1776 AT_CHECK([autoreconf -v --force -Wno-syntax], 0, [ignore], [stderr])
1777 AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [1])
1779 AT_CHECK([./configure $configure_options], [0], [ignore])
1780 AT_CHECK([test ! -f foo/innerfile])
1781 # Running the outer configure should trigger the inner.
1782 AT_CHECK([./configure $configure_options package_foo_enabled=yes], [0], [ignore])
1783 AT_CHECK([test -f foo/innerfile])
1788 ## ----------------- ##
1789 ## Empty directory. ##
1790 ## ----------------- ##
1792 AT_SETUP([Empty directory])
1793 AT_KEYWORDS([autoreconf])
1795 # We use aclocal (via autoreconf).
1796 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1798 # The test group directory is not necessarily _empty_, but it does not contain
1799 # files meaningful to `autoreconf'.
1801 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1807 ## ------------------------------ ##
1808 ## Unusual Automake input files. ##
1809 ## ------------------------------ ##
1811 # This parallels gnumake.test in Automake.
1813 AT_SETUP([Unusual Automake input files])
1814 AT_KEYWORDS([autoreconf])
1816 # We use aclocal and automake via autoreconf.
1817 AT_CHECK([automake --version || exit 77], [], [stdout], [ignore])
1818 AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
1820 AT_DATA([configure.in],
1821 [[AC_INIT(GNU foo, 1.0)
1823 AC_CONFIG_FILES([HeeHee])
1827 AT_DATA([HeeHee.am],
1828 [[# Humans do no worse than `GNUmakefile.am'.
1829 AUTOMAKE_OPTIONS = foreign 1.8
1832 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1833 [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1834 AT_CHECK([test -f HeeHee.in])