Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / distlinks.test
1 #! /bin/sh
2 # Copyright (C) 2010 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 # Check that distributed symlinks in the source tree will be expanded
18 # as regular files in $(distdir).
19
20 . ./defs || Exit 1
21
22 set -e
23
24 echo text > file
25
26 ln -s file lnk || {
27   echo "$me: cannot create symlinks to files" >&2
28   Exit 77
29 }
30
31 mkdir A
32 mkdir B
33 echo aaa > A/aaa
34 cd B
35 ln -s ../A/aaa bbb
36 cd ..
37
38 echo FooBarBaz > foo
39
40 ln -s foo  bar1
41 ln -s bar1 bar2
42 ln -s bar2 bar3
43
44 ln -s "`pwd`/foo" quux
45
46 cat >> configure.in << 'END'
47 AC_OUTPUT
48 END
49
50 echo "me = $me" > Makefile.am  # for better failure messages
51 cat >> Makefile.am << 'END'
52 EXTRA_DIST = lnk B/bbb bar1 bar2 bar3 quux
53 .PHONY: test
54 test: distdir
55         ls -l $(distdir) $(distdir)/B
56         fail() { echo "$(me): $$*" >&2; e=1; }; \
57         e=0; \
58         set file lnk A/aaa B/bbb foo quux foo bar1 foo bar2 foo bar3; \
59         while test $$# -ge 2; do \
60           file=$$1; shift; link=$(distdir)/$$1; shift; \
61           test -f $$link || fail "$$link is not a regular file"; \
62           test ! -h $$link || fail "$$link is a symlink"; \
63           diff $$file $$link || fail "$$link differs from $$file"; \
64         done; \
65         exit $$e;
66 END
67
68 ls -l . A B
69
70 $ACLOCAL
71 $AUTOCONF
72 $AUTOMAKE
73
74 ./configure
75 $MAKE test
76
77 :