THRIFT-340. python: Detect endianness properly on FreeBSD


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745223 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/protocol/fastbinary.c b/lib/py/src/protocol/fastbinary.c
index 0945ca7..7ada44c 100644
--- a/lib/py/src/protocol/fastbinary.c
+++ b/lib/py/src/protocol/fastbinary.c
@@ -50,6 +50,16 @@
   T_UTF16      = 17
 } TType;
 
+#ifndef __BYTE_ORDER
+# if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
+#  define __BYTE_ORDER BYTE_ORDER
+#  define __LITTLE_ENDIAN LITTLE_ENDIAN
+#  define __BIG_ENDIAN BIG_ENDIAN
+# else
+#  error "Cannot determine endianness"
+# endif
+#endif
+
 // Same comment as the enum.  Sorry.
 #if __BYTE_ORDER == __BIG_ENDIAN
 # define ntohll(n) (n)