autoconf
[Top][All Lists]
Advanced

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

Re: Proper use of AC_DEFAULT_INCLUDES


From: Ralf Wildenhues
Subject: Re: Proper use of AC_DEFAULT_INCLUDES
Date: Thu, 9 Mar 2006 11:02:24 +0100
User-agent: Mutt/1.5.11

Hi Davide,

* Davide Bolcioni wrote on Tue, Mar 07, 2006 at 09:16:06PM CET:
> Greetings,
> this is my first post here and I was wonder what the proper use of
> AC_DEFAULT_INCLUDES is supposed to be (using autoconf 2.59 in case
> it matters). Which of the following is correct:

First note: there was an unfortunate misspelling in the documentation.
It's AC_INCLUDES_DEFAULT, not AC_DEFAULT_INCLUDES.  This has since been
fixed in CVS.

> 1) I should blindly put AC_DEFAULT_INCLUDES in my configure.ac and then
> put the following boilerplate, lifted from the docs, in my .c files:
*snip*

> 2) I should blindly put AC_DEFAULT_INCLUDES in my configure.ac and then
> put just snippets of the above boilerplate where I need them, according
> to the header I am including (I doubt this, but still)
> 
> 3) I should blindly put AC_DEFAULT_INCLUDES in my configure.ac and this
> will just have the effect of including the above
> 
> 4) I should not normally need to put AC_DEFAULT_INCLUDES in my
> configure.ac, it is there only in case I want to change the set of
> includes other tests use.
> 
> Please note that this question is more of a documentation clarification
> question than anything else;

Sure.  Well, most of the time you do not need to specify
AC_INCLUDES_DEFAULT in configure.ac at all.  For example, if you are
using only predefined tests, and not writing macros yourself that invoke
AC_LANG_PROGRAM or similar lower-level stuff, then you can usually get
away without knowing about AC_INCLUDES_DEFAULT at all.  If you need to
use it, then usually as first _argument_ to AC_LANG_PROGRAM or
AC_LANG_CALL.  It is not useful to call the macro outside of other
macros (and will probably raise some obscure shell error, too).

In your C source, the safest would probably be your suggestion (1).
But frequently (2) is done, with good results.  In doubt ask back what
is ok, or check the documentation (Autoconf docs have some more hints
about dependencies between the headers).

With (3) I'd disagree, for reasons given above, with (4) I'd agree.
You basically only need to override the default includes in tests if you
know you are testing some header file that conflicts with them.

Cheers,
Ralf




reply via email to

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