[lxc-devel] [PATCH 2/6] Get systemd unit dir from pkg-config
Martin Pitt
martin.pitt at ubuntu.com
Thu Jul 31 06:53:52 UTC 2014
Don't install systemd unit files into $(prefix), they won't work there.
Instead, get them from systemd's pkg-config file.
---
config/init/systemd/Makefile.am | 2 --
configure.ac | 12 ++++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/config/init/systemd/Makefile.am b/config/init/systemd/Makefile.am
index fc374c5..3bd221f 100644
--- a/config/init/systemd/Makefile.am
+++ b/config/init/systemd/Makefile.am
@@ -3,8 +3,6 @@ EXTRA_DIST = \
lxc.service
if INIT_SCRIPT_SYSTEMD
-SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
-
lxc-autostart-helper: ../sysvinit/lxc.in $(top_builddir)/config.status
$(AM_V_GEN)sed \
-e 's|[@]SYSCONFDIR[@]|$(sysconfdir)|g' \
diff --git a/configure.ac b/configure.ac
index 23a5b01..ded4c48 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,6 +122,18 @@ AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
AC_MSG_RESULT($init_script)
+# systemd unit dir
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [],
+ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+if test -z "$with_systemdsystemunitdir"; then
+ with_systemdsystemunitdir=/lib/systemd/system
+fi
+if test "x$with_systemdsystemunitdir" != "xno"; then
+ AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
+fi
+
# Allow disabling rpath
AC_ARG_ENABLE([rpath],
[AC_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
--
2.0.1
More information about the lxc-devel
mailing list