From 0cc2156572755626a170ad99345647faf4d43a84 Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Thu, 20 Aug 2015 14:09:37 +0200 Subject: [PATCH] opencv: Fix OpenCV data path check to work with cross compilation https://bugzilla.gnome.org/show_bug.cgi?id=753651 --- configure.ac | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 955244c6bd..2ba930d81a 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,9 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)]) +dnl PKG_CONFIG_SYSROOT_DIR is a valid environment variable +m4_pattern_allow(PKG_CONFIG_SYSROOT_DIR) + dnl our libraries and install dirs use GST_API_VERSION in the filename dnl to allow side-by-side installation of different API versions GST_API_VERSION=1.0 @@ -2486,9 +2489,15 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [ AC_SUBST(OPENCV_PREFIX) AC_SUBST(OPENCV_CFLAGS) AC_SUBST(OPENCV_LIBS) - AC_CHECK_FILE([$OPENCV_PREFIX/share/opencv/], - [AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["opencv"], [OpenCV path name])], - [AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["OpenCV"], [OpenCV path name])]) + dnl the OpenCV prefix is used at runtime for some object properties, and also + dnl used here to detect which directory is the correct one. For the second + dnl case, make sure the right sysroot is used, ensuring correct behavior + dnl during cross compilation. + if test -d "$PKG_CONFIG_SYSROOT_DIR/$OPENCV_PREFIX/share/opencv/"; then + AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["opencv"], [OpenCV path name]) + else + AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["OpenCV"], [OpenCV path name]) + fi ]) dnl *** OpenEXR ***