tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / exeext4.sh
1 #! /bin/sh
2 # Copyright (C) 2003-2012 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 cat >> configure.ac << 'END'
23 AM_CONDITIONAL([COND], [test -n "$cond"])
24 AC_SUBST([programs], ['prg1$(EXEEXT) prg2$(EXEEXT)'])
25 AC_SUBST([CC], [whocares])
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am << 'END'
30 AUTOMAKE_OPTIONS = no-dependencies
31 EXEEXT = .x
32 if COND
33   BAR = bar
34   DEP = bar
35   BAZE = baz$(EXEEXT)
36   BAZ = baz $(DEP)
37 endif
38 bin_PROGRAMS = $(programs) @programs@ prg3 $(BAR) $(BAZE)
39 EXTRA_PROGRAMS = prg1 prg2 prg3
40 TESTS = prg1 prg3 prg4 $(BAZ)
41
42 .PHONY: test-cond test-nocond
43 test-nocond:
44         is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x
45         is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
46         is $(TESTS) == prg1.x prg3.x prg4
47 test-cond:
48         is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x bar.x baz.x
49         is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
50         is $(TESTS) == prg1.x prg3.x prg4 baz.x bar.x
51         is $(BAR) $(BAZ) == bar baz bar
52 END
53
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE --add-missing --copy
57
58 ./configure
59 $MAKE test-nocond
60
61 ./configure cond=yes
62 $MAKE test-cond
63
64 # Only two am__EXEEXT_* variables are needed here: one for BAR, and one
65 # BAZ.  The latter must use the former.
66 test 2 = `grep '__EXEEXT_. =' Makefile.in | wc -l`
67 grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in
68
69 :