Adapt hash tests to big-endian systems.

The hash code, which has MurmurHash3 at its core, generates different
output depending on system endianness, so adapt the expected output on
big-endian systems.  MurmurHash3 code also makes the assumption that
unaligned access is okay (not true on all systems), but jemalloc only
hashes data structures that have sufficient alignment to dodge this
limitation.
diff --git a/configure.ac b/configure.ac
index 3837a78..d5c663e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,6 +150,11 @@
 fi
 AC_PROG_CPP
 
+AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
+if test "x${ac_cv_big_endian}" = "x1" ; then
+  AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
+fi
+
 AC_CHECK_SIZEOF([void *])
 if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
   LG_SIZEOF_PTR=3
diff --git a/include/jemalloc/internal/hash.h b/include/jemalloc/internal/hash.h
index 09b69df..c7183ed 100644
--- a/include/jemalloc/internal/hash.h
+++ b/include/jemalloc/internal/hash.h
@@ -320,7 +320,7 @@
 JEMALLOC_INLINE void
 hash(const void *key, size_t len, const uint32_t seed, size_t r_hash[2])
 {
-#if (LG_SIZEOF_PTR == 3)
+#if (LG_SIZEOF_PTR == 3 && !defined(JEMALLOC_BIG_ENDIAN))
 	hash_x64_128(key, len, seed, (uint64_t *)r_hash);
 #else
 	uint64_t hashes[2];
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in
index e3758e4..c166fbd 100644
--- a/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in
@@ -190,6 +190,9 @@
 /* C99 restrict keyword supported. */
 #undef JEMALLOC_HAS_RESTRICT
 
+/* For use by hash code. */
+#undef JEMALLOC_BIG_ENDIAN
+
 /* sizeof(int) == 2^LG_SIZEOF_INT. */
 #undef LG_SIZEOF_INT
 
diff --git a/test/unit/hash.c b/test/unit/hash.c
index 0446e52..abb394a 100644
--- a/test/unit/hash.c
+++ b/test/unit/hash.c
@@ -122,9 +122,15 @@
 	    (final[3] << 24);
 
 	switch (variant) {
+#ifdef JEMALLOC_BIG_ENDIAN
+	case hash_variant_x86_32: expected = 0x6213303eU; break;
+	case hash_variant_x86_128: expected = 0x266820caU; break;
+	case hash_variant_x64_128: expected = 0xcc622b6fU; break;
+#else
 	case hash_variant_x86_32: expected = 0xb0f57ee3U; break;
 	case hash_variant_x86_128: expected = 0xb3ece62aU; break;
 	case hash_variant_x64_128: expected = 0x6384ba69U; break;
+#endif
 	default: not_reached();
 	}