tests: fix a maintainer-check failure ('Exit' used instead of 'exit')
[platform/upstream/automake.git] / t / backcompat6.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: try to build and distribute a package
18 # using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
19 # This script can also serve as mild stress-testing for Automake.
20 # See also the similar test 'backcompat5.test'.
21
22 required=cc
23 am_create_testdir=empty
24 . ./defs || exit 1
25
26 # Anyone doing something like this in a real-life package probably
27 # deserves to be killed.
28 cat > configure.ac <<'END'
29 dnl: Everything here is *deliberately* underquoted!
30 AC_INIT(quux.c)
31 PACKAGE=nonesuch-zardoz
32 VERSION=nonesuch-0.1
33 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
34 AC_SUBST(one,1)
35 two=2
36 AC_SUBST(two, $two)
37 three=3
38 AC_SUBST(three)
39 AC_PROG_CC
40 AC_CONFIG_HEADERS(config.h:config.hin)
41 AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = yes)
42 AC_OUTPUT(Makefile foo.got:foo1.in:foo2.in:foo3.in)
43 END
44
45 echo @one@ > foo1.in
46 echo @two@ > foo2.in
47 echo @three@ > foo3.in
48
49 cat >config.hin <<'END'
50 #undef PACKAGE
51 #undef VERSION
52 END
53
54 cat >> Makefile.am <<'END'
55 bin_PROGRAMS = foo
56 foo_SOURCES = quux.c
57 check-local:
58         test x'$(PACKAGE)' = x'nonesuch-zardoz'
59         test x'$(VERSION)' = x'nonesuch-0.1'
60 if ! CROSS_COMPILING
61         ./foo
62 ## Do not anchor the regexps w.r.t. the end of line, because on
63 ## MinGW/MSYS, grep may assume LF line endings only, while our
64 ## 'foo' program may generate CRLF line endings.
65         ./foo | grep '^PACKAGE = nonesuch-zardoz!'
66         ./foo | echo '^VERSION = nonesuch-0\.1!'
67 endif
68 END
69
70 cat > quux.c <<'END'
71 #include <config.h>
72 #include <stdio.h>
73 int main (void)
74 {
75   printf("PACKAGE = %s!\nVERSION = %s!\n", PACKAGE, VERSION);
76   return 0;
77 }
78 END
79
80 $ACLOCAL
81 $AUTOMAKE -Wno-obsolete --add-missing
82 $AUTOCONF
83
84 ./configure
85
86 cat >foo.exp <<'END'
87 1
88 2
89 3
90 END
91
92 diff foo.exp foo.got
93
94 $MAKE
95 $MAKE check
96
97 distdir=nonesuch-zardoz-nonesuch-0.1
98 $MAKE distdir
99 test -f $distdir/quux.c
100 test ! -f $distdir/foo.got
101
102 $MAKE distcheck
103
104 :