include <sys/endian.h> according by checking in meson

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.
This commit is contained in:
Aydın Mercan 2026-03-25 16:28:48 +03:00
parent c58d3d0318
commit 2a62cd449f
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View 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.

View 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',