From 05f7c359ae59cbcf9890dddf27dd4362269459c8 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 23 Feb 2012 00:20:15 +0100 Subject: make gudev dep optional Debian has arches w/o udev (hurd-*, kfreebsd-*). These cannot build indicator-session currently because libgudev-1.0-dev is missing there. Make the gudev dep optional and thus make indicator-session buildable on non-Linux arches again. --- configure.ac | 12 +++++++++--- src/Makefile.am | 15 +++++++++++++-- src/device-menu-mgr.c | 2 ++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 8d02d69..0c2a9f8 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,6 @@ AS_IF([test "x$with_gtk" = x3], [PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION dbus-glib-1 - gudev-1.0 gio-unix-2.0 indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION packagekit-glib2) @@ -69,7 +68,6 @@ AS_IF([test "x$with_gtk" = x3], [test "x$with_gtk" = x2], [PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - gudev-1.0 dbus-glib-1 gio-unix-2.0 indicator-0.4 >= $INDICATOR_REQUIRED_VERSION @@ -80,6 +78,10 @@ AS_IF([test "x$with_gtk" = x3], AC_SUBST(SESSIONERVICE_CFLAGS) AC_SUBST(SESSIONERVICE_LIBS) +PKG_CHECK_MODULES(GUDEV, gudev-1.0, has_gudev=true, has_gudev=false) +AC_SUBST(GUDEV_CFLAGS) +AC_SUBST(GUDEV_LIBS) + AM_CONDITIONAL([USE_GTK3], [test "x$with_gtk" = "x3"]) AS_IF([test "x$with_gtk" = x3], [ AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available]) @@ -199,7 +201,9 @@ AM_GLIB_GNU_GETTEXT # Files ########################### -AC_OUTPUT([ +AM_CONDITIONAL([HAS_GUDEV], [test "x$has_gudev" = "xtrue"]) + +AC_CONFIG_FILES([ Makefile src/Makefile data/Makefile @@ -223,6 +227,8 @@ data/extra-sessions/Makefile po/Makefile.in ]) +AC_OUTPUT + ########################### # Results ########################### diff --git a/src/Makefile.am b/src/Makefile.am index 67a1cb6..04801b5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -107,8 +107,6 @@ indicator_session_service_SOURCES = \ user-menu-mgr.c \ device-menu-mgr.h \ device-menu-mgr.c \ - udev-mgr.h \ - udev-mgr.c \ sane-rules.h if BUILD_APT @@ -117,6 +115,12 @@ indicator_session_service_SOURCES += \ apt-watcher.c endif +if HAS_GUDEV +indicator_session_service_SOURCES += \ + udev-mgr.h \ + udev-mgr.c +endif + indicator_session_service_CFLAGS = \ $(SESSIONSERVICE_CFLAGS) \ $(GCONF_CFLAGS) \ @@ -127,6 +131,13 @@ indicator_session_service_LDADD = \ $(SESSIONSERVICE_LIBS) \ $(GCONF_LIBS) +if HAS_GUDEV +indicator_session_service_CFLAGS += \ + $(GUDEV_CFLAGS) +indicator_session_service_LDADD += \ + $(GUDEV_LIBS) +endif + ################# # GTK Logout Stuff ################# diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c index f8f0696..8e0713e 100644 --- a/src/device-menu-mgr.c +++ b/src/device-menu-mgr.c @@ -733,8 +733,10 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self, gboolean greeter_mode) restart_shutdown_logout_mi->shutdown_mi = shutdown_mi; update_menu_entries(restart_shutdown_logout_mi); +#ifdef HAS_GUDEV // Time to create the udev mgr and hand it the static relevant items. self->udev_mgr = udev_mgr_new (scanners_menuitem, webcam_menuitem); +#endif } static void -- cgit v1.2.3 From cc124ba5add6debff0f4053f43e3f2e160b2039c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 23 Feb 2012 08:38:00 -0600 Subject: Making sure to distribute the files even if we don't use them to build. --- src/Makefile.am | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 04801b5..4da3fc5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,6 @@ +EXTRA_DIST = + libexec_PROGRAMS = \ indicator-session-service @@ -113,12 +115,20 @@ if BUILD_APT indicator_session_service_SOURCES += \ apt-watcher.h \ apt-watcher.c +else +EXTRA_DIST += \ + apt-watcher.h \ + apt-watcher.c endif if HAS_GUDEV indicator_session_service_SOURCES += \ udev-mgr.h \ udev-mgr.c +else +EXTRA_DIST += \ + udev-mgr.h \ + udev-mgr.c endif indicator_session_service_CFLAGS = \ @@ -179,7 +189,7 @@ BUILT_SOURCES = \ accounts-service-client.h \ accounts-service-user-client.h -EXTRA_DIST = \ +EXTRA_DIST += \ org.freedesktop.ConsoleKit.Manager.xml \ org.freedesktop.ConsoleKit.Seat.xml \ org.freedesktop.ConsoleKit.Session.xml \ -- cgit v1.2.3 From 76e3d09219f1dd4f7dcb1e99dcaec562ff7cdcaf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 23 Feb 2012 08:39:11 -0600 Subject: Move the variables into the list straight up as they'll be NULL if undefined --- src/Makefile.am | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 4da3fc5..a1e443e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -136,17 +136,12 @@ indicator_session_service_CFLAGS = \ $(GCONF_CFLAGS) \ -DLIBEXECDIR=\"$(libexecdir)\" \ -Wall -Werror \ - -DG_LOG_DOMAIN=\"Indicator-Session\" + -DG_LOG_DOMAIN=\"Indicator-Session\" \ + $(GUDEV_CFLAGS) indicator_session_service_LDADD = \ $(SESSIONSERVICE_LIBS) \ - $(GCONF_LIBS) - -if HAS_GUDEV -indicator_session_service_CFLAGS += \ - $(GUDEV_CFLAGS) -indicator_session_service_LDADD += \ + $(GCONF_LIBS) \ $(GUDEV_LIBS) -endif ################# # GTK Logout Stuff -- cgit v1.2.3 From 68cf3cfad3861048d620b2486abf47d5a3ce2886 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 23 Feb 2012 08:40:17 -0600 Subject: Don't include the header or the variable if we're not using GUDev --- src/device-menu-mgr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c index 8e0713e..cfdb55d 100644 --- a/src/device-menu-mgr.c +++ b/src/device-menu-mgr.c @@ -31,7 +31,9 @@ with this program. If not, see . #include "apt-watcher.h" #endif /* HAVE_APT */ +#ifdef HAS_GUDEV #include "udev-mgr.h" +#endif /* HAS_GUDEV */ #define UP_ADDRESS "org.freedesktop.UPower" #define UP_OBJECT "/org/freedesktop/UPower" @@ -47,7 +49,9 @@ struct _DeviceMenuMgr #ifdef HAVE_APT AptWatcher* apt_watcher; #endif /* HAVE_APT */ +#ifdef HAS_GUDEV UdevMgr* udev_mgr; +#endif /* HAS_GUDEV */ }; static GSettings *lockdown_settings = NULL; -- cgit v1.2.3