From 46aaf080472953623c943176255b3b4c7ceb2707 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 14 Jun 2018 11:05:58 +0930 Subject: [PATCH] configure: add hack to rename ccan's sha256 routines to avoid libwally clash Signed-off-by: Rusty Russell --- ccan_compat.h | 19 +++++++++++++++++++ configure | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 ccan_compat.h diff --git a/ccan_compat.h b/ccan_compat.h new file mode 100644 index 000000000..f0337f33f --- /dev/null +++ b/ccan_compat.h @@ -0,0 +1,19 @@ +#ifndef LIGHTNING_CCAN_COMPAT_H +#define LIGHTNING_CCAN_COMPAT_H +/* Magical file included from config.h (ie. everywhere) which renames + * sha256 routines so they don't clash with libwally-core's internal ones */ +#define sha256(sha, p, size) ccan_sha256(sha, p, size) +#define sha256_init(ctx) ccan_sha256_init(ctx) +#define sha256_update(ctx, p, size) ccan_sha256_update(ctx, p, size) +#define sha256_done(sha256, res) ccan_sha256_done(sha256, res) +#define sha256_u8(ctx, v) ccan_sha256_u8(ctx, v) +#define sha256_u16(ctx, v) ccan_sha256_u16(ctx, v) +#define sha256_u32(ctx, v) ccan_sha256_u32(ctx, v) +#define sha256_u64(ctx, v) ccan_sha256_u64(ctx, v) +#define sha256_le16(ctx, v) ccan_sha256_le16(ctx, v) +#define sha256_le32(ctx, v) ccan_sha256_le32(ctx, v) +#define sha256_le64(ctx, v) ccan_sha256_le64(ctx, v) +#define sha256_be16(ctx, v) ccan_sha256_be16(ctx, v) +#define sha256_be32(ctx, v) ccan_sha256_be32(ctx, v) +#define sha256_be64(ctx, v) ccan_sha256_be64(ctx, v) +#endif /* LIGHTNING_CCAN_COMPAT_H */ diff --git a/configure b/configure index 841aecbda..8ac2a7333 100755 --- a/configure +++ b/configure @@ -128,3 +128,7 @@ add_var VALGRIND "$VALGRIND" add_var DEVELOPER "$DEVELOPER" $CONFIG_HEADER add_var COMPAT "$COMPAT" $CONFIG_HEADER add_var PYTEST "$PYTEST" + +# Hack to avoid sha256 name clash with libwally: will be fixed when that +# becomes a standalone shared lib. +echo '#include "ccan_compat.h"' >> $CONFIG_HEADER