+2011-10-21 Peter Rosin <peda@lysator.liu.se>
+
+ warnings: new 'extra-portability' category, for AM_PROG_AR
+ * lib/Automake/ChannelDefs.pm: Register new extra-portability
+ warning channel.
+ (switch_warning): Turn off extra-portability if portability is
+ turned off, and turn on portability if extra-portability is
+ turned on.
+ (set_strictness): Silence extra-portability for --gnits, --gnu
+ and --foreign.
+ * tests/extra-portability2.test: New test, checking that the
+ extra-portability channel is silenced by --gnits, --gnu and
+ --foreign.
+ * doc/automake.texi (Invoking Automake): Document the new warning
+ category and its interaction with the portability category.
+ * tests/extra-portability.test: New test, checking the interaction
+ between the portability and extra-portability warning categories.
+ * automake.in (handle_libraries, handle_ltlibraries): Move the
+ AM_PROG_AR warnings to the new extra-portability channel.
+ * tests/ar2.test: Adjust to the new warning channel.
+ * tests/pr300-lib.test: Likewise.
+ * tests/pr300-ltlib.test: Likewise.
+ * tests/pr307.test: Likewise.
+ * tests/pr401.test: Likewise.
+ * tests/pr401b.test: Likewise.
+ * tests/pr401c.test: Likewise.
+ * tests/pr72.test: Likewise.
+ * NEWS: Likewise.
+ * tests/Makefile.am (TESTS): Update.
+
2011-10-21 Peter Rosin <peda@lysator.liu.se>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Stefano Lattarini <stefano.lattarini@gmail.com>
- New macro AM_PROG_AR that looks for an archiver and wraps it in the new
'ar-lib' auxiliary script if the found archiver is Microsoft lib. This
new macro is required for LIBRARIES and LTLIBRARIES when automake is
- run with -Wportability (or -Wall) and -Werror.
+ run with -Wextra-portability (or -Wall) and -Werror.
Bugs fixed in 1.11.0a:
if (! $seen_ar)
{
- msg ('portability', $where,
+ msg ('extra-portability', $where,
"`$onelib': linking libraries using a non-POSIX\n"
. "archiver requires `AM_PROG_AR' in `$configure_ac'")
}
if (! $seen_ar)
{
- msg ('portability', $where,
+ msg ('extra-portability', $where,
"`$onelib': linking libtool libraries using a non-POSIX\n"
. "archiver requires `AM_PROG_AR' in `$configure_ac'")
}
@item portability
portability issues (e.g., use of @command{make} features that are
known to be not portable)
+@item extra-portability
+extra portability issues related to obscure tools. One example of such
+a tool is the Microsoft @command{lib} archiver.
@item syntax
weird syntax, unused variables, typos
@item unsupported
On the other hand, the @option{silent-rules} options (@pxref{Options})
turns off portability warnings about recursive variable expansions.
+@c Checked by extra-portability.test
+Turning off @samp{portability} will also turn off @samp{extra-portability},
+and similarly turning on @samp{extra-portability} will also turn on
+@samp{portability}. However, turning on @samp{portability} or turning
+off @samp{extra-portability} will not affect the other category.
+
@vindex WARNINGS
The environment variable @env{WARNINGS} can contain a comma separated
list of categories to enable. It will be taken into account before the
@acindex AM_PROG_AR
@vindex AR
You must use this macro when you use the archiver in your project, if
-you want support for unusual archivers such as Microsoft lib. The
-content of the optional argument is executed if the archiver
+you want support for unusual archivers such as Microsoft @command{lib}.
+The content of the optional argument is executed if the archiver
interface is not recognized; the default action is to abort configure
with an error message.
Warnings about non-portable constructs.
+=item C<extra-portability>
+
+Extra warnings about non-portable constructs covering obscure tools.
+
=item C<syntax>
Warnings about weird syntax, unused variables, typos...
footer => "\nPlease contact <$PACKAGE_BUGREPORT>.",
uniq_part => UP_NONE, ordered => 0;
+register_channel 'extra-portability', type => 'warning', silent => 1;
register_channel 'gnu', type => 'warning';
register_channel 'obsolete', type => 'warning', silent => 1;
register_channel 'override', type => 'warning', silent => 1;
`obsolete' obsolete features or constructions
`override' user redefinitions of Automake rules or variables
`portability' portability issues (default in gnu and gnits modes)
+ `extra-portability' extra portability issues related to obscure tools
`syntax' dubious syntactic constructs (default)
`unsupported' unsupported or incomplete features (default)
`all' all the warnings
setup_channel $cat, silent => $has_no;
setup_channel 'portability-recursive', silent => $has_no
if $cat eq 'portability';
+ setup_channel 'extra-portability', silent => $has_no
+ if ($cat eq 'portability' && $has_no);
+ setup_channel 'portability', silent => $has_no
+ if ($cat eq 'extra-portability' && ! $has_no);
}
else
{
setup_channel 'error-gnu/warn', silent => 0, type => 'error';
setup_channel 'error-gnits', silent => 1;
setup_channel 'portability', silent => 0;
+ setup_channel 'extra-portability', silent => 1;
setup_channel 'gnu', silent => 0;
}
elsif ($name eq 'gnits')
setup_channel 'error-gnu/warn', silent => 0, type => 'error';
setup_channel 'error-gnits', silent => 0;
setup_channel 'portability', silent => 0;
+ setup_channel 'extra-portability', silent => 1;
setup_channel 'gnu', silent => 0;
}
elsif ($name eq 'foreign')
setup_channel 'error-gnu/warn', silent => 0, type => 'warning';
setup_channel 'error-gnits', silent => 1;
setup_channel 'portability', silent => 1;
+ setup_channel 'extra-portability', silent => 1;
setup_channel 'gnu', silent => 1;
}
else
extra10.test \
extra11.test \
extra12.test \
+extra-portability.test \
+extra-portability2.test \
f90only.test \
flavor.test \
flibs.test \
extra10.test \
extra11.test \
extra12.test \
+extra-portability.test \
+extra-portability2.test \
f90only.test \
flavor.test \
flibs.test \
END
$ACLOCAL
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
grep '^ARFLAGS =' Makefile.in
grep '^AR =' Makefile.in
--- /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/>.
+
+# Check interactions between the `portability' and `extra-portability'
+# warning categories:
+# 1. `-Wextra-portability' must imply `-Wportability'.
+# 2. `-Wno-portability' must imply `-Wno-extra-portability'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = sub/foo.c
+libfoo_a_CPPFLAGS = -Dwhatever
+END
+
+$ACLOCAL
+
+# 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
+
+# Disabling extra-portability leaves portability intact.
+AUTOMAKE_fails -Wno-extra-portability
+# The expected diagnostic is
+# Makefile.am:2: compiling `foo.c' with per-target flags requires `AM_PROG_CC_C_O' 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 && Exit 1
+
+# Enabling portability does not enable extra-portability.
+AUTOMAKE_fails -Wnone -Wportability
+# The expected diagnostic is
+# Makefile.am:2: compiling `foo.c' with per-target flags requires `AM_PROG_CC_C_O' 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 && Exit 1
+
+# Disabling portability disables extra-portability.
+$AUTOMAKE -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
+
+# Make sure the test is useful.
+AUTOMAKE_fails
+
+$AUTOMAKE --foreign
+$AUTOMAKE --gnu
+$AUTOMAKE --gnits
+
+:
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
./configure --prefix "`pwd`/inst"
libtoolize
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
./configure --prefix "`pwd`/inst"
libtoolize --force
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability -a
+$AUTOMAKE -Wno-extra-portability -a
# Sanity check: make sure the variable we are attempting to force
# is used by configure
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
$MAKE distcheck
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
test ! -d lib/lib
$MAKE distcheck
mv -f src/Makefile.am src/t
sed 's/LDADD = .*/LDADD = @LIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails -Wno-portability
+AUTOMAKE_fails -Wno-extra-portability
grep 'cannot be used outside.*lib' stderr
mv -f src/t src/Makefile.am
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
./configure
test ! -d src/lib
test ! -d 'src/$(top_builddir)'
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
$MAKE distcheck
libtoolize
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability -a
+$AUTOMAKE -Wno-extra-portability -a
./configure
$MAKE distcheck
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability -a
+$AUTOMAKE -Wno-extra-portability -a
./configure
test ! -d lib/lib
$MAKE distcheck
mv -f src/Makefile.am src/t
sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails -Wno-portability
+AUTOMAKE_fails -Wno-extra-portability
grep 'cannot be used outside.*lib' stderr
mv -f src/t src/Makefile.am
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
./configure
test ! -d src/lib
test ! -d 'src/$(top_builddir)'
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
$MAKE distcheck
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
$MAKE distcheck
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
test ! -d lib/lib
$MAKE distcheck
mv -f src/Makefile.am src/t
sed 's/LDADD = .*/LDADD = @ALLOCA@/' src/t > src/Makefile.am
-AUTOMAKE_fails -Wno-portability
+AUTOMAKE_fails -Wno-extra-portability
grep 'cannot be used outside.*lib' stderr
mv -f src/t src/Makefile.am
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
./configure
$MAKE
test ! -d src/lib
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
$MAKE distcheck
: > config.sub
$ACLOCAL
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
grep '^LINK =' Makefile.in