test init: refactor: new function 'am_setup_testdir'
[automake.git] / t / backcompat3.sh
blobe00992bb20f4a849fd3ed71699d191adb9891be5
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 <http://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 . ./defs || exit 1
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.in <<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.in
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.in <<'END'
79 dnl: 'AC_INIT' in Autoconf <= 2.63 doesn't have an URL argument.
80 dnl: Luckily, 'AC_AUTOCONF_VERSION' and 'm4_version_prereq' are
81 dnl: both present in autoconf 2.62, which we require; so that we
82 dnl: can at least use the following workaround.
83 m4_version_prereq([2.64],
84 [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
85 [ac_url])],
86 [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname])
87 AC_SUBST([PACKAGE_URL], [ac_url])])
88 AM_INIT_AUTOMAKE([am_name], [am_version])
89 AC_CONFIG_FILES([Makefile])
90 AC_OUTPUT
91 END
93 cat configure.in
95 $ACLOCAL
96 $AUTOCONF
97 $AUTOMAKE
99 ./configure
101 cat >exp <<END
102 PACKAGE = am_name
103 VERSION = am_version
104 PACKAGE_NAME = ac_name
105 PACKAGE_VERSION = ac_version
106 PACKAGE_STRING = ac_name ac_version
107 PACKAGE_TARNAME = ac_tarname
108 PACKAGE_BUGREPORT = ac_bugreport
109 PACKAGE_URL = ac_url
112 $MAKE got
114 diff exp got
117 ### Run 3 ###
119 cat > configure.in <<END
120 AC_INIT([ac_name], [ac_version])
121 AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
122 AC_CONFIG_FILES([Makefile])
123 AC_OUTPUT
126 cat configure.in
128 $ACLOCAL
129 $AUTOCONF
130 $AUTOMAKE
132 ./configure
134 cat >exp <<END
135 PACKAGE = am_name
136 VERSION = am_version
137 PACKAGE_NAME = ac_name
138 PACKAGE_VERSION = ac_version
139 PACKAGE_STRING = ac_name ac_version
140 PACKAGE_TARNAME = ac_name
141 PACKAGE_BUGREPORT = $empty
142 PACKAGE_URL = $empty
145 $MAKE got
147 diff exp got
149 $FGREP am_foo_quux Makefile.in Makefile configure config.status && exit 1
152 ### Done ###