mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-08 23:12:09 -04:00
Make <isc/endian.h> detect GNU rather than Linux
Instead of only supporting Linux, try making <isc/endian.h> support
other GNU platforms as well. Since some compilers define __GNUC__ on
BSDs (e.g. Clang on FreeBSD), move the relevant section to the bottom of
the platform-specific part of <isc/endian.h>, so that it only gets
evaluated when more specific platform determination criteria are not
met. Also include <byteswap.h> so that any byte-swapping macros which
may be defined in that file on older platforms are used in the fallback
definitions of the nonstandard hto[bl]e{16,32,64}() and
[bl]e{16,32,64}toh() conversion functions.
This commit is contained in:
parent
387cc00121
commit
2e54b1be29
1 changed files with 7 additions and 5 deletions
|
|
@ -11,11 +11,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__)
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#elif defined __APPLE__
|
||||
#if defined __APPLE__
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
|
|
@ -96,6 +92,12 @@
|
|||
# define bswap_32(x) BSWAP_32(x)
|
||||
# define bswap_64(x) BSWAP_64(x)
|
||||
|
||||
#elif defined(__ANDROID__) || defined(__CYGWIN__) || \
|
||||
defined(__GNUC__) || defined(__GNU__)
|
||||
|
||||
# include <byteswap.h>
|
||||
# include <endian.h>
|
||||
|
||||
#else
|
||||
|
||||
#endif /* Specific platform support */
|
||||
|
|
|
|||
Loading…
Reference in a new issue