]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
cygwin: Handle differences in the XDR implementation
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sun, 25 Apr 2010 11:31:31 +0000 (13:31 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 27 Apr 2010 07:31:28 +0000 (09:31 +0200)
Cygwin's XDR implementation defines xdr_u_int64_t instead of
xdr_uint64_t and lacks IXDR_PUT_INT32/IXDR_GET_INT32.

Alter the IXDR_GET_LONG regex in rpcgen_fix.pl so it doesn't destroy
the #define IXDR_GET_INT32 IXDR_GET_LONG in remote_protocol.x.

Also fix the remote_protocol.h regex in rpcgen_fix.pl.

configure.ac
src/remote/remote_protocol.c
src/remote/remote_protocol.h
src/remote/remote_protocol.x
src/remote/rpcgen_fix.pl

index d75fac86ac4009d7b1aa295247d3662af5a93b20..955a9e9e310bda0938f9739e4f56ed2ef43151d1 100644 (file)
@@ -124,6 +124,9 @@ AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[
                [AC_MSG_ERROR([Cannot find a XDR library])])
        ])
 
+dnl check for cygwin's variation in xdr function names
+AC_CHECK_FUNCS([xdr_u_int64_t],[],[],[#include <rpc/xdr.h>])
+
 AC_CHECK_LIB([intl],[gettext],[])
 
 dnl Do we have rpcgen?
index c9816dd93bae42696c9ccd676a3e105a37c52438..eb0f9c3dc5264de3d81e91487a15148fea523914 100644 (file)
@@ -4,9 +4,18 @@
  * It was generated using rpcgen.
  */
 
-#include "./remote/remote_protocol.h"
+#include "remote_protocol.h"
 #include "internal.h"
 #include <arpa/inet.h>
+#ifdef HAVE_XDR_U_INT64_T
+# define xdr_uint64_t xdr_u_int64_t
+#endif
+#ifndef IXDR_PUT_INT32
+# define IXDR_PUT_INT32 IXDR_PUT_LONG
+#endif
+#ifndef IXDR_GET_INT32
+# define IXDR_GET_INT32 IXDR_GET_LONG
+#endif
 
 bool_t
 xdr_remote_nonnull_string (XDR *xdrs, remote_nonnull_string *objp)
index 57ed123751e7ded2577cee27c5af55f80b4c2534..92fd6dfe3100bf1f44b78ef928ba5d44ed2969e2 100644 (file)
@@ -15,6 +15,15 @@ extern "C" {
 
 #include "internal.h"
 #include <arpa/inet.h>
+#ifdef HAVE_XDR_U_INT64_T
+# define xdr_uint64_t xdr_u_int64_t
+#endif
+#ifndef IXDR_PUT_INT32
+# define IXDR_PUT_INT32 IXDR_PUT_LONG
+#endif
+#ifndef IXDR_GET_INT32
+# define IXDR_GET_INT32 IXDR_GET_LONG
+#endif
 #define REMOTE_MESSAGE_MAX 262144
 #define REMOTE_MESSAGE_HEADER_MAX 24
 #define REMOTE_MESSAGE_PAYLOAD_MAX 262120
index 9aa3a7e583fd8514723a9102fd1dd4ba57263862..60f93b2cc68f8d71ec7a7504674f25f2f9f7d0de 100644 (file)
 %#include "internal.h"
 %#include <arpa/inet.h>
 
+/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
+ * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
+ */
+%#ifdef HAVE_XDR_U_INT64_T
+%# define xdr_uint64_t xdr_u_int64_t
+%#endif
+%#ifndef IXDR_PUT_INT32
+%# define IXDR_PUT_INT32 IXDR_PUT_LONG
+%#endif
+%#ifndef IXDR_GET_INT32
+%# define IXDR_GET_INT32 IXDR_GET_LONG
+%#endif
+
 /*----- Data types. -----*/
 
 /* Maximum total message size (serialised). */
index 4943765f6da567e8300f228280fb250fd0b5ebc3..3cf5479dfc39ccf3f100a2d3d24130c5587da975 100644 (file)
@@ -31,8 +31,8 @@ while (<>) {
     s/quad_t/int64_t/g;
     s/xdr_u_quad_t/xdr_uint64_t/g;
     s/xdr_quad_t/xdr_int64_t/g;
-    s/IXDR_GET_LONG/IXDR_GET_INT32/g;
-    s,#include "\./remote_protocol\.h",#include "remote_protocol.h",;
+    s/(?<!IXDR_GET_INT32 )IXDR_GET_LONG/IXDR_GET_INT32/g;
+    s,#include "\./remote/remote_protocol\.h",#include "remote_protocol.h",;
 
     if (m/^}/) {
        $in_function = 0;