autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CONFIG_MACRO_DIR vs m4_include


From: Nick Bowler
Subject: Re: AC_CONFIG_MACRO_DIR vs m4_include
Date: Tue, 20 Aug 2013 18:13:13 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On 2013-08-20 22:11 +0200, Brandon Invergo wrote:
> 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], address@hidden)
>     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.

> 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/)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]