[libvirt] [PATCH] build: add $(prefix) to SYSTEMD_UNIT_DIR

Eric Blake eblake at redhat.com
Fri Jan 17 16:36:53 UTC 2014

On 01/17/2014 05:34 AM, Laine Stump wrote:
> I noticed this problem when adding systemd support to netcf, because I
> setup the configure.ac to automatically prefer using systemd over
> initscripts when possible - although I had copied the
> install-data-local target from the example of libvirt's
> "libvirt-guests" service more or less verbatim, "make distcheck" would
> fail because it was trying to install the service file directly into
> /lib/systemd/system rather than into
> /home/user/some/unimportant/name/lib/systemd/system.
> This is caused by the install/uninstall rules for the systemd unit
> files relying on $(DESTDIR) pointing the installed files to the right
> place, but in reality $(DESTDIR) is empty during this part of make
> distcheck - it instead sets $(prefix) with the toplevel directory used
> for its test build/install/uninstall cycle.
> (This problem hasn't been seen when running "make distcheck" in
> libvirt because libvirt will never build/install systemd support
> unless explicitly told to do so on the configure commandline, and
> "make distcheck" doesn't put the "--with-initscript=..." option on the
> configure commandline.)

There are ways with autotools to cause 'make distcheck' to enable
particular configure options for the child process, but I'm not sure if
it's worth playing with them.  Maybe it's even worth having
./autobuild.sh try to tickle the situation.  But that's something for a
followup patch, and doesn't affect this patch.

> I verified that the same problem does exist in libvirt by modifying
> libvirt's configure.ac to set:
>   init_systemd=yes
>   with_init_script=systemd+redhat
> This forces a build/install of the systemd unit files during
> distcheck, which yields an error like this:
> /usr/bin/install -c -m 644 virtlockd.service \
>   /lib/systemd/system/
> libtool: install: warning: relinking `libvirt-qemu.la'
> /usr/bin/install: cannot remove '/lib/systemd/system/virtlockd.service': Permission denied
> make[4]: *** [install-systemd] Error 1
> After adding $(prefix) to all the definitions of SYSTEMD_UNIT_DIR,
> make distcheck now completes successfully with the modified
> configure.ac, and the above lines change to something like this:
> /usr/bin/install -c -m 644 virtlockd.service \
>   /home/laine/devel/libvirt/libvirt-1.2.1/_inst/lib/systemd/system/


Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140117/a52a7ad5/attachment-0001.sig>

More information about the libvir-list mailing list