[prev in list] [next in list] [prev in thread] [next in thread] 

List:       autoconf
Subject:    Re: search path for AC_CHECK_HEADERS?
From:       "Steve M. Robbins" <steven.robbins () videotron ! ca>
Date:       2002-05-11 16:10:52
Message-ID: 20020511161052.GG4082 () nyongwa ! montreal ! qc ! ca
[Download RAW message or body]

On Sat, May 11, 2002 at 10:31:14AM -0400, mcmahill@mtl.mit.edu 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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic