[vlc-commits] configure: simplify Wayland checks

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


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

configure: simplify Wayland checks

All (useful) parts of wayland source are now treated as a single block
of dependencies (same as libxcb). All errors are printed at once.

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

 configure.ac                             | 78 ++++++++++++++------------------
 modules/video_output/Makefile.am         |  8 +---
 modules/video_output/wayland/xdg-shell.c | 17 -------
 3 files changed, 36 insertions(+), 67 deletions(-)

diff --git a/configure.ac b/configure.ac
index bdfb6332f7..0b2d8903ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3163,62 +3163,54 @@ dnl  Wayland
 dnl
 AC_ARG_ENABLE(wayland,
   [AS_HELP_STRING([--enable-wayland], [Wayland support (default auto)])])
-have_wayland="no"
-have_wayland_cursor="no"
-have_wayland_egl="no"
 
+have_wayland="no"
 AS_IF([test "${enable_wayland}" != "no"], [
-  PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= 1.5.91], [
-    AC_MSG_CHECKING([for the Wayland protocols])
-    PKG_CHECK_EXISTS([wayland-protocols >= 1.12], [
-      WAYLAND_PROTOCOLS="$(${PKG_CONFIG} wayland-protocols --variable pkgdatadir)"
-      AC_MSG_RESULT([${WAYLAND_PROTOCOLS}])
-    ], [
-      AC_MSG_RESULT([not found])
-      AC_MSG_ERROR([$(${PKG_CONFIG} --print-errors 'wayland-protocols >= 1.12')])
-    ])
+  wl_err=""
 
-    PKG_CHECK_MODULES([WAYLAND_CURSOR], [wayland-cursor], [
-      have_wayland_cursor="yes"
-    ], [
-      AC_MSG_WARN([${WAYLAND_CURSOR_PKG_ERRORS}.])
-    ])
+  dnl wayland
+  PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= 1.5.91],, [
+    wl_err="$wl_err ${WAYLAND_CLIENT_PKG_ERRORS}."
+  ])
+  PKG_CHECK_MODULES([WAYLAND_CURSOR], [wayland-cursor],, [
+    wl_err="$wl_err ${WAYLAND_CURSOR_PKG_ERRORS}."
+  ])
+  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl],, [
+    wl_err="$wl_err ${WAYLAND_EGL_PKG_ERRORS}."
+  ])
+  PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner >= 1.15], [
+    WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
+  ], [
+    wl_err="$wl_err ${WAYLAND_SCANNER_PKG_ERRORS}."
+  ])
+
+  dnl wayland-protocols
+  PKG_CHECK_MODULES([WAYLAND_PROTOCOLS], [wayland-protocols >= 1.12], [
+    WAYLAND_PROTOCOLS="$(${PKG_CONFIG} wayland-protocols --variable pkgdatadir)"
+  ], [
+    wl_err="$wl_err ${WAYLAND_PROTOCOLS_PKG_ERRORS}."
+  ])
 
-    AC_MSG_CHECKING([for the Wayland scanner])
-    PKG_CHECK_EXISTS([wayland-scanner >= 1.15], [
-      WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
-      AC_MSG_RESULT([${WAYLAND_SCANNER}])
+  AS_IF([test -n "$wl_err"], [
+    AS_IF([test -n "$enable_wayland"], [
+      AC_MSG_ERROR([$wl_err])
     ], [
-      AC_MSG_RESULT([not found])
-      AC_MSG_ERROR([$(${PKG_CONFIG} --print-errors 'wayland-scanner >= 1.15')])
+      AC_MSG_WARN([$wl_err])
     ])
-
+  ], [
     have_wayland="yes"
+  ])
 
-    AS_IF([test "${have_egl}" = "yes"], [
-      PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl], [
-        have_wayland_egl="yes"
-      ], [
-        AC_MSG_ERROR([${WAYLAND_EGL_PKG_ERRORS}.])
-      ])
-    ])
-
-    PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon], [
-      have_xkbcommon="yes"
-    ], [
-      AC_MSG_WARN([${XKBCOMMON_PKG_ERRORS}])
-    ])
+  dnl xkbcommon
+  PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon], [
+    have_xkbcommon="yes"
   ], [
-    AS_IF([test -n "${enable_wayland}"], [
-      AC_MSG_ERROR([${WAYLAND_CLIENT_PKG_ERRORS}.])
-    ])
+    AC_MSG_WARN([${XKBCOMMON_PKG_ERRORS}. Hotkeys are disabled.])
   ])
 ])
+AM_CONDITIONAL([HAVE_WAYLAND], [test "${have_wayland}" = "yes"])
 AC_SUBST([WAYLAND_PROTOCOLS])
 AC_SUBST([WAYLAND_SCANNER])
-AM_CONDITIONAL([HAVE_WAYLAND], [test "${have_wayland}" = "yes"])
-AM_CONDITIONAL([HAVE_WAYLAND_CURSOR], [test "${have_wayland_cursor}" = "yes"])
-AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "${have_wayland_egl}" = "yes"])
 AM_CONDITIONAL([HAVE_XKBCOMMON], [test "${have_xkbcommon}" = "yes"])
 
 
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index ac027ce22b..5d18a36ad9 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -100,7 +100,7 @@ if HAVE_GL
 vout_LTLIBRARIES += libgl_plugin.la
 if HAVE_EGL
 if HAVE_VAAPI
-if HAVE_WAYLAND_EGL
+if HAVE_WAYLAND
 if HAVE_VAAPI_WL
 vout_LTLIBRARIES += libglconv_vaapi_wl_plugin.la
 endif
@@ -229,10 +229,6 @@ libxdg_shell_plugin_la_CFLAGS = \
 libxdg_shell_plugin_la_LIBADD = \
 	$(WAYLAND_CLIENT_LIBS) $(WAYLAND_CURSOR_LIBS) \
 	$(XKBCOMMON_LIBS) $(LIBPTHREAD)
-if HAVE_WAYLAND_CURSOR
-libwl_shell_plugin_la_CPPFLAGS += -DHAVE_WAYLAND_CURSOR
-libxdg_shell_plugin_la_CPPFLAGS += -DHAVE_WAYLAND_CURSOR
-endif
 if HAVE_XKBCOMMON
 libwl_shell_plugin_la_CPPFLAGS += -DHAVE_XKBCOMMON
 libxdg_shell_plugin_la_CPPFLAGS += -DHAVE_XKBCOMMON
@@ -265,12 +261,10 @@ vout_LTLIBRARIES += libwl_shm_plugin.la
 vout_LTLIBRARIES += libwl_shell_plugin.la
 BUILT_SOURCES += $(nodist_libxdg_shell_plugin_la_SOURCES)
 vout_LTLIBRARIES += libxdg_shell_plugin.la
-if HAVE_WAYLAND_EGL
 if HAVE_EGL
 vout_LTLIBRARIES += libegl_wl_plugin.la
 endif
 endif
-endif
 
 
 ### Win32 ###
diff --git a/modules/video_output/wayland/xdg-shell.c b/modules/video_output/wayland/xdg-shell.c
index c9e133e1ee..a631d78768 100644
--- a/modules/video_output/wayland/xdg-shell.c
+++ b/modules/video_output/wayland/xdg-shell.c
@@ -33,9 +33,7 @@
 #include <poll.h>
 
 #include <wayland-client.h>
-#ifdef HAVE_WAYLAND_CURSOR
 #include <wayland-cursor.h>
-#endif
 #ifdef XDG_SHELL
 #include "xdg-shell-client-protocol.h"
 /** Temporary backward compatibility hack for XDG shell unstable v6 */
@@ -92,11 +90,9 @@ struct vout_window_sys_t
 
     struct wl_list outputs;
     struct wl_list seats;
-#ifdef HAVE_WAYLAND_CURSOR
     struct wl_cursor_theme *cursor_theme;
     struct wl_cursor *cursor;
     struct wl_surface *cursor_surface;
-#endif
 
     vlc_thread_t thread;
 };
@@ -410,7 +406,6 @@ static const struct wl_registry_listener registry_cbs =
 struct wl_surface *window_get_cursor(vout_window_t *wnd, int32_t *restrict hsx,
                                      int32_t *restrict hsy)
 {
-#ifdef HAVE_WAYLAND_CURSOR
     vout_window_sys_t *sys = wnd->sys;
 
     if (unlikely(sys->cursor == NULL))
@@ -432,10 +427,6 @@ struct wl_surface *window_get_cursor(vout_window_t *wnd, int32_t *restrict hsx,
     *hsx = img->hotspot_x;
     *hsy = img->hotspot_y;
     return surface;
-#else
-    (void) wnd; (void) hsx; (void) hsy;
-    return NULL;
-#endif
 }
 
 /**
@@ -452,10 +443,8 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
     sys->wm_base = NULL;
     sys->surface = NULL;
     sys->toplevel = NULL;
-#ifdef HAVE_WAYLAND_CURSOR
     sys->cursor_theme = NULL;
     sys->cursor = NULL;
-#endif
     sys->deco_manager = NULL;
     sys->deco = NULL;
     sys->default_output = var_InheritInteger(wnd, "wl-output");
@@ -531,7 +520,6 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
                                     cfg->width, cfg->height);
     vout_window_ReportSize(wnd, cfg->width, cfg->height);
 
-#ifdef HAVE_WAYLAND_CURSOR
     if (sys->shm != NULL)
     {
         sys->cursor_theme = wl_cursor_theme_load(NULL, 32, sys->shm);
@@ -543,7 +531,6 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
     }
     if (sys->cursor == NULL)
         msg_Err(wnd, "failed to load cursor");
-#endif
 
     const uint_fast32_t deco_mode =
         var_InheritBool(wnd, "video-deco")
@@ -597,12 +584,10 @@ error:
         org_kde_kwin_server_decoration_destroy(sys->deco);
     if (sys->deco_manager != NULL)
         org_kde_kwin_server_decoration_manager_destroy(sys->deco_manager);
-#ifdef HAVE_WAYLAND_CURSOR
     if (sys->cursor_surface != NULL)
         wl_surface_destroy(sys->cursor_surface);
     if (sys->cursor_theme != NULL)
         wl_cursor_theme_destroy(sys->cursor_theme);
-#endif
     if (sys->toplevel != NULL)
         xdg_toplevel_destroy(sys->toplevel);
     if (sys->surface != NULL)
@@ -638,12 +623,10 @@ static void Close(vout_window_t *wnd)
         org_kde_kwin_server_decoration_destroy(sys->deco);
     if (sys->deco_manager != NULL)
         org_kde_kwin_server_decoration_manager_destroy(sys->deco_manager);
-#ifdef HAVE_WAYLAND_CURSOR
     if (sys->cursor_surface != NULL)
         wl_surface_destroy(sys->cursor_surface);
     if (sys->cursor_theme != NULL)
         wl_cursor_theme_destroy(sys->cursor_theme);
-#endif
     xdg_toplevel_destroy(sys->toplevel);
     xdg_surface_destroy(sys->surface);
     xdg_wm_base_destroy(sys->wm_base);



More information about the vlc-commits mailing list