tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / exeext4.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 $(EXEEXT) is appended to programs and to tests that are
18 # programs, but not to @substitutions@.
19
20 # For gen-testsuite-part: ==> try-with-serial-tests <==
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AM_CONDITIONAL([COND], [test -n "$cond"])
25 AC_SUBST([programs], ['prg1$(EXEEXT) prg2$(EXEEXT)'])
26 AC_SUBST([CC], [whocares])
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 AUTOMAKE_OPTIONS = no-dependencies
32 EXEEXT = .x
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 .PHONY: test-cond test-nocond
44 test-nocond:
45         is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x
46         is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
47         is $(TESTS) == prg1.x prg3.x prg4
48 test-cond:
49         is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x bar.x baz.x
50         is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
51         is $(TESTS) == prg1.x prg3.x prg4 baz.x bar.x
52         is $(BAR) $(BAZ) == bar baz bar
53 END
54
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE --add-missing --copy
58
59 ./configure
60 $MAKE test-nocond
61
62 ./configure cond=yes
63 $MAKE test-cond
64
65 # Only two am__EXEEXT_* variables are needed here: one for BAR, and one
66 # BAZ.  The latter must use the former.
67 test 2 -eq $(grep -c '__EXEEXT_. =' Makefile.in)
68 grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in
69
70 :