File 0001-Also-detect-OpenCV-4-via-pkgconfig.patch of Package vlc

From ab9920b2f1da5639ae84d90a4ddb5c5cd21d3553 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Fri, 19 Nov 2021 01:29:26 +0100
Subject: [PATCH] Also detect OpenCV 4 via pkgconfig

With OpenCV 4, the pkgconfig file changed.  Preferably use OpenCV 4,
and if is not detected try opencv 3/2.4.
---
 configure.ac | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 7db5256..1c4178d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1899,7 +1899,32 @@ PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.6.2], (libbluray f
 dnl
 dnl  OpenCV wrapper and example filters
 dnl
-PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
+AC_ARG_ENABLE(opencv,
+  [AS_HELP_STRING([--enable-opencv],
+    [OpenCV (computer vision) filter (default auto)])])
+AS_IF([test "${enable_opencv}" != "no"], [
+  have_opencv="no"
+  PKG_CHECK_MODULES([OPENCV], [opencv4], [
+    have_opencv="yes"
+  ], [
+    PKG_CHECK_MODULES([OPENCV], [opencv > 2.0], [
+      have_opencv="yes"
+    ], [
+      AS_IF([test -n "${enable_opencv}"], [
+        AC_MSG_ERROR([${OPENCV_PKG_ERRORS}.])
+      ])
+    ])
+  ])
+  AS_IF([test "${have_opencv}" != "no"], [
+    VLC_ADD_PLUGIN([opencv_example opencv_wrapper])
+    VLC_ADD_LIBS([opencv_example opencv_wrapper], [$OPENCV_LIBS])
+    VLC_ADD_CFLAGS([opencv_example opencv_wrapper], [$OPENCV_CFLAGS])
+  ], [
+    AC_MSG_WARN([${OPENCV_PKG_ERRORS}.])
+    enable_opencv="no"
+  ])
+])
+AM_CONDITIONAL(HAVE_OPENCV, [test "$enable_opencv" != "no"])
 
 
 dnl
-- 
2.33.1

openSUSE Build Service is sponsored by