tests: expose automake bug#14560
[platform/upstream/automake.git] / t / distdir.sh
1 #! /bin/sh
2 # Copyright (C) 1996-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 # Test to make sure subdirs in EXTRA_DIST work.  Also tests to make
18 # sure *srcdir is properly handled.  Note that using './', as in
19 #   EXTRA_DIST = ./joe
20 # does not work portably: it fails with HP-UX and Tru64 make.
21 # Also test DISTFILES containing a directory and a file in it,
22 # and repeated directories.
23
24 . test-init.sh
25
26 cat >> configure.ac << 'END'
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 include_HEADERS = some/file another/sub/subsub/file2 yet/another/file3
32 EXTRA_DIST = foo/bar joe $(top_srcdir)/woo/doo $(srcdir)/dada \
33              some another/sub yet \
34              some another/sub yet
35
36
37 all-local:
38         $(MKDIR_P) another/sub/subsub
39         touch another/sub/subsub/file2
40
41 CLEANFILES = another/sub/subsub/file2
42
43 check-local:
44         test -f $(srcdir)/foo/bar
45         test -f $(srcdir)/woo/doo
46         test -f $(srcdir)/joe
47         test -f $(srcdir)/dada
48         test -f $(srcdir)/some/file
49         test -f $(srcdir)/another/sub/subsub/file2 \
50         || test -f /another/sub/subsub/file2
51         test -f $(srcdir)/yet/another/file3
52 END
53
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE
57
58 mkdir foo woo some another another/sub another/sub/subsub yet yet/another
59 touch foo/bar joe woo/doo dada some/file another/sub/subsub/file2
60 touch yet/another/file3
61
62 mkdir build
63 cd build
64 ../configure
65 $MAKE distdir
66 # Check to make sure 'foo' isn't made in build directory.
67 test -d foo && exit 1
68
69 rm -rf $me-1.0
70 # Remove the dot from VERSION for the next grep.
71 run_make -O -e IGNORE VERSION=10 MKDIR_P='echo MKDIR_P' distdir
72
73 # Make sure no './' appear in the directory names.  srcdir is '..', so
74 # this also checks that no directory is created in the source tree.
75 grep 'MKDIR_P.*\.' stdout && exit 1
76
77 cd ..
78 ./configure --prefix "$(pwd)"
79 $MAKE distcheck
80
81 :