Johan Persson <joh...@aditus.nu> writes:

> As part of the installation of a project I'm working on I want to
> install a systemd service file which is created as part of the
> configuration process (by autoconf).

> Now I found myself in the situation where I can choose to have this work
> either in real life or when I make "make distcheck" but not both.

Have you seen the discussion of this in daemon(7)?  It provides a working
example that addresses exactly this situation, although it does rely on
using the pkg.m4 Autoconf macros from pkg-config.

The basic idea is that you default to this:

> My problem is that me trying to install the service in an absolute
> system directory as

> $(INSTALL) -m 644 ${systemd_service} ${DESTDIR}/usr/lib/systemd/system 

> will not work with distcheck since it requires the use of ${prefix} in
> order for the temporary install/check to work.

except pulling the actual directory from the pkg-config configuration for
systemd (for example, it may be /lib, not /usr/lib, on, e.g., Debian), and
then you override the directory with a --with flag in Makefile.am for use
with distcheck.

The documentation and the Autoconf code is in "Installing Systemd Service
Files" in daemon(7).

-- 
Russ Allbery (ea...@eyrie.org)              <http://www.eyrie.org/~eagle/>

Reply via email to