* Use `keep_testdirs=yes' to keep test directories for successful
tests also.
++* Use perl coverage information to ensure your new code is thoroughly
++ tested by your new tests.
++
* See file `tests/README' for more information.
================================================================
=cut
++# HACK to have `-Wextra-portability' *not* implied by `-Wall'.
++# This will go away in automake 1.12.
++my $have_extra_portability = 0;
++
sub switch_warning ($)
{
my ($cat) = @_;
if ($cat eq 'all')
{
setup_channel_type 'warning', silent => $has_no;
++ setup_channel 'extra-portability', silent => 1
++ unless $have_extra_portability;
}
elsif ($cat eq 'none')
{
elsif (channel_type ($cat) eq 'warning')
{
setup_channel $cat, silent => $has_no;
- #
- # Handling of portability warnings is trickier. For relevant tests,
- # see `dollarvar2', `extra-portability' and `extra-portability3'.
- #
- # -Wportability-recursive and -Wno-portability-recursive should not
- # have any effect on other 'portability' or 'extra-portability'
- # warnings, so there's no need to handle them separately or ad-hoc.
- #
- if ($cat eq 'extra-portability' && ! $has_no) # -Wextra-portability
+ setup_channel 'portability-recursive', silent => $has_no
+ if $cat eq 'portability';
++ if ($cat eq 'portability' && $has_no)
+ {
- # -Wextra-portability must enable 'portability' and
- # 'portability-recursive' warnings.
- setup_channel 'portability', silent => 0;
- setup_channel 'portability-recursive', silent => 0;
++ setup_channel 'extra-portability', silent => 1;
++ $have_extra_portability = 0;
+ }
- if ($cat eq 'portability') # -Wportability or -Wno-portability
++ if ($cat eq 'extra-portability' && ! $has_no)
+ {
- if ($has_no) # -Wno-portability
- {
- # -Wno-portability must disable 'extra-portability' and
- # 'portability-recursive' warnings.
- setup_channel 'portability-recursive', silent => 1;
- setup_channel 'extra-portability', silent => 1;
- }
- else # -Wportability
- {
- # -Wportability must enable 'portability-recursive'
- # warnings. But it should have no influence over the
- # 'extra-portability' warnings.
- setup_channel 'portability-recursive', silent => 0;
- }
++ setup_channel 'portability', silent => 0;
++ setup_channel 'portability-recursive', silent => 0;
++ $have_extra_portability = 1;
+ }
}
else
{
}
}
++1;
++
=back
=head1 SEE ALSO
--- /dev/null
-AUTOMAKE_fails
+ #! /bin/sh
+ # Copyright (C) 2011 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/>.
+
+ # Test if lib_LIBRARIES requests AM_PROG_AR.
+
+ . ./defs || Exit 1
+
+ set -e
+
+ cat >> configure.in << 'END'
+ AC_PROG_CC
+ AC_PROG_RANLIB
+ END
+
+ cat > Makefile.am << 'END'
+ lib_LIBRARIES = libfoo.a
+ libfoo_a_SOURCES = foo.c
+ END
+
+ $ACLOCAL
++AUTOMAKE_fails -Wextra-portability
+
+ grep 'requires.*AM_PROG_AR' stderr
+
+ cat >> configure.in << 'END'
+ AM_PROG_AR
+ END
+
+ rm -rf autom4te*.cache
+ $ACLOCAL
+ $AUTOMAKE --add-missing
+
+ :
--- /dev/null
-AUTOMAKE_fails
+ #! /bin/sh
+ # Copyright (C) 2011 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/>.
+
+ # Test if lib_LTLIBRARIES requests AM_PROG_AR.
+
+ required=libtoolize
+ . ./defs || Exit 1
+
+ set -e
+
+ cp configure.in X
+
+ cat >> configure.in << 'END'
+ AC_PROG_CC
+ AC_PROG_RANLIB
+ AC_PROG_LIBTOOL
+ AC_OUTPUT
+ END
+
+ cat > Makefile.am << 'END'
+ lib_LTLIBRARIES = libfoo.la
+ libfoo_la_SOURCES = foo.c
+ END
+
+ libtoolize
+ $ACLOCAL
-$AUTOMAKE --add-missing
++AUTOMAKE_fails -Wextra-portability
+
+ grep 'requires.*AM_PROG_AR' stderr
+
+ cp X configure.in
+
+ cat >> configure.in << 'END'
+ AC_PROG_CC
+ AM_PROG_AR
+ AC_PROG_RANLIB
+ AC_PROG_LIBTOOL
+ AC_OUTPUT
+ END
+
+ $ACLOCAL
++$AUTOMAKE -Wextra-portability --add-missing
+
+ :
--- /dev/null
-# 3. `-Wall' must imply `-Wextra-portability'.
+ #! /bin/sh
+ # Copyright (C) 2011 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' and `extra-portability'
+ # warning categories:
+ # 1. `-Wextra-portability' must imply `-Wportability'.
+ # 2. `-Wno-portability' must imply `-Wno-extra-portability'.
-# -Wall enables extra-portability.
-AUTOMAKE_fails -Wall
-grep 'requires.*AM_PROG_AR' stderr
-
-# Disabling portability disables extra-portability as well.
-$AUTOMAKE -Wextra-portability -Wno-portability
-$AUTOMAKE -Wall -Wno-portability
++# 3. `-Wall' does *not* imply `-Wextra-portability'.
+
+ . ./defs || Exit 1
+
+ set -e
+
+ # We want (almost) complete control over automake options.
+ # FIXME: use $original_AUTOMAKE here once we are merged into master.
+ AUTOMAKE="`(set $AUTOMAKE && echo $1)` --foreign -Werror"
+
+ cat >>configure.in <<END
+ AC_PROG_CC
+ AC_PROG_RANLIB
+ AC_OUTPUT
+ END
+
+ $ACLOCAL
+
+ #
+ # First, a setup where only an extra-portability warning is present
+ # (no "simple" portability-warnings are).
+ #
+
+ cat >Makefile.am <<END
+ EXTRA_LIBRARIES = libfoo.a
+ libfoo_a_SOURCES = sub/foo.c
+ END
+
+ # Sanity check: extra-portability warnings causes the expected error.
+ AUTOMAKE_fails -Wextra-portability
+ grep 'requires.*AM_PROG_AR' stderr
+
+ # Warnings in extra-portability category are not enabled by default.
+ $AUTOMAKE
+
-#
-# Now, a setup where also a "simple" portability warning is present.
-#
++# `-Wall' does not enable extra-portability warnings.
++$AUTOMAKE -Wall -Werror
+
-# Per-target flags require the use of AM_PROG_CC_C_O in configure.ac.
++# Enabling extra-portability works.
++AUTOMAKE_fails -Wnone -Wextra-portability
++grep 'requires.*AM_PROG_AR' stderr
++# Disabling portability disables extra-portability.
++$AUTOMAKE -Wno-portability -Wall
++$AUTOMAKE -Wextra-portability -Wno-portability -Wall
+
-# Enabling extra-portability enables portability as well ...
-AUTOMAKE_fails -Wextra-portability
+ echo libfoo_a_CPPFLAGS = -Dwhatever >> Makefile.am
+
-# ... even if it had been previously disabled.
-AUTOMAKE_fails -Wno-portability -Wextra-portability
++# Enabling extra-portability enables portability.
++AUTOMAKE_fails -Wnone -Wextra-portability
++# The expected diagnostic is
++# Makefile.am:2: compiling `foo.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.in'
++# .../lib/am/library.am: `libfoo.a': linking libraries using a non-POSIX
++# .../lib/am/library.am: archiver requires `AM_PROG_AR' in `configure.in'
++# Makefile.am:1: while processing library `libfoo.a'
+ grep 'requires.*AM_PROG_CC_C_O' stderr
+ grep 'requires.*AM_PROG_AR' stderr
++
++# `-Wall' does not reset extra portability warnings to their
++# default (i.e., disabled).
++AUTOMAKE_fails -Wextra-portability -Wall
+ grep 'requires.*AM_PROG_CC_C_O' stderr
+ grep 'requires.*AM_PROG_AR' stderr
+
+ # Disabling extra-portability leaves portability intact.
+ AUTOMAKE_fails -Wportability -Wno-extra-portability
+ grep 'requires.*AM_PROG_CC_C_O' stderr
+ grep 'requires.*AM_PROG_AR' stderr && Exit 1
+
++# `-Wall' does not set extra portability warnings if they have
++# been previously disabled.
++AUTOMAKE_fails -Wno-extra-portability -Wall
++grep 'requires.*AM_PROG_CC_C_O' stderr
++grep 'requires.*AM_PROG_AR' stderr && Exit 1
++
+ # Enabling portability does not enable extra-portability.
+ AUTOMAKE_fails -Wnone -Wportability
+ grep 'requires.*AM_PROG_CC_C_O' stderr
+ grep 'requires.*AM_PROG_AR' stderr && Exit 1
+
+ # Disabling portability disables extra-portability.
+ $AUTOMAKE -Wno-portability
+ $AUTOMAKE -Wextra-portability -Wno-portability
+ $AUTOMAKE -Wall -Wno-portability
+
+ :
--- /dev/null
+ #! /bin/sh
+ # Copyright (C) 2011 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/>.
+
+ # Make sure that extra-portability warnings are not enabled by --gnits,
+ # --gnu and --foreign.
+
+ . ./defs || Exit 1
+
+ set -e
+
+ # Satisfy --gnits and --gnu.
+ : > INSTALL
+ : > NEWS
+ : > README
+ : > AUTHORS
+ : > ChangeLog
+ : > COPYING
+ : > THANKS
+
+ cat >>configure.in <<END
+ AC_PROG_CC
+ AC_PROG_RANLIB
+ AC_OUTPUT
+ END
+
+ cat >Makefile.am <<END
+ EXTRA_LIBRARIES = libfoo.a
+ libfoo_a_SOURCES = foo.c
+ END
+
+ $ACLOCAL
+
++# In the 1.11.x series, `extra-portability' warnings are not enabled
++# by `-Wall'.
++AUTOMAKE="$AUTOMAKE -Wextra-portability"
++
+ # Make sure the test is useful.
+ AUTOMAKE_fails
+
+ $AUTOMAKE --foreign
+ $AUTOMAKE --gnu
+ $AUTOMAKE --gnits
+
+ :
cat >> configure.in << 'END'
AC_PROG_CC
++AM_PROG_AR
AC_PROG_RANLIB
AC_SUBST([deps], [bardep])
AM_CONDITIONAL([COND], [test -n "$cond"])
cat >> configure.in << 'END'
AC_PROG_CC
++AM_PROG_AR
AC_PROG_LIBTOOL
AC_SUBST([deps], [bardep])
AC_OUTPUT
exsource.test \
ext.test \
ext2.test \
++extra-portability.test \
++extra-portability2.test \
++extra-portability3.test \
extra.test \
extra2.test \
extra3.test \