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 | 3 +++ src/remote/remote_protocol.c | 11 ++++++++++- src/remote/remote_protocol.h | 9 +++++++++ src/remote/remote_protocol.x | 13 +++++++++++++ src/remote/rpcgen_fix.pl | 4 ++-- 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d75fac8..955a9e9 100644 --- a/configure.ac +++ b/configure.ac @@ -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? diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c index c9816dd..eb0f9c3 100644 --- a/src/remote/remote_protocol.c +++ b/src/remote/remote_protocol.c @@ -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) diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h index 57ed123..92fd6df 100644 --- a/src/remote/remote_protocol.h +++ b/src/remote/remote_protocol.h @@ -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 diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 9aa3a7e..60f93b2 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -39,6 +39,19 @@ %#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). */ diff --git a/src/remote/rpcgen_fix.pl b/src/remote/rpcgen_fix.pl index 4943765..3cf5479 100644 --- a/src/remote/rpcgen_fix.pl +++ b/src/remote/rpcgen_fix.pl @@ -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; -- 1.6.3.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list