summaryrefslogtreecommitdiff
path: root/t/extra-portability3.sh
blob: 77680c66390e438e81624274def3876c0e42f7ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/sh
# Copyright (C) 2011-2017 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Check interactions between the 'portability-recursive' and
# 'extra-portability' warning categories.

. test-init.sh

# We want (almost) complete control over automake options.
AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror"

cat >>configure.ac <<END
AC_PROG_CC
AC_PROG_RANLIB
AC_OUTPUT
END

$ACLOCAL

cat >Makefile.am <<'END'
baz = $(foo$(bar))
lib_LIBRARIES = libfoo.a
libfoo_a_SOURCES = foo.c
END

# 'extra-portability' implies 'portability-recursive'.
AUTOMAKE_fails -Wextra-portability
grep 'requires.*AM_PROG_AR' stderr
grep 'recursive variable expansion' stderr

# We can disable 'extra-portability' while leaving
# 'portability-recursive' intact.
AUTOMAKE_fails -Wportability-recursive -Wno-extra-portability
grep 'requires.*AM_PROG_AR' stderr && exit 1
grep 'recursive variable expansion' stderr

# We can disable 'portability-recursive' while leaving
# 'extra-portability' intact.
AUTOMAKE_fails -Wextra-portability -Wno-portability-recursive
grep 'requires.*AM_PROG_AR' stderr
grep 'recursive variable expansion' stderr && exit 1

# Disabling 'portability' disables 'portability-recursive' and
# 'extra-portability'.
$AUTOMAKE -Wextra-portability -Wno-portability

: