]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
build: work around mingw header pollution
authorEric Blake <eblake@redhat.com>
Tue, 2 Jul 2013 12:09:30 +0000 (06:09 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 2 Jul 2013 12:25:50 +0000 (06:25 -0600)
On Fedora 18, when cross-compiling to mingw with the mingw*-dbus
packages installed, compilation fails with:

  CC       libvirt_net_rpc_server_la-virnetserver.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-connection.h:32:0,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-bus.h:30,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus.h:31,
                 from ../../src/util/virdbus.h:26,
                 from ../../src/rpc/virnetserver.c:39:
/usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:74:58: error: expected ';', ',' or ')' before 'struct'

I have reported this as a bug against two packages:
- mingw-headers, for polluting the namespace
https://bugzilla.redhat.com/show_bug.cgi?id=980270
- dbus, for not dealing with the pollution
https://bugzilla.redhat.com/show_bug.cgi?id=980278

At least dbus has agreed that a future version of dbus headers will
do s/interface/iface/, regardless of what happens in mingw. But it
is also easy to workaround in libvirt in the meantime, without having
to wait for either mingw or dbus to upgrade.

* src/util/virdbus.h (includes): Undo mingw's pollution so that
dbus doesn't fail.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/util/virdbus.h

index a51dba7c499a6e2248cf972086368732bc8a8c52..a73e293a83b44e8a14ffdfaaa8981ea0d182af96 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * virdbus.h: helper for using DBus
  *
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2012-2013 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
@@ -23,6 +23,7 @@
 # define __VIR_DBUS_H__
 
 # ifdef WITH_DBUS
+#  undef interface /* Work around namespace pollution in mingw's rpc.h */
 #  include <dbus/dbus.h>
 # else
 #  define DBusConnection void