sync: some auxiliary files synced from upstream
[platform/upstream/automake.git] / t / backcompat3.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 <http://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
20 am_create_testdir=empty
21 . ./defs || Exit 1
22
23 empty=''
24
25 cat > Makefile.am <<'END'
26 ## Leading ':;' here required to work around bugs of (at least) bash 3.2
27 got: Makefile
28         @:; { \
29           echo 'PACKAGE = $(PACKAGE)'; \
30           echo 'VERSION = $(VERSION)'; \
31           echo 'PACKAGE_NAME = $(PACKAGE_NAME)'; \
32           echo 'PACKAGE_VERSION = $(PACKAGE_VERSION)'; \
33           echo 'PACKAGE_STRING = $(PACKAGE_STRING)'; \
34           echo 'PACKAGE_TARNAME = $(PACKAGE_TARNAME)'; \
35           echo 'PACKAGE_BUGREPORT = $(PACKAGE_BUGREPORT)'; \
36           echo 'PACKAGE_URL = $(PACKAGE_URL)'; \
37         } >$@
38 END
39
40
41 ### Run 1 ###
42
43 cat > configure.in <<END
44 AC_INIT([ac_name], [ac_version])
45 AM_INIT_AUTOMAKE([am_name], [am_version])
46 AC_CONFIG_FILES([Makefile])
47 AC_OUTPUT
48 END
49
50 cat configure.in
51
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE -a
55
56 ./configure
57
58 cat >exp <<END
59 PACKAGE = am_name
60 VERSION = am_version
61 PACKAGE_NAME = ac_name
62 PACKAGE_VERSION = ac_version
63 PACKAGE_STRING = ac_name ac_version
64 PACKAGE_TARNAME = ac_name
65 PACKAGE_BUGREPORT = $empty
66 PACKAGE_URL = $empty
67 END
68
69 $MAKE got
70
71 diff exp got
72
73
74 ### Run 2 ###
75
76 cat > configure.in <<'END'
77 dnl: 'AC_INIT' in Autoconf <= 2.63 doesn't have an URL argument.
78 dnl: Luckily, 'AC_AUTOCONF_VERSION' and 'm4_version_prereq' are
79 dnl: both present in autoconf 2.62, which we require; so that we
80 dnl: can at least use the following workaround.
81 m4_version_prereq([2.64],
82     [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
83              [ac_url])],
84     [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname])
85      AC_SUBST([PACKAGE_URL], [ac_url])])
86 AM_INIT_AUTOMAKE([am_name], [am_version])
87 AC_CONFIG_FILES([Makefile])
88 AC_OUTPUT
89 END
90
91 cat configure.in
92
93 $ACLOCAL
94 $AUTOCONF
95 $AUTOMAKE
96
97 ./configure
98
99 cat >exp <<END
100 PACKAGE = am_name
101 VERSION = am_version
102 PACKAGE_NAME = ac_name
103 PACKAGE_VERSION = ac_version
104 PACKAGE_STRING = ac_name ac_version
105 PACKAGE_TARNAME = ac_tarname
106 PACKAGE_BUGREPORT = ac_bugreport
107 PACKAGE_URL = ac_url
108 END
109
110 $MAKE got
111
112 diff exp got
113
114
115 ### Run 3 ###
116
117 cat > configure.in <<END
118 AC_INIT([ac_name], [ac_version])
119 AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
120 AC_CONFIG_FILES([Makefile])
121 AC_OUTPUT
122 END
123
124 cat configure.in
125
126 $ACLOCAL
127 $AUTOCONF
128 $AUTOMAKE
129
130 ./configure
131
132 cat >exp <<END
133 PACKAGE = am_name
134 VERSION = am_version
135 PACKAGE_NAME = ac_name
136 PACKAGE_VERSION = ac_version
137 PACKAGE_STRING = ac_name ac_version
138 PACKAGE_TARNAME = ac_name
139 PACKAGE_BUGREPORT = $empty
140 PACKAGE_URL = $empty
141 END
142
143 $MAKE got
144
145 diff exp got
146
147 $FGREP am_foo_quux Makefile.in Makefile configure config.status && Exit 1
148
149
150 ### Done ###
151
152 :