coverage: tests AM_MISSING_PROG usage
[platform/upstream/automake.git] / t / cygnus-no-dist.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 that cygnus mode forbids creation of distribution tarball.
18
19 . ./defs || Exit 1
20
21 echo AM_MAINTAINER_MODE >> configure.ac
22 mv -f configure.ac configure.stub
23
24 cat configure.stub - > configure.ac <<'END'
25 AC_OUTPUT
26 END
27
28 : > Makefile.am
29
30 $ACLOCAL
31 $AUTOCONF
32 $AUTOMAKE --cygnus -Wno-obsolete
33
34 ./configure
35 $MAKE
36
37 for target in dist distdir distcheck dist-all dist-gzip; do
38   $MAKE -n $target >out 2>&1 && { cat out; Exit 1; }
39   cat out
40   grep $target out
41 done
42
43 # Now check that cygnus mode in a subdirectory disables
44 # distribution-building in that subdirectory.
45
46 cat > Makefile.am <<'END'
47 SUBDIRS = sub1 sub2
48 END
49
50 mkdir sub1 sub2
51 : > sub1/Makefile.am
52 cat > sub2/Makefile.am <<'END'
53 # The '-Wall' after 'cygnus' should ensure no warning gets
54 # unintentionally disabled.  We are particularly interested
55 # in override warnings, for when (below) we add the 'distdir'
56 # target.
57 AUTOMAKE_OPTIONS = cygnus -Wall
58 # This is required because the 'cygnus' option is now deprecated.
59 AUTOMAKE_OPTIONS += -Wno-obsolete
60 END
61
62 cat configure.stub - > configure.ac <<'END'
63 AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
64 AC_OUTPUT
65 END
66
67 $AUTOCONF
68 $AUTOMAKE
69
70 ./configure
71 $MAKE
72 cd sub2
73 $MAKE -n distdir >out 2>&1 && { cat out; Exit 1; }
74 grep distdir out
75 cd ..
76
77 cat >> sub2/Makefile.am <<'END'
78 distdir:
79 END
80 $AUTOMAKE sub2/Makefile
81 ./config.status sub2/Makefile
82
83 $MAKE distdir
84 $MAKE dist
85
86 :