Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / extra-portability3.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 interactions between the `portability-recursive' and
18 # `extra-portability' warning categories.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 # We want (almost) complete control over automake options.
25 # FIXME: use $original_AUTOMAKE here once we are merged into master.
26 AUTOMAKE="`(set $AUTOMAKE && echo $1)` --foreign -Werror"
27
28 cat >>configure.in <<END
29 AC_PROG_CC
30 AC_PROG_RANLIB
31 AC_OUTPUT
32 END
33
34 $ACLOCAL
35
36 cat >Makefile.am <<'END'
37 baz = $(foo$(bar))
38 lib_LIBRARIES = libfoo.a
39 libfoo_a_SOURCES = foo.c
40 END
41
42 # 'extra-portability' implies 'portability-recursive'.
43 AUTOMAKE_fails -Wextra-portability
44 grep 'requires.*AM_PROG_AR' stderr
45 grep 'recursive variable expansion' stderr
46
47 # We can disable 'extra-portability' while leaving
48 # 'portability-recursive' intact.
49 AUTOMAKE_fails -Wportability-recursive -Wno-extra-portability
50 grep 'requires.*AM_PROG_AR' stderr && Exit 1
51 grep 'recursive variable expansion' stderr
52
53 # We can disable 'portability-recursive' while leaving
54 # 'extra-portability' intact.
55 AUTOMAKE_fails -Wextra-portability -Wno-portability-recursive
56 grep 'requires.*AM_PROG_AR' stderr
57 grep 'recursive variable expansion' stderr && Exit 1
58
59 # Disabling 'portability' disables 'portability-recursive' and
60 # 'extra-portability'.
61 $AUTOMAKE -Wextra-portability -Wno-portability
62
63 :