* lib/Makefile.am (dist_script_DATA): Move config-ml.in ...
[automake.git] / tests / cond21.test
blob9b279fa1ff21514670aa2b709c2e5d6ebc178e12
1 #! /bin/sh
2 # Copyright (C) 2002 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
6 # GNU Automake is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # GNU Automake is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with autoconf; see the file COPYING. If not, write to
18 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
21 # Check for use of = and += in different conditions.
23 . ./defs || exit 1
25 cat >> configure.in << 'END'
26 AC_PROG_CC
27 AM_CONDITIONAL(COND1, true)
28 AM_CONDITIONAL(COND2, true)
29 AM_CONDITIONAL(COND3, true)
30 AC_OUTPUT
31 END
33 cat > Makefile.am << 'END'
35 FOO = foo
36 if COND1
37 FOO += foo1
38 else
39 FOO += foon1
40 endif
41 if COND2
42 FOO += foo2
43 else
44 FOO += foon2
45 endif
46 ## Note that we add `foo1b' after `foo2'; however because it is appended in
47 ## the same condition as `foo1', it should use the same helper variable
48 ## and thus appear right after `foo1' in the output.
49 if COND1
50 FOO += foo1b
51 else
52 FOO += foon1b
53 endif
55 if COND1
56 if COND2
57 BAR = bar12
58 else
59 BAR = bar1n2
60 endif
61 else
62 BAR = barn1
63 endif
65 BAR += bar
67 if COND3
68 BAR += bar3
69 endif
71 test:
72 @echo BAR: $(BAR) :BAR
73 @echo FOO: $(FOO) :FOO
74 END
76 set -e
78 $ACLOCAL
79 $AUTOCONF
80 $AUTOMAKE -a
81 ./configure
82 $MAKE test | $FGREP 'BAR: bar12 bar bar3 :BAR'
83 $MAKE test | $FGREP 'FOO: foo foo1 foo1b foo2 :FOO'