opencv: fix configure check and build with opencv 2.1

AC_CHECK_HEADERS() calls action-if-not-found also if just one of
the headers checked for is missing, which is not what we wanted.
Also, check for highgui_c.h instead of highgui.hpp.

https://bugzilla.gnome.org/show_bug.cgi?id=672226
This commit is contained in:
Tim-Philipp Müller 2012-03-17 12:47:52 +00:00
parent 486ddd38cf
commit 692bf9ba63
6 changed files with 32 additions and 11 deletions

View file

@ -1432,14 +1432,15 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
AC_LANG_CPLUSPLUS
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS=$OPENCV_CFLAGS
AC_CHECK_HEADERS(highgui.h opencv2/highgui/highgui.hpp, HAVE_HIGHGUI="yes", HAVE_HIGHGUI="no")
AC_CHECK_HEADERS([highgui.h opencv2/highgui/highgui_c.h])
CPPFLAGS=$OLD_CPPFLAGS
AC_LANG_C
if test "x$HAVE_HIGHGUI" = "xno"; then
AC_MSG_RESULT(highgui.h could not be found.)
HAVE_OPENCV="no"
else
if test $ac_cv_header_highgui_h = "yes" -o $ac_cv_header_opencv2_highgui_highgui_c_h = "yes" ; then
HAVE_OPENCV="yes"
else
AC_MSG_RESULT([neither highgui.h nor opencv2/highgui/highgui_c.h could not be found])
HAVE_OPENCV="no"
fi
], [
HAVE_OPENCV="no"

View file

@ -42,6 +42,13 @@
* Boston, MA 02111-1307, USA.
*/
/* This breaks the build for reasons that aren't entirely clear to me yet */
#if 0
//#ifdef HAVE_CONFIG_H
//#include "config.h"
//#endif
#endif
#include <cstdlib>
#include <errno.h>
#include <math.h>

View file

@ -46,10 +46,11 @@
#define MOTIONCELLS_H_
#include <cv.h> // includes OpenCV definitions
#ifndef __OPENCV_OLD_CV_H__
#ifdef HAVE_HIGHGUI_H
#include <highgui.h> // includes highGUI definitions
#else
#include <opencv2/highgui/highgui.hpp> // includes highGUI definitions
#endif
#ifdef HAVE_OPENCV2_HIGHGUI_HIGHGUI_C_H
#include <opencv2/highgui/highgui_c.h> // includes highGUI definitions
#endif
#include <iostream>
#include <fstream>

View file

@ -19,6 +19,10 @@
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstopencvutils.h"
static gboolean

View file

@ -48,10 +48,11 @@
#include <gst/gst.h>
#include <cv.h>
#ifndef __OPENCV_OLD_CV_H__
#ifdef HAVE_HIGHGUI_H
#include <highgui.h> // includes highGUI definitions
#else
#include <opencv2/highgui/highgui.hpp> // includes highGUI definitions
#endif
#ifdef HAVE_OPENCV2_HIGHGUI_HIGHGUI_C_H
#include <opencv2/highgui/highgui_c.h> // includes highGUI definitions
#endif
G_BEGIN_DECLS

View file

@ -42,6 +42,13 @@
* Boston, MA 02111-1307, USA.
*/
/* This breaks the build for reasons that aren't entirely clear to me yet */
#if 0
//#ifdef HAVE_CONFIG_H
//#include "config.h"
//#endif
#endif
#include <stdio.h>
#include <limits.h>
#include "motioncells_wrapper.h"