[systemd-devel] [PATCH] buildsys: allow building without libnotify

Thierry Reding thierry.reding at avionic-design.de
Tue Nov 23 23:36:31 PST 2010


This patch makes the libnotify dependency optional and doesn't build the
systemd-gnome-ask-password-agent utility if libnotify is not available.

Since libnotify >= 0.7.0 requires gtk+-3.0, this patch may be useful for
environments where upgrading Gtk is not an option.
---
 Makefile.am  |    6 +++++-
 configure.ac |    5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 694ec57..2fa6ecb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,9 +95,13 @@ bin_PROGRAMS = \
 
 if HAVE_GTK
 bin_PROGRAMS += \
-	systemadm \
+	systemadm
+
+if HAVE_LIBNOTIFY
+bin_PROGRAMS += \
 	systemd-gnome-ask-password-agent
 endif
+endif
 
 rootlibexec_PROGRAMS = \
 	systemd-logger \
diff --git a/configure.ac b/configure.ac
index f9f5eee..b2e329e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -259,10 +259,12 @@ if test "$have_gtk" = "yes"; then
         AC_SUBST(DBUSGLIB_CFLAGS)
         AC_SUBST(DBUSGLIB_LIBS)
 
-        PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify >= 0.7.0 ])
+        PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify >= 0.7.0 ],
+                [AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if libnotify is available]) have_libnotify=yes], have_libnotify=no)
         AC_SUBST(LIBNOTIFY_CFLAGS)
         AC_SUBST(LIBNOTIFY_LIBS)
 fi
+AM_CONDITIONAL(HAVE_LIBNOTIFY, [test "$have_libnotify" = "yes"])
 
 AM_PROG_VALAC([0.11])
 AC_SUBST(VAPIDIR)
@@ -466,6 +468,7 @@ echo "
         SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
         Syslog service:          ${SPECIAL_SYSLOG_SERVICE}
         Gtk:                     ${have_gtk}
+        libnotify:               ${have_libnotify}
         libcryptsetup:           ${have_libcryptsetup}
         tcpwrap:                 ${have_tcpwrap}
         PAM:                     ${have_pam}



More information about the systemd-devel mailing list