summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2011-08-31 18:02:53 +0200
committerGaetan Nadon <memsize@videotron.ca>2011-08-31 19:05:14 -0400
commit0782f1c24c658c06736907dd143f8e67359ac235 (patch)
treebbf8e7cc93916e8deaf59bdbbaac7ceca7e5f501
parent5574b79c2d6c89f96484b890872ba1594fb6ddd2 (diff)
Support installing systemd unit file.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38339 Signed-off-by: Michał Górny <mgorny@gentoo.org> Reviewed-by: Gaetan Nadon <memsize@videotron.ca> Tested-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am13
-rw-r--r--configure.ac21
-rw-r--r--xdm.service.in9
4 files changed, 43 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index fbf6b92..c51052d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,3 +76,4 @@ core
# Edit the following section as needed
# For example, !report.pc overrides *.pc. See 'man gitignore'
#
+xdm.service
diff --git a/Makefile.am b/Makefile.am
index 0bd7ca9..e5f9f5c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,9 @@ SUBDIRS = app-defaults chooser config greeter include man xdm xdmshell
ACLOCAL_AMFLAGS = -I m4
# This ensures distcheck is performed in a location where user has write access
-DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults
+DISTCHECK_CONFIGURE_FLAGS = \
+ --with-appdefaultdir=\$${datadir}/X11/app-defaults \
+ --with-systemdsystemunitdir=\$${libdir}/systemd/system
if LINT
ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
@@ -38,6 +40,15 @@ lint:
(cd chooser && $(MAKE) $(AM_MAKEFLAGS) lint)
endif LINT
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = xdm.service
+
+xdm.service: xdm.service.in
+ $(AM_V_GEN)$(SED) -e 's|BINDIR|$(bindir)|g' < $< > $@
+endif HAVE_SYSTEMD
+CLEANFILES = xdm.service
+EXTRA_DIST = xdm.service.in
+
MAINTAINERCLEANFILES = ChangeLog INSTALL
.PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index 0c79999..2485288 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,27 @@ if test "x$USE_SELINUX" != "xno" ; then
)
fi
+# Check whether to install systemd unit files, as suggested in daemon(7).
+AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
+ [Directory for systemd service files (default from the System and Service Manager)]),,
+ [with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
+ def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+
+ AS_IF([test "x$def_systemdsystemunitdir" = "x"], [
+ AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], [
+ AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])
+ ])
+ with_systemdsystemunitdir=no
+ ], [
+ with_systemdsystemunitdir=$def_systemdsystemunitdir
+ ])
+])
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+])
+AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$with_systemdsystemunitdir" != "xno"])
+
# FIXME: Find better test for which OS'es use su -m - for now, just try to
# mirror the Imakefile setting of:
# if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || defined(FreeBSDArchitecture) || defined(DarwinArchitecture)
diff --git a/xdm.service.in b/xdm.service.in
new file mode 100644
index 0000000..d15e072
--- /dev/null
+++ b/xdm.service.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=X-Window Display Manager
+After=systemd-user-sessions.service
+
+[Service]
+ExecStart=BINDIR/xdm -nodaemon
+
+[Install]
+Alias=graphical.target.wants/xdm.service