Fix for PR automake/294:
authorAlexandre Duret-Lutz <adl@gnu.org>
Tue, 5 Mar 2002 17:09:32 +0000 (17:09 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Tue, 5 Mar 2002 17:09:32 +0000 (17:09 +0000)
* tests/dirforbid.test: New file.
* tests/Makefile.am (TESTS): Add it.
* automake.in (standard_prefix): New hash.
(am_primary_prefixes): Forbid standard_prefixes which are not
explicitely allowed.
* automake.texi (Uniform): Remove FIXME.

ChangeLog
automake.in
automake.texi
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/dirforbid.test [new file with mode: 0755]
version.texi

index 7222366..72e049e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-03-05  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       Fix for PR automake/294:
+       * tests/dirforbid.test: New file.
+       * tests/Makefile.am (TESTS): Add it.
+       * automake.in (standard_prefix): New hash.
+       (am_primary_prefixes): Forbid standard_prefixes which are not
+       explicitely allowed.
+       * automake.texi (Uniform): Remove FIXME.
+
 2002-03-05  Jim Meyering  <meyering@lucent.com>
 
        * automake.in (@common_files): Add config.rpath.
index 54e0ead..20eadd5 100755 (executable)
@@ -215,6 +215,15 @@ my @common_files =
 my @common_sometimes =
     qw(aclocal.m4 acconfig.h config.h.top config.h.bot stamp-vti);
 
+# 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 exec include info lib libexec lisp
+                       localstate man man1 man2 man3 man4 man5 man6
+                       man7 man8 man9 oldinclude pkgdatadir
+                       pkgincludedir pkglibdir sbin sharedstate
+                       sysconf));
+
 # Copyright on generated Makefile.ins.
 my $gen_copyright = "\
 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
@@ -7670,7 +7679,10 @@ sub am_primary_prefixes ($$@)
                            "invalid variable `$varname': `dist' is forbidden")
                  if ! exists $configure_vars{$varname};
            }
-           elsif (! defined $valid{$X} && ! variable_defined ("${X}dir"))
+           # A not-explicitely-allowed prefix X is allowed if Xdir
+           # has been defined and X is not a standard prefix.
+           elsif (! defined $valid{$X} && (! variable_defined ("${X}dir")
+                                           || exists $standard_prefix{$X}))
            {
                # Note that a configure variable is always legitimate.
                # It is natural to name such variables after the
index 15e61c3..bd80a52 100644 (file)
@@ -423,11 +423,6 @@ variable names; thus one writes @samp{bin_PROGRAMS} and not
 
 Not every sort of object can be installed in every directory.  Automake
 will flag those attempts it finds in error.
-@c FIXME: This is broken today: &am_primary_prefix will allow data_PROGRAMS
-@c because $datadir is defined before Makefile.am is parsed.  This
-@c means that passing the list of allowed directory suffix to
-@c &am_install_var or &am_primary_prefix is absolutely useless (except
-@c for 'noinst', 'check' and friends).
 Automake will also diagnose obvious misspellings in directory names.
 
 @cindex Extending list of installation directories
index d0f6402..fce658a 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 21 February 2002
-@set UPDATED-MONTH February 2002
+@set UPDATED 5 March 2002
+@set UPDATED-MONTH March 2002
 @set EDITION 1.5e
 @set VERSION 1.5e
index 37143e7..a1418b2 100644 (file)
@@ -119,6 +119,7 @@ depend.test \
 depend2.test \
 depend3.test \
 depend4.test \
+dirforbid.test \
 dirname.test \
 discover.test \
 distcommon.test \
@@ -177,7 +178,6 @@ interp2.test \
 java.test \
 javaprim.test \
 javasubst.test \
-listval.test \
 ldadd.test \
 ldflags.test \
 lex.test \
@@ -206,6 +206,7 @@ link_f_c_cxx.test \
 link_f_cxx.test        \
 link_f_only.test \
 lisp.test \
+listval.test \
 ltdeps.test \
 ltlibobjs.test \
 make.test \
@@ -219,10 +220,10 @@ mdate4.test \
 mkinst2.test \
 mkinstall.test \
 nobase.test \
-nodep.test \
-nodepcomp.test \
 nodefine.test \
 nodefine2.test \
+nodep.test \
+nodepcomp.test \
 nodist.test \
 nodist2.test \
 noinst.test \
@@ -250,6 +251,9 @@ pluseq7.test \
 pluseq8.test \
 ppf77.test \
 pr2.test \
+pr9.test \
+pr72.test \
+pr87.test \
 pr204.test \
 pr211.test \
 pr220.test \
@@ -260,9 +264,6 @@ pr266.test \
 pr279.test \
 pr279-2.test \
 pr287.test \
-pr9.test \
-pr72.test \
-pr87.test \
 prefix.test \
 primary.test \
 primary2.test \
index 22d5e99..d72759e 100644 (file)
@@ -194,6 +194,7 @@ depend.test \
 depend2.test \
 depend3.test \
 depend4.test \
+dirforbid.test \
 dirname.test \
 discover.test \
 distcommon.test \
@@ -252,7 +253,6 @@ interp2.test \
 java.test \
 javaprim.test \
 javasubst.test \
-listval.test \
 ldadd.test \
 ldflags.test \
 lex.test \
@@ -281,6 +281,7 @@ link_f_c_cxx.test \
 link_f_cxx.test        \
 link_f_only.test \
 lisp.test \
+listval.test \
 ltdeps.test \
 ltlibobjs.test \
 make.test \
@@ -294,10 +295,10 @@ mdate4.test \
 mkinst2.test \
 mkinstall.test \
 nobase.test \
-nodep.test \
-nodepcomp.test \
 nodefine.test \
 nodefine2.test \
+nodep.test \
+nodepcomp.test \
 nodist.test \
 nodist2.test \
 noinst.test \
@@ -325,6 +326,9 @@ pluseq7.test \
 pluseq8.test \
 ppf77.test \
 pr2.test \
+pr9.test \
+pr72.test \
+pr87.test \
 pr204.test \
 pr211.test \
 pr220.test \
@@ -335,9 +339,6 @@ pr266.test \
 pr279.test \
 pr279-2.test \
 pr287.test \
-pr9.test \
-pr72.test \
-pr87.test \
 prefix.test \
 primary.test \
 primary2.test \
diff --git a/tests/dirforbid.test b/tests/dirforbid.test
new file mode 100755 (executable)
index 0000000..814930d
--- /dev/null
@@ -0,0 +1,23 @@
+#! /bin/sh
+
+# All primaries cannot be used with all directories.
+# Automake should flag them as errors.
+# For PR/294
+
+. $srcdir/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 -a && exit 1
+done
+:
index d0f6402..fce658a 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 21 February 2002
-@set UPDATED-MONTH February 2002
+@set UPDATED 5 March 2002
+@set UPDATED-MONTH March 2002
 @set EDITION 1.5e
 @set VERSION 1.5e