autoconf
[Top][All Lists]
Advanced

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

Re: including files in configure.in


From: Micah J. Cowan
Subject: Re: including files in configure.in
Date: Wed, 7 Jun 2006 15:48:59 -0700
User-agent: Mutt/1.2.5.1i

On Wed, Jun 07, 2006 at 02:54:35PM -0700, Micah J. Cowan wrote:
> On Wed, Jun 07, 2006 at 01:31:43PM -0700, Theodore Sternberg wrote:
> > Is there a way to include external files in configure.in?  In the
> > interest of being modular, of course.
> > 
> > I'm thinking along these lines:
> > 
> > case "${host}" in
> >         *86*-linux-gnu*)
> >             include linux.generic
> > 
> >         x86_64-*-linux-gnu)
> >             include linux.generic
> >             include linux.64
> > 
> >        [...]
> > esac
> 
> m4_include([linux.generic]) works for me.
> 
> You should be able to use the GNU m4 manual as a reference, remembering
> to prefix all builtins with m4, and checking autoconf's manual for
> additional information.

Actually, now that I think about it some more, it's probably more
efficient to attempt to use the /shell's/ inclusion instead, via the
"source" command or somesuch. But then, I have no idea how you would get
autoconf to process linux.generic.{ac,in} to linux.generic... you
probably can't.

Barring that, you should avoid invoking m4_include() more than once on
the same file, even "conditionally". NB that simply replacing your
includes above with m4_includes will cause the entire contents of
linux.generic to be imported into your configure script /twice/.
Instead, you might want to set a flag in both linux options, and check
for that flag after the case statement, at which point you'd do the
/actual/ inclusions.

Better yet, I'd imagine you can achieve your goals more efficiently by
defining custom macros in your aclocal.m4 (or acinclude.m4, if you're
using Automake), and simply invoking the appropriate ones. This really
removes any usefulness of sourcing other external files, as far as I can
tell.

DISCLAIMER: I am /not/ a regular to this list. As far as this forum is
concerned, I was literally born yesterday. Additionally, I am not very
experienced with either m4 or autoconf (I just know how to get what I
want from good reference documentation). Please wait until someone more
knowledgeable than myself speaks up, before taking any advice I might
offer.

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/




reply via email to

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