cygwin: Handle differences in the XDR implementation

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.
This commit is contained in:
Matthias Bolte 2010-04-25 13:31:31 +02:00
parent 56c33caaec
commit d707c86633
5 changed files with 37 additions and 3 deletions

View 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?

View 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)

View 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

View File

@ -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). */

View 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;