1#! /bin/sh
2# Copyright (C) 2010-2021 Free Software Foundation, Inc.
3#
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.
8#
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.
13#
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/>.
16
17# Backward-compatibility test: check what happens when AC_INIT and
18# AM_INIT_AUTOMAKE are both given two or more arguments.
19
20am_create_testdir=empty
21. test-init.sh
22
23empty=''
24
25AUTOMAKE="$AUTOMAKE -Wno-obsolete"
26
27cat > Makefile.am <<'END'
28## Leading ':;' here required to work around bugs of (at least) bash 3.2
29got: 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	} >$@
40END
41
42
43### Run 1 ###
44
45cat > configure.ac <<END
46AC_INIT([ac_name], [ac_version])
47AM_INIT_AUTOMAKE([am_name], [am_version])
48AC_CONFIG_FILES([Makefile])
49AC_OUTPUT
50END
51
52cat configure.ac
53
54$ACLOCAL
55$AUTOCONF
56$AUTOMAKE -a
57
58./configure
59
60cat >exp <<END
61PACKAGE = am_name
62VERSION = am_version
63PACKAGE_NAME = ac_name
64PACKAGE_VERSION = ac_version
65PACKAGE_STRING = ac_name ac_version
66PACKAGE_TARNAME = ac_name
67PACKAGE_BUGREPORT = $empty
68PACKAGE_URL = $empty
69END
70
71$MAKE got
72
73diff exp got
74
75
76### Run 2 ###
77
78cat > configure.ac <<'END'
79AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
80        [ac_url])],
81AM_INIT_AUTOMAKE([am_name], [am_version])
82AC_CONFIG_FILES([Makefile])
83AC_OUTPUT
84END
85
86cat configure.ac
87
88$ACLOCAL
89$AUTOCONF
90$AUTOMAKE
91
92./configure
93
94cat >exp <<END
95PACKAGE = am_name
96VERSION = am_version
97PACKAGE_NAME = ac_name
98PACKAGE_VERSION = ac_version
99PACKAGE_STRING = ac_name ac_version
100PACKAGE_TARNAME = ac_tarname
101PACKAGE_BUGREPORT = ac_bugreport
102PACKAGE_URL = ac_url
103END
104
105$MAKE got
106
107diff exp got
108
109
110### Run 3 ###
111
112cat > configure.ac <<END
113AC_INIT([ac_name], [ac_version])
114AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
115AC_CONFIG_FILES([Makefile])
116AC_OUTPUT
117END
118
119cat configure.ac
120
121$ACLOCAL
122$AUTOCONF
123$AUTOMAKE
124
125./configure
126
127cat >exp <<END
128PACKAGE = am_name
129VERSION = am_version
130PACKAGE_NAME = ac_name
131PACKAGE_VERSION = ac_version
132PACKAGE_STRING = ac_name ac_version
133PACKAGE_TARNAME = ac_name
134PACKAGE_BUGREPORT = $empty
135PACKAGE_URL = $empty
136END
137
138$MAKE got
139
140diff exp got
141
142$FGREP am_foo_quux Makefile.in Makefile configure config.status && exit 1
143
144
145### Done ###
146
147:
148