maint: Update HACKING
[automake.git] / t / warnings-override.sh
blobf5431ae74c47a702b4f00bd70f9af65bade8b87b
1 #! /bin/sh
2 # Copyright (C) 2011-2017 Free Software Foundation, Inc.
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.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # The warnings specified in Makefile.am:AUTOMAKE_OPTIONS should override
18 # those specified in configure.ac:AM_INIT_AUTOMAKE, and both should
19 # override the warnings 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.
24 . test-init.sh
26 # We want (almost) complete control over automake options.
27 AUTOMAKE="$am_original_AUTOMAKE -Werror"
29 cat > Makefile.am <<'END'
30 FOO := bar
31 AUTOMAKE_OPTIONS =
32 END
34 set_warnings ()
36 set +x
37 sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
38 -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
39 mv -f $2-t $2
40 set -x
41 cat $2
44 ok ()
46 $AUTOMAKE $*
49 ko ()
51 AUTOMAKE_fails $*
52 grep '^Makefile\.am:1:.*:=.*not portable' stderr
55 $ACLOCAL
57 # Files required in gnu strictness.
58 touch README INSTALL NEWS AUTHORS ChangeLog COPYING
60 rm -rf autom4te*.cache
61 set_warnings '-Wno-portability' Makefile.am
62 set_warnings '' configure.ac
64 ok -Wportability
67 rm -rf autom4te*.cache
68 set_warnings '' Makefile.am
69 set_warnings '-Wno-portability' configure.ac
71 ok -Wportability
74 rm -rf autom4te*.cache
75 set_warnings '-Wno-portability' Makefile.am
76 set_warnings '-Wno-portability' configure.ac
78 ok -Wportability
80 rm -rf autom4te*.cache
81 set_warnings '-Wportability' Makefile.am
82 set_warnings '' configure.ac
85 ko -Wno-portability
87 rm -rf autom4te*.cache
88 set_warnings '' Makefile.am
89 set_warnings '-Wportability' configure.ac
92 ko -Wno-portability
94 rm -rf autom4te*.cache
95 set_warnings '-Wportability' Makefile.am
96 set_warnings '-Wportability' configure.ac
97 ko -Wno-portability
99 rm -rf autom4te*.cache
100 set_warnings '-Wno-portability' Makefile.am
101 set_warnings '-Wportability' configure.ac
103 ok -Wportability
105 rm -rf autom4te*.cache
106 set_warnings '-Wportability' Makefile.am
107 set_warnings '-Wno-portability' configure.ac
109 ko -Wno-portability