Package: automake;
Reported by: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Wed, 15 Dec 2010 11:23:01 UTC
Severity: normal
Tags: patch
Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7647 in the body.
You can then email your comments to 7647 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
owner <at> debbugs.gnu.org, bug-automake <at> gnu.org
:bug#7647
; Package automake
.
(Wed, 15 Dec 2010 11:23:02 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
:bug-automake <at> gnu.org
.
(Wed, 15 Dec 2010 11:23:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: automake <at> gnu.org Cc: bug-automake <at> gnu.org, Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>, Eric Blake <eblake <at> redhat.com> Subject: Diagnose invalid primary/directory combinations (was: Re: configmake module and automake 1.9.6) Date: Wed, 15 Dec 2010 12:27:43 +0100
Hi Eric. On Tuesday 14 December 2010, Eric Blake wrote: > [dropping gnulib for this reply] > > On 12/14/2010 02:54 PM, Eric Blake wrote: > >>> # Listed in the same order as the GNU makefile conventions. > >>> # The Automake-defined pkg* macros are appended, in the order > >>> # listed in the Automake 1.10a+ documentation. > >>> +# Support newer definitions even when using older automake 1.9.6 > >> > >> The Automake version is probably irrelevant here. It's the Autoconf > >> version that matters. > > > > Oh; it's a mix of both autoconf and automake macros (autoconf AC_SUBST's > > localedir, but only automake 1.11 AC_SUBST's pkglibexecdir); the comment > > in modules/configmake only mentioned automake, but both tools have a > > hand in feeding configmake.h. > > In fact, I think automake has a minor bug. automake.in lists the > following directories: > > my %standard_prefix = > map { $_ => 1 } (qw(bin data dataroot dvi exec html include info > lib libexec lisp localstate man man1 man2 man3 > man4 man5 man6 man7 man8 man9 oldinclude pdf > pkgdatadir pkgincludedir pkglibdir pkglibexecdir > ps sbin sharedstate sysconf)); > > That list is missing 'doc' and 'locale'. > If you are referring to this issue: <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00080.html> then I don't think this automake bug (or limitation) is relevant. The list in `%standard_prefix' is used only for diagnosing invalid primary/directory combinations, such as `data_PROGRAMS' or 'lib_HEADERS'. For more info, see test `dirforbid.test', PR/294 at <http://sources.redhat.com/cgi-bin/gnatsweb.pl?database=automake>, and commit e87d851a863a7c321af8bc7b2b36aff5e072ff94 (05/03/2002). That said, you might have uncovered a bug in automake, because something like: doc_LIBRARIES = libfoo.a should warn IMHO, but it currently doesn't. Ralf, what do you think? If you agree with me, I'll attempt a patch (and a testsuite enhancement). Regards, Stefano
owner <at> debbugs.gnu.org, bug-automake <at> gnu.org
:bug#7647
; Package automake
.
(Wed, 15 Dec 2010 18:25:03 GMT) Full text and rfc822 format available.Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: bug-automake <at> gnu.org, Eric Blake <eblake <at> redhat.com> Subject: Re: Diagnose invalid primary/directory combinations Date: Wed, 15 Dec 2010 19:26:12 +0100
Hello, and dropping automake@, * Stefano Lattarini wrote on Wed, Dec 15, 2010 at 12:27:43PM CET: > The list in `%standard_prefix' is used only for diagnosing invalid > primary/directory combinations, such as `data_PROGRAMS' or > 'lib_HEADERS'. For more info, see test `dirforbid.test', PR/294 at > <http://sources.redhat.com/cgi-bin/gnatsweb.pl?database=automake>, > and commit e87d851a863a7c321af8bc7b2b36aff5e072ff94 (05/03/2002). > > That said, you might have uncovered a bug in automake, because > something like: > doc_LIBRARIES = libfoo.a > should warn IMHO, but it currently doesn't. Agreed. Extending dirforbid.test and fixing fallout would be good. Thanks, Ralf
owner <at> debbugs.gnu.org, bug-automake <at> gnu.org
:bug#7647
; Package automake
.
(Fri, 17 Dec 2010 14:54:02 GMT) Full text and rfc822 format available.Message #11 received at 7647 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: 7647 <at> debbugs.gnu.org, automake-patches <at> gnu.org Cc: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>, Eric Blake <eblake <at> redhat.com> Subject: Re: bug#7647: Diagnose invalid primary/directory combinations Date: Fri, 17 Dec 2010 15:59:10 +0100
[Message part 1 (text/plain, inline)]
On Wednesday 15 December 2010, Ralf Wildenhues wrote: > Hello, and dropping automake@, > > * Stefano Lattarini wrote on Wed, Dec 15, 2010 at 12:27:43PM CET: > > The list in `%standard_prefix' is used only for diagnosing invalid > > primary/directory combinations, such as `data_PROGRAMS' or > > 'lib_HEADERS'. For more info, see test `dirforbid.test', PR/294 at > > <http://sources.redhat.com/cgi-bin/gnatsweb.pl?database=automake>, > > and commit e87d851a863a7c321af8bc7b2b36aff5e072ff94 (05/03/2002). > > > > That said, you might have uncovered a bug in automake, because > > something like: > > doc_LIBRARIES = libfoo.a > > should warn IMHO, but it currently doesn't. > > Agreed. Extending dirforbid.test and fixing fallout would be good. > I've also throw in a couple of related fixings and improvements, and (as you might have guessed I'd do ;-) greatly extended the relevant tests. Attached is what I'd like to push; it's based off of maint, but I'd like to push it to master only, as it might cause some backwards incompatibilities (IMHO very minor, but better play safe here). OK to apply? Regards, Stefano
[0001-Warnings-about-primary-prefix-mismatch-fixed-and-ext.patch (text/x-patch, inline)]
From 5d284ed4fccb649b3e968aa2700891afab001029 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattarini <at> gmail.com> Date: Thu, 16 Dec 2010 19:23:06 +0100 Subject: [PATCH] Warnings about primary/prefix mismatch fixed and extended. * automake.in (%standard_prefix): Add `doc' and `locale'. Rename `pkgdatadir' to `pkgdata'. Similarly for`pkglibdir', `pkgincludedir' and `pkglibexecdir'. (handle_programs): List `pkglibexec', not `pkglib', among the prefixes valid for the `PROGRAMS' primary. (handle_data): List also `doc' among the prefixes valid for the `DATA' primary. This is required by automake's own build system. * tests/dirforbid.test: Test removed, superseded by ... * tests/primary-prefix-invalid-couples.test: ... this new test. * tests/primary-prefix-valid-couples.test: New test. * tests/primary-prefix-documented-valid.test: Likewise. * tests/primary-prefix-force-valid.test: Likewise. * tests/java3.test: Adjusted, and extended a bit. * tests/Makefile.am (TESTS): Updated. * NEWS: Updated. From a report by Eric Blake. --- ChangeLog | 21 +++ NEWS | 3 + automake.in | 16 +- tests/Makefile.am | 5 +- tests/Makefile.in | 5 +- tests/dirforbid.test | 38 ----- tests/java3.test | 14 ++- tests/primary-prefix-couples-documented-valid.test | 83 ++++++++++++ tests/primary-prefix-couples-force-valid.test | 87 ++++++++++++ tests/primary-prefix-invalid-couples.test | 142 ++++++++++++++++++++ tests/primary-prefix-valid-couples.test | 90 ++++++++++++ 11 files changed, 453 insertions(+), 51 deletions(-) delete mode 100755 tests/dirforbid.test create mode 100755 tests/primary-prefix-couples-documented-valid.test create mode 100755 tests/primary-prefix-couples-force-valid.test create mode 100755 tests/primary-prefix-invalid-couples.test create mode 100755 tests/primary-prefix-valid-couples.test diff --git a/ChangeLog b/ChangeLog index 2482ef1..a67b1d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2010-12-17 Stefano Lattarini <stefano.lattarini <at> gmail.com> + + Warnings about primary/prefix mismatch fixed and extended. + * automake.in (%standard_prefix): Add `doc' and `locale'. + Rename `pkgdatadir' to `pkgdata'. Similarly for`pkglibdir', + `pkgincludedir' and `pkglibexecdir'. + (handle_programs): List `pkglibexec', not `pkglib', among the + prefixes valid for the `PROGRAMS' primary. + (handle_data): List also `doc' among the prefixes valid for + the `DATA' primary. This is required by automake's own build + system. + * tests/dirforbid.test: Test removed, superseded by ... + * tests/primary-prefix-invalid-couples.test: ... this new test. + * tests/primary-prefix-valid-couples.test: New test. + * tests/primary-prefix-couples-documented-valid.test: Likewise. + * tests/primary-prefix-couples-force-valid.test: Likewise. + * tests/java3.test: Adjusted, and extended a bit. + * tests/Makefile.am (TESTS): Updated. + * NEWS: Updated. + From a report by Eric Blake. + 2010-12-14 Stefano Lattarini <stefano.lattarini <at> gmail.com> Improve tests on generated portions of configure help screen. diff --git a/NEWS b/NEWS index 6bc0d6f..2f98f90 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ Bugs fixed in 1.11.0a: * Long standing bugs: + - Automake now warns about more primary/directory invalid combinations, + such as "doc_LIBRARIES" or "pkglib_PROGRAMS". + - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python' even if the `--prefix' argument pointed outside of a system directory. AM_PATH_PYTHON has been fixed to ignore the value returned from python's diff --git a/automake.in b/automake.in index 8f3edde..c3bcfd5 100755 --- a/automake.in +++ b/automake.in @@ -249,11 +249,11 @@ my @common_sometimes = # Standard directories from the GNU Coding Standards, and additional # pkg* directories from Automake. Stored in a hash for fast member check. my %standard_prefix = - map { $_ => 1 } (qw(bin data dataroot dvi exec html include info - lib libexec lisp localstate man man1 man2 man3 - man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdatadir pkgincludedir pkglibdir pkglibexecdir - ps sbin sharedstate sysconf)); + map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info + lib libexec lisp locale localstate man man1 man2 + man3 man4 man5 man6 man7 man8 man9 oldinclude pdf + pkgdata pkginclude pkglib pkglibexec ps sbin + sharedstate sysconf)); # Copyright on generated Makefile.ins. my $gen_copyright = "\ @@ -2616,7 +2616,7 @@ sub handle_libtool sub handle_programs { my @proglist = &am_install_var ('progs', 'PROGRAMS', - 'bin', 'sbin', 'libexec', 'pkglib', + 'bin', 'sbin', 'libexec', 'pkglibexec', 'noinst', 'check'); return if ! @proglist; @@ -3726,8 +3726,8 @@ sub handle_man_pages sub handle_data { &am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'dvi', 'html', 'pdf', 'ps', - 'sysconf', 'sharedstate', 'localstate', + 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf', + 'ps', 'sysconf', 'sharedstate', 'localstate', 'pkgdata', 'lisp', 'noinst', 'check'); } diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e3..5940ffe 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -270,7 +270,6 @@ depend4.test \ depend5.test \ depend6.test \ destdir.test \ -dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ @@ -598,6 +597,10 @@ prefix.test \ primary.test \ primary2.test \ primary3.test \ +primary-prefix-invalid-couples.test \ +primary-prefix-valid-couples.test \ +primary-prefix-couples-force-valid.test \ +primary-prefix-couples-documented-valid.test \ proginst.test \ python.test \ python2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f43..f70aee1 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -537,7 +537,6 @@ depend4.test \ depend5.test \ depend6.test \ destdir.test \ -dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ @@ -865,6 +864,10 @@ prefix.test \ primary.test \ primary2.test \ primary3.test \ +primary-prefix-invalid-couples.test \ +primary-prefix-valid-couples.test \ +primary-prefix-couples-force-valid.test \ +primary-prefix-couples-documented-valid.test \ proginst.test \ python.test \ python2.test \ diff --git a/tests/dirforbid.test b/tests/dirforbid.test deleted file mode 100755 index 3ab319d..0000000 --- a/tests/dirforbid.test +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# Copyright (C) 2002, 2003 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/>. - -# All primaries cannot be used with all directories. -# Automake should flag them as errors. -# For PR/294 - -. ./defs || Exit 1 - -set -e - -cat >> configure.in <<'END' -AC_PROG_CC -END - -# Try some (not all) disallowed variables -for i in data_PROGRAMS lib_HEADERS ; do - cat > Makefile.am << END -$i = foo -END - $ACLOCAL - AUTOMAKE_fails -a - grep 'Makefile.am:1:.*directory' stderr -done -: diff --git a/tests/java3.test b/tests/java3.test index 7895769..41dbb71 100755 --- a/tests/java3.test +++ b/tests/java3.test @@ -23,7 +23,7 @@ set -e cat >> configure.in << 'END' -AM_CONDITIONAL([WHO_CARES], false) +AM_CONDITIONAL([WHO_CARES], [false]) AC_OUTPUT END @@ -32,7 +32,7 @@ if WHO_CARES JAVA_FILES = MyClass1.java endif -dist_pkgdata_JAVA = $(JAVA_FILES) +dist_java_JAVA = $(JAVA_FILES) END : >MyClass1.java @@ -40,5 +40,13 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -./configure + +cwd=`pwd` || Exit 1 +./configure --prefix="$cwd/_inst" +$MAKE install +test ! -d _inst +test ! -r _inst +$MAKE uninstall $MAKE distcheck + +: diff --git a/tests/primary-prefix-couples-documented-valid.test b/tests/primary-prefix-couples-documented-valid.test new file mode 100755 index 0000000..893704f --- /dev/null +++ b/tests/primary-prefix-couples-documented-valid.test @@ -0,0 +1,83 @@ +#! /bin/sh +# Copyright (C) 2010 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 that the "uncommon" prefix/primary combinations used in +# examples in the Automake manual do not cause obvious errors. +# Please keep this test in sync with the automake manual. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_CC +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +END + +# Fake libtool availability. +: > ltmain.sh +cat > acinclude.m4 <<'END' +AC_DEFUN([AC_PROG_LIBTOOL], + [AC_SUBST([LIBTOOL], [:])]) +END + +cat > Makefile.am <<'END' +xmldir = $(datadir)/xml +xml_DATA = file.xml + +data_DATA = file1 file2 file3 +data2dir = $(datadir) +data2_DATA = file4 file5 file6 + +aclocaldir = $(datadir)/aclocal +aclocal_DATA = mymacro.m4 myothermacro.m4 + +imagesdir = $(pkgdatadir)/images +soundsdir = $(pkgdatadir)/sounds +dist_images_DATA = images/vortex.pgm +dist_sounds_DATA = sounds/whirl.ogg + +lisp_DATA = file1.el file2.el + +javadir = $(datadir)/java +dist_java_JAVA = a.java b.java c.java + +pkgpython_PYTHON = foo.py + +pyexec_LTLIBRARIES = quaternion.la +quaternion_la_SOURCES = quaternion.c support.c support.h +quaternion_la_LDFLAGS = -avoid-version -module + +myexecbindir = /exec +myexecbin_PROGRAMS = foo + +foodir = $(prefix)/foo +barexecdir = $(prefix)/bar/binaries +foo_SCRIPTS = foo.sh +barexec_SCRIPTS = quux.pl +END + +$ACLOCAL + +# Both these two invocations are meant. +# They exercise both code paths concerning auxiliary files. +$AUTOMAKE -a +$AUTOMAKE + +: diff --git a/tests/primary-prefix-couples-force-valid.test b/tests/primary-prefix-couples-force-valid.test new file mode 100755 index 0000000..02728b9 --- /dev/null +++ b/tests/primary-prefix-couples-force-valid.test @@ -0,0 +1,87 @@ +#! /bin/sh +# Copyright (C) 2010 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 that a user who wants to use an invalid prefix/primary +# combination can do so with a proper workaround. +# For example, this: +# lib_PROGRAMS = foo +# is expected to cause an automake error, but this: +# bardir = $(libdir) +# bar_PROGRAMS = foo +# should work. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_OUTPUT +END + +cat > Makefile.am <<'END' +my_libdir = $(libdir) +my_lib_PROGRAMS = foo + +foodir = $(bindir) +foo_LIBRARIES = libquux.a + +xdir = $(libexecdir) +x_HEADERS = bar.h + +installcheck-local: test +.PHONY: test +test: + (cd '$(prefix)' && find .);: for debugging + ls -l '$(libdir)/foo' + test -f '$(libdir)/foo' + test -x '$(libdir)/foo' + ls -l '$(bindir)/libquux.a' + test -f '$(bindir)/libquux.a' + ls -l '$(libexecdir)/bar.h' + test -f '$(libexecdir)/bar.h' + test ! -x '$(libexecdir)/bar.h' +END + +cat > foo.c <<'END' +int main (void) +{ + return 0; +} +END + +cat > libquux.c <<'END' +int quux(void) +{ + return 1; +} +END + +: > bar.h + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +cwd=`pwd` || Exit 1 +./configure --prefix="$cwd/_inst" + +$MAKE install +$MAKE installcheck +$MAKE distcheck + +: diff --git a/tests/primary-prefix-invalid-couples.test b/tests/primary-prefix-invalid-couples.test new file mode 100755 index 0000000..1a3d4e0 --- /dev/null +++ b/tests/primary-prefix-invalid-couples.test @@ -0,0 +1,142 @@ +#! /bin/sh +# Copyright (C) 2010 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/>. + +# Not all primaries/directories combinations are valid. +# Automake should flag them as errors. +# Originated from PR/294, extended later (following bug #7647) to +# cover more cases. +# See also test `primary-prefix-valid-couples.test'. + +. ./defs || Exit 1 + +set -e + +oIFS=$IFS # saved for later + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +AM_PATH_LISPDIR +END + +$ACLOCAL + +# Please keep this list in sync with the list of "Directory Variables" +# in the GNU Coding Standards and with the list additional directory +# variables provided by autoconf and/or automake (pkgdatadir, pkglibdir, +# ...). See also the hash `%standard_prefix' in the automake script. +prefixes='bin data dataroot doc dvi exec html include info lib libexec + lisp locale localstate man man1 man2 man3 man4 man5 man6 man7 + man8 man9 oldinclude pdf pkgdata pkginclude pkglib pkglibexec + ps sbin sharedstate sysconf' +# Please keep this list in sync with the list of primaries documented in +# the Automake manual (see the "The Uniform Naming Scheme" section). +primaries='PROGRAMS LIBRARIES LTLIBRARIES LISP PYTHON JAVA SCRIPTS DATA + HEADERS MANS TEXINFOS' + +# Use files, not variables, to hold the list of all the possible +# prefix_PRIMARY couples and the list of those couples valid for +# automake, to avoid having unreadable very verbose traces. + +set +x # don't be overly verbose + +for prefix in $prefixes; do + for primary in $primaries; do + echo ${prefix}_${primary} + done +done >all.list + +for primary in $primaries; do + prefixes_ok='' + case $primary in + LIBRARIES|LTLIBRARIES) + prefixes_ok='lib pkglib' + ;; + PROGRAMS) + prefixes_ok='bin sbin libexec pkglibexec' + ;; + SCRIPTS) + prefixes_ok='bin sbin libexec pkgdata' + ;; + DATA) + prefixes_ok='data dataroot pkgdata doc html dvi pdf ps + sysconf sharedstate localstate lisp' + ;; + HEADERS) + prefixes_ok='include oldinclude pkginclude' + ;; + LISP) + prefixes_ok='lisp' + ;; + PYTHON) + prefixes_ok='python' + ;; + JAVA) + prefixes_ok='java' + ;; + MANS) + # FIXME: Here we'd like to have: + # prefixes_ok='man man1 man2 man3 man4 man5 man6 man7 man8 man9' + # but Automake currently fails on that, as it allows the MANS + # primary to be coupled to any prefix. + # See also Automake bug#7656. + # We should dig out how automake had come to behave this way, and + # if such a behaviour can be safely changed. + prefixes_ok=$prefixes + ;; + TEXINFOS) + # FIXME: Here we'd like to have: + # prefixes_ok='info' + # but Automake currently fails on that, as it allows the TEXINFOS + # primary to be coupled to any prefix. + # See also Automake bug#7657. + # We should dig out how automake had come to behave this way, and + # if such a behaviour can be safely changed. + prefixes_ok=$prefixes + ;; + *) + echo "$me: internal error: unrecognized primary '$primary'" >&2 + Exit 99 + ;; + esac + for prefix in $prefixes_ok; do + echo ${prefix}_${primary} + done +done >allow.list + +set -x + +cat all.list +cat allow.list + +while read x; do + grep "^$x$" allow.list >/dev/null && continue + # To get the expected error message more in detail. + IFS=_; set $x; IFS=$oIFS + test $# -eq 2 || Exit 99 # sanity check + prefix=$1 + primary=$2 + errmsg_rx=".*${prefix}dir.* not a legitimate directory .*$primary" + # Now do the test for this prefix/primary combination. + echo "$x = foo" > Makefile.am + AUTOMAKE_fails -a + grep "^Makefile\\.am:1:$errmsg_rx" stderr +done <all.list + +: diff --git a/tests/primary-prefix-valid-couples.test b/tests/primary-prefix-valid-couples.test new file mode 100755 index 0000000..8acb32e --- /dev/null +++ b/tests/primary-prefix-valid-couples.test @@ -0,0 +1,90 @@ +#! /bin/sh +# Copyright (C) 2010 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 for valid prefix/primary combinations. +# See also test `primary-prefix-invalid-couples.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +AM_PATH_LISPDIR +END + +# Fake libtool availability. +: > ltmain.sh +: > config.sub +: > config.guess +cat > acinclude.m4 <<'END' +AC_DEFUN([AC_PROG_LIBTOOL], + [AC_SUBST([LIBTOOL], [:])]) +END + +# Other required files. +echo '@setfilename foo' > foo.texi +: > texinfo.tex +: > py-compile +: > elisp-comp + +# Setup Makefile.am. + +: > Makefile.am + +for p in bin sbin libexec pkglibexec; do + echo "${p}_PROGRAMS = prog-$p" >> Makefile.am +done + +for p in lib pkglib; do + echo "${p}_LIBRARIES = libs-$p.a" >> Makefile.am + echo "${p}_LTLIBRARIES = libd-$p.la" >> Makefile.am +done + +for p in bin sbin libexec pkgdata; do + echo "${p}_SCRIPTS = $p.sh" >> Makefile.am +done + +for p in data dataroot pkgdata doc html dvi pdf ps sysconf \ + sharedstate localstate lisp; do + echo "${p}_DATA = $p.dat" >> Makefile.am +done + +for p in include oldinclude pkginclude; do + echo "${p}_HEADERS = $p.h" >> Makefile.am +done + +for p in man man1 man2 man3 man4 man5 man6 man7 man8 man9; do + echo "${p}_MANS = bar.$p" +done + +echo "info_TEXINFOS = foo.texi" >> Makefile.am +echo "lisp_LISP = foo.el" >> Makefile.am +echo "python_PYTHON = foo.py" >> Makefile.am +echo "java_JAVA = foo.java" >> Makefile.am + +awk '{print NR ":" $0}' Makefile.am # for debugging + +# Go with the tests. + +$ACLOCAL +$AUTOMAKE + +: -- 1.7.1
Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Tue, 21 Dec 2010 13:43:02 GMT) Full text and rfc822 format available.owner <at> debbugs.gnu.org, bug-automake <at> gnu.org
:bug#7647
; Package automake
.
(Mon, 03 Jan 2011 14:26:02 GMT) Full text and rfc822 format available.Message #16 received at 7647 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: 7647 <at> debbugs.gnu.org Cc: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>, Eric Blake <eblake <at> redhat.com>, automake-patches <at> gnu.org Subject: [PATCH] {maint} Warnings about primary/prefix mismatch fixed and extended. (was: Re: bug#7647: Diagnose invalid primary/directory combinations) Date: Mon, 3 Jan 2011 15:32:00 +0100
[Message part 1 (text/plain, inline)]
References: <http://lists.gnu.org/archive/html/automake-patches/2010-12/msg00106.html> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7647> -*-*- Hello automakers. I've rebased the patch on latest maint, removed trailing whitespaces, fixed the copyright years, and extended the new testcase `primary-prefix-documented-valid.test' to cover the new examples added in the manual with commit `v1.11-261-gd5a408d' -- reference: <http://lists.gnu.org/archive/html/automake-patches/2011-01/msg00008.html> Below is what I've squashed into the rebased patch; the whole amended patch is attached. OK for maint? Regards, Stefano -*-*- diff --git a/ChangeLog b/ChangeLog index 08403ef..625d580 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2010-12-17 Stefano Lattarini <stefano.lattarini <at> gmail.com> +2011-01-03 Stefano Lattarini <stefano.lattarini <at> gmail.com> Warnings about primary/prefix mismatch fixed and extended. * automake.in (%standard_prefix): Add `doc' and `locale'. diff --git a/tests/primary-prefix-couples-documented-valid.test b/tests/primary-prefix-couples-documented-valid.test index 893704f..5bc851c 100755 --- a/tests/primary-prefix-couples-documented-valid.test +++ b/tests/primary-prefix-couples-documented-valid.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2010 Free Software Foundation, Inc. +# 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 @@ -25,6 +25,7 @@ set -e cat >> configure.in <<'END' AC_PROG_CC AC_PROG_CC +AC_PROG_RANLIB AC_PROG_LIBTOOL AM_PROG_GCJ AM_PATH_PYTHON @@ -65,12 +65,17 @@ quaternion_la_SOURCES = quaternion.c support.c support.h quaternion_la_LDFLAGS = -avoid-version -module myexecbindir = /exec -myexecbin_PROGRAMS = foo +myexecbin_PROGRAMS = zardoz foodir = $(prefix)/foo barexecdir = $(prefix)/bar/binaries foo_SCRIPTS = foo.sh barexec_SCRIPTS = quux.pl + +my_execbindir = $(pkglibdir) +my_doclibdir = $(docdir) +my_execbin_PROGRAMS = foo +my_doclib_LIBRARIES = libquux.a END $ACLOCAL diff --git a/tests/primary-prefix-couples-force-valid.test b/tests/primary-prefix-couples-force-valid.test index 02728b9..159f297 100755 --- a/tests/primary-prefix-couples-force-valid.test +++ b/tests/primary-prefix-couples-force-valid.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2010 Free Software Foundation, Inc. +# 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 diff --git a/tests/primary-prefix-invalid-couples.test b/tests/primary-prefix-invalid-couples.test index 1a3d4e0..bd7a346 100755 --- a/tests/primary-prefix-invalid-couples.test +++ b/tests/primary-prefix-invalid-couples.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2010 Free Software Foundation, Inc. +# 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 diff --git a/tests/primary-prefix-valid-couples.test b/tests/primary-prefix-valid-couples.test index 8acb32e..b6b53dc 100755 --- a/tests/primary-prefix-valid-couples.test +++ b/tests/primary-prefix-valid-couples.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2010 Free Software Foundation, Inc. +# 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 @@ -50,8 +50,8 @@ echo '@setfilename foo' > foo.texi : > Makefile.am for p in bin sbin libexec pkglibexec; do - echo "${p}_PROGRAMS = prog-$p" >> Makefile.am -done + echo "${p}_PROGRAMS = prog-$p" >> Makefile.am +done for p in lib pkglib; do echo "${p}_LIBRARIES = libs-$p.a" >> Makefile.am @@ -74,7 +74,7 @@ done for p in man man1 man2 man3 man4 man5 man6 man7 man8 man9; do echo "${p}_MANS = bar.$p" done - + echo "info_TEXINFOS = foo.texi" >> Makefile.am echo "lisp_LISP = foo.el" >> Makefile.am echo "python_PYTHON = foo.py" >> Makefile.am
[0001-Warnings-about-primary-prefix-mismatch-fixed-and-ext.patch (text/x-patch, inline)]
From 5ef86e55c8a500798b86d536f9daf8aeaef540b3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattarini <at> gmail.com> Date: Thu, 16 Dec 2010 19:23:06 +0100 Subject: [PATCH] Warnings about primary/prefix mismatch fixed and extended. * automake.in (%standard_prefix): Add `doc' and `locale'. Rename `pkgdatadir' to `pkgdata'. Similarly for`pkglibdir', `pkgincludedir' and `pkglibexecdir'. (handle_programs): List `pkglibexec', not `pkglib', among the prefixes valid for the `PROGRAMS' primary. (handle_data): List also `doc' among the prefixes valid for the `DATA' primary. This is required by automake's own build system. * tests/dirforbid.test: Test removed, superseded by ... * tests/primary-prefix-invalid-couples.test: ... this new test. * tests/primary-prefix-valid-couples.test: New test. * tests/primary-prefix-documented-valid.test: Likewise. * tests/primary-prefix-force-valid.test: Likewise. * tests/java3.test: Adjusted, and extended a bit. * tests/Makefile.am (TESTS): Updated. * NEWS: Updated. From a report by Eric Blake. --- ChangeLog | 21 +++ NEWS | 3 + automake.in | 16 +- tests/Makefile.am | 5 +- tests/Makefile.in | 5 +- tests/dirforbid.test | 38 ----- tests/java3.test | 14 ++- tests/primary-prefix-couples-documented-valid.test | 89 ++++++++++++ tests/primary-prefix-couples-force-valid.test | 87 ++++++++++++ tests/primary-prefix-invalid-couples.test | 142 ++++++++++++++++++++ tests/primary-prefix-valid-couples.test | 90 ++++++++++++ 11 files changed, 459 insertions(+), 51 deletions(-) delete mode 100755 tests/dirforbid.test create mode 100755 tests/primary-prefix-couples-documented-valid.test create mode 100755 tests/primary-prefix-couples-force-valid.test create mode 100755 tests/primary-prefix-invalid-couples.test create mode 100755 tests/primary-prefix-valid-couples.test diff --git a/ChangeLog b/ChangeLog index bf44677..625d580 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2011-01-03 Stefano Lattarini <stefano.lattarini <at> gmail.com> + + Warnings about primary/prefix mismatch fixed and extended. + * automake.in (%standard_prefix): Add `doc' and `locale'. + Rename `pkgdatadir' to `pkgdata'. Similarly for`pkglibdir', + `pkgincludedir' and `pkglibexecdir'. + (handle_programs): List `pkglibexec', not `pkglib', among the + prefixes valid for the `PROGRAMS' primary. + (handle_data): List also `doc' among the prefixes valid for + the `DATA' primary. This is required by automake's own build + system. + * tests/dirforbid.test: Test removed, superseded by ... + * tests/primary-prefix-invalid-couples.test: ... this new test. + * tests/primary-prefix-valid-couples.test: New test. + * tests/primary-prefix-couples-documented-valid.test: Likewise. + * tests/primary-prefix-couples-force-valid.test: Likewise. + * tests/java3.test: Adjusted, and extended a bit. + * tests/Makefile.am (TESTS): Updated. + * NEWS: Updated. + From a report by Eric Blake. + 2011-01-02 Stefano Lattarini <stefano.lattarini <at> gmail.com> * NEWS: Fix typo (forgotten word). diff --git a/NEWS b/NEWS index eb31266..b147e48 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ Bugs fixed in 1.11.0a: * Long standing bugs: + - Automake now warns about more primary/directory invalid combinations, + such as "doc_LIBRARIES" or "pkglib_PROGRAMS". + - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python' even if the `--prefix' argument pointed outside of a system directory. AM_PATH_PYTHON has been fixed to ignore the value returned from python's diff --git a/automake.in b/automake.in index fa110a5..9879b93 100755 --- a/automake.in +++ b/automake.in @@ -249,11 +249,11 @@ my @common_sometimes = # Standard directories from the GNU Coding Standards, and additional # pkg* directories from Automake. Stored in a hash for fast member check. my %standard_prefix = - map { $_ => 1 } (qw(bin data dataroot dvi exec html include info - lib libexec lisp localstate man man1 man2 man3 - man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdatadir pkgincludedir pkglibdir pkglibexecdir - ps sbin sharedstate sysconf)); + map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info + lib libexec lisp locale localstate man man1 man2 + man3 man4 man5 man6 man7 man8 man9 oldinclude pdf + pkgdata pkginclude pkglib pkglibexec ps sbin + sharedstate sysconf)); # Copyright on generated Makefile.ins. my $gen_copyright = "\ @@ -2626,7 +2626,7 @@ sub handle_libtool sub handle_programs { my @proglist = &am_install_var ('progs', 'PROGRAMS', - 'bin', 'sbin', 'libexec', 'pkglib', + 'bin', 'sbin', 'libexec', 'pkglibexec', 'noinst', 'check'); return if ! @proglist; @@ -3736,8 +3736,8 @@ sub handle_man_pages sub handle_data { &am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'dvi', 'html', 'pdf', 'ps', - 'sysconf', 'sharedstate', 'localstate', + 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf', + 'ps', 'sysconf', 'sharedstate', 'localstate', 'pkgdata', 'lisp', 'noinst', 'check'); } diff --git a/tests/Makefile.am b/tests/Makefile.am index 8842be3..00f8c9f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -272,7 +272,6 @@ depend4.test \ depend5.test \ depend6.test \ destdir.test \ -dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ @@ -600,6 +599,10 @@ prefix.test \ primary.test \ primary2.test \ primary3.test \ +primary-prefix-invalid-couples.test \ +primary-prefix-valid-couples.test \ +primary-prefix-couples-force-valid.test \ +primary-prefix-couples-documented-valid.test \ proginst.test \ python.test \ python2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3bc4415..d6302b4 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -539,7 +539,6 @@ depend4.test \ depend5.test \ depend6.test \ destdir.test \ -dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ @@ -867,6 +866,10 @@ prefix.test \ primary.test \ primary2.test \ primary3.test \ +primary-prefix-invalid-couples.test \ +primary-prefix-valid-couples.test \ +primary-prefix-couples-force-valid.test \ +primary-prefix-couples-documented-valid.test \ proginst.test \ python.test \ python2.test \ diff --git a/tests/dirforbid.test b/tests/dirforbid.test deleted file mode 100755 index 3ab319d..0000000 --- a/tests/dirforbid.test +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# Copyright (C) 2002, 2003 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/>. - -# All primaries cannot be used with all directories. -# Automake should flag them as errors. -# For PR/294 - -. ./defs || Exit 1 - -set -e - -cat >> configure.in <<'END' -AC_PROG_CC -END - -# Try some (not all) disallowed variables -for i in data_PROGRAMS lib_HEADERS ; do - cat > Makefile.am << END -$i = foo -END - $ACLOCAL - AUTOMAKE_fails -a - grep 'Makefile.am:1:.*directory' stderr -done -: diff --git a/tests/java3.test b/tests/java3.test index 7895769..41dbb71 100755 --- a/tests/java3.test +++ b/tests/java3.test @@ -23,7 +23,7 @@ set -e cat >> configure.in << 'END' -AM_CONDITIONAL([WHO_CARES], false) +AM_CONDITIONAL([WHO_CARES], [false]) AC_OUTPUT END @@ -32,7 +32,7 @@ if WHO_CARES JAVA_FILES = MyClass1.java endif -dist_pkgdata_JAVA = $(JAVA_FILES) +dist_java_JAVA = $(JAVA_FILES) END : >MyClass1.java @@ -40,5 +40,13 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -./configure + +cwd=`pwd` || Exit 1 +./configure --prefix="$cwd/_inst" +$MAKE install +test ! -d _inst +test ! -r _inst +$MAKE uninstall $MAKE distcheck + +: diff --git a/tests/primary-prefix-couples-documented-valid.test b/tests/primary-prefix-couples-documented-valid.test new file mode 100755 index 0000000..c52e40f --- /dev/null +++ b/tests/primary-prefix-couples-documented-valid.test @@ -0,0 +1,89 @@ +#! /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 that the "uncommon" prefix/primary combinations used in +# examples in the Automake manual do not cause obvious errors. +# Please keep this test in sync with the automake manual. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +END + +# Fake libtool availability. +: > ltmain.sh +cat > acinclude.m4 <<'END' +AC_DEFUN([AC_PROG_LIBTOOL], + [AC_SUBST([LIBTOOL], [:])]) +END + +cat > Makefile.am <<'END' +xmldir = $(datadir)/xml +xml_DATA = file.xml + +data_DATA = file1 file2 file3 +data2dir = $(datadir) +data2_DATA = file4 file5 file6 + +aclocaldir = $(datadir)/aclocal +aclocal_DATA = mymacro.m4 myothermacro.m4 + +imagesdir = $(pkgdatadir)/images +soundsdir = $(pkgdatadir)/sounds +dist_images_DATA = images/vortex.pgm +dist_sounds_DATA = sounds/whirl.ogg + +lisp_DATA = file1.el file2.el + +javadir = $(datadir)/java +dist_java_JAVA = a.java b.java c.java + +pkgpython_PYTHON = foo.py + +pyexec_LTLIBRARIES = quaternion.la +quaternion_la_SOURCES = quaternion.c support.c support.h +quaternion_la_LDFLAGS = -avoid-version -module + +myexecbindir = /exec +myexecbin_PROGRAMS = zardoz + +foodir = $(prefix)/foo +barexecdir = $(prefix)/bar/binaries +foo_SCRIPTS = foo.sh +barexec_SCRIPTS = quux.pl + +my_execbindir = $(pkglibdir) +my_doclibdir = $(docdir) +my_execbin_PROGRAMS = foo +my_doclib_LIBRARIES = libquux.a +END + +$ACLOCAL + +# Both these two invocations are meant. +# They exercise both code paths concerning auxiliary files. +$AUTOMAKE -a +$AUTOMAKE + +: diff --git a/tests/primary-prefix-couples-force-valid.test b/tests/primary-prefix-couples-force-valid.test new file mode 100755 index 0000000..159f297 --- /dev/null +++ b/tests/primary-prefix-couples-force-valid.test @@ -0,0 +1,87 @@ +#! /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 that a user who wants to use an invalid prefix/primary +# combination can do so with a proper workaround. +# For example, this: +# lib_PROGRAMS = foo +# is expected to cause an automake error, but this: +# bardir = $(libdir) +# bar_PROGRAMS = foo +# should work. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_OUTPUT +END + +cat > Makefile.am <<'END' +my_libdir = $(libdir) +my_lib_PROGRAMS = foo + +foodir = $(bindir) +foo_LIBRARIES = libquux.a + +xdir = $(libexecdir) +x_HEADERS = bar.h + +installcheck-local: test +.PHONY: test +test: + (cd '$(prefix)' && find .);: for debugging + ls -l '$(libdir)/foo' + test -f '$(libdir)/foo' + test -x '$(libdir)/foo' + ls -l '$(bindir)/libquux.a' + test -f '$(bindir)/libquux.a' + ls -l '$(libexecdir)/bar.h' + test -f '$(libexecdir)/bar.h' + test ! -x '$(libexecdir)/bar.h' +END + +cat > foo.c <<'END' +int main (void) +{ + return 0; +} +END + +cat > libquux.c <<'END' +int quux(void) +{ + return 1; +} +END + +: > bar.h + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +cwd=`pwd` || Exit 1 +./configure --prefix="$cwd/_inst" + +$MAKE install +$MAKE installcheck +$MAKE distcheck + +: diff --git a/tests/primary-prefix-invalid-couples.test b/tests/primary-prefix-invalid-couples.test new file mode 100755 index 0000000..bd7a346 --- /dev/null +++ b/tests/primary-prefix-invalid-couples.test @@ -0,0 +1,142 @@ +#! /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/>. + +# Not all primaries/directories combinations are valid. +# Automake should flag them as errors. +# Originated from PR/294, extended later (following bug #7647) to +# cover more cases. +# See also test `primary-prefix-valid-couples.test'. + +. ./defs || Exit 1 + +set -e + +oIFS=$IFS # saved for later + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +AM_PATH_LISPDIR +END + +$ACLOCAL + +# Please keep this list in sync with the list of "Directory Variables" +# in the GNU Coding Standards and with the list additional directory +# variables provided by autoconf and/or automake (pkgdatadir, pkglibdir, +# ...). See also the hash `%standard_prefix' in the automake script. +prefixes='bin data dataroot doc dvi exec html include info lib libexec + lisp locale localstate man man1 man2 man3 man4 man5 man6 man7 + man8 man9 oldinclude pdf pkgdata pkginclude pkglib pkglibexec + ps sbin sharedstate sysconf' +# Please keep this list in sync with the list of primaries documented in +# the Automake manual (see the "The Uniform Naming Scheme" section). +primaries='PROGRAMS LIBRARIES LTLIBRARIES LISP PYTHON JAVA SCRIPTS DATA + HEADERS MANS TEXINFOS' + +# Use files, not variables, to hold the list of all the possible +# prefix_PRIMARY couples and the list of those couples valid for +# automake, to avoid having unreadable very verbose traces. + +set +x # don't be overly verbose + +for prefix in $prefixes; do + for primary in $primaries; do + echo ${prefix}_${primary} + done +done >all.list + +for primary in $primaries; do + prefixes_ok='' + case $primary in + LIBRARIES|LTLIBRARIES) + prefixes_ok='lib pkglib' + ;; + PROGRAMS) + prefixes_ok='bin sbin libexec pkglibexec' + ;; + SCRIPTS) + prefixes_ok='bin sbin libexec pkgdata' + ;; + DATA) + prefixes_ok='data dataroot pkgdata doc html dvi pdf ps + sysconf sharedstate localstate lisp' + ;; + HEADERS) + prefixes_ok='include oldinclude pkginclude' + ;; + LISP) + prefixes_ok='lisp' + ;; + PYTHON) + prefixes_ok='python' + ;; + JAVA) + prefixes_ok='java' + ;; + MANS) + # FIXME: Here we'd like to have: + # prefixes_ok='man man1 man2 man3 man4 man5 man6 man7 man8 man9' + # but Automake currently fails on that, as it allows the MANS + # primary to be coupled to any prefix. + # See also Automake bug#7656. + # We should dig out how automake had come to behave this way, and + # if such a behaviour can be safely changed. + prefixes_ok=$prefixes + ;; + TEXINFOS) + # FIXME: Here we'd like to have: + # prefixes_ok='info' + # but Automake currently fails on that, as it allows the TEXINFOS + # primary to be coupled to any prefix. + # See also Automake bug#7657. + # We should dig out how automake had come to behave this way, and + # if such a behaviour can be safely changed. + prefixes_ok=$prefixes + ;; + *) + echo "$me: internal error: unrecognized primary '$primary'" >&2 + Exit 99 + ;; + esac + for prefix in $prefixes_ok; do + echo ${prefix}_${primary} + done +done >allow.list + +set -x + +cat all.list +cat allow.list + +while read x; do + grep "^$x$" allow.list >/dev/null && continue + # To get the expected error message more in detail. + IFS=_; set $x; IFS=$oIFS + test $# -eq 2 || Exit 99 # sanity check + prefix=$1 + primary=$2 + errmsg_rx=".*${prefix}dir.* not a legitimate directory .*$primary" + # Now do the test for this prefix/primary combination. + echo "$x = foo" > Makefile.am + AUTOMAKE_fails -a + grep "^Makefile\\.am:1:$errmsg_rx" stderr +done <all.list + +: diff --git a/tests/primary-prefix-valid-couples.test b/tests/primary-prefix-valid-couples.test new file mode 100755 index 0000000..b6b53dc --- /dev/null +++ b/tests/primary-prefix-valid-couples.test @@ -0,0 +1,90 @@ +#! /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 for valid prefix/primary combinations. +# See also test `primary-prefix-invalid-couples.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +AM_PATH_LISPDIR +END + +# Fake libtool availability. +: > ltmain.sh +: > config.sub +: > config.guess +cat > acinclude.m4 <<'END' +AC_DEFUN([AC_PROG_LIBTOOL], + [AC_SUBST([LIBTOOL], [:])]) +END + +# Other required files. +echo '@setfilename foo' > foo.texi +: > texinfo.tex +: > py-compile +: > elisp-comp + +# Setup Makefile.am. + +: > Makefile.am + +for p in bin sbin libexec pkglibexec; do + echo "${p}_PROGRAMS = prog-$p" >> Makefile.am +done + +for p in lib pkglib; do + echo "${p}_LIBRARIES = libs-$p.a" >> Makefile.am + echo "${p}_LTLIBRARIES = libd-$p.la" >> Makefile.am +done + +for p in bin sbin libexec pkgdata; do + echo "${p}_SCRIPTS = $p.sh" >> Makefile.am +done + +for p in data dataroot pkgdata doc html dvi pdf ps sysconf \ + sharedstate localstate lisp; do + echo "${p}_DATA = $p.dat" >> Makefile.am +done + +for p in include oldinclude pkginclude; do + echo "${p}_HEADERS = $p.h" >> Makefile.am +done + +for p in man man1 man2 man3 man4 man5 man6 man7 man8 man9; do + echo "${p}_MANS = bar.$p" +done + +echo "info_TEXINFOS = foo.texi" >> Makefile.am +echo "lisp_LISP = foo.el" >> Makefile.am +echo "python_PYTHON = foo.py" >> Makefile.am +echo "java_JAVA = foo.java" >> Makefile.am + +awk '{print NR ":" $0}' Makefile.am # for debugging + +# Go with the tests. + +$ACLOCAL +$AUTOMAKE + +: -- 1.7.2.3
owner <at> debbugs.gnu.org, bug-automake <at> gnu.org
:bug#7647
; Package automake
.
(Thu, 27 Jan 2011 20:29:02 GMT) Full text and rfc822 format available.Message #19 received at 7647 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: 7647 <at> debbugs.gnu.org Cc: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>, Eric Blake <eblake <at> redhat.com>, automake-patches <at> gnu.org Subject: Re: [PATCH] {maint} Warnings about primary/prefix mismatch fixed and extended. (was: Re: bug#7647: Diagnose invalid primary/directory combinations) Date: Thu, 27 Jan 2011 21:36:29 +0100
[Message part 1 (text/plain, inline)]
Ping on this? References: <http://lists.gnu.org/archive/html/automake-patches/2011-01/msg00032.html> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7647> I've rebased the patch on latest maint, and improved the comments in the testcase `primary-prefix-documented-valid.test'. Below is what I've squashed in; the updated patch is attached. So... OK for maint? Regards, Stefano -*-*-*- diff --git a/ChangeLog b/ChangeLog index 625d580..5e1dcd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2011-01-03 Stefano Lattarini <stefano.lattarini <at> gmail.com> +2011-01-27 Stefano Lattarini <stefano.lattarini <at> gmail.com> Warnings about primary/prefix mismatch fixed and extended. * automake.in (%standard_prefix): Add `doc' and `locale'. diff --git a/tests/primary-prefix-invalid-couples.test b/tests/primary-prefix-invalid-couples.test index bd7a346..a8f61a9 100755 --- a/tests/primary-prefix-invalid-couples.test +++ b/tests/primary-prefix-invalid-couples.test @@ -103,11 +103,12 @@ for primary in $primaries; do TEXINFOS) # FIXME: Here we'd like to have: # prefixes_ok='info' - # but Automake currently fails on that, as it allows the TEXINFOS - # primary to be coupled to any prefix. + # but Automake currently fails on that, as it allows the use of + # `foo_TEXINFOS' to declare extra Texinfo sources for the `foo' + # Texinfo manual, as in e.g.: + # info_TEXINFOS = foo.texi + # foo_TEXINFOS = gpl.texi # See also Automake bug#7657. - # We should dig out how automake had come to behave this way, and - # if such a behaviour can be safely changed. prefixes_ok=$prefixes ;; *)
[0001-Warnings-about-primary-prefix-mismatch-fixed-and-ext.patch (text/x-patch, inline)]
From e73827393f4ca2bc0b126bf9c31ec55064b0b6af Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattarini <at> gmail.com> Date: Thu, 16 Dec 2010 19:23:06 +0100 Subject: [PATCH] Warnings about primary/prefix mismatch fixed and extended. * automake.in (%standard_prefix): Add `doc' and `locale'. Rename `pkgdatadir' to `pkgdata'. Similarly for`pkglibdir', `pkgincludedir' and `pkglibexecdir'. (handle_programs): List `pkglibexec', not `pkglib', among the prefixes valid for the `PROGRAMS' primary. (handle_data): List also `doc' among the prefixes valid for the `DATA' primary. This is required by automake's own build system. * tests/dirforbid.test: Test removed, superseded by ... * tests/primary-prefix-invalid-couples.test: ... this new test. * tests/primary-prefix-valid-couples.test: New test. * tests/primary-prefix-documented-valid.test: Likewise. * tests/primary-prefix-force-valid.test: Likewise. * tests/java3.test: Adjusted, and extended a bit. * tests/Makefile.am (TESTS): Updated. * NEWS: Updated. From a report by Eric Blake. --- ChangeLog | 21 +++ NEWS | 3 + automake.in | 16 +- tests/Makefile.am | 5 +- tests/Makefile.in | 5 +- tests/dirforbid.test | 38 ----- tests/java3.test | 14 ++- tests/primary-prefix-couples-documented-valid.test | 89 ++++++++++++ tests/primary-prefix-couples-force-valid.test | 87 ++++++++++++ tests/primary-prefix-invalid-couples.test | 143 ++++++++++++++++++++ tests/primary-prefix-valid-couples.test | 90 ++++++++++++ 11 files changed, 460 insertions(+), 51 deletions(-) delete mode 100755 tests/dirforbid.test create mode 100755 tests/primary-prefix-couples-documented-valid.test create mode 100755 tests/primary-prefix-couples-force-valid.test create mode 100755 tests/primary-prefix-invalid-couples.test create mode 100755 tests/primary-prefix-valid-couples.test diff --git a/ChangeLog b/ChangeLog index bed0418..615a72d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2011-01-27 Stefano Lattarini <stefano.lattarini <at> gmail.com> + + Warnings about primary/prefix mismatch fixed and extended. + * automake.in (%standard_prefix): Add `doc' and `locale'. + Rename `pkgdatadir' to `pkgdata'. Similarly for`pkglibdir', + `pkgincludedir' and `pkglibexecdir'. + (handle_programs): List `pkglibexec', not `pkglib', among the + prefixes valid for the `PROGRAMS' primary. + (handle_data): List also `doc' among the prefixes valid for + the `DATA' primary. This is required by automake's own build + system. + * tests/dirforbid.test: Test removed, superseded by ... + * tests/primary-prefix-invalid-couples.test: ... this new test. + * tests/primary-prefix-valid-couples.test: New test. + * tests/primary-prefix-couples-documented-valid.test: Likewise. + * tests/primary-prefix-couples-force-valid.test: Likewise. + * tests/java3.test: Adjusted, and extended a bit. + * tests/Makefile.am (TESTS): Updated. + * NEWS: Updated. + From a report by Eric Blake. + 2011-01-24 Stefano Lattarini <stefano.lattarini <at> gmail.com> docs: color-tests issues with parallel make diff --git a/NEWS b/NEWS index b5cb6e9..703aeb2 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ Bugs fixed in 1.11.0a: * Long standing bugs: + - Automake now warns about more primary/directory invalid combinations, + such as "doc_LIBRARIES" or "pkglib_PROGRAMS". + - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python' even if the `--prefix' argument pointed outside of a system directory. AM_PATH_PYTHON has been fixed to ignore the value returned from python's diff --git a/automake.in b/automake.in index d56fbf7..c9ba0f1 100755 --- a/automake.in +++ b/automake.in @@ -249,11 +249,11 @@ my @common_sometimes = # Standard directories from the GNU Coding Standards, and additional # pkg* directories from Automake. Stored in a hash for fast member check. my %standard_prefix = - map { $_ => 1 } (qw(bin data dataroot dvi exec html include info - lib libexec lisp localstate man man1 man2 man3 - man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdatadir pkgincludedir pkglibdir pkglibexecdir - ps sbin sharedstate sysconf)); + map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info + lib libexec lisp locale localstate man man1 man2 + man3 man4 man5 man6 man7 man8 man9 oldinclude pdf + pkgdata pkginclude pkglib pkglibexec ps sbin + sharedstate sysconf)); # Copyright on generated Makefile.ins. my $gen_copyright = "\ @@ -2627,7 +2627,7 @@ sub handle_libtool sub handle_programs { my @proglist = &am_install_var ('progs', 'PROGRAMS', - 'bin', 'sbin', 'libexec', 'pkglib', + 'bin', 'sbin', 'libexec', 'pkglibexec', 'noinst', 'check'); return if ! @proglist; @@ -3737,8 +3737,8 @@ sub handle_man_pages sub handle_data { &am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'dvi', 'html', 'pdf', 'ps', - 'sysconf', 'sharedstate', 'localstate', + 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf', + 'ps', 'sysconf', 'sharedstate', 'localstate', 'pkgdata', 'lisp', 'noinst', 'check'); } diff --git a/tests/Makefile.am b/tests/Makefile.am index 78bacf2..d43ad48 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -281,7 +281,6 @@ depend4.test \ depend5.test \ depend6.test \ destdir.test \ -dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ @@ -610,6 +609,10 @@ prefix.test \ primary.test \ primary2.test \ primary3.test \ +primary-prefix-invalid-couples.test \ +primary-prefix-valid-couples.test \ +primary-prefix-couples-force-valid.test \ +primary-prefix-couples-documented-valid.test \ proginst.test \ python.test \ python2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 18cb337..d925805 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -548,7 +548,6 @@ depend4.test \ depend5.test \ depend6.test \ destdir.test \ -dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ @@ -877,6 +876,10 @@ prefix.test \ primary.test \ primary2.test \ primary3.test \ +primary-prefix-invalid-couples.test \ +primary-prefix-valid-couples.test \ +primary-prefix-couples-force-valid.test \ +primary-prefix-couples-documented-valid.test \ proginst.test \ python.test \ python2.test \ diff --git a/tests/dirforbid.test b/tests/dirforbid.test deleted file mode 100755 index 3ab319d..0000000 --- a/tests/dirforbid.test +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# Copyright (C) 2002, 2003 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/>. - -# All primaries cannot be used with all directories. -# Automake should flag them as errors. -# For PR/294 - -. ./defs || Exit 1 - -set -e - -cat >> configure.in <<'END' -AC_PROG_CC -END - -# Try some (not all) disallowed variables -for i in data_PROGRAMS lib_HEADERS ; do - cat > Makefile.am << END -$i = foo -END - $ACLOCAL - AUTOMAKE_fails -a - grep 'Makefile.am:1:.*directory' stderr -done -: diff --git a/tests/java3.test b/tests/java3.test index 7895769..41dbb71 100755 --- a/tests/java3.test +++ b/tests/java3.test @@ -23,7 +23,7 @@ set -e cat >> configure.in << 'END' -AM_CONDITIONAL([WHO_CARES], false) +AM_CONDITIONAL([WHO_CARES], [false]) AC_OUTPUT END @@ -32,7 +32,7 @@ if WHO_CARES JAVA_FILES = MyClass1.java endif -dist_pkgdata_JAVA = $(JAVA_FILES) +dist_java_JAVA = $(JAVA_FILES) END : >MyClass1.java @@ -40,5 +40,13 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -./configure + +cwd=`pwd` || Exit 1 +./configure --prefix="$cwd/_inst" +$MAKE install +test ! -d _inst +test ! -r _inst +$MAKE uninstall $MAKE distcheck + +: diff --git a/tests/primary-prefix-couples-documented-valid.test b/tests/primary-prefix-couples-documented-valid.test new file mode 100755 index 0000000..c52e40f --- /dev/null +++ b/tests/primary-prefix-couples-documented-valid.test @@ -0,0 +1,89 @@ +#! /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 that the "uncommon" prefix/primary combinations used in +# examples in the Automake manual do not cause obvious errors. +# Please keep this test in sync with the automake manual. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +END + +# Fake libtool availability. +: > ltmain.sh +cat > acinclude.m4 <<'END' +AC_DEFUN([AC_PROG_LIBTOOL], + [AC_SUBST([LIBTOOL], [:])]) +END + +cat > Makefile.am <<'END' +xmldir = $(datadir)/xml +xml_DATA = file.xml + +data_DATA = file1 file2 file3 +data2dir = $(datadir) +data2_DATA = file4 file5 file6 + +aclocaldir = $(datadir)/aclocal +aclocal_DATA = mymacro.m4 myothermacro.m4 + +imagesdir = $(pkgdatadir)/images +soundsdir = $(pkgdatadir)/sounds +dist_images_DATA = images/vortex.pgm +dist_sounds_DATA = sounds/whirl.ogg + +lisp_DATA = file1.el file2.el + +javadir = $(datadir)/java +dist_java_JAVA = a.java b.java c.java + +pkgpython_PYTHON = foo.py + +pyexec_LTLIBRARIES = quaternion.la +quaternion_la_SOURCES = quaternion.c support.c support.h +quaternion_la_LDFLAGS = -avoid-version -module + +myexecbindir = /exec +myexecbin_PROGRAMS = zardoz + +foodir = $(prefix)/foo +barexecdir = $(prefix)/bar/binaries +foo_SCRIPTS = foo.sh +barexec_SCRIPTS = quux.pl + +my_execbindir = $(pkglibdir) +my_doclibdir = $(docdir) +my_execbin_PROGRAMS = foo +my_doclib_LIBRARIES = libquux.a +END + +$ACLOCAL + +# Both these two invocations are meant. +# They exercise both code paths concerning auxiliary files. +$AUTOMAKE -a +$AUTOMAKE + +: diff --git a/tests/primary-prefix-couples-force-valid.test b/tests/primary-prefix-couples-force-valid.test new file mode 100755 index 0000000..159f297 --- /dev/null +++ b/tests/primary-prefix-couples-force-valid.test @@ -0,0 +1,87 @@ +#! /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 that a user who wants to use an invalid prefix/primary +# combination can do so with a proper workaround. +# For example, this: +# lib_PROGRAMS = foo +# is expected to cause an automake error, but this: +# bardir = $(libdir) +# bar_PROGRAMS = foo +# should work. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_OUTPUT +END + +cat > Makefile.am <<'END' +my_libdir = $(libdir) +my_lib_PROGRAMS = foo + +foodir = $(bindir) +foo_LIBRARIES = libquux.a + +xdir = $(libexecdir) +x_HEADERS = bar.h + +installcheck-local: test +.PHONY: test +test: + (cd '$(prefix)' && find .);: for debugging + ls -l '$(libdir)/foo' + test -f '$(libdir)/foo' + test -x '$(libdir)/foo' + ls -l '$(bindir)/libquux.a' + test -f '$(bindir)/libquux.a' + ls -l '$(libexecdir)/bar.h' + test -f '$(libexecdir)/bar.h' + test ! -x '$(libexecdir)/bar.h' +END + +cat > foo.c <<'END' +int main (void) +{ + return 0; +} +END + +cat > libquux.c <<'END' +int quux(void) +{ + return 1; +} +END + +: > bar.h + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +cwd=`pwd` || Exit 1 +./configure --prefix="$cwd/_inst" + +$MAKE install +$MAKE installcheck +$MAKE distcheck + +: diff --git a/tests/primary-prefix-invalid-couples.test b/tests/primary-prefix-invalid-couples.test new file mode 100755 index 0000000..a2f98e1 --- /dev/null +++ b/tests/primary-prefix-invalid-couples.test @@ -0,0 +1,143 @@ +#! /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/>. + +# Not all primaries/directories combinations are valid. +# Automake should flag them as errors. +# Originated from PR/294, extended later (following bug #7647) to +# cover more cases. +# See also test `primary-prefix-valid-couples.test'. + +. ./defs || Exit 1 + +set -e + +oIFS=$IFS # saved for later + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +AM_PATH_LISPDIR +END + +$ACLOCAL + +# Please keep this list in sync with the list of "Directory Variables" +# in the GNU Coding Standards and with the list additional directory +# variables provided by autoconf and/or automake (pkgdatadir, pkglibdir, +# ...). See also the hash `%standard_prefix' in the automake script. +prefixes='bin data dataroot doc dvi exec html include info lib libexec + lisp locale localstate man man1 man2 man3 man4 man5 man6 man7 + man8 man9 oldinclude pdf pkgdata pkginclude pkglib pkglibexec + ps sbin sharedstate sysconf' +# Please keep this list in sync with the list of primaries documented in +# the Automake manual (see the "The Uniform Naming Scheme" section). +primaries='PROGRAMS LIBRARIES LTLIBRARIES LISP PYTHON JAVA SCRIPTS DATA + HEADERS MANS TEXINFOS' + +# Use files, not variables, to hold the list of all the possible +# prefix_PRIMARY couples and the list of those couples valid for +# automake, to avoid having unreadable very verbose traces. + +set +x # don't be overly verbose + +for prefix in $prefixes; do + for primary in $primaries; do + echo ${prefix}_${primary} + done +done >all.list + +for primary in $primaries; do + prefixes_ok='' + case $primary in + LIBRARIES|LTLIBRARIES) + prefixes_ok='lib pkglib' + ;; + PROGRAMS) + prefixes_ok='bin sbin libexec pkglibexec' + ;; + SCRIPTS) + prefixes_ok='bin sbin libexec pkgdata' + ;; + DATA) + prefixes_ok='data dataroot pkgdata doc html dvi pdf ps + sysconf sharedstate localstate lisp' + ;; + HEADERS) + prefixes_ok='include oldinclude pkginclude' + ;; + LISP) + prefixes_ok='lisp' + ;; + PYTHON) + prefixes_ok='python' + ;; + JAVA) + prefixes_ok='java' + ;; + MANS) + # FIXME: Here we'd like to have: + # prefixes_ok='man man1 man2 man3 man4 man5 man6 man7 man8 man9' + # but Automake currently fails on that, as it allows the MANS + # primary to be coupled to any prefix. + # See also Automake bug#7656. + # We should dig out how automake had come to behave this way, and + # if such a behaviour can be safely changed. + prefixes_ok=$prefixes + ;; + TEXINFOS) + # FIXME: Here we'd like to have: + # prefixes_ok='info' + # but Automake currently fails on that, as it allows the use of + # `foo_TEXINFOS' to declare extra Texinfo sources for the `foo' + # Texinfo manual, as in e.g.: + # info_TEXINFOS = foo.texi + # foo_TEXINFOS = gpl.texi + # See also Automake bug#7657. + prefixes_ok=$prefixes + ;; + *) + echo "$me: internal error: unrecognized primary '$primary'" >&2 + Exit 99 + ;; + esac + for prefix in $prefixes_ok; do + echo ${prefix}_${primary} + done +done >allow.list + +set -x + +cat all.list +cat allow.list + +while read x; do + grep "^$x$" allow.list >/dev/null && continue + # To get the expected error message more in detail. + IFS=_; set $x; IFS=$oIFS + test $# -eq 2 || Exit 99 # sanity check + prefix=$1 + primary=$2 + errmsg_rx=".*${prefix}dir.* not a legitimate directory .*$primary" + # Now do the test for this prefix/primary combination. + echo "$x = foo" > Makefile.am + AUTOMAKE_fails -a + grep "^Makefile\\.am:1:$errmsg_rx" stderr +done <all.list + +: diff --git a/tests/primary-prefix-valid-couples.test b/tests/primary-prefix-valid-couples.test new file mode 100755 index 0000000..b6b53dc --- /dev/null +++ b/tests/primary-prefix-valid-couples.test @@ -0,0 +1,90 @@ +#! /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 for valid prefix/primary combinations. +# See also test `primary-prefix-invalid-couples.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_GCJ +AM_PATH_PYTHON +AM_PATH_LISPDIR +END + +# Fake libtool availability. +: > ltmain.sh +: > config.sub +: > config.guess +cat > acinclude.m4 <<'END' +AC_DEFUN([AC_PROG_LIBTOOL], + [AC_SUBST([LIBTOOL], [:])]) +END + +# Other required files. +echo '@setfilename foo' > foo.texi +: > texinfo.tex +: > py-compile +: > elisp-comp + +# Setup Makefile.am. + +: > Makefile.am + +for p in bin sbin libexec pkglibexec; do + echo "${p}_PROGRAMS = prog-$p" >> Makefile.am +done + +for p in lib pkglib; do + echo "${p}_LIBRARIES = libs-$p.a" >> Makefile.am + echo "${p}_LTLIBRARIES = libd-$p.la" >> Makefile.am +done + +for p in bin sbin libexec pkgdata; do + echo "${p}_SCRIPTS = $p.sh" >> Makefile.am +done + +for p in data dataroot pkgdata doc html dvi pdf ps sysconf \ + sharedstate localstate lisp; do + echo "${p}_DATA = $p.dat" >> Makefile.am +done + +for p in include oldinclude pkginclude; do + echo "${p}_HEADERS = $p.h" >> Makefile.am +done + +for p in man man1 man2 man3 man4 man5 man6 man7 man8 man9; do + echo "${p}_MANS = bar.$p" +done + +echo "info_TEXINFOS = foo.texi" >> Makefile.am +echo "lisp_LISP = foo.el" >> Makefile.am +echo "python_PYTHON = foo.py" >> Makefile.am +echo "java_JAVA = foo.java" >> Makefile.am + +awk '{print NR ":" $0}' Makefile.am # for debugging + +# Go with the tests. + +$ACLOCAL +$AUTOMAKE + +: -- 1.7.2.3
owner <at> debbugs.gnu.org, bug-automake <at> gnu.org
:bug#7647
; Package automake
.
(Wed, 30 Mar 2011 09:09:02 GMT) Full text and rfc822 format available.Message #22 received at 7647 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: 7647 <at> debbugs.gnu.org Cc: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>, Eric Blake <eblake <at> redhat.com>, automake-patches <at> gnu.org Subject: Re: [PATCH] {maint} Warnings about primary/prefix mismatch fixed and extended. Date: Wed, 30 Mar 2011 11:08:05 +0200
References: <http://lists.gnu.org/archive/html/automake-patches/2011-01/msg00304.html> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7647> Ping^2? I will push in 72 hours if there are no objections. Regards, Stefano
owner <at> debbugs.gnu.org, bug-automake <at> gnu.org
:bug#7647
; Package automake
.
(Sun, 17 Apr 2011 19:24:02 GMT) Full text and rfc822 format available.Message #25 received at 7647 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: 7647 <at> debbugs.gnu.org Cc: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>, Eric Blake <eblake <at> redhat.com>, automake-patches <at> gnu.org Subject: Re: [PATCH] {maint} Warnings about primary/prefix mismatch fixed and extended. Date: Sun, 17 Apr 2011 21:23:10 +0200
Reference: <http://lists.gnu.org/archive/html/automake-patches/2011-03/msg00053.html> On Wednesday 30 March 2011, Stefano Lattarini wrote: > References: > <http://lists.gnu.org/archive/html/automake-patches/2011-01/msg00304.html> > <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7647> > > Ping^2? > > I will push in 72 hours if there are no objections. > > Regards, > Stefano > I've just realized that the "adjusted" test java3.test has been made weaker, since $(javadir) is empty by default and thus nothing gets installed there anyway. The following squash-in should solve this issue: -*-*- diff --git a/ChangeLog b/ChangeLog index 615a72d..0c54062 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2011-01-27 Stefano Lattarini <stefano.lattarini <at> gmail.com> +2011-04-17 Stefano Lattarini <stefano.lattarini <at> gmail.com> Warnings about primary/prefix mismatch fixed and extended. * automake.in (%standard_prefix): Add `doc' and `locale'. diff --git a/tests/java3.test b/tests/java3.test index 41dbb71..e1850a8 100755 --- a/tests/java3.test +++ b/tests/java3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 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 @@ -14,8 +14,8 @@ # 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 Java rules don't attempt to install *.java files when -# there are none. +# Make sure that Java rules don't attempt to compile or install +# *.java files when there are none. # Report from Johannes Nicolai (PR/441). . ./defs || Exit 1 @@ -32,10 +32,13 @@ if WHO_CARES JAVA_FILES = MyClass1.java endif -dist_java_JAVA = $(JAVA_FILES) +javadir = $(prefix)/java +java_JAVA = $(JAVA_FILES) END -: >MyClass1.java +cat > MyClass1.java << 'END' +class MyClass1 { // Deliberately missing right curly bracket. +END $ACLOCAL $AUTOCONF @@ -43,9 +46,10 @@ $AUTOMAKE cwd=`pwd` || Exit 1 ./configure --prefix="$cwd/_inst" +$MAKE $MAKE install -test ! -d _inst -test ! -r _inst +ls -l . _inst/java # For debugging. +find . -name '*.class' | grep . && Exit 1 $MAKE uninstall $MAKE distcheck -*-*- I'll push in 72 hours if there is no review by then. Regards, Stefano
Stefano Lattarini <stefano.lattarini <at> gmail.com>
:Stefano Lattarini <stefano.lattarini <at> gmail.com>
:Message #30 received at 7647-done <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: 7647-done <at> debbugs.gnu.org Cc: Eric Blake <eblake <at> redhat.com> Subject: Re: bug#7647: [PATCH] {maint} Warnings about primary/prefix mismatch fixed and extended. Date: Thu, 16 Jun 2011 18:20:49 +0200
The patch has been finally as commit v1.11-373-g9ca6326, with a non-trivial optimization (for speed reasons) to a test case applied with follow-up commit `v1.11-374-ged078da'. I'm thus marking this bug as closed. Regards, Stefano
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Fri, 15 Jul 2011 11:24:04 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.