]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: fix build on Cygwin
authorEric Blake <eblake@redhat.com>
Mon, 13 Jun 2011 23:50:09 +0000 (17:50 -0600)
committerEric Blake <eblake@redhat.com>
Sat, 3 Dec 2011 20:03:44 +0000 (13:03 -0700)
The RPC fixups needed on Linux are also needed on cygwin, and
worked without further tweaking to the list of fixups.  Also,
unlike BSD, Cygwin exports 'struct ifreq', but unlike Linux,
Cygwin lacks the ioctls that we were using 'struct ifreq' to
access.  This patch allows compilation under cygwin.

* src/rpc/genprotocol.pl: Also perform fixups on cygwin.
* src/util/virnetdev.c (HAVE_STRUCT_IFREQ): Also require AF_PACKET
definition.
* src/util/virnetdevbridge.c (virNetDevSetupControlFull): Only
compile if SIOCBRADDBR works.

src/rpc/genprotocol.pl
src/util/virnetdev.c
src/util/virnetdevbridge.c

index 166508b649faa238a565314e5846930cc6cda2b8..7af1b3bd124e44d4d60790d8bda6d0b98470a9ee 100755 (executable)
@@ -31,7 +31,7 @@ open RPCGEN, "-|", $rpcgen, $mode, $xdrdef
 open TARGET, ">$target"
     or die "cannot create $target: $!";
 
-my $fixup = $^O eq "linux";
+my $fixup = $^O eq "linux" || $^O eq "cygwin";
 
 if ($mode eq "-c") {
     print TARGET "#include <config.h>\n";
index 318721507951e413757d7b812c839b22d7d12a8f..fee87ef3bb479263f2662abb8079c908503deefa 100644 (file)
@@ -38,6 +38,8 @@
 #ifdef __linux__
 # include <linux/sockios.h>
 # include <linux/if_vlan.h>
+#elif !defined(AF_PACKET)
+# undef HAVE_STRUCT_IFREQ
 #endif
 
 #define VIR_FROM_THIS VIR_FROM_NONE
index 0440a738fcb5c83d2ea3fb78475d5a142dea8ade..e246b2c53dacffdd293359fb89872a8bc0c03cd0 100644 (file)
@@ -45,7 +45,7 @@
 #define VIR_FROM_THIS VIR_FROM_NONE
 
 
-#ifdef HAVE_NET_IF_H
+#if defined(HAVE_NET_IF_H) && defined(SIOCBRADDBR)
 static int virNetDevSetupControlFull(const char *ifname,
                                      struct ifreq *ifr,
                                      int domain,