protocol: Replace missing xdr_uint64_t on macOS

The macOS rpcgen actually generates calls to xdr_uint64_t but doesn't
define them.  Despite this we can just use xdr_int64_t instead since
it's just byte swapping.
This commit is contained in:
Richard W.M. Jones
2022-08-16 13:58:38 +01:00
parent c51d1cfe9a
commit 6c0e5d7f8f
2 changed files with 11 additions and 0 deletions

View File

@@ -50,6 +50,10 @@ let generate_xdr () =
pr "\n";
pr "%%#include <config.h>\n";
pr "\n";
pr "%%#ifndef HAVE_XDR_UINT64_T\n";
pr "%%#define xdr_uint64_t xdr_int64_t\n";
pr "%%#endif\n";
pr "\n";
pr "/* This has to be defined to get around a limitation in Sun's rpcgen. */\n";
pr "typedef string guestfs_str<>;\n";

View File

@@ -196,6 +196,13 @@ PKG_CHECK_MODULES([RPC], [libtirpc], [], [
AC_SUBST([RPC_LIBS])
])
dnl Unsigned 64 bit ints are not available on macOS, but
dnl the signed functions can be used instead.
old_LIBS="$LIBS"
LIBS="$LIBS $RPC_LIBS"
AC_CHECK_FUNCS([xdr_uint64_t])
LIBS="$old_LIBS"
AC_CHECK_PROG([RPCGEN],[rpcgen],[rpcgen],[no])
AM_CONDITIONAL([HAVE_RPCGEN],[test "x$RPCGEN" != "xno"])