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. 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. However modifying the install using ${prefix} as in $(INSTALL) -m 644 ${systemd_service} ${DESTDIR}${prefix}/lib/systemd/system will make the distcheck work but in real life it will only work as long as the ${prefix} == "/usr" but it will not work if the end user changes the prefix when running configure. I guess I could figure out some "if conditions" to do some workarounds here depending on the value of prefix but it seems "ugly" to me and there must be a better way to make it work both with distcheck and in "real life" but having re-read the automake manual nothing obvious pops out so I suspect I'm missing something obvious here? Is someone offering to make a fool out of me pointing out this "obvious thing" I'm missing :-)