am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / programs-primary-rewritten.sh
1 #! /bin/sh
2 # Copyright (C) 2003-2013 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 # Make sure xxx_PROGRAMS gets properly rewritten where needed.  These
18 # checks have been introduced in commit 'Release-1-9-254-g9d0eaef' into
19 # the former test 'subst2.test'.
20
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_SUBST([FOO], [c])
25 AC_OUTPUT
26 END
27
28 cat >Makefile.am <<'END'
29 AUTOMAKE_OPTIONS = no-dependencies
30 CC = false
31 EXEEXT = .bin
32
33 check_PROGRAMS = a
34 bin_PROGRAMS = b @FOO@
35 noinst_PROGRAMS = $(bar) $(baz:=de)
36 EXTRA_PROGRAMS =
37
38 bar = zardoz
39 baz = mau
40
41 .PHONY: test
42 test:
43         is $(check_PROGRAMS) == a.bin
44         is $(bin_PROGRAMS) == b.bin c
45         is $(noinst_PROGRAMS) == zardoz.bin maude.bin
46 END
47
48 $ACLOCAL
49 $AUTOMAKE
50
51 grep PROGRAMS Makefile.in # For debugging.
52
53 # Check that no useless indirections are used.
54 grep '^check_PROGRAMS = a$(EXEEXT)$' Makefile.in
55 grep '^bin_PROGRAMS = b$(EXEEXT) @FOO@$' Makefile.in
56
57 $AUTOCONF
58 ./configure
59 $MAKE test
60
61 :