[libvirt] [PATCH v2 2/3] configure: Add systemd detection to --with-init-script=check

Andrea Bolognani abologna at redhat.com
Mon May 2 15:17:49 UTC 2016


On Mon, 2016-05-02 at 17:01 +0200, Ján Tomko wrote:
> On Mon, May 02, 2016 at 01:51:26PM +0200, Andrea Bolognani wrote:
> > 
> > Most distributions, including RHEL, have switched to systemd,
> > so we should detect it and act accordingly. This also means
> > that 'systemd+redhat' should be preferred to legacy 'redhat'.
> > 
> > Our witness for the check is the availability of the systemctl
> > command on the host.
> > ---
> >  configure.ac | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 4149e20..f5cb1c3 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -634,7 +634,15 @@ if test "$with_init_script" = check; then
> >      if test "$cross_compiling" = yes; then
> >          with_init_script=none
> >      fi
> > +    if type systemctl >/dev/null 2>&1; then
> > +        if test "$with_init_script" = check; then
> > +            with_init_script=systemd
> > +        fi
> 
> I liked the /etc/systemd check a bit more, but this also works.

This check should be more accurate, though, eg. won't install
the systemd unit files on your OpenRC-powered Gentoo box,
whereas the previous code would have.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list