From 2b5c1b0742cd109c0702b3051d12829b39e5af49 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 22 Sep 2017 09:57:35 +0200 Subject: autotools: Make systemd dependency optional. This makes libayatana-indicator available on Debian GNU/kFreeBSD and Debian GNU/Hurd. --- configure.ac | 16 +++++++++++++--- data/Makefile.am | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 7c1f13d..f47d852 100644 --- a/configure.ac +++ b/configure.ac @@ -71,9 +71,6 @@ AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3]) LT_LIB_M AC_SUBST(LIBM) -SYSTEMD_USERDIR=`$PKG_CONFIG --variable=systemduserunitdir systemd` -AC_SUBST(SYSTEMD_USERDIR) - ############################## # Custom Junk ############################## @@ -116,6 +113,19 @@ AC_DEFINE_PATH(PREFIX, "${prefix}", [prefix directory]) AC_DEFINE_PATH(SYSCONFDIR, "${sysconfdir}", [system configuration dir]) AC_DEFINE_PATH(LIBDIR, "${libdir}", [system configuration dir]) +######################### +# Check for systemd +######################### +PKG_CHECK_MODULES(SYSTEMD, systemd, + [has_systemd=yes], + [] +) +if test "x$has_systemd" = "xyes"; then + SYSTEMD_USERDIR=`$PKG_CONFIG --variable=systemduserunitdir systemd` + AC_SUBST(SYSTEMD_USERDIR) + AC_DEFINE(HAVE_SYSTEMD, 1, [create ayatana-indicators-pre.target for systemd]) +fi + ######################### # Check if build tests ######################### diff --git a/data/Makefile.am b/data/Makefile.am index 5a0f26e..55ae3ab 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,3 +1,5 @@ +#if defined(HAVE_SYSTEMD) systemd_DATA = ayatana-indicators-pre.target systemddir = $(SYSTEMD_USERDIR) EXTRA_DIST = $(systemd_DATA) +#endif -- cgit v1.2.3