1From e8716a7755eef93e1033bb913e1eb4faee54658f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 15 Apr 2020 18:29:26 -0700
4Subject: [PATCH] Use packageconfig to detect mmal support
5
6This needs userland graphics libraries, because distros may install it
7in different locations, therefore its best to rely on pkgconf to find
8the libs and header locations instead of assuming /opt/vc which might
9work on some distros ( like raspbian ) but not everywhere
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 configure.ac | 31 +++++++++++--------------------
14 1 file changed, 11 insertions(+), 20 deletions(-)
15
16diff --git a/configure.ac b/configure.ac
17index d7cf692..f81b99d 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -3427,27 +3427,18 @@ AC_ARG_ENABLE(mmal,
21   AS_HELP_STRING([--enable-mmal],
22     [Multi-Media Abstraction Layer (MMAL) hardware plugin (default enable)]))
23 if test "${enable_mmal}" != "no"; then
24-  VLC_SAVE_FLAGS
25-  LDFLAGS="${LDFLAGS} -L/opt/vc/lib -lvchostif"
26-  CPPFLAGS="${CPPFLAGS} -isystem /opt/vc/include -isystem /opt/vc/include/interface/vcos/pthreads -isystem /opt/vc/include/interface/vmcs_host/linux"
27-  AC_CHECK_HEADERS(interface/mmal/mmal.h,
28-    [ AC_CHECK_LIB(bcm_host, vc_tv_unregister_callback_full, [
29-        have_mmal="yes"
30-        VLC_ADD_PLUGIN([mmal])
31-        VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
32-        VLC_ADD_CFLAGS([mmal],[ -isystem /opt/vc/include -isystem /opt/vc/include/interface/vcos/pthreads -isystem /opt/vc/include/interface/vmcs_host/linux ])
33-        VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lmmal_core -lmmal_components -lmmal_util -lvchostif ]) ], [
34-          AS_IF([test "${enable_mmal}" = "yes"],
35-            [ AC_MSG_ERROR([Cannot find bcm library...]) ],
36-            [ AC_MSG_WARN([Cannot find bcm library...]) ])
37-          ],
38-        [])
39-    ] , [ AS_IF([test "${enable_mmal}" = "yes"],
40-      [ AC_MSG_ERROR([Cannot find development headers for mmal...]) ],
41-      [ AC_MSG_WARN([Cannot find development headers for mmal...]) ]) ])
42-  VLC_RESTORE_FLAGS
43+      PKG_CHECK_MODULES(BCMHOST, [bcm_host], [
44+      HAVE_BCMHOST=yes
45+      AC_DEFINE(HAVE_BCMHOST, 1, [Define this if you have have userlang graphics installed])
46+      VLC_ADD_LIBS([bcmhost],[$BCMHOST_LIBS])
47+      VLC_ADD_CFLAGS([bcmhost],[$BCMHOST_CFLAGS])
48+      ],:
49+      [AC_MSG_WARN([${BCMHOST_PKG_ERRORS}: userland graphics not available.])
50+      HAVE_BCMHOST=no])
51+
52+      AC_CHECK_HEADERS(interface/mmal/mmal.h)
53 fi
54-AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
55+AM_CONDITIONAL([HAVE_MMAL], [test "${have_bcmhost}" = "yes"])
56
57 dnl
58 dnl evas plugin
59--
602.26.1
61
62