doc: typos in test file.
[automake.git] / t / posixsubst-programs.sh
blob5ead19aaee226c6e4dfcf25fbbb9f430e4f5e96f
1 #! /bin/sh
2 # Copyright (C) 2010-2024 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 <https://www.gnu.org/licenses/>.
17 # Test that POSIX variable expansion '$(var:str=rpl)' works when used
18 # with the PROGRAMS primary.
20 required=cc
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
28 cat > Makefile.am << 'END'
29 t1 = foo1 foo2
30 t2 = barx bar2
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)
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
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
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE
56 cwd=$(pwd) || fatal_ "getting current working directory"
57 ./configure --prefix="$cwd/_inst"
58 $MAKE
59 $MAKE install
60 $MAKE installcheck
61 $MAKE distcheck