[libvirt] [PATCHv2 12/12] build: require Jansson if QEMU driver is enabled

Ján Tomko posted 12 patches 7 years, 7 months ago
[libvirt] [PATCHv2 12/12] build: require Jansson if QEMU driver is enabled
Posted by Ján Tomko 7 years, 7 months ago
If the QEMU driver was requested, require Jansson, since we need to use
the JSON monitor to probe capabilities for all QEMU version supported
by libvirt.

Switch the default from 'yes' to 'check', and enable the QEMU driver
by default if the Jansson library is present.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 m4/virt-driver-qemu.m4 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/m4/virt-driver-qemu.m4 b/m4/virt-driver-qemu.m4
index b9bafdab90..a0d34f1dca 100644
--- a/m4/virt-driver-qemu.m4
+++ b/m4/virt-driver-qemu.m4
@@ -18,7 +18,7 @@ dnl <http://www.gnu.org/licenses/>.
 dnl
 
 AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [
-  LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [yes])
+  LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [check])
   LIBVIRT_ARG_WITH([QEMU_USER], [username to run QEMU system instance as],
                    ['platform dependent'])
   LIBVIRT_ARG_WITH([QEMU_GROUP], [groupname to run QEMU system instance as],
@@ -26,6 +26,12 @@ AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [
 ])
 
 AC_DEFUN([LIBVIRT_DRIVER_CHECK_QEMU], [
+  if test "$with_qemu:$with_jansson" = "yes:no"; then
+    AC_MSG_ERROR([Jansson >= 2.7 is required to build QEMU driver])
+  fi
+  if test "$with_qemu" = "check"; then
+    with_qemu=$with_jansson
+  fi
   if test "$with_qemu" = "yes" ; then
     AC_DEFINE_UNQUOTED([WITH_QEMU], 1, [whether QEMU driver is enabled])
   fi
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 12/12] build: require Jansson if QEMU driver is enabled
Posted by Peter Krempa 7 years, 7 months ago
On Thu, May 10, 2018 at 18:44:24 +0200, Ján Tomko wrote:
> If the QEMU driver was requested, require Jansson, since we need to use
> the JSON monitor to probe capabilities for all QEMU version supported
> by libvirt.
> 
> Switch the default from 'yes' to 'check', and enable the QEMU driver
> by default if the Jansson library is present.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  m4/virt-driver-qemu.m4 | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/m4/virt-driver-qemu.m4 b/m4/virt-driver-qemu.m4
> index b9bafdab90..a0d34f1dca 100644
> --- a/m4/virt-driver-qemu.m4
> +++ b/m4/virt-driver-qemu.m4
> @@ -18,7 +18,7 @@ dnl <http://www.gnu.org/licenses/>.
>  dnl
>  
>  AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [
> -  LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [yes])
> +  LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [check])
>    LIBVIRT_ARG_WITH([QEMU_USER], [username to run QEMU system instance as],
>                     ['platform dependent'])
>    LIBVIRT_ARG_WITH([QEMU_GROUP], [groupname to run QEMU system instance as],
> @@ -26,6 +26,12 @@ AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [
>  ])
>  
>  AC_DEFUN([LIBVIRT_DRIVER_CHECK_QEMU], [
> +  if test "$with_qemu:$with_jansson" = "yes:no"; then
> +    AC_MSG_ERROR([Jansson >= 2.7 is required to build QEMU driver])
> +  fi

So is the ordering of execution of these guaranteed? In other words,
will 'with_najsson' be always resolved at this point?

Also I agree with this check, but I'm not entirely persuaded by the rest
of the patch. Maybe it can be split into two, since it does two separate
things.

> +  if test "$with_qemu" = "check"; then
> +    with_qemu=$with_jansson
> +  fi
>    if test "$with_qemu" = "yes" ; then
>      AC_DEFINE_UNQUOTED([WITH_QEMU], 1, [whether QEMU driver is enabled])
>    fi
> -- 
> 2.16.1
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list