3 # Copyright (C) 2000-2017, 2020-2023 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 AT_BANNER([[Testing config.status.]])
22 ## ---------------------------------------- ##
23 ## AC_CONFIG_COMMANDS with empty commands. ##
24 ## ---------------------------------------- ##
26 AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
27 [[AC_CONFIG_COMMANDS([foo], [], [:])
31 ## --------------------------------------------- ##
32 ## AC_CONFIG_COMMANDS with temporary directory. ##
33 ## --------------------------------------------- ##
35 AT_CHECK_MACRO([AC_CONFIG_COMMANDS with temporary directory],
36 [[AC_CONFIG_COMMANDS([foo], [
40 test -d "$tmp" || AC_MSG_ERROR([No $tmp directory])
41 echo garbage-in > "$tmp/garbage-out"
51 AT_CHECK([test ! -f tmpdir])
52 AT_CHECK([ACTION=use ./config.status], [], [ignore])
53 AT_CHECK([test -s tmpdir && test ! -d "`cat tmpdir`"])
54 AT_CHECK([ACTION=corrupt ./config.status], [], [ignore])
55 AT_CHECK([test -s tmpdir && test ! -d "`cat tmpdir`"])
59 ## -------------------------- ##
60 ## Multiple AC_CONFIG_FILES. ##
61 ## -------------------------- ##
63 AT_SETUP([Multiple AC_CONFIG_FILES])
65 AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
66 AT_CHECK_AUTOCONF([], 1, [], [ignore])
71 ## ------------------------------- ##
72 ## parameterized AC_CONFIG_FILES. ##
73 ## ------------------------------- ##
75 AT_SETUP([Parameterized AC_CONFIG_FILES])
80 AC_CONFIG_FILES([$files])]])
81 AT_CHECK_AUTOCONF([], [], [], [ignore])
82 touch foo.in bar.in config.hin
93 # AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE, [STATUS = 1])
94 # ------------------------------------------------------------
95 # Check that AC_ARG_VAR caches the latest values, diagnoses
96 # inconsistencies, and arms config.status. Check that recheck
97 # returns STATUS, save configure output in files 'stdout' and 'stderr'
98 # for further inspection.
99 m4_define([AT_CHECK_AC_ARG_VAR],
104 [precious='m4_bpatsubst([$1], [[']], ['\\''])'; export precious],
106 AT_CHECK_CONFIGURE([--config-cache -q])
107 AT_CHECK([cat file], [], [`$1'
110 # Testing --recheck: 1. have the environment 'forget' about PRECIOUS.
112 # 2. Rerun config.status to recreate 'file'.
113 AT_CHECK([./config.status --recheck], [], [ignore])
114 AT_CHECK([./config.status], [], [ignore])
115 # 3. Check that file contains the old value of PRECIOUS.
116 AT_CHECK([cat file], [], [`$1'
119 # Second value: we should issue an error here: the value
122 [precious='$2'; export precious],
124 AT_CHECK_CONFIGURE([--config-cache], [m4_default([$3], [1])], [stdout], [stderr])
126 ])# AT_CHECK_AC_ARG_VAR
129 AT_SETUP([AC_ARG_VAR])
131 # We don't want to run this test if this shell doesn't support
134 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
141 AT_DATA([configure.ac],
143 AC_ARG_VAR([precious], [this variable costs a lot])
144 echo "precious:$precious"
152 AT_CHECK_AUTOCONF([], 0, [],
153 [[configure.ac:4: warning: AC_OUTPUT should be used without arguments.
154 configure.ac:4: You should run autoupdate.
157 # Set a precious variable
158 AT_CHECK_AC_ARG_VAR([], [apple of my eye])
160 # Unset a precious variable
161 AT_CHECK_AC_ARG_VAR([apple of my eye], [])
163 # Change a precious variable
164 AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
166 # Change a precious variable that contains braces
167 AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
169 # Change a precious variable that contains all kinds of fun
170 AT_CHECK_AC_ARG_VAR(['p r ec"iou$], [orange of my eye])
171 dnl restore font-lock: "
173 # Warn (but do not fail) about a whitespace-only change
174 AT_CHECK_AC_ARG_VAR([ apple of my eye ], [apple of my eye],
175 [0], ["has whitespace changes"])
176 mv stdout configure-output
177 AT_CHECK([grep "ignoring whitespace changes" stderr], [], [ignore])
178 AT_CHECK([grep "precious: apple" configure-output], [], [ignore])
185 ## ---------------------------------------------- ##
186 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
187 ## ---------------------------------------------- ##
189 AT_SETUP([[AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]])
191 AT_DATA([configure.ac],
194 rm -f -r header var-header file var-file link var-link command var-command
197 # Be sure to also stress the associated INIT-CMDS.
198 case $what_to_test in
200 AC_CONFIG_HEADERS(header:input);;
202 AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
205 AC_CONFIG_FILES(file:input);;
207 AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
210 AC_CONFIG_COMMANDS(command,
211 [cp input command]);;
213 AC_CONFIG_COMMANDS(var-command,
214 [cp $command_in var-command], [command_in=input]);;
217 AC_CONFIG_LINKS(link:input);;
219 AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
227 # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
228 # ------------------------------------------------------------------
229 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
230 # are properly created, with the right content.
231 # Use 'grep OK' instead of a simple 'cat' to avoid banners such as in
233 m4_define([AT_CHECK_CONFIG_CREATION],
234 [AT_CHECK_CONFIGURE([what_to_test=$1])
235 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
238 AT_CHECK([grep OK $1], [], [OK
241 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
242 # config.status might be stupidly expecting data on stdin, if it's
244 AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
245 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
248 AT_CHECK([grep OK var-$1], [], [OK
250 ])# AT_CHECK_CONFIG_CREATION
253 # AT_CHECK_CONFIG_CREATION_NOWRITE(THING = (header | link | file | command))
254 # --------------------------------------------------------------------------
255 # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
256 # are properly created, with the right content.
257 # Use 'grep OK' instead of a simple 'cat' to avoid banners such as in
259 m4_define([AT_CHECK_CONFIG_CREATION_NOWRITE],
260 [AT_CHECK_CONFIGURE([what_to_test=$1])
261 AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
264 AT_CHECK([grep OK $1], [], [OK
267 AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
268 # config.status might be stupidly expecting data on stdin, if it's
270 # Skip check if user can rename files into a read-only directory (when
271 # run by root or on w32).
274 mv t t1 >/dev/null 2>&1 \
275 || AT_CHECK([./config.status var-$1 </dev/null || exit 1],
276 [1], [ignore], [ignore])
279 ])# AT_CHECK_CONFIG_CREATION_NOWRITE
283 AT_CHECK_CONFIG_CREATION(file)
286 AT_CHECK_CONFIG_CREATION(header)
289 AT_CHECK_CONFIG_CREATION(command)
292 AT_CHECK_CONFIG_CREATION(link)
294 # Now check for write errors
297 AT_CHECK_CONFIG_CREATION_NOWRITE(file)
298 # Create a file with bits from stdin
299 AT_CHECK([echo from-stdin | ./config.status --file=file:-],
301 AT_CHECK([grep from-stdin file], [], [from-stdin
303 # Force write error creating a file on stdout
304 if test -w /dev/full && test -c /dev/full; then
305 AT_CHECK([./config.status --file=-:input </dev/null >/dev/full || exit 1],
306 [1], [ignore], [ignore])
309 # Validate that --file requires an argument
310 AT_CHECK([./config.status --file], [1], [ignore], [stderr])
311 AT_CHECK([grep 'missing file argument' stderr], [0], [ignore])
312 AT_CHECK([./config.status --file=], [1], [ignore], [stderr])
313 AT_CHECK([grep 'missing file argument' stderr], [0], [ignore])
316 AT_CHECK_CONFIG_CREATION_NOWRITE(header)
317 # Create a header on stdout
318 AT_CHECK([./config.status --header=-:input </dev/null],
319 [0], [stdout], [ignore])
320 AT_CHECK([grep OK stdout], [], [OK
322 # Force write error creating a header on stdout
323 if test -w /dev/full && test -c /dev/full; then
324 AT_CHECK([./config.status --header=-:input </dev/null >/dev/full || exit 1],
325 [1], [ignore], [ignore])
329 AT_CHECK_CONFIG_CREATION_NOWRITE(command)
332 AT_CHECK_CONFIG_CREATION_NOWRITE(link)
334 # Check that no use of 'ac_write_fail' escaped into config.status
335 AT_CHECK([grep ac_write_fail config.status], [1])
337 # Check that --file and --header accept funny file names
341 ./config.status --file=fgrep:fgrep.in
347 'with funny '\'' $x & #! name' \
348 'file with funny \ '\'' \'\'' $ & #!*? name' \
349 'with funny \ '\'' \'\'' " | <a >b & * ? name ' # "restore font-lock
351 # The function func_sanitize_file_name comes from tools.at
352 file=`func_sanitize_file_name "$file"`
353 cat >"$file.in" <<'END'
356 AT_CHECK([./config.status "--file=$file:$file.in"],
358 AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
359 AT_CHECK([./config.status "--header=$file:$file.in"],
361 # Run the same test a 2nd time to see that config.status does not recreate
362 # the header (regression test)
363 AT_CHECK_UNQUOTED([./config.status "--header=$file:$file.in"],
364 [0], [config.status: creating $file
365 config.status: $file is unchanged
367 AT_CHECK_UNQUOTED([grep ' & ' "$file"], [],
368 [/* $file. Generated from $file.in by configure. */
370 AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
376 ## ---------------------------------------- ##
377 ## Macro calls in AC_CONFIG_COMMANDS tags. ##
378 ## ---------------------------------------- ##
380 AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
382 AT_DATA_M4SUGAR([configure.ac],
384 AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
395 ## ------------------- ##
396 ## Missing templates. ##
397 ## ------------------- ##
399 # Check that config.status detects missing input files
400 AT_SETUP([Missing templates])
402 AT_DATA([configure.ac],
404 AC_CONFIG_FILES([nonexistent])
410 AT_CAPTURE_FILE([build/config.log])[]dnl
412 AT_CHECK([../configure], [1], [ignore],
413 [[config.status: error: cannot find input file: 'nonexistent.in'
415 # Make sure that the output file doesn't exist
416 AT_CHECK([test -f nonexistent], 1)
418 AT_CHECK_CONFIGURE([], [1], [],
419 [[config.status: error: cannot find input file: 'nonexistent.in'
421 # Make sure that the output file doesn't exist
422 AT_CHECK([test -f nonexistent], 1)
429 ## ---------------------- ##
430 ## configure invocation. ##
431 ## ---------------------- ##
433 # Check that 'configure' and 'config.status' honor their interface.
435 # We run './configure one=val1 --enable-two=val2 --with-three=val3'
436 # and verify that (i) 'configure' correctly receives the arguments,
437 # (ii) correctly passes them to 'config.status', which we check by
438 # running 'config.status --recheck', (iii) correctly passes them
439 # to sub-configure scripts, and (iv) correctly reproduces them with
440 # 'config.status --config'.
442 AT_SETUP([configure invocation])
446 AT_DATA([configure.ac],
448 AC_CONFIG_SUBDIRS([sub])
449 echo "result=$one$enable_two$with_three"
453 AT_DATA([sub/configure.ac],
455 echo "result=$one$enable_two$with_three"
459 echo fake install-sh script >install-sh
466 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
467 sed -n -e 's/^result=//p'], 0,
471 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
474 AT_CHECK([args=`./config.status --config` && eval ./configure \$configure_options "$args" |
475 sed -n -e 's/^result=//p'], 0,
480 AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
481 sed -n -e 's/^result=//p'], 0,
482 [m4_do(["'$ " ' $ "'$
485 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
488 dnl restore font-lock: "
489 AT_CHECK([args=`./config.status --config` && eval ./configure \$configure_options "$args" |
490 sed -n -e 's/^result=//p'], 0,
491 [m4_do(["'$ " ' $ "'$
499 ## ---------------------- ##
500 ## --help and --version. ##
501 ## ---------------------- ##
503 AT_SETUP([--help and --version in unwritable directory])
506 AT_DATA([inner/configure.ac],
511 AT_CHECK_M4([(cd inner && autoconf --force)])
512 AT_CHECK([test -s inner/configure])
513 if test "$SHELL_N" != none; then
514 AT_CHECK_SHELL_SYNTAX([inner/configure])
518 AT_CHECK([(cd inner && ./configure --help)], 0, [ignore], [ignore])
519 AT_CHECK([(cd inner && ./configure --version)], 0, [ignore], [ignore])
526 ## -------------------------------------------- ##
527 ## Check that '#define' templates are honored. ##
528 ## -------------------------------------------- ##
530 # Use various forms of '#define' templates, and make sure there are no
531 # problems when a symbol is prefix of another.
533 AT_SETUP([@%:@define header templates])
534 AT_KEYWORDS([AC@&t@_DEFINE])
536 AT_DATA([configure.ac],
538 AC_CONFIG_HEADERS(config.h:config.hin)
540 # I18n of dummy variables: their French translations.
544 AC_DEFINE(fubar, tutu)
546 # Symbols which are prefixes of another.
551 # backslash-newline combinations
552 AC_DEFINE([multiline], [line1\
556 AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
558 AC_CONFIG_FILES(defs)
561 AC_DEFINE([paste(a,b)], [a##b])
563 # Things included in confdefs.h, but which make no sense in
564 # config.h, nor in $DEFS.
565 cat <<\EOF >>confdefs.h
566 /* Hi Mum! Look, I am doing C++! */
568 void exit (int status);
572 # In addition of config.h output a full DEFS
583 AT_DATA([config.hin],
586 # define baz "Archimedes was sinking in his baz"
594 #define aaa(a, aa) aa a
596 #define aaac(a, aa) aa a
598 # undef multiline_args
599 #define paste(a,b) a##b
601 #define str(define) \
603 #define stringify(arg) str(arg)
604 #undef aaa /* with comments */
605 #undef not_substed /* with comments */
612 [[/* config.h. Generated from config.hin by configure. */
625 #define aaac(a, aa) aa a
626 #define multiline line1\
630 # define multiline_args(ARG1, ARG2) ARG2 \
632 #define paste(a,b) a##b
634 #define str(define) \
636 #define stringify(arg) str(arg)
638 /* #undef not_substed */
640 AT_CHECK([cat config.h], 0, expout)
642 # Check the value of DEFS.
644 [[-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
647 # Because we strip trailing spaces in 'testsuite' we can't leave one in
648 # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
649 AT_CHECK([sed -e 's/ $//' defs], 0, expout)
655 ## ------------------------- ##
656 ## Torturing config.status. ##
657 ## ------------------------- ##
659 ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
660 ## big value. This is mostly to check that Autoconf produces portable sed
661 ## scripts in config.status. sed is used to skip the first two lines
662 ## 'Generated by ...'.
664 # We use m4_for many times.
665 m4_pattern_allow([^m4_for$])
667 AT_SETUP([Torturing config.status])
669 dnl The value used as a big value for AC_DEFINE.
670 dnl Don't use sh active chars here, below it is also used in a sh
672 m4_define([AT_BIG_VALUE],
673 [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
675 m4_define([AT_DESCRIPTION],
676 [Define to a long string if your 'Autoconf' works properly.])
679 # AT_DUMMY_VAR(NUMBER)
680 # --------------------
681 # Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
682 # so that the check for user name space invasion does not complain
683 # of the new variables defined.
685 # Note that you should not use the name ac_dummy, because it will be
686 # turned into ac_uummy during the construction of config.status. Yes,
687 # this is admittedly a bug, but it would be too hard to fix this.
688 # There is really no point in AC_DEFINE a var named ac_d.*.
689 m4_pattern_allow([^m4_bpatsubst$])
690 m4_define([AT_DUMMY_VAR],
691 [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
696 [m4_for([AT_Count], 1, 100, 1,
697 [@AT_DUMMY_VAR(AT_Count)@
703 while test $i != 101; do
704 echo "content of file $i" > file_$i
705 AS_VAR_ARITH([i], [$i + 1])
713 m4_pattern_allow([^m4_(define|defun)$])
714 AT_DATA([configure.ac],
715 dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
716 dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
717 [[m4_define([AC_DUMMY_VAR],]
718 m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
720 [[m4_define([AC_DESCRIPTION],]
721 m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
723 [[m4_define([AC_BIG_VALUE],]
724 m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
728 # Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
729 # used in the torture tests.
730 m4_defun([AC_DEFUBST],
731 [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
732 AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
734 AC_SUBST(AC_DUMMY_VAR($1))
740 AC_CONFIG_HEADERS(config.h:config.hin)
741 AC_CONFIG_FILES(dummy)
742 m4_for(AC_Count, 1, 100, 1,
743 [AC_DEFUBST(AC_Count)])
749 AT_CHECK_AUTOHEADER([],
750 m4_for(AT_Count, 1, 100, 1, [ AT_DUMMY_VAR(AT_Count)]))
752 # Check both awk and the result of AC_PROG_AWK.
753 # Quote the first word in the for list for Solaris sh.
754 for awk_arg in "FOO=" AWK=awk; do
755 AT_CHECK_CONFIGURE([$awk_arg])
757 # Checking that AC_DEFINE worked properly.
759 [/* Define to the address where bug reports for this package should be sent. */
760 #define PACKAGE_BUGREPORT ""
762 /* Define to the full name of this package. */
763 #define PACKAGE_NAME ""
765 /* Define to the full name and version of this package. */
766 #define PACKAGE_STRING ""
768 /* Define to the one symbol short name of this package. */
769 #define PACKAGE_TARNAME ""
771 /* Define to the home page for this package. */
772 #define PACKAGE_URL ""
774 /* Define to the version of this package. */
775 #define PACKAGE_VERSION ""
776 m4_for(AT_Count, 1, 100, 1,
779 [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
782 AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
784 # Checking that AC_SUBST worked properly.
786 [m4_for(AT_Count, 1, 100, 1,
788 content of file AT_Count
791 AT_CHECK([cat dummy], 0, expout)
797 ## ------------------------------- ##
798 ## Substitute a 2000-byte string. ##
799 ## ------------------------------- ##
801 # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
802 # sed dumps core around 8 KiB. However, POSIX says that sed need not
803 # handle lines longer than 2048 bytes (including the trailing newline).
804 # So we'll just test a 2000-byte value, and for awk, we test a line with
805 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
806 # multi-line values should allow to get around the limitations.
807 # We also test runs of around 148 backslashes: they need to be escaped,
808 # and 148 is the portable limit for awk string literals. config.status
809 # uses concatenation to generate longer strings.
811 AT_SETUP([Substitute a 2000-byte string])
813 AT_DATA([Foo.in], [@foo@
815 AT_DATA([Bar.in], [@bar@
817 AT_DATA([Baz.in], [@baz@
819 AT_DATA([Boo.in], [@b147@
827 AT_DATA([configure.ac],
829 AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
830 AC_SUBST([bar], "]m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)[")
831 baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
833 baz=$baz$baz$baz$baz$baz
835 b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
836 b147=$b29$b29$b29$b29$b29'\\'
849 AC_CONFIG_FILES([Foo Bar Baz Boo])
853 cp "$abs_top_srcdir/build-aux/install-sh" .
855 b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
856 b147=$b29$b29$b29$b29$b29'\\'
868 # Check both awk and the result of AC_PROG_AWK
869 # Quote the first word in the for list for Solaris sh.
870 for awk_arg in "Foo=" AWK=awk; do
871 AT_CHECK_CONFIGURE([$awk_arg])
872 AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
874 AT_CHECK([cat Bar], 0, m4_for([n], 1, 100,, @ @ @ @ @ @ @ @ @ @@)
877 [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
879 AT_CHECK([cat Baz], 0, [stdout])
880 AT_CHECK([diff Boo-exp Boo])
885 ## ------------------------------ ##
886 ## Define to a 2000-byte string. ##
887 ## ------------------------------ ##
889 AT_SETUP([Define to a 2000-byte string])
890 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
894 AC_DEFINE_UNQUOTED([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
895 AC_DEFINE([fooq], ]m4_for([n], 1, 100,, ....................)[, [desc])
899 AT_CHECK_AUTOHEADER([], [foo fooq])
901 AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
902 @%:@define fooq m4_for([n], 1, 100,, ....................)
907 ## ------------------------------------------ ##
908 ## Substitute and define special characters. ##
909 ## ------------------------------------------ ##
911 # Use characters special to the shell, sed, awk, and M4.
913 AT_SETUP([Substitute and define special characters])
914 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
916 AT_XFAIL_IF([byte=\\200s; dnl
917 test `{ printf $byte; echo; } | sed -n '/^./p' | wc -l` = 0])
919 AT_DATA([Foo.in], [@foo@
920 @bar@@notsubsted@@baz@ stray @ and more@@@baz@
937 AT_DATA([Zardoz.in], [@zardoz@
941 [[foo="AS@&t@_ESCAPE([[X*'[]+ ", & &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !]])"
945 ( for i in 0 1 2 3; do
946 for j in 0 1 2 3 4 5 6 7; do
947 for k in 0 1 2 3 4 5 6 7; do
949 000 | 015 | 377) ;; # MinGW awk dislikes 0xFF, and the test does
950 # the wrong thing for CR on MinGW.
952 *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
959 zardoz=`cat allowed-chars`
965 AC_SUBST_FILE([file])
966 AC_DEFINE([fooq], [[X*'[]+ ", & &`\($foo !]], [Awful value.])
967 AC_DEFINE([barq], [[%!_!# X]], [Value that is used as special delimiter.])
968 AC_DEFINE_UNQUOTED([foo], [[X*'[]+ ", & &\`\\(\$foo !]], [Awful value.])
969 AC_DEFINE_UNQUOTED([bar], [[%!_!# X]], [Value that is used as special delimiter.])
970 AC_DEFINE_UNQUOTED([unq1], [$baz], [unquoted, test 1])
971 AC_DEFINE_UNQUOTED([unq2], [\$baz], [unquoted, test 2])
972 AC_DEFINE_UNQUOTED([unq3], ["$baz"], [unquoted, test 3])
973 AC_DEFINE_UNQUOTED([unq4], [${baz+set}], [unquoted, test 4])
974 AC_DEFINE_UNQUOTED([unq5], ["${baz+`echo "a "' b'`}"], [unquoted, test 5])
975 AC_DEFINE_UNQUOTED([unq6], [`echo hi`], [unquoted, test 6])
976 AC_DEFINE_UNQUOTED([unq7], ['\\"'], [unquoted, test 7])
978 AC_CONFIG_FILES([Foo Zardoz])]])
981 AT_CHECK_AUTOHEADER([],
982 [foo fooq bar barq unq1 unq2 unq2 unq3 unq4 unq5 unq6 unq7])
983 # Check both awk and the result of AC_PROG_AWK
984 # Quote the first word in the for list for Solaris sh.
985 for awk_arg in "FOO=" AWK=awk; do
986 AT_CHECK_CONFIGURE([$awk_arg])
987 AT_CHECK([cat Foo], 0, [[X*'[]+ ", & &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
988 @foo@ @baz@@notsubsted@bla stray @ and more@@bla
989 abc@foo@ @baz@baz@baz
991 abc@foo@ @baz@blabaz@
1000 AT_CHECK([cmp allowed-chars Zardoz])
1001 AT_CHECK_DEFINES([[#define bar %!_!# X
1002 #define barq %!_!# X
1003 #define foo X*'[]+ ", & &`\($foo !
1004 #define fooq X*'[]+ ", & &`\($foo !
1017 ## ---------------------- ##
1018 ## Substitute a newline. ##
1019 ## ---------------------- ##
1021 AT_SETUP([Substitute a newline])
1028 AT_DATA([configure.ac],
1036 AC_CONFIG_FILES([Foo])
1041 cp "$abs_top_srcdir/build-aux/install-sh" .
1049 # Check both awk and the result of AC_PROG_AWK
1050 # Quote the first word in the for list for Solaris sh.
1051 for awk_arg in "FOO=" AWK=awk; do
1052 AT_CHECK_CONFIGURE([$awk_arg])
1053 AT_CHECK([cat Foo], 0, [expout])
1058 ## ------------------ ##
1059 ## Define a newline. ##
1060 ## ------------------ ##
1062 AT_SETUP([Define a newline])
1063 AT_KEYWORDS([AC@&t@_DEFINE AC@&t@_DEFINE_UNQUOTED])
1064 AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
1065 two], [This spans two lines.])
1067 AT_CHECK_AUTOCONF([], [], [], [stderr])
1068 dnl Older versions of m4 report error at line 5 (end of macro);
1069 dnl newer versions report it at line 4 (start of macro).
1070 AT_CHECK([[sed '/trailer\.m4:/d; s/^configure\.ac:[45]: //' stderr]], [],
1071 [[warning: AC_DEFINE: 'one
1072 two' is not a valid preprocessor define value
1074 AT_CHECK_AUTOHEADER([], [foo])
1076 AT_CHECK_DEFINES([[#define foo one
1079 rm -rf autom4te.cache
1081 AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
1082 two], [This spans two lines.])
1084 AT_CHECK_AUTOCONF([], [], [], [stderr])
1085 AT_CHECK([[sed '/trailer.m4:/d; s/^configure\.ac:[45]: //' stderr]], [],
1086 [[warning: AC_DEFINE_UNQUOTED: 'one
1087 two' is not a valid preprocessor define value
1089 AT_CHECK_AUTOHEADER([], [foo])
1091 AT_CHECK_DEFINES([[#define foo one
1097 ## ------------------------------------ ##
1098 ## AC_SUBST: variable name validation. ##
1099 ## ------------------------------------ ##
1101 AT_SETUP([AC_SUBST: variable name validation])
1103 AT_CONFIGURE_AC([[AC_SUBST(, [])
1104 AC_CONFIG_FILES([Makefile])
1106 AT_DATA([Makefile.in], [[
1108 mv -f configure.ac configure.tmpl
1111 for var in ['' ab\~ ab\( ab[] ab\' ab\" ab\\\\]; do
1112 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
1113 AT_CHECK_AUTOCONF([], [1], [], [ignore])
1117 for var in ab a4 'a@@&t@\&t@b'; do
1118 sed ["s/AC_SUBST(/&[$var]/"] <configure.tmpl >configure.ac
1127 ## ------------------------ ##
1128 ## datarootdir workaround. ##
1129 ## ------------------------ ##
1131 AT_SETUP([datarootdir workaround])
1145 AT_DATA([configure.ac],
1147 d@&t@nl The following line silences the warnings, if uncommented:
1148 d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
1150 # This substitution is wrong and bogus! Don't use it in your own code!
1151 # Read 'info Autoconf "Defining Directories"'!
1152 AC_SUBST([mydatadir], [${datadir}/my])
1154 AC_CONFIG_FILES([Foo Bar])
1158 cp "$abs_top_srcdir/build-aux/install-sh" .
1161 AT_CHECK_CONFIGURE([], [], [],
1162 [config.status: WARNING: 'Foo.in' seems to ignore the --datarootdir setting
1163 config.status: WARNING: Bar contains a reference to the variable 'datarootdir'
1164 which seems to be undefined. Please make sure it is defined
1166 AT_CHECK([grep datarootdir Foo], 1, [])
1169 sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
1189 AT_DATA([configure.ac],
1192 AC_CONFIG_FILES([foo at-dir/bar])
1194 # Use quotes in the INIT-COMMANDS to accommodate a value of $srcdir
1195 # containing e.g., spaces or shell meta-characters.
1196 # Use *single* quotes because the context is an unquoted here-doc.
1197 AC_CONFIG_COMMANDS([report],
1198 [test -f "$srcdir/configure.ac" ||
1199 AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
1203 rm -f -r foo at-dir/bar
1209 AT_CHECK([./configure $configure_options], [], [ignore])
1212 AT_CHECK([cd at-dir && ../configure $configure_options], [], [ignore])
1216 AT_CHECK([cd at-dir && "$at_here/configure" $configure_options], [], [ignore])
1227 dirs='at paren brace space'
1228 for dir in $dirs; do
1229 mkdir $dir $dir/s1 $dir/s2
1230 touch $dir/f $dir/s1/f1 $dir/s2/f2
1233 AT_DATA([configure.ac],
1235 AC_CONFIG_FILES([at/Makefile paren/Makefile brace/Makefile space/Makefile])
1239 AT_DATA([at/Makefile.in],
1240 [[# This is what you should use in order to be portable to old makes.
1242 VPATH = @srcdir@/s1:@srcdir@:@srcdir@/s2
1247 AT_DATA([paren/Makefile.in],
1248 [[# This works with some makes but not with old ones.
1250 VPATH = $(srcdir)/s1:$(srcdir):$(srcdir)/s2
1255 AT_DATA([brace/Makefile.in],
1256 [[# This works with some makes but not with old ones.
1258 VPATH = ${srcdir}/s1:${srcdir}:${srcdir}/s2
1263 AT_DATA([space/Makefile.in],
1264 [[# This fails with FreeBSD make, for example.
1266 VPATH = @srcdir@/s1 @srcdir@ @srcdir@/s2
1274 AT_CHECK([./configure $configure_options], [], [ignore])
1275 # Treat BSD make separately, afterwards, for maximal coverage.
1276 dirs='at paren brace'
1277 for dir in $dirs; do
1278 AT_CHECK_MAKE([], [$dir])
1282 mkdir build absbuild
1285 AT_CHECK([cd build && ../configure $configure_options], [], [ignore])
1286 for dir in $dirs; do
1287 AT_CHECK_MAKE([], [build/$dir])
1292 AT_CHECK([cd absbuild && "$at_here/configure" $configure_options], [], [ignore])
1293 for dir in $dirs; do
1294 AT_CHECK_MAKE([], [absbuild/$dir])
1297 # These will not pass with BSD make.
1298 AT_CHECK_MAKE([|| exit 77], [space])
1299 AT_CHECK_MAKE([], [build/space])
1300 AT_CHECK_MAKE([], [absbuild/space])
1306 ## ----------------- ##
1307 ## Signal handling. ##
1308 ## ----------------- ##
1310 AT_SETUP([Signal handling])
1312 AT_DATA([configure.ac],
1320 AT_CHECK_CONFIGURE([], [1], [ignore], [ignore])
1325 ## ----------------- ##
1326 ## AC_CONFIG_LINKS. ##
1327 ## ----------------- ##
1329 AT_SETUP([AC_CONFIG_LINKS])
1331 AT_DATA([configure.ac],
1332 [[AC_INIT([config links to config files test], [1.0])
1333 AC_CONFIG_SRCDIR([sub1/file1.in])
1334 AC_CONFIG_FILES([sub1/file1 file2])
1335 AC_CONFIG_LINKS([file1:sub1/file1 sub2/file2:file2])
1341 AT_DATA([sub1/file1.in],
1342 [[/* @configure_input@ */
1343 #define PACKAGE_STRING "@PACKAGE_STRING@"
1347 [[/* @configure_input@ */
1348 #define PACKAGE_STRING "@PACKAGE_STRING@"
1354 AT_CHECK([../configure && ../configure], 0, [ignore])
1355 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1357 AT_CHECK([../configure && ../configure], 0, [ignore])
1358 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1365 AT_CHECK(["$cwd"/../configure && "$cwd"/../configure], 0, [ignore])
1366 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1369 AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
1370 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1373 AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
1374 AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
1380 ## ------------------------------------- ##
1381 ## AC_CONFIG_LINKS and identical files. ##
1382 ## ------------------------------------- ##
1383 AT_SETUP([AC_CONFIG_LINKS and identical files])
1385 AT_DATA([configure.ac],
1387 AC_CONFIG_LINKS([src/s:src/s])
1388 test "$srcdir" != '.' && AC_CONFIG_LINKS([src/t:src/t])
1397 AT_CHECK([../configure $configure_options && ../configure $configure_options],
1399 AT_CHECK([cat src/s src/t], 0, [file1
1408 AT_CHECK(["$cwd"/../configure], 0, [ignore])
1409 AT_CHECK([cat src/s src/t], 0, [file1
1412 AT_CHECK(["$cwd"/../configure], 0, [ignore])
1413 AT_CHECK([cat src/s src/t], 0, [file1
1417 AT_CHECK([./configure $configure_options && ./configure $configure_options],
1418 0, [ignore], [stderr])
1419 AT_CHECK([grep src/t stderr], 1)
1420 AT_CHECK([cat src/s src/t], 0, [file1
1424 AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
1425 AT_CHECK([cat src/s src/t], 0, [file1
1432 AT_BANNER([autoreconf.])
1434 ## ---------------------------- ##
1435 ## Configuring subdirectories. ##
1436 ## ---------------------------- ##
1441 # | |-- config.status
1444 # | |-- config.status
1451 # | |-- configure.ac
1456 AT_SETUP([Configuring subdirectories])
1457 AT_KEYWORDS(autoreconf)
1459 # We use aclocal (via autoreconf).
1460 AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
1461 AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
1463 # It should understand configure.ac.
1464 AT_CHECK([[grep '[^0-9]1\.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
1466 # Prevent aclocal from reading third-party macros, in case they are buggy.
1468 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1471 # The contents of 'inner/', and 'inner/innermost/'.
1472 AS_MKDIR_P([inner/innermost])
1474 AT_DATA([inner/configure.ac],
1475 [[AC_INIT(GNU Inner, 1.0)
1476 AC_CONFIG_SRCDIR([innermost/config.in])
1477 AC_ARG_VAR([INNER], [an inner variable])
1479 if test "x$INNER" = x; then
1482 AC_CONFIG_FILES([innermost/config])
1486 AT_DATA([inner/innermost/config.in],
1489 top_srcdir=@top_srcdir@
1493 # The contents of '.'
1494 AT_DATA([install-sh], [])
1496 # nonexistent is allowed not to exist.
1497 AT_DATA([configure.ac],
1498 [[AC_INIT(GNU Outer, 1.0)
1499 AC_ARG_VAR([OUTER], [an outer variable])
1501 AC_CONFIG_SUBDIRS([nonexistent])
1503 AC_CONFIG_SUBDIRS([inner])
1507 AT_CHECK([autoreconf])
1508 AT_CHECK([test -f inner/configure])
1510 # Running the outer configure recursively should provide the innermost
1512 chmod a-w inner/innermost inner .
1513 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep INNER], 0,
1515 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1516 chmod u+w . inner inner/innermost
1518 # Running the outer configure should trigger the inner.
1520 AT_CHECK([cat inner/innermost/config], 0,
1527 # The same, but from a builddir.
1528 AS_MKDIR_P([builddir])
1529 AT_CHECK([cd builddir && ../configure $configure_options], 0, [ignore])
1530 AT_CHECK([cat builddir/inner/innermost/config], 0,
1532 srcdir=../../../inner/innermost
1533 top_srcdir=../../../inner
1537 # Make sure precious variables and command line options are properly
1538 # passed, even when there are duplicates.
1539 AT_CHECK([cd builddir && ../configure $configure_options --prefix /bad --prefix /good INNER=bad INNER=good],
1541 AT_CHECK([cat builddir/inner/innermost/config], 0,
1543 srcdir=../../../inner/innermost
1544 top_srcdir=../../../inner
1548 # Make sure --prefix is properly quoted
1549 AT_CHECK([cd builddir && ../configure --prefix "/a b c$ 'd"], 0, [ignore])
1550 AT_CHECK([cat builddir/inner/innermost/config], 0,
1552 srcdir=../../../inner/innermost
1553 top_srcdir=../../../inner
1557 # Make sure --silent is properly passed...
1558 AT_CHECK([cd builddir && ../configure $configure_options --silent], 0, [])
1559 # ...but not stored in config.status.
1560 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
1561 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
1563 # --cache-file is adjusted for subdirectories, so the cache is shared.
1564 AT_CHECK([cd builddir && ../configure $configure_options --config-cache],
1566 AT_CHECK([grep 'loading .*\.\./config.cache' stdout], [], [ignore])
1568 # Make sure we can run autoreconf on a subdirectory
1569 rm -f configure configure.ac
1570 AT_CHECK([autoreconf inner], [], [], [ignore])
1572 # Make sure we can pass a configure.ac name
1573 AT_CHECK([cd inner && autoreconf configure.ac], [], [], [ignore])
1574 AT_CHECK([autoreconf inner/configure.ac], [], [], [ignore])
1580 ## -------------- ##
1582 ## -------------- ##
1584 AT_SETUP([Deep Package])
1585 AT_KEYWORDS(autoreconf)
1587 # We use aclocal (via autoreconf).
1588 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1590 # Prevent aclocal from reading third-party macros, in case they are buggy.
1592 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1595 # The contents of '.'
1596 AT_DATA([install-sh], [])
1597 AT_DATA([configure.ac],
1598 [[AC_INIT(GNU Outer, 1.0)
1599 AC_ARG_VAR([OUTER], [an outer variable])
1607 # The contents of 'inner/', and 'inner/innermost/'.
1608 AS_MKDIR_P([inner/innermost])
1609 AS_MKDIR_P([inner2])
1611 AT_DATA([inner/configure.ac],
1612 [[AC_INIT(GNU Inner, 1.0)
1613 AC_ARG_VAR([INNER], [an inner variable])
1614 AC_CONFIG_SUBDIRS(innermost)
1618 AT_DATA([inner/innermost/configure.ac],
1619 [[AC_INIT(GNU Innermost, 1.0)
1620 AC_ARG_VAR([INNERMOST], [an innermost variable])
1621 AC_CONFIG_HEADERS(config.h:config.hin)
1622 AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
1623 if test -n "$innermost_error"; then
1624 AC_MSG_FAILURE([error in $PACKAGE_NAME])
1629 AT_DATA([inner2/configure.ac],
1630 [[AC_INIT(GNU Inner 2, 1.0)
1631 AC_ARG_VAR([INNER2], [an inner2 variable])
1635 AT_CHECK([autoreconf -Wall], [0], [ignore])
1636 AT_CHECK([test -f inner/configure])
1637 AT_CHECK([test -f inner/innermost/configure])
1638 AT_CHECK([test -f inner/innermost/config.hin])
1639 AT_CHECK([test -f inner2/configure])
1641 # Running the outer configure recursively should provide the innermost
1643 chmod a-w inner/innermost inner
1644 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER "],
1645 0, [ignore], [stderr],
1646 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1648 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER2 "],
1649 0, [ignore], [stderr],
1650 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1652 AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1653 0, [ignore], [stderr],
1654 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1656 AT_CHECK([{ /bin/sh ./configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1657 0, [ignore], [stderr],
1658 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1660 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure $configure_options --help=recursive; chmod +w .; } | grep " INNERMOST "],
1661 0, [ignore], [stderr],
1662 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1664 AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1665 0, [ignore], [stderr],
1666 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1667 chmod u+w inner inner/innermost
1669 # Running the outer configure should trigger the inner.
1670 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
1671 AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
1672 [[#define INNERMOST tsomrenni
1675 # Ensure we point to the right config.log file for errors.
1676 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1677 AT_CHECK([grep 'inner/innermost' stderr], [], [ignore])
1679 AT_CHECK_CONFIGURE([innermost_error=:], [1], [], [stderr])
1680 AT_CHECK([grep 'innermost' stderr], [], [ignore])
1683 # The same, but from a builddir.
1684 AS_MKDIR_P([builddir])
1685 chmod a-w builddir inner/innermost inner
1686 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER "],
1687 0, [ignore], [stderr],
1688 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1690 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNER2 "],
1691 0, [ignore], [stderr],
1692 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1694 AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1695 0, [ignore], [stderr],
1696 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1698 AT_CHECK([cd builddir && { /bin/sh ../configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1699 0, [ignore], [stderr],
1700 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1702 # Not all shells search $PATH for scripts.
1703 if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure $configure_options --help) >/dev/null 2>&1; then
1704 AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure $configure_options --help=recursive | grep " INNERMOST "], 0, [ignore])
1706 AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { configure $configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
1707 0, [ignore], [stderr],
1708 [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
1709 chmod u+w builddir inner inner/innermost
1710 AT_CHECK([cd builddir && ../configure $configure_options INNERMOST=build/tsomrenni], 0, [ignore])
1711 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
1712 [[#define INNERMOST build/tsomrenni
1719 ## -------------------------------- ##
1720 ## Non-Autoconf AC_CONFIG_SUBDIRS. ##
1721 ## -------------------------------- ##
1723 AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
1724 AT_KEYWORDS([autoreconf])
1726 # We use aclocal (via autoreconf).
1727 AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
1729 # Prevent aclocal from reading third-party macros, in case they are buggy.
1731 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1734 AT_DATA([install-sh], [])
1735 AT_DATA([configure.ac],
1736 [[AC_INIT(GNU Outer, 1.0)
1737 AC_CONFIG_SUBDIRS([inner])
1743 AT_DATA([inner/configure],
1746 *--help*) echo 'No Autoconf here, folks!' ;;
1747 *) echo got_it >myfile ;;
1751 chmod +x inner/configure
1753 AT_CHECK([autoreconf -Wall], 0, [ignore])
1755 # Running the outer configure recursively should provide the innermost
1757 AT_CHECK([./configure $configure_options --help=recursive | grep "folks"],
1760 # Running the outer configure should trigger the inner.
1761 AT_CHECK([./configure $configure_options], 0, [ignore])
1762 AT_CHECK([test -f inner/myfile], 0)
1767 ## ------------------------------- ##
1768 ## Non-literal AC_CONFIG_SUBDIRS. ##
1769 ## ------------------------------- ##
1771 AT_SETUP([Non-literal AC_CONFIG_SUBDIRS])
1772 AT_KEYWORDS([autoreconf])
1774 AT_DATA([install-sh], [])
1775 AT_DATA([configure.ac],
1776 [[AC_INIT(GNU Outer, 1.0)
1779 # Taken from autoconf.texi:Subdirectories.
1780 if test "x$package_foo_enabled" = xyes; then
1781 my_subdirs="$my_subdirs foo"
1783 AC_CONFIG_SUBDIRS([$my_subdirs])
1787 # Prevent autoreconf from running aclocal, which might not exist,
1788 # or could barf over warnings in third-party macro files.
1789 AT_DATA([aclocal.m4])
1795 AT_DATA([foo/configure],
1800 chmod +x foo/configure
1802 # autoreconf should warn without -Wno-syntax, but should not fail without -Werror.
1803 AT_CHECK([autoreconf -Werror -v], [1], [ignore], [stderr])
1804 AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [0], [ignore])
1805 AT_CHECK([autoreconf -v], [0], [ignore], [stderr])
1806 AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [0], [ignore])
1807 AT_CHECK([autoreconf -v --force -Wno-syntax], 0, [ignore], [stderr])
1808 AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [1])
1810 AT_CHECK([./configure $configure_options], [0], [ignore])
1811 AT_CHECK([test ! -f foo/innerfile])
1812 # Running the outer configure should trigger the inner.
1813 AT_CHECK([./configure $configure_options package_foo_enabled=yes], [0], [ignore])
1814 AT_CHECK([test -f foo/innerfile])
1818 ## ------------------------- ##
1819 ## Empty AC_CONFIG_SUBDIRS. ##
1820 ## ------------------------- ##
1822 AT_SETUP([Empty AC_CONFIG_SUBDIRS])
1823 AT_KEYWORDS([autoreconf])
1825 AT_DATA([install-sh], [])
1826 AT_DATA([configure.ac],
1827 [[AC_INIT(GNU Outer, 1.0)
1833 # Prevent autoreconf from running aclocal, which might not exist,
1834 # or could barf over warnings in third-party macro files.
1835 AT_DATA([aclocal.m4])
1839 # autoreconf should have no complaints, and the generated configure
1840 # script should run fine with or without --no-recursion.
1841 AT_CHECK([autoreconf -Werror], [0], [ignore])
1842 AT_CHECK_CONFIGURE()
1843 AT_CHECK_CONFIGURE([--no-recursion])
1847 ## ----------------- ##
1848 ## Empty directory. ##
1849 ## ----------------- ##
1851 AT_SETUP([Empty directory])
1852 AT_KEYWORDS([autoreconf])
1854 # Prevent autoreconf from running aclocal, which might not exist,
1855 # or could barf over warnings in third-party macro files.
1859 # The test group directory is not necessarily _empty_, but it does not contain
1860 # files meaningful to 'autoreconf'.
1862 AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
1868 ## ------------------------------ ##
1869 ## Unusual Automake input files. ##
1870 ## ------------------------------ ##
1872 # This parallels gnumake.test in Automake.
1874 AT_SETUP([Unusual Automake input files])
1875 AT_KEYWORDS([autoreconf])
1877 # We use aclocal and automake via autoreconf.
1878 AT_CHECK([automake --version || exit 77], [], [stdout], [ignore])
1879 AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
1881 # Prevent aclocal from reading third-party macros, in case they are buggy.
1882 # (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.)
1884 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1887 AT_DATA([configure.ac],
1888 [[AC_INIT(GNU foo, 1.0)
1890 AC_CONFIG_FILES([HeeHee])
1894 AT_DATA([HeeHee.am],
1895 [[# Humans do no worse than 'GNUmakefile.am'.
1896 AUTOMAKE_OPTIONS = foreign 1.8
1899 AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
1900 [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
1901 AT_CHECK([test -f HeeHee.in])
1905 ## ------------------------------ ##
1906 ## Specific warnings options. ##
1907 ## ------------------------------ ##
1909 AT_SETUP([Specific warnings options for autoreconf])
1910 AT_KEYWORDS([autoreconf])
1912 # If autoreconf is given a -W option that's mentioned in its own
1913 # --help output, that option should not cause errors, even if some
1914 # of the subsidiary programs don't support it.
1916 # We use aclocal and automake via autoreconf.
1917 AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
1919 # Prevent aclocal from reading third-party macros, in case they are buggy.
1920 # (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.)
1922 ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
1925 AT_DATA([configure.ac],
1926 [[AC_INIT(GNU foo, 1.0)
1928 AC_CONFIG_HEADERS([config.h])
1929 AC_CONFIG_FILES([Makefile])
1933 AT_DATA([Makefile.am],
1934 [[AUTOMAKE_OPTIONS = foreign
1937 # To silence complaints about required helper scripts from automake.
1938 # We aren't going to run the generated Makefile so we don't need the
1939 # real helper scripts.
1940 AT_DATA([install-sh], [])
1941 AT_DATA([missing], [])
1943 # In order to cut down the time this test takes, we do not test all
1944 # of the supported warning categories, just the most common case
1945 # (-Wall) and some specific categories that are known to have been a
1946 # problem in the past.
1947 AT_CHECK([autoreconf -Werror -Wall], 0, [], [])
1948 rm -rf configure config.h.in Makefile.in aclocal.m4 autom4te.cache
1950 AT_CHECK([autoreconf -Werror -Wcross], 0, [], [])
1951 rm -rf configure config.h.in Makefile.in aclocal.m4 autom4te.cache
1953 AT_CHECK([autoreconf -Werror -Wportability-recursive], 0, [], [])
1954 rm -rf configure config.h.in Makefile.in aclocal.m4 autom4te.cache
1958 ## ------------------------- ##
1959 ## Missing auxiliary files. ##
1960 ## ------------------------- ##
1962 AT_SETUP([Missing auxiliary files (config.*)])
1963 AT_KEYWORDS([autoreconf])
1965 # Prevent autoreconf from running aclocal, which might not exist,
1966 # or could barf over warnings in third-party macro files.
1967 AT_DATA([aclocal.m4])
1971 AT_DATA([configure.ac],
1972 [[AC_INIT([GNU foo], [1.0])
1973 AC_CONFIG_AUX_DIR([build-aux])
1980 # Both configure and autoreconf should detect the missing files.
1981 AT_CHECK_CONFIGURE([], [1], [ignore],
1982 [configure: error: cannot find required auxiliary files: config.guess config.sub
1985 AT_CHECK([autoreconf], 1, [],
1986 [configure.ac: error: required file 'config.sub' not found
1987 configure.ac: error: required file 'config.guess' not found
1988 configure.ac: try running autoreconf --install
1991 # If only one file is missing, the error messages should only report
1992 # that one. Also, the above invocation of autoreconf should _not_
1993 # have created build-aux, because it wasn't called with --install.
1994 AT_CHECK([test ! -e build-aux])
1996 : > build-aux/config.guess
1998 AT_CHECK_CONFIGURE([], [1], [ignore],
1999 [configure: error: cannot find required auxiliary files: config.sub
2002 AT_CHECK([autoreconf], 1, [],
2003 [configure.ac: error: required file 'config.sub' not found
2004 configure.ac: try running autoreconf --install
2007 # Missing aux files should not interfere with --help and --version.
2008 AT_CHECK_CONFIGURE([--help], [0], [ignore], [ignore])
2009 AT_CHECK_CONFIGURE([--version], [0], [ignore], [ignore])
2011 # autoreconf --install should be able to install config.sub and config.guess.
2012 rm build-aux/config.guess
2013 AT_CHECK([autoreconf --install])
2015 AT_CHECK([test -x build-aux/config.guess])
2016 AT_CHECK([test -x build-aux/config.sub])
2017 AT_CHECK([test ! -e build-aux/install-sh])
2024 AT_SETUP([Missing auxiliary files (install-sh)])
2025 AT_KEYWORDS([autoreconf])
2027 # Same as "Missing auxiliary files (config.*)" except that the
2028 # configure script _doesn't_ need config.{sub,guess} but does need
2031 # Prevent autoreconf from running aclocal, which might not exist,
2032 # or could barf over warnings in third-party macro files.
2033 AT_DATA([aclocal.m4])
2037 AT_DATA([configure.ac],
2038 [[AC_INIT([GNU foo], [1.0])
2039 AC_CONFIG_AUX_DIR([build-aux])
2046 # Both configure and autoreconf should detect the missing files.
2047 AT_CHECK_CONFIGURE([], [1], [ignore],
2048 [configure: error: cannot find required auxiliary files: install-sh
2051 AT_CHECK([autoreconf], 1, [],
2052 [configure.ac: error: required file 'install-sh' not found
2053 configure.ac: try running autoreconf --install
2055 AT_CHECK([test ! -e build-aux])
2057 AT_CHECK_CONFIGURE([--help], [0], [ignore], [ignore])
2058 AT_CHECK_CONFIGURE([--version], [0], [ignore], [ignore])
2060 AT_CHECK([autoreconf --install])
2062 AT_CHECK([test ! -e build-aux/config.guess])
2063 AT_CHECK([test ! -e build-aux/config.sub])
2064 AT_CHECK([test -x build-aux/install-sh])
2071 AT_SETUP([Missing auxiliary files (foreign)])
2072 AT_KEYWORDS([autoreconf])
2074 # If an aux file is required that autoreconf doesn't know how to install,
2075 # it shouldn't suggest autoreconf --install.
2076 # This also verifies that AC_REQUIRE_AUX_FILE can be used outside of a
2077 # macro definition, which was always the intent, and was recommended
2078 # usage in some automake recipes, but which was broken in autoconf
2079 # beta 2.69d (see https://savannah.gnu.org/support/?110363).
2081 # Prevent autoreconf from running aclocal, which might not exist,
2082 # or could barf over warnings in third-party macro files.
2083 AT_DATA([aclocal.m4])
2087 AT_DATA([configure.ac],
2088 [[AC_INIT([GNU foo], [1.0])
2089 AC_CONFIG_AUX_DIR([build-aux])
2090 AC_REQUIRE_AUX_FILE([tap-driver.sh])
2095 AT_CHECK_CONFIGURE([], [1], [ignore],
2096 [configure: error: cannot find required auxiliary files: tap-driver.sh
2099 AT_CHECK([autoreconf], 1, [],
2100 [configure.ac: error: required file 'tap-driver.sh' not found
2102 AT_CHECK([test ! -e build-aux])
2104 AT_CHECK([autoreconf --install], 1, [],
2105 [configure.ac: error: required file 'tap-driver.sh' not found
2107 # autoreconf --install always creates the aux directory.
2108 AT_CHECK([test -e build-aux])
2110 touch build-aux/tap-driver.sh
2112 AT_CHECK([autoreconf])
2118 AT_SETUP([Missing auxiliary files (--force)])
2119 AT_KEYWORDS([autoreconf])
2121 # Aux files that already exist should not be overwritten, unless
2122 # --force is used, in which case they *should* be overwritten.
2123 # Additional wrinkle: in case automake got to the files we install
2124 # first, we need to *not* overwrite a newer copy supplied by them.
2126 # Prevent autoreconf from running aclocal, which might not exist,
2127 # or could barf over warnings in third-party macro files.
2128 AT_DATA([aclocal.m4])
2132 AT_DATA([configure.ac],
2133 [[AC_INIT([GNU foo], [1.0])
2134 AC_CONFIG_AUX_DIR([build-aux])
2142 AT_DATA([build-aux/config-guess.old],
2144 timestamp='1970-01-01'
2145 printf '%s\n' 'frobozz-bogon-bogos1'
2148 AT_DATA([build-aux/config-sub.new],
2150 scriptversion='9999-12-31'
2154 AT_DATA([build-aux/install-sh.old],
2156 # Old versions of install-sh did not have a timestamp line.
2159 cp build-aux/config-guess.old build-aux/config.guess
2160 cp build-aux/config-sub.new build-aux/config.sub
2161 cp build-aux/install-sh.old build-aux/install-sh
2162 chmod +x build-aux/config.sub build-aux/config.guess build-aux/install-sh
2164 # This pass should not change any of the files.
2165 AT_CHECK([autoreconf --install])
2166 AT_CMP([build-aux/config-guess.old], [build-aux/config.guess])
2167 AT_CMP([build-aux/config-sub.new], [build-aux/config.sub])
2168 AT_CMP([build-aux/install-sh.old], [build-aux/install-sh])
2170 # This pass should change only config.guess and install-sh, not config.sub.
2171 AT_CHECK([autoreconf --install --force])
2173 [if cmp build-aux/config-guess.old build-aux/config.guess > /dev/null 2>&1
2176 AT_CMP([build-aux/config-sub.new], [build-aux/config.sub])
2178 [if cmp build-aux/install-sh.old build-aux/install-sh > /dev/null 2>&1
2185 ## ------------------------------ ##
2186 ## Files clobbered by AC_OPENMP. ##
2187 ## ------------------------------ ##
2189 AT_SETUP([Files clobbered by AC_OPENMP])
2198 # autoconf should bomb out if either 'mp' or 'openmp' exists in the
2201 AT_CHECK_AUTOCONF([], [1], [], [stderr])
2202 AT_CHECK([grep "clobbers files named 'mp' and 'penmp'" stderr],
2203 [0], [ignore], [ignore])
2207 AT_CHECK_AUTOCONF([], [1], [], [stderr])
2208 AT_CHECK([grep "clobbers files named 'mp' and 'penmp'" stderr],
2209 [0], [ignore], [ignore])
2212 # If neither of these files exist, autoconf should go through...
2215 # ... but configure should bomb out, and *not* delete the files,
2216 # if they are added after autoconf is run.
2218 AT_CHECK_CONFIGURE([], [1], [], [stderr])
2219 AT_CHECK([test -e mp])
2220 AT_CHECK([grep "clobbers files named 'mp' and 'penmp'" stderr],
2221 [0], [ignore], [ignore])
2225 AT_CHECK_CONFIGURE([], [1], [], [stderr])
2226 AT_CHECK([test -e penmp])
2227 AT_CHECK([grep "clobbers files named 'mp' and 'penmp'" stderr],
2228 [0], [ignore], [ignore])