Hi all, this patch provides a fourth scheme of adding directories to the search path. It is a simple colon-separated list of directories (without globbing).
It is useful when you're using a global installation of Automake but you want to add directories from your account as well to the search path. It is also useful for people who do not like for some reason to touch files in /usr/share (which, unlike /etc, are usually not meant for user customization). The test suites leaves the user's ACLOCAL_PATH in place, for consistency with the treatment of ${prefix}/share/aclocal/dirlist in tests/defs.in. By the way, this line: aclocaldir='@prefix@/share/aclocal' should probably use datadir, no? Ok to apply? (I have copyright assignment in place but I'm not sure if I have access to the repository---probably not). * NEWS: Document new behavior. * aclocal.in (parse_arguments): Parse ACLOCAL_PATH as a colon-separated list of directories to be included in the search path. * doc/automake.texi (Macro Search Path): Document new behavior. * tests/acloca24.test: New testcase. * tests/Makefile.am (TESTS): Add it. * tests/Makefile.in: Regenerate. --- NEWS | 5 ++++ aclocal.in | 11 ++++++++- doc/automake.texi | 10 ++++++++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/acloca24.test | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 87 insertions(+), 1 deletions(-) create mode 100755 tests/acloca24.test diff --git a/NEWS b/NEWS index c64ec14..7567ca6 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ New in 1.11a: +* Changes to aclocal: + + - aclocal now interprets the `ACLOCAL_PATH' environment variable as a + colon-separated list of additional directories to search. + * Changes to automake: - automake now generates silenced rules for texinfo outputs. diff --git a/aclocal.in b/aclocal.in index 4c81a47..bc8cd25 100644 --- a/aclocal.in +++ b/aclocal.in @@ -1025,7 +1025,7 @@ sub parse_arguments () } else { - # Finally, adds any directory listed in the `dirlist' file. + # Add any directory listed in the `dirlist' file. if (open (DIRLIST, "$system_includes[0]/dirlist")) { while (<DIRLIST>) @@ -1043,6 +1043,15 @@ sub parse_arguments () close (DIRLIST); } } + # Add any directory listed in the `ACLOCAL_PATH' environment + # variable. + if (defined $ENV{"ACLOCAL_PATH"}) + { + foreach my $dir (split /:/, $ENV{"ACLOCAL_PATH"}) + { + push (@system_includes, $dir) if $dir ne '' && -d $dir; + } + } } ################################################################ diff --git a/doc/automake.texi b/doc/automake.texi index 7214e49..92fb0ab 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -3361,6 +3361,16 @@ Macro Search Path copy of Automake in your account and want @command{aclocal} to look for macros installed at other places on the system. +...@subsubheading Modifying the Macro Search Path: @file{ACLOCAL_PATH} +...@cindex @env{ACLOCAL_PATH} + +The fourth and last mechanism to customize the macro search path is +also the simplest. Any directory included in the colon-separated +environment variable @env{ACLOCAL_PATH} is added to the search path. + +Conversely to @file{dirlist}, @env{ACLOCAL_PATH} is useful if you are +using a global copy of Automake and want @command{aclocal} to look for +macros somewhere under your home directory. @node Extending aclocal @subsection Writing your own aclocal macros diff --git a/tests/Makefile.am b/tests/Makefile.am index 6673293..8bddb03 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -77,6 +77,7 @@ acloca20.test \ acloca21.test \ acloca22.test \ acloca23.test \ +acloca24.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3bc699f..798c4fe 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -317,6 +317,7 @@ acloca20.test \ acloca21.test \ acloca22.test \ acloca23.test \ +acloca24.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ diff --git a/tests/acloca24.test b/tests/acloca24.test new file mode 100755 index 0000000..a99be3d --- /dev/null +++ b/tests/acloca24.test @@ -0,0 +1,60 @@ +#! /bin/sh +# Copyright (C) 2002, 2003, 2004, 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 ACLOCAL_PATH support. + +. ./defs || Exit 1 + +set -e + +cat > configure.in <<EOF +AC_INIT +AM_INIT_GUILE_MODULE +EOF + +mkdir path-test + +cat >path-test/path-check.m4 <<'END' +AC_DEFUN([AM_INIT_GUILE_MODULE],[ +. $srcdir/../GUILE-VERSION +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) +AC_CONFIG_AUX_DIR(..) +module=[$1] +AC_SUBST(module)]) +END + +cat >path-test/init.m4 <<EOF +AC_DEFUN([AM_INIT_AUTOMAKE], [I should not be included]) +EOF + +ACLOCAL_PATH=./path-test${ACLOCAL_PATH:+:$ACLOCAL_PATH} +export ACLOCAL_PATH +$ACLOCAL +$AUTOCONF + +# there should be no m4_include in aclocal.m4, even tho m4/dirlist contains +# `./dirlist-test' as a relative directory. Only -I directories are subject +# to file inclusion. +grep m4_include aclocal.m4 && Exit 1 + +grep 'GUILE-VERSION' configure + +# This bug can occur only when we do a VPATH build of Automake +# (because of the `-I' passed to aclocal in tests/defs/aclocal.in) but +# it's OK because VPATH builds are done by `make distcheck'. +grep 'I should not be included' configure && Exit 1 + +: -- 1.7.2.3