Avoid infinite aclocal loop.
[autoconf.git] / tests / torture.at
blob92f8d5b7561db233da5d4de7dea69db4896444e7
1 #                                                       -*- Autotest -*-
3 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 # 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 2, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
22 AT_BANNER([[Testing config.status.]])
25 ## ---------------------------------------- ##
26 ## AC_CONFIG_COMMANDS with empty commands.  ##
27 ## ---------------------------------------- ##
29 AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
30 [[AC_CONFIG_COMMANDS([foo], [], [:])
31 ]])
34 ## -------------------------- ##
35 ## Multiple AC_CONFIG_FILES.  ##
36 ## -------------------------- ##
38 AT_SETUP([Multiple AC_CONFIG_FILES])
40 AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
41 AT_CHECK_AUTOCONF([], 1, [], [ignore])
43 AT_CLEANUP
47 ## ------------ ##
48 ## AC_ARG_VAR.  ##
49 ## ------------ ##
51 # AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE, [STATUS = 1])
52 # ------------------------------------------------------------
53 # Check that AC_ARG_VAR caches the latest values, diagnoses
54 # inconsistencies, and arms config.status.  Check that recheck
55 # returns STATUS, save configure output in files 'stdout' and 'stderr'
56 # for further inspection.
57 m4_define([AT_CHECK_AC_ARG_VAR],
58 [rm -f config.cache
60 # Initial value.
61 m4_ifval([$1],
62          [precious='m4_bpatsubst([$1], [[']], ['\\''])'; export precious],
63          [unset precious])
64 AT_CHECK_CONFIGURE([--config-cache -q])
65 AT_CHECK([cat file], [], [`$1'
68 # Testing --recheck: 1. have the environment `forget' about PRECIOUS.
69 unset precious
70 # 2. Rerun config.status to recreate `file'.
71 AT_CHECK([./config.status --recheck], [], [ignore])
72 AT_CHECK([./config.status], [], [ignore])
73 # 3. Check that file contains the old value of PRECIOUS.
74 AT_CHECK([cat file], [], [`$1'
77 # Second value: we should issue an error here: the value
78 # has changed!
79 m4_ifval([$2],
80          [precious='$2'; export precious],
81          [unset precious])
82 AT_CHECK_CONFIGURE([--config-cache], [m4_default([$3], [1])], [stdout], [stderr])
84 ])# AT_CHECK_AC_ARG_VAR
87 AT_SETUP([AC_ARG_VAR])
89 # We don't want to run this test if this shell doesn't support
90 # `unset'.
91 AT_CHECK([
92 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
93   exit 0
94 else
95   exit 77
99 AT_DATA([configure.ac],
100 [[AC_INIT
101 AC_ARG_VAR([precious], [this variable costs a lot])
102 echo "precious:$precious"
103 AC_OUTPUT(file)
106 AT_DATA([file.in],
107 [[`@precious@'
110 AT_CHECK_AUTOCONF
112 # Set a precious variable
113 AT_CHECK_AC_ARG_VAR([], [apple of my eye])
115 # Unset a precious variable
116 AT_CHECK_AC_ARG_VAR([apple of my eye], [])
118 # Change a precious variable
119 AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
121 # Change a precious variable that contains braces
122 AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
124 # Change a precious variable that contains all kinds of fun
125 AT_CHECK_AC_ARG_VAR(['p  r      ec"iou$], [orange of my eye])
126 dnl restore font-lock: "
128 # Warn (but do not fail) about a whitespace-only change
129 AT_CHECK_AC_ARG_VAR([    apple  of       my eye  ], [apple of my eye],
130                     [0], ["has whitespace changes"])
131 mv stdout configure-output
132 AT_CHECK([grep "ignoring whitespace changes" stderr], [], [ignore])
133 AT_CHECK([grep "precious:        apple" configure-output], [], [ignore])
135 AT_CLEANUP
140 ## ---------------------------------------------- ##
141 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS.  ##
142 ## ---------------------------------------------- ##
144 AT_SETUP([[AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]])
146 AT_DATA([configure.ac],
147 [[AC_INIT
148 AC_PROG_FGREP
149 rm -f -r header var-header file var-file link var-link command var-command
150 echo 'OK' >input
152 # Be sure to also stress the associated INIT-CMDS.
153 case $what_to_test in
154  header)
155    AC_CONFIG_HEADERS(header:input);;
156  var-header)
157    AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
159  file)
160    AC_CONFIG_FILES(file:input);;
161  var-file)
162    AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
164  command)
165    AC_CONFIG_COMMANDS(command,
166                       [cp input command]);;
167  var-command)
168    AC_CONFIG_COMMANDS(var-command,
169                       [cp $command_in var-command], [command_in=input]);;
171  link)
172    AC_CONFIG_LINKS(link:input);;
173  var-link)
174    AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
175 esac
176 AC_OUTPUT
179 AT_CHECK_AUTOCONF
182 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
183 # ------------------------------------------------------------------
184 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
185 # are properly created, with the right content.
186 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
187 # AC_CONFIG_HEADERS.
188 m4_define([AT_CHECK_CONFIG_CREATION],
189 [AT_CHECK_CONFIGURE([what_to_test=$1])
190 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
191          [ignore], [$1
193 AT_CHECK([grep OK $1], [], [OK
196 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
197 # config.status might be stupidly expecting data on stdin, if it's
198 # really broken...
199 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
200 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
201          [ignore], [var-$1
203 AT_CHECK([grep OK var-$1], [], [OK
205 ])# AT_CHECK_CONFIG_CREATION
208 # AT_CHECK_CONFIG_CREATION_NOWRITE(THING = (header | link | file | command))
209 # ------------------------------------------------------------------
210 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
211 # are properly created, with the right content.
212 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
213 # AC_CONFIG_HEADERS.
214 m4_define([AT_CHECK_CONFIG_CREATION_NOWRITE],
215 [AT_CHECK_CONFIGURE([what_to_test=$1])
216 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
217          [ignore], [$1
219 AT_CHECK([grep OK $1], [], [OK
222 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
223 # config.status might be stupidly expecting data on stdin, if it's
224 # really broken...
225 # Skip check if user can rename files into a read-only directory (when
226 # run by root or on w32).
227 touch t
228 chmod a-w .
229 mv t t1 >/dev/null 2>&1 \
230   || AT_CHECK([./config.status var-$1 </dev/null], [1], [ignore], [ignore])
231 chmod u+w .
232 rm -rf t t1
233 ])# AT_CHECK_CONFIG_CREATION_NOWRITE
236 # Create a file
237 AT_CHECK_CONFIG_CREATION(file)
239 # Create a header
240 AT_CHECK_CONFIG_CREATION(header)
242 # Execute a command
243 AT_CHECK_CONFIG_CREATION(command)
245 # Create a link
246 AT_CHECK_CONFIG_CREATION(link)
248 # Now check for write errors
250 # Create a file
251 AT_CHECK_CONFIG_CREATION_NOWRITE(file)
252 # Create a file with bits from stdin
253 AT_CHECK([echo from-stdin | ./config.status --file=file:-],
254          [0], [ignore])
255 AT_CHECK([grep from-stdin file], [], [from-stdin
257 # Force write error creating a file on stdout
258 if test -w /dev/full && test -c /dev/full; then
259   AT_CHECK([./config.status --file=-:input </dev/null >/dev/full],
260            [1], [ignore], [ignore])
263 # Create a header
264 AT_CHECK_CONFIG_CREATION_NOWRITE(header)
265 # Create a header on stdout
266 AT_CHECK([./config.status --header=-:input </dev/null],
267          [0], [stdout], [ignore])
268 AT_CHECK([grep OK stdout], [], [OK
270 # Force write error creating a header on stdout
271 if test -w /dev/full && test -c /dev/full; then
272   AT_CHECK([./config.status --header=-:input </dev/null >/dev/full],
273            [1], [ignore], [ignore])
276 # Execute a command
277 AT_CHECK_CONFIG_CREATION_NOWRITE(command)
279 # Create a link
280 AT_CHECK_CONFIG_CREATION_NOWRITE(link)
282 # Check that no use of `ac_write_fail' escaped into config.status
283 AT_CHECK([grep ac_write_fail config.status], [1])
285 # Check that --file and --header accept funny file names
286 AT_DATA([fgrep.in],
287 [[FGREP="@FGREP@"
289 ./config.status --file=fgrep:fgrep.in
290 . ./fgrep
293 export x
294 for file in \
295   'with  funny '\'' $x & #! name' \
296   'file with  funny \ '\'' \'\'' $ & #!*? name' \
297   'with  funny \ '\'' \'\'' " | <a >b & * ? name ' # "restore font-lock
299   # The function func_sanitize_file_name comes from tools.at
300   file=`func_sanitize_file_name "$file"`
301   cat >"$file.in" <<'END'
302 @configure_input@
304   AT_CHECK([./config.status "--file=$file:$file.in"],
305            [0], [ignore])
306   AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
307   AT_CHECK([./config.status "--header=$file:$file.in"],
308            [0], [ignore])
309   # Run the same test a 2nd time to see that config.status does not recreate
310   # the header (regression test)
311   AT_CHECK_NOESCAPE([./config.status "--header=$file:$file.in"],
312                     [0], [config.status: creating $file
313 config.status: $file is unchanged
315   AT_CHECK_NOESCAPE([grep ' & ' "$file"], [],
316 [/* $file.  Generated from $file.in by configure.  */
318   AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
319 done
320 AT_CLEANUP
324 ## ---------------------------------------- ##
325 ## Macro calls in AC_CONFIG_COMMANDS tags.  ##
326 ## ---------------------------------------- ##
328 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
330 AT_DATA_M4SUGAR([configure.ac],
331 [[AC_INIT
332 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
333 AC_OUTPUT
336 AT_CHECK_AUTOCONF
337 AT_CHECK_CONFIGURE
339 AT_CLEANUP
343 ## ------------------- ##
344 ## Missing templates.  ##
345 ## ------------------- ##
347 # Check that config.status detects missing input files
348 AT_SETUP([Missing templates])
350 AT_DATA([configure.ac],
351 [[AC_INIT
352 AC_CONFIG_FILES([nonexistent])
353 AC_OUTPUT
356 AT_CHECK_AUTOCONF
357 AT_CHECK_CONFIGURE([], [1], [],
358 [[config.status: error: cannot find input file: nonexistent.in
360 # Make sure that the output file doesn't exist
361 AT_CHECK([test -f nonexistent], 1)
363 AT_CLEANUP
368 ## ---------------------- ##
369 ## configure invocation.  ##
370 ## ---------------------- ##
372 # Check that `configure' and `config.status' honor their interface.
374 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
375 # and verify that (i) `configure' correctly receives the arguments,
376 # (ii) correctly passes them to `config.status', which we check by
377 # running `config.status --recheck', and (iii) correctly passes them
378 # to sub-configure scripts.
380 AT_SETUP([configure invocation])
382 mkdir sub
384 AT_DATA([configure.ac],
385 [[AC_INIT
386 AC_CONFIG_SUBDIRS([sub])
387 echo "result=$one$enable_two$with_three"
388 AC_OUTPUT
391 AT_DATA([sub/configure.ac],
392 [[AC_INIT
393 echo "result=$one$enable_two$with_three"
394 AC_OUTPUT
397 echo fake install-sh script >install-sh
399 AT_CHECK_AUTOCONF
400 cd sub
401 AT_CHECK_AUTOCONF
402 cd ..
404 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
405                      sed -n -e 's/^result=//p'], 0,
406                    [m4_do([onetwothree
407 ],                        [onetwothree
408 ])])
409 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
410          [onetwothree
413 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" '  $" --with-three="   \"'$"|
414                       sed -n -e 's/^result=//p'], 0,
415                    [m4_do(["'$ " '  $   "'$
416 ],                        ["'$ " '  $   "'$
417 ])])
418 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
419          ["'$ " '  $    "'$
421 dnl restore font-lock: "
423 AT_CLEANUP
427 ## -------------------------------------------- ##
428 ## Check that `#define' templates are honored.  ##
429 ## -------------------------------------------- ##
431 # Use various forms of `#define' templates, and make sure there are no
432 # problems when a symbol is prefix of another.
434 AT_SETUP([@%:@define header templates])
436 AT_DATA([configure.ac],
437 [[AC_INIT
438 AC_CONFIG_HEADERS(config.h:config.hin)
440 # I18n of dummy variables: their French translations.
441 AC_DEFINE(foo, toto)
442 AC_DEFINE(bar, tata)
443 AC_DEFINE(baz, titi)
444 AC_DEFINE(fubar, tutu)
446 # Symbols which are prefixes of another.
447 AC_DEFINE(a, A)
448 AC_DEFINE(aaa, AAA)
449 AC_DEFINE(aa, AA)
451 # backslash-newline combinations
452 AC_DEFINE([multiline], [line1\
453 line2\
454 line3 \
455 line4])
456 AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
457 ARG1])
458 AC_CONFIG_FILES(defs)
460 # Things included in confdefs.h, but which make no sense in
461 # config.h, nor in $DEFS.
462 cat <<\EOF >>confdefs.h
463 /* Hi Mum! Look, I am doing C++! */
464 #ifdef __cplusplus
465 void exit (int status);
466 #endif
469 # In addition of config.h output a full DEFS
470 AC_OUTPUT_MAKE_DEFS
471 DEFS_SAVED=$DEFS
472 AC_SUBST(DEFS_SAVED)
473 AC_OUTPUT
476 AT_DATA([defs.in],
477 [[@DEFS_SAVED@
480 AT_DATA([config.hin],
481 [[#define foo   0
482 #  define bar bar
483 #  define baz   "Archimedes was sinking in his baz"
484   #  define fubar                               tutu
485 #define a B
486  #define aa BB
487  #  define aaa BBB
488 #undef a
489  #  undef aa
490 #undef aaa
491 #define aaa(a, aa) aa a
492 #define aaab
493 #define aaac(a, aa) aa a
494 #undef multiline
495 #  undef multiline_args
496 /* an ugly one: */
497 #define str(define) \
498 #define
499 #define stringify(arg) str(arg)
500 #undef aaa /* with comments */
501 #undef not_substed /* with comments */
504 AT_CHECK_AUTOCONF
505 AT_CHECK_CONFIGURE
507 AT_DATA([expout],
508 [[/* config.h.  Generated from config.hin by configure.  */
509 #define foo toto
510 #  define bar tata
511 #  define baz titi
512   #  define fubar tutu
513 #define a A
514  #define aa AA
515  #  define aaa AAA
516 #define a A
517  #  define aa AA
518 #define aaa AAA
519 #define aaa AAA
520 #define aaab
521 #define aaac(a, aa) aa a
522 #define multiline line1\
523 line2\
524 line3 \
525 line4
526 #  define multiline_args(ARG1, ARG2) ARG2 \
527 ARG1
528 /* an ugly one: */
529 #define str(define) \
530 #define
531 #define stringify(arg) str(arg)
532 #define aaa AAA
533 /* #undef not_substed */
535 AT_CHECK([cat config.h], 0, expout)
537 # Check the value of DEFS.
538 AT_DATA([expout],
539 [[-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
542 # Because we strip trailing spaces in `testsuite' we can't leave one in
543 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
544 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
546 AT_CLEANUP
550 ## ------------------------- ##
551 ## Torturing config.status.  ##
552 ## ------------------------- ##
554 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
555 ## big value.  This is mostly to check that Autoconf produces portable sed
556 ## scripts in config.status.  sed is used to skip the first two lines
557 ## `Generated by...'.
559 # We use m4_for many times.
560 m4_pattern_allow([^m4_for$])
562 AT_SETUP([Torturing config.status])
564 dnl The value used as a big value for AC_DEFINE.
565 dnl Don't use sh active chars here, below it is also used in a sh
566 dnl assignment.
567 m4_define([AT_BIG_VALUE],
568 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
570 m4_define([AT_DESCRIPTION],
571 [Define to a long string if your `Autoconf' works properly.])
574 # AT_DUMMY_VAR(NUMBER)
575 # --------------------
576 # Build a name used for AC_SUBST and AC_DEFINE.  Put ac_ in it
577 # so that the check for user name space invasion does not complain
578 # of the new variables defined.
580 # Note that you should not use the name ac_dummy, because it will be
581 # turned into ac_uummy during the construction of config.status.  Yes,
582 # this is admittedly a bug, but it would be too hard to fix this.
583 # There is really no point in AC_DEFINE a var named ac_d.*.
584 m4_pattern_allow([^m4_bpatsubst$])
585 m4_define([AT_DUMMY_VAR],
586 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
590 AT_DATA([dummy.in],
591 [m4_for([AT_Count], 1, 100, 1,
592 [@AT_DUMMY_VAR(AT_Count)@
593 @[f]AT_Count@
594 ])])
598 while test $i != 101; do
599   echo "content of file $i" > file_$i
600   i=`expr $i + 1`
601 done
604 # ------------ #
605 # configure.ac #
606 # ------------ #
608 m4_pattern_allow([^m4_(define|defun)$])
609 AT_DATA([configure.ac],
610 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
611 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
612 [[m4_define([AC_DUMMY_VAR],]
613 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
615 [[m4_define([AC_DESCRIPTION],]
616 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
618 [[m4_define([AC_BIG_VALUE],]
619 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
621 [[# AC_DEFUBST(NAME)
622 # ----------------
623 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE.  This is
624 # used in the torture tests.
625 m4_defun([AC_DEFUBST],
626 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
627 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
628                    AC_DESCRIPTION)
629 AC_SUBST(AC_DUMMY_VAR($1))
630 AC_SUBST_FILE([f]$1)
631 f$1=file_$1
634 AC_INIT
635 AC_CONFIG_HEADERS(config.h:config.hin)
636 AC_CONFIG_FILES(dummy)
637 m4_for(AC_Count, 1, 100, 1,
638        [AC_DEFUBST(AC_Count)])
639 AC_PROG_AWK
640 AC_OUTPUT
641 ]])# configure.ac
643 AT_CHECK_AUTOCONF
644 AT_CHECK_AUTOHEADER
645 # Check both awk and the result of AC_PROG_AWK
646 for awk_arg in FOO= AWK=awk; do
647   AT_CHECK_CONFIGURE([$awk_arg])
649   # Checking that AC_DEFINE worked properly.
650   AT_DATA([expout],
651 [/* Define to the address where bug reports for this package should be sent. */
652 #define PACKAGE_BUGREPORT ""
654 /* Define to the full name of this package. */
655 #define PACKAGE_NAME ""
657 /* Define to the full name and version of this package. */
658 #define PACKAGE_STRING ""
660 /* Define to the one symbol short name of this package. */
661 #define PACKAGE_TARNAME ""
663 /* Define to the version of this package. */
664 #define PACKAGE_VERSION ""
665 m4_for(AT_Count, 1, 100, 1,
667 /* AT_DESCRIPTION */
668 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
669 ])])
671   AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
673   # Checking that AC_SUBST worked properly.
674   AT_DATA([expout],
675 [m4_for(AT_Count, 1, 100, 1,
676 [AT_BIG_VALUE
677 content of file AT_Count
678 ])])
680   AT_CHECK([cat dummy], 0, expout)
681 done
683 AT_CLEANUP
686 ## ------------------------------- ##
687 ## Substitute a 2000-byte string.  ##
688 ## ------------------------------- ##
690 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes.  HP/UX
691 # sed dumps core around 8 KiB.  However, POSIX says that sed need not
692 # handle lines longer than 2048 bytes (including the trailing newline).
693 # So we'll just test a 2000-byte value, and for awk, we test a line with
694 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
695 # multi-line values should allow to get around the limitations.
697 AT_SETUP([Substitute a 2000-byte string])
699 AT_DATA([Foo.in], [@foo@
701 AT_DATA([Bar.in], [@bar@
703 AT_DATA([Baz.in], [@baz@
706 AT_DATA([configure.ac],
707 [[AC_INIT
708 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
709 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
710 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
712 baz=$baz$baz$baz$baz$baz
713 AC_SUBST([baz])
714 AC_PROG_AWK
715 AC_CONFIG_FILES([Foo Bar Baz])
716 AC_OUTPUT
719 cp "$abs_top_srcdir/build-aux/install-sh" .
721 AT_CHECK_AUTOCONF
722 # Check both awk and the result of AC_PROG_AWK
723 for awk_arg in Foo= AWK=awk; do
724   AT_CHECK_CONFIGURE([$awk_arg])
725   AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
727   AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
729   AT_DATA([stdout],
730   [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
732   AT_CHECK([cat Baz], 0, [stdout])
733 done
734 AT_CLEANUP
737 ## ------------------------------ ##
738 ## Define to a 2000-byte string.  ##
739 ## ------------------------------ ##
741 AT_SETUP([Define to a 2000-byte string])
743 AT_CONFIGURE_AC(
745 AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
748 AT_CHECK_AUTOCONF
749 AT_CHECK_AUTOHEADER
750 AT_CHECK_CONFIGURE
751 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
753 AT_CLEANUP
756 ## ------------------------------------------ ##
757 ## Substitute and define special characters.  ##
758 ## ------------------------------------------ ##
760 # Use characters special to the shell, sed, awk, and M4.
762 AT_SETUP([Substitute and define special characters])
764 AT_DATA([Foo.in], [@foo@
765 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
766 abc@bar@baz@baz
767 abc@bar@@baz@baz
768 abc@bar@@baz@baz@
769 abc@bar @baz@baz
770 abc@bar @baz@baz@
771 abc@bar @baz@@baz@
772 @file@
773          @file@
774 X@file@
775 @file@X
778 AT_DATA([File],
779 [@foo@@bar@
782 AT_DATA([Zardoz.in], [@zardoz@
785 AT_CONFIGURE_AC(
786 [[foo="AS@&t@_ESCAPE([[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
787 bar="@foo@ @baz@"
788 baz=bla
789 ( for i in 0 1 2 3; do
790     for j in 0 1 2 3 4 5 6 7; do
791       for k in 0 1 2 3 4 5 6 7; do
792         case $i$j$k in #(
793         000 | 015 | 377) ;; # MinGW awk dislikes 0xFF, and the test does
794                             # the wrong thing for CR on MinGW.
795                             #(
796         *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
797         esac
798       done
799     done
800   done
801   printf \\n
802 ) >allowed-chars
803 zardoz=`cat allowed-chars`
804 AC_SUBST([foo])
805 AC_SUBST([bar])
806 AC_SUBST([baz])
807 AC_SUBST([zardoz])
808 file=File
809 AC_SUBST_FILE([file])
810 AC_DEFINE([foo], [[X*'[]+ ",& &`\($foo !]], [Awful value.])
811 AC_DEFINE([bar], [[%!_!# X]], [Value that is used as special delimiter.])
812 AC_PROG_AWK
813 AC_CONFIG_FILES([Foo Zardoz])]])
815 AT_CHECK_AUTOCONF
816 AT_CHECK_AUTOHEADER
817 # Check both awk and the result of AC_PROG_AWK
818 for awk_arg in FOO= AWK=awk; do
819   AT_CHECK_CONFIGURE([$awk_arg])
820   AT_CHECK([cat Foo], 0, [[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
821 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
822 abc@foo@ @baz@baz@baz
823 abc@foo@ @baz@blabaz
824 abc@foo@ @baz@blabaz@
825 abc@bar blabaz
826 abc@bar blabaz@
827 abc@bar blabla
828 @foo@@bar@
829 @foo@@bar@
830 X@file@
831 @file@X
833   AT_CHECK([cmp allowed-chars Zardoz])
834   AT_CHECK_DEFINES([[#define bar %!_!# X
835 #define foo X*'[]+ ",& &`\($foo !
837 done
838 AT_CLEANUP
841 ## ---------------------- ##
842 ## Substitute a newline.  ##
843 ## ---------------------- ##
845 AT_SETUP([Substitute a newline])
847 AT_DATA([Foo.in],
848 [@foo@
849 @bar@
852 AT_DATA([configure.ac],
853 [[AC_INIT
854 foo='one
855 two'
856 bar='%!_!# ''
858 AC_SUBST([foo])
859 AC_SUBST([bar])
860 AC_CONFIG_FILES([Foo])
861 AC_PROG_AWK
862 AC_OUTPUT
865 cp "$abs_top_srcdir/build-aux/install-sh" .
867 echo 'one
869 %!_!# ''
870 x' >expout
872 AT_CHECK_AUTOCONF
873 # Check both awk and the result of AC_PROG_AWK
874 for awk_arg in FOO= AWK=awk; do
875   AT_CHECK_CONFIGURE([$awk_arg])
876   AT_CHECK([cat Foo], 0, [expout])
877 done
878 AT_CLEANUP
881 ## ------------------ ##
882 ## Define a newline.  ##
883 ## ------------------ ##
885 AT_SETUP([Define a newline])
886 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
887 two], [This spans two lines.])
889 AT_CHECK_AUTOCONF([], [], [], [stderr])
890 dnl Older versions of m4 report error at line 5 (end of macro);
891 dnl newer versions report it at line 4 (start of macro).
892 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
893 [[warning: AC_DEFINE: `one
894 two' is not a valid preprocessor define value
896 AT_CHECK_AUTOHEADER([], [], [], [stderr])
897 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
898 [[warning: AC_DEFINE: `one
899 two' is not a valid preprocessor define value
901 AT_CHECK_CONFIGURE
902 AT_CHECK_DEFINES([[#define foo one
905 AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
906 two], [This spans two lines.])
908 AT_CHECK_AUTOCONF([], [], [], [stderr])
909 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
910 [[warning: AC_DEFINE_UNQUOTED: `one
911 two' is not a valid preprocessor define value
913 AT_CHECK_AUTOHEADER([], [], [], [stderr])
914 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
915 [[warning: AC_DEFINE_UNQUOTED: `one
916 two' is not a valid preprocessor define value
918 AT_CHECK_CONFIGURE
919 AT_CHECK_DEFINES([[#define foo one
922 AT_CLEANUP
925 ## ------------------------------------ ##
926 ## AC_SUBST: variable name validation.  ##
927 ## ------------------------------------ ##
929 AT_SETUP([AC_SUBST: variable name validation])
931 AT_CONFIGURE_AC([[AC_SUBST(, [])
932 AC_CONFIG_FILES([Makefile])
934 AT_DATA([Makefile.in], [[
936 mv -f configure.ac configure.tmpl
938 # Invalid names.
939 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
940   sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
941   AT_CHECK_AUTOCONF([], [1], [], [ignore])
942 done
944 # Valid names.
945 for var in ab a4 'a@@&t@\&t@b'; do
946   sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
947   AT_CHECK_AUTOCONF
948   AT_CHECK_AUTOHEADER
949   AT_CHECK_CONFIGURE
950 done
952 AT_CLEANUP
955 ## ------------------------ ##
956 ## datarootdir workaround.  ##
957 ## ------------------------ ##
959 AT_SETUP([datarootdir workaround])
961 AT_DATA([Foo.in],
962 [@datadir@
963 @docdir@
964 @infodir@
965 @localedir@
966 @mandir@
969 AT_DATA([Bar.in],
970 [@mydatadir@
973 AT_DATA([configure.ac],
974 [[AC_INIT
975 d@&t@nl The following line silences the warnings, if uncommented:
976 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
978 # This substitution is wrong and bogus!  Don't use it in your own code!
979 # Read `info Autoconf "Defining Directories"'!
980 AC_SUBST([mydatadir], [${datadir}/my])
982 AC_CONFIG_FILES([Foo Bar])
983 AC_OUTPUT
986 cp "$abs_top_srcdir/build-aux/install-sh" .
988 AT_CHECK_AUTOCONF
989 AT_CHECK_CONFIGURE([], [], [],
990   [config.status: WARNING:  'Foo.in' seems to ignore the --datarootdir setting
991 config.status: WARNING: Bar contains a reference to the variable `datarootdir'
992 which seems to be undefined.  Please make sure it is defined.
994 AT_CHECK([grep datarootdir Foo], 1, [])
996 rm configure
997 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
998 mv t configure.ac
1000 AT_CHECK_AUTOCONF
1001 AT_CHECK_CONFIGURE
1003 AT_CLEANUP
1006 ## -------- ##
1007 ## srcdir.  ##
1008 ## -------- ##
1010 AT_SETUP([srcdir])
1012 rm -f -r at-dir
1013 mkdir at-dir
1014 : >at-dir/bar.in
1015 : >foo.in
1017 AT_DATA([configure.ac],
1018 [[AC_INIT
1020 AC_CONFIG_FILES([foo at-dir/bar])
1022 # Use quotes in the INIT-COMMANDS to accommodate a value of $srcdir
1023 # containing e.g., spaces or shell meta-characters.
1024 # Use *single* quotes because the context is an unquoted here-doc.
1025 AC_CONFIG_COMMANDS([report],
1026 [test -f "$srcdir/configure.ac" ||
1027    AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
1028                    [srcdir='$srcdir'])
1030 AC_OUTPUT
1031 rm -f -r foo at-dir/bar
1034 AT_CHECK_AUTOCONF
1036 # In place.
1037 AT_CHECK([./configure], [], [ignore])
1039 # Relative name.
1040 AT_CHECK([cd at-dir && ../configure], [], [ignore])
1042 # Absolute name.
1043 at_here=`pwd`
1044 AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
1046 AT_CLEANUP
1049 ## ----------------- ##
1050 ## Signal handling.  ##
1051 ## ----------------- ##
1053 AT_SETUP([Signal handling])
1055 AT_DATA([configure.ac],
1056 [[AC_INIT
1057 kill -2 $$
1058 exit 77
1061 AT_CHECK_AUTOCONF
1062 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
1064 AT_CLEANUP
1067 ## ------------------------------------- ##
1068 ## AC_CONFIG_LINKS and identical files.  ##
1069 ## ------------------------------------- ##
1070 AT_SETUP([AC_CONFIG_LINKS and identical files])
1072 AT_DATA([configure.ac],
1073 [[AC_INIT
1074 AC_CONFIG_LINKS([src/s:src/s])
1075 test "$srcdir" != '.' && AC_CONFIG_LINKS([src/t:src/t])
1076 AC_OUTPUT
1079 mkdir src build
1080 echo file1 > src/s
1081 echo file2 > src/t
1082 AT_CHECK_AUTOCONF
1083 cd build
1084 AT_CHECK([../configure && ../configure], 0, [ignore])
1085 AT_CHECK([cat src/s src/t], 0, [file1
1086 file2
1088 cd ..
1089 AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
1090 AT_CHECK([grep src/t stderr], 1)
1091 AT_CHECK([cat src/s src/t], 0, [file1
1092 file2
1094 AT_CHECK(["`pwd`"/configure && "`pwd`"/configure], 0, [ignore], [ignore])
1095 AT_CHECK([cat src/s src/t], 0, [file1
1096 file2
1099 AT_CLEANUP
1102 AT_BANNER([autoreconf.])
1104 ## ---------------------------- ##
1105 ## Configuring subdirectories.  ##
1106 ## ---------------------------- ##
1108 # .
1109 # |-- builddir
1110 # |   |-- config.log
1111 # |   |-- config.status
1112 # |   `-- inner
1113 # |       |-- config.log
1114 # |       |-- config.status
1115 # |       `-- innermost
1116 # |           `-- config
1117 # |-- configure
1118 # |-- configure.ac
1119 # |-- inner
1120 # |   |-- configure
1121 # |   |-- configure.ac
1122 # |   `-- innermost
1123 # |       `-- config.in
1124 # `-- install-sh
1126 AT_SETUP([Configuring subdirectories])
1127 AT_KEYWORDS(autoreconf)
1129 # We use aclocal (via autoreconf).
1130 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
1131 # It should understand configure.ac.
1132 AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
1134 # Set CONFIG_SITE to a nonexistent file, so that there are
1135 # no worries about nonstandard values for 'prefix'.
1136 CONFIG_SITE=no-such-file
1137 export CONFIG_SITE
1139 # The contents of `inner/', and `inner/innermost/'.
1140 AS_MKDIR_P([inner/innermost])
1142 # We have to use configure.in, not configure.ac, if we still want to
1143 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
1144 # die because it can't find configure.in.
1145 AT_DATA([inner/configure.in],
1146 [[AC_INIT(GNU Inner, 1.0)
1147 AC_CONFIG_SRCDIR([innermost/config.in])
1148 AC_ARG_VAR([INNER], [an inner variable])
1149 AC_SUBST([INNER])
1150 if test "x$INNER" = x; then
1151   INNER=inner
1153 AC_CONFIG_FILES([innermost/config])
1154 AC_OUTPUT
1157 AT_DATA([inner/innermost/config.in],
1158 [INNER=@INNER@
1159 srcdir=@srcdir@
1160 top_srcdir=@top_srcdir@
1161 prefix=@prefix@
1164 # The contents of `.'
1165 AT_DATA([install-sh], [])
1167 # nonexistent is allowed not to exist.
1168 AT_DATA([configure.in],
1169 [[AC_INIT(GNU Outer, 1.0)
1170 AC_ARG_VAR([OUTER], [an outer variable])
1171 if false; then
1172   AC_CONFIG_SUBDIRS([nonexistent])
1174 AC_CONFIG_SUBDIRS([inner])
1175 AC_OUTPUT
1178 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
1179 # they trigger warnings from aclocal 1.8, so ignore stderr.
1180 AT_CHECK([autoreconf], [], [], [ignore])
1181 AT_CHECK([test -f inner/configure])
1183 # Running the outer configure recursively should provide the innermost
1184 # help strings.
1185 chmod a-w inner/innermost inner .
1186 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep INNER], 0,
1187          [ignore], [stderr],
1188          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1189 chmod u+w . inner inner/innermost
1191 # Running the outer configure should trigger the inner.
1192 AT_CHECK_CONFIGURE
1193 AT_CHECK([cat inner/innermost/config], 0,
1194 [INNER=inner
1195 srcdir=.
1196 top_srcdir=..
1197 prefix=/usr/local
1200 # The same, but from a builddir.
1201 AS_MKDIR_P([builddir])
1202 AT_CHECK([cd builddir && ../configure], 0, [ignore])
1203 AT_CHECK([cat builddir/inner/innermost/config], 0,
1204 [INNER=inner
1205 srcdir=../../../inner/innermost
1206 top_srcdir=../../../inner
1207 prefix=/usr/local
1210 # Make sure precious variables and command line options are properly
1211 # passed, even when there are duplicates.
1212 AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
1213 AT_CHECK([cat builddir/inner/innermost/config], 0,
1214 [INNER=good
1215 srcdir=../../../inner/innermost
1216 top_srcdir=../../../inner
1217 prefix=/good
1220 # Make sure --prefix is properly quoted
1221 AT_CHECK([cd builddir && ../configure --prefix "/a  b c$ 'd"], 0, [ignore])
1222 AT_CHECK([cat builddir/inner/innermost/config], 0,
1223 [INNER=inner
1224 srcdir=../../../inner/innermost
1225 top_srcdir=../../../inner
1226 prefix=/a  b c$ 'd
1229 # Make sure --silent is properly passed...
1230 AT_CHECK([cd builddir && ../configure --silent], 0, [])
1231 # ...but not stored in config.status.
1232 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1233 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1235 # Make sure we can run autoreconf on a subdirectory
1236 rm -f configure configure.in
1237 AT_CHECK([autoreconf inner], [], [], [ignore])
1239 # Make sure we can pass a configure.ac name
1240 AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
1241 AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
1243 AT_CLEANUP
1247 ## -------------- ##
1248 ## Deep Package.  ##
1249 ## -------------- ##
1251 AT_SETUP([Deep Package])
1252 AT_KEYWORDS(autoreconf)
1254 # We use aclocal (via autoreconf).
1255 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1257 # The contents of `.'
1258 AT_DATA([install-sh], [])
1259 AT_DATA([configure.in],
1260 [[AC_INIT(GNU Outer, 1.0)
1261 AC_ARG_VAR([OUTER], [an outer variable])
1262 AC_CONFIG_SUBDIRS([inner inner2])
1263 AC_OUTPUT
1266 # The contents of `inner/', and `inner/innermost/'.
1267 AS_MKDIR_P([inner/innermost])
1268 AS_MKDIR_P([inner2])
1270 AT_DATA([inner/configure.in],
1271 [[AC_INIT(GNU Inner, 1.0)
1272 AC_ARG_VAR([INNER], [an inner variable])
1273 AC_CONFIG_SUBDIRS(innermost)
1274 AC_OUTPUT
1277 AT_DATA([inner/innermost/configure.in],
1278 [[AC_INIT(GNU Innermost, 1.0)
1279 AC_ARG_VAR([INNERMOST], [an innermost variable])
1280 AC_CONFIG_HEADERS(config.h:config.hin)
1281 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1282 if test -n "$innermost_error"; then
1283   AC_MSG_FAILURE([Error in $PACKAGE_NAME])
1285 AC_OUTPUT
1288 AT_DATA([inner2/configure.in],
1289 [[AC_INIT(GNU Inner 2, 1.0)
1290 AC_ARG_VAR([INNER2], [an inner2 variable])
1291 AC_OUTPUT
1294 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
1295 AT_CHECK([test -f inner/configure])
1296 AT_CHECK([test -f inner/innermost/configure])
1297 AT_CHECK([test -f inner/innermost/config.hin])
1298 AT_CHECK([test -f inner2/configure])
1300 # Running the outer configure recursively should provide the innermost
1301 # help strings.
1302 chmod a-w inner/innermost inner
1303 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER "],
1304          0, [ignore], [stderr],
1305          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1306 chmod a-w .
1307 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER2 "],
1308          0, [ignore], [stderr],
1309          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1310 chmod a-w .
1311 AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1312          0, [ignore], [stderr],
1313          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1314 chmod a-w .
1315 AT_CHECK([{ /bin/sh ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1316          0, [ignore], [stderr],
1317          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1318 chmod a-w .
1319 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure --help=recursive; chmod +w .; } | grep " INNERMOST "],
1320          0, [ignore], [stderr],
1321          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1322 chmod a-w .
1323 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1324          0, [ignore], [stderr],
1325          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1326 chmod u+w inner inner/innermost
1328 # Running the outer configure should trigger the inner.
1329 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1330 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1331 [[#define INNERMOST tsomrenni
1334 # Ensure we point to the right config.log file for errors.
1335 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1336 AT_CHECK([grep 'inner/innermost' stderr], [], [ignore])
1337 cd inner
1338 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1339 AT_CHECK([grep 'innermost' stderr], [], [ignore])
1340 cd ..
1342 # The same, but from a builddir.
1343 AS_MKDIR_P([builddir])
1344 chmod a-w builddir inner/innermost inner
1345 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNER "],
1346          0, [ignore], [stderr],
1347          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1348 chmod a-w builddir
1349 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNER2 "],
1350          0, [ignore], [stderr],
1351          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1352 chmod a-w builddir
1353 AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1354          0, [ignore], [stderr],
1355          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1356 chmod a-w builddir
1357 AT_CHECK([cd builddir && { /bin/sh ../configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1358          0, [ignore], [stderr],
1359          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1360 chmod a-w builddir
1361 # Not all shells search $PATH for scripts.
1362 if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help) >/dev/null 2>&1; then
1363   AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help=recursive | grep " INNERMOST "], 0, [ignore])
1365 AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1366          0, [ignore], [stderr],
1367          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1368 chmod u+w builddir inner inner/innermost
1369 AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
1370 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1371 [[#define INNERMOST build/tsomrenni
1374 AT_CLEANUP
1378 ## -------------------------------- ##
1379 ## Non-Autoconf AC_CONFIG_SUBDIRS.  ##
1380 ## -------------------------------- ##
1382 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1383 AT_KEYWORDS([autoreconf])
1385 # We use aclocal (via autoreconf).
1386 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1388 AT_DATA([install-sh], [])
1389 AT_DATA([configure.in],
1390 [[AC_INIT(GNU Outer, 1.0)
1391 AC_CONFIG_SUBDIRS([inner])
1392 AC_OUTPUT
1395 AS_MKDIR_P([inner])
1397 AT_DATA([inner/configure],
1398 [[#! /bin/sh
1399 case "$*" in
1400     *--help*) echo 'No Autoconf here, folks!' ;;
1401     *)        echo got_it >myfile ;;
1402 esac
1403 exit 0
1405 chmod +x inner/configure
1407 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
1409 # Running the outer configure recursively should provide the innermost
1410 # help strings.
1411 AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
1413 # Running the outer configure should trigger the inner.
1414 AT_CHECK([./configure], 0, [ignore])
1415 AT_CHECK([test -f inner/myfile], 0)
1417 AT_CLEANUP
1421 ## ----------------- ##
1422 ## Empty directory.  ##
1423 ## ----------------- ##
1425 AT_SETUP([Empty directory])
1426 AT_KEYWORDS([autoreconf])
1428 # We use aclocal (via autoreconf).
1429 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1431 # The test group directory is not necessarily _empty_, but it does not contain
1432 # files meaningful to `autoreconf'.
1434 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1436 AT_CLEANUP
1440 ## ------------------------------ ##
1441 ## Unusual Automake input files.  ##
1442 ## ------------------------------ ##
1444 # This parallels gnumake.test in Automake.
1446 AT_SETUP([Unusual Automake input files])
1447 AT_KEYWORDS([autoreconf])
1449 # We use aclocal and automake via autoreconf.
1450 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1452 AT_DATA([configure.in],
1453 [[AC_INIT(GNU foo, 1.0)
1454 AM_INIT_AUTOMAKE
1455 AC_CONFIG_FILES([HeeHee])
1456 AC_OUTPUT
1459 AT_DATA([HeeHee.am],
1460 [[# Humans do no worse than `GNUmakefile.am'.
1461 AUTOMAKE_OPTIONS = foreign 1.8
1464 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1465          [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1466 AT_CHECK([test -f HeeHee.in])
1468 AT_CLEANUP