Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / distdir.test
1 #! /bin/sh
2 # Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007, 2009, 2010 Free
3 # Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Test to make sure subdirs in EXTRA_DIST work.  Also tests to make
19 # sure *srcdir is properly handled.  Note that using `./', as in
20 #   EXTRA_DIST = ./joe
21 # does not work portably: it fails with HP-UX and Tru64 make.
22 # Also test DISTFILES containing a directory and a file in it,
23 # and repeated directories.
24
25 . ./defs || Exit 1
26
27 set -e
28
29 cat >> configure.in << 'END'
30 AC_OUTPUT
31 END
32
33 cat > Makefile.am << 'END'
34 include_HEADERS = some/file another/sub/subsub/file2 yet/another/file3
35 EXTRA_DIST = foo/bar joe $(top_srcdir)/woo/doo $(srcdir)/dada \
36              some another/sub yet \
37              some another/sub yet
38
39
40 all-local:
41         $(MKDIR_P) another/sub/subsub
42         touch another/sub/subsub/file2
43
44 CLEANFILES = another/sub/subsub/file2
45
46 check-local:
47         test -f $(srcdir)/foo/bar
48         test -f $(srcdir)/woo/doo
49         test -f $(srcdir)/joe
50         test -f $(srcdir)/dada
51         test -f $(srcdir)/some/file
52         test -f $(srcdir)/another/sub/subsub/file2 \
53         || test -f /another/sub/subsub/file2
54         test -f $(srcdir)/yet/another/file3
55 END
56
57 $ACLOCAL
58 $AUTOCONF
59 $AUTOMAKE
60
61 mkdir foo woo some another another/sub another/sub/subsub yet yet/another
62 touch foo/bar joe woo/doo dada some/file another/sub/subsub/file2
63 touch yet/another/file3
64
65 mkdir build
66 cd build
67 ../configure
68 $MAKE distdir
69 # Check to make sure `foo' isn't made in build directory.
70 test -d foo && Exit 1
71
72 rm -rf $me-1.0
73 # Remove the dot from VERSION for the next grep.
74 VERSION=10 MKDIR_P='echo MKDIR_P' $MAKE -e distdir >stdout || :
75 cat stdout
76
77 # Make sure no `./' appear in the directory names.  srcdir is `..', so
78 # this also checks that no directory is created in the source tree.
79 grep 'MKDIR_P.*\.' stdout && Exit 1
80
81 cd ..
82 ./configure --prefix "`pwd`"
83 $MAKE distcheck
84
85 :