From 2e54b1be2901c5b687169ad4d6f0f9017ae9493d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 3 Jun 2019 14:13:23 +0200 Subject: [PATCH] Make detect GNU rather than Linux Instead of only supporting Linux, try making 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 , so that it only gets evaluated when more specific platform determination criteria are not met. Also include 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. --- lib/isc/include/isc/endian.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/isc/include/isc/endian.h b/lib/isc/include/isc/endian.h index 98a26dafac..30a8f1e076 100644 --- a/lib/isc/include/isc/endian.h +++ b/lib/isc/include/isc/endian.h @@ -11,11 +11,7 @@ #pragma once -#if defined(__linux__) || defined(__CYGWIN__) - -#include - -#elif defined __APPLE__ +#if defined __APPLE__ #include @@ -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 +# include + #else #endif /* Specific platform support */