t/README: document "run_make", discourage "make -e"
[platform/upstream/automake.git] / t / strictness-override.sh
1 #! /bin/sh
2 # Copyright (C) 2011-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 # The strictness specified in Makefile.am:AUTOMAKE_OPTIONS should
18 # override that specified in configure.ac:AM_INIT_AUTOMAKE, and both
19 # should override the strictness specified on the command line.
20 # NOTE: the current semantics might not be the best one (even if it has
21 # been in place for quite a long time); see also Automake bug #7673.
22 # Update this test if the semantics are changed.
23
24 . test-init.sh
25
26 # We want complete control over automake options.
27 AUTOMAKE=$am_original_AUTOMAKE
28
29 cat > Makefile.am <<'END'
30 AUTOMAKE_OPTIONS =
31 END
32
33 set_strictness ()
34 {
35   set +x
36   sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
37                 -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
38   mv -f $2-t $2
39   set -x
40   cat $2
41 }
42
43 ok ()
44 {
45   $AUTOMAKE -Werror $*
46 }
47
48 ko ()
49 {
50   AUTOMAKE_fails $*
51   grep 'required file.*README' stderr
52 }
53
54 $ACLOCAL
55
56 # Leave out only one of the required files, to avoid too much
57 # repetition in the error messages.
58 touch INSTALL NEWS AUTHORS ChangeLog COPYING
59
60 rm -rf autom4te*.cache
61 set_strictness '' Makefile.am
62 set_strictness '' configure.ac
63 ko --gnu
64 ko
65 ok --foreign
66
67 rm -rf autom4te*.cache
68 set_strictness 'gnu' Makefile.am
69 set_strictness '' configure.ac
70 ko --gnu
71 ko
72 ko --foreign
73
74 rm -rf autom4te*.cache
75 set_strictness '' Makefile.am
76 set_strictness 'gnu' configure.ac
77 ko --gnu
78 ko
79 ko --foreign
80
81 rm -rf autom4te*.cache
82 set_strictness 'foreign' Makefile.am
83 set_strictness '' configure.ac
84 ok --gnu
85 ok
86 ok --foreign
87
88 rm -rf autom4te*.cache
89 set_strictness '' Makefile.am
90 set_strictness 'foreign' configure.ac
91 ok --gnu
92 ok
93 ok --foreign
94
95 rm -rf autom4te*.cache
96 set_strictness 'gnu' Makefile.am
97 set_strictness 'gnu' configure.ac
98 ko --gnu
99 ko
100 ko --foreign
101
102 rm -rf autom4te*.cache
103 set_strictness 'foreign' Makefile.am
104 set_strictness 'foreign' configure.ac
105 ok --gnu
106 ok
107 ok --foreign
108
109 rm -rf autom4te*.cache
110 set_strictness 'foreign' Makefile.am
111 set_strictness 'gnu' configure.ac
112 ok --gnu
113 ok
114 ok --foreign
115
116 rm -rf autom4te*.cache
117 set_strictness 'gnu' Makefile.am
118 set_strictness 'foreign' configure.ac
119 ko --gnu
120 ko
121 ko --foreign
122
123 :