Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / cond40.test
1 #! /bin/sh
2 # Copyright (C) 2008, 2010 Free Software Foundation, Inc.
3 #
4 # This file is part of GNU Automake.
5 #
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.
10 #
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.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Automake; see the file COPYING.  If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
20
21 # Test AM_COND_IF.
22
23 . ./defs || Exit 1
24 set -e
25
26 cat >>configure.in <<'END'
27 AC_DEFUN([FOO],
28          [AC_CONFIG_FILES([$1])])
29
30 AM_CONDITIONAL([COND], [test "$cond" = yes])
31 # Next lines should not cause a shell syntax error.
32 AM_COND_IF([COND])
33 AM_COND_IF([COND],
34            [AC_SUBST([BAR])])
35 AM_COND_IF([COND],
36            [AC_CONFIG_FILES([file1])])
37
38 # Things should work even at a time when the shell expressions
39 # for the conditional are not valid any more.
40 ok=$cond1
41 AM_CONDITIONAL([COND1], [test "$ok" = yes])
42 ok=$cond2
43 AM_CONDITIONAL([COND2], [test "$ok" = yes])
44 ok=$cond3
45 AM_CONDITIONAL([COND3], [test "$ok" = yes])
46
47 AM_COND_IF([COND1],
48            [AM_COND_IF([COND2], [FOO([file2])],
49                        [AM_COND_IF([COND3],
50                                    [FOO([file3])])])])
51
52 AC_OUTPUT
53 END
54
55 : >Makefile.am
56 : >file1.in
57 : >file2.in
58 : >file3.in
59
60 $ACLOCAL
61 $AUTOCONF
62 $AUTOMAKE -a
63
64 ./configure cond=yes cond1=yes cond2=no cond3=yes
65 test -f file1
66 test ! -f file2
67 test -f file3
68 rm -f file1 file3
69 $MAKE file1 file3
70 $MAKE file2 && Exit 1
71 test -f file1
72 test ! -f file2
73 test -f file3
74 $MAKE distclean
75
76 ./configure cond=no cond1=yes cond2=yes
77 test ! -f file1
78 test -f file2
79 test ! -f file3
80 rm -f file2
81 $MAKE file1 && Exit 1
82 $MAKE file2
83 $MAKE file3 && Exit 1
84 test ! -f file1
85 test -f file2
86 test ! -f file3
87 :