[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] build: fix build with older dbus headers



Compilation on a RHEL 5 host failed, due to the older dbus headers
present on that machine, and triggered by commit 2aa167ca:

util/virdbus.c: In function 'virDBusMessageIterDecode':
util/virdbus.c:952: error: 'DBusBasicValue' undeclared (first use in this function)

* m4/virt-dbus.m4 (LIBVIRT_CHECK_DBUS): Check for DBusBasicValue.
* src/util/virdbuspriv.h (DBusBasicValue): Provide fallback.

Signed-off-by: Eric Blake <eblake redhat com>
---

Pushing under the build-breaker rule.

 m4/virt-dbus.m4        |  3 ++-
 src/util/virdbuspriv.h | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/m4/virt-dbus.m4 b/m4/virt-dbus.m4
index 4ef0c82..3f9b306 100644
--- a/m4/virt-dbus.m4
+++ b/m4/virt-dbus.m4
@@ -1,6 +1,6 @@
 dnl The libdbus.so library
 dnl
-dnl Copyright (C) 2012-2013 Red Hat, Inc.
+dnl Copyright (C) 2012-2014 Red Hat, Inc.
 dnl
 dnl This library is free software; you can redistribute it and/or
 dnl modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,7 @@ AC_DEFUN([LIBVIRT_CHECK_DBUS],[
     CFLAGS="$CFLAGS $DBUS_CFLAGS"
     LIBS="$LIBS $DBUS_LIBS"
     AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
+    AC_CHECK_TYPES([DBusBasicValue], [], [], [[#include <dbus/dbus.h>]])
     CFLAGS="$old_CFLAGS"
     LIBS="$old_LIBS"
   fi
diff --git a/src/util/virdbuspriv.h b/src/util/virdbuspriv.h
index d45fb25..4247746 100644
--- a/src/util/virdbuspriv.h
+++ b/src/util/virdbuspriv.h
@@ -1,7 +1,7 @@
 /*
  * virdbuspriv.h: internal APIs for testing DBus code
  *
- * Copyright (C) 2012-2013 Red Hat, Inc.
+ * Copyright (C) 2012-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,6 +24,21 @@

 # include "virdbus.h"

+# if !HAVE_DBUSBASICVALUE
+/* Copied (and simplified) from dbus 1.6.12, for use with older dbus headers */
+typedef union
+{
+  dbus_int16_t  i16;   /**< as int16 */
+  dbus_uint16_t u16;   /**< as int16 */
+  dbus_int32_t  i32;   /**< as int32 */
+  dbus_uint32_t u32;   /**< as int32 */
+  dbus_bool_t   bool_val; /**< as boolean */
+  dbus_int64_t  i64;   /**< as int64 */
+  dbus_uint64_t u64;   /**< as int64 */
+  double dbl;          /**< as double */
+  unsigned char byt;   /**< as byte */
+} DBusBasicValue;
+# endif

 int virDBusMessageEncodeArgs(DBusMessage* msg,
                              const char *types,
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]