[gnome-settings-daemon] build: Clean up X11 library dependencies
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] build: Clean up X11 library dependencies
- Date: Wed, 7 Sep 2011 14:44:29 +0000 (UTC)
commit 34bf5fc0136e15e7a70d36c6573d3606502a275e
Author: Bastien Nocera <hadess hadess net>
Date: Wed Sep 7 15:35:12 2011 +0100
build: Clean up X11 library dependencies
And make them per-plugin instead of as broad as before.
https://bugzilla.gnome.org/show_bug.cgi?id=657178
configure.ac | 72 ++++++------------------------
plugins/automount/Makefile.am | 11 +++--
plugins/background/Makefile.am | 9 ++--
plugins/common/Makefile.am | 7 +--
plugins/common/gsd-keygrab.c | 8 ---
plugins/cursor/Makefile.am | 4 +-
plugins/keyboard/Makefile.am | 4 +-
plugins/keyboard/gsd-keyboard-manager.c | 23 +---------
plugins/media-keys/Makefile.am | 3 -
plugins/mouse/Makefile.am | 9 ++--
plugins/orientation/Makefile.am | 6 +--
plugins/wacom/Makefile.am | 1 -
12 files changed, 39 insertions(+), 118 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b4ddc21..8cac11d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,64 +158,34 @@ fi
AC_SUBST(DBUS_SYS_DIR)
dnl ---------------------------------------------------------------------------
-dnl - X11 stuff
+dnl - common
dnl ---------------------------------------------------------------------------
-# Like AC_CHECK_HEADERS, but it uses the already-computed -I directories.
-#
-AC_DEFUN([AC_CHECK_X_HEADERS], [
- ac_save_CPPFLAGS="$CPPFLAGS"
- if test \! -z "$includedir" ; then
- CPPFLAGS="$CPPFLAGS -I$includedir"
- fi
- CPPFLAGS="$CPPFLAGS $X_CFLAGS"
- AC_CHECK_HEADERS([$1],[$2],[$3],[$4])
- CPPFLAGS="$ac_save_CPPFLAGS"])
-
-# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
-# Use this sparingly; it probably doesn't work very well on X programs.
-#
-AC_DEFUN([AC_CHECK_X_LIB], [
- ac_save_CPPFLAGS="$CPPFLAGS"
- ac_save_LDFLAGS="$LDFLAGS"
-# ac_save_LIBS="$LIBS"
+PKG_CHECK_MODULES(COMMON, x11 kbproto xi)
- if test \! -z "$includedir" ; then
- CPPFLAGS="$CPPFLAGS -I$includedir"
- fi
- # note: $X_CFLAGS includes $x_includes
- CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
- if test \! -z "$libdir" ; then
- LDFLAGS="$LDFLAGS -L$libdir"
- fi
- # note: $X_LIBS includes $x_libraries
- LDFLAGS="$LDFLAGS $ALL_X_LIBS"
-
- AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
- CPPFLAGS="$ac_save_CPPFLAGS"
- LDFLAGS="$ac_save_LDFLAGS"
-# LIBS="$ac_save_LIBS"
- ])
+dnl ---------------------------------------------------------------------------
+dnl - automount
+dnl ---------------------------------------------------------------------------
-AC_PATH_XTRA
+PKG_CHECK_MODULES(AUTOMOUNT, x11 kbproto)
-ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
+dnl ---------------------------------------------------------------------------
+dnl - background
+dnl ---------------------------------------------------------------------------
-X11_LIBS="$ALL_X_LIBS"
-AC_SUBST(X11_LIBS)
+PKG_CHECK_MODULES(BACKGROUND, x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
dnl ---------------------------------------------------------------------------
-dnl - XInput
+dnl - mouse
dnl ---------------------------------------------------------------------------
-PKG_CHECK_MODULES(XINPUT, xi)
+PKG_CHECK_MODULES(MOUSE, x11 xi)
dnl ---------------------------------------------------------------------------
-dnl - XFixes
+dnl - cursor
dnl ---------------------------------------------------------------------------
-PKG_CHECK_MODULES(XFIXES, xfixes)
+PKG_CHECK_MODULES(CURSOR, xfixes)
dnl ---------------------------------------------------------------------------
dnl - Fontconfig
@@ -227,26 +197,14 @@ dnl ---------------------------------------------------------------------------
dnl - Keyboard plugin stuff
dnl ---------------------------------------------------------------------------
-AC_CHECK_X_LIB(Xxf86misc, XF86MiscQueryExtension, [
- AC_CHECK_X_HEADERS([X11/extensions/xf86misc.h],
- [XF86MISC_LIBS="-lXxf86misc"], :,
- [#include <X11/Xlib.h>])], : ,
- -lXxf86misc $x_libs)
-AC_SUBST(XF86MISC_LIBS)
-AC_CHECK_X_HEADERS([X11/extensions/XKB.h])
-
LIBGNOMEKBD_REQUIRED=2.91.1
-PKG_CHECK_MODULES(LIBGNOMEKBDUI, [libgnomekbdui >= $LIBGNOMEKBD_REQUIRED libgnomekbd >= $LIBGNOMEKBD_REQUIRED libxklavier >= 5.0])
-AC_SUBST(LIBGNOMEKBDUI_CFLAGS)
-AC_SUBST(LIBGNOMEKBDUI_LIBS)
+PKG_CHECK_MODULES(KEYBOARD, [libgnomekbdui >= $LIBGNOMEKBD_REQUIRED libgnomekbd >= $LIBGNOMEKBD_REQUIRED libxklavier >= 5.0 kbproto])
dnl ---------------------------------------------------------------------------
dnl - Housekeeping plugin stuff
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(GIOUNIX, [gio-unix-2.0])
-AC_SUBST(GIOUNIX_CFLAGS)
-AC_SUBST(GIOUNIX_LIBS)
dnl ---------------------------------------------------------------------------
dnl - GConf<->GSettings bridge
diff --git a/plugins/automount/Makefile.am b/plugins/automount/Makefile.am
index c12660b..64164b9 100644
--- a/plugins/automount/Makefile.am
+++ b/plugins/automount/Makefile.am
@@ -12,12 +12,13 @@ gnome_fallback_mount_helper_CPPFLAGS = \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
$(AM_CPPFLAGS)
-gnome_fallback_mount_helper_CFLAGS = \
- $(SETTINGS_PLUGIN_CFLAGS)
+gnome_fallback_mount_helper_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(AUTOMOUNT_CFLAGS)
-gnome_fallback_mount_helper_LDADD = \
- $(SETTINGS_PLUGIN_LIBS) \
- $(X11_LIBS) \
+gnome_fallback_mount_helper_LDADD = \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(AUTOMOUNT_LIBS) \
$(top_builddir)/gnome-settings-daemon/libgsd-profile.la
autostartdir = $(sysconfdir)/xdg/autostart
diff --git a/plugins/background/Makefile.am b/plugins/background/Makefile.am
index 9023dfc..f3bca03 100644
--- a/plugins/background/Makefile.am
+++ b/plugins/background/Makefile.am
@@ -20,14 +20,13 @@ test_background_CPPFLAGS = \
test_background_CFLAGS = \
$(PLUGIN_CFLAGS) \
$(SETTINGS_PLUGIN_CFLAGS) \
- $(GNOME_DESKTOP_CFLAGS) \
+ $(BACKGROUND_CFLAGS) \
$(AM_CFLAGS)
test_background_LDADD = \
$(top_builddir)/gnome-settings-daemon/libgsd-profile.la \
$(SETTINGS_PLUGIN_LIBS) \
- $(GNOME_DESKTOP_LIBS) \
- $(X11_LIBS) \
+ $(BACKGROUND_LIBS) \
$(NULL)
plugin_LTLIBRARIES = \
@@ -49,7 +48,7 @@ libbackground_la_CPPFLAGS = \
libbackground_la_CFLAGS = \
$(SETTINGS_PLUGIN_CFLAGS) \
- $(GNOME_DESKTOP_CFLAGS) \
+ $(BACKGROUND_CFLAGS) \
$(AM_CFLAGS)
libbackground_la_LDFLAGS = \
@@ -58,7 +57,7 @@ libbackground_la_LDFLAGS = \
libbackground_la_LIBADD = \
$(SETTINGS_PLUGIN_LIBS) \
- $(GNOME_DESKTOP_LIBS) \
+ $(BACKGROUND_LIBS) \
$(NULL)
plugin_in_files = \
diff --git a/plugins/common/Makefile.am b/plugins/common/Makefile.am
index 6226b11..21dd1e4 100644
--- a/plugins/common/Makefile.am
+++ b/plugins/common/Makefile.am
@@ -16,7 +16,7 @@ libcommon_la_CPPFLAGS = \
libcommon_la_CFLAGS = \
$(PLUGIN_CFLAGS) \
$(SETTINGS_PLUGIN_CFLAGS) \
- $(XINPUT_CFLAGS) \
+ $(COMMON_CFLAGS) \
$(AM_CFLAGS)
libcommon_la_LDFLAGS = \
@@ -24,8 +24,7 @@ libcommon_la_LDFLAGS = \
libcommon_la_LIBADD = \
$(SETTINGS_PLUGIN_LIBS) \
- $(XINPUT_LIBS) \
- $(X11_LIBS)
+ $(COMMON_LIBS)
noinst_PROGRAMS = test-input-helper test-egg-key-parsing
@@ -34,7 +33,7 @@ test_input_helper_LDADD = libcommon.la
test_input_helper_CFLAGS = $(libcommon_la_CFLAGS)
test_egg_key_parsing_SOURCES = test-egg-key-parsing.c
-test_egg_key_parsing_LDADD = libcommon.la
+test_egg_key_parsing_LDADD = libcommon.la $(COMMON_LIBS)
test_egg_key_parsing_CFLAGS = $(libcommon_la_CFLAGS)
scriptsdir = $(datadir)/gnome-settings-daemon- GSD_API_VERSION@
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
index 1d50a22..0ea4270 100644
--- a/plugins/common/gsd-keygrab.c
+++ b/plugins/common/gsd-keygrab.c
@@ -24,11 +24,9 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
#include <X11/XKBlib.h>
#include <X11/extensions/XKB.h>
#include <gdk/gdkkeysyms.h>
-#endif
#include "eggaccelerators.h"
@@ -211,7 +209,6 @@ have_xkb (Display *dpy)
static int have_xkb = -1;
if (have_xkb == -1) {
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
int opcode, error_base, major, minor, xkb_event_base;
have_xkb = XkbQueryExtension (dpy,
@@ -221,9 +218,6 @@ have_xkb (Display *dpy)
&major,
&minor)
&& XkbUseExtension (dpy, &major, &minor);
-#else
- have_xkb = 0;
-#endif
}
return have_xkb;
@@ -255,11 +249,9 @@ match_key (Key *key, XEvent *event)
setup_modifiers ();
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
if (have_xkb (event->xkey.display))
group = XkbGroupForCoreState (event->xkey.state);
else
-#endif
group = (event->xkey.state & GDK_KEY_Mode_switch) ? 1 : 0;
/* Check if we find a keysym that matches our current state */
diff --git a/plugins/cursor/Makefile.am b/plugins/cursor/Makefile.am
index 4808558..2787d5d 100644
--- a/plugins/cursor/Makefile.am
+++ b/plugins/cursor/Makefile.am
@@ -17,7 +17,7 @@ libcursor_la_CPPFLAGS = \
libcursor_la_CFLAGS = \
$(PLUGIN_CFLAGS) \
- $(XFIXES_CFLAGS) \
+ $(CURSOR_CFLAGS) \
$(SETTINGS_PLUGIN_CFLAGS) \
$(AM_CFLAGS)
@@ -26,7 +26,7 @@ libcursor_la_LDFLAGS = \
libcursor_la_LIBADD = \
$(top_builddir)/plugins/common/libcommon.la \
- $(XFIXES_LIBS) \
+ $(CURSOR_LIBS) \
$(SETTINGS_PLUGIN_LIBS)
plugin_in_files = \
diff --git a/plugins/keyboard/Makefile.am b/plugins/keyboard/Makefile.am
index e4926f0..da59e83 100644
--- a/plugins/keyboard/Makefile.am
+++ b/plugins/keyboard/Makefile.am
@@ -36,7 +36,7 @@ libkeyboard_la_CPPFLAGS = \
libkeyboard_la_CFLAGS = \
$(PLUGIN_CFLAGS) \
$(SETTINGS_PLUGIN_CFLAGS) \
- $(LIBGNOMEKBDUI_CFLAGS) \
+ $(KEYBOARD_CFLAGS) \
$(AM_CFLAGS)
libkeyboard_la_LDFLAGS = \
@@ -46,7 +46,7 @@ libkeyboard_la_LDFLAGS = \
libkeyboard_la_LIBADD = \
$(SETTINGS_PLUGIN_LIBS) \
$(XF86MISC_LIBS) \
- $(LIBGNOMEKBDUI_LIBS) \
+ $(KEYBOARD_LIBS) \
$(NULL)
plugin_in_files = \
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index f842f75..00398a5 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -37,10 +37,8 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
#include <X11/XKBlib.h>
#include <X11/keysym.h>
-#endif
#include "gnome-settings-profile.h"
#include "gsd-keyboard-manager.h"
@@ -83,7 +81,6 @@ G_DEFINE_TYPE (GsdKeyboardManager, gsd_keyboard_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
static gboolean
xkb_set_keyboard_autorepeat_rate (guint delay, guint interval)
{
@@ -92,7 +89,6 @@ xkb_set_keyboard_autorepeat_rate (guint delay, guint interval)
delay,
interval);
}
-#endif
static char *
gsd_keyboard_get_hostname_key (void)
@@ -122,8 +118,6 @@ gsd_keyboard_get_hostname_key (void)
return NULL;
}
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
-
typedef enum {
NUMLOCK_STATE_OFF = 0,
NUMLOCK_STATE_ON = 1,
@@ -242,8 +236,6 @@ numlock_install_xkb_callback (GsdKeyboardManager *manager)
manager);
}
-#endif /* HAVE_X11_EXTENSIONS_XKB_H */
-
static guint
_gsd_settings_get_uint (GSettings *settings,
const char *key)
@@ -269,9 +261,7 @@ apply_settings (GSettings *settings,
int bell_pitch;
int bell_duration;
GsdBellMode bell_mode;
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
gboolean rnumlock;
-#endif /* HAVE_X11_EXTENSIONS_XKB_H */
repeat = g_settings_get_boolean (settings, KEY_REPEAT);
click = g_settings_get_boolean (settings, KEY_CLICK);
@@ -284,9 +274,7 @@ apply_settings (GSettings *settings,
bell_mode = g_settings_get_enum (settings, KEY_BELL_MODE);
bell_volume = (bell_mode == GSD_BELL_MODE_ON) ? 50 : 0;
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
rnumlock = g_settings_get_boolean (settings, "remember-numlock-state");
-#endif /* HAVE_X11_EXTENSIONS_XKB_H */
gdk_error_trap_push ();
if (repeat) {
@@ -294,9 +282,8 @@ apply_settings (GSettings *settings,
XAutoRepeatOn (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
/* Use XKB in preference */
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
rate_set = xkb_set_keyboard_autorepeat_rate (delay, interval);
-#endif
+
if (!rate_set)
g_warning ("Neither XKeyboard not Xfree86's keyboard extensions are available,\n"
"no way to support keyboard autorepeat rate settings");
@@ -318,11 +305,9 @@ apply_settings (GSettings *settings,
KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration,
&kbdcontrol);
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
if (manager->priv->have_xkb && rnumlock) {
numlock_set_xkb_state (numlock_get_gsettings_state (manager->priv->settings));
}
-#endif /* HAVE_X11_EXTENSIONS_XKB_H */
XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
gdk_error_trap_pop_ignored ();
@@ -347,9 +332,7 @@ start_keyboard_idle_cb (GsdKeyboardManager *manager)
/* Essential - xkb initialization should happen before */
gsd_keyboard_xkb_init (manager);
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
numlock_xkb_init (manager);
-#endif /* HAVE_X11_EXTENSIONS_XKB_H */
/* apply current settings before we install the callback */
gsd_keyboard_manager_apply_settings (manager);
@@ -357,9 +340,7 @@ start_keyboard_idle_cb (GsdKeyboardManager *manager)
g_signal_connect (G_OBJECT (manager->priv->settings), "changed",
G_CALLBACK (apply_settings), manager);
-#ifdef HAVE_X11_EXTENSIONS_XKB_H
numlock_install_xkb_callback (manager);
-#endif /* HAVE_X11_EXTENSIONS_XKB_H */
gnome_settings_profile_end (NULL);
@@ -393,13 +374,11 @@ gsd_keyboard_manager_stop (GsdKeyboardManager *manager)
p->settings = NULL;
}
-#if HAVE_X11_EXTENSIONS_XKB_H
if (p->have_xkb) {
gdk_window_remove_filter (NULL,
numlock_xkb_callback,
manager);
}
-#endif /* HAVE_X11_EXTENSIONS_XKB_H */
gsd_keyboard_xkb_shutdown ();
}
diff --git a/plugins/media-keys/Makefile.am b/plugins/media-keys/Makefile.am
index 9d8ed1c..ad286da 100644
--- a/plugins/media-keys/Makefile.am
+++ b/plugins/media-keys/Makefile.am
@@ -105,7 +105,6 @@ libmedia_keys_la_LIBADD = \
$(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la \
$(UPOWER_LIBS) \
$(SETTINGS_PLUGIN_LIBS) \
- $(XF86MISC_LIBS) \
-lm
plugin_in_files = \
@@ -147,7 +146,6 @@ test_media_window_LDADD = \
$(top_builddir)/plugins/common/libcommon.la \
$(SETTINGS_DAEMON_LIBS) \
$(SETTINGS_PLUGIN_LIBS) \
- $(XF86MISC_LIBS) \
$(GST_LIBS) \
-lm
@@ -183,7 +181,6 @@ test_media_keys_LDADD = \
$(SETTINGS_DAEMON_LIBS) \
$(SETTINGS_PLUGIN_LIBS) \
$(UPOWER_LIBS) \
- $(XF86MISC_LIBS) \
$(GST_LIBS) \
-lm
diff --git a/plugins/mouse/Makefile.am b/plugins/mouse/Makefile.am
index 9feca5f..8299cd4 100644
--- a/plugins/mouse/Makefile.am
+++ b/plugins/mouse/Makefile.am
@@ -19,16 +19,16 @@ libmouse_la_CPPFLAGS = \
libmouse_la_CFLAGS = \
$(PLUGIN_CFLAGS) \
$(SETTINGS_PLUGIN_CFLAGS) \
+ $(MOUSE_CFLAGS) \
$(AM_CFLAGS)
libmouse_la_LDFLAGS = \
$(GSD_PLUGIN_LDFLAGS)
libmouse_la_LIBADD = \
+ $(MOUSE_LIBS) \
$(top_builddir)/plugins/common/libcommon.la \
- $(SETTINGS_PLUGIN_LIBS) \
- $(X11_LIBS) \
- $(XINPUT_LIBS)
+ $(SETTINGS_PLUGIN_LIBS)
plugin_in_files = mouse.gnome-settings-plugin.in
@@ -44,11 +44,12 @@ gsd_locate_pointer_SOURCES = \
gsd_locate_pointer_CFLAGS = \
$(SETTINGS_PLUGIN_CFLAGS) \
+ $(MOUSE_CFLAGS) \
$(AM_CFLAGS)
gsd_locate_pointer_LDADD = \
$(SETTINGS_PLUGIN_LIBS) \
- $(X11_LIBS) \
+ $(MOUSE_LIBS) \
-lm
EXTRA_DIST = $(plugin_in_files)
diff --git a/plugins/orientation/Makefile.am b/plugins/orientation/Makefile.am
index 1b12ff2..9a825de 100644
--- a/plugins/orientation/Makefile.am
+++ b/plugins/orientation/Makefile.am
@@ -13,7 +13,6 @@ test_orientation_CFLAGS = \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
$(GNOME_DESKTOP_CFLAGS) \
$(GUDEV_CFLAGS) \
- $(XINPUT_CFLAGS) \
$(PLUGIN_CFLAGS) \
$(SETTINGS_PLUGIN_CFLAGS) \
$(AM_CFLAGS)
@@ -22,7 +21,6 @@ test_orientation_LDADD = \
$(top_builddir)/gnome-settings-daemon/libgsd-profile.la \
$(top_builddir)/plugins/common/libcommon.la \
$(GUDEV_LIBS) \
- $(XINPUT_LIBS) \
$(SETTINGS_PLUGIN_LIBS)
plugin_LTLIBRARIES = liborientation.la
@@ -54,9 +52,7 @@ liborientation_la_LDFLAGS = \
liborientation_la_LIBADD = \
$(top_builddir)/plugins/common/libcommon.la \
$(GUDEV_LIBS) \
- $(SETTINGS_PLUGIN_LIBS) \
- $(X11_LIBS) \
- $(XINPUT_LIBS)
+ $(SETTINGS_PLUGIN_LIBS)
plugin_in_files = orientation.gnome-settings-plugin.in
diff --git a/plugins/wacom/Makefile.am b/plugins/wacom/Makefile.am
index 6a765c1..2880b70 100644
--- a/plugins/wacom/Makefile.am
+++ b/plugins/wacom/Makefile.am
@@ -27,7 +27,6 @@ libwacom_la_LDFLAGS = \
libwacom_la_LIBADD = \
$(top_builddir)/plugins/common/libcommon.la \
$(SETTINGS_PLUGIN_LIBS) \
- $(X11_LIBS) \
$(XINPUT_LIBS)
plugin_in_files = wacom.gnome-settings-plugin.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]