tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / conflnk4.sh
1 #! /bin/sh
2 # Copyright (C) 2003-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 # Test to make sure links to _identical files_ created by AC_CONFIG_LINKS get
18 # removed with 'make distclean' only if doing a VPATH build.
19
20 . test-init.sh
21
22 mkdir nonmk-subdir sdir sdir/mk-subdir
23 : > src
24 : > sdir/Makefile.am
25 : > sdir/src2
26 : > nonmk-subdir/src3
27 : > sdir/mk-subdir/src4
28
29 cat >> Makefile.am <<'EOF'
30 SUBDIRS = sdir
31 .PHONY: test
32 test: distdir
33         test -f $(distdir)/src
34         test -f $(distdir)/sdir/src2
35         test -f $(distdir)/nonmk-subdir/src3
36         test -f $(distdir)/sdir/mk-subdir/src4
37 EOF
38
39 cat >>configure.ac << 'EOF'
40 AC_CONFIG_FILES([sdir/Makefile])
41 AC_CONFIG_LINKS([src:src])
42 AC_CONFIG_LINKS([sdir/src2:sdir/src2])
43 AC_CONFIG_LINKS([nonmk-subdir/src3:nonmk-subdir/src3])
44 AC_CONFIG_LINKS([sdir/mk-subdir/src4:sdir/mk-subdir/src4])
45 AC_OUTPUT
46 EOF
47
48 $ACLOCAL
49 $AUTOMAKE
50 $AUTOCONF
51
52 mkdir build
53 cd build
54 ../configure
55
56 $MAKE test
57
58 # Make sure nothing is deleted by 'make clean'
59 $MAKE clean
60
61 test -f ../src
62 test -f ../sdir/src2
63 test -f ../nonmk-subdir/src3
64 test -f ../sdir/mk-subdir/src4
65
66 # Make sure the links are deleted by 'make distclean' and the original files
67 # are not.
68 $MAKE distclean
69
70 test -f ../src
71 test -f ../sdir/src2
72 test -f ../nonmk-subdir/src3
73 test -f ../sdir/mk-subdir/src4
74
75 test -r src && exit 1
76 test -r sdir/src2 && exit 1
77 test -r nonmk-subdir/src3 && exit 1
78 test -r sdir/mk-subdir/src4 && exit 1
79
80 cd ..
81 ./configure
82
83 $MAKE test
84
85 # Make sure nothing is deleted by 'make distclean'
86 $MAKE distclean
87
88 test -f src
89 test -f sdir/src2
90 test -f nonmk-subdir/src3
91 test -f sdir/mk-subdir/src4
92
93 :