sync: update files from upstream with "make fetch"
[automake.git] / t / conflnk4.sh
blob090f809f27c3184673f19f79cd871ae244d386e5
1 #! /bin/sh
2 # Copyright (C) 2003-2012 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 <http://www.gnu.org/licenses/>.
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.
20 . ./defs || exit 1
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
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
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
48 $ACLOCAL
49 $AUTOMAKE
50 $AUTOCONF
52 mkdir build
53 cd build
54 ../configure
56 $MAKE test
58 # Make sure nothing is deleted by 'make clean'
59 $MAKE clean
61 test -f ../src
62 test -f ../sdir/src2
63 test -f ../nonmk-subdir/src3
64 test -f ../sdir/mk-subdir/src4
66 # Make sure the links are deleted by 'make distclean' and the original files
67 # are not.
68 $MAKE distclean
70 test -f ../src
71 test -f ../sdir/src2
72 test -f ../nonmk-subdir/src3
73 test -f ../sdir/mk-subdir/src4
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
80 cd ..
81 ./configure
83 $MAKE test
85 # Make sure nothing is deleted by 'make distclean'
86 $MAKE distclean
88 test -f src
89 test -f sdir/src2
90 test -f nonmk-subdir/src3
91 test -f sdir/mk-subdir/src4