tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / condman3.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2013 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 2, 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 # Make sure conditionals work with man pages.
18
19 . test-init.sh
20
21 cat >> configure.ac << 'END'
22 AM_CONDITIONAL([COND], [test x"$FOO" = x"true"])
23 AC_OUTPUT
24 END
25
26 cat > Makefile.am << 'END'
27 if COND
28 man_MANS = foo.1
29 man4_MANS = 6.man
30 else
31 man_MANS = bar.2 baz.1
32 man5_MANS = zap.5
33 endif
34
35 .PHONY: test1 test2
36 test1:
37         find $(mandir) ;: For debugging.
38         test -f $(mandir)/man1/foo.1
39         test -f $(mandir)/man4/6.4
40         test ! -f $(mandir)/man2/bar.2
41         test ! -f $(mandir)/man1/baz.1
42         test ! -f $(mandir)/man5/zap.5
43 test2:
44         find $(mandir) ;: For debugging.
45         test -f $(mandir)/man2/bar.2
46         test -f $(mandir)/man1/baz.1
47         test -f $(mandir)/man5/zap.5
48         test ! -f $(mandir)/man1/foo.1
49         test ! -f $(mandir)/man4/6.4
50         test ! -f $(mandir)/man4/6.man
51 END
52
53 $ACLOCAL
54 $AUTOMAKE
55 $AUTOCONF
56
57 $EGREP 'MANS|\.([123456789]|man)' Makefile.in # For debugging.
58
59 mkdir build
60 cd build
61 ../configure FOO=true --prefix="$(pwd)/_inst"
62 $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
63 touch foo.1 6.man
64 $MAKE install
65 $MAKE test1
66
67 cd ..
68 ./configure FOO=false --prefix="$(pwd)/_inst"
69 $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
70 touch bar.2 baz.1 zap.5
71 $MAKE install
72 $MAKE test2
73
74 :