1 dnl Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 dnl This library is free software; you can redistribute it and/or
4 dnl modify it under the terms of the GNU Lesser General Public
5 dnl License as published by the Free Software Foundation; either
6 dnl version 2.1 of the License, or (at your option) any later version.
8 dnl This library is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 dnl Lesser General Public License for more details.
13 dnl You should have received a copy of the GNU Lesser General Public
14 dnl License along with this library; if not, write to the Free Software
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 dnl File : check_OpenCV.m4
21 dnl Author : Renaud NEDELEC, Open CASCADE S.A.S (renaud.nedelec@opencascade.com)
23 AC_DEFUN([CHECK_OPENCV],[
25 AC_REQUIRE([AC_PROG_CXX])dnl
26 AC_REQUIRE([AC_PROG_CXXCPP])dnl
28 AC_CHECKING([for OPENCV product])
37 [ --with-opencv=DIR root directory path of OPENCV installation])
41 if test "$with_opencv" != "no" ; then
42 if test "$with_opencv" == "yes" || test "$with_opencv" == "auto"; then
45 OPENCV_HOME="$with_opencv"
48 if test "$OPENCV_HOME" == "" ; then
49 if test "x$OPENCV_INSTALL_DIR" != "x" ; then
50 OPENCV_HOME=$OPENCV_INSTALL_DIR
54 if test "x$OPENCV_HOME" != "x"; then
56 LOCAL_INCLUDES="-I$OPENCV_HOME/include -I$OPENCV_HOME/include/opencv"
57 LOCAL_LIBS="-L$OPENCV_HOME/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann"
59 CPPFLAGS_old="$CPPFLAGS"
60 CXXFLAGS_old="$CXXFLAGS"
61 CPPFLAGS="$LOCAL_INCLUDES $CPPFLAGS"
62 CXXFLAGS="$LOCAL_INCLUDES $CXXFLAGS"
64 AC_MSG_CHECKING([for OPENCV library])
66 LDFLAGS_old="$LDFLAGS"
67 LDFLAGS="-L. $LOCAL_LIBS $LDFLAGS"
69 LDFLAGS="$LDFLAGS_old"
73 AC_MSG_RESULT([$opencv_ok])
75 CPPFLAGS="$CPPFLAGS_old"
76 CXXFLAGS="$CXXFLAGS_old"
81 if test "x$opencv_ok" == xno ; then
82 AC_MSG_RESULT([for OPENCV: no])
83 AC_MSG_WARN([OPENCV includes or libraries are not found or are not properly installed])
84 AC_MSG_WARN([Use --with-opencv option to define OPENCV installation.])
86 OPENCV_INCLUDES=$LOCAL_INCLUDES
87 OPENCV_LIBS=$LOCAL_LIBS
88 AC_MSG_RESULT([for OPENCV: yes])
91 AM_CONDITIONAL(WITH_OPENCV, [test x"$opencv_ok" = xyes])
93 AC_SUBST(OPENCV_INCLUDES)