Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / ansi2knr-deprecation.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 the use of automatic de-ANSI-fication feature is deprecated.
18 # That feature will be removed in the next major Automake release.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 warn_rx='automatic de-ANSI-fication.*deprecated'
25
26 cat >> configure.in <<'END'
27 AC_PROG_CC
28 AM_C_PROTOTYPES
29 END
30
31 $ACLOCAL
32
33 $AUTOCONF -Wall -Werror -Wno-obsolete
34 $AUTOCONF -Wnone -Wobsolete -Werror 2>stderr && { cat stderr >&2; Exit 1; }
35 cat stderr >&2
36 grep "^configure\\.in:5:.* AM_C_PROTOTYPES:.*$warn_rx" stderr
37
38 sed '/AM_C_PROTOTYPES/d' configure.in > config.stub
39 diff configure.in config.stub && fatal_ "failed to edit configure.in"
40 rm -f configure.in
41
42 cat > Makefile.stub <<'END'
43 ANSI2KNR = :
44 U =
45 END
46
47 for opt in ansi2knr lib/ansi2knr; do
48   # ansi2knr option in Makefile.am
49   cp config.stub configure.in
50   cp Makefile.stub Makefile.am
51   echo "AUTOMAKE_OPTIONS = $opt" >> Makefile.am
52   cat Makefile.am # For debugging.
53   $AUTOMAKE -Wno-obsolete
54   AUTOMAKE_fails
55   grep "^Makefile\.am:3:.*$warn_rx" stderr
56   AUTOMAKE_fails -Wnone -Wobsolete
57   grep "^Makefile\.am:3:.*$warn_rx" stderr
58   # ansi2knr option in configure.in
59   cp Makefile.stub Makefile.am
60   sed "s|^\\(AM_INIT_AUTOMAKE\\).*|\1([$opt])|" config.stub > configure.in
61   cat configure.in # For debugging.
62   $AUTOMAKE -Wno-obsolete
63   AUTOMAKE_fails
64   grep "^configure\.in:2:.*$warn_rx" stderr
65   AUTOMAKE_fails -Wnone -Wobsolete
66   grep "^configure\.in:2:.*$warn_rx" stderr
67 done
68
69 :