[vlc-commits] configure: simplify XCB checks

Rémi Denis-Courmont git at videolan.org
Wed May 30 18:37:32 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 30 19:14:14 2018 +0300| [7984db8c038c0802a29057da64429ce1e2895136] | committer: Rémi Denis-Courmont

configure: simplify XCB checks

All (useful) parts of libxcb source are mandatory because there is not
much point in splitting hairs. Xproto is mandatory as before.
All errors are printed at once.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7984db8c038c0802a29057da64429ce1e2895136
---

 configure.ac                       | 66 ++++++++++++++++++++------------------
 modules/video_output/Makefile.am   |  6 ++--
 modules/video_output/xcb/window.c  | 10 +++---
 modules/video_splitter/Makefile.am |  2 +-
 4 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/configure.ac b/configure.ac
index 40d78663d5..bdfb6332f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3068,50 +3068,54 @@ AC_ARG_ENABLE(xcb,
     enable_xcb="no"
   ])
 ])
-AC_ARG_ENABLE(xvideo,
-  [  --enable-xvideo         XVideo support (default enabled)],, [
-    enable_xvideo="$enable_xcb"
-])
 
 have_xcb="no"
+have_xkbcommon_x11="no"
 have_xcb_keysyms="no"
-have_xcb_randr="no"
-have_xcb_xvideo="no"
-have_xcb_xkb="no"
 AS_IF([test "${enable_xcb}" != "no"], [
-  dnl libxcb
-  PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
-  have_xcb="yes"
-  PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
-  PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
-  PKG_CHECK_MODULES(XPROTO, [xproto])
-
-  AS_IF([test "${enable_xvideo}" != "no"], [
-    PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
-  ])
-
-  PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
+  xcb_err=""
 
-  PKG_CHECK_MODULES([XCB_XKB], [xcb-xkb], [
-    PKG_CHECK_MODULES([XKBCOMMON_X11], [xkbcommon-x11], [
-      have_xcb_xkb="yes"
-    ], [
-      AC_MSG_WARN([${XKBCOMMON_X11_PKG_ERRORS}. Hotkeys will not work.])
-    ])
+  dnl libxcb
+  PKG_CHECK_MODULES([XCB], [xcb >= 1.6],, [
+    xcb_err="$xcb_err ${XCB_PKG_ERRORS}."])
+  PKG_CHECK_MODULES([XCB_COMPOSITE], [xcb-composite],, [
+    xcb_err="$xcb_err ${XCB_COMPOSITE_PKG_ERRORS}."])
+  PKG_CHECK_MODULES([XCB_RANDR], [xcb-randr >= 1.3],, [
+    xcb_err="$xcb_err ${XCB_RANDR_PKG_ERRORS}."])
+  PKG_CHECK_MODULES([XCB_SHM], [xcb-shm],, [
+    xcb_err="$xcb_err ${XCB_SHM_PKG_ERRORS}."])
+  PKG_CHECK_MODULES([XCB_XKB], [xcb-xkb],, [
+    xcb_err="$xcb_err ${XCB_XKB_PKG_ERRORS}."])
+  PKG_CHECK_MODULES([XCB_XV], [xcb-xv >= 1.1.90.1],, [
+    xcb_err="$xcb_err ${XCB_XV_PKG_ERRORS}."])
+
+  dnl xproto
+  PKG_CHECK_MODULES(XPROTO, [xproto],, [
+    xcb_err="$xcb_err ${XPROTO_PKG_ERRORS}."])
+
+  AS_IF([test -n "$xcb_err"], [
+    AC_MSG_ERROR([$xcb_err Pass --disable-xcb to skip X11 support.])
+  ])
+
+  dnl xkbcommon
+  PKG_CHECK_MODULES([XKBCOMMON_X11], [xkbcommon-x11], [
+    have_xkbcommon_x11="yes"
   ], [
-    AC_MSG_WARN([${XCB_XKB_PKG_ERRORS}. Hotkeys will not work.])
+    AC_MSG_WARN([${XKBCOMMON_X11_PKG_ERRORS}. Hotkeys are disabled.])
   ])
 
   dnl xcb-utils
-  PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
-    AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}])
+  PKG_CHECK_MODULES([XCB_KEYSYMS], [xcb-keysyms >= 0.3.4], [
+    have_xcb_keysyms="yes"
+  ], [
+    AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Global hotkeys are disabled.])
   ])
+
+  have_xcb="yes"
 ])
 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
+AM_CONDITIONAL([HAVE_XKBCOMMON_X11], [test "${have_xkbcommon_x11}" = "yes"])
 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
-AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
-AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
-AM_CONDITIONAL([HAVE_XCB_XKB], [test "${have_xcb_xkb}" = "yes"])
 
 
 dnl
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 2f27c27735..ac027ce22b 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -167,15 +167,13 @@ libglx_plugin_la_LIBADD = $(GL_LIBS) $(X_LIBS) $(X_PRE_LIBS) -lX11
 if HAVE_XCB
 pkglib_LTLIBRARIES += libvlc_xcb_events.la
 vout_LTLIBRARIES += libxcb_x11_plugin.la libxcb_window_plugin.la
-if HAVE_XCB_XKB
+if HAVE_XKBCOMMON_X11
 libxcb_window_plugin_la_SOURCES += \
 	video_output/xcb/keysym.h video_output/xcb/xcb_keysym.h \
 	video_output/xcb/vlc_xkb.h video_output/xcb/xkb.c
-libxcb_window_plugin_la_CFLAGS += -DHAVE_XCB_XKB -DHAVE_XKBCOMMON
+libxcb_window_plugin_la_CFLAGS += -DHAVE_XKBCOMMON
 endif
-if HAVE_XCB_XVIDEO
 vout_LTLIBRARIES += libxcb_xv_plugin.la
-endif
 if HAVE_EGL
 vout_LTLIBRARIES += libegl_x11_plugin.la
 endif
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 134d313c12..793adb3eeb 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -31,7 +31,7 @@
 #include <limits.h> /* _POSIX_HOST_NAME_MAX */
 
 #include <xcb/xcb.h>
-#ifdef HAVE_XCB_XKB
+#ifdef HAVE_XKBCOMMON
 # include <xcb/xkb.h>
 # include <xkbcommon/xkbcommon-x11.h>
 # include "vlc_xkb.h"
@@ -56,7 +56,7 @@ struct vout_window_sys_t
     xcb_atom_t wm_state_below;
     xcb_atom_t wm_state_fullscreen;
 
-#ifdef HAVE_XCB_XKB
+#ifdef HAVE_XKBCOMMON
     struct
     {
         struct xkb_context *ctx;
@@ -69,7 +69,7 @@ struct vout_window_sys_t
     bool embedded;
 };
 
-#ifdef HAVE_XCB_XKB
+#ifdef HAVE_XKBCOMMON
 static int InitKeyboard(vout_window_t *wnd)
 {
     vout_window_sys_t *sys = wnd->sys;
@@ -231,7 +231,7 @@ static int ProcessEvent(vout_window_t *wnd, xcb_generic_event_t *ev)
     {
         case XCB_KEY_PRESS:
         {
-#ifdef HAVE_XCB_XKB
+#ifdef HAVE_XKBCOMMON
             xcb_key_press_event_t *e = (xcb_key_press_event_t *)ev;
             uint_fast32_t vk = vlc_xkb_get_one(sys->xkb.state, e->detail);
 
@@ -290,7 +290,7 @@ static int ProcessEvent(vout_window_t *wnd, xcb_generic_event_t *ev)
             break;
 
         default:
-#ifdef HAVE_XCB_XKB
+#ifdef HAVE_XKBCOMMON
             if (sys->xkb.ctx != NULL && ev->response_type == sys->xkb.base)
             {
                 ProcessKeyboardEvent(wnd, ev);
diff --git a/modules/video_splitter/Makefile.am b/modules/video_splitter/Makefile.am
index ffeb94e82f..c6905f2385 100644
--- a/modules/video_splitter/Makefile.am
+++ b/modules/video_splitter/Makefile.am
@@ -14,7 +14,7 @@ libpanoramix_plugin_la_LIBADD = $(LIBM)
 if HAVE_WIN32_DESKTOP
 splitter_LTLIBRARIES += libpanoramix_plugin.la
 else
-if HAVE_XCB_RANDR
+if HAVE_XCB
 libpanoramix_plugin_la_CFLAGS += $(XCB_RANDR_CFLAGS) $(XCB_CFLAGS)
 libpanoramix_plugin_la_LIBADD += $(XCB_RANDR_LIBS) $(XCB_LIBS)
 splitter_LTLIBRARIES += libpanoramix_plugin.la



More information about the vlc-commits mailing list