[libvirt] [PATCH 03/29] Convert HAVE_YAJL into WITH_YAJL

Daniel P. Berrange berrange at redhat.com
Thu Sep 20 15:01:17 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 configure.ac                 |  6 +++---
 src/qemu/qemu_capabilities.c |  2 +-
 src/qemu/qemu_driver.c       |  4 ++--
 src/util/json.c              | 14 +++++++-------
 tests/Makefile.am            |  2 +-
 tests/qemuhelptest.c         |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index cc63361..738a611 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1158,15 +1158,15 @@ if test "x$with_yajl" != "xno"; then
   CPPFLAGS="$old_cppflags"
   LIBS="$old_libs"
   if test "x$with_yajl" = "xyes" ; then
-    AC_DEFINE_UNQUOTED([HAVE_YAJL], 1,
+    AC_DEFINE_UNQUOTED([WITH_YAJL], 1,
       [whether YAJL is available for JSON parsing/formatting])
   fi
   if test "x$with_yajl2" = "xyes" ; then
-    AC_DEFINE_UNQUOTED([HAVE_YAJL2], 1,
+    AC_DEFINE_UNQUOTED([WITH_YAJL2], 1,
       [whether YAJL has API version 2])
   fi
 fi
-AM_CONDITIONAL([HAVE_YAJL], [test "x$with_yajl" = "xyes"])
+AM_CONDITIONAL([WITH_YAJL], [test "x$with_yajl" = "xyes"])
 AC_SUBST([YAJL_CFLAGS])
 AC_SUBST([YAJL_LIBS])
 
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4b52dc5..3b6ba4f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1289,7 +1289,7 @@ qemuCapsComputeCmdFlags(const char *help,
      * backported for libvirt. The benefits of JSON mode now
      * outweigh the downside.
      */
-#if HAVE_YAJL
+#if WITH_YAJL
     if (version >= 13000) {
         qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
     } else if (version >= 12000 &&
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 12ac15c..9bd2343 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1805,7 +1805,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
             goto cleanup;
         }
     } else {
-#if HAVE_YAJL
+#if WITH_YAJL
         if (qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON)) {
             if (!qemuCapsGet(priv->caps, QEMU_CAPS_NO_SHUTDOWN)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -1817,7 +1817,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
             virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                            _("Reboot is not supported without the JSON monitor"));
             goto cleanup;
-#if HAVE_YAJL
+#if WITH_YAJL
         }
 #endif
     }
diff --git a/src/util/json.c b/src/util/json.c
index 0507244..988c86e 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -29,11 +29,11 @@
 #include "logging.h"
 #include "util.h"
 
-#if HAVE_YAJL
+#if WITH_YAJL
 # include <yajl/yajl_gen.h>
 # include <yajl/yajl_parse.h>
 
-# ifdef HAVE_YAJL2
+# ifdef WITH_YAJL2
 #  define yajl_size_t size_t
 # else
 #  define yajl_size_t unsigned int
@@ -659,7 +659,7 @@ int virJSONValueObjectIsNull(virJSONValuePtr object, const char *key)
 }
 
 
-#if HAVE_YAJL
+#if WITH_YAJL
 static int virJSONParserInsertValue(virJSONParserPtr parser,
                                     virJSONValuePtr value)
 {
@@ -937,13 +937,13 @@ virJSONValuePtr virJSONValueFromString(const char *jsonstring)
     yajl_handle hand;
     virJSONParser parser = { NULL, NULL, 0 };
     virJSONValuePtr ret = NULL;
-# ifndef HAVE_YAJL2
+# ifndef WITH_YAJL2
     yajl_parser_config cfg = { 1, 1 };
 # endif
 
     VIR_DEBUG("string=%s", jsonstring);
 
-# ifdef HAVE_YAJL2
+# ifdef WITH_YAJL2
     hand = yajl_alloc(&parserCallbacks, NULL, &parser);
     if (hand) {
         yajl_config(hand, yajl_allow_comments, 1);
@@ -1061,13 +1061,13 @@ char *virJSONValueToString(virJSONValuePtr object,
     const unsigned char *str;
     char *ret = NULL;
     yajl_size_t len;
-# ifndef HAVE_YAJL2
+# ifndef WITH_YAJL2
     yajl_gen_config conf = { pretty ? 1 : 0, pretty ? "    " : " "};
 # endif
 
     VIR_DEBUG("object=%p", object);
 
-# ifdef HAVE_YAJL2
+# ifdef WITH_YAJL2
     g = yajl_gen_alloc(NULL);
     if (g) {
         yajl_gen_config(g, yajl_gen_beautify, pretty ? 1 : 0);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d715291..42df023 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -141,7 +141,7 @@ if WITH_CIL
 test_programs += object-locking
 endif
 
-if HAVE_YAJL
+if WITH_YAJL
 test_programs += jsontest
 endif
 
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 079aef8..5112458 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -56,7 +56,7 @@ static int testHelpStrParsing(const void *data)
                              &version, &is_kvm, &kvm_version, false) == -1)
         goto cleanup;
 
-# ifndef HAVE_YAJL
+# ifndef WITH_YAJL
     if (qemuCapsGet(info->flags, QEMU_CAPS_MONITOR_JSON))
         qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
 # endif
-- 
1.7.11.4




More information about the libvir-list mailing list