[libvirt] [PATCH 6/9] virt-json.m4: generalize yajl dependency

Ján Tomko jtomko at redhat.com
Wed Mar 28 23:09:55 UTC 2018


The QEMU driver needs a JSON library, not necessarily yajl.
Check for yajl first, then explicitly check if we found a JSON
library, to allow use of a different one.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 m4/virt-json.m4 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/m4/virt-json.m4 b/m4/virt-json.m4
index 9e026931e..5e4bcc7c9 100644
--- a/m4/virt-json.m4
+++ b/m4/virt-json.m4
@@ -22,21 +22,21 @@ AC_DEFUN([LIBVIRT_ARG_JSON],[
 ])
 
 AC_DEFUN([LIBVIRT_CHECK_JSON],[
-  dnl YAJL JSON library http://lloyd.github.com/yajl/
+  need_json=no
   if test "$with_qemu:$with_yajl" = yes:check; then
-    dnl Some versions of qemu require the use of yajl; try to detect them
+    dnl Some versions of qemu require the use of JSON; try to detect them
     dnl here, although we do not require qemu to exist in order to compile.
     dnl This check mirrors src/qemu/qemu_capabilities.c
     AC_PATH_PROGS([QEMU], [qemu-kvm qemu kvm qemu-system-x86_64],
                   [], [$PATH:/usr/bin:/usr/libexec])
     if test -x "$QEMU"; then
       if $QEMU -help 2>/dev/null | grep -q libvirt; then
-        with_yajl=yes
+        need_json=yes
       else
         [qemu_version_sed='s/.*ersion \([0-9.,]*\).*/\1/']
         qemu_version=`$QEMU -version | sed "$qemu_version_sed"`
         case $qemu_version in
-          [[1-9]].* | 0.15.* ) with_yajl=yes ;;
+          [[1-9]].* | 0.15.* ) need_json=yes ;;
           0.* | '' ) ;;
           *) AC_MSG_ERROR([Unexpected qemu version string]) ;;
         esac
@@ -44,6 +44,7 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
     fi
   fi
 
+  dnl YAJL JSON library http://lloyd.github.com/yajl/
   LIBVIRT_CHECK_LIB_ALT([YAJL], [yajl],
                         [yajl_parse_complete], [yajl/yajl_common.h],
                         [YAJL2], [yajl],
@@ -53,6 +54,8 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
                  [test "$with_yajl" = "yes"])
   if test "$with_yajl" = "yes"; then
     AC_DEFINE([WITH_JSON], [1], [whether a JSON library is available])
+  elif "$need_json" = "yes"; then
+    AC_MSG_ERROR([QEMU needs JSON but no library is available])
   fi
   AC_SUBST([JSON_CFLAGS], [$YAJL_CFLAGS])
   AC_SUBST([JSON_LIBS], [$YAJL_LIBS])
-- 
2.16.1




More information about the libvir-list mailing list