c6de0e95d0ea6797c2c332a00cc9614b629e50ae
[platform/upstream/automake.git] / tests / cond34.test
1 #!/bin/sh
2 # Copyright (C) 2004  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 3, 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 # Check for _DEPDENDENCIES definition with conditional _LDADD.
18 # Report from Elena A. Vengerova
19
20 . ./defs
21
22 set -e
23
24 cat >>configure.in <<'EOF'
25 AM_CONDITIONAL([TWO], test -n "$two")
26 AC_PROG_CC
27 AC_OUTPUT
28 EOF
29
30 cat >>Makefile.am <<'EOF'
31 OBJEXT=z
32
33 bin_PROGRAMS = test1 test2
34
35 if TWO
36   test1_LDADD = two.$(OBJEXT)
37   test2_LDADD = two.$(OBJEXT)
38   test2_DEPENDENCIES = $(test2_LDADD) somethingelse.a
39 else !TWO
40   test1_LDADD = one.$(OBJEXT)
41   test2_LDADD = three.$(OBJEXT)
42 endif !TWO
43
44 test1_DEPENDENCIES = $(test1_LDADD) somethingelse.a
45
46 dep-test1:
47         echo BEG: $(test1_DEPENDENCIES) :END
48 dep-test2:
49         echo BEG: $(test2_DEPENDENCIES) :END
50
51 EOF
52
53 :> test.c
54
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE
58 ./configure
59 $MAKE dep-test1 >out
60 grep 'BEG: one.z somethingelse.a :END' out
61 $MAKE dep-test2 >out
62 grep 'BEG: three.z :END' out
63
64 ./configure two=2
65 $MAKE dep-test1 >out
66 grep 'BEG: two.z somethingelse.a :END' out
67 $MAKE dep-test2 >out
68 grep 'BEG: two.z somethingelse.a :END' out