I want to compile some part of the code only when library (OpenCV) is detected:
In configure.ac
dnl check if opencv is installed
PKG_CHECK_MODULES(OPENCV,
opencv >= 2.1.0,
HAVE_OPENCV=yes, HAVE_OPENCV=no)
if test "x$HAVE_OPENCV" = "xno"; then
AC_MSG_NOTICE(no OpenCV library with version >= 2.1.0 found - rectify plugin will not be available)
elseif
dnl if yes set flags and libs
AC_SUBST(OPENCV_CFLAGS)
AC_SUBST(OPENCV_LIBS)
fi
dnl set the variable for makefile
AM_CONDITIONAL(I_HAVE_OPENCV, test "x$HAVE_OPENCV" = "xyes")
---------------
In Makefile.am
if I_HAVE_OPENCV
"do smth"
else
"do smth else"
endif
A bit more about conditionals in makefiles is here
Thursday, May 27, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment