test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / remake-deeply-nested.sh
blobf31028d52ab00588d33d135d5b567abb345488f8
1 #! /bin/sh
2 # Copyright (C) 2010-2024 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Test remake rules in deeply nested subdirectories, and with a lot
18 # of files. This is basically a mild stress test, ensuring that rebuild
19 # rules don't break in obvious ways in a slightly "heavier than usual"
20 # setup.
22 . test-init.sh
24 ocwd=$(pwd) || fatal_ "getting current working directory"
26 magic1=::MagicStringOne::
27 magic2=__MagicStringTwo__
29 echo "AC_SUBST([FOO], [$magic1])" >> configure.ac
31 echo "@FOO@" > bar.in
32 echo "AC_CONFIG_FILES([bar])" >> configure.ac
33 unset d # Avoid unduly interferences from the environment.
34 for i in 0 1 2 3 4 5 6 7 8 9; do
35 d=${d+"$d/"}sub$i
36 echo "SUBDIRS = sub$i" > Makefile.am
37 echo "AC_CONFIG_FILES([$d/Makefile])" >> "$ocwd"/configure.ac
38 echo "AC_CONFIG_FILES([$d/bar])" >> "$ocwd"/configure.ac
39 mkdir sub$i
40 cd sub$i
41 echo "$d: @FOO@" > bar.in
42 done
43 echo AC_OUTPUT >> "$ocwd"/configure.ac
44 : > Makefile.am
45 unset d i
47 bottom=$(pwd) || fatal_ "getting current working directory"
49 cd "$ocwd"
51 makefiles_am_list=$(find . -name Makefile.am | LC_ALL=C sort)
52 makefiles_list=$(echo "$makefiles_am_list" | sed 's/\.am$//')
53 bar_in_list=$(find . -name bar.in | LC_ALL=C sort)
54 bar_list=$(echo "$bar_in_list" | sed 's/\.in$//')
56 cat configure.ac # For debugging.
58 $ACLOCAL
59 $AUTOMAKE
60 $AUTOCONF
62 ./configure
64 for f in configure config.status $makefiles_list $bar_list; do
65 $FGREP "$magic1" $f
66 done
68 $sleep
69 sed "s/$magic1/$magic2/" configure.ac >configure.tmp
70 mv -f configure.tmp configure.ac
72 cd "$bottom"
73 $MAKE
74 cd "$ocwd"
76 for f in configure config.status $makefiles_list $bar_list; do
77 $FGREP "$magic2" $f
78 done
79 $FGREP "$magic1" configure config.status $makefiles_list $bar_list && exit 1
81 $MAKE distcheck