Skip to content

Commit 3e60b9c

Browse files
committed
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
2 parents cac6d11 + 150b2f0 commit 3e60b9c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/compat/endian.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,51 @@
1919
#include <sys/endian.h>
2020
#endif
2121

22+
#ifndef HAVE_CONFIG_H
23+
// While not technically a supported configuration, defaulting to defining these
24+
// DECLs when we were compiled without autotools makes it easier for other build
25+
// systems to build things like libbitcoinconsensus for strange targets.
26+
#ifdef htobe16
27+
#define HAVE_DECL_HTOBE16 1
28+
#endif
29+
#ifdef htole16
30+
#define HAVE_DECL_HTOLE16 1
31+
#endif
32+
#ifdef be16toh
33+
#define HAVE_DECL_BE16TOH 1
34+
#endif
35+
#ifdef le16toh
36+
#define HAVE_DECL_LE16TOH 1
37+
#endif
38+
39+
#ifdef htobe32
40+
#define HAVE_DECL_HTOBE32 1
41+
#endif
42+
#ifdef htole32
43+
#define HAVE_DECL_HTOLE32 1
44+
#endif
45+
#ifdef be32toh
46+
#define HAVE_DECL_BE32TOH 1
47+
#endif
48+
#ifdef le32toh
49+
#define HAVE_DECL_LE32TOH 1
50+
#endif
51+
52+
#ifdef htobe64
53+
#define HAVE_DECL_HTOBE64 1
54+
#endif
55+
#ifdef htole64
56+
#define HAVE_DECL_HTOLE64 1
57+
#endif
58+
#ifdef be64toh
59+
#define HAVE_DECL_BE64TOH 1
60+
#endif
61+
#ifdef le64toh
62+
#define HAVE_DECL_LE64TOH 1
63+
#endif
64+
65+
#endif // HAVE_CONFIG_H
66+
2267
#if defined(WORDS_BIGENDIAN)
2368

2469
#if HAVE_DECL_HTOBE16 == 0

0 commit comments

Comments
 (0)