test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / subdir-add-pr46.sh
blob635a67c87084a81a85e507c985d1120c67058cae
1 #! /bin/sh
2 # Copyright (C) 2001-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 to make sure that adding a new directory works.
18 # This test runs 'make' from the top-level directory, the sister
19 # test 'subdir-add2-pr46.sh' do it from a subdirectory.
20 # PR automake/46
22 . test-init.sh
24 cat >> configure.ac << 'END'
25 AC_OUTPUT
26 END
28 : > Makefile.am
30 $ACLOCAL
31 $AUTOCONF
32 $AUTOMAKE
33 ./configure
34 $MAKE
36 # Now add new directories.
38 # First we add a new directory by modifying configure.ac directly.
39 # We update configure.ac *before* updating sub/Makefile.am; the sister
40 # test 'subdir-add2-pr46.sh' does it in the other way: it updates
41 # confiles.m4 (which is m4_included by configure.ac there) after
42 # Makefile.am.
44 # Modified configure dependencies must be newer than config.status.
45 $sleep
46 sed <configure.ac >configure.tmp -e '/^AC_OUTPUT$/i\
47 AC_CONFIG_FILES([maude/Makefile])\
48 m4_include([confile.m4])\
49 ' # Last newline required by older OpenBSD sed.
50 mv -f configure.tmp configure.ac
52 cat configure.ac # For debugging.
54 : > confile.m4
56 mkdir maude
58 cat > maude/Makefile.am << 'END'
59 include_HEADERS = foo.h
60 END
62 : > maude/foo.h
64 echo 'SUBDIRS = maude' >> Makefile.am
66 # We want a simple rebuild to create maude/Makefile automatically.
67 $MAKE
68 grep '^SUBDIRS = *maude *$' Makefile.in
69 grep '^SUBDIRS = *maude *$' Makefile
70 test -f maude/Makefile
72 # Then we add a new directory by modifying a file included (through
73 # 'm4_include') by configure.ac.
74 mkdir maude2
75 # Modified configure dependencies must be newer than config.status.
76 $sleep
77 cat >> confile.m4 << 'END'
78 AC_CONFIG_FILES([maude2/Makefile])
79 AC_SUBST([GREPME])
80 END
81 : > maude2/Makefile.am
82 echo 'SUBDIRS += maude2' >> Makefile.am
84 # We want a simple rebuild to create maude2/Makefile and update
85 # all other Makefiles automatically.
86 $MAKE
87 grep '^SUBDIRS =.* maude2' Makefile.in
88 grep '^SUBDIRS =.* maude2' Makefile
90 for ext in '.in' ''; do
91 for d in . maude maude2; do
92 grep '^GREPME =' $d/Makefile$ext
93 done
94 done