[Top][All Lists]

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

Adding $includedir and $libdir in CPPFLAGS and LDFLAGS

From: John D. Burger
Subject: Adding $includedir and $libdir in CPPFLAGS and LDFLAGS
Date: Fri, 21 Dec 2001 15:21:26 -0500

Hi -

I am new to autoconf - the usual caveats and apologies apply ...

I am writing templates for a number of related libraries
and executables.  Most users will not be installing these in the usual
directories, i.e., typical configuration will be:

  configure --prefix=/some/strange/place

Configuring and installing successive packages would ordinarily require:

  configure --prefix=/some/strange/place \
    CPPFLAGS=-I/some/strange/place/include \

What I would like to do is have my generated configure scripts give
default values to CPPFLAGS and LDFLAGS as above, or perhaps just add on
to whatever the user passes in on the command line, so that the
configure-time tests will use these directories to find the previously
installed headers and libraries.

I've tried:

  AC_INIT(libspec, 1.0, address@hidden)
  CPPFLAGS="-I$includedir $CPPFLAGS"
  LDFLAGS="-L$libdir $LDFLAGS"

but this doesn't quite work - ac_cpp and friends end up with an
unexpanded ${prefix} or ${exec_prefix}, I believe.  What does work (sort
of) is the following:

  CPPFLAGS="-I$prefix/includedir $CPPFLAGS"
  LDFLAGS="-L$prefix/lib $LDFLAGS"

This is clearly suboptimal for several reasons, e.g., it ignores any
--includedir and --libdir values that the configuring user passes in.

I couldn't find any mention of this issue in the archive for this list,
although it's been discussed in another venue:

There, though, the discussion seemed to be whether to make this the
default behavior of autoconf, not how to achieve this in an individual
configure script.  I can see how that suggested patch deals with the
double evaluation issue, as well as the fact that exec_prefix might be
NONE.  Is that code indicative of the right strategy, or is there a
simpler approach?

Any suggestions would be welcome.  Thanks!

- John Burger

reply via email to

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