This patch introduces an approach that is compatbile with both centos and Mac.
Patch: Todd Lipcon
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@986410
13f79535-47bb-0310-9956-
ffa450edef68
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([arpa/inet.h])
-AC_CHECK_HEADERS([endian.h])
+AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([limits.h])
using apache::thrift::transport::TTransport;
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
+#ifdef HAVE_SYS_PARAM_H_
+#include <sys/param.h>
#endif
#ifndef __BYTE_ORDER
#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>
-#include <machine/endian.h>
-#include <machine/byte_order.h>
+#include <sys/param.h>
#include <stdexcept>
-#ifndef _BYTESWAP_H
-#define _BYTESWAP_H
-
+#ifndef bswap_64
#define bswap_64(x) (((uint64_t)(x) << 56) | \
(((uint64_t)(x) << 40) & 0xff000000000000ULL) | \
(((uint64_t)(x) << 24) & 0xff0000000000ULL) | \
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htonll(x) bswap_64(x)
#define ntohll(x) bswap_64(x)
-#else
+#elif __BYTE_ORDER == __BIG_ENDIAN
#define htonll(x) x
#define ntohll(x) x
+#else
+#error Unknown __BYTE_ORDER
#endif
enum TType {