Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / distdir.test
1 #! /bin/sh
2 # Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007, 2009  Free Software
3 # 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 echo AC_OUTPUT >>configure.in
30
31 cat > Makefile.am << 'END'
32 include_HEADERS = some/file another/sub/subsub/file2 yet/another/file3
33 EXTRA_DIST = foo/bar joe $(top_srcdir)/woo/doo $(srcdir)/dada \
34              some another/sub yet \
35              some another/sub yet
36
37
38 all-local:
39         $(MKDIR_P) another/sub/subsub
40         touch another/sub/subsub/file2
41
42 CLEANFILES = another/sub/subsub/file2
43
44 check-local:
45         test -f $(srcdir)/foo/bar
46         test -f $(srcdir)/woo/doo
47         test -f $(srcdir)/joe
48         test -f $(srcdir)/dada
49         test -f $(srcdir)/some/file
50         test -f $(srcdir)/another/sub/subsub/file2 \
51         || test -f /another/sub/subsub/file2
52         test -f $(srcdir)/yet/another/file3
53 END
54
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE
58
59 mkdir foo woo some another another/sub another/sub/subsub yet yet/another
60 touch foo/bar joe woo/doo dada some/file another/sub/subsub/file2
61 touch yet/another/file3
62
63 mkdir build
64 cd build
65 ../configure
66 $MAKE distdir
67 # Check to make sure `foo' isn't made in build directory.
68 test -d foo && Exit 1
69
70 rm -rf distdir-1.0
71 # Remove the dot from VERSION for the next grep.
72 VERSION=10 MKDIR_P='echo MKDIR_P' $MAKE -e distdir >make.log || :
73
74 # Make sure no `./' appear in the directory names.  srcdir is `..', so
75 # this also checks that no directory is created in the source tree.
76 grep 'MKDIR_P.*\.' make.log && Exit 1
77
78 cd ..
79 ./configure --prefix "`pwd`"
80 $MAKE distcheck
81
82 Exit 0