tests: avoid use of redirected 'run_make' invocations
[platform/upstream/automake.git] / t / exeext.sh
1 #! /bin/sh
2 # Copyright (C) 2001-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 to make sure '.' in an exe name doesn't fool us.
18 # Report from Robert Collins.
19 # Also make sure we rewrite conditionals variables.
20 # Also check for PR/352.
21 # Also make sure the old definitions of bin_PROGRAMS and friend
22 # aren't left around.  Report from Jim Meyering.
23
24 required=cc
25 . test-init.sh
26
27 cat >> configure.ac << 'END'
28 AC_PROG_CC
29 AM_CONDITIONAL([WANT_MT], [test -z "$revert"])
30 AM_CONDITIONAL([WANT_RMT], [test -z "$revert"])
31 AC_OUTPUT
32 END
33
34 cat > Makefile.am << 'END'
35 ## Use a different dir for each to make grep easy.
36 bin_PROGRAMS = maude
37 sbin_PROGRAMS = maude.static
38 ## We don't define this one for now.  Probably it is an error.
39 ## noinst_PROGRAMS = maude2.exe
40 check_PROGRAMS = maude3$(EXEEXT)
41
42 if WANT_MT
43   bin_PROGRAMS += mt
44 endif
45 if WANT_RMT
46   libexec_PROGRAMS = rmt
47 endif
48
49 print:
50         @echo 1BEG: $(bin_PROGRAMS) :END1
51         @echo 2BEG: $(sbin_PROGRAMS) :END2
52         @echo 3BEG: $(check_PROGRAMS) :END3
53         @echo 4BEG: $(libexec_PROGRAMS) :END4
54 END
55
56 $ACLOCAL
57 $AUTOCONF
58 $AUTOMAKE
59
60 grep '^maude$(EXEEXT):' Makefile.in
61 grep '^maude\.static$(EXEEXT):' Makefile.in
62 grep '^maude3$(EXEEXT):' Makefile.in
63 grep '^mt$(EXEEXT):' Makefile.in
64 grep '^rmt$(EXEEXT):' Makefile.in
65 test $(grep -c '^bin_PROGRAMS =' Makefile.in) -eq 1
66
67 # Make sure $(EXEEXT) gets stripped before canonicalization.
68 grep 'maude3__EXEEXT__OBJECTS' Makefile.in && exit 1
69
70 ./configure
71
72 run_make -O EXEEXT=.foo print
73
74 grep '1BEG: maude.foo mt.foo :END1' stdout
75 grep '2BEG: maude.static.foo :END2' stdout
76 grep '3BEG: maude3.foo :END3' stdout
77 grep '4BEG: rmt.foo :END4' stdout
78
79 ./configure revert=yes
80
81 run_make -O EXEEXT=.foo print
82
83 grep '1BEG: maude.foo :END1' stdout
84 grep '2BEG: maude.static.foo :END2' stdout
85 grep '3BEG: maude3.foo :END3' stdout
86 grep '4BEG: :END4' stdout
87
88 :