Author: bryanduxbury
Date: Tue Aug 17 17:43:58 2010
New Revision: 986410

URL: http://svn.apache.org/viewvc?rev=986410&view=rev
Log:
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

Modified:
    incubator/thrift/trunk/configure.ac
    incubator/thrift/trunk/lib/cpp/src/protocol/TProtocol.h
    
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp

Modified: incubator/thrift/trunk/configure.ac
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/configure.ac?rev=986410&r1=986409&r2=986410&view=diff
==============================================================================
--- incubator/thrift/trunk/configure.ac (original)
+++ incubator/thrift/trunk/configure.ac Tue Aug 17 17:43:58 2010
@@ -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])

Modified: incubator/thrift/trunk/lib/cpp/src/protocol/TProtocol.h
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/protocol/TProtocol.h?rev=986410&r1=986409&r2=986410&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/cpp/src/protocol/TProtocol.h (original)
+++ incubator/thrift/trunk/lib/cpp/src/protocol/TProtocol.h Tue Aug 17 17:43:58 
2010
@@ -76,8 +76,8 @@ namespace apache { namespace thrift { na
 
 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

Modified: 
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp?rev=986410&r1=986409&r2=986410&view=diff
==============================================================================
--- 
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp 
(original)
+++ 
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp 
Tue Aug 17 17:43:58 2010
@@ -24,13 +24,10 @@
 #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) | \
@@ -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 {


Reply via email to