# HG changeset patch
# Parent 1507f021ac93c1d27cfd00e389fba1c9421b3201
# User Ulrich Weigand <uweigand@de.ibm.com>
Bug 976648 - powerpc64le-linux support

diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@@ -1082,17 +1082,17 @@ esac
 
 # Only set CPU_ARCH if we recognize the value of OS_TEST
 
 case "$OS_TEST" in
 *86 | i86pc)
     CPU_ARCH=x86
     ;;
 
-powerpc64 | ppc64)
+powerpc64 | ppc64 | powerpc64le | ppc64le)
     CPU_ARCH=ppc64
     ;;
 
 powerpc | ppc | rs6000)
     CPU_ARCH=ppc
     ;;
 
 Alpha | alpha | ALPHA)
diff --git a/js/src/configure.in b/js/src/configure.in
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -923,17 +923,17 @@ esac
 
 # Only set CPU_ARCH if we recognize the value of OS_TEST
 
 case "$OS_TEST" in
 *86 | i86pc)
     CPU_ARCH=x86
     ;;
 
-powerpc64 | ppc64)
+powerpc64 | ppc64 | powerpc64le | ppc64le)
     CPU_ARCH=ppc64
     ;;
 
 powerpc | ppc | rs6000)
     CPU_ARCH=ppc
     ;;
 
 Alpha | alpha | ALPHA)
diff --git a/js/src/assembler/wtf/Platform.h b/js/src/assembler/wtf/Platform.h
--- a/js/src/assembler/wtf/Platform.h
+++ b/js/src/assembler/wtf/Platform.h
@@ -160,26 +160,32 @@
 /* WTF_CPU_PPC - PowerPC 32-bit */
 #if   defined(__ppc__)     \
     || defined(__PPC__)     \
     || defined(__powerpc__) \
     || defined(__powerpc)   \
     || defined(__POWERPC__) \
     || defined(_M_PPC)      \
     || defined(__PPC)
+#if !defined(__ppc64__) && !defined(__PPC64__)
 #define WTF_CPU_PPC 1
+#endif
+#if !defined(__LITTLE_ENDIAN__)
 #define WTF_CPU_BIG_ENDIAN 1
 #endif
+#endif
 
 /* WTF_CPU_PPC64 - PowerPC 64-bit */
 #if   defined(__ppc64__) \
     || defined(__PPC64__)
 #define WTF_CPU_PPC64 1
+#if !defined(__LITTLE_ENDIAN__)
 #define WTF_CPU_BIG_ENDIAN 1
 #endif
+#endif
 
 /* WTF_CPU_SH4 - SuperH SH-4 */
 #if defined(__SH4__)
 #define WTF_CPU_SH4 1
 #endif
 
 /* WTF_CPU_SPARC32 - SPARC 32-bit */
 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
diff --git a/js/src/jscpucfg.h b/js/src/jscpucfg.h
--- a/js/src/jscpucfg.h
+++ b/js/src/jscpucfg.h
@@ -26,17 +26,17 @@
 #  define HAVE_VA_LIST_AS_ARRAY 1
 # endif
 
 # define IS_LITTLE_ENDIAN 1
 # undef  IS_BIG_ENDIAN
 # define JS_BYTES_PER_WORD   4
 # define JS_BITS_PER_WORD_LOG2   5
 
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__powerpc__) || defined(__ppc__)
 # if __LITTLE_ENDIAN__
 #  define IS_LITTLE_ENDIAN 1
 #  undef  IS_BIG_ENDIAN
 # elif __BIG_ENDIAN__
 #  undef  IS_LITTLE_ENDIAN
 #  define IS_BIG_ENDIAN 1
 # endif
 
@@ -88,18 +88,17 @@
 #  if defined(_STACK_GROWS_UPWARD)
 #   define JS_STACK_GROWTH_DIRECTION (1)
 #  elif defined(_STACK_GROWS_DOWNWARD)
 #   define JS_STACK_GROWTH_DIRECTION (-1)
 #  endif
 # endif
 
 #elif defined(__sparc) || defined(__sparc__) || \
-      defined(_POWER) || defined(__powerpc__) || \
-      defined(__ppc__) || defined(__hppa) || \
+      defined(_POWER) || defined(__hppa) || \
       defined(_MIPSEB) || defined(_BIG_ENDIAN)
 /* IA64 running HP-UX will have _BIG_ENDIAN defined.
  * IA64 running Linux will have endian.h and be handled above.
  */
 # undef IS_LITTLE_ENDIAN
 # define IS_BIG_ENDIAN 1
 
 #else /* !defined(__sparc) && !defined(__sparc__) && ... */
diff --git a/nsprpub/pr/include/md/_linux.cfg b/nsprpub/pr/include/md/_linux.cfg
--- a/nsprpub/pr/include/md/_linux.cfg
+++ b/nsprpub/pr/include/md/_linux.cfg
@@ -24,18 +24,23 @@
 #elif defined(__GNU__)
 #define PR_AF_INET6 26  /* same as AF_INET6 */
 #else
 #define PR_AF_INET6 10  /* same as AF_INET6 */
 #endif
 
 #ifdef __powerpc64__
 
+#ifdef __LITTLE_ENDIAN__
+#define IS_LITTLE_ENDIAN 1
+#undef  IS_BIG_ENDIAN
+#else
 #undef  IS_LITTLE_ENDIAN
 #define IS_BIG_ENDIAN    1
+#endif
 #define IS_64
 
 #define PR_BYTES_PER_BYTE   1
 #define PR_BYTES_PER_SHORT  2
 #define PR_BYTES_PER_INT    4
 #define PR_BYTES_PER_INT64  8
 #define PR_BYTES_PER_LONG   8
 #define PR_BYTES_PER_FLOAT  4
@@ -70,18 +75,23 @@
 #define PR_ALIGN_OF_POINTER 8
 #define PR_ALIGN_OF_WORD    8
 
 #define PR_BYTES_PER_WORD_LOG2   3
 #define PR_BYTES_PER_DWORD_LOG2  3
 
 #elif defined(__powerpc__)
 
+#ifdef __LITTLE_ENDIAN__
+#define IS_LITTLE_ENDIAN 1
+#undef  IS_BIG_ENDIAN
+#else
 #undef  IS_LITTLE_ENDIAN
 #define IS_BIG_ENDIAN    1
+#endif
 
 #define PR_BYTES_PER_BYTE   1
 #define PR_BYTES_PER_SHORT  2
 #define PR_BYTES_PER_INT    4
 #define PR_BYTES_PER_INT64  8
 #define PR_BYTES_PER_LONG   4
 #define PR_BYTES_PER_FLOAT  4
 #define PR_BYTES_PER_DOUBLE 8
