tests: fix a spurious typo-related failure
[automake.git] / t / backcompat2.sh
blob109483b47785d067b5230a402590235a5142f662
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 that AM_INIT_AUTOMAKE with two or
18 # three arguments does AC_DEFINE the symbols PACKAGE and VERSION iff the
19 # third argument is empty or non-existent.
21 am_create_testdir=empty
22 . ./defs || exit 1
24 # A trick to make the test run muuuch faster, by avoiding repeated
25 # runs of aclocal (one order of magnitude improvement in speed!).
26 echo 'AC_INIT(x,0) AM_INIT_AUTOMAKE' > configure.ac
27 $ACLOCAL
28 rm -rf configure.ac autom4te.*
30 touch install-sh missing
32 cat > config.h.in <<'END'
33 #undef PACKAGE
34 #undef VERSION
35 END
37 for am_arg3 in ':' 'false' '#' ' '; do
38 unindent > configure.ac <<END
39 AC_INIT
40 AC_CONFIG_HEADERS([config.h])
41 AM_INIT_AUTOMAKE([pkgname], [pkgversion], [$am_arg3])
42 AC_OUTPUT
43 END
44 cat configure.ac # For debugging.
45 $AUTOCONF
46 ./configure
47 cat config.h # For debugging.
48 # The non-empty third argument should prevent PACKAGE and VERSION
49 # from being AC_DEFINE'd.
50 $EGREP 'pkg(name|version)' config.h && exit 1
51 # This is required because even relatively-recent versions of the
52 # BSD shell wrongly exit when the 'errexit' shell flag is active if
53 # the last command of a compound statement fails, even if it should
54 # be protected by the use of "&&".
56 done
58 for am_extra_args in '' ',' ', []'; do
59 unindent > configure.ac <<END
60 AC_INIT
61 AC_CONFIG_HEADERS([config.h])
62 AM_INIT_AUTOMAKE([pkgname], [pkgversion]$am_extra_args)
63 AC_OUTPUT
64 END
65 cat configure.ac # For debugging.
66 $AUTOCONF
67 ./configure
68 cat config.h # For debugging.
69 grep '^ *# *define *PACKAGE *"pkgname" *$' config.h
70 grep '^ *# *define *VERSION *"pkgversion" *$' config.h
71 done