Hash :
cd1a9ccc
Author :
Date :
2010-10-05T17:14:00
aclocal: deprecate ACLOCAL_AMFLAGS, trace AC_CONFIG_MACRO_DIR instead
Maintaining ACLOCAL_AMFLAGS in the Makefile.am to pass extra flags
to aclocal is (and have always been) quite of an hack. For example,
autoreconf is forced to grep Makefile.am to honour those flags. But
this is a bad obsolescent behaviour; in fact, the autotools have moved
consistently in the past years from custom grepping of Makefile.am and
configure.ac to tracing of m4 macro calls, which is more consistent,
more reliable and more flexible.
And when autoreconf is not used, the developer is forced to add *by hand*
the flags specified by ACLOCAL_AMFLAGS to the aclocal calls not triggered
by make rebuild rules; here lie again more duplication and more chances
for errors.
Moreover, ACLOCAL_AMFLAGS has only two typical use cases:
- to instruct aclocal to look for extra macro definition in a local
directory (as with "ACLOCAL_AMFLAGS = -I m4"); and
- to further instruct aclocal to copy in that local directory the
required third-party .m4 files found in the system-wide directory
(as with "ACLOCAL_AMFLAGS = -I m4 --install").
The first use case can be better covered if aclocal can instead trace and
honours call to the AC_CONFIG_MACRO_DIR autoconf macro; and the second
use case shouldn't be considered really legitimate, as it is quite (and
subtly) brittle (see automake bug#9037).
Thus we now make aclocal trace AC_CONFIG_MACRO_DIR macro, and act
accordingly. For backward compatibility, we continue to support the
ACLOCAL_AMFLAGS special variable (although removing any mention of it
from the documentation). Future Automake releases will likely start
to warn about the use of that variable, and eventually remove support
for it altogether.
From a suggestion by Eric Blake.
This is a much simplified (and IMHO saner) version of the patch series
discussed in the threads:
<http://lists.gnu.org/archive/html/automake-patches/2010-10/msg00045.html>
<http://lists.gnu.org/archive/html/automake-patches/2010-12/msg00156.html>
* aclocal.in ($ac_config_macro_dir): New global variable.
(trace_used_macros): Also trace the macro 'AC_CONFIG_MACRO_DIR',
and set the '$ac_config_macro_dir' variable accordingly.
(parse_arguments): Code for diagnosis of '--install' used without
any user-specified include directory moved ...
(while (1)): .. into the main loop. Which now also updates the
list of user-specified include directories to include the directory
given as argument to the call (if any) of 'AC_CONFIG_MACRO_DIR'.
* lib/am/configure.am: Update comments.
* NEWS: Updated.
* doc/automake.texi: Likewise. Also, stop advising the use of the
'--install' in ACLOCAL_AMFLAGS (see automake bug#9037 for a rationale),
and remove any reference to ACLOCAL_AMFLAGS (which is now considered
obsolescent).
* t/aclocal-path-install.sh: Adjust grepping check in the aclocal
error messages.
* t/subpkg.sh: Updated: add 'AC_CONFIG_MACRO_DIR' call to configure.ac,
remove setting of 'ACLOCAL_AMFLAGS' in Makefile.am and use of aclocal
command line arguments.
* t/subpkg2.sh: Likewise.
* t/subdir8.sh: Likewise.
* t/remake10c.sh: Likewise.
* t/remake8a.sh: Likewise.
* t/remake8b.sh: Likewise.
* t/aclocal4.sh: Likewise.
* t/aclocal6.sh: Likewise.
* t/acloca14.sh: Likewise.
* t/acloca22.sh: Likewise.
* t/aclocal5.sh: Likewise, and do not not invade the Automake
namespace (this avoids spurious failures).
* t/acloca14b.sh: New test, identical to the previous version of
'acloca14.test'; it is kept to verify backwards compatibility with
the use of ACLOCAL_AMFLAGS.
* t/acloca22b.sh: Likewise (but for 'acloca22.test').
* t/aclocal-amflags.sh: New test, check for backwards
compatibility that ACLOCAL_AMFLAGS still works.
* t/remake-macrodir.sh: New test, checking that aclocal's honoring of
AC_CONFIG_MACRO_DIR interacts nicely with automatic rebuild rules.
* t/list-of-tests.mk: Add the new tests.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001-2012 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/>.
## This dummy rule is called from subdirectories whenever one of the
## top-level Makefile's dependencies must be updated. It does depend
## on %MAKEFILE% for the benefit of non-GNU make implementations (GNU
## make will always make sure %MAKEFILE% is updated before considering
## the am--refresh target anyway).
if %?TOPDIR_P%
.PHONY: am--refresh
am--refresh: %MAKEFILE%
@:
endif %?TOPDIR_P%
## --------------------- ##
## Building Makefile.*. ##
## --------------------- ##
## This rule remakes the Makefile.in.
%MAKEFILE-IN%: %MAINTAINER-MODE% %MAKEFILE-AM% %MAKEFILE-IN-DEPS% $(am__configure_deps)
## If configure.ac or one of configure's dependencies has changed, all
## Makefile.in are to be updated; it is then more efficient to run
## automake on all the Makefiles at once. It also allow Automake to be
## run for newly added directories.
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
?TOPDIR_P? echo ' cd $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS%'; \
?TOPDIR_P? $(am__cd) $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% \
?TOPDIR_P? && exit 0; \
?!TOPDIR_P? ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
## If on the other hand, subdir/Makefile.in has been removed, then toplevel
## am--refresh will not be aware of any need to run. We still invoke it
## due to $? listing all prerequisites. Fix up for it by running the rebuild
## rule for this file only, below.
?!TOPDIR_P? && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
## Otherwise, rebuild only this file.
echo ' cd $(top_srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%
## Ensure that GNU make doesn't remove Makefile if ./config.status (below)
## is interrupted. Otherwise, the user would need to know to rerun
## ./config.status to recreate the lost Makefile.
.PRECIOUS: %MAKEFILE%
## This rule remakes the Makefile.
%MAKEFILE%: %MAKEFILE-DEPS% $(top_builddir)/config.status
## If Makefile is to be updated because of config.status, then run
## config.status without argument in order to (i) rerun all the
## AC_CONFIG_COMMANDS including those that are not visible to
## Automake, and (ii) to save time by running config.status all with
## all the files, instead of once per file (iii) generate Makefiles
## in newly added directories.
@case '$?' in \
## Don't prefix $(top_builddir), because GNU make will strip it out
## when it's '.'.
*config.status*) \
?TOPDIR_P? echo ' $(SHELL) ./config.status'; \
?TOPDIR_P? $(SHELL) ./config.status;; \
?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
## FIXME: $(am__depfiles_maybe) lets us re-run the rule to create the
## .P files. Ideally we wouldn't have to do this by hand.
echo ' cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe);; \
esac;
## Avoid the "deleted header file" problem for the dependencies.
?HAVE-MAKEFILE-IN-DEPS?%MAKEFILE-IN-DEPS%:
DIST_COMMON += %MAKEFILE-AM%
## --------------------------- ##
## config.status & configure. ##
## --------------------------- ##
if %?TOPDIR_P%
## Always require configure.ac and configure at top level, even if they
## don't exist. This is especially important for configure, since it
## won't be created until autoconf is run -- which might be after
## automake is run.
DIST_COMMON += $(top_srcdir)/configure $(am__configure_deps)
endif %?TOPDIR_P%
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
?TOPDIR_P? $(SHELL) ./config.status --recheck
?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: %MAINTAINER-MODE% $(am__configure_deps)
?TOPDIR_P? $(am__cd) $(srcdir) && $(AUTOCONF)
?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
## ------------ ##
## aclocal.m4. ##
## ------------ ##
## Whenever a configure dependency changes we need to rebuild
## aclocal.m4 too. Changing configure.ac, or any file included by
## aclocal.m4 might require adding more files to aclocal.m4. Hence
## the $(am__configure_deps) dependency.
## We still need $(ACLOCAL_AMFLAGS) for sake of backward-compatibility;
## we should hopefully be able to get rid of it in a not-so-distant
## future.
if %?REGEN-ACLOCAL-M4%
$(ACLOCAL_M4): %MAINTAINER-MODE% $(am__aclocal_m4_deps)
?TOPDIR_P? $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
## Avoid the "deleted header file" problem for the dependencies.
$(am__aclocal_m4_deps):
endif %?REGEN-ACLOCAL-M4%
## --------- ##
## cleanup. ##
## --------- ##
## We special-case config.status here. If we do it as part of the
## normal clean processing for this directory, then it might be
## removed before some subdir is cleaned. However, that subdir's
## Makefile depends on config.status.
if %?TOPDIR_P%
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
distclean:
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
## Note: you might think we should remove Makefile.in, configure, or
## aclocal.m4 here in a maintainer-clean rule. However, the GNU
## Coding Standards explicitly prohibit this.
maintainer-clean:
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
## autom4te.cache is created by Autoconf; the only valid target to
## remove it is maintainer-clean, not distclean.
## If you have an autom4te.cache that cause distcheck to fail, then
## it is good news: you finally discovered that autoconf and/or
## autoheader is needed to use your tarball, which is wrong.
-rm -rf $(top_srcdir)/autom4te.cache
endif %?TOPDIR_P%