Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / distcom4.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2006, 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 # Test to make sure config files are distributed, and only once.
18 # This tries to distribute a file from a subdirectory, without
19 # Makefile in that directory.  distcom5.test performs the same
20 # test with a Makefile in the directory.
21 # Also make sure that README appears first in DIST_COMMON.
22
23 . ./defs || Exit 1
24
25 set -e
26
27 cat >> configure.in << 'END'
28    AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in],
29                    [chmod +x tests/autoconf])
30    AC_CONFIG_FILES([tests/autoheader:tests/wrapper.in],
31                    [chmod +x tests/autoheader])
32    AC_CONFIG_FILES([tests/autom4te:tests/wrapper.in],
33                    [chmod +x tests/autom4te])
34    AC_CONFIG_FILES([tests/autoreconf:tests/wrapper.in],
35                    [chmod +x tests/autoreconf])
36    AC_CONFIG_FILES([tests/autoscan:tests/wrapper.in],
37                    [chmod +x tests/autoscan])
38    AC_CONFIG_FILES([tests/autoupdate:tests/wrapper.in],
39                    [chmod +x tests/autoupdate])
40    AC_CONFIG_FILES([tests/ifnames:tests/wrapper.in],
41                    [chmod +x tests/ifnames])
42    AC_OUTPUT
43 END
44
45 mkdir tests
46 : > README
47 : > tests/wrapper.in
48 cat > Makefile.am << 'END'
49 .PHONY: test
50 test: distdir
51         test -f $(distdir)/tests/wrapper.in
52 END
53
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE --add-missing
57 ./configure
58 $MAKE test
59
60 sed -n -e '/^DIST_COMMON =.*\\$/ {
61    :loop
62    p
63    n
64    t clear
65    :clear
66    s/\\$/\\/
67    t loop
68    p
69    n
70    }' -e '/^DIST_COMMON =/ p' Makefile.in > dc.txt
71
72 cat dc.txt # might be useful for debugging
73
74 test 1 = `grep tests dc.txt | wc -l`
75 grep configure dc.txt
76 # README must come first.
77 grep 'DIST_COMMON = README' Makefile.in
78
79 :