test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / backcompat3.sh
blobb61e1f53c3d9f7ec22db3239760300e48a4d16da
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 # Backward-compatibility test: check what happens when AC_INIT and
18 # AM_INIT_AUTOMAKE are both given two or more arguments.
20 am_create_testdir=empty
21 . test-init.sh
23 empty=''
25 AUTOMAKE="$AUTOMAKE -Wno-obsolete"
27 cat > Makefile.am <<'END'
28 ## Leading ':;' here required to work around bugs of (at least) bash 3.2
29 got: Makefile
30 @:; { \
31 echo 'PACKAGE = $(PACKAGE)'; \
32 echo 'VERSION = $(VERSION)'; \
33 echo 'PACKAGE_NAME = $(PACKAGE_NAME)'; \
34 echo 'PACKAGE_VERSION = $(PACKAGE_VERSION)'; \
35 echo 'PACKAGE_STRING = $(PACKAGE_STRING)'; \
36 echo 'PACKAGE_TARNAME = $(PACKAGE_TARNAME)'; \
37 echo 'PACKAGE_BUGREPORT = $(PACKAGE_BUGREPORT)'; \
38 echo 'PACKAGE_URL = $(PACKAGE_URL)'; \
39 } >$@
40 END
43 ### Run 1 ###
45 cat > configure.ac <<END
46 AC_INIT([ac_name], [ac_version])
47 AM_INIT_AUTOMAKE([am_name], [am_version])
48 AC_CONFIG_FILES([Makefile])
49 AC_OUTPUT
50 END
52 cat configure.ac
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE -a
58 ./configure
60 cat >exp <<END
61 PACKAGE = am_name
62 VERSION = am_version
63 PACKAGE_NAME = ac_name
64 PACKAGE_VERSION = ac_version
65 PACKAGE_STRING = ac_name ac_version
66 PACKAGE_TARNAME = ac_name
67 PACKAGE_BUGREPORT = $empty
68 PACKAGE_URL = $empty
69 END
71 $MAKE got
73 diff exp got
76 ### Run 2 ###
78 cat > configure.ac <<'END'
79 AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
80 [ac_url])],
81 AM_INIT_AUTOMAKE([am_name], [am_version])
82 AC_CONFIG_FILES([Makefile])
83 AC_OUTPUT
84 END
86 cat configure.ac
88 $ACLOCAL
89 $AUTOCONF
90 $AUTOMAKE
92 ./configure
94 cat >exp <<END
95 PACKAGE = am_name
96 VERSION = am_version
97 PACKAGE_NAME = ac_name
98 PACKAGE_VERSION = ac_version
99 PACKAGE_STRING = ac_name ac_version
100 PACKAGE_TARNAME = ac_tarname
101 PACKAGE_BUGREPORT = ac_bugreport
102 PACKAGE_URL = ac_url
105 $MAKE got
107 diff exp got
110 ### Run 3 ###
112 cat > configure.ac <<END
113 AC_INIT([ac_name], [ac_version])
114 AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
115 AC_CONFIG_FILES([Makefile])
116 AC_OUTPUT
119 cat configure.ac
121 $ACLOCAL
122 $AUTOCONF
123 $AUTOMAKE
125 ./configure
127 cat >exp <<END
128 PACKAGE = am_name
129 VERSION = am_version
130 PACKAGE_NAME = ac_name
131 PACKAGE_VERSION = ac_version
132 PACKAGE_STRING = ac_name ac_version
133 PACKAGE_TARNAME = ac_name
134 PACKAGE_BUGREPORT = $empty
135 PACKAGE_URL = $empty
138 $MAKE got
140 diff exp got
142 $FGREP am_foo_quux Makefile.in Makefile configure config.status && exit 1
145 ### Done ###