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

[libvirt] [PATCH] build: fix build on Cygwin



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.
---

Pushing under the build-breaker rule.

 src/rpc/genprotocol.pl     |    2 +-
 src/util/virnetdev.c       |    2 ++
 src/util/virnetdevbridge.c |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl
index 166508b..7af1b3b 100755
--- a/src/rpc/genprotocol.pl
+++ b/src/rpc/genprotocol.pl
@@ -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";
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 3187215..a1c62e3 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -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
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index 0440a73..e246b2c 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -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,
-- 
1.7.7.3


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