commit fa1f2bbf636e614ed79d815c463c65dcd505be94
Author: Yaroslav Shmelev <yars068@yandex.ru>
Date:   Thu Jan 21 21:40:13 2016 +0300

    configure.ac: Add --with-systemduserunitdir option
    
    This option allows maiintainers to specify the directory that contain
    a systemd user units, or disable it. Default location for these units
    is /usr/lib/systemd/user. This patch will switch from hard-coded path
    to configurable one.
    
    For details, see https://bugzilla.gnome.org/show_bug.cgi?id=760293
    
         configure.ac                | 21 ++++++++++++++++++++-
         daemon/Makefile.am          |  4 +++-
         metadata/Makefile.am        |  4 +++-
         monitor/afc/Makefile.am     |  4 +++-
         monitor/gdu/Makefile.am     |  4 +++-
         monitor/goa/Makefile.am     |  4 +++-
         monitor/gphoto2/Makefile.am |  4 +++-
         monitor/hal/Makefile.am     |  4 +++-
         monitor/mtp/Makefile.am     |  4 +++-
         monitor/udisks2/Makefile.am |  4 +++-
         10 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1caad91..c4f7ce6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,6 +260,24 @@ fi
 
 AM_CONDITIONAL(USE_UDISKS2, [test "$msg_udisks2" = "yes"])
 
+dnl ************************************
+dnl *** Check for systemd user units ***
+dnl ************************************
+
+systemd_user_dir=
+AC_ARG_WITH([systemduserunitdir],
+        [AS_HELP_STRING([--with-systemduserunitdir=PATH],
+            [specify the location or disable systemd user units support])],
+        [systemd_user_dir=$withval],
+        [systemd_user_dir=/usr/lib/systemd/user])
+
+if test "x$systemd_user_dir" != "xno"; then
+    PKG_CHECK_MODULES([SYSTEMD], [systemd >= 206],
+        AC_SUBST(systemd_user_dir))
+fi
+
+AM_CONDITIONAL([USE_SYSTEMD_USER_UNITS], [test "x$systemd_user_dir" != "xno"])
+
 dnl **********************************
 dnl *** Check for libsystemd-login ***
 dnl **********************************
@@ -949,6 +967,7 @@ echo "
 	Build GDU volume monitor:     $msg_gdu
 	Build udisks2 volume monitor: $msg_udisks2
 	Build GOA volume monitor:     $msg_goa
+        Use systemd user units:       $systemd_user_dir
         Use libsystemd-login:         $msg_libsystemd_login
         Use GCR:                      $msg_gcr
 	GNOME Keyring support:        $msg_keyring
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 79113c7..a763e62 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -39,9 +39,11 @@ servicedir = $(DBUS_SERVICE_DIR)
 service_in_files = org.gtk.vfs.Daemon.service.in
 service_DATA = org.gtk.vfs.Daemon.service
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-daemon.service.in
 systemd_user_DATA = gvfs-daemon.service
+endif
 
 %.mount: %.mount.in ../config.log
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
diff --git a/metadata/Makefile.am b/metadata/Makefile.am
index e15e40e..fd7f186 100644
--- a/metadata/Makefile.am
+++ b/metadata/Makefile.am
@@ -72,9 +72,11 @@ servicedir = $(DBUS_SERVICE_DIR)
 service_in_files = org.gtk.vfs.Metadata.service.in
 service_DATA = org.gtk.vfs.Metadata.service
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-metadata.service.in
 systemd_user_DATA = gvfs-metadata.service
+endif
 
 EXTRA_DIST =				\
 	$(service_in_files)		\
diff --git a/monitor/afc/Makefile.am b/monitor/afc/Makefile.am
index bde7a90..97fa8ad 100644
--- a/monitor/afc/Makefile.am
+++ b/monitor/afc/Makefile.am
@@ -35,9 +35,11 @@ servicedir = $(datadir)/dbus-1/services
 service_in_files = org.gtk.vfs.AfcVolumeMonitor.service.in
 service_DATA = $(service_in_files:.service.in=.service)
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-afc-volume-monitor.service.in
 systemd_user_DATA = $(systemd_user_in_files:.service.in=.service)
+endif
 
 $(service_DATA): $(service_in_files) Makefile
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
diff --git a/monitor/gdu/Makefile.am b/monitor/gdu/Makefile.am
index 0c5c4e8..3eb2f2b 100644
--- a/monitor/gdu/Makefile.am
+++ b/monitor/gdu/Makefile.am
@@ -43,9 +43,11 @@ servicedir       = $(datadir)/dbus-1/services
 service_in_files = org.gtk.vfs.GduVolumeMonitor.service.in
 service_DATA     = $(service_in_files:.service.in=.service)
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-gdu-volume-monitor.service.in
 systemd_user_DATA = $(systemd_user_in_files:.service.in=.service)
+endif
 
 $(service_DATA): $(service_in_files) Makefile
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
diff --git a/monitor/goa/Makefile.am b/monitor/goa/Makefile.am
index c1c45d9..d991b95 100644
--- a/monitor/goa/Makefile.am
+++ b/monitor/goa/Makefile.am
@@ -35,9 +35,11 @@ servicedir = $(datadir)/dbus-1/services
 service_in_files = org.gtk.vfs.GoaVolumeMonitor.service.in
 service_DATA = $(service_in_files:.service.in=.service)
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-goa-volume-monitor.service.in
 systemd_user_DATA = $(systemd_user_in_files:.service.in=.service)
+endif
 
 $(service_DATA): $(service_in_files) Makefile
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
diff --git a/monitor/gphoto2/Makefile.am b/monitor/gphoto2/Makefile.am
index 723fbbc..010b5af 100644
--- a/monitor/gphoto2/Makefile.am
+++ b/monitor/gphoto2/Makefile.am
@@ -77,9 +77,11 @@ servicedir       = $(datadir)/dbus-1/services
 service_in_files = org.gtk.vfs.GPhoto2VolumeMonitor.service.in
 service_DATA     = $(service_in_files:.service.in=.service)
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-gphoto2-volume-monitor.service.in
 systemd_user_DATA = $(systemd_user_in_files:.service.in=.service)
+endif
 
 $(service_DATA): $(service_in_files) Makefile
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
diff --git a/monitor/hal/Makefile.am b/monitor/hal/Makefile.am
index 888268f..3abf74e 100644
--- a/monitor/hal/Makefile.am
+++ b/monitor/hal/Makefile.am
@@ -56,9 +56,11 @@ servicedir       = $(datadir)/dbus-1/services
 service_in_files = org.gtk.vfs.HalVolumeMonitor.service.in
 service_DATA     = $(service_in_files:.service.in=.service)
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-hal-volume-monitor.service.in
 systemd_user_DATA = $(systemd_user_in_files:.service.in=.service)
+endif
 
 $(service_DATA): $(service_in_files) Makefile
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
diff --git a/monitor/mtp/Makefile.am b/monitor/mtp/Makefile.am
index 98e64b3..d7a7c6f 100644
--- a/monitor/mtp/Makefile.am
+++ b/monitor/mtp/Makefile.am
@@ -40,9 +40,11 @@ servicedir       = $(datadir)/dbus-1/services
 service_in_files = org.gtk.vfs.MTPVolumeMonitor.service.in
 service_DATA     = $(service_in_files:.service.in=.service)
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-mtp-volume-monitor.service.in
 systemd_user_DATA = $(systemd_user_in_files:.service.in=.service)
+endif
 
 $(service_DATA): $(service_in_files) Makefile
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
diff --git a/monitor/udisks2/Makefile.am b/monitor/udisks2/Makefile.am
index 5c0a801..1824e26 100644
--- a/monitor/udisks2/Makefile.am
+++ b/monitor/udisks2/Makefile.am
@@ -48,9 +48,11 @@ servicedir       = $(datadir)/dbus-1/services
 service_in_files = org.gtk.vfs.UDisks2VolumeMonitor.service.in
 service_DATA     = $(service_in_files:.service.in=.service)
 
-systemd_userdir = ${prefix}/lib/systemd/user
+if USE_SYSTEMD_USER_UNITS
+systemd_userdir = @systemd_user_dir@
 systemd_user_in_files = gvfs-udisks2-volume-monitor.service.in
 systemd_user_DATA = $(systemd_user_in_files:.service.in=.service)
+endif
 
 $(service_DATA): $(service_in_files) Makefile
 	$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
