From d73770f879e29d11d0f03e092247be27234fc32a Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 17 Oct 2012 12:15:56 +0200 Subject: [PATCH] AC_CONFIG_MACRO_DIRS: new macro, mostly for aclocal Similar to AC_CONFIG_MACRO_DIR, but accepts more than one argument. This will allow projects to use several m4 macro local dirs. This is especially important for projects that are used as nested subpackages of larger projects. See also: * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS): New. Expands to the empty anyway, since it is only meant to be traced by tools like aclocal and autoreconf. (AC_CONFIG_MACRO_DIR): Updated comments. * doc/autoconf.texi (@node "Input"): Document AC_CONFIG_MACRO_DIRS as preferred over AC_CONFIG_MACRO_DIR. * NEWS: Update. Suggested-by: Eric Blake Helped-by: Nick Bowler Signed-off-by: Stefano Lattarini Signed-off-by: Eric Blake --- NEWS | 8 ++++++++ doc/autoconf.texi | 39 ++++++++++++++++++++++++++++++--------- lib/autoconf/general.m4 | 9 ++++++++- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index d3ff4b9c..6d5b5e94 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,14 @@ GNU Autoconf NEWS - User visible changes. ** Macros +- AC_CONFIG_MACRO_DIRS + New macro, used to declare multiple directories when looking for + local M4 macros. This macro overcomes some of the shortfalls in the + older AC_CONFIG_MACRO_DIR, which could only be used once; although + the older macro remains for compatibility with older tools. The + newer macro will be used by the upcoming Automake 1.13 release to + eliminate the need to specify ACLOCAL_AMFLAGS in Makefile.am. + - AC_PROG_CC now prefers C11 if available, falling back on C99 and then on C89 as before. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index a0c19d1d..7697d0e7 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2106,19 +2106,40 @@ files. For instance it is called by macros like @code{AC_PROG_INSTALL} @end defmac Similarly, packages that use @command{aclocal} should declare where -local macros can be found using @code{AC_CONFIG_MACRO_DIR}. +local macros can be found using @code{AC_CONFIG_MACRO_DIRS}. -@defmac AC_CONFIG_MACRO_DIR (@var{dir}) +@defmac AC_CONFIG_MACRO_DIRS (@var{dir1} [@var{dir2} ... @var{dirN}]) +@defmacx AC_CONFIG_MACRO_DIR (@var{dir}) +@acindex{CONFIG_MACRO_DIRS} @acindex{CONFIG_MACRO_DIR} -Specify @var{dir} as the location of additional local Autoconf macros. -This macro is intended for use by future versions of commands like -@command{autoreconf} that trace macro calls. It should be called -directly from @file{configure.ac} so that tools that install macros for -@command{aclocal} can find the macros' declarations. +Specify the given directories as the location of additional local Autoconf +macros. These macros are intended for use by commands like +@command{autoreconf} or @command{aclocal} that trace macro calls; they should +be called directly from @file{configure.ac} so that tools that install +macros for @command{aclocal} can find the macros' declarations. + +AC_CONFIG_MACRO_DIRS is the preferred form, and can be called multiple +times and with multiple arguments; in such cases, directories in earlier +calls are expected to be searched before directories in later calls, and +directories appearing in the same call are expected to be searched in +the order in which they appear in the call. For historical reasons, the +macro AC_CONFIG_MACRO_DIR can also be used once, if it appears first, +for tools such as older @command{libtool} that weren't prepared to +handle multiple directories. For example, a usage like + +@smallexample +AC_CONFIG_MACRO_DIR([dir1]) +AC_CONFIG_MACRO_DIRS([dir2]) +AC_CONFIG_MACRO_DIRS([dir3 dir4]) +@end smallexample + +should cause the directories to be searched in this order: +@samp{dir1 dir2 dir3 dir4}. Note that if you use @command{aclocal} from Automake to generate -@file{aclocal.m4}, you must also set @code{ACLOCAL_AMFLAGS = -I -@var{dir}} in your top-level @file{Makefile.am}. Due to a limitation in +@file{aclocal.m4}, you must also set +@code{ACLOCAL_AMFLAGS = -I @var{dir1} [-I @var{dir2} ... -I @var{dirN}]} +in your top-level @file{Makefile.am}. Due to a limitation in the Autoconf implementation of @command{autoreconf}, these include directives currently must be set on a single line in @file{Makefile.am}, without any backslash-newlines. diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 51cee303..96deb1e8 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1727,13 +1727,20 @@ AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl ## ------------------------ ## +# AC_CONFIG_MACRO_DIRS(DIR-1 [DIR-2 ... DIR-n]) +# -------------------------------------------- +# Declare directories containing additional macros for aclocal. +# This macro can be called multiple times, and with multiple arguments. +AC_DEFUN([AC_CONFIG_MACRO_DIRS], []) + # AC_CONFIG_MACRO_DIR(DIR) # ------------------------ # Declare directory containing additional macros for aclocal. +# This is obsoleted by AC_CONFIG_MACRO_DIRS, and kept only for +# backward compatibility. AC_DEFUN([AC_CONFIG_MACRO_DIR], []) - ## --------------------- ## ## Requiring aux files. ## ## --------------------- ## -- 2.47.2