From: Bryan Duxbury Date: Tue, 17 Aug 2010 17:43:58 +0000 (+0000) Subject: THRIFT-851. php: php extension fails to compile on centos 5.x X-Git-Tag: 0.5.0~168 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=184d26237a3d0a5449a29350a74c2240bf1097e8;p=common%2Fthrift.git THRIFT-851. php: php extension fails to compile on centos 5.x 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 --- diff --git a/configure.ac b/configure.ac index 7aaa4335..412a223d 100644 --- a/configure.ac +++ b/configure.ac @@ -145,7 +145,7 @@ AC_HEADER_STDBOOL 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]) diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h index 7d7b0659..2e24f750 100644 --- a/lib/cpp/src/protocol/TProtocol.h +++ b/lib/cpp/src/protocol/TProtocol.h @@ -76,8 +76,8 @@ namespace apache { namespace thrift { namespace protocol { using apache::thrift::transport::TTransport; -#ifdef HAVE_ENDIAN_H -#include +#ifdef HAVE_SYS_PARAM_H_ +#include #endif #ifndef __BYTE_ORDER diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp index 193669bb..8348a97b 100644 --- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp +++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp @@ -24,13 +24,10 @@ #include #include #include -#include -#include +#include #include -#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) | \ @@ -44,9 +41,11 @@ #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 {