doc: update Vala documentation
[automake.git] / t / cond40.sh
blob6021bb79fe826a85ec22b5cb72e7e0b22c2cbf04
1 #! /bin/sh
2 # Copyright (C) 2008-2024 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 <https://www.gnu.org/licenses/>.
17 # Test AM_COND_IF.
19 . test-init.sh
21 cat >>configure.ac <<'END'
22 AC_DEFUN([FOO],
23 [AC_CONFIG_FILES([$1])])
25 AM_CONDITIONAL([COND], [test "$cond" = yes])
26 # Next lines should not cause a shell syntax error.
27 AM_COND_IF([COND])
28 AM_COND_IF([COND],
29 [AC_SUBST([BAR])])
30 AM_COND_IF([COND],
31 [AC_CONFIG_FILES([file1])])
33 # Things should work even at a time when the shell expressions
34 # for the conditional are not valid any more.
35 ok=$cond1
36 AM_CONDITIONAL([COND1], [test "$ok" = yes])
37 ok=$cond2
38 AM_CONDITIONAL([COND2], [test "$ok" = yes])
39 ok=$cond3
40 AM_CONDITIONAL([COND3], [test "$ok" = yes])
42 AM_COND_IF([COND1],
43 [AM_COND_IF([COND2], [FOO([file2])],
44 [AM_COND_IF([COND3],
45 [FOO([file3])])])])
47 AC_OUTPUT
48 END
50 : >Makefile.am
51 : >file1.in
52 : >file2.in
53 : >file3.in
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE -a
59 ./configure cond=yes cond1=yes cond2=no cond3=yes
60 test -f file1
61 test ! -e file2
62 test -f file3
63 rm -f file1 file3
64 $MAKE file1 file3
65 $MAKE file2 && exit 1
66 test -f file1
67 test ! -e file2
68 test -f file3
69 $MAKE distclean
71 ./configure cond=no cond1=yes cond2=yes
72 test ! -e file1
73 test -f file2
74 test ! -e file3
75 rm -f file2
76 $MAKE file1 && exit 1
77 $MAKE file2
78 $MAKE file3 && exit 1
79 test ! -e file1
80 test -f file2
81 test ! -e file3