[lxc-devel] [PATCH 2/6] Get systemd unit dir from pkg-config

Dwight Engen dwight.engen at oracle.com
Mon Aug 11 14:41:16 UTC 2014


On Thu, 31 Jul 2014 08:53:52 +0200
Martin Pitt <martin.pitt at ubuntu.com> wrote:

> 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

I'm fine with using the path from pkg-config but the default fallback
should be $(prefix)/lib/systemd/system. See the definition of
systemunitdir in systemd itself which uses
$(rootprefix)/lib/systemd/system, and rootprefix defaults to
${ac_default_prefix}. systemd also has hardcoded paths
to /usr/lib/systemd/system, see for example those in
src/shared/path-lookup.c.

> +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]])],



More information about the lxc-devel mailing list