Discussion:
AC_CONFIG_MACRO_DIR vs m4_include
Brandon Invergo
2013-08-20 20:11:15 UTC
Permalink
Hi all,

In the default example configure.ac file that I provide with GNU
pyconfigure, I include the Python-related Autoconf macros (contained in
the 'm4' directory) via the AC_CONFIG_MACRO_DIR macro. In all of my
testing, this has worked fine for me; the macros get included by aclocal
into aclocal.m4 without a problem.

A minimal pyconfigure configure.ac file might look like this:

AC_INIT([foo], [1.5], [bug-***@gnu.org])
AC_CONFIG_MACRO_DIR([m4])
PC_INIT([2.7], [3.3.2])
AC_CONFIG_FILES([Makefile setup.py])
AC_OUTPUT

Currently a user is finding that autoreconf on his system is not calling
aclocal and thus the macros are never included. Instead, he must use
m4_include. He's using Autoconf 2.69 and Automake 1.11.6.

My question comes in two parts: why might autoreconf not be calling
aclocal? Browsing the code, it looks like the only case is if
aclocal.m4 already exists and was not created by aclocal. Is there any
other possibility? The second question is, ultimately, which is
preferable: AC_CONFIG_MACRO_DIR or m4_include? My gut says
AC_CONFIG_MACRO_DIR, but perhaps I've missed some recommendations about
it.

I understand that I may be lacking some salient information regarding
the user's setup. I've still got some questions out to him. If I learn
anything else that's relevant, I'll add it here.

Thanks for your help!

Regards,
Brandon
--
Brandon Invergo
http://brandon.invergo.net
Nick Bowler
2013-08-20 22:13:13 UTC
Permalink
Post by Brandon Invergo
In the default example configure.ac file that I provide with GNU
pyconfigure, I include the Python-related Autoconf macros (contained in
the 'm4' directory) via the AC_CONFIG_MACRO_DIR macro. In all of my
testing, this has worked fine for me; the macros get included by aclocal
into aclocal.m4 without a problem.
AC_CONFIG_MACRO_DIR([m4])
PC_INIT([2.7], [3.3.2])
AC_CONFIG_FILES([Makefile setup.py])
AC_OUTPUT
Currently a user is finding that autoreconf on his system is not calling
aclocal and thus the macros are never included. Instead, he must use
m4_include. He's using Autoconf 2.69 and Automake 1.11.6.
Despite documentation to the contrary, until recently (and not in the
tool versions you are using), AC_CONFIG_MACRO_DIR never actually did
anything at all. For this reason alone, I strongly recommend not
specifying it.

Since you say you are using Automake (although your snippet above does
not include an AM_INIT_AUTOMAKE call, I assume this is an oversight),
the way to specify the aclocal include directories is to write a line
like:

ACLOCAL_AMFLAGS = -I m4

in your Makefile.am. You can also specify include directories when you
run autoreconf or aclocal, via -I options (but these will not make it
into the automake-generated rebuild rules). Alternately, you can update
to a more recent Automake and try using the new AC_CONFIG_MACRO_DIRS
(note the S) feature.
Post by Brandon Invergo
My question comes in two parts: why might autoreconf not be calling
aclocal? Browsing the code, it looks like the only case is if
aclocal.m4 already exists and was not created by aclocal. Is there any
other possibility? The second question is, ultimately, which is
preferable: AC_CONFIG_MACRO_DIR or m4_include? My gut says
AC_CONFIG_MACRO_DIR, but perhaps I've missed some recommendations about
it.
It's not your fault, the feature was confusing because the documentation
made it sound like AC_CONFIG_MACRO_DIR did something, but the tools
didn't actually care about it.

If you run autoreconf with the -v option, it should print out which
tools it is using, and you should see that it is in fact running aclocal.

Regardless, aclocal's functionality should not be confused with
m4_include. The latter is a core feature of the Autoconf language,
whereas aclocal is just a tool to automatically generate an aclocal.m4
file which

(a) copies the relevant Automake macros into your project, and
(b) includes (using m4_include) your local project macros based on
some loose text matching.

Hope that helps,
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
Brandon Invergo
2013-08-20 22:19:50 UTC
Permalink
Post by Nick Bowler
Despite documentation to the contrary, until recently (and not in the
tool versions you are using), AC_CONFIG_MACRO_DIR never actually did
anything at all. For this reason alone, I strongly recommend not
specifying it.
OK, good to know. Thanks!
Post by Nick Bowler
Since you say you are using Automake (although your snippet above does
not include an AM_INIT_AUTOMAKE call, I assume this is an oversight),
Sorry, I only mentioned Automake because it provides aclocal. Automake
itself isn't actually being used in this case.
Post by Nick Bowler
Regardless, aclocal's functionality should not be confused with
m4_include. The latter is a core feature of the Autoconf language,
whereas aclocal is just a tool to automatically generate an aclocal.m4
file which
(a) copies the relevant Automake macros into your project, and
(b) includes (using m4_include) your local project macros based on
some loose text matching.
Hope that helps,
Yep, makes sense. I'll just go ahead with m4_include then.

Thanks again for your help!


-brandon
--
Brandon Invergo
http://brandon.invergo.net
Loading...