autoconf
[Top][All Lists]
Advanced

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

Re: Passing flags to AC_CHECK_HEADER


From: Nick Bowler
Subject: Re: Passing flags to AC_CHECK_HEADER
Date: Tue, 28 Feb 2012 15:00:29 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Chris,

On 2012-02-28 11:33 -0800, Chris Stankevitz wrote:
> The following command assigns the variable OPENCV_CFLAGS with "-I
> /path/to/opencv/include":
> PKG_CHECK_MODULES(OPENCV, opencv >= 2.3.1,, 
> AC_MSG_ERROR(${OPENCV_PKG_ERRORS}))

Not directly related to your problem, but you should quote the macro
arguments above, as in:

   PKG_CHECK_MODULES([OPENCV], [opencv >= 2.3.1],, 
[AC_MSG_ERROR([${OPENCV_PKG_ERRORS}])])

Otherwise, the arguments are subject to macro expansion /before/ they are
substituted into the body of PKG_CHECK_MODULES.

> Q1: How to I tell AC_CHECK_HEADER to use the include directory
> specified in OPENCV_CFLAGS?
> 
> A1: CPPFLAGS="${OPENCV_CFLAGS} $CPPFLAGS"
> 
> Q2: But I thought I wasn't supposed to mess with CPPFLAGS, it was only
> for the user to play with.  Plus I don't want to affect all CPPFLAGS
> for the entire project.  I intend to selectively apply OPENCV_CFLAGS
> where needed.

That is essentially correct, you should allow the user to override
CPPFLAGS.  For tests like the above, though, you can save/restore the
CPPFLAGS (or other similar variables) temporarily.  Something like the
following (untested)

  old_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="${OPENCV_CPPFLAGS} $CPPFLAGS"
  
  # do stuff
  
  CPPFLAGS=$old_CPPFLAGS

should do the trick.

Hope that helps,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)




reply via email to

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