]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
include <sys/endian.h> according by checking in meson
authorAydın Mercan <aydin@isc.org>
Wed, 25 Mar 2026 13:28:48 +0000 (16:28 +0300)
committerAydın Mercan <aydin@isc.org>
Tue, 31 Mar 2026 13:06:37 +0000 (16:06 +0300)
The <sys/endian.h> header has existed in macOS since around ~26. This
causes the `htobeNN`/`htoleNN` macros to be redefined in <isc/endian.h>
in terms of <libkern/OSByteOrder.h> when other system headers include
<sys/endian.h>.

Fix this issue by using checking for the existence of <sys/endian.h> in
meson and including it according to the probe result.

lib/isc/include/isc/endian.h
meson.build

index 3c7ffbc29859833316929c74aef7d4625946a494..153fa00f4111c50b93dde431174f81111bc843f3 100644 (file)
@@ -13,8 +13,7 @@
 
 #pragma once
 
-#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
-       defined(__OpenBSD__) || defined(__bsdi__)
+#ifdef HAVE_SYS_ENDIAN_H
 
 #include <sys/endian.h>
 
@@ -32,7 +31,7 @@
 #define le64toh(x) letoh64(x)
 #endif /* !be16toh */
 
-#elif defined __APPLE__
+#elif defined(__APPLE__)
 
 /*
  * macOS has its own byte-swapping routines, so use these.
index 03f03f71f2ea92900d98f72ca498b00678648a50..91d492435642cf43e6cc02deeaf3e390a4024e8a 100644 (file)
@@ -538,6 +538,7 @@ foreach h : [
     'regex.h',
     'stdckdint.h',
     'sys/mman.h',
+    'sys/endian.h',
     'sys/select.h',
     'sys/sockio.h',
     'sys/sysctl.h',