blob: 0bb3d096af4996aeb234e4077eb26780d989506b [file] [log] [blame]
From 51e83420638d58a2229931614bfc6f71e292980e Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 29 Nov 2020 20:25:43 -0300
Subject: [PATCH 1/4] Fix autotools build for opencv4
The CMake build already works
---
configure.ac | 15 +++++++++++----
src/Makefile.am | 2 ++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 42dd629..4ddc06e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,12 +94,19 @@ AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor memset pow sqrt])
HAVE_OPENCV=false
-PKG_CHECK_MODULES(OPENCV, opencv >= 1.0.0, [HAVE_OPENCV=true], [true])
+PKG_CHECK_MODULES([OPENCV], [opencv4 >= 4.0.0],
+ [AC_DEFINE([HAVE_OPENCV], true, [compiled including OpenCV >= 4])],
+ [PKG_CHECK_MODULES([OPENCV], [opencv > 1.0.0],
+ [AC_DEFINE([HAVE_OPENCV], true, [compiled including OpenCV < 4])
+ ])
+])
AM_CONDITIONAL([HAVE_OPENCV], [test x$HAVE_OPENCV = xtrue])
-if test x$HAVE_OPENCV = xtrue; then
-# OPENCV_CFLAGS="$OPENCV_CFLAGS -DOPENCV_PREFIX=`pkg-config opencv --variable=prefix`"
- AC_DEFINE(HAVE_OPENCV,1,[compiled including opencv])
+if test ! "x$OPENCV_LIBS" = "x"; then
+ HAVE_OPENCV=true
AC_DEFINE(OPENCV_DATA_DIR,[${prefix}/share/opencv],opencv data prefix)
+ OPENCV_DATA_DIR=${prefix}/share/opencv
+ AC_SUBST([OPENCV_CFLAGS])
+ AC_SUBST([OPENCV_LIBS])
fi
AC_SUBST(HAVE_OPENCV)
diff --git a/src/Makefile.am b/src/Makefile.am
index 0eda1a2..2d8ba6b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -158,10 +158,12 @@ if HAVE_OPENCV
plugin_LTLIBRARIES += facebl0r.la
facebl0r_la_SOURCES = filter/facebl0r/facebl0r.cpp
facebl0r_la_CFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
+facebl0r_la_CXXFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
facebl0r_la_LIBADD = @OPENCV_LIBS@
plugin_LTLIBRARIES += facedetect.la
facedetect_la_SOURCES = filter/facedetect/facedetect.cpp
facedetect_la_CFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
+facedetect_la_CXXFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
facedetect_la_LIBADD = @OPENCV_LIBS@
endif
--
2.23.0