update nspr to NSPR_HEAD_20100604 r=ted
authorBrad Lassey <blassey@mozilla.com>
Sat, 05 Jun 2010 13:15:50 -0400
changeset 43125 b5b016bb7c91740a438ecc24d1cbc41fb61a9302
parent 43124 ea4e623e936d7a1c03df8967b3bd8d99c5286893
child 43126 8bc975526c0fb0912701477a79f0b94789dce9c2
push idunknown
push userunknown
push dateunknown
reviewersted
milestone1.9.3a5pre
update nspr to NSPR_HEAD_20100604 r=ted
nsprpub/config/autoconf.mk.in
nsprpub/config/config.mk
nsprpub/configure
nsprpub/configure.in
nsprpub/lib/libc/include/plgetopt.h
nsprpub/lib/libc/src/plgetopt.c
nsprpub/pr/include/md/_openbsd.h
nsprpub/pr/include/md/_pth.h
nsprpub/pr/include/md/_winnt.h
nsprpub/pr/include/pratom.h
nsprpub/pr/src/md/unix/os_Darwin_ppc.s
nsprpub/pr/src/md/unix/os_Darwin_x86.s
nsprpub/pr/src/md/unix/os_Darwin_x86_64.s
nsprpub/pr/src/md/unix/os_HPUX.s
nsprpub/pr/src/md/unix/os_Linux_x86_64.s
nsprpub/pr/src/md/unix/uxrng.c
nsprpub/pr/src/misc/prinit.c
nsprpub/pr/src/misc/prsystem.c
nsprpub/pr/src/pthreads/ptsynch.c
nsprpub/pr/src/pthreads/ptthread.c
nsprpub/pr/src/threads/combined/pruthr.c
nsprpub/pr/src/threads/prtpd.c
nsprpub/pr/tests/nbconn.c
--- a/nsprpub/config/autoconf.mk.in
+++ b/nsprpub/config/autoconf.mk.in
@@ -78,17 +78,24 @@ OS_CFLAGS	= $(OS_CPPFLAGS) @CFLAGS@ $(DS
 OS_CXXFLAGS	= $(OS_CPPFLAGS) @CXXFLAGS@ $(DSO_CFLAGS)
 OS_LIBS         = @OS_LIBS@
 OS_LDFLAGS	= @LDFLAGS@
 OS_DLLFLAGS	= @OS_DLLFLAGS@
 DLLFLAGS	= @DLLFLAGS@
 EXEFLAGS  = @EXEFLAGS@
 OPTIMIZER	= @OPTIMIZER@
 
+PROFILE_GEN_CFLAGS  = @PROFILE_GEN_CFLAGS@
+PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@
+PROFILE_USE_CFLAGS  = @PROFILE_USE_CFLAGS@
+PROFILE_USE_LDFLAGS = @PROFILE_USE_LDFLAGS@
+
 MKSHLIB		= @MKSHLIB@
+WRAP_MALLOC_LIB = @WRAP_MALLOC_LIB@
+WRAP_MALLOC_CFLAGS = @WRAP_MALLOC_CFLAGS@
 DSO_CFLAGS	= @DSO_CFLAGS@
 DSO_LDOPTS	= @DSO_LDOPTS@
 
 RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYMBOLS@
 
 HOST_CC		= @HOST_CC@
 HOST_CFLAGS	= @HOST_CFLAGS@
 HOST_LDFLAGS	= @HOST_LDFLAGS@
--- a/nsprpub/config/config.mk
+++ b/nsprpub/config/config.mk
@@ -69,16 +69,27 @@ CCCFLAGS	= $(VISIBILITY_FLAGS) $(CCC_ONL
 # For purify
 NOMD_CFLAGS	= $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
 		  $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
 NOMD_CCFLAGS	= $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
 		  $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
 
 LDFLAGS		= $(OS_LDFLAGS)
 
+# Enable profile-guided optimization
+ifdef MOZ_PROFILE_GENERATE
+CFLAGS += $(PROFILE_GEN_CFLAGS)
+LDFLAGS += $(PROFILE_GEN_LDFLAGS)
+endif # MOZ_PROFILE_GENERATE
+
+ifdef MOZ_PROFILE_USE
+CFLAGS += $(PROFILE_USE_CFLAGS)
+LDFLAGS += $(PROFILE_USE_LDFLAGS)
+endif # MOZ_PROFILE_USE
+
 define MAKE_OBJDIR
 if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
 endef
 
 LINK_DLL	= $(LD) $(OS_DLLFLAGS) $(DLLFLAGS)
 
 ifeq ($(OS_ARCH),Darwin)
 PWD := $(shell pwd)
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -62,16 +62,18 @@ ac_help="$ac_help
   --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)"
 ac_help="$ac_help
   --enable-macos-target=VER
                           Set the minimum MacOS version needed at runtime
                           [10.2 for ppc, 10.4 for x86]"
 ac_help="$ac_help
   --disable-os2-high-mem  Disable high-memory support on OS/2"
 ac_help="$ac_help
+  --enable-thumb2              Enable Thumb2 instruction set"
+ac_help="$ac_help
   --with-symbian-sdk=SYMBIAN_SDK_DIR
                           The path to the Symbian SDK"
 ac_help="$ac_help
   --enable-strip          Enable stripping of shared libs and programs"
 ac_help="$ac_help
   --with-pthreads         Use system pthreads library as thread subsystem"
 ac_help="$ac_help
   --enable-user-pthreads  Build using userland pthreads"
@@ -79,16 +81,20 @@ ac_help="$ac_help
   --enable-nspr-threads   Build using classic nspr threads"
 ac_help="$ac_help
   --with-bthreads         Use system bthreads library as thread subsystem
                           (BeOS only)"
 ac_help="$ac_help
   --enable-ipv6           Compile ipv6 support"
 ac_help="$ac_help
   --enable-boehm          Enable the Boehm Garbage Collector"
+ac_help="$ac_help
+  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)"
+ac_help="$ac_help
+  --with-wrap-malloc=SHAREDLIB  Location of malloc wrapper library"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
 # dashes changed to underlines.
 build=NONE
 cache_file=./config.cache
 exec_prefix=NONE
 host=NONE
@@ -637,17 +643,17 @@ esac
 
 
 # Make sure we can run config.sub.
 if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
 else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:646: checking host system type" >&5
+echo "configure:652: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
 NONE)
   case $nonopt in
   NONE)
     if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
     else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
@@ -658,17 +664,17 @@ esac
 
 host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:667: checking target system type" >&5
+echo "configure:673: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
 NONE)
   case $nonopt in
   NONE) target_alias=$host_alias ;;
   *) target_alias=$nonopt ;;
   esac ;;
@@ -676,17 +682,17 @@ esac
 
 target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
 target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:685: checking build system type" >&5
+echo "configure:691: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
 NONE)
   case $nonopt in
   NONE) build_alias=$host_alias ;;
   *) build_alias=$nonopt ;;
   esac ;;
@@ -729,16 +735,21 @@ NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_
 NOSUCHFILE=/no-such-file
 LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
 LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)'
 CYGWIN_WRAPPER=
 MACOS_SDK_DIR=
 NEXT_ROOT=
 MT=
 MOZ_OS2_HIGH_MEMORY=1
+MOZ_THUMB2=
+PROFILE_GEN_CFLAGS=
+PROFILE_GEN_LDFLAGS=
+PROFILE_USE_CFLAGS=
+PROFILE_USE_LDFLAGS=
 
 RESOLVE_LINK_SYMBOLS=
 
 CFLAGS="${CFLAGS=}"
 CXXFLAGS="${CXXFLAGS=}"
 LDFLAGS="${LDFLAGS=}"
 DLLFLAGS="${DLLFLAGS=}"
 HOST_CFLAGS="${HOST_CFLAGS=}"
@@ -748,17 +759,17 @@ case "$target" in
 *-cygwin*|*-mingw*)
     # Check to see if we are really running in a msvc environemnt
     _WIN32_MSVC=
     for ac_prog in cl
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:757: checking for $ac_word" >&5
+echo "configure:768: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -848,18 +859,18 @@ if test "$target" = "arm-android-eabi" ;
     CXX="$android_toolchain"/bin/arm-eabi-g++
     CPP="$android_toolchain"/bin/arm-eabi-cpp
     LD="$android_toolchain"/bin/arm-eabi-ld
     AR="$android_toolchain"/bin/arm-eabi-ar
     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
     STRIP="$android_toolchain"/bin/arm-eabi-strip
 
     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
-    CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
-    CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS"
+    CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
+    CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS"
     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
 
         if test -z "$HOST_CPPFLAGS" ; then
         HOST_CPPFLAGS=" "
     fi
     if test -z "$HOST_CFLAGS" ; then
         HOST_CFLAGS=" "
     fi
@@ -1161,17 +1172,17 @@ if test -z "$CXX"; then
 
     esac
 fi
 
 if test -z "$SKIP_PATH_CHECKS"; then
     # Extract the first word of "$WHOAMI whoami", so it can be a program name with args.
 set dummy $WHOAMI whoami; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1170: checking for $ac_word" >&5
+echo "configure:1181: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$WHOAMI" in
   /*)
   ac_cv_path_WHOAMI="$WHOAMI" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -1232,23 +1243,23 @@ if test "$target" != "$host"; then
     echo "cross compiling from $host 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:1241: checking for $host compiler" >&5
+echo "configure:1252: checking for $host 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.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1247: checking for $ac_word" >&5
+echo "configure:1258: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$HOST_CC"; then
   ac_cv_prog_HOST_CC="$HOST_CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1284,26 +1295,26 @@ test -n "$HOST_CC" || HOST_CC=""""
         HOST_LDFLAGS="$LDFLAGS"
     fi
 
     CC="$HOST_CC"
     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:1293: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+echo "configure:1304: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
     cat > conftest.$ac_ext <<EOF
-#line 1295 "configure"
+#line 1306 "configure"
 #include "confdefs.h"
 
 int main() {
 return(0);
 ; return 0; }
 EOF
-if { (eval echo configure:1302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6
 else
   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; } 
 fi
@@ -1322,17 +1333,17 @@ rm -f conftest*
         ;;        
     esac            
 
     for ac_prog in $CC "${target_alias}-gcc" "${target}-gcc"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1331: checking for $ac_word" >&5
+echo "configure:1342: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1356,17 +1367,17 @@ fi
 test -n "$CC" && break
 done
 test -n "$CC" || CC="echo"
 
     unset ac_cv_prog_CC
     # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1365: checking for $ac_word" >&5
+echo "configure:1376: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1386,17 +1397,17 @@ if test -n "$CC"; then
 else
   echo "$ac_t""no" 1>&6
 fi
 
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1395: checking for $ac_word" >&5
+echo "configure:1406: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
@@ -1437,17 +1448,17 @@ else
 fi
 
   if test -z "$CC"; then
     case "`uname -s`" in
     *win32* | *WIN32*)
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1446: checking for $ac_word" >&5
+echo "configure:1457: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1469,33 +1480,33 @@ else
 fi
  ;;
     esac
   fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1489: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 1489 "configure"
+#line 1500 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cc_cross=no
   else
     ac_cv_prog_cc_cross=yes
   fi
 else
@@ -1511,31 +1522,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1520: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1531: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1525: checking whether we are using GNU C" >&5
+echo "configure:1536: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1545: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
@@ -1544,17 +1555,17 @@ if test $ac_cv_prog_gcc = yes; then
 else
   GCC=
 fi
 
 ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1553: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1564: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -1581,17 +1592,17 @@ else
 fi
 
     if test -n "$USE_CPLUS"; then
         for ac_prog in $CXX "${target_alias}-g++" "${target}-g++"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1590: checking for $ac_word" >&5
+echo "configure:1601: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CXX"; then
   ac_cv_prog_CXX="$CXX" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1617,17 +1628,17 @@ done
 test -n "$CXX" || CXX="echo"
 
         unset ac_cv_prog_CXX
         for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1626: checking for $ac_word" >&5
+echo "configure:1637: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CXX"; then
   ac_cv_prog_CXX="$CXX" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1649,33 +1660,33 @@ else
 fi
 
 test -n "$CXX" && break
 done
 test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1658: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1669: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cxx_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 1669 "configure"
+#line 1680 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cxx_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cxx_cross=no
   else
     ac_cv_prog_cxx_cross=yes
   fi
 else
@@ -1691,31 +1702,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
 if test $ac_cv_prog_cxx_works = no; then
   { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1700: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1711: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
 cross_compiling=$ac_cv_prog_cxx_cross
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1705: checking whether we are using GNU C++" >&5
+echo "configure:1716: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.C <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gxx" 1>&6
 
@@ -1724,17 +1735,17 @@ if test $ac_cv_prog_gxx = yes; then
 else
   GXX=
 fi
 
 ac_test_CXXFLAGS="${CXXFLAGS+set}"
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1733: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1744: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.cc
 if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -1769,17 +1780,17 @@ fi
         ;;
     esac
 
     for ac_prog in $RANLIB "${target_alias}-ranlib" "${target}-ranlib"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1778: checking for $ac_word" >&5
+echo "configure:1789: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1804,17 +1815,17 @@ test -n "$RANLIB" && break
 done
 test -n "$RANLIB" || RANLIB="echo"
 
     for ac_prog in $AR "${target_alias}-ar" "${target}-ar"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1813: checking for $ac_word" >&5
+echo "configure:1824: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$AR"; then
   ac_cv_prog_AR="$AR" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1839,17 +1850,17 @@ test -n "$AR" && break
 done
 test -n "$AR" || AR="echo"
 
     for ac_prog in $AS "${target_alias}-as" "${target}-as"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1848: checking for $ac_word" >&5
+echo "configure:1859: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$AS"; then
   ac_cv_prog_AS="$AS" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1874,17 +1885,17 @@ test -n "$AS" && break
 done
 test -n "$AS" || AS="echo"
 
     for ac_prog in $LD "${target_alias}-ld" "${target}-ld"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1883: checking for $ac_word" >&5
+echo "configure:1894: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$LD"; then
   ac_cv_prog_LD="$LD" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1909,17 +1920,17 @@ test -n "$LD" && break
 done
 test -n "$LD" || LD="echo"
 
     for ac_prog in $STRIP "${target_alias}-strip" "${target}-strip"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1918: checking for $ac_word" >&5
+echo "configure:1929: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$STRIP"; then
   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1944,17 +1955,17 @@ test -n "$STRIP" && break
 done
 test -n "$STRIP" || STRIP="echo"
 
     for ac_prog in $WINDRES "${target_alias}-windres" "${target}-windres"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1953: checking for $ac_word" >&5
+echo "configure:1964: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$WINDRES"; then
   ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1979,17 +1990,17 @@ test -n "$WINDRES" && break
 done
 test -n "$WINDRES" || WINDRES="echo"
 
 
 else
     # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1988: checking for $ac_word" >&5
+echo "configure:1999: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -2009,17 +2020,17 @@ if test -n "$CC"; then
 else
   echo "$ac_t""no" 1>&6
 fi
 
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2018: checking for $ac_word" >&5
+echo "configure:2029: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
@@ -2060,17 +2071,17 @@ else
 fi
 
   if test -z "$CC"; then
     case "`uname -s`" in
     *win32* | *WIN32*)
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2069: checking for $ac_word" >&5
+echo "configure:2080: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -2092,33 +2103,33 @@ else
 fi
  ;;
     esac
   fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2101: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2112: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 2112 "configure"
+#line 2123 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cc_cross=no
   else
     ac_cv_prog_cc_cross=yes
   fi
 else
@@ -2134,31 +2145,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2143: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2154: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2148: checking whether we are using GNU C" >&5
+echo "configure:2159: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
@@ -2167,17 +2178,17 @@ if test $ac_cv_prog_gcc = yes; then
 else
   GCC=
 fi
 
 ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2176: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2187: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -2207,17 +2218,17 @@ fi
         if test "$CC" = "cl" -a -z "$CXX"; then
             CXX=$CC
         else        
             for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2216: checking for $ac_word" >&5
+echo "configure:2227: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CXX"; then
   ac_cv_prog_CXX="$CXX" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -2239,33 +2250,33 @@ else
 fi
 
 test -n "$CXX" && break
 done
 test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2248: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:2259: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cxx_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 2259 "configure"
+#line 2270 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:2264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cxx_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cxx_cross=no
   else
     ac_cv_prog_cxx_cross=yes
   fi
 else
@@ -2281,31 +2292,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
 if test $ac_cv_prog_cxx_works = no; then
   { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2290: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2301: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
 cross_compiling=$ac_cv_prog_cxx_cross
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:2295: checking whether we are using GNU C++" >&5
+echo "configure:2306: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.C <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gxx" 1>&6
 
@@ -2314,17 +2325,17 @@ if test $ac_cv_prog_gxx = yes; then
 else
   GXX=
 fi
 
 ac_test_CXXFLAGS="${CXXFLAGS+set}"
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:2323: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:2334: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.cc
 if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -2348,72 +2359,72 @@ else
   else
     CXXFLAGS=
   fi
 fi
 
         fi
     fi
     echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2357: checking how to run the C preprocessor" >&5
+echo "configure:2368: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     # This must be in double quotes, not single quotes, because CPP may get
   # substituted into the Makefile and "${CC-cc}" will confuse make.
   CPP="${CC-cc} -E"
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2372 "configure"
+#line 2383 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2389 "configure"
+#line 2400 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2406 "configure"
+#line 2417 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
@@ -2430,17 +2441,17 @@ fi
 else
   ac_cv_prog_CPP="$CPP"
 fi
 echo "$ac_t""$CPP" 1>&6
 
     # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2439: checking for $ac_word" >&5
+echo "configure:2450: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -2462,17 +2473,17 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
     for ac_prog in as
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2471: checking for $ac_word" >&5
+echo "configure:2482: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$AS" in
   /*)
   ac_cv_path_AS="$AS" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2503,17 +2514,17 @@ test -n "$AS" && break
 done
 test -n "$AS" || AS="$CC"
 
     for ac_prog in ar
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2512: checking for $ac_word" >&5
+echo "configure:2523: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$AR" in
   /*)
   ac_cv_path_AR="$AR" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2544,17 +2555,17 @@ test -n "$AR" && break
 done
 test -n "$AR" || AR="echo not_ar"
 
     for ac_prog in ld link
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2553: checking for $ac_word" >&5
+echo "configure:2564: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$LD" in
   /*)
   ac_cv_path_LD="$LD" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2585,17 +2596,17 @@ test -n "$LD" && break
 done
 test -n "$LD" || LD="echo not_ld"
 
     for ac_prog in strip
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2594: checking for $ac_word" >&5
+echo "configure:2605: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$STRIP" in
   /*)
   ac_cv_path_STRIP="$STRIP" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2626,17 +2637,17 @@ test -n "$STRIP" && break
 done
 test -n "$STRIP" || STRIP="echo not_strip"
 
     for ac_prog in windres
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2635: checking for $ac_word" >&5
+echo "configure:2646: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$WINDRES" in
   /*)
   ac_cv_path_WINDRES="$WINDRES" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2694,39 +2705,39 @@ esac
 
 if test "$cross_compiling"  = "yes"; then
     CROSS_COMPILE=1
 else
     CROSS_COMPILE=
 fi
 
 echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6
-echo "configure:2703: checking for gcc -pipe support" >&5
+echo "configure:2714: checking for gcc -pipe support" >&5
 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
     echo '#include <stdio.h>' > dummy-hello.c
     echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c
     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
     cat dummy-hello.s | ${AS} -o dummy-hello.S - 2>&5
     if test $? = 0; then
         _res_as_stdin="yes"
     else
         _res_as_stdin="no"
     fi
     if test "$_res_as_stdin" = "yes"; then
         _SAVE_CFLAGS=$CFLAGS
         CFLAGS="$CFLAGS -pipe"
         cat > conftest.$ac_ext <<EOF
-#line 2718 "configure"
+#line 2729 "configure"
 #include "confdefs.h"
  #include <stdio.h> 
 int main() {
 printf("Hello World\n");
 ; return 0; }
 EOF
-if { (eval echo configure:2725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   _res_gcc_pipe="yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   _res_gcc_pipe="no" 
 fi
@@ -2741,19 +2752,54 @@ rm -f conftest*
         _res="no"
     fi
     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
     echo "$ac_t""$_res" 1>&6
 else
     echo "$ac_t""no" 1>&6
 fi
 
+
+_SAVE_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
+
+echo $ac_n "checking whether C compiler supports -fprofile-generate""... $ac_c" 1>&6
+echo "configure:2766: checking whether C compiler supports -fprofile-generate" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2768 "configure"
+#include "confdefs.h"
+
+int main() {
+return 0;
+; return 0; }
+EOF
+if { (eval echo configure:2775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+   PROFILE_GEN_CFLAGS="-fprofile-generate"
+                 result="yes" 
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  result="no"
+fi
+rm -f conftest*
+echo "$ac_t""$result" 1>&6
+
+if test $result = "yes"; then
+   PROFILE_GEN_LDFLAGS="-fprofile-generate"
+   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freoder-blocks-and-partition"
+   PROFILE_USE_LDFLAGS="-fprofile-use"
+fi
+
+CFLAGS="$_SAVE_CFLAGS"
+
 if test "$GNU_CC"; then
     echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6
-echo "configure:2752: checking for visibility(hidden) attribute" >&5
+echo "configure:2798: checking for visibility(hidden) attribute" >&5
 if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
         int foo __attribute__ ((visibility ("hidden"))) = 1;
 EOF
         ac_cv_visibility_hidden=no
         if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
@@ -2767,17 +2813,17 @@ fi
 
 echo "$ac_t""$ac_cv_visibility_hidden" 1>&6
     if test "$ac_cv_visibility_hidden" = "yes"; then
         cat >> confdefs.h <<\EOF
 #define HAVE_VISIBILITY_HIDDEN_ATTRIBUTE 1
 EOF
 
         echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6
-echo "configure:2776: checking for visibility pragma support" >&5
+echo "configure:2822: checking for visibility pragma support" >&5
 if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
 #pragma GCC visibility push(hidden)
             int foo_hidden = 1;
 #pragma GCC visibility push(default)
             int foo_default = 1;
@@ -2820,17 +2866,17 @@ fi # GNU_CC
 fi # SKIP_COMPILER_CHECKS
 
 if test -z "$SKIP_PATH_CHECKS"; then
     for ac_prog in perl5 perl
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2829: checking for $ac_word" >&5
+echo "configure:2875: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$PERL" in
   /*)
   ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -3032,16 +3078,42 @@ if test "${enable_os2_high_mem+set}" = s
    if test "$enableval" = "no"; then
         MOZ_OS2_HIGH_MEMORY=
       else
         MOZ_OS2_HIGH_MEMORY=1
       fi 
 fi
 
 
+# Check whether --enable-thumb2 or --disable-thumb2 was given.
+if test "${enable_thumb2+set}" = set; then
+  enableval="$enable_thumb2"
+   if test "$enableval" = "yes"; then
+     MOZ_THUMB2=1,
+   fi 
+fi
+
+
+if test -n "$MOZ_THUMB2"; then
+  case "$target_cpu" in
+    arm*)
+      if test "$GNU_CC"; then
+        CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
+        CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
+        ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
+      else
+        { echo "configure: error: --enable-thumb2 is not supported for non-GNU toolchains" 1>&2; exit 1; }
+      fi
+    ;;
+    *)
+      { echo "configure: error: --enable-thumb2 is not supported for non-ARM CPU architectures" 1>&2; exit 1; }
+    ;;
+  esac
+fi
+
 case "$host" in
 *-mingw*)
     NSINSTALL=nsinstall
     ;;
 *-cygwin*|*-msvc*|*-mks*|*-wince*|*-winmo*)
     NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
     if test `echo "${PATH}" | grep -c \;` = 0; then
         CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
@@ -3070,27 +3142,27 @@ EOF
 
     cat >> confdefs.h <<\EOF
 #define SYSV 1
 EOF
 
     DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
     ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
-echo "configure:3079: checking for sys/atomic_op.h" >&5
+echo "configure:3151: checking for sys/atomic_op.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3084 "configure"
+#line 3156 "configure"
 #include "confdefs.h"
 #include <sys/atomic_op.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -3237,36 +3309,36 @@ EOF
     PR_MD_ARCH_DIR=beos
     RESOLVE_LINK_SYMBOLS=1
     case "${target_cpu}" in
     i*86)
         _OPTIMIZE_FLAGS=-O2
         _DEBUG_FLAGS='-gdwarf-2 -O0'
         MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
         echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
-echo "configure:3246: checking for gethostbyaddr in -lbind" >&5
+echo "configure:3318: checking for gethostbyaddr in -lbind" >&5
 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3254 "configure"
+#line 3326 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char gethostbyaddr();
 
 int main() {
 gethostbyaddr()
 ; return 0; }
 EOF
-if { (eval echo configure:3265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=no"
 fi
@@ -3989,17 +4061,17 @@ EOF
     cat >> confdefs.h <<\EOF
 #define LINUX 1
 EOF
 
     CFLAGS="$CFLAGS -Wall"
     CXXFLAGS="$CXXFLAGS -Wall"
     MDCPUCFG_H=_linux.cfg
     PR_MD_CSRCS=linux.c
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
     _OPTIMIZE_FLAGS=-O2
     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
                                    # combo is not yet good at debugging inlined
                                    # functions (even when using DWARF2 as the
                                    # debugging format)
     COMPILER_TAG=_glibc
@@ -4032,17 +4104,17 @@ EOF
 EOF
 
         ;;
     esac
     CFLAGS="$CFLAGS -Wall"
     CXXFLAGS="$CXXFLAGS -Wall"
     MDCPUCFG_H=_linux.cfg
     PR_MD_CSRCS=linux.c
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
     _OPTIMIZE_FLAGS=-O2
     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
                                    # combo is not yet good at debugging inlined
                                    # functions (even when using DWARF2 as the
                                    # debugging format)
     COMPILER_TAG=_glibc
@@ -4136,21 +4208,41 @@ EOF
         STRIP='echo not_strip'
         RC=rc.exe
         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
         OBJ_SUFFIX=obj
         LIB_SUFFIX=lib
         DLL_SUFFIX=dll
 
         # Determine compiler version
-        CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
-        _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'`
-        _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'`
+        
+        _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
+        
+
+        CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
+        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`
+        _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'`
+        _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'`
+        _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'`
         MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
 
+        if test "$_CC_MAJOR_VERSION" = "14"; then
+                                            if test $_CC_RELEASE -gt 50727; then
+              _USE_DYNAMICBASE=1
+           elif test $_CC_BUILD -ge 762; then
+              _USE_DYNAMICBASE=1
+           fi
+        elif test $_CC_MAJOR_VERSION -gt 15; then
+           _USE_DYNAMICBASE=1    
+        fi
+
+        if test -n "$_USE_DYNAMICBASE"; then
+           DLLFLAGS="$DLLFLAGS -DYNAMICBASE"
+        fi
+
         # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic
         # tape manipulation utility (or something else)
         if test "$MSC_VER" -ge "1400"; then
             
             _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
             
 
             MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
@@ -4165,16 +4257,22 @@ EOF
                 { echo "configure: error: Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
             fi
         fi
         
         CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
         DLLFLAGS="$DLLFLAGS -OUT:\"\$@\""
         _DEBUG_FLAGS=-Zi
         _OPTIMIZE_FLAGS=-O2
+
+        PROFILE_GEN_CFLAGS="-GL"
+        PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
+        PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
+        PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
+
         if test -z "$MOZ_OPTIMIZE"; then
             CFLAGS="$CFLAGS -Od"
         fi
 
         if test -n "$USE_DEBUG_RTL"; then
             CFLAGS="$CFLAGS -MDd"
         else
             CFLAGS="$CFLAGS -MD"
@@ -4606,27 +4704,27 @@ EOF
     if test -z "$GNU_CC"; then
         CC="$CC -std1 -ieee_with_inexact"
         if test "$OS_RELEASE" != "V2.0"; then
             CC="$CC -readonly_strings"
         fi
         _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
         ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4615: checking for machine/builtins.h" >&5
+echo "configure:4713: checking for machine/builtins.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4620 "configure"
+#line 4718 "configure"
 #include "confdefs.h"
 #include <machine/builtins.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4723: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -5265,63 +5363,63 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 
 
 case $target in
 *-darwin*|*-beos*|*-os2*)
     ;;
 *)
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5274: checking for dlopen in -ldl" >&5
+echo "configure:5372: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5282 "configure"
+#line 5380 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char dlopen();
 
 int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:5293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:5310: checking for dlfcn.h" >&5
+echo "configure:5408: checking for dlfcn.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5315 "configure"
+#line 5413 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -5344,23 +5442,23 @@ fi
     ;;
 esac
 
 
 
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:5353: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5451: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 5359 "configure"
+#line 5457 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -5368,17 +5466,17 @@ else
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 5377 "configure"
+#line 5475 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -5392,22 +5490,22 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
 for ac_func in lchown strerror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5401: checking for $ac_func" >&5
+echo "configure:5499: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5406 "configure"
+#line 5504 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char $ac_func();
@@ -5420,17 +5518,17 @@ int main() {
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
 $ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=no"
 fi
@@ -5461,17 +5559,17 @@ if test "${enable_strip+set}" = set; the
 fi
 
 
 case "${target_os}" in
 hpux*)
 if test -z "$GNU_CC"; then
 
     echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5470: checking for +Olit support" >&5
+echo "configure:5568: checking for +Olit support" >&5
 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
                   ac_cv_hpux_usable_olit_option=no
         rm -f conftest*
         echo 'int main() { return 0; }' | cat > conftest.c
         ${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
         if test $? -eq 0; then
@@ -5503,17 +5601,17 @@ darwin*)
     _HAVE_PTHREADS=1
     ;;
 wince*)
     _HAVE_PTHREADS=
     ;;
 *)
     
 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5512: checking for pthread_create in -lpthreads" >&5
+echo "configure:5610: checking for pthread_create in -lpthreads" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5525,17 +5623,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5534: checking for pthread_create in -lpthread" >&5
+echo "configure:5632: checking for pthread_create in -lpthread" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5547,17 +5645,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5556: checking for pthread_create in -lc_r" >&5
+echo "configure:5654: checking for pthread_create in -lc_r" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5569,17 +5667,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5578: checking for pthread_create in -lc" >&5
+echo "configure:5676: checking for pthread_create in -lc" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5701,17 +5799,17 @@ EOF
     fi
 fi
 
 
 if test -n "$USE_PTHREADS"; then
       rm -f conftest*
    ac_cv_have_dash_pthread=no
    echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:5710: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5808: checking whether ${CC-cc} accepts -pthread" >&5
    echo 'int main() { return 0; }' | cat > conftest.c
    ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
    if test $? -eq 0; then
 	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 	    ac_cv_have_dash_pthread=yes
 		case "$target_os" in
 	    freebsd*)
 # Freebsd doesn't use -pthread for compiles, it uses them for linking
@@ -5724,17 +5822,17 @@ echo "configure:5710: checking whether $
 	fi
     fi
     rm -f conftest*
     echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6
 
 			    ac_cv_have_dash_pthreads=no
     if test "$ac_cv_have_dash_pthread" = "no"; then
 	    echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:5733: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5831: checking whether ${CC-cc} accepts -pthreads" >&5
     	echo 'int main() { return 0; }' | cat > conftest.c
 	    ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
     	if test $? -eq 0; then
 	    	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 			    ac_cv_have_dash_pthreads=yes
 			    CFLAGS="$CFLAGS -pthreads"
 			    CXXFLAGS="$CXXFLAGS -pthreads"
 		    fi
@@ -6037,16 +6135,48 @@ RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_A
 case "$target_os" in
 cygwin*|msvc*|mks*)
     CC="\$(CYGWIN_WRAPPER) $CC"
     CXX="\$(CYGWIN_WRAPPER) $CXX"
     RC="\$(CYGWIN_WRAPPER) $RC"
     ;;
 esac
 
+# Check whether --enable-wrap-malloc or --disable-wrap-malloc was given.
+if test "${enable_wrap_malloc+set}" = set; then
+  enableval="$enable_wrap_malloc"
+       if test "$enableval" = "yes"; then
+	    _WRAP_MALLOC=1
+      fi 
+fi
+
+
+if test -n "$_WRAP_MALLOC"; then
+    if test "$GNU_CC"; then
+       WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
+       DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS"
+    else
+       { echo "configure: error: --enable-wrap-malloc is not supported for non-GNU toolchains" 1>&2; exit 1; }
+    fi
+fi
+
+# Check whether --with-wrap-malloc or --without-wrap-malloc was given.
+if test "${with_wrap_malloc+set}" = set; then
+  withval="$with_wrap_malloc"
+  WRAP_MALLOC_LIB=$withval
+fi
+
+
+
+
+
+
+
+
+
 
 
 
 
 
 
 
 
@@ -6399,29 +6529,35 @@ s%@MDCPUCFG_H@%$MDCPUCFG_H%g
 s%@PR_MD_CSRCS@%$PR_MD_CSRCS%g
 s%@PR_MD_ASFILES@%$PR_MD_ASFILES%g
 s%@PR_MD_ARCH_DIR@%$PR_MD_ARCH_DIR%g
 s%@CPU_ARCH@%$CPU_ARCH%g
 s%@OBJ_SUFFIX@%$OBJ_SUFFIX%g
 s%@LIB_SUFFIX@%$LIB_SUFFIX%g
 s%@DLL_SUFFIX@%$DLL_SUFFIX%g
 s%@ASM_SUFFIX@%$ASM_SUFFIX%g
+s%@WRAP_MALLOC_CFLAGS@%$WRAP_MALLOC_CFLAGS%g
+s%@WRAP_MALLOC_LIB@%$WRAP_MALLOC_LIB%g
 s%@MKSHLIB@%$MKSHLIB%g
 s%@DSO_CFLAGS@%$DSO_CFLAGS%g
 s%@DSO_LDOPTS@%$DSO_LDOPTS%g
 s%@OS_TARGET@%$OS_TARGET%g
 s%@OS_ARCH@%$OS_ARCH%g
 s%@OS_RELEASE@%$OS_RELEASE%g
 s%@OS_TEST@%$OS_TEST%g
 s%@MACOSX_DEPLOYMENT_TARGET@%$MACOSX_DEPLOYMENT_TARGET%g
 s%@DEFINES@%$DEFINES%g
 s%@AR_FLAGS@%$AR_FLAGS%g
 s%@ASFLAGS@%$ASFLAGS%g
 s%@FILTER@%$FILTER%g
 s%@IMPLIB@%$IMPLIB%g
+s%@PROFILE_GEN_CFLAGS@%$PROFILE_GEN_CFLAGS%g
+s%@PROFILE_GEN_LDFLAGS@%$PROFILE_GEN_LDFLAGS%g
+s%@PROFILE_USE_CFLAGS@%$PROFILE_USE_CFLAGS%g
+s%@PROFILE_USE_LDFLAGS@%$PROFILE_USE_LDFLAGS%g
 s%@OS_LIBS@%$OS_LIBS%g
 s%@RESOLVE_LINK_SYMBOLS@%$RESOLVE_LINK_SYMBOLS%g
 s%@AIX_LINK_OPTS@%$AIX_LINK_OPTS%g
 s%@NOSUCHFILE@%$NOSUCHFILE%g
 s%@MOZ_OBJFORMAT@%$MOZ_OBJFORMAT%g
 s%@ULTRASPARC_LIBRARY@%$ULTRASPARC_LIBRARY%g
 s%@OBJDIR@%$OBJDIR%g
 s%@OBJDIR_NAME@%$OBJDIR_NAME%g
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -73,16 +73,21 @@ NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_
 NOSUCHFILE=/no-such-file
 LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
 LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)'
 CYGWIN_WRAPPER=
 MACOS_SDK_DIR=
 NEXT_ROOT=
 MT=
 MOZ_OS2_HIGH_MEMORY=1
+MOZ_THUMB2=
+PROFILE_GEN_CFLAGS=
+PROFILE_GEN_LDFLAGS=
+PROFILE_USE_CFLAGS=
+PROFILE_USE_LDFLAGS=
 
 dnl Link in libraries necessary to resolve all symbols for shared libs
 RESOLVE_LINK_SYMBOLS=
 
 dnl ========================================================
 dnl =
 dnl = Dont change the following lines.  Doing so breaks:
 dnl =
@@ -166,18 +171,18 @@ if test "$target" = "arm-android-eabi" ;
     CXX="$android_toolchain"/bin/arm-eabi-g++
     CPP="$android_toolchain"/bin/arm-eabi-cpp
     LD="$android_toolchain"/bin/arm-eabi-ld
     AR="$android_toolchain"/bin/arm-eabi-ar
     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
     STRIP="$android_toolchain"/bin/arm-eabi-strip
 
     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
-    CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
-    CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS"
+    CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
+    CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS"
     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
 
     dnl prevent cross compile section from using these flags as host flags
     if test -z "$HOST_CPPFLAGS" ; then
         HOST_CPPFLAGS=" "
     fi
     if test -z "$HOST_CFLAGS" ; then
         HOST_CFLAGS=" "
@@ -632,16 +637,39 @@ if test -n "$GNU_CC" && test -n "$GNU_CX
         _res="no"
     fi
     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
     AC_MSG_RESULT([$_res])
 else
     AC_MSG_RESULT([no])
 fi
 
+dnl ========================================================
+dnl Profile guided optimization
+dnl ========================================================
+dnl Test for profiling options
+dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
+
+_SAVE_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
+
+AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
+AC_TRY_COMPILE([], [return 0;],
+               [ PROFILE_GEN_CFLAGS="-fprofile-generate"
+                 result="yes" ], result="no")
+AC_MSG_RESULT([$result])
+
+if test $result = "yes"; then
+   PROFILE_GEN_LDFLAGS="-fprofile-generate"
+   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freoder-blocks-and-partition"
+   PROFILE_USE_LDFLAGS="-fprofile-use"
+fi
+
+CFLAGS="$_SAVE_CFLAGS"
+
 dnl ===============================================================
 dnl Check for .hidden assembler directive and visibility attribute.
 dnl Borrowed from glibc configure.in
 dnl ===============================================================
 if test "$GNU_CC"; then
     AC_CACHE_CHECK(for visibility(hidden) attribute,
         ac_cv_visibility_hidden,
         [cat > conftest.c <<EOF
@@ -876,16 +904,42 @@ AC_ARG_ENABLE(os2-high-mem,
     [  --disable-os2-high-mem  Disable high-memory support on OS/2],
     [ if test "$enableval" = "no"; then
         MOZ_OS2_HIGH_MEMORY=
       else
         MOZ_OS2_HIGH_MEMORY=1
       fi ])
 
 dnl ========================================================
+dnl = Enable building the Thumb2 instruction set
+dnl ========================================================
+AC_ARG_ENABLE(thumb2,
+ [  --enable-thumb2              Enable Thumb2 instruction set],
+ [ if test "$enableval" = "yes"; then
+     MOZ_THUMB2=1,
+   fi ])
+
+if test -n "$MOZ_THUMB2"; then
+  case "$target_cpu" in
+    arm*)
+      if test "$GNU_CC"; then
+        CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
+        CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
+        ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
+      else
+        AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
+      fi
+    ;;
+    *)
+      AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
+    ;;
+  esac
+fi
+
+dnl ========================================================
 dnl Override of system specific host options
 dnl ========================================================
 case "$host" in
 *-mingw*)
     NSINSTALL=nsinstall
     ;;
 *-cygwin*|*-msvc*|*-mks*|*-wince*|*-winmo*)
     NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
@@ -1501,17 +1555,17 @@ arm-android-eabi)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(_GNU_SOURCE)
     AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
     AC_DEFINE(LINUX)
     CFLAGS="$CFLAGS -Wall"
     CXXFLAGS="$CXXFLAGS -Wall"
     MDCPUCFG_H=_linux.cfg
     PR_MD_CSRCS=linux.c
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
     _OPTIMIZE_FLAGS=-O2
     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
                                    # combo is not yet good at debugging inlined
                                    # functions (even when using DWARF2 as the
                                    # debugging format)
     COMPILER_TAG=_glibc
@@ -1532,17 +1586,17 @@ arm-android-eabi)
     linux*)
         AC_DEFINE(LINUX)
         ;;
     esac
     CFLAGS="$CFLAGS -Wall"
     CXXFLAGS="$CXXFLAGS -Wall"
     MDCPUCFG_H=_linux.cfg
     PR_MD_CSRCS=linux.c
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
     _OPTIMIZE_FLAGS=-O2
     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
                                    # combo is not yet good at debugging inlined
                                    # functions (even when using DWARF2 as the
                                    # debugging format)
     COMPILER_TAG=_glibc
@@ -1618,21 +1672,44 @@ arm-android-eabi)
         STRIP='echo not_strip'
         RC=rc.exe
         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
         OBJ_SUFFIX=obj
         LIB_SUFFIX=lib
         DLL_SUFFIX=dll
 
         # Determine compiler version
-        CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
-        _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'`
-        _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'`
+        changequote(,)
+        _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
+        changequote([,])
+
+        CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
+        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`
+        _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'`
+        _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'`
+        _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'`
         MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
 
+        if test "$_CC_MAJOR_VERSION" = "14"; then
+           dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
+           dnl so be very specific here!
+           dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
+           if test $_CC_RELEASE -gt 50727; then
+              _USE_DYNAMICBASE=1
+           elif test $_CC_BUILD -ge 762; then
+              _USE_DYNAMICBASE=1
+           fi
+        elif test $_CC_MAJOR_VERSION -gt 15; then
+           _USE_DYNAMICBASE=1    
+        fi
+
+        if test -n "$_USE_DYNAMICBASE"; then
+           DLLFLAGS="$DLLFLAGS -DYNAMICBASE"
+        fi
+
         # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic
         # tape manipulation utility (or something else)
         if test "$MSC_VER" -ge "1400"; then
             changequote(,)
             _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
             changequote([,])
 
             MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
@@ -1647,16 +1724,22 @@ arm-android-eabi)
                 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
             fi
         fi
         
         CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
         DLLFLAGS="$DLLFLAGS -OUT:\"\$@\""
         _DEBUG_FLAGS=-Zi
         _OPTIMIZE_FLAGS=-O2
+
+        PROFILE_GEN_CFLAGS="-GL"
+        PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
+        PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
+        PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
+
         if test -z "$MOZ_OPTIMIZE"; then
             CFLAGS="$CFLAGS -Od"
         fi
 
         if test -n "$USE_DEBUG_RTL"; then
             CFLAGS="$CFLAGS -MDd"
         else
             CFLAGS="$CFLAGS -MD"
@@ -2855,16 +2938,41 @@ case "$target_os" in
 cygwin*|msvc*|mks*)
     CC="\$(CYGWIN_WRAPPER) $CC"
     CXX="\$(CYGWIN_WRAPPER) $CXX"
     RC="\$(CYGWIN_WRAPPER) $RC"
     ;;
 esac
 
 dnl ========================================================
+dnl = Use malloc wrapper lib
+dnl ========================================================
+AC_ARG_ENABLE(wrap-malloc,
+[  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
+[     if test "$enableval" = "yes"; then
+	    _WRAP_MALLOC=1
+      fi ])
+
+if test -n "$_WRAP_MALLOC"; then
+    if test "$GNU_CC"; then
+       WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
+       DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS"
+    else
+       AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
+    fi
+fi
+
+dnl ========================================================
+dnl = Location of malloc wrapper lib
+dnl ========================================================
+AC_ARG_WITH(wrap-malloc,
+[  --with-wrap-malloc=SHAREDLIB  Location of malloc wrapper library],
+    WRAP_MALLOC_LIB=$withval)
+
+dnl ========================================================
 dnl Substitution of found variables.
 dnl ========================================================
 AC_SUBST(SHELL_OVERRIDE)
 
 AC_SUBST(MOZILLA_CLIENT)
 AC_SUBST(CC)
 AC_SUBST(CXX)
 AC_SUBST(CFLAGS)
@@ -2908,16 +3016,18 @@ AC_SUBST(PR_MD_CSRCS)
 AC_SUBST(PR_MD_ASFILES)
 AC_SUBST(PR_MD_ARCH_DIR)
 AC_SUBST(CPU_ARCH)
 
 AC_SUBST(OBJ_SUFFIX)
 AC_SUBST(LIB_SUFFIX)
 AC_SUBST(DLL_SUFFIX)
 AC_SUBST(ASM_SUFFIX)
+AC_SUBST(WRAP_MALLOC_CFLAGS)
+AC_SUBST(WRAP_MALLOC_LIB)
 AC_SUBST(MKSHLIB)
 AC_SUBST(DSO_CFLAGS)
 AC_SUBST(DSO_LDOPTS)
 
 AC_SUBST(OS_TARGET)
 AC_SUBST(OS_ARCH)
 AC_SUBST(OS_RELEASE)
 AC_SUBST(OS_TEST)
@@ -2931,16 +3041,21 @@ AC_SUBST(AS)
 AC_SUBST(ASFLAGS)
 AC_SUBST(LD)
 AC_SUBST(RANLIB)
 AC_SUBST(PERL)
 AC_SUBST(STRIP)
 AC_SUBST(FILTER)
 AC_SUBST(IMPLIB)
 
+AC_SUBST(PROFILE_GEN_CFLAGS)
+AC_SUBST(PROFILE_GEN_LDFLAGS)
+AC_SUBST(PROFILE_USE_CFLAGS)
+AC_SUBST(PROFILE_USE_LDFLAGS)
+
 AC_SUBST(OS_LIBS)
 AC_SUBST(RESOLVE_LINK_SYMBOLS)
 AC_SUBST(AIX_LINK_OPTS)
 AC_SUBST(NOSUCHFILE)
 AC_SUBST(MOZ_OBJFORMAT)
 AC_SUBST(ULTRASPARC_LIBRARY)
 
 AC_SUBST(OBJDIR)
--- a/nsprpub/lib/libc/include/plgetopt.h
+++ b/nsprpub/lib/libc/include/plgetopt.h
@@ -117,23 +117,24 @@ PR_EXTERN(void) PL_DestroyOptState(PLOpt
  * When opt->option is zero, the token parsed was either a "long" (keyword) 
  *   option or a positional parameter.  
  * For a positional parameter, 
  * - opt->longOptIndex will contain -1, and
  * - opt->value will point to the positional parameter string.
  * For a long option name, 
  * - opt->longOptIndex will contain the non-negative index of the 
  *   PLLongOpt structure in the caller's array of PLLongOpt structures 
- 8   corresponding to the long option name, and 
+ *   corresponding to the long option name, and 
  * For a single-character or long option, 
  * - opt->longOption will contain the value of the single-character option
  *   name, or the value of the longOption from the PLLongOpt structure
  *   for that long option.  See notes below.
  * - opt->value will point to the argument option string, or will
- *   be NULL if no argument option string was given.
+ *   be NULL if option does not require argument.  If option requires
+ *   argument but it is not provided, PL_OPT_BAD is returned.
  * When opt->option is non-zero, 
  * - opt->longOptIndex will be -1
  * When this function returns PL_OPT_EOL, or PL_OPT_BAD, the contents of
  *   opt are undefined.
  *
  * Notes: It is possible to ignore opt->option, and always look at 
  *   opt->longOption instead.  opt->longOption will contain the same value
  *   as opt->option for single-character option names, and will contain the
--- a/nsprpub/lib/libc/src/plgetopt.c
+++ b/nsprpub/lib/libc/src/plgetopt.c
@@ -172,81 +172,107 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(
         }
     }
 
     /*
     ** If we already have a '-' or '--' in hand, xargv points to the next
     ** option. See if we can find a match in the list of possible
     ** options supplied.
     */
-
     if (internal->minus == 2) 
     {
         char * foundEqual = strchr(internal->xargv,'=');
         PRIntn optNameLen = foundEqual ? (foundEqual - internal->xargv) :
                             strlen(internal->xargv);
         const PLLongOpt *longOpt = internal->longOpts;
+        PLOptStatus result = PL_OPT_BAD;
 
         opt->option = 0;
         opt->value  = NULL;
 
         for (; longOpt->longOptName; ++longOpt) 
         {
             if (strncmp(longOpt->longOptName, internal->xargv, optNameLen))
                 continue;  /* not a possible match */
             if (strlen(longOpt->longOptName) != optNameLen)
                 continue;  /* not a match */
             /* option name match */
             opt->longOptIndex = longOpt - internal->longOpts;
             opt->longOption   = longOpt->longOption;
+            /* value is part of the current argv[] element if = was found */
+            /* note: this sets value even for long options that do not
+             * require option if specified as --long=value */
             if (foundEqual) 
             {
-                opt->value = foundEqual[1] ? foundEqual + 1 : NULL;
+                opt->value = foundEqual + 1;
             }
             else if (longOpt->valueRequired)
             {
-                opt->value = internal->argv[++(internal->xargc)];
+                /* value is the next argv[] element, if any */
+                if (internal->xargc + 1 < internal->argc)
+                {
+                    opt->value = internal->argv[++(internal->xargc)];
+                }
+                /* missing value */
+                else
+                {
+                    break; /* return PL_OPT_BAD */
+                }
             }
-            internal->xargv = &static_Nul; /* consume this */
-            return PL_OPT_OK;
+            result = PL_OPT_OK;
+            break;
         }
         internal->xargv = &static_Nul; /* consume this */
-        return PL_OPT_BAD;
+        return result;
     }
     if (internal->minus)
     {
         PRIntn cop;
         PRIntn eoo = internal->optionsLen;
         for (cop = 0; cop < eoo; ++cop)
         {
             if (internal->options[cop] == *internal->xargv)
             {
                 opt->option = *internal->xargv++;
                 opt->longOption = opt->option & 0xff;
                 /*
                 ** if options indicates that there's an associated
-                ** value, this argv is finished and the next is the
-                ** option's value.
+                ** value, it must be provided, either as part of this
+                ** argv[] element or as the next one
                 */
                 if (':' == internal->options[cop + 1])
                 {
-                    if (0 != *internal->xargv) 
+                    /* value is part of the current argv[] element */
+                    if (0 != *internal->xargv)
+                    {
+                        opt->value = internal->xargv;
+                    }
+                    /* value is the next argv[] element, if any */
+                    else if (internal->xargc + 1 < internal->argc)
+                    {
+                        opt->value = internal->argv[++(internal->xargc)];
+                    }
+                    /* missing value */
+                    else
+                    {
                         return PL_OPT_BAD;
-                    opt->value = internal->argv[++(internal->xargc)];
+                    }
+
                     internal->xargv = &static_Nul;
                     internal->minus = 0;
                 }
                 else 
                     opt->value = NULL; 
                 return PL_OPT_OK;
             }
         }
         internal->xargv += 1;  /* consume that option */
         return PL_OPT_BAD;
     }
+
     /*
     ** No '-', so it must be a standalone value. The option is nul.
     */
     opt->value = internal->argv[internal->xargc];
     internal->xargv = &static_Nul;
     opt->option = 0;
     return PL_OPT_OK;
 }  /* PL_GetNextOpt */
--- a/nsprpub/pr/include/md/_openbsd.h
+++ b/nsprpub/pr/include/md/_openbsd.h
@@ -64,17 +64,17 @@
 #define _PR_STACK_VMBASE	0x50000000
 #define _MD_DEFAULT_STACK_SIZE	65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
 #undef  HAVE_STACK_GROWING_UP
 #define HAVE_DLL
 #define USE_DLFCN
 #define _PR_HAVE_SOCKADDR_LEN
-#define _PR_NO_LARGE_FILES
+#define _PR_HAVE_LARGE_OFF_T
 #define _PR_STAT_HAS_ST_ATIMESPEC
 #define _PR_POLL_AVAILABLE
 #define _PR_USE_POLL
 #define _PR_HAVE_SYSV_SEMAPHORES
 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
 #define _PR_INET6
 #define _PR_HAVE_INET_NTOP
--- a/nsprpub/pr/include/md/_pth.h
+++ b/nsprpub/pr/include/md/_pth.h
@@ -93,18 +93,24 @@
 #define _PT_PTHREAD_MUTEXATTR_INIT        pthread_mutexattr_init
 #define _PT_PTHREAD_MUTEXATTR_DESTROY     pthread_mutexattr_destroy
 #define _PT_PTHREAD_MUTEX_INIT(m, a)      pthread_mutex_init(&(m), &(a))
 #if defined(FREEBSD)
 #define _PT_PTHREAD_MUTEX_IS_LOCKED(m)    pt_pthread_mutex_is_locked(&(m))
 #else
 #define _PT_PTHREAD_MUTEX_IS_LOCKED(m)    (EBUSY == pthread_mutex_trylock(&(m)))
 #endif
+#if defined(ANDROID)
+/* Conditional attribute init and destroy aren't implemented in bionic. */
+#define _PT_PTHREAD_CONDATTR_INIT(x)      0
+#define _PT_PTHREAD_CONDATTR_DESTROY(x)   /* */
+#else
 #define _PT_PTHREAD_CONDATTR_INIT         pthread_condattr_init
 #define _PT_PTHREAD_CONDATTR_DESTROY      pthread_condattr_destroy
+#endif
 #define _PT_PTHREAD_COND_INIT(m, a)       pthread_cond_init(&(m), &(a))
 #endif
 
 /* The pthreads standard does not specify an invalid value for the
  * pthread_t handle.  (0 is usually an invalid pthread identifier
  * but there are exceptions, for example, DG/UX.)  These macros
  * define a way to set the handle to or compare the handle with an
  * invalid identifier.  These macros are not portable and may be
--- a/nsprpub/pr/include/md/_winnt.h
+++ b/nsprpub/pr/include/md/_winnt.h
@@ -37,20 +37,20 @@
 
 #ifndef nspr_win32_defs_h___
 #define nspr_win32_defs_h___
 
 /* Need to force service-pack 3 extensions to be defined by
 ** setting _WIN32_WINNT to NT 4.0 for winsock.h, winbase.h, winnt.h.
 */ 
 #ifndef  _WIN32_WINNT
-    #define _WIN32_WINNT 0x0403
-#elif   (_WIN32_WINNT < 0x0403)
+    #define _WIN32_WINNT 0x0400
+#elif   (_WIN32_WINNT < 0x0400)
     #undef  _WIN32_WINNT
-    #define _WIN32_WINNT 0x0403
+    #define _WIN32_WINNT 0x0400
 #endif /* _WIN32_WINNT */
 
 #include <windows.h>
 #include <winsock.h>
 #ifdef __MINGW32__
 #include <mswsock.h>
 #endif
 #include <errno.h>
--- a/nsprpub/pr/include/pratom.h
+++ b/nsprpub/pr/include/pratom.h
@@ -120,20 +120,22 @@ long __cdecl _InterlockedDecrement(long 
 #pragma intrinsic(_InterlockedDecrement)
 
 long __cdecl _InterlockedExchange(long volatile *Target, long Value);
 #pragma intrinsic(_InterlockedExchange)
 
 long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value);
 #pragma intrinsic(_InterlockedExchangeAdd)
 
-#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement(val)
-#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement(val)
-#define PR_ATOMIC_SET(val, newval) _InterlockedExchange(val, newval)
-#define PR_ATOMIC_ADD(ptr, val) (_InterlockedExchangeAdd(ptr, val) + (val))
+#define PR_ATOMIC_INCREMENT(val)   _InterlockedIncrement((long volatile *)val)
+#define PR_ATOMIC_DECREMENT(val)   _InterlockedDecrement((long volatile *)val)
+#define PR_ATOMIC_SET(val, newval) \
+        _InterlockedExchange((long volatile *)val, (long)newval)
+#define PR_ATOMIC_ADD(ptr, val)    \
+        (_InterlockedExchangeAdd((long volatile *)ptr, (long)val) + (val))
 
 #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \
       ((defined(DARWIN) && \
            (defined(__ppc__) || defined(__i386__))) || \
        (defined(LINUX) && \
            (defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || \
            (defined(__powerpc__) && !defined(__powerpc64__)) || \
            defined(__alpha))))
--- a/nsprpub/pr/src/md/unix/os_Darwin_ppc.s
+++ b/nsprpub/pr/src/md/unix/os_Darwin_ppc.s
@@ -44,53 +44,57 @@
 
 .text
 
 #
 # PRInt32 __PR_DarwinPPC_AtomicIncrement(PRInt32 *val);
 #
         .align  2
         .globl  __PR_DarwinPPC_AtomicIncrement
+        .private_extern __PR_DarwinPPC_AtomicIncrement
 __PR_DarwinPPC_AtomicIncrement:
         lwarx   r4,0,r3
         addi    r0,r4,1
         stwcx.  r0,0,r3
         bne-    __PR_DarwinPPC_AtomicIncrement
         mr      r3,r0
         blr
 
 #
 # PRInt32 __PR_DarwinPPC_AtomicDecrement(PRInt32 *val);
 #
         .align  2
         .globl  __PR_DarwinPPC_AtomicDecrement
+        .private_extern __PR_DarwinPPC_AtomicDecrement
 __PR_DarwinPPC_AtomicDecrement:
         lwarx   r4,0,r3
         addi    r0,r4,-1
         stwcx.  r0,0,r3
         bne-    __PR_DarwinPPC_AtomicDecrement
         mr      r3,r0
         blr
 
 #
 # PRInt32 __PR_DarwinPPC_AtomicSet(PRInt32 *val, PRInt32 newval);
 #
         .align  2
         .globl  __PR_DarwinPPC_AtomicSet
+        .private_extern __PR_DarwinPPC_AtomicSet
 __PR_DarwinPPC_AtomicSet:
         lwarx   r5,0,r3
         stwcx.  r4,0,r3
         bne-    __PR_DarwinPPC_AtomicSet
         mr      r3,r5
         blr
 
 #
 # PRInt32 __PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val);
 #
         .align  2
         .globl  __PR_DarwinPPC_AtomicAdd
+        .private_extern __PR_DarwinPPC_AtomicAdd
 __PR_DarwinPPC_AtomicAdd:
         lwarx   r5,0,r3
         add     r0,r4,r5
         stwcx.  r0,0,r3
         bne-    __PR_DarwinPPC_AtomicAdd
         mr      r3,r0
         blr
--- a/nsprpub/pr/src/md/unix/os_Darwin_x86.s
+++ b/nsprpub/pr/src/md/unix/os_Darwin_x86.s
@@ -44,16 +44,17 @@
 #
 # PRInt32 __PR_Darwin_x86_AtomicIncrement(PRInt32 *val);
 #
 # Atomically increment the integer pointed to by 'val' and return
 # the result of the increment.
 #
     .text
     .globl __PR_Darwin_x86_AtomicIncrement
+    .private_extern __PR_Darwin_x86_AtomicIncrement
     .align 4
 __PR_Darwin_x86_AtomicIncrement:
     movl 4(%esp), %ecx
     movl $1, %eax
     lock
     xaddl %eax, (%ecx)
     incl %eax
     ret
@@ -61,16 +62,17 @@
 #
 # PRInt32 __PR_Darwin_x86_AtomicDecrement(PRInt32 *val);
 #
 # Atomically decrement the integer pointed to by 'val' and return
 # the result of the decrement.
 #
     .text
     .globl __PR_Darwin_x86_AtomicDecrement
+    .private_extern __PR_Darwin_x86_AtomicDecrement
     .align 4
 __PR_Darwin_x86_AtomicDecrement:
     movl 4(%esp), %ecx
     movl $-1, %eax
     lock
     xaddl %eax, (%ecx)
     decl %eax
     ret
@@ -78,31 +80,33 @@
 #
 # PRInt32 __PR_Darwin_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
 #
 # Atomically set the integer pointed to by 'val' to the new
 # value 'newval' and return the old value.
 #
     .text
     .globl __PR_Darwin_x86_AtomicSet
+    .private_extern __PR_Darwin_x86_AtomicSet
     .align 4
 __PR_Darwin_x86_AtomicSet:
     movl 4(%esp), %ecx
     movl 8(%esp), %eax
     xchgl %eax, (%ecx)
     ret
 
 #
 # PRInt32 __PR_Darwin_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
 #
 # Atomically add 'val' to the integer pointed to by 'ptr'
 # and return the result of the addition.
 #
     .text
     .globl __PR_Darwin_x86_AtomicAdd
+    .private_extern __PR_Darwin_x86_AtomicAdd
     .align 4
 __PR_Darwin_x86_AtomicAdd:
     movl 4(%esp), %ecx
     movl 8(%esp), %eax
     movl %eax, %edx
     lock
     xaddl %eax, (%ecx)
     addl %edx, %eax
--- a/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s
+++ b/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s
@@ -38,58 +38,62 @@
 
 # PRInt32 __PR_Darwin_x86_64_AtomicIncrement(PRInt32 *val)
 #
 # Atomically increment the integer pointed to by 'val' and return
 # the result of the increment.
 #
     .text
     .globl __PR_Darwin_x86_64_AtomicIncrement
+    .private_extern __PR_Darwin_x86_64_AtomicIncrement
     .align 4
 __PR_Darwin_x86_64_AtomicIncrement:
     movl $1, %eax
     lock
     xaddl %eax, (%rdi)
     incl %eax
     ret
 
 # PRInt32 __PR_Darwin_x86_64_AtomicDecrement(PRInt32 *val)
 #
 # Atomically decrement the integer pointed to by 'val' and return
 # the result of the decrement.
 #
     .text
     .globl __PR_Darwin_x86_64_AtomicDecrement
+    .private_extern __PR_Darwin_x86_64_AtomicDecrement
     .align 4
 __PR_Darwin_x86_64_AtomicDecrement:
     movl $-1, %eax
     lock
     xaddl %eax, (%rdi)
     decl %eax
     ret
 
 # PRInt32 __PR_Darwin_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
 #
 # Atomically set the integer pointed to by 'val' to the new
 # value 'newval' and return the old value.
 #
     .text
     .globl __PR_Darwin_x86_64_AtomicSet
+    .private_extern __PR_Darwin_x86_64_AtomicSet
     .align 4
 __PR_Darwin_x86_64_AtomicSet:
     movl %esi, %eax
     xchgl %eax, (%rdi)
     ret
 
 # PRInt32 __PR_Darwin_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
 #
 # Atomically add 'val' to the integer pointed to by 'ptr'
 # and return the result of the addition.
 #
     .text
     .globl __PR_Darwin_x86_64_AtomicAdd
+    .private_extern __PR_Darwin_x86_64_AtomicAdd
     .align 4
 __PR_Darwin_x86_64_AtomicAdd:
     movl %esi, %eax
     lock
     xaddl %eax, (%rdi)
     addl %esi, %eax
     ret
--- a/nsprpub/pr/src/md/unix/os_HPUX.s
+++ b/nsprpub/pr/src/md/unix/os_HPUX.s
@@ -44,15 +44,14 @@
 	.CODE	; equivalent to the following two lines
 ;       .SPACE   $TEXT$,SORT=8
 ;       .SUBSPA  $CODE$,QUAD=0,ALIGN=4,ACCESS=0x2c,CODE_ONLY,SORT=24
 
 ret_cr16
 	.PROC
 	.CALLINFO 	FRAME=0, NO_CALLS
 	.EXPORT 	ret_cr16,ENTRY
-	.ENTER
-;	BV		%r0(%rp)
-	BV		0(%rp)
+	.ENTRY
+	BV		%r0(%rp)
+        .EXIT
 	MFCTL		%cr16,%ret0
-        .LEAVE
         .PROCEND
         .END
--- a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
+++ b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
@@ -38,61 +38,69 @@
 
 / PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
 /
 / Atomically increment the integer pointed to by 'val' and return
 / the result of the increment.
 /
     .text
     .globl _PR_x86_64_AtomicIncrement
+    .type _PR_x86_64_AtomicIncrement, @function
     .align 4
 _PR_x86_64_AtomicIncrement:
     movl $1, %eax
     lock
     xaddl %eax, (%rdi)
     incl %eax
     ret
+    .size _PR_x86_64_AtomicIncrement, .-_PR_x86_64_AtomicIncrement
 
 / PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
 /
 / Atomically decrement the integer pointed to by 'val' and return
 / the result of the decrement.
 /
     .text
     .globl _PR_x86_64_AtomicDecrement
+    .type _PR_x86_64_AtomicDecrement, @function
     .align 4
 _PR_x86_64_AtomicDecrement:
     movl $-1, %eax
     lock
     xaddl %eax, (%rdi)
     decl %eax
     ret
+    .size _PR_x86_64_AtomicDecrement, .-_PR_x86_64_AtomicDecrement
 
 / PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
 /
 / Atomically set the integer pointed to by 'val' to the new
 / value 'newval' and return the old value.
 /
     .text
     .globl _PR_x86_64_AtomicSet
+    .type _PR_x86_64_AtomicSet, @function
     .align 4
 _PR_x86_64_AtomicSet:
     movl %esi, %eax
     xchgl %eax, (%rdi)
     ret
+    .size _PR_x86_64_AtomicSet, .-_PR_x86_64_AtomicSet
 
 / PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
 /
 / Atomically add 'val' to the integer pointed to by 'ptr'
 / and return the result of the addition.
 /
     .text
     .globl _PR_x86_64_AtomicAdd
+    .type _PR_x86_64_AtomicAdd, @function
     .align 4
 _PR_x86_64_AtomicAdd:
     movl %esi, %eax
     lock
     xaddl %eax, (%rdi)
     addl %esi, %eax
     ret
+    .size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd
 
 / Magic indicating no need for an executable stack
 .section .note.GNU-stack, "", @progbits ; .previous
--- a/nsprpub/pr/src/md/unix/uxrng.c
+++ b/nsprpub/pr/src/md/unix/uxrng.c
@@ -70,17 +70,21 @@ GetHighResClock(void *buf, size_t maxbyt
 #ifdef __ia64
 #include <ia64/sys/inline.h>
 
 static size_t
 GetHighResClock(void *buf, size_t maxbytes)
 {
     PRUint64 t;
 
+#ifdef __GNUC__
+    __asm__ __volatile__("mov %0 = ar.itc" : "=r" (t));
+#else
     t = _Asm_mov_from_ar(_AREG44);
+#endif
     return _pr_CopyLowBits(buf, maxbytes, &t, sizeof(t));
 }
 #else
 static size_t
 GetHighResClock(void *buf, size_t maxbytes)
 {
     extern int ret_cr16();
     int cr16val;
--- a/nsprpub/pr/src/misc/prinit.c
+++ b/nsprpub/pr/src/misc/prinit.c
@@ -798,17 +798,17 @@ void _PR_CleanupCallOnce()
 
 PR_IMPLEMENT(PRStatus) PR_CallOnce(
     PRCallOnceType *once,
     PRCallOnceFN    func)
 {
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     if (!once->initialized) {
-	if (PR_AtomicSet(&once->inProgress, 1) == 0) {
+	if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) {
 	    once->status = (*func)();
 	    PR_Lock(mod_init.ml);
 	    once->initialized = 1;
 	    PR_NotifyAllCondVar(mod_init.cv);
 	    PR_Unlock(mod_init.ml);
 	} else {
 	    PR_Lock(mod_init.ml);
 	    while (!once->initialized) {
@@ -827,17 +827,17 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce(
 PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg(
     PRCallOnceType      *once,
     PRCallOnceWithArgFN  func,
     void                *arg)
 {
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     if (!once->initialized) {
-	if (PR_AtomicSet(&once->inProgress, 1) == 0) {
+	if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) {
 	    once->status = (*func)(arg);
 	    PR_Lock(mod_init.ml);
 	    once->initialized = 1;
 	    PR_NotifyAllCondVar(mod_init.cv);
 	    PR_Unlock(mod_init.ml);
 	} else {
 	    PR_Lock(mod_init.ml);
 	    while (!once->initialized) {
--- a/nsprpub/pr/src/misc/prsystem.c
+++ b/nsprpub/pr/src/misc/prsystem.c
@@ -279,16 +279,30 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMem
     PRUint64 bytes = 0;
 
 #if defined(LINUX) || defined(SOLARIS)
 
     long pageSize = sysconf(_SC_PAGESIZE);
     long pageCount = sysconf(_SC_PHYS_PAGES);
     bytes = (PRUint64) pageSize * pageCount;
 
+#elif defined(NETBSD)
+
+    int mib[2];
+    int rc;
+    uint64_t memSize;
+    size_t len = sizeof(memSize);
+
+    mib[0] = CTL_HW;
+    mib[1] = HW_PHYSMEM64;
+    rc = sysctl(mib, 2, &memSize, &len, NULL, 0);
+    if (-1 != rc)  {
+        bytes = memSize;
+    }
+
 #elif defined(HPUX)
 
     struct pst_static info;
     int result = pstat_getstatic(&info, sizeof(info), 1, 0);
     if (result == 1)
         bytes = (PRUint64) info.physical_memory * info.page_size;
 
 #elif defined(DARWIN)
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -143,23 +143,23 @@ static void pt_PostNotifies(PRLock *lock
                 while (notified->cv[index].times-- > 0)
                 {
                     rv = pthread_cond_signal(&cv->cv);
                     PR_ASSERT(0 == rv);
                 }
             }
 #if defined(DEBUG)
             pt_debug.cvars_notified += 1;
-            if (0 > PR_AtomicDecrement(&cv->notify_pending))
+            if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
             {
                 pt_debug.delayed_cv_deletes += 1;
                 PR_DestroyCondVar(cv);
             }
 #else  /* defined(DEBUG) */
-            if (0 > PR_AtomicDecrement(&cv->notify_pending))
+            if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
                 PR_DestroyCondVar(cv);
 #endif  /* defined(DEBUG) */
         }
         prev = notified;
         notified = notified->link;
         if (&post != prev) PR_DELETE(prev);
     } while (NULL != notified);
 }  /* pt_PostNotifies */
@@ -333,17 +333,17 @@ static void pt_PostNotifyToCvar(PRCondVa
 
         /* if there's no link, create an empty array and link it */
         if (NULL == notified->link)
             notified->link = PR_NEWZAP(_PT_Notified);
         notified = notified->link;
     }
 
     /* A brand new entry in the array */
-    (void)PR_AtomicIncrement(&cvar->notify_pending);
+    (void)PR_ATOMIC_INCREMENT(&cvar->notify_pending);
     notified->cv[index].times = (broadcast) ? -1 : 1;
     notified->cv[index].cv = cvar;
     notified->length += 1;
 
 finished:
     PR_ASSERT(PR_TRUE == cvar->lock->locked);
     PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));
 }  /* pt_PostNotifyToCvar */
@@ -362,17 +362,17 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(P
         pt_debug.cvars_created += 1;
 #endif
     }
     return cv;
 }  /* PR_NewCondVar */
 
 PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar)
 {
-    if (0 > PR_AtomicDecrement(&cvar->notify_pending))
+    if (0 > PR_ATOMIC_DECREMENT(&cvar->notify_pending))
     {
         PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv);
 #if defined(DEBUG)
         memset(cvar, 0xaf, sizeof(PRCondVar));
         pt_debug.cvars_destroyed += 1;
 #endif
         PR_Free(cvar);
     }
--- a/nsprpub/pr/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -747,20 +747,20 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRTh
     if (NULL == thred) return PR_FAILURE;
 
     thred->state |= PT_THREAD_ABORTED;
 
     cv = thred->waiting;
     if ((NULL != cv) && !thred->interrupt_blocked)
     {
         PRIntn rv;
-        (void)PR_AtomicIncrement(&cv->notify_pending);
+        (void)PR_ATOMIC_INCREMENT(&cv->notify_pending);
         rv = pthread_cond_broadcast(&cv->cv);
         PR_ASSERT(0 == rv);
-        if (0 > PR_AtomicDecrement(&cv->notify_pending))
+        if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
             PR_DestroyCondVar(cv);
     }
     return PR_SUCCESS;
 }  /* PR_Interrupt */
 
 PR_IMPLEMENT(void) PR_ClearInterrupt(void)
 {
     PRThread *me = PR_GetCurrentThread();
--- a/nsprpub/pr/src/threads/combined/pruthr.c
+++ b/nsprpub/pr/src/threads/combined/pruthr.c
@@ -1160,19 +1160,19 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread
 
                 _PR_InitializeRecycledThread(thread);
                 thread->startFunc = start;
                 thread->arg = arg;
             thread->flags = (flags | _PR_GLOBAL_SCOPE);
             if (type == PR_SYSTEM_THREAD)
             {
                 thread->flags |= _PR_SYSTEM;
-                PR_AtomicIncrement(&_pr_systemActive);
+                PR_ATOMIC_INCREMENT(&_pr_systemActive);
             }
-            else PR_AtomicIncrement(&_pr_userActive);
+            else PR_ATOMIC_INCREMENT(&_pr_userActive);
 
             if (state == PR_JOINABLE_THREAD) {
                 if (!thread->term) 
                        thread->term = PR_NewCondVar(_pr_terminationCVLock);
             }
         else {
                 if(thread->term) {
                     PR_DestroyCondVar(thread->term);
--- a/nsprpub/pr/src/threads/prtpd.c
+++ b/nsprpub/pr/src/threads/prtpd.c
@@ -132,17 +132,17 @@ PR_IMPLEMENT(PRStatus) PR_NewThreadPriva
     PRStatus rv;
     PRInt32 index;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     PR_ASSERT(NULL != newIndex);
     PR_ASSERT(NULL != _pr_tpd_destructors);
 
-    index = PR_AtomicIncrement(&_pr_tpd_highwater) - 1;  /* allocate index */
+    index = PR_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1;  /* allocate index */
     if (_PR_TPD_LIMIT <= index)
     {
         PR_SetError(PR_TPD_RANGE_ERROR, 0);
         rv = PR_FAILURE;  /* that's just wrong */
     }
     else
     {
         _pr_tpd_destructors[index] = dtor;  /* record destructor @index */
--- a/nsprpub/pr/tests/nbconn.c
+++ b/nsprpub/pr/tests/nbconn.c
@@ -120,17 +120,17 @@ int main(int argc, char **argv)
 
 	if (default_case) {
 
 		/*
 		 * In the default case the following tests are executed:
 		 *	1. successful connection: a server thread accepts a connection
 		 *	   from the main thread
 		 *	2. unsuccessful connection: the main thread tries to connect to a
-		 *	   non-existent port and expects to get an error
+		 *	   nonexistent port and expects to get an error
 		 */
 		rv = connection_success_test();
 		if (rv == 0)
 			rv = connection_failure_test();
 		return rv;
 	} else {
     	PRFileDesc *sock;
 
@@ -442,17 +442,17 @@ def_exit:
 	if (failed_already)
 		return 1;
 	else
 		return 0;
 
 }
 
 /*
- * test for connection to a non-existent port using a non-blocking socket
+ * test for connection to a nonexistent port using a non-blocking socket
  */
 static PRIntn
 connection_failure_test()
 {
 	PRFileDesc *sockfd = NULL, *conn_fd = NULL;
 	PRNetAddr netaddr;
 	PRInt32 i, rv;
     PRPollDesc pd;