Fix typo in previous patch.
[autoconf.git] / tests / torture.at
blob1eefd71b8246ac47984680237b49c6d6dc38d085
1 #                                                       -*- Autotest -*-
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], [], [:])
29 ]])
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])
41 AT_CLEANUP
44 ## ------------------------------- ##
45 ## parameterized AC_CONFIG_FILES.  ##
46 ## ------------------------------- ##
48 AT_SETUP([Parameterized AC_CONFIG_FILES])
50 AT_CONFIGURE_AC([[
51 files="foo
52 bar"
53 AC_CONFIG_FILES([$files])]])
54 AT_CHECK_AUTOCONF([], [], [], [ignore])
55 touch foo.in bar.in config.hin
56 AT_CHECK_CONFIGURE
58 AT_CLEANUP
62 ## ------------ ##
63 ## AC_ARG_VAR.  ##
64 ## ------------ ##
66 # AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE, [STATUS = 1])
67 # ------------------------------------------------------------
68 # Check that AC_ARG_VAR caches the latest values, diagnoses
69 # inconsistencies, and arms config.status.  Check that recheck
70 # returns STATUS, save configure output in files 'stdout' and 'stderr'
71 # for further inspection.
72 m4_define([AT_CHECK_AC_ARG_VAR],
73 [rm -f config.cache
75 # Initial value.
76 m4_ifval([$1],
77          [precious='m4_bpatsubst([$1], [[']], ['\\''])'; export precious],
78          [unset precious])
79 AT_CHECK_CONFIGURE([--config-cache -q])
80 AT_CHECK([cat file], [], [`$1'
83 # Testing --recheck: 1. have the environment `forget' about PRECIOUS.
84 unset precious
85 # 2. Rerun config.status to recreate `file'.
86 AT_CHECK([./config.status --recheck], [], [ignore])
87 AT_CHECK([./config.status], [], [ignore])
88 # 3. Check that file contains the old value of PRECIOUS.
89 AT_CHECK([cat file], [], [`$1'
92 # Second value: we should issue an error here: the value
93 # has changed!
94 m4_ifval([$2],
95          [precious='$2'; export precious],
96          [unset precious])
97 AT_CHECK_CONFIGURE([--config-cache], [m4_default([$3], [1])], [stdout], [stderr])
99 ])# AT_CHECK_AC_ARG_VAR
102 AT_SETUP([AC_ARG_VAR])
104 # We don't want to run this test if this shell doesn't support
105 # `unset'.
106 AT_CHECK([
107 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
108   exit 0
109 else
110   exit 77
114 AT_DATA([configure.ac],
115 [[AC_INIT
116 AC_ARG_VAR([precious], [this variable costs a lot])
117 echo "precious:$precious"
118 AC_OUTPUT(file)
121 AT_DATA([file.in],
122 [[`@precious@'
125 AT_CHECK_AUTOCONF
127 # Set a precious variable
128 AT_CHECK_AC_ARG_VAR([], [apple of my eye])
130 # Unset a precious variable
131 AT_CHECK_AC_ARG_VAR([apple of my eye], [])
133 # Change a precious variable
134 AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
136 # Change a precious variable that contains braces
137 AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
139 # Change a precious variable that contains all kinds of fun
140 AT_CHECK_AC_ARG_VAR(['p  r      ec"iou$], [orange of my eye])
141 dnl restore font-lock: "
143 # Warn (but do not fail) about a whitespace-only change
144 AT_CHECK_AC_ARG_VAR([    apple  of       my eye  ], [apple of my eye],
145                     [0], ["has whitespace changes"])
146 mv stdout configure-output
147 AT_CHECK([grep "ignoring whitespace changes" stderr], [], [ignore])
148 AT_CHECK([grep "precious:        apple" configure-output], [], [ignore])
150 AT_CLEANUP
155 ## ---------------------------------------------- ##
156 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS.  ##
157 ## ---------------------------------------------- ##
159 AT_SETUP([[AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]])
161 AT_DATA([configure.ac],
162 [[AC_INIT
163 AC_PROG_FGREP
164 rm -f -r header var-header file var-file link var-link command var-command
165 echo 'OK' >input
167 # Be sure to also stress the associated INIT-CMDS.
168 case $what_to_test in
169  header)
170    AC_CONFIG_HEADERS(header:input);;
171  var-header)
172    AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
174  file)
175    AC_CONFIG_FILES(file:input);;
176  var-file)
177    AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
179  command)
180    AC_CONFIG_COMMANDS(command,
181                       [cp input command]);;
182  var-command)
183    AC_CONFIG_COMMANDS(var-command,
184                       [cp $command_in var-command], [command_in=input]);;
186  link)
187    AC_CONFIG_LINKS(link:input);;
188  var-link)
189    AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
190 esac
191 AC_OUTPUT
194 AT_CHECK_AUTOCONF
197 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
198 # ------------------------------------------------------------------
199 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
200 # are properly created, with the right content.
201 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
202 # AC_CONFIG_HEADERS.
203 m4_define([AT_CHECK_CONFIG_CREATION],
204 [AT_CHECK_CONFIGURE([what_to_test=$1])
205 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
206          [ignore], [$1
208 AT_CHECK([grep OK $1], [], [OK
211 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
212 # config.status might be stupidly expecting data on stdin, if it's
213 # really broken...
214 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
215 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
216          [ignore], [var-$1
218 AT_CHECK([grep OK var-$1], [], [OK
220 ])# AT_CHECK_CONFIG_CREATION
223 # AT_CHECK_CONFIG_CREATION_NOWRITE(THING = (header | link | file | command))
224 # --------------------------------------------------------------------------
225 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
226 # are properly created, with the right content.
227 # Use `grep OK' instead of a simple `cat' to avoid banners such as in
228 # AC_CONFIG_HEADERS.
229 m4_define([AT_CHECK_CONFIG_CREATION_NOWRITE],
230 [AT_CHECK_CONFIGURE([what_to_test=$1])
231 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
232          [ignore], [$1
234 AT_CHECK([grep OK $1], [], [OK
237 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
238 # config.status might be stupidly expecting data on stdin, if it's
239 # really broken...
240 # Skip check if user can rename files into a read-only directory (when
241 # run by root or on w32).
242 touch t
243 chmod a-w .
244 mv t t1 >/dev/null 2>&1 \
245   || AT_CHECK([./config.status var-$1 </dev/null || exit 1],
246    [1], [ignore], [ignore])
247 chmod u+w .
248 rm -rf t t1
249 ])# AT_CHECK_CONFIG_CREATION_NOWRITE
252 # Create a file
253 AT_CHECK_CONFIG_CREATION(file)
255 # Create a header
256 AT_CHECK_CONFIG_CREATION(header)
258 # Execute a command
259 AT_CHECK_CONFIG_CREATION(command)
261 # Create a link
262 AT_CHECK_CONFIG_CREATION(link)
264 # Now check for write errors
266 # Create a file
267 AT_CHECK_CONFIG_CREATION_NOWRITE(file)
268 # Create a file with bits from stdin
269 AT_CHECK([echo from-stdin | ./config.status --file=file:-],
270          [0], [ignore])
271 AT_CHECK([grep from-stdin file], [], [from-stdin
273 # Force write error creating a file on stdout
274 if test -w /dev/full && test -c /dev/full; then
275   AT_CHECK([./config.status --file=-:input </dev/null >/dev/full],
276            [1], [ignore], [ignore])
279 # Create a header
280 AT_CHECK_CONFIG_CREATION_NOWRITE(header)
281 # Create a header on stdout
282 AT_CHECK([./config.status --header=-:input </dev/null],
283          [0], [stdout], [ignore])
284 AT_CHECK([grep OK stdout], [], [OK
286 # Force write error creating a header on stdout
287 if test -w /dev/full && test -c /dev/full; then
288   AT_CHECK([./config.status --header=-:input </dev/null >/dev/full],
289            [1], [ignore], [ignore])
292 # Execute a command
293 AT_CHECK_CONFIG_CREATION_NOWRITE(command)
295 # Create a link
296 AT_CHECK_CONFIG_CREATION_NOWRITE(link)
298 # Check that no use of `ac_write_fail' escaped into config.status
299 AT_CHECK([grep ac_write_fail config.status], [1])
301 # Check that --file and --header accept funny file names
302 AT_DATA([fgrep.in],
303 [[FGREP="@FGREP@"
305 ./config.status --file=fgrep:fgrep.in
306 . ./fgrep
309 export x
310 for file in \
311   'with  funny '\'' $x & #! name' \
312   'file with  funny \ '\'' \'\'' $ & #!*? name' \
313   'with  funny \ '\'' \'\'' " | <a >b & * ? name ' # "restore font-lock
315   # The function func_sanitize_file_name comes from tools.at
316   file=`func_sanitize_file_name "$file"`
317   cat >"$file.in" <<'END'
318 @configure_input@
320   AT_CHECK([./config.status "--file=$file:$file.in"],
321            [0], [ignore])
322   AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
323   AT_CHECK([./config.status "--header=$file:$file.in"],
324            [0], [ignore])
325   # Run the same test a 2nd time to see that config.status does not recreate
326   # the header (regression test)
327   AT_CHECK_UNQUOTED([./config.status "--header=$file:$file.in"],
328                     [0], [config.status: creating $file
329 config.status: $file is unchanged
331   AT_CHECK_UNQUOTED([grep ' & ' "$file"], [],
332 [/* $file.  Generated from $file.in by configure.  */
334   AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
335 done
336 AT_CLEANUP
340 ## ---------------------------------------- ##
341 ## Macro calls in AC_CONFIG_COMMANDS tags.  ##
342 ## ---------------------------------------- ##
344 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
346 AT_DATA_M4SUGAR([configure.ac],
347 [[AC_INIT
348 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
349 AC_OUTPUT
352 AT_CHECK_AUTOCONF
353 AT_CHECK_CONFIGURE
355 AT_CLEANUP
359 ## ------------------- ##
360 ## Missing templates.  ##
361 ## ------------------- ##
363 # Check that config.status detects missing input files
364 AT_SETUP([Missing templates])
366 AT_DATA([configure.ac],
367 [[AC_INIT
368 AC_CONFIG_FILES([nonexistent])
369 AC_OUTPUT
372 AT_CHECK_AUTOCONF
373 mkdir build
374 AT_CAPTURE_FILE([build/config.log])[]dnl
375 cd build
376 AT_CHECK([../configure], [1], [ignore],
377 [[config.status: error: cannot find input file: `nonexistent.in'
379 # Make sure that the output file doesn't exist
380 AT_CHECK([test -f nonexistent], 1)
381 cd ..
382 AT_CHECK_CONFIGURE([], [1], [],
383 [[config.status: error: cannot find input file: `nonexistent.in'
385 # Make sure that the output file doesn't exist
386 AT_CHECK([test -f nonexistent], 1)
388 AT_CLEANUP
393 ## ---------------------- ##
394 ## configure invocation.  ##
395 ## ---------------------- ##
397 # Check that `configure' and `config.status' honor their interface.
399 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
400 # and verify that (i) `configure' correctly receives the arguments,
401 # (ii) correctly passes them to `config.status', which we check by
402 # running `config.status --recheck', (iii) correctly passes them
403 # to sub-configure scripts, and (iv) correctly reproduces them with
404 # `config.status --config'.
406 AT_SETUP([configure invocation])
408 mkdir sub
410 AT_DATA([configure.ac],
411 [[AC_INIT
412 AC_CONFIG_SUBDIRS([sub])
413 echo "result=$one$enable_two$with_three"
414 AC_OUTPUT
417 AT_DATA([sub/configure.ac],
418 [[AC_INIT
419 echo "result=$one$enable_two$with_three"
420 AC_OUTPUT
423 echo fake install-sh script >install-sh
425 AT_CHECK_AUTOCONF
426 cd sub
427 AT_CHECK_AUTOCONF
428 cd ..
430 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
431                      sed -n -e 's/^result=//p'], 0,
432                    [m4_do([onetwothree
433 ],                        [onetwothree
434 ])])
435 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
436          [onetwothree
438 AT_CHECK([args=`./config.status --config` && eval ./configure \$configure_options "$args" |
439             sed -n -e 's/^result=//p'], 0,
440          [m4_do([onetwothree
441 ],              [onetwothree
442 ])])
444 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" '  $" --with-three="   \"'$"|
445                       sed -n -e 's/^result=//p'], 0,
446                    [m4_do(["'$ " '  $   "'$
447 ],                        ["'$ " '  $   "'$
448 ])])
449 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
450          ["'$ " '  $    "'$
452 dnl restore font-lock: "
453 AT_CHECK([args=`./config.status --config` && eval ./configure \$configure_options "$args" |
454             sed -n -e 's/^result=//p'], 0,
455          [m4_do(["'$ " '  $     "'$
456 ],              ["'$ " '  $     "'$
457 ])])
459 AT_CLEANUP
463 ## -------------------------------------------- ##
464 ## Check that `#define' templates are honored.  ##
465 ## -------------------------------------------- ##
467 # Use various forms of `#define' templates, and make sure there are no
468 # problems when a symbol is prefix of another.
470 AT_SETUP([@%:@define header templates])
471 AT_KEYWORDS([AC@&t@_DEFINE])
473 AT_DATA([configure.ac],
474 [[AC_INIT
475 AC_CONFIG_HEADERS(config.h:config.hin)
477 # I18n of dummy variables: their French translations.
478 AC_DEFINE(foo, toto)
479 AC_DEFINE(bar, tata)
480 AC_DEFINE(baz, titi)
481 AC_DEFINE(fubar, tutu)
483 # Symbols which are prefixes of another.
484 AC_DEFINE(a, A)
485 AC_DEFINE(aaa, AAA)
486 AC_DEFINE(aa, AA)
488 # backslash-newline combinations
489 AC_DEFINE([multiline], [line1\
490 line2\
491 line3 \
492 line4])
493 AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
494 ARG1])
495 AC_CONFIG_FILES(defs)
497 # underquoted #
498 AC_DEFINE([paste(a,b)], [a##b])
500 # Things included in confdefs.h, but which make no sense in
501 # config.h, nor in $DEFS.
502 cat <<\EOF >>confdefs.h
503 /* Hi Mum! Look, I am doing C++! */
504 #ifdef __cplusplus
505 void exit (int status);
506 #endif
509 # In addition of config.h output a full DEFS
510 AC_OUTPUT_MAKE_DEFS
511 DEFS_SAVED=$DEFS
512 AC_SUBST(DEFS_SAVED)
513 AC_OUTPUT
516 AT_DATA([defs.in],
517 [[@DEFS_SAVED@
520 AT_DATA([config.hin],
521 [[#define foo   0
522 #  define bar bar
523 #  define baz   "Archimedes was sinking in his baz"
524   #  define fubar                               tutu
525 #define a B
526  #define aa BB
527  #  define aaa BBB
528 #undef a
529  #  undef aa
530 #undef aaa
531 #define aaa(a, aa) aa a
532 #define aaab
533 #define aaac(a, aa) aa a
534 #undef multiline
535 #  undef multiline_args
536 #define paste(a,b) a##b
537 /* an ugly one: */
538 #define str(define) \
539 #define
540 #define stringify(arg) str(arg)
541 #undef aaa /* with comments */
542 #undef not_substed /* with comments */
545 AT_CHECK_AUTOCONF
546 AT_CHECK_CONFIGURE
548 AT_DATA([expout],
549 [[/* config.h.  Generated from config.hin by configure.  */
550 #define foo toto
551 #  define bar tata
552 #  define baz titi
553   #  define fubar tutu
554 #define a A
555  #define aa AA
556  #  define aaa AAA
557 #define a A
558  #  define aa AA
559 #define aaa AAA
560 #define aaa AAA
561 #define aaab
562 #define aaac(a, aa) aa a
563 #define multiline line1\
564 line2\
565 line3 \
566 line4
567 #  define multiline_args(ARG1, ARG2) ARG2 \
568 ARG1
569 #define paste(a,b) a##b
570 /* an ugly one: */
571 #define str(define) \
572 #define
573 #define stringify(arg) str(arg)
574 #define aaa AAA
575 /* #undef not_substed */
577 AT_CHECK([cat config.h], 0, expout)
579 # Check the value of DEFS.
580 AT_DATA([expout],
581 [[-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
584 # Because we strip trailing spaces in `testsuite' we can't leave one in
585 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
586 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
588 AT_CLEANUP
592 ## ------------------------- ##
593 ## Torturing config.status.  ##
594 ## ------------------------- ##
596 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
597 ## big value.  This is mostly to check that Autoconf produces portable sed
598 ## scripts in config.status.  sed is used to skip the first two lines
599 ## `Generated by ...'.
601 # We use m4_for many times.
602 m4_pattern_allow([^m4_for$])
604 AT_SETUP([Torturing config.status])
606 dnl The value used as a big value for AC_DEFINE.
607 dnl Don't use sh active chars here, below it is also used in a sh
608 dnl assignment.
609 m4_define([AT_BIG_VALUE],
610 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
612 m4_define([AT_DESCRIPTION],
613 [Define to a long string if your `Autoconf' works properly.])
616 # AT_DUMMY_VAR(NUMBER)
617 # --------------------
618 # Build a name used for AC_SUBST and AC_DEFINE.  Put ac_ in it
619 # so that the check for user name space invasion does not complain
620 # of the new variables defined.
622 # Note that you should not use the name ac_dummy, because it will be
623 # turned into ac_uummy during the construction of config.status.  Yes,
624 # this is admittedly a bug, but it would be too hard to fix this.
625 # There is really no point in AC_DEFINE a var named ac_d.*.
626 m4_pattern_allow([^m4_bpatsubst$])
627 m4_define([AT_DUMMY_VAR],
628 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
632 AT_DATA([dummy.in],
633 [m4_for([AT_Count], 1, 100, 1,
634 [@AT_DUMMY_VAR(AT_Count)@
635 @[f]AT_Count@
636 ])])
640 while test $i != 101; do
641   echo "content of file $i" > file_$i
642   AS_VAR_ARITH([i], [$i + 1])
643 done
646 # ------------ #
647 # configure.ac #
648 # ------------ #
650 m4_pattern_allow([^m4_(define|defun)$])
651 AT_DATA([configure.ac],
652 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
653 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
654 [[m4_define([AC_DUMMY_VAR],]
655 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
657 [[m4_define([AC_DESCRIPTION],]
658 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
660 [[m4_define([AC_BIG_VALUE],]
661 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
663 [[# AC_DEFUBST(NAME)
664 # ----------------
665 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE.  This is
666 # used in the torture tests.
667 m4_defun([AC_DEFUBST],
668 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
669 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
670                    AC_DESCRIPTION)
671 AC_SUBST(AC_DUMMY_VAR($1))
672 AC_SUBST_FILE([f]$1)
673 f$1=file_$1
676 AC_INIT
677 AC_CONFIG_HEADERS(config.h:config.hin)
678 AC_CONFIG_FILES(dummy)
679 m4_for(AC_Count, 1, 100, 1,
680        [AC_DEFUBST(AC_Count)])
681 AC_PROG_AWK
682 AC_OUTPUT
683 ]])# configure.ac
685 AT_CHECK_AUTOCONF
686 AT_CHECK_AUTOHEADER
687 # Check both awk and the result of AC_PROG_AWK
688 for awk_arg in FOO= AWK=awk; do
689   AT_CHECK_CONFIGURE([$awk_arg])
691   # Checking that AC_DEFINE worked properly.
692   AT_DATA([expout],
693 [/* Define to the address where bug reports for this package should be sent. */
694 #define PACKAGE_BUGREPORT ""
696 /* Define to the full name of this package. */
697 #define PACKAGE_NAME ""
699 /* Define to the full name and version of this package. */
700 #define PACKAGE_STRING ""
702 /* Define to the one symbol short name of this package. */
703 #define PACKAGE_TARNAME ""
705 /* Define to the home page for this package. */
706 #define PACKAGE_URL ""
708 /* Define to the version of this package. */
709 #define PACKAGE_VERSION ""
710 m4_for(AT_Count, 1, 100, 1,
712 /* AT_DESCRIPTION */
713 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
714 ])])
716   AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
718   # Checking that AC_SUBST worked properly.
719   AT_DATA([expout],
720 [m4_for(AT_Count, 1, 100, 1,
721 [AT_BIG_VALUE
722 content of file AT_Count
723 ])])
725   AT_CHECK([cat dummy], 0, expout)
726 done
728 AT_CLEANUP
731 ## ------------------------------- ##
732 ## Substitute a 2000-byte string.  ##
733 ## ------------------------------- ##
735 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes.  HP/UX
736 # sed dumps core around 8 KiB.  However, POSIX says that sed need not
737 # handle lines longer than 2048 bytes (including the trailing newline).
738 # So we'll just test a 2000-byte value, and for awk, we test a line with
739 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
740 # multi-line values should allow to get around the limitations.
741 # We also test runs of around 148 backslashes: they need to be escaped,
742 # and 148 is the portable limit for awk string literals.  config.status
743 # uses concatenation to generate longer strings.
745 AT_SETUP([Substitute a 2000-byte string])
747 AT_DATA([Foo.in], [@foo@
749 AT_DATA([Bar.in], [@bar@
751 AT_DATA([Baz.in], [@baz@
753 AT_DATA([Boo.in], [@b147@
754 @b148@
755 @b149@
756 @b295@
757 @b296@
758 @b297@
761 AT_DATA([configure.ac],
762 [[AC_INIT
763 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
764 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
765 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
767 baz=$baz$baz$baz$baz$baz
768 AC_SUBST([baz])
769 b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
770 b147=$b29$b29$b29$b29$b29'\\'
771 b148=$b147'\'
772 b149=$b148'\'
773 b295=$b147$b147'\'
774 b296=$b295'\'
775 b297=$b296'\'
776 AC_SUBST([b147])
777 AC_SUBST([b148])
778 AC_SUBST([b149])
779 AC_SUBST([b295])
780 AC_SUBST([b296])
781 AC_SUBST([b297])
782 AC_PROG_AWK
783 AC_CONFIG_FILES([Foo Bar Baz Boo])
784 AC_OUTPUT
787 cp "$abs_top_srcdir/build-aux/install-sh" .
789 b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
790 b147=$b29$b29$b29$b29$b29'\\'
791 b295=$b147$b147'\'
792 cat >Boo-exp <<EOF
793 $b147
794 $b147\\
795 $b147\\\\
796 $b295
797 $b295\\
798 $b295\\\\
801 AT_CHECK_AUTOCONF
802 # Check both awk and the result of AC_PROG_AWK
803 for awk_arg in Foo= AWK=awk; do
804   AT_CHECK_CONFIGURE([$awk_arg])
805   AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
807   AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
809   AT_DATA([stdout],
810   [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
812   AT_CHECK([cat Baz], 0, [stdout])
813   AT_CHECK([diff Boo-exp Boo])
814 done
815 AT_CLEANUP
818 ## ------------------------------ ##
819 ## Define to a 2000-byte string.  ##
820 ## ------------------------------ ##
822 AT_SETUP([Define to a 2000-byte string])
823 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
825 AT_CONFIGURE_AC(
827 AC_DEFINE_UNQUOTED([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
828 AC_DEFINE([fooq], ]m4_for([n], 1, 100,, ....................)[, [desc])
831 AT_CHECK_AUTOCONF
832 AT_CHECK_AUTOHEADER
833 AT_CHECK_CONFIGURE
834 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
835 @%:@define fooq m4_for([n], 1, 100,, ....................)
837 AT_CLEANUP
840 ## ------------------------------------------ ##
841 ## Substitute and define special characters.  ##
842 ## ------------------------------------------ ##
844 # Use characters special to the shell, sed, awk, and M4.
846 AT_SETUP([Substitute and define special characters])
847 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
849 AT_DATA([Foo.in], [@foo@
850 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
851 abc@bar@baz@baz
852 abc@bar@@baz@baz
853 abc@bar@@baz@baz@
854 abc@bar @baz@baz
855 abc@bar @baz@baz@
856 abc@bar @baz@@baz@
857 @file@
858          @file@
859 X@file@
860 @file@X
863 AT_DATA([File],
864 [@foo@@bar@
867 AT_DATA([Zardoz.in], [@zardoz@
870 AT_CONFIGURE_AC(
871 [[foo="AS@&t@_ESCAPE([[X*'[]+ ", & &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
873 bar="@foo@ @baz@"
874 baz=bla
875 ( for i in 0 1 2 3; do
876     for j in 0 1 2 3 4 5 6 7; do
877       for k in 0 1 2 3 4 5 6 7; do
878         case $i$j$k in #(
879         000 | 015 | 377) ;; # MinGW awk dislikes 0xFF, and the test does
880                             # the wrong thing for CR on MinGW.
881                             #(
882         *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
883         esac
884       done
885     done
886   done
887   printf \\n
888 ) >allowed-chars
889 zardoz=`cat allowed-chars`
890 AC_SUBST([foo])
891 AC_SUBST([bar])
892 AC_SUBST([baz])
893 AC_SUBST([zardoz])
894 file=File
895 AC_SUBST_FILE([file])
896 AC_DEFINE([fooq], [[X*'[]+ ", & &`\($foo !]], [Awful value.])
897 AC_DEFINE([barq], [[%!_!# X]], [Value that is used as special delimiter.])
898 AC_DEFINE_UNQUOTED([foo], [[X*'[]+ ", & &\`\\(\$foo !]], [Awful value.])
899 AC_DEFINE_UNQUOTED([bar], [[%!_!# X]], [Value that is used as special delimiter.])
900 AC_DEFINE_UNQUOTED([unq1], [$baz], [unquoted, test 1])
901 AC_DEFINE_UNQUOTED([unq2], [\$baz], [unquoted, test 2])
902 AC_DEFINE_UNQUOTED([unq3], ["$baz"], [unquoted, test 3])
903 AC_DEFINE_UNQUOTED([unq4], [${baz+set}], [unquoted, test 4])
904 AC_DEFINE_UNQUOTED([unq5], ["${baz+`echo "a b"`}"], [unquoted, test 5])
905 AC_DEFINE_UNQUOTED([unq6], [`echo hi`], [unquoted, test 6])
906 AC_DEFINE_UNQUOTED([unq7], ['\\"'], [unquoted, test 7])
907 AC_PROG_AWK
908 AC_CONFIG_FILES([Foo Zardoz])]])
910 AT_CHECK_AUTOCONF
911 AT_CHECK_AUTOHEADER
912 # Check both awk and the result of AC_PROG_AWK
913 for awk_arg in FOO= AWK=awk; do
914   AT_CHECK_CONFIGURE([$awk_arg])
915   AT_CHECK([cat Foo], 0, [[X*'[]+ ", & &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
916 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
917 abc@foo@ @baz@baz@baz
918 abc@foo@ @baz@blabaz
919 abc@foo@ @baz@blabaz@
920 abc@bar blabaz
921 abc@bar blabaz@
922 abc@bar blabla
923 @foo@@bar@
924 @foo@@bar@
925 X@file@
926 @file@X
928   AT_CHECK([cmp allowed-chars Zardoz])
929   AT_CHECK_DEFINES([[#define bar %!_!# X
930 #define barq %!_!# X
931 #define foo X*'[]+ ", & &`\($foo !
932 #define fooq X*'[]+ ", & &`\($foo !
933 #define unq1 bla
934 #define unq2 $baz
935 #define unq3 "bla"
936 #define unq4 set
937 #define unq5 "a b"
938 #define unq6 hi
939 #define unq7 '\"'
941 done
942 AT_CLEANUP
945 ## ---------------------- ##
946 ## Substitute a newline.  ##
947 ## ---------------------- ##
949 AT_SETUP([Substitute a newline])
951 AT_DATA([Foo.in],
952 [@foo@
953 @bar@
956 AT_DATA([configure.ac],
957 [[AC_INIT
958 foo='one
959 two'
960 bar='%!_!# ''
962 AC_SUBST([foo])
963 AC_SUBST([bar])
964 AC_CONFIG_FILES([Foo])
965 AC_PROG_AWK
966 AC_OUTPUT
969 cp "$abs_top_srcdir/build-aux/install-sh" .
971 echo 'one
973 %!_!# ''
974 x' >expout
976 AT_CHECK_AUTOCONF
977 # Check both awk and the result of AC_PROG_AWK
978 for awk_arg in FOO= AWK=awk; do
979   AT_CHECK_CONFIGURE([$awk_arg])
980   AT_CHECK([cat Foo], 0, [expout])
981 done
982 AT_CLEANUP
985 ## ------------------ ##
986 ## Define a newline.  ##
987 ## ------------------ ##
989 AT_SETUP([Define a newline])
990 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
991 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
992 two], [This spans two lines.])
994 AT_CHECK_AUTOCONF([], [], [], [stderr])
995 dnl Older versions of m4 report error at line 5 (end of macro);
996 dnl newer versions report it at line 4 (start of macro).
997 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
998 [[warning: AC_DEFINE: `one
999 two' is not a valid preprocessor define value
1001 AT_CHECK_AUTOHEADER([], [], [], [stderr])
1002 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
1003 [[warning: AC_DEFINE: `one
1004 two' is not a valid preprocessor define value
1006 AT_CHECK_CONFIGURE
1007 AT_CHECK_DEFINES([[#define foo one
1010 AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
1011 two], [This spans two lines.])
1013 AT_CHECK_AUTOCONF([], [], [], [stderr])
1014 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
1015 [[warning: AC_DEFINE_UNQUOTED: `one
1016 two' is not a valid preprocessor define value
1018 AT_CHECK_AUTOHEADER([], [], [], [stderr])
1019 AT_CHECK([[sed 's/^configure.ac:[45]: //' stderr]], [],
1020 [[warning: AC_DEFINE_UNQUOTED: `one
1021 two' is not a valid preprocessor define value
1023 AT_CHECK_CONFIGURE
1024 AT_CHECK_DEFINES([[#define foo one
1027 AT_CLEANUP
1030 ## ------------------------------------ ##
1031 ## AC_SUBST: variable name validation.  ##
1032 ## ------------------------------------ ##
1034 AT_SETUP([AC_SUBST: variable name validation])
1036 AT_CONFIGURE_AC([[AC_SUBST(, [])
1037 AC_CONFIG_FILES([Makefile])
1039 AT_DATA([Makefile.in], [[
1041 mv -f configure.ac configure.tmpl
1043 # Invalid names.
1044 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
1045   sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
1046   AT_CHECK_AUTOCONF([], [1], [], [ignore])
1047 done
1049 # Valid names.
1050 for var in ab a4 'a@@&t@\&t@b'; do
1051   sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
1052   AT_CHECK_AUTOCONF
1053   AT_CHECK_AUTOHEADER
1054   AT_CHECK_CONFIGURE
1055 done
1057 AT_CLEANUP
1060 ## ------------------------ ##
1061 ## datarootdir workaround.  ##
1062 ## ------------------------ ##
1064 AT_SETUP([datarootdir workaround])
1066 AT_DATA([Foo.in],
1067 [@datadir@
1068 @docdir@
1069 @infodir@
1070 @localedir@
1071 @mandir@
1074 AT_DATA([Bar.in],
1075 [@mydatadir@
1078 AT_DATA([configure.ac],
1079 [[AC_INIT
1080 d@&t@nl The following line silences the warnings, if uncommented:
1081 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
1083 # This substitution is wrong and bogus!  Don't use it in your own code!
1084 # Read `info Autoconf "Defining Directories"'!
1085 AC_SUBST([mydatadir], [${datadir}/my])
1087 AC_CONFIG_FILES([Foo Bar])
1088 AC_OUTPUT
1091 cp "$abs_top_srcdir/build-aux/install-sh" .
1093 AT_CHECK_AUTOCONF
1094 AT_CHECK_CONFIGURE([], [], [],
1095   [config.status: WARNING:  'Foo.in' seems to ignore the --datarootdir setting
1096 config.status: WARNING: Bar contains a reference to the variable `datarootdir'
1097 which seems to be undefined.  Please make sure it is defined
1099 AT_CHECK([grep datarootdir Foo], 1, [])
1101 rm configure
1102 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
1103 mv t configure.ac
1105 AT_CHECK_AUTOCONF
1106 AT_CHECK_CONFIGURE
1108 AT_CLEANUP
1111 ## -------- ##
1112 ## srcdir.  ##
1113 ## -------- ##
1115 AT_SETUP([srcdir])
1117 rm -f -r at-dir
1118 mkdir at-dir
1119 : >at-dir/bar.in
1120 : >foo.in
1122 AT_DATA([configure.ac],
1123 [[AC_INIT
1125 AC_CONFIG_FILES([foo at-dir/bar])
1127 # Use quotes in the INIT-COMMANDS to accommodate a value of $srcdir
1128 # containing e.g., spaces or shell meta-characters.
1129 # Use *single* quotes because the context is an unquoted here-doc.
1130 AC_CONFIG_COMMANDS([report],
1131 [test -f "$srcdir/configure.ac" ||
1132    AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
1133                    [srcdir='$srcdir'])
1135 AC_OUTPUT
1136 rm -f -r foo at-dir/bar
1139 AT_CHECK_AUTOCONF
1141 # In place.
1142 AT_CHECK([./configure $configure_options], [], [ignore])
1144 # Relative name.
1145 AT_CHECK([cd at-dir && ../configure $configure_options], [], [ignore])
1147 # Absolute name.
1148 at_here=`pwd`
1149 AT_CHECK([cd at-dir && "$at_here/configure" $configure_options], [], [ignore])
1151 AT_CLEANUP
1154 ## ----------------- ##
1155 ## Signal handling.  ##
1156 ## ----------------- ##
1158 AT_SETUP([Signal handling])
1160 AT_DATA([configure.ac],
1161 [[AC_INIT
1162 kill -2 $$
1163 exit 77
1166 AT_CHECK_AUTOCONF
1167 AT_CHECK_CONFIGURE([], 1, ignore, ignore)
1169 AT_CLEANUP
1172 ## ----------------- ##
1173 ## AC_CONFIG_LINKS.  ##
1174 ## ----------------- ##
1176 AT_SETUP([AC_CONFIG_LINKS])
1178 AT_DATA([configure.ac],
1179 [[AC_INIT([config links to config files test], [1.0])
1180 AC_CONFIG_SRCDIR([sub1/file1.in])
1181 AC_CONFIG_FILES([sub1/file1 file2])
1182 AC_CONFIG_LINKS([file1:sub1/file1 sub2/file2:file2])
1183 AC_OUTPUT
1186 mkdir sub1
1188 AT_DATA([sub1/file1.in],
1189 [[/* @configure_input@ */
1190 #define PACKAGE_STRING "@PACKAGE_STRING@"
1193 AT_DATA([file2.in],
1194 [[/* @configure_input@ */
1195 #define PACKAGE_STRING "@PACKAGE_STRING@"
1198 mkdir build
1199 AT_CHECK_AUTOCONF
1200 cd build
1201 AT_CHECK([../configure && ../configure], 0, [ignore])
1202 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1204 AT_CHECK([../configure && ../configure], 0, [ignore])
1205 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1207 cd ..
1208 rm -rf build
1209 mkdir build
1210 cd build
1211 cwd=`pwd`
1212 AT_CHECK(["$cwd"/../configure && "$cwd"/../configure], 0, [ignore])
1213 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1215 cd ..
1216 AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
1217 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1219 cwd=`pwd`
1220 AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
1221 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1224 AT_CLEANUP
1227 ## ------------------------------------- ##
1228 ## AC_CONFIG_LINKS and identical files.  ##
1229 ## ------------------------------------- ##
1230 AT_SETUP([AC_CONFIG_LINKS and identical files])
1232 AT_DATA([configure.ac],
1233 [[AC_INIT
1234 AC_CONFIG_LINKS([src/s:src/s])
1235 test "$srcdir" != '.' && AC_CONFIG_LINKS([src/t:src/t])
1236 AC_OUTPUT
1239 mkdir src build
1240 echo file1 > src/s
1241 echo file2 > src/t
1242 AT_CHECK_AUTOCONF
1243 cd build
1244 AT_CHECK([../configure $configure_options && ../configure $configure_options],
1245          0, [ignore])
1246 AT_CHECK([cat src/s src/t], 0, [file1
1247 file2
1250 cd ..
1251 rm -rf build
1252 mkdir build
1253 cd build
1254 cwd=`pwd`
1255 AT_CHECK(["$cwd"/../configure], 0, [ignore])
1256 AT_CHECK([cat src/s src/t], 0, [file1
1257 file2
1259 AT_CHECK(["$cwd"/../configure], 0, [ignore])
1260 AT_CHECK([cat src/s src/t], 0, [file1
1261 file2
1263 cd ..
1264 AT_CHECK([./configure $configure_options && ./configure $configure_options],
1265          0, [ignore], [stderr])
1266 AT_CHECK([grep src/t stderr], 1)
1267 AT_CHECK([cat src/s src/t], 0, [file1
1268 file2
1270 cwd=`pwd`
1271 AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
1272 AT_CHECK([cat src/s src/t], 0, [file1
1273 file2
1276 AT_CLEANUP
1279 AT_BANNER([autoreconf.])
1281 ## ---------------------------- ##
1282 ## Configuring subdirectories.  ##
1283 ## ---------------------------- ##
1285 # .
1286 # |-- builddir
1287 # |   |-- config.log
1288 # |   |-- config.status
1289 # |   `-- inner
1290 # |       |-- config.log
1291 # |       |-- config.status
1292 # |       `-- innermost
1293 # |           `-- config
1294 # |-- configure
1295 # |-- configure.ac
1296 # |-- inner
1297 # |   |-- configure
1298 # |   |-- configure.ac
1299 # |   `-- innermost
1300 # |       `-- config.in
1301 # `-- install-sh
1303 AT_SETUP([Configuring subdirectories])
1304 AT_KEYWORDS(autoreconf)
1306 # We use aclocal (via autoreconf).
1307 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
1308 # It should understand configure.ac.
1309 AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
1311 # Set CONFIG_SITE to a nonexistent file, so that there are
1312 # no worries about nonstandard values for 'prefix'.
1313 CONFIG_SITE=no-such-file
1314 export CONFIG_SITE
1316 # The contents of `inner/', and `inner/innermost/'.
1317 AS_MKDIR_P([inner/innermost])
1319 # We have to use configure.in, not configure.ac, if we still want to
1320 # be compatible with Automake 1.4: aclocal (run by autoreconf) would
1321 # die because it can't find configure.in.
1322 AT_DATA([inner/configure.in],
1323 [[AC_INIT(GNU Inner, 1.0)
1324 AC_CONFIG_SRCDIR([innermost/config.in])
1325 AC_ARG_VAR([INNER], [an inner variable])
1326 AC_SUBST([INNER])
1327 if test "x$INNER" = x; then
1328   INNER=inner
1330 AC_CONFIG_FILES([innermost/config])
1331 AC_OUTPUT
1334 AT_DATA([inner/innermost/config.in],
1335 [INNER=@INNER@
1336 srcdir=@srcdir@
1337 top_srcdir=@top_srcdir@
1338 prefix=@prefix@
1341 # The contents of `.'
1342 AT_DATA([install-sh], [])
1344 # nonexistent is allowed not to exist.
1345 AT_DATA([configure.in],
1346 [[AC_INIT(GNU Outer, 1.0)
1347 AC_ARG_VAR([OUTER], [an outer variable])
1348 if false; then
1349   AC_CONFIG_SUBDIRS([nonexistent])
1351 AC_CONFIG_SUBDIRS([inner])
1352 AC_OUTPUT
1355 # If there are improperly quoted AC_DEFUN installed in share/aclocal,
1356 # they trigger warnings from aclocal 1.8, so ignore stderr.
1357 AT_CHECK([autoreconf], [], [], [ignore])
1358 AT_CHECK([test -f inner/configure])
1360 # Running the outer configure recursively should provide the innermost
1361 # help strings.
1362 chmod a-w inner/innermost inner .
1363 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep INNER], 0,
1364          [ignore], [stderr],
1365          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1366 chmod u+w . inner inner/innermost
1368 # Running the outer configure should trigger the inner.
1369 AT_CHECK_CONFIGURE
1370 AT_CHECK([cat inner/innermost/config], 0,
1371 [INNER=inner
1372 srcdir=.
1373 top_srcdir=..
1374 prefix=/usr/local
1377 # The same, but from a builddir.
1378 AS_MKDIR_P([builddir])
1379 AT_CHECK([cd builddir && ../configure $configure_options], 0, [ignore])
1380 AT_CHECK([cat builddir/inner/innermost/config], 0,
1381 [INNER=inner
1382 srcdir=../../../inner/innermost
1383 top_srcdir=../../../inner
1384 prefix=/usr/local
1387 # Make sure precious variables and command line options are properly
1388 # passed, even when there are duplicates.
1389 AT_CHECK([cd builddir && ../configure $configure_options --prefix /bad --prefix /good INNER=bad INNER=good],
1390          0, [ignore])
1391 AT_CHECK([cat builddir/inner/innermost/config], 0,
1392 [INNER=good
1393 srcdir=../../../inner/innermost
1394 top_srcdir=../../../inner
1395 prefix=/good
1398 # Make sure --prefix is properly quoted
1399 AT_CHECK([cd builddir && ../configure --prefix "/a  b c$ 'd"], 0, [ignore])
1400 AT_CHECK([cat builddir/inner/innermost/config], 0,
1401 [INNER=inner
1402 srcdir=../../../inner/innermost
1403 top_srcdir=../../../inner
1404 prefix=/a  b c$ 'd
1407 # Make sure --silent is properly passed...
1408 AT_CHECK([cd builddir && ../configure $configure_options --silent], 0, [])
1409 # ...but not stored in config.status.
1410 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1411 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1413 # Make sure we can run autoreconf on a subdirectory
1414 rm -f configure configure.in
1415 AT_CHECK([autoreconf inner], [], [], [ignore])
1417 # Make sure we can pass a configure.ac name
1418 AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
1419 AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
1421 AT_CLEANUP
1425 ## -------------- ##
1426 ## Deep Package.  ##
1427 ## -------------- ##
1429 AT_SETUP([Deep Package])
1430 AT_KEYWORDS(autoreconf)
1432 # We use aclocal (via autoreconf).
1433 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1435 # The contents of `.'
1436 AT_DATA([install-sh], [])
1437 AT_DATA([configure.in],
1438 [[AC_INIT(GNU Outer, 1.0)
1439 AC_ARG_VAR([OUTER], [an outer variable])
1440 AC_CONFIG_SUBDIRS([
1441   inner
1442   inner2
1444 AC_OUTPUT
1447 # The contents of `inner/', and `inner/innermost/'.
1448 AS_MKDIR_P([inner/innermost])
1449 AS_MKDIR_P([inner2])
1451 AT_DATA([inner/configure.in],
1452 [[AC_INIT(GNU Inner, 1.0)
1453 AC_ARG_VAR([INNER], [an inner variable])
1454 AC_CONFIG_SUBDIRS(innermost)
1455 AC_OUTPUT
1458 AT_DATA([inner/innermost/configure.in],
1459 [[AC_INIT(GNU Innermost, 1.0)
1460 AC_ARG_VAR([INNERMOST], [an innermost variable])
1461 AC_CONFIG_HEADERS(config.h:config.hin)
1462 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1463 if test -n "$innermost_error"; then
1464   AC_MSG_FAILURE([error in $PACKAGE_NAME])
1466 AC_OUTPUT
1469 AT_DATA([inner2/configure.in],
1470 [[AC_INIT(GNU Inner 2, 1.0)
1471 AC_ARG_VAR([INNER2], [an inner2 variable])
1472 AC_OUTPUT
1475 AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
1476 AT_CHECK([test -f inner/configure])
1477 AT_CHECK([test -f inner/innermost/configure])
1478 AT_CHECK([test -f inner/innermost/config.hin])
1479 AT_CHECK([test -f inner2/configure])
1481 # Running the outer configure recursively should provide the innermost
1482 # help strings.
1483 chmod a-w inner/innermost inner
1484 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER "],
1485          0, [ignore], [stderr],
1486          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1487 chmod a-w .
1488 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER2 "],
1489          0, [ignore], [stderr],
1490          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1491 chmod a-w .
1492 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1493          0, [ignore], [stderr],
1494          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1495 chmod a-w .
1496 AT_CHECK([{ /bin/sh ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1497          0, [ignore], [stderr],
1498          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1499 chmod a-w .
1500 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure $configure_options --help=recursive; chmod +w .; } | grep " INNERMOST "],
1501          0, [ignore], [stderr],
1502          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1503 chmod a-w .
1504 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1505          0, [ignore], [stderr],
1506          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1507 chmod u+w inner inner/innermost
1509 # Running the outer configure should trigger the inner.
1510 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1511 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1512 [[#define INNERMOST tsomrenni
1515 # Ensure we point to the right config.log file for errors.
1516 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1517 AT_CHECK([grep 'inner/innermost' stderr], [], [ignore])
1518 cd inner
1519 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1520 AT_CHECK([grep 'innermost' stderr], [], [ignore])
1521 cd ..
1523 # The same, but from a builddir.
1524 AS_MKDIR_P([builddir])
1525 chmod a-w builddir inner/innermost inner
1526 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER "],
1527          0, [ignore], [stderr],
1528          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1529 chmod a-w builddir
1530 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER2 "],
1531          0, [ignore], [stderr],
1532          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1533 chmod a-w builddir
1534 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1535          0, [ignore], [stderr],
1536          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1537 chmod a-w builddir
1538 AT_CHECK([cd builddir && { /bin/sh ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1539          0, [ignore], [stderr],
1540          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1541 chmod a-w builddir
1542 # Not all shells search $PATH for scripts.
1543 if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure $configure_options --help) >/dev/null 2>&1; then
1544   AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure $configure_options --help=recursive | grep " INNERMOST "], 0, [ignore])
1546 AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1547          0, [ignore], [stderr],
1548          [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1549 chmod u+w builddir inner inner/innermost
1550 AT_CHECK([cd builddir && ../configure $configure_options INNERMOST=build/tsomrenni], 0, [ignore])
1551 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1552 [[#define INNERMOST build/tsomrenni
1555 AT_CLEANUP
1559 ## -------------------------------- ##
1560 ## Non-Autoconf AC_CONFIG_SUBDIRS.  ##
1561 ## -------------------------------- ##
1563 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1564 AT_KEYWORDS([autoreconf])
1566 # We use aclocal (via autoreconf).
1567 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1569 AT_DATA([install-sh], [])
1570 AT_DATA([configure.in],
1571 [[AC_INIT(GNU Outer, 1.0)
1572 AC_CONFIG_SUBDIRS([inner])
1573 AC_OUTPUT
1576 AS_MKDIR_P([inner])
1578 AT_DATA([inner/configure],
1579 [[#! /bin/sh
1580 case "$*" in
1581     *--help*) echo 'No Autoconf here, folks!' ;;
1582     *)        echo got_it >myfile ;;
1583 esac
1584 exit 0
1586 chmod +x inner/configure
1588 AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
1590 # Running the outer configure recursively should provide the innermost
1591 # help strings.
1592 AT_CHECK([./configure $configure_options --help=recursive | grep "folks"], 0, [ignore])
1594 # Running the outer configure should trigger the inner.
1595 AT_CHECK([./configure $configure_options], 0, [ignore])
1596 AT_CHECK([test -f inner/myfile], 0)
1598 AT_CLEANUP
1602 ## ----------------- ##
1603 ## Empty directory.  ##
1604 ## ----------------- ##
1606 AT_SETUP([Empty directory])
1607 AT_KEYWORDS([autoreconf])
1609 # We use aclocal (via autoreconf).
1610 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1612 # The test group directory is not necessarily _empty_, but it does not contain
1613 # files meaningful to `autoreconf'.
1615 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1617 AT_CLEANUP
1621 ## ------------------------------ ##
1622 ## Unusual Automake input files.  ##
1623 ## ------------------------------ ##
1625 # This parallels gnumake.test in Automake.
1627 AT_SETUP([Unusual Automake input files])
1628 AT_KEYWORDS([autoreconf])
1630 # We use aclocal and automake via autoreconf.
1631 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1633 AT_DATA([configure.in],
1634 [[AC_INIT(GNU foo, 1.0)
1635 AM_INIT_AUTOMAKE
1636 AC_CONFIG_FILES([HeeHee])
1637 AC_OUTPUT
1640 AT_DATA([HeeHee.am],
1641 [[# Humans do no worse than `GNUmakefile.am'.
1642 AUTOMAKE_OPTIONS = foreign 1.8
1645 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1646          [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1647 AT_CHECK([test -f HeeHee.in])
1649 AT_CLEANUP