tests: work around strangeness in MSYS
[automake.git] / tests / cond32.test
blob45ecf70964047318ce79ddb9733b7a7a7782111a
1 #!/bin/sh
2 # Copyright (C) 2003, 2006, 2011 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 # Make sure the user can override a conditional _DEPENDENCIES.
19 . ./defs || Exit 1
21 cat >>configure.in <<'EOF'
22 AM_CONDITIONAL([C1], [test -z "$two"])
23 AM_CONDITIONAL([C2], [test -n "$two"])
24 AM_CONDITIONAL([C3], [test -z "$three"])
25 # We define CC in Makefile.am, but OBJEXT here.
26 OBJEXT=o; AC_SUBST([OBJEXT])
27 AC_SUBST([MYSUB], ["foo.$OBJEXT"])
28 AC_OUTPUT
29 EOF
31 cat >>Makefile.am <<'EOF'
32 AUTOMAKE_OPTIONS = no-dependencies
33 CC = :
35 bin_PROGRAMS = a
37 if C1
38 a_LDADD = $(MYSUB)
39 a_DEPENDENCIES = $(MYSUB) nonsense.a
40 # Note that `nonsense.a' is there just to make sure Automake insn't
41 # using some self computed a_DEPENDENCIES variable.
42 endif
44 if C2
45 if C3
46 BAR = bar.o
47 else
48 BAR = baz.o
49 endif
50 a_LDADD = $(BAR)
51 endif
53 got = `echo $(a_DEPENDENCIES)`
54 test:
55 test "$(exp)" = "$(got)"
56 .PHONY: test
57 EOF
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE
63 ./configure
64 exp='foo.o nonsense.a' $MAKE -e test
66 ./configure two=yes three=
67 exp='bar.o' $MAKE -e test
69 ./configure two=yes three=yes
70 exp='baz.o' $MAKE -e test