Subject: Re: bug#8407: aclocal installs third-party m4 files in directories specified with absolute paths, even if it is documented not to

From: Stefano Lattarini <[email-masked]>
Date: Tue, 27 Dec 2011 16:00:42 +0100

tags 8407 + patch
close 8407
thanks

Reference:

  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8407>

I've applied the attached patch to maint, and I'm thus closing this bug
report.

Regards, and thanks for the patience,
  Stefano
>From 44da9cbd7dbbdb858d11e8dcdf213c32be7e333c Mon Sep 17 00:00:00 2001
Message-Id: <44da9cbd7[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Tue, 27 Dec 2011 14:55:41 +0100
Subject: [PATCH] docs: "aclocal --install -I /abs/dir" actually copies files

This change is for automake bug#8407.

In the past, there had been some debate and confusion about
whether "aclocal --install" should copy third-party .m4 files
in the first directory passed to the `-I' option even when
such directory was given as an absolute path, or whether it
was better to do so only for directories specified with a
relative path.

The rationale for this latter behaviour was that, before the
existence of the `ACLOCAL_PATH' variable, the only way (a poor
way, I might add) for a common user to extend the search path
of a system-wide installation of aclocal was to export something
like ACLOCAL="aclocal -I /my/extra/macros" in the environment.
Today, the correct way to proceed is undoubtedly through the
use of ACLOCAL_PATH, so we can settle the question once and for
all, and start verifying the correct behaviour of `-I' with a
new test.

* tests/aclocal-install-absdir.test: New test.
* tests/Makefile.am (TESTS): Add it.
* doc/automake.texi (aclocal Options): Be more explicit about
this part of `--install' semantics.
---
 ChangeLog                         |   28 ++++++++++++++++++++++++++++
 doc/automake.texi                 |    2 ++
 tests/Makefile.am                 |    1 +
 tests/aclocal-install-absdir.test |   35 +++++++++++++++++++++++++++++++++++
 4 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 tests/aclocal-install-absdir.test

diff --git a/ChangeLog b/ChangeLog
index 412d4d6..0d42cdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2011-12-27  Stefano Lattarini  <[email-masked]>
+
+	docs: "aclocal --install -I /abs/dir" actually copies files
+
+	This change is for automake bug#8407.
+
+	In the past, there had been some debate and confusion about
+	whether "aclocal --install" should copy third-party .m4 files
+	in the first directory passed to the `-I' option even when
+	such directory was given as an absolute path, or whether it
+	was better to do so only for directories specified with a
+	relative path.
+
+	The rationale for this latter behaviour was that, before the
+	existence of the `ACLOCAL_PATH' variable, the only way (a poor
+	way, I might add) for a common user to extend the search path
+	of a system-wide installation of aclocal was to export something
+	like ACLOCAL="aclocal -I /my/extra/macros" in the environment.
+	Today, the correct way to proceed is undoubtedly through the
+	use of ACLOCAL_PATH, so we can settle the question once and for
+	all, and start verifying the correct behaviour of `-I' with a
+	new test.
+
+	* tests/aclocal-install-absdir.test: New test.
+	* tests/Makefile.am (TESTS): Add it.
+	* doc/automake.texi (aclocal Options): Be more explicit about
+	this part of `--install' semantics.
+
 2011-12-26  Stefano Lattarini  <[email-masked]>
 
 	docs: fix node names for automake and aclocal invocations
diff --git a/doc/automake.texi b/doc/automake.texi
index 3151620..86879d1 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -3224,6 +3224,8 @@ Add the directory @var{dir} to the list of directories searched for
 Install system-wide third-party macros into the first directory
 specified with @samp{-I @var{dir}} instead of copying them in the
 output file.
+@c The following semantics is checked by `aclocal-install-absdir.test'.
+Note that this will happen also if @var{dir} is an absolute path.
 
 @cindex serial number and @option{--install}
 When this option is used, and only when this option is used,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5ac0e48..6ce7c53 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -78,6 +78,7 @@ acloca20.test \
 acloca21.test \
 acloca22.test \
 aclocal-acdir.test \
+aclocal-install-absdir.test \
 aclocal-print-acdir.test \
 aclocal-path.test \
 aclocal-path-install.test \
diff --git a/tests/aclocal-install-absdir.test b/tests/aclocal-install-absdir.test
new file mode 100644
index 0000000..1a642b5
--- /dev/null
+++ b/tests/aclocal-install-absdir.test
@@ -0,0 +1,35 @@
+#! /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 "aclocal --install" install files also in directories
+# passed to `-I' as absolute paths.  Now that we support the
+# ACLOCAL_PATH variable, it is clear that this is the right thing
+# to do.  See also automake bug#8407.
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir loc sys
+
+echo 'AM_DUMMY_MACRO' >> configure.in
+echo 'AC_DEFUN([AM_DUMMY_MACRO], [:])' >> sys/foo.m4
+
+cwd=`pwd` || fatal_ "cannot get current working directory"
+env ACLOCAL_PATH="$cwd/sys" $ACLOCAL --verbose --install -I "$cwd/loc"
+diff sys/foo.m4 loc/foo.m4
+
+:
-- 
1.7.7.3