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/)
_______________________________________________
Autoconf mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/autoconf