Description: fix crosscompile
Origin: http://git.chromium.org/gitweb/?p=chromiumos/overlays/chromiumos-overlay.git;a=blob_plain;f=dev-libs/nspr/files/nspr-4.9.2-r1-cross.patch;hb=HEAD

Index: nspr-4.9.5/mozilla/nsprpub/configure
===================================================================
--- nspr-4.9.5.orig/nspr/configure	2013-03-13 09:51:06.000000000 -0500
+++ nspr-4.9.5/nspr/configure	2013-03-13 09:53:16.000000000 -0500
@@ -1375,16 +1375,16 @@
 
 if test -z "$SKIP_COMPILER_CHECKS"; then
 
-if test "$target" != "$host" -o -n "$CROSS_COMPILE"; then
-    echo "cross compiling from $host to $target"
+if test "$target" != "$build" -o -n "$CROSS_COMPILE"; then
+    echo "cross compiling from $build to $target"
     cross_compiling=yes
 
     _SAVE_CC="$CC"
     _SAVE_CFLAGS="$CFLAGS"
     _SAVE_LDFLAGS="$LDFLAGS"
 
-    echo $ac_n "checking for $host compiler""... $ac_c" 1>&6
-echo "configure:1388: checking for $host compiler" >&5
+    echo $ac_n "checking for $build compiler""... $ac_c" 1>&6
+echo "configure:1388: checking for $build compiler" >&5
     for ac_prog in $HOST_CC gcc cc /usr/ucb/cc
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -1435,8 +1435,8 @@
     CFLAGS="$HOST_CFLAGS"
     LDFLAGS="$HOST_LDFLAGS"
 
-    echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1440: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+    echo $ac_n "checking whether the $build compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1440: checking whether the $build compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
     cat > conftest.$ac_ext <<EOF
 #line 1442 "configure"
 #include "confdefs.h"
@@ -1452,7 +1452,7 @@
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  { echo "configure: error: installation or configuration problem: $host compiler $HOST_CC cannot create executables." 1>&2; exit 1; } 
+  { echo "configure: error: installation or configuration problem: $build compiler $HOST_CC cannot create executables." 1>&2; exit 1; } 
 fi
 rm -f conftest*
 
@@ -2843,6 +2843,9 @@
     i?86-apple-darwin*:powerpc-apple-darwin*)
                                 cross_compiling=yes
         ;;
+    x86_64-*:i686-*)
+                                cross_compiling=yes
+        ;;
 esac
 
 if test "$cross_compiling"  = "yes"; then
Index: nspr-4.9.5/mozilla/nsprpub/configure.in
===================================================================
--- nspr-4.9.5.orig/nspr/configure.in	2013-03-13 09:51:06.000000000 -0500
+++ nspr-4.9.5/nspr/configure.in	2013-03-13 09:51:06.000000000 -0500
@@ -558,15 +558,15 @@
 dnl Explicitly honor $CROSS_COMPILE to allow cross-compiling
 dnl between toolkits on the same architecture, as when
 dnl targeting the iOS Simulator from OS X.
-if test "$target" != "$host" -o -n "$CROSS_COMPILE"; then
-    echo "cross compiling from $host to $target"
+if test "$target" != "$build" -o -n "$CROSS_COMPILE"; then
+    echo "cross compiling from $build to $target"
     cross_compiling=yes
 
     _SAVE_CC="$CC"
     _SAVE_CFLAGS="$CFLAGS"
     _SAVE_LDFLAGS="$LDFLAGS"
 
-    AC_MSG_CHECKING([for $host compiler])
+    AC_MSG_CHECKING([for $build compiler])
     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc, "")
     if test -z "$HOST_CC"; then
         AC_MSG_ERROR([no acceptable cc found in \$PATH])
@@ -583,10 +583,10 @@
     CFLAGS="$HOST_CFLAGS"
     LDFLAGS="$HOST_LDFLAGS"
 
-    AC_MSG_CHECKING([whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
+    AC_MSG_CHECKING([whether the $build compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
     AC_TRY_COMPILE([], [return(0);], 
         [ac_cv_prog_host_cc_works=1 AC_MSG_RESULT([yes])],
-        AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.]) )
+        AC_MSG_ERROR([installation or configuration problem: $build compiler $HOST_CC cannot create executables.]) )
 
     CC=$_SAVE_CC
     CFLAGS=$_SAVE_CFLAGS
@@ -683,6 +683,9 @@
         dnl translated environment, making a cross compiler appear native.
         cross_compiling=yes
         ;;
+    x86_64-*:i686-*)
+        cross_compiling=yes
+        ;;
 esac
 
 if test "$cross_compiling"  = "yes"; then
