Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / exeext4.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2006  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 $(EXEEXT) is appended to programs and to tests that are
18 # programs, but not to @substitutions@.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in << 'END'
25 AM_CONDITIONAL([COND], [test -n "$cond"])
26 AC_SUBST([programs], ['prg1$(EXEEXT) prg2$(EXEEXT)'])
27 AC_PROG_CC
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am << 'END'
32 EXEEXT = .bin
33 if COND
34   BAR = bar
35   DEP = bar
36   BAZE = baz$(EXEEXT)
37   BAZ = baz $(DEP)
38 endif
39 bin_PROGRAMS = $(programs) @programs@ prg3 $(BAR) $(BAZE)
40 EXTRA_PROGRAMS = prg1 prg2 prg3
41 TESTS = prg1 prg3 prg4 $(BAZ)
42
43 print-bin:
44         echo BEG: $(bin_PROGRAMS) :END
45 print-extra:
46         echo BEG: $(EXTRA_PROGRAMS) :END
47 print-tests:
48         echo BEG: $(TESTS) :END
49 print-barbaz:
50         echo BEG: $(BAR) $(BAZ) :END
51 END
52
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE
56 ./configure
57 $MAKE print-bin > output
58 cat output
59 grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin' output
60 $MAKE print-extra > output
61 cat output
62 grep 'prg1.bin prg2.bin prg3.bin' output
63 $MAKE print-tests > output
64 cat output
65 grep 'prg1.bin prg3.bin prg4' output
66
67 ./configure cond=yes
68 $MAKE print-bin > output
69 cat output
70 grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin bar.bin baz.bin' output
71 $MAKE print-tests > output
72 cat output
73 grep 'prg1.bin prg3.bin prg4 baz.bin bar.bin' output
74 $MAKE print-barbaz > output
75 cat output
76 grep 'bar baz bar' output
77
78 # Only two am__EXEEXT_* variables are needed here: one for BAR, and one
79 # BAZ.  The latter must use the former.
80 test 2 = `grep '__EXEEXT_. =' Makefile.in | wc -l`
81 grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in