autoconf
[Top][All Lists]
Advanced

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

Re: search path for AC_CHECK_HEADERS?


From: Steve M. Robbins
Subject: Re: search path for AC_CHECK_HEADERS?
Date: Sat, 11 May 2002 12:10:52 -0400
User-agent: Mutt/1.3.28i

On Sat, May 11, 2002 at 10:31:14AM -0400, address@hidden wrote:
> 
> How can I specify a search path to try and find a 3rd party header in?

The official answer is that your users should read INSTALL and figure
out how to set their CPPFLAGS and LDFLAGS.

For convenience, I use the --with-build-path macro

  
http://www.gnu.org/software/ac-archive/Installed_Packages/smr_with_build_path.html

 
> I'm trying to add a --enable-dmalloc option to a program which will cause
> configure to search for dmalloc.h and link with -ldmalloc for debugging.
> I'll need a similar thing to look for libs for -ldmalloc and also for a
> --enable-electricfence option.
> 
> any suggestions are appreciated.

After having LDFLAGS and CPPFLAGS properly set, you can then use use
AC_CHECK_HEADER and AC_CHECK_LIB to look for headers and libraries.
However, I find these rather fragile: for one thing, they don't work
for C++ code.  I've switched to using AC_TRY_LINK.

In http://mail.gnu.org/pipermail/autoconf/2002-April/012917.html,
I gave a macro that searches for header & lib that aborts with an
error if they are not found.  That is the macro I use for 3rd party
libs that are *required* to build the project.

In your case, you would simply make the macro invocation conditional
on the result of the --with option.  My theory is that when someone
specifies --with-dmalloc, they probably want to know if that library
was not found.  Alternatively, you could simply change the
AC_MSG_ERROR call to a warning and continue as if they had NOT used
--with-dmalloc.

Cheers,
-Steve

-- 
by Rocket to the Moon,
by Airplane to the Rocket,
by Taxi to the Airport,
by Frontdoor to the Taxi,
by throwing back the blanket and laying down the legs ...
- They Might Be Giants




reply via email to

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