From 10d31064c35fab1a80a92d9b19e86a60d948bf1a Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Sat, 9 Sep 2017 09:06:07 -0400 Subject: [PATCH] Endian fix for OpenBSD systems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per github issue #257, Jérémie Courrèges-Anglas and Ingo Feinerer contributed a patch to fix endian detection on OpenBSD systems. This is based on information contained at: https://www.opengroup.org/austin/docs/austin_514.txt --- CREDITS | 5 +++++ lib/fko_common.h | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index fe839715..a8f969b8 100644 --- a/CREDITS +++ b/CREDITS @@ -235,3 +235,8 @@ Github user 'sgh7': on goes down. If this happens, it is expected that the native process monitoring feature in things like systemd or upstart will restart fwknopd. + +Jérémie Courrèges-Anglas and Ingo Feinerer + - Contributed a patch to fix endian detection on OpenBSD systems based on + information contained here: + https://www.opengroup.org/austin/docs/austin_514.txt diff --git a/lib/fko_common.h b/lib/fko_common.h index d7cbbb34..4c7d6fc0 100644 --- a/lib/fko_common.h +++ b/lib/fko_common.h @@ -91,9 +91,15 @@ /* Work out endianness */ -#if HAVE_ENDIAN_H /* Should cover most Linux systems */ +#ifdef HAVE_ENDIAN_H /* POSIX proposal, should cover most modern systems */ #include - #define BYTEORDER __BYTE_ORDER + #ifndef BYTE_ORDER + #ifdef _BYTE_ORDER + #define BYTE_ORDER _BYTE_ORDER + #elif defined(__BYTE_ORDER) + #define BYTE_ORDER __BYTE_ORDER + #endif + #endif #elif HAVE_SYS_ENDIAN_H /* FreeBSD has a sys/endian.h */ #include #define BYTEORDER _BYTE_ORDER