Hi, Wouter Verhelst <w...@uter.be> writes:
> I'm adding a systemd unit to my package. To that end, I'm checking if > there is a pkg-config .pc file for systemd which sets a variable > "systemdsystemunitdir", and am trying to install the systemd unit in > that location. > > I'm currently doing this: > > AC_MSG_CHECKING([for systemd unit file locations]) > AC_ARG_ENABLE( > systemd, > AS_HELP_STRING([--disable-systemd],[Do not install systemd support files > (or use --enable-systemd to fail build when not available)]), > [ > if test "x$enableval" = "xyes"; then > ENABLE_SYSTEMD=yes > else > ENABLE_SYSTEMD=no > fi > ],[] > ) > > if test "x$ENABLE_SYSTEMD" != "xno"; then > > PKG_CHECK_VAR([SYSTEMDUNIT],[systemd],systemdsystemunitdir],[AC_SUBST([systemdunitdir], > [$SYSTEMDUNIT])]) > fi > > and then in my Makefile.am: > > if SYSTEMD > systemdunit_DATA = nbd@.service > endif > > (if you need the full files, they're in the git repository at > git.debian.org/users/wouter/nbd.git) This URL doesn't work for me. > However, now my "make distcheck" fails, because the "make install" > target disregards DESTDIR and tries to install files in the actual > systemd unit directory, rather than the staging one. Clearly this means > I'm doing something wrong, but I'm not sure what the proper way for > doing this would be. ‘systemdsystemunitdir’ seems not affected by DESTDIR because IIUC PKG_CHECK_VAR set it to something like "/lib/systemd/system" instead of "${libdir}/systemd/system". I suppose it would work better to define it manually like this: if SYSTEMD systemdunitdir = $(libdir)/systemd/system systemdunit_DATA = nbd@.service endif and keep only the feature test in configure.ac followed with the Automake conditional. -- Mathieu Lirzin