diff options
author | dimitri staessens <dimitri.staessens@ugent.be> | 2017-08-18 15:56:55 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@ugent.be> | 2017-08-21 10:25:19 +0200 |
commit | 8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e (patch) | |
tree | 0535742162921dc0d19c16f5b02d2f1c8f4fc493 /include/ouroboros/endian.h | |
parent | eefae235dd7af96eef3dc4f82f706170c379d260 (diff) | |
download | ouroboros-8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e.tar.gz ouroboros-8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e.zip |
build: Revise the build system
This revises the build system to have configuration per system
component. System settings can now be set using cmake.
The standard compliance defines were removed from configuration header
and are set in the sources where needed. Also some small code
refactors, such as moving the data for shims out of the ipcp structure
to the respective shims were performed.
Diffstat (limited to 'include/ouroboros/endian.h')
-rw-r--r-- | include/ouroboros/endian.h | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/include/ouroboros/endian.h b/include/ouroboros/endian.h index 18df0e99..00c7e043 100644 --- a/include/ouroboros/endian.h +++ b/include/ouroboros/endian.h @@ -24,42 +24,18 @@ #define OUROBOROS_ENDIAN_H #if defined(__linux__) || defined(__CYGWIN__) || \ - (defined(__MACH__) && !defined(__APPLE__)) - -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif -#ifndef __USE_BSD -#define __USE_BSD -#endif -#ifndef _DEFAULT_SOURCE + (defined(__MACH__) && !defined(__APPLE__)) #define _DEFAULT_SOURCE -#endif - #include <endian.h> -#include <features.h> - -#define betoh16(x) be16toh(x) -#define letoh16(x) le16toh(x) -#define betoh32(x) be32toh(x) -#define letoh32(x) le32toh(x) -#define betoh64(x) be64toh(x) -#define letoh64(x) le64toh(x) - -#elif defined(__NetBSD__) || defined(__FreeBSD__) - +#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include <sys/endian.h> - -#define betoh16(x) be16toh(x) -#define letoh16(x) le16toh(x) -#define betoh32(x) be32toh(x) -#define letoh32(x) le32toh(x) -#define betoh64(x) be64toh(x) -#define letoh64(x) le64toh(x) - #elif defined(__APPLE__) - #include <libkern/OSByteOrder.h> +#else +#error OS currently not supported +#endif + +#if defined (__APPLE__) #define htobe16(x) OSSwapHostToBigInt16(x) #define htole16(x) OSSwapHostToLittleInt16(x) @@ -76,13 +52,14 @@ #define betoh64(x) OSSwapBigToHostInt64(x) #define letoh64(x) OSSwapLittleToHostInt64(x) -#elif defined(__OpenBSD__) - -#include <sys/endian.h> +#elif !defined(__OpenBSD__) -#else - -#error OS currently not supported +#define betoh16(x) be16toh(x) +#define letoh16(x) le16toh(x) +#define betoh32(x) be32toh(x) +#define letoh32(x) le32toh(x) +#define betoh64(x) be64toh(x) +#define letoh64(x) le64toh(x) #endif |