aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-04-22 11:56:03 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-04-22 11:56:23 +0200
commit3e60b9cfa7689bc25ff947da4005cf76b2db2739 (patch)
tree6d0794a29bc950f4e538b5970bccc968a2290726 /src
parentcac6d1184da5e777c7cc1f6088f50951682582ed (diff)
parent150b2f0265f11590940d9c89560b5c067f4d2120 (diff)
downloadbitcoin-3e60b9cfa7689bc25ff947da4005cf76b2db2739.tar.xz
Merge #12998: Default to defining endian-conversion DECLs in compat w/o config
150b2f0 Default to defining endian-conversion DECLs in compat w/o config (Matt Corallo) Pull request description: While this isn't a supported build configuration, some build systems need to build without going through our autotools steps, so defaulting to something sane may make it easier to build. Specifically, this fixes the inability to build rust-bitcoinconsensus on some non-x86 platforms. It needs to build without our autotools/configure steps to ensure correct compile args are passed from the rust build system to gcc. Converting the args from the rust build system to gcc would be a lot of unmaintainable work. Tree-SHA512: 776fdb8c91b66f421fc751cb281c99c53c47e496f46b26c9f49bb6fdb6da3d2dda5dcc1c5bf413206bdd9ff3cbe5cef2823455900462519a4944631d9c48b54c
Diffstat (limited to 'src')
-rw-r--r--src/compat/endian.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/compat/endian.h b/src/compat/endian.h
index e5c7e50223..4f244c3930 100644
--- a/src/compat/endian.h
+++ b/src/compat/endian.h
@@ -19,6 +19,51 @@
#include <sys/endian.h>
#endif
+#ifndef HAVE_CONFIG_H
+// While not technically a supported configuration, defaulting to defining these
+// DECLs when we were compiled without autotools makes it easier for other build
+// systems to build things like libbitcoinconsensus for strange targets.
+#ifdef htobe16
+#define HAVE_DECL_HTOBE16 1
+#endif
+#ifdef htole16
+#define HAVE_DECL_HTOLE16 1
+#endif
+#ifdef be16toh
+#define HAVE_DECL_BE16TOH 1
+#endif
+#ifdef le16toh
+#define HAVE_DECL_LE16TOH 1
+#endif
+
+#ifdef htobe32
+#define HAVE_DECL_HTOBE32 1
+#endif
+#ifdef htole32
+#define HAVE_DECL_HTOLE32 1
+#endif
+#ifdef be32toh
+#define HAVE_DECL_BE32TOH 1
+#endif
+#ifdef le32toh
+#define HAVE_DECL_LE32TOH 1
+#endif
+
+#ifdef htobe64
+#define HAVE_DECL_HTOBE64 1
+#endif
+#ifdef htole64
+#define HAVE_DECL_HTOLE64 1
+#endif
+#ifdef be64toh
+#define HAVE_DECL_BE64TOH 1
+#endif
+#ifdef le64toh
+#define HAVE_DECL_LE64TOH 1
+#endif
+
+#endif // HAVE_CONFIG_H
+
#if defined(WORDS_BIGENDIAN)
#if HAVE_DECL_HTOBE16 == 0