tests: expose automake bug#14560
[platform/upstream/automake.git] / t / posixsubst-programs.sh
1 #! /bin/sh
2 # Copyright (C) 2010-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 # Test that POSIX variable expansion '$(var:str=rpl)' works when used
18 # with the PROGRAMS primary.
19
20 required=cc
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am << 'END'
29 t1 = foo1 foo2
30 t2 = barx bar2
31
32 # Also try an empty match suffix, to ensure that the ':=' in there is
33 # not confused by the parser with an unportable assignment operator.
34 bin_PROGRAMS = $(t1:=-p) $(t2:2=y)
35
36 installcheck-local:
37         ls -l $(prefix)/bin
38         test -f $(prefix)/bin/foo1-p$(EXEEXT)
39         test -x $(prefix)/bin/foo1-p$(EXEEXT)
40         test -f $(prefix)/bin/foo2-p$(EXEEXT)
41         test -x $(prefix)/bin/foo2-p$(EXEEXT)
42         test -f $(prefix)/bin/barx$(EXEEXT)
43         test -x $(prefix)/bin/barx$(EXEEXT)
44         test -f $(prefix)/bin/bary$(EXEEXT)
45         test -x $(prefix)/bin/bary$(EXEEXT)
46 END
47
48 for f in foo1-p.c foo2-p.c barx.c bary.c; do
49   echo 'int main(void) { return 0; }' > $f
50 done
51
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE
55
56 cwd=$(pwd) || fatal_ "getting current working directory"
57 ./configure --prefix="$cwd/_inst"
58 $MAKE
59 $MAKE install
60 $MAKE installcheck
61 $MAKE distcheck
62
63 :