dnl of the POSIX Real-Time Extensions.  This seems necessary on Linux,
 dnl and we haven't yet found a system where this is a problem.
 AC_CHECK_LIB(rt, clock_gettime)
+AC_CHECK_LIB(socket, setsockopt)
 
 AC_TYPE_INT16_T
 AC_TYPE_INT32_T
 
 #  define __LITTLE_ENDIAN LITTLE_ENDIAN
 #  define __BIG_ENDIAN BIG_ENDIAN
 # else
-#  error "Cannot determine endianness"
+#  include <boost/config.hpp>
+#  define __BYTE_ORDER BOOST_BYTE_ORDER
+#  define __LITTLE_ENDIAN BOOST_LITTLE_ENDIAN
+#  define __BIG_ENDIAN BOOST_BIG_ENDIAN
 # endif
 #endif
 
 
 #include <errno.h>
 #include <assert.h>
 
+#ifndef AF_LOCAL
+#define AF_LOCAL AF_UNIX
+#endif
+
 namespace apache { namespace thrift { namespace server {
 
 using namespace apache::thrift::protocol;
 
 #include "TServerSocket.h"
 #include <boost/shared_ptr.hpp>
 
+#ifndef AF_LOCAL
+#define AF_LOCAL AF_UNIX
+#endif
+
 namespace apache { namespace thrift { namespace transport {
 
 using namespace std;