[mutter/wip/carlosg/sound-abstraction: 38/42] build: Make libcanberra no longer optional



commit 956ab4bd58b56bfe410e04903ad0e9b1c8ed8607
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Dec 17 23:52:03 2018 +0100

    build: Make libcanberra no longer optional
    
    This is not the case anymore with MetaSoundPlayer in place, and also
    important to get keyboard bell right.

 config.h.meson             |  3 ---
 configure.ac               | 26 +++++---------------------
 meson.build                |  8 +-------
 meson_options.txt          |  6 ------
 src/core/bell.c            |  6 ------
 src/core/workspace.c       |  4 ----
 src/meson.build            |  7 +------
 src/x11/meta-x11-display.c |  4 ----
 8 files changed, 7 insertions(+), 57 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index af935cdeb..70681d774 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -28,9 +28,6 @@
 /* Defined if EGLStream support is enabled */
 #mesondefine HAVE_WAYLAND_EGLSTREAM
 
-/* Building with libcanberra for playing sounds */
-#mesondefine HAVE_LIBCANBERRA
-
 /* Building with gudev for device type detection */
 #mesondefine HAVE_LIBGUDEV
 
diff --git a/configure.ac b/configure.ac
index eb61abd08..e18426166 100644
--- a/configure.ac
+++ b/configure.ac
@@ -128,11 +128,6 @@ AC_ARG_ENABLE(startup-notification,
                  [disable mutter's startup notification support, for embedded/size-sensitive custom 
non-GNOME builds]),,
   enable_startup_notification=auto)
 
-AC_ARG_WITH(libcanberra,
-  AC_HELP_STRING([--without-libcanberra],
-                 [disable the use of libcanberra for playing sounds]),,
-  with_libcanberra=auto)
-
 AC_ARG_WITH(libwacom,
   AC_HELP_STRING([--without-libwacom],
                  [disable the use of libwacom for advanced tablet management]),,
@@ -186,22 +181,12 @@ else
   echo "Building without libstartup-notification"
 fi
 
-have_libcanberra=no
-AC_MSG_CHECKING([libcanberra-gtk])
-if test x$with_libcanberra = xno ; then
-  AC_MSG_RESULT([disabled])
+if $PKG_CONFIG --exists $CANBERRA_GTK '>=' $CANBERRA_GTK_VERSION; then
+  AC_MSG_RESULT(yes)
+  MUTTER_PC_MODULES="$MUTTER_PC_MODULES $CANBERRA_GTK"
 else
-  if $PKG_CONFIG --exists $CANBERRA_GTK '>=' $CANBERRA_GTK_VERSION; then
-    have_libcanberra=yes
-    AC_MSG_RESULT(yes)
-    MUTTER_PC_MODULES="$MUTTER_PC_MODULES $CANBERRA_GTK"
-    AC_DEFINE([HAVE_LIBCANBERRA], 1, [Building with libcanberra for playing sounds])
-  else
-    AC_MSG_RESULT(no)
-    if test x$with_libcanberra = xyes ; then
-      AC_MSG_ERROR([libcanberra forced and libcanberra-gtk was not found])
-    fi
-  fi
+  AC_MSG_RESULT(no)
+  AC_MSG_ERROR([libcanberra was not found])
 fi
 
 have_libwacom=no
@@ -544,7 +529,6 @@ mutter-$VERSION
        compiler:                 ${CC}
 
        Startup notification:     ${have_startup_notification}
-       libcanberra:              ${have_libcanberra}
        libwacom:                 ${have_libwacom}
        gudev                     ${have_gudev}
        Introspection:            ${found_introspection}
diff --git a/meson.build b/meson.build
index e24d3645b..1a566d15d 100644
--- a/meson.build
+++ b/meson.build
@@ -117,6 +117,7 @@ xcb_res_dep = dependency('xcb-res')
 xinerama_dep = dependency('xinerama')
 ice_dep = dependency('ice')
 atk_dep = dependency('atk', version: atk_req)
+libcanberra_gtk3_dep = dependency('libcanberra-gtk3', version: libcanberra_gtk3_req)
 
 # For now always require X11 support
 have_x11 = true
@@ -212,11 +213,6 @@ if have_sm
   sm_dep = dependency('sm')
 endif
 
-have_libcanberra = get_option('libcanberra')
-if have_libcanberra
-  libcanberra_gtk3_dep = dependency('libcanberra-gtk3', version: libcanberra_gtk3_req)
-endif
-
 have_libwacom = get_option('libwacom')
 if have_libwacom
   libwacom_dep = dependency('libwacom', version: libwacom_req)
@@ -292,7 +288,6 @@ cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop)
 cdata.set('HAVE_EGL_DEVICE', have_egl_device)
 cdata.set('HAVE_WAYLAND_EGLSTREAM', have_wayland_eglstream)
 cdata.set('HAVE_LIBGUDEV', have_libgudev)
-cdata.set('HAVE_LIBCANBERRA', have_libcanberra)
 cdata.set('HAVE_LIBWACOM', have_libwacom)
 cdata.set('HAVE_SM', have_sm)
 cdata.set('HAVE_STARTUP_NOTIFICATION', have_startup_notification)
@@ -358,7 +353,6 @@ output = [
   '        EGL Device............... ' + have_egl_device.to_string(),
   '        Remote desktop........... ' + have_remote_desktop.to_string(),
   '        gudev.................... ' + have_libgudev.to_string(),
-  '        canberra................. ' + have_libcanberra.to_string(),
   '        Wacom.................... ' + have_libwacom.to_string(),
   '        SM....................... ' + have_sm.to_string(),
   '        Startup notification..... ' + have_startup_notification.to_string(),
diff --git a/meson_options.txt b/meson_options.txt
index 7626661d1..add49c866 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -81,12 +81,6 @@ option('pango_ft2',
   description: 'Enable PangoFt2 support'
 )
 
-option('libcanberra',
-  type: 'boolean',
-  value: true,
-  description: 'Enable libcanberra support'
-)
-
 option('startup_notification',
   type: 'boolean',
   value: true,
diff --git a/src/core/bell.c b/src/core/bell.c
index a4b049145..45564b174 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -51,9 +51,7 @@
 
 #include "core/bell.h"
 
-#ifdef HAVE_LIBCANBERRA
 #include <canberra-gtk.h>
-#endif
 
 #include "compositor/compositor-private.h"
 #include "core/util-private.h"
@@ -248,7 +246,6 @@ static gboolean
 bell_audible_notify (MetaDisplay *display,
                      MetaWindow  *window)
 {
-#ifdef HAVE_LIBCANBERRA
   ca_proplist *p;
   int res;
 
@@ -270,9 +267,6 @@ bell_audible_notify (MetaDisplay *display,
   ca_proplist_destroy (p);
 
   return res == CA_SUCCESS || res == CA_ERROR_DISABLED;
-#endif /* HAVE_LIBCANBERRA */
-
-  return FALSE;
 }
 
 gboolean
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 1f129fd12..0268266bb 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -37,9 +37,7 @@
 
 #include <X11/Xatom.h>
 #include <string.h>
-#ifdef HAVE_LIBCANBERRA
 #include <canberra-gtk.h>
-#endif
 
 #include "backends/meta-backend-private.h"
 #include "backends/meta-logical-monitor.h"
@@ -441,7 +439,6 @@ static void
 workspace_switch_sound(MetaWorkspace *from,
                        MetaWorkspace *to)
 {
-#ifdef HAVE_LIBCANBERRA
   MetaWorkspaceLayout layout;
   int i, nw, x, y, fi, ti;
   const char *e;
@@ -497,7 +494,6 @@ workspace_switch_sound(MetaWorkspace *from,
 
  finish:
   meta_workspace_manager_free_workspace_layout (&layout);
-#endif /* HAVE_LIBCANBERRA */
 }
 
 /**
diff --git a/src/meson.build b/src/meson.build
index 58134967b..e258d8d39 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -23,6 +23,7 @@ mutter_pkg_deps = [
   json_glib_dep,
   pango_dep,
   xkbcommon_dep,
+  libcanberra_gtk3_dep,
 ]
 
 if have_gl
@@ -56,12 +57,6 @@ if have_startup_notification
   ]
 endif
 
-if have_libcanberra
-  mutter_pkg_deps += [
-    libcanberra_gtk3_dep,
-  ]
-endif
-
 if have_libwacom
   mutter_pkg_deps += [
     libwacom_dep,
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 6f31f237f..47fb47f83 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -488,13 +488,9 @@ static void
 set_x11_bell_is_audible (MetaX11Display *x11_display,
                          gboolean is_audible)
 {
-#ifdef HAVE_LIBCANBERRA
   /* When we are playing sounds using libcanberra support, we handle the
    * bell whether its an audible bell or a visible bell */
   gboolean enable_system_bell = FALSE;
-#else
-  gboolean enable_system_bell = is_audible;
-#endif /* HAVE_LIBCANBERRA */
 
   XkbChangeEnabledControls (x11_display->xdisplay,
                             XkbUseCoreKbd,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]