summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-09-05 17:37:44 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-09-08 17:05:49 +0200
commit30f99cbd07736c96603d15346fc8ad9097a0dddd (patch)
treea56240054e1bec55d8f240059bfe836adeca4fd0
parent3c99e9dca034ba5cbe3848af024aea5b4fc19b6c (diff)
downloadautomake-30f99cbd07736c96603d15346fc8ad9097a0dddd.tar.gz
aclocal: more granularity in acdir overriding
Before this change, using the `--acdir' option caused aclocal to redefine both the directory of automake-provided m4 macros and the directory of third-party system-wide m4 macros. With this change, we deprecate the `--acdir' aclocal option, and introduce two new options `--automake-acdir' and `--system-acdir', to allow for more granularity. * aclocal.in (@automake_includes, @system_includes, @user_includes): Fix and extend comments. (usage): Update. (handle_acdir_option): New function. (parse_arguments): Recognize new options `--system-acdir' and `automake-acdir', and handle `--acdir' using the new function above. Simplify logic by assuming that the directory of third-party system-wide m4 files always exists. * tests/aclocal.in: Update to use the new options, instead of the deprecated. `--acdir'. * m4/dirlist: Move ... * m4/acdir/dirlist: ... here. * m4/Makefile.am (EXTRA_DIST): Update. (m4datadir): Rename ... (automake_acdir): ... to this. Accordingly, ... (dist_m4data_DATA): ... rename this ... (dist_automake_ac_DATA): ... to this. (system_acdir): New, directory. (dist_system_ac_DATA): New, defined to an empty value; this will ensure that the $(system_acdir) directory will be created by "make install". * tests/aclocal.test: Remove check about the `--print-ac-dir' option of aclocal, it has been moved into ... * tests/aclocal-print-acdir.test: ... this new test, and quite extended. * tests/aclocal-acdir.test: New test. * tests/Makefile.am (TESTS): Add the new tests. * NEWS, bootstrap: Update. * doc/automake.texi (aclocal Options, Macro Search Path): Update.
-rw-r--r--ChangeLog39
-rw-r--r--NEWS8
-rw-r--r--aclocal.in74
-rwxr-xr-xbootstrap4
-rw-r--r--doc/automake.texi58
-rw-r--r--m4/Makefile.am12
-rw-r--r--m4/Makefile.in84
-rw-r--r--m4/acdir/dirlist (renamed from m4/dirlist)0
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/Makefile.in2
-rwxr-xr-xtests/aclocal-acdir.test91
-rwxr-xr-xtests/aclocal-print-acdir.test35
-rw-r--r--tests/aclocal.in6
-rwxr-xr-xtests/aclocal.test6
14 files changed, 315 insertions, 106 deletions
diff --git a/ChangeLog b/ChangeLog
index b768311af..c25b41ebf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2011-09-06 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ aclocal: more granularity in acdir overriding
+ Before this change, using the `--acdir' option caused aclocal to
+ redefine both the directory of automake-provided m4 macros and the
+ directory of third-party system-wide m4 macros. With this change,
+ we deprecate the `--acdir' aclocal option, and introduce two new
+ options `--automake-acdir' and `--system-acdir', to allow for more
+ granularity.
+ * aclocal.in (@automake_includes, @system_includes,
+ @user_includes): Fix and extend comments.
+ (usage): Update.
+ (handle_acdir_option): New function.
+ (parse_arguments): Recognize new options `--system-acdir' and
+ `automake-acdir', and handle `--acdir' using the new function
+ above. Simplify logic by assuming that the directory of
+ third-party system-wide m4 files always exists.
+ * tests/aclocal.in: Update to use the new options, instead of
+ the deprecated. `--acdir'.
+ * m4/dirlist: Move ...
+ * m4/acdir/dirlist: ... here.
+ * m4/Makefile.am (EXTRA_DIST): Update.
+ (m4datadir): Rename ...
+ (automake_acdir): ... to this. Accordingly, ...
+ (dist_m4data_DATA): ... rename this ...
+ (dist_automake_ac_DATA): ... to this.
+ (system_acdir): New, directory.
+ (dist_system_ac_DATA): New, defined to an empty value; this will
+ ensure that the $(system_acdir) directory will be created by
+ "make install".
+ * tests/aclocal.test: Remove check about the `--print-ac-dir'
+ option of aclocal, it has been moved into ...
+ * tests/aclocal-print-acdir.test: ... this new test, and quite
+ extended.
+ * tests/aclocal-acdir.test: New test.
+ * tests/Makefile.am (TESTS): Add the new tests.
+ * NEWS, bootstrap: Update.
+ * doc/automake.texi (aclocal Options, Macro Search Path): Update.
+
2011-09-05 Peter Rosin <peda@lysator.liu.se>
* tests/amhello-binpkg.test: Add missing $EXEEXT usage.
diff --git a/NEWS b/NEWS
index 5086f7571..776650d3a 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,14 @@ New in 1.11.0a:
- The Automake support for automatic de-ANSI-fication will be removed in
the next major Automake release (1.12).
+ - The `--acdir' option of aclocal is deprecated, and will probably be
+ removed in the next major Automake release (1.12).
+
+* Changes to aclocal:
+
+ - The `--acdir' option is deprecated. Now you should use th new options
+ `--automake-acdir' and `--system-acdir' instead.
+
* Miscellaneous changes:
- The `lzma' compression scheme and associated automake option `dist-lzma'
diff --git a/aclocal.in b/aclocal.in
index 4b63c1afa..8b31bdca4 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -54,9 +54,11 @@ $perl_threads = 0;
# Include paths for searching macros. We search macros in this order:
# user-supplied directories first, then the directory containing the
# automake macros, and finally the system-wide directories for
-# third-party macro. @user_includes can be augmented with -I.
-# @system_includes can be augmented with the `dirlist' file. Also
-# --acdir will reset both @automake_includes and @system_includes.
+# third-party macros.
+# @user_includes can be augmented with -I.
+# @automake_includes can be reset with the `--automake-acdir' option.
+# @system_includes can be augmented with the `dirlist' file, and reset
+# with the `--system-acdir' option.
my @user_includes = ();
my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
my @system_includes = ('@datadir@/aclocal');
@@ -877,7 +879,8 @@ sub usage ($)
Generate `aclocal.m4' by scanning `configure.ac' or `configure.in'
Options:
- --acdir=DIR directory holding config files (for debugging)
+ --automake-acdir=DIR directory holding automake-provided m4 files
+ --system-acdir=DIR directory holding third-party system-wide files
--diff[=COMMAND] run COMMAND [diff -u] on M4 files that would be
changed (implies --install and --dry-run)
--dry-run pretend to, but do not actually update any file
@@ -886,7 +889,8 @@ Options:
-I DIR add directory to search list for .m4 files
--install copy third-party files to the first -I directory
--output=FILE put output in FILE (default aclocal.m4)
- --print-ac-dir print name of directory holding m4 files, then exit
+ --print-ac-dir print name of directory holding system-wide
+ third-party m4 files, then exit
--verbose don't be silent
--version print version number, then exit
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
@@ -923,6 +927,15 @@ EOF
exit 0;
}
+# Using --acdir overrides both the automake (versioned) directory and
+# the public (unversioned) system directory. This usage is obsolete.
+sub handle_acdir_option ($$)
+{
+ msg 'obsolete', '', "`--acdir' is deprecated\n";
+ @system_includes = ($_[1]);
+ @automake_includes = ();
+}
+
# Parse command line.
sub parse_arguments ()
{
@@ -931,12 +944,9 @@ sub parse_arguments ()
my %cli_options =
(
- 'acdir=s' => sub # Setting --acdir overrides both the
- { # automake (versioned) directory and the
- # public (unversioned) system directory.
- @automake_includes = ();
- @system_includes = ($_[1])
- },
+ 'acdir=s' => \&handle_acdir_option,
+ 'system-acdir=s' => sub { shift; @system_includes = @_; },
+ 'automake-acdir=s' => sub { shift; @automake_includes = @_; },
'diff:s' => \$diff_command,
'dry-run' => \$dry_run,
'force' => \$force_output,
@@ -1017,34 +1027,22 @@ sub parse_arguments ()
. "\nfirst -I option, but no -I was supplied.");
}
- if (! -d $system_includes[0])
+ # Finally, adds any directory listed in the `dirlist' file.
+ if (open (DIRLIST, "$system_includes[0]/dirlist"))
{
- # By default $(datadir)/aclocal doesn't exist. We don't want to
- # get an error in the case where we are searching the default
- # directory and it hasn't been created. (We know
- # @system_includes has its default value if @automake_includes
- # is not empty, because --acdir is the only way to change this.)
- @system_includes = () if @automake_includes;
- }
- else
- {
- # Finally, adds any directory listed in the `dirlist' file.
- if (open (DIRLIST, "$system_includes[0]/dirlist"))
- {
- while (<DIRLIST>)
- {
- # Ignore '#' lines.
- next if /^#/;
- # strip off newlines and end-of-line comments
- s/\s*\#.*$//;
- chomp;
- foreach my $dir (glob)
- {
- push (@system_includes, $dir) if -d $dir;
- }
- }
- close (DIRLIST);
- }
+ while (<DIRLIST>)
+ {
+ # Ignore '#' lines.
+ next if /^#/;
+ # strip off newlines and end-of-line comments
+ s/\s*\#.*$//;
+ chomp;
+ foreach my $dir (glob)
+ {
+ push (@system_includes, $dir) if -d $dir;
+ }
+ }
+ close (DIRLIST);
}
}
diff --git a/bootstrap b/bootstrap
index 9f1a8d824..c0043a3cb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -109,7 +109,9 @@ $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
cd ..
# Run the autotools.
-$PERL ./aclocal.tmp -I m4
+# Use `-I' here so that our own *.m4 files in m4/ gets included,
+# not copied, in aclocal.m4.
+$PERL ./aclocal.tmp -I m4 --automake-acdir m4 --system-acdir m4/acdir
$AUTOCONF
$PERL ./automake.tmp
diff --git a/doc/automake.texi b/doc/automake.texi
index 3be857851..bf2c87266 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -3186,10 +3186,21 @@ overridden using the @env{AUTOM4TE} environment variable.
@command{aclocal} accepts the following options:
@table @code
+@item --automake-acdir=@var{dir}
+@opindex --automake-acdir
+Look for the automake-provided macro files in @var{dir} instead of
+in the installation directory. This is typically used for debugging.
+
+@item --system-acdir=@var{dir}
+@opindex --system-acdir
+Look for the system-wide third-party macro files (and the special
+@file{dirlist} file) in @var{dir} instead of in the installation
+directory. This is typically used for debugging.
+
@item --acdir=@var{dir}
@opindex --acdir
-Look for the macro files in @var{dir} instead of the installation
-directory. This is typically used for debugging.
+@emph{Deprecated} shorthand for ``@option{--automake-acdir=@var{dir}
+--system-acdir=@var{dir}}''. Will be removed in future aclocal versions.
@item --diff[=@var{command}]
@opindex --diff
@@ -3294,7 +3305,7 @@ directories, in this order:
@item @var{acdir-APIVERSION}
This is where the @file{.m4} macros distributed with Automake itself
are stored. @var{APIVERSION} depends on the Automake release used;
-for Automake 1.6.x, @var{APIVERSION} = @code{1.6}.
+for example, for Automake 1.11.x, @var{APIVERSION} = @code{1.11}.
@item @var{acdir}
This directory is intended for third party @file{.m4} files, and is
@@ -3305,31 +3316,24 @@ value of @var{acdir}, use the @option{--print-ac-dir} option
(@pxref{aclocal Options}).
@end table
-As an example, suppose that @command{automake-1.6.2} was configured with
+As an example, suppose that @command{automake-1.11.2} was configured with
@option{--prefix=@-/usr/local}. Then, the search path would be:
@enumerate
-@item @file{/usr/local/share/aclocal-1.6/}
+@item @file{/usr/local/share/aclocal-1.11.2/}
@item @file{/usr/local/share/aclocal/}
@end enumerate
+The paths for the @var{acdir} and @var{acdir-APIVERSION} directories can
+be changed respectively through aclocal options @option{--system-acdir}
+and @option{--automake-acdir} (@pxref{aclocal Options}). Note however
+that these options are only intended for use by the internal Automake
+test suite, or for debugging under highly unusual situations; they are
+not ordinarily needed by end-users.
+
As explained in (@pxref{aclocal Options}), there are several options that
can be used to change or extend this search path.
-@subsubheading Modifying the Macro Search Path: @option{--acdir}
-
-The most erroneous option to modify the search path is
-@option{--acdir=@var{dir}}, which changes default directory and
-drops the @var{APIVERSION} directory. For example, if one specifies
-@samp{--acdir=/opt/private/}, then the search path becomes:
-
-@enumerate
-@item @file{/opt/private/}
-@end enumerate
-
-This option, @option{--acdir}, is intended for use by the internal
-Automake test suite only; it is not ordinarily needed by end-users.
-
@subsubheading Modifying the Macro Search Path: @samp{-I @var{dir}}
Any extra directories specified using @option{-I} options
@@ -3379,21 +3383,19 @@ Then, the search path would be
@noindent
and all directories with path names starting with @code{/test3}.
-If the @option{--acdir=@var{dir}} option is used, then @command{aclocal}
-will search for the @file{dirlist} file in @var{dir}. In the
-@samp{--acdir=/opt/private/} example above, @command{aclocal} would look
-for @file{/opt/private/dirlist}. Again, however, the @option{--acdir}
-option is intended for use by the internal Automake test suite only;
-@option{--acdir} is not ordinarily needed by end-users.
+If the @option{--system-acdir=@var{dir}} option is used, then
+@command{aclocal} will search for the @file{dirlist} file in
+@var{dir}; but remember the warnings above against the use of
+@option{--system-acdir}.
@file{dirlist} is useful in the following situation: suppose that
-@command{automake} version @code{1.6.2} is installed with
+@command{automake} version @code{1.11.2} is installed with
@samp{--prefix=/usr} by the system vendor. Thus, the default search
directories are
@c @code looks better than @file here
@enumerate
-@item @code{/usr/share/aclocal-1.6/}
+@item @code{/usr/share/aclocal-1.11/}
@item @code{/usr/share/aclocal/}
@end enumerate
@@ -3414,7 +3416,7 @@ Now, the ``default'' search path on the affected system is
@c @code looks better than @file here
@enumerate
-@item @code{/usr/share/aclocal-1.6/}
+@item @code{/usr/share/aclocal-1.11/}
@item @code{/usr/share/aclocal/}
@item @code{/usr/local/share/aclocal/}
@end enumerate
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 0cf074b4e..143df71f0 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -3,7 +3,7 @@
## Makefile for Automake m4.
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 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
@@ -18,9 +18,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-m4datadir = $(datadir)/aclocal-$(APIVERSION)
+automake_acdir = $(datadir)/aclocal-$(APIVERSION)
+system_acdir = $(datadir)/aclocal
-dist_m4data_DATA = \
+dist_automake_ac_DATA = \
$(top_srcdir)/m4/amversion.m4 \
as.m4 \
auxdir.m4 \
@@ -59,7 +60,10 @@ tar.m4 \
upc.m4 \
vala.m4
-EXTRA_DIST = dirlist amversion.in
+# So that $(system_acdir) will be created by "make install".
+dist_system_ac_DATA =
+
+EXTRA_DIST = acdir/dirlist amversion.in
# We build amversion.m4 here, instead of from config.status,
# because config.status is rerun each time one of configure's
diff --git a/m4/Makefile.in b/m4/Makefile.in
index ff4dd433f..2e7e5470d 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -16,7 +16,7 @@
@SET_MAKE@
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 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 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
subdir = m4
-DIST_COMMON = $(dist_m4data_DATA) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
+DIST_COMMON = $(dist_automake_ac_DATA) $(dist_system_ac_DATA) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
@@ -89,8 +89,9 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(m4datadir)"
-DATA = $(dist_m4data_DATA)
+am__installdirs = "$(DESTDIR)$(automake_acdir)" \
+ "$(DESTDIR)$(system_acdir)"
+DATA = $(dist_automake_ac_DATA) $(dist_system_ac_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -185,8 +186,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-m4datadir = $(datadir)/aclocal-$(APIVERSION)
-dist_m4data_DATA = \
+automake_acdir = $(datadir)/aclocal-$(APIVERSION)
+system_acdir = $(datadir)/aclocal
+dist_automake_ac_DATA = \
$(top_srcdir)/m4/amversion.m4 \
as.m4 \
auxdir.m4 \
@@ -225,7 +227,10 @@ tar.m4 \
upc.m4 \
vala.m4
-EXTRA_DIST = dirlist amversion.in
+
+# So that $(system_acdir) will be created by "make install".
+dist_system_ac_DATA =
+EXTRA_DIST = acdir/dirlist amversion.in
all: all-am
.SUFFIXES:
@@ -259,26 +264,46 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-install-dist_m4dataDATA: $(dist_m4data_DATA)
+install-dist_automake_acDATA: $(dist_automake_ac_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(automake_acdir)" || $(MKDIR_P) "$(DESTDIR)$(automake_acdir)"
+ @list='$(dist_automake_ac_DATA)'; test -n "$(automake_acdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(automake_acdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(automake_acdir)" || exit $$?; \
+ done
+
+uninstall-dist_automake_acDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_automake_ac_DATA)'; test -n "$(automake_acdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(automake_acdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(automake_acdir)" && rm -f $$files
+install-dist_system_acDATA: $(dist_system_ac_DATA)
@$(NORMAL_INSTALL)
- test -z "$(m4datadir)" || $(MKDIR_P) "$(DESTDIR)$(m4datadir)"
- @list='$(dist_m4data_DATA)'; test -n "$(m4datadir)" || list=; \
+ test -z "$(system_acdir)" || $(MKDIR_P) "$(DESTDIR)$(system_acdir)"
+ @list='$(dist_system_ac_DATA)'; test -n "$(system_acdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(system_acdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(system_acdir)" || exit $$?; \
done
-uninstall-dist_m4dataDATA:
+uninstall-dist_system_acDATA:
@$(NORMAL_UNINSTALL)
- @list='$(dist_m4data_DATA)'; test -n "$(m4datadir)" || list=; \
+ @list='$(dist_system_ac_DATA)'; test -n "$(system_acdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(m4datadir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(m4datadir)" && rm -f $$files
+ echo " ( cd '$(DESTDIR)$(system_acdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(system_acdir)" && rm -f $$files
tags: TAGS
TAGS:
@@ -320,7 +345,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(m4datadir)"; do \
+ for dir in "$(DESTDIR)$(automake_acdir)" "$(DESTDIR)$(system_acdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -373,7 +398,8 @@ info: info-am
info-am:
-install-data-am: install-dist_m4dataDATA
+install-data-am: install-dist_automake_acDATA \
+ install-dist_system_acDATA
install-dvi: install-dvi-am
@@ -417,21 +443,23 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-dist_m4dataDATA
+uninstall-am: uninstall-dist_automake_acDATA \
+ uninstall-dist_system_acDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
- install-dist_m4dataDATA install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am uninstall uninstall-am \
- uninstall-dist_m4dataDATA
+ install-dist_automake_acDATA install-dist_system_acDATA \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+ uninstall-am uninstall-dist_automake_acDATA \
+ uninstall-dist_system_acDATA
# We build amversion.m4 here, instead of from config.status,
diff --git a/m4/dirlist b/m4/acdir/dirlist
index 82339e48a..82339e48a 100644
--- a/m4/dirlist
+++ b/m4/acdir/dirlist
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 38f2319cf..f01a6dda1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -71,6 +71,8 @@ acloca19.test \
acloca20.test \
acloca21.test \
acloca22.test \
+aclocal-acdir.test \
+aclocal-print-acdir.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index ffb2fe21d..eed1ef90c 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -349,6 +349,8 @@ acloca19.test \
acloca20.test \
acloca21.test \
acloca22.test \
+aclocal-acdir.test \
+aclocal-print-acdir.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
diff --git a/tests/aclocal-acdir.test b/tests/aclocal-acdir.test
new file mode 100755
index 000000000..c5cc992f9
--- /dev/null
+++ b/tests/aclocal-acdir.test
@@ -0,0 +1,91 @@
+#! /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 aclocal's `--acdir', `--automake-acdir' and `--system-acdir'
+# options. Also check that stuff in the automake acdir takes precedence
+# over stuff in the system acdir.
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir am sys
+
+cat >> configure.in <<'END'
+MY_MACRO
+END
+
+cat > am/foo.m4 <<'END'
+AC_DEFUN([AM_INIT_AUTOMAKE], [fake--init--automake])
+END
+
+cat > sys/foo.m4 <<'END'
+AC_DEFUN([MY_MACRO], [my--macro])
+END
+
+$ACLOCAL --automake-acdir am
+$AUTOCONF
+$FGREP 'fake--init--automake' configure
+$FGREP 'MY_MACRO' configure
+
+rm -rf autom4te*.cache
+
+$ACLOCAL --system-acdir sys
+$AUTOCONF
+$FGREP 'am__api_version' configure
+$FGREP 'my--macro' configure
+
+rm -rf autom4te*.cache
+
+$ACLOCAL --automake-acdir am --system-acdir sys
+$AUTOCONF
+$FGREP 'fake--init--automake' configure
+$FGREP 'my--macro' configure
+
+rm -rf autom4te*.cache
+
+$ACLOCAL --system-acdir sys --automake-acdir am
+$AUTOCONF
+$FGREP 'fake--init--automake' configure
+$FGREP 'my--macro' configure
+
+rm -rf autom4te*.cache
+
+# Stuff in automake acdir takes precedence over stuff in system acdir.
+cat > am/bar.m4 <<'END'
+AC_DEFUN([MY_MACRO], [am--macro])
+END
+$ACLOCAL --automake-acdir am --system-acdir sys
+$AUTOCONF
+$FGREP 'fake--init--automake' configure
+$FGREP 'am--macro' configure
+$FGREP 'my--macro' configure && Exit 1 # Just to be sure.
+
+# Obsolescent `--acdir' option.
+$ACLOCAL -Wobsolete --acdir am 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep '.*--acdir.*deprecated' stderr
+
+$ACLOCAL -Wno-obsolete --acdir am
+$AUTOCONF
+$FGREP 'fake--init--automake' configure
+$FGREP 'am--macro' configure
+
+$ACLOCAL -Wno-obsolete --acdir sys 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'macro .*AM_INIT_AUTOMAKE.* not found' stderr
+
+:
diff --git a/tests/aclocal-print-acdir.test b/tests/aclocal-print-acdir.test
new file mode 100755
index 000000000..368416caf
--- /dev/null
+++ b/tests/aclocal-print-acdir.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/>.
+
+# Test on aclocal's `--print-ac-dir' option.
+
+. ./defs || Exit 1
+
+set -e
+
+$ACLOCAL --print-ac-dir
+test "`$ACLOCAL --print-ac-dir`" = "$testaclocaldir/acdir"
+
+$ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir
+test "`$ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir`" = foo
+
+$ACLOCAL --system-acdir /bar --print-ac-dir
+test "`$ACLOCAL --system-acdir /bar --print-ac-dir`" = /bar
+
+$ACLOCAL --automake-acdir /bar --print-ac-dir
+test "`$ACLOCAL --automake-acdir /bar --print-ac-dir`" = "$testaclocaldir/acdir"
+
+:
diff --git a/tests/aclocal.in b/tests/aclocal.in
index f8aa1a727..5326ad08d 100644
--- a/tests/aclocal.in
+++ b/tests/aclocal.in
@@ -12,6 +12,6 @@ fi
perllibdir="@abs_top_builddir@/lib@PATH_SEPARATOR@@abs_top_srcdir@/lib"
export perllibdir
-# Most of the files are in $srcdir/../m4. However amversion.m4 is
-# generated in ../m4, so we include that directory in the search path too.
-exec "@abs_top_builddir@/aclocal" "--acdir=@abs_top_srcdir@/m4" ${1+"$@"}
+
+exec "@abs_top_builddir@/aclocal" "--automake-acdir=@abs_top_srcdir@/m4" \
+ "--system-acdir=@abs_top_srcdir@/m4/acdir" ${1+"$@"}
diff --git a/tests/aclocal.test b/tests/aclocal.test
index da80d0887..439faa95f 100755
--- a/tests/aclocal.test
+++ b/tests/aclocal.test
@@ -15,8 +15,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/>.
-# Test to make sure that aclocal --output works. Report from
-# Alexandre Oliva.
+# Test on some aclocal options. Report from Alexandre Oliva.
+
. ./defs || Exit 1
set -e
@@ -41,6 +41,4 @@ grep '[Tt]ry.*--help.*for more information' stderr
$ACLOCAL --versi
-test "`$ACLOCAL --print-ac-dir`" = "$testaclocaldir"
-
: