am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / extra-dist-vpath-dir-merge.sh
1 #! /bin/sh
2 # Copyright (C) 2002-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 # Check to make sure that when distdir is invoked in a VPATH
18 # configuration and has to distribute directory X, it actually merge
19 # $(srcdir)/X and ./X, with the files from the later overriding the
20 # files from the former.
21
22 . test-init.sh
23
24 echo AC_OUTPUT >> configure.ac
25
26 cat > Makefile.am << 'END'
27 EXTRA_DIST=foo/bar baz
28
29 check: distdir
30         test -f $(distdir)/foo/bar/baz
31         test -f $(distdir)/foo/bar/baz2
32         test -f $(distdir)/baz/foo
33         test -f $(distdir)/baz/foo2
34         grep source $(distdir)/foo/bar/baz
35         grep build $(distdir)/foo/bar/baz2
36         grep source $(distdir)/baz/foo
37         grep build $(distdir)/baz/foo2
38 END
39
40 # Create some files in $(srcdir)
41 mkdir foo
42 mkdir foo/bar
43 echo source > foo/bar/baz
44 echo source > foo/bar/baz2
45 mkdir baz
46 echo source > baz/foo
47 echo source > baz/foo2
48
49 $ACLOCAL
50 $AUTOMAKE
51 $AUTOCONF
52 mkdir build
53 cd build
54 ../configure
55
56 # Create some files in $(builddir) that will override part of the
57 # files if $(srcdir) when the distribution is made.
58 mkdir foo
59 mkdir foo/bar
60 echo build > foo/bar/baz2
61 mkdir baz
62 echo build > baz/foo2
63
64 $MAKE check
65
66 :