diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2012-04-21 10:00:07 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2012-04-21 10:00:07 +0200 |
commit | 44b7299a99d7e0c00722bad994c5f88c6f697068 (patch) | |
tree | 11dcb3092954a7ff29f5b5e82be2a7bd6027fb60 /pgsql.c | |
parent | eb019f7d9c0807f2f7219825cf15fdea047d149b (diff) | |
download | pgfuse-44b7299a99d7e0c00722bad994c5f88c6f697068.tar.gz pgfuse-44b7299a99d7e0c00722bad994c5f88c6f697068.tar.bz2 |
another try to fix around absent be64toh macros
Diffstat (limited to 'pgsql.c')
-rw-r--r-- | pgsql.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -24,7 +24,26 @@ #include <errno.h> /* for ENOENT and friends */ #include <arpa/inet.h> /* for htonl, ntohl */ #include <stdint.h> /* for uint64_t */ -#include <endian.h> /* for be64toh (GNU/BSD-ism, but easy to port if necessary) */ + +/* for be64toh and htobe64 */ +#if defined(__linux__) +#include <endian.h> +#ifndef be64toh +#include <byteswap.h> +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htobe64( x ) bswap_64 ( x ) +#define be64toh( x ) bswap_64( x ) +#else +#define htobe64( x ) ( x ) +#define be64toh( x ) ( x ) +#endif +#endif +#elif defined(__FreeBSD__) || defined(__NetBSD__) +#include <sys/endian.h> +#elif defined(__OpenBSD__) +#include <sys/types.h> +#define be64toh( x ) betoh64(x) +#endif #include "config.h" /* compiled in defaults */ |