tests: fix a spurious typo-related failure
[automake.git] / t / cond34.sh
blob3d37a2b3240587b84f5c7f7a0196a2a68434fb7a
1 #!/bin/sh
2 # Copyright (C) 2004-2012 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 <http://www.gnu.org/licenses/>.
17 # Check for _DEPENDENCIES definition with conditional _LDADD.
18 # Report from Elena A. Vengerova.
20 . ./defs || exit 1
22 cat >>configure.ac <<'EOF'
23 AM_CONDITIONAL([TWO], [test -n "$two"])
24 AC_OUTPUT
25 EOF
27 cat > Makefile.am <<'EOF'
28 OBJEXT=z
29 CC=false
30 AUTOMAKE_OPTIONS=no-dependencies
32 bin_PROGRAMS = test1 test2
34 if TWO
35 test1_LDADD = two.$(OBJEXT)
36 test2_LDADD = two.$(OBJEXT)
37 test2_DEPENDENCIES = $(test2_LDADD) somethingelse.a
38 else !TWO
39 test1_LDADD = one.$(OBJEXT)
40 test2_LDADD = three.$(OBJEXT)
41 endif !TWO
43 test1_DEPENDENCIES = $(test1_LDADD) somethingelse.a
45 .PHONY: dep-test1 dep-test2
46 dep-test1:
47 echo BEG: $(test1_DEPENDENCIES) :END
48 dep-test2:
49 echo BEG: $(test2_DEPENDENCIES) :END
50 EOF
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE
55 ./configure
57 $MAKE dep-test1 >stdout || { cat stdout; exit 1; }
58 cat stdout
59 $FGREP 'BEG: one.z somethingelse.a :END' stdout
61 $MAKE dep-test2 >stdout || { cat stdout; exit 1; }
62 cat stdout
63 $FGREP 'BEG: three.z :END' stdout
65 ./configure two=2
67 $MAKE dep-test1 >stdout || { cat stdout; exit 1; }
68 cat stdout
69 $FGREP 'BEG: two.z somethingelse.a :END' stdout
71 $MAKE dep-test2 >stdout || { cat stdout; exit 1; }
72 cat stdout
73 $FGREP 'BEG: two.z somethingelse.a :END' stdout