Thanks! It was exactly the problem I faced (I have previously never had to use DISTCHECK_CONFIGURE_FLAGS so it wasn't really in my autotools vocabulary until now). I ended up implemented a similar solution but without relying on pkg-config since it is not longer widely used as far as I can tell.
(This useful "trick" should really go into the autoconf/automake manual since it is a generic way of handling absolute installation paths in conjunction with distcheck) Cheers! On 2013-12-30 06:01, Russ Allbery wrote: > 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).