From 71e81f3e8db6e95cac5bffb43d42c41f8bcabac8 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Thu, 6 Nov 2025 09:07:12 +0100 Subject: [PATCH] We're runing on a posix system, so we can expect endian.h to exist Should fix #16091 Signed-off-by: Otto Moerbeek --- ext/protozero/include/protozero/config.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ext/protozero/include/protozero/config.hpp b/ext/protozero/include/protozero/config.hpp index 6fc7749049..68481d2c76 100644 --- a/ext/protozero/include/protozero/config.hpp +++ b/ext/protozero/include/protozero/config.hpp @@ -18,6 +18,14 @@ documentation. * @brief Contains macro checks for different configurations. */ +#if __has_include() +#include // Recent posix +#elif __has_include() +#include // Common place on older BSD derived systems +#else +#error no endian.h found +#endif + #define PROTOZERO_LITTLE_ENDIAN 1234 #define PROTOZERO_BIG_ENDIAN 4321 @@ -35,6 +43,9 @@ documentation. # define PROTOZERO_BYTE_ORDER PROTOZERO_LITTLE_ENDIAN #endif +// Sanity check +static_assert(PROTOZERO_BYTE_ORDER == BYTE_ORDER); + // Check whether __builtin_bswap is available #if defined(__GNUC__) || defined(__clang__) # define PROTOZERO_USE_BUILTIN_BSWAP -- 2.47.3