]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
We're runing on a posix system, so we can expect endian.h to exist
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 6 Nov 2025 08:07:12 +0000 (09:07 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 6 Nov 2025 08:07:12 +0000 (09:07 +0100)
Should fix #16091

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
ext/protozero/include/protozero/config.hpp

index 6fc7749049312f43692ac24f8088c00f63a6675f..68481d2c76be3aa52e00487428c832001e6ae3da 100644 (file)
@@ -18,6 +18,14 @@ documentation.
  * @brief Contains macro checks for different configurations.
  */
 
+#if __has_include(<endian.h>)
+#include <endian.h> // Recent posix
+#elif __has_include(<machine/endian.h>)
+#include <machine/endian.h> // 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