From 6c0e5d7f8f2a8eaddadbc34c08f8a1ed095626b0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 16 Aug 2022 13:58:38 +0100 Subject: [PATCH] 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. --- generator/XDR.ml | 4 ++++ m4/guestfs-libraries.m4 | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/generator/XDR.ml b/generator/XDR.ml index c299c13b2..b867bdd01 100644 --- a/generator/XDR.ml +++ b/generator/XDR.ml @@ -50,6 +50,10 @@ let generate_xdr () = pr "\n"; pr "%%#include \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"; diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4 index 838b76ee7..4154acf53 100644 --- a/m4/guestfs-libraries.m4 +++ b/m4/guestfs-libraries.m4 @@ -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"])