[libdispatch-dev] autoconf HAVE macro conventions

Robert Watson robert at fledge.watson.org
Sat Oct 31 03:00:18 PDT 2009


On Fri, 30 Oct 2009, Kevin Van Vechten wrote:

> I'm not very familiar with autoconf conventions and was wondering why some 
> config.h values are merely defined and some are explicitly defined to 1.
>
> Is there a strong convention to do #ifdef HAVE_FOO instead of #if HAVE_FOO 
> when testing for configure features?  For various reasons, the ability to 
> define a macro to 0 or 1 would be useful for the Mac OS X version of 
> config.h — it would let us define certain features in terms of other 
> features without as much conditional logic.

As I understand it, some of this is simply a feature of the way autoconf 
works: AC_CHECK_DECLS(), used for testing macros, checks conditionally define 
HAVE_DECL_foo, whereas functional checks, such as AC_CHECK_FUNCS(), used for 
testing for functions, defines HAVE_foo unconditionally but with a value of 0 
or 1.  I'd be quite happy to learn about ways to avoid this happening. :-)

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the libdispatch-dev mailing list