提交 c0e70221 编写于 作者: E Eric Blake

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: NEric Blake <eblake@redhat.com>
上级 225f4833
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
......
/*
* 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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册