Bug 469870: Upgraded nsprpub to NSPR_HEAD_20081216. r=kaie.
authorWan-Teh Chang <wtc@google.com>
Thu, 18 Dec 2008 14:34:38 -0800
changeset 22923 0e61b5765cd30cf7840c5ed28b2a076c7e0ce436
parent 22922 af64ac164e4474a8adc7e9c264a1b3e770cf87c1
child 22924 4e8aa0501296d1dd20e6ee92df7a1f79789db844
push id4264
push userwtc@google.com
push dateThu, 18 Dec 2008 22:34:50 +0000
treeherdermozilla-central@0e61b5765cd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaie
bugs469870
milestone1.9.2a1pre
Bug 469870: Upgraded nsprpub to NSPR_HEAD_20081216. r=kaie.
nsprpub/admin/repackage.sh
nsprpub/config/Makefile.in
nsprpub/config/now.c
nsprpub/config/prdepend.h
nsprpub/config/rules.mk
nsprpub/configure
nsprpub/configure.in
nsprpub/pr/include/md/_darwin.cfg
nsprpub/pr/include/md/_darwin.h
nsprpub/pr/include/md/_linux.h
nsprpub/pr/include/md/_win95.cfg
nsprpub/pr/include/md/_win95.h
nsprpub/pr/include/md/prosdep.h
nsprpub/pr/include/pratom.h
nsprpub/pr/include/prinit.h
nsprpub/pr/include/prnetdb.h
nsprpub/pr/src/linking/prlink.c
nsprpub/pr/src/md/windows/ntinrval.c
nsprpub/pr/src/md/windows/w32poll.c
nsprpub/pr/src/pthreads/ptsynch.c
nsprpub/pr/tests/runtests.pl
nsprpub/pr/tests/vercheck.c
--- a/nsprpub/admin/repackage.sh
+++ b/nsprpub/admin/repackage.sh
@@ -59,20 +59,20 @@
 # Note! Files written with Gnu tar are not readable by some non-Gnu
 # versions. Sun, in particular.
 # 
 # 
 # 
 # 
 # ------------------------------------------------------------------
 
-FROMTOP=/share/builds/components/nspr20/v4.7.2
-TOTOP=./v4.7.2
-NSPRDIR=nspr-4.7.2
-SOURCETAG=NSPR_4_7_2_RTM
+FROMTOP=/share/builds/components/nspr20/v4.7.4
+TOTOP=./v4.7.4
+NSPRDIR=nspr-4.7.4
+SOURCETAG=NSPR_4_7_4_RTM
 
 #
 # enumerate Unix object directories on /s/b/c
 UNIX_OBJDIRS="
 HP-UXB.11.11_64_DBG.OBJ
 HP-UXB.11.11_64_OPT.OBJ
 HP-UXB.11.11_DBG.OBJ
 HP-UXB.11.11_OPT.OBJ
--- a/nsprpub/config/Makefile.in
+++ b/nsprpub/config/Makefile.in
@@ -108,22 +108,26 @@ endif
 
 include $(topsrcdir)/config/rules.mk
 
 PROGS	= $(OBJDIR)/now$(PROG_SUFFIX)
 
 ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
 TARGETS = $(PROGS)
 else
+ifeq ($(OS_ARCH),WINCE)
+TARGETS = $(PROGS)
+else
 PROGS	+= $(OBJDIR)/nsinstall$(PROG_SUFFIX)
 TARGETS = $(PROGS) $(PLSRCS:.pl=)
 endif
+endif
 
 OUTOPTION = -o # end of the line
-ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
+ifeq (,$(filter-out WINNT WIN95 WINCE,$(OS_TARGET)))
 ifndef NS_USE_GCC
 OUTOPTION = -Fe
 endif
 endif
 
 # Redefine MAKE_OBJDIR for just this directory
 define MAKE_OBJDIR
 if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi
--- a/nsprpub/config/now.c
+++ b/nsprpub/config/now.c
@@ -37,17 +37,17 @@
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #if defined(VMS)
 #include <sys/timeb.h>
 #elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
 #include <sys/time.h>
-#elif defined(WIN32)
+#elif defined(_WIN32)
 #include <windows.h>
 #else
 #error "Architecture not supported"
 #endif
 
 
 int main(int argc, char **argv)
 {
@@ -82,17 +82,17 @@ int main(int argc, char **argv)
 #if defined(OSF1)
     fprintf(stdout, "%ld", now);
 #elif defined(BEOS) && defined(__POWERPC__)
     fprintf(stdout, "%Ld", now);  /* Metroworks on BeOS PPC */
 #else
     fprintf(stdout, "%lld", now);
 #endif
 
-#elif defined(WIN32)
+#elif defined(_WIN32)
     __int64 now;
     FILETIME ft;
     GetSystemTimeAsFileTime(&ft);
     CopyMemory(&now, &ft, sizeof(now));
     /*
      * 116444736000000000 is the number of 100-nanosecond intervals
      * between Jan. 1, 1601 and Jan. 1, 1970.
      */
--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -37,8 +37,9 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSPR in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
+
--- a/nsprpub/config/rules.mk
+++ b/nsprpub/config/rules.mk
@@ -101,23 +101,23 @@ endif
 # - SHARED_LIBRARY: a shared (dynamic link) library
 # - IMPORT_LIBRARY: an import library, used only on Windows and OS/2
 #
 # The names of these libraries can be generated by simply specifying
 # LIBRARY_NAME and LIBRARY_VERSION.
 #
 
 ifdef LIBRARY_NAME
-ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
 
 #
 # Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
 # other platforms do not.
 #
-ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
+ifeq (,$(filter-out WIN95 WINCE OS2,$(OS_TARGET)))
 LIBRARY		= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
 SHARED_LIBRARY	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
 IMPORT_LIBRARY	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
 SHARED_LIB_PDB	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
 else
 LIBRARY		= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
 SHARED_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
 IMPORT_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
@@ -134,17 +134,17 @@ ifdef MKSHLIB
 SHARED_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
 endif
 endif
 
 endif
 endif
 
 ifndef TARGETS
-ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
 TARGETS		= $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
 ifndef BUILD_OPT
 ifdef MSC_VER
 ifneq (,$(filter-out 1100 1200,$(MSC_VER)))
 TARGETS		+= $(SHARED_LIB_PDB)
 endif
 endif
 endif
@@ -404,37 +404,45 @@ PWD := $(shell pwd)
 abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
 endif
 
 $(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
 	@$(MAKE_OBJDIR)
 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
 else
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
+	$(CCC) -Fo$@ -c $(CCCFLAGS) $<
+else
 ifdef NEED_ABSOLUTE_PATH
 	$(CCC) -o $@ -c $(CCCFLAGS) $(call abspath,$<)
 else
 	$(CCC) -o $@ -c $(CCCFLAGS) $<
 endif
 endif
+endif
 
 WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
 WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
 WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
 $(OBJDIR)/%.$(OBJ_SUFFIX): %.c
 	@$(MAKE_OBJDIR)
 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
 else
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
+	$(CC) -Fo$@ -c $(CFLAGS) $<
+else
 ifdef NEED_ABSOLUTE_PATH
 	$(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
 else
 	$(CC) -o $@ -c $(CFLAGS) $<
 endif
 endif
+endif
 
 
 $(OBJDIR)/%.$(OBJ_SUFFIX): %.s
 	@$(MAKE_OBJDIR)
 	$(AS) -o $@ $(ASFLAGS) -c $<
 
 %.i: %.c
 	$(CC) -C -E $(CFLAGS) $< > $*.i
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -684,17 +684,17 @@ echo "$ac_t""$build" 1>&6
 test "$host_alias" != "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=7
-MOD_PATCH_VERSION=2
+MOD_PATCH_VERSION=4
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -1105,17 +1105,17 @@ if test -n "$MOZ_DEBUG"; then
 EOF
 
     DEFINES="$DEFINES -UNDEBUG"
 
     case "${target_os}" in
     beos*)
         DEFINES="$DEFINES -DDEBUG_${USER}"
         ;;
-    msvc*|mks*|cygwin*|mingw*|os2*)
+    msvc*|mks*|cygwin*|mingw*|wince*|os2*)
         DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
         ;;
     *) 
         DEFINES="$DEFINES -DDEBUG_`$WHOAMI`"
         ;;
     esac
 else
     cat >> confdefs.h <<\EOF
@@ -2778,16 +2778,17 @@ ASFLAGS='$(CFLAGS)'
 if test -n "$CROSS_COMPILE"; then
     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
     OS_RELEASE=
     OS_TEST="${target_cpu}"
     case "${target_os}" in
         linux*)       OS_ARCH=Linux ;;
         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
         mingw*)       OS_ARCH=WINNT ;;
+        wince*)       OS_ARCH=WINCE ;;
         darwin*)      OS_ARCH=Darwin ;;
     esac
 else
     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
     OS_RELEASE=`uname -r`
     OS_TEST=`uname -m`
 fi
 
@@ -2941,17 +2942,17 @@ if test "${enable_os2_high_mem+set}" = s
       fi 
 fi
 
 
 case "$host" in
 *-mingw*)
     NSINSTALL=nsinstall
     ;;
-*-cygwin*|*-msvc*|*-mks*)
+*-cygwin*|*-msvc*|*-mks*|*-wince*)
     NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
     if test `echo "${PATH}" | grep -c \;` = 0; then
         CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
     fi
     ;;
 *-beos*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
     ;;
@@ -2975,27 +2976,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:2984: checking for sys/atomic_op.h" >&5
+echo "configure:2985: 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 2989 "configure"
+#line 2990 "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:2994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2995: \"$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
@@ -3142,36 +3143,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:3151: checking for gethostbyaddr in -lbind" >&5
+echo "configure:3152: 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 3159 "configure"
+#line 3160 "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:3170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3171: \"$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
@@ -4202,16 +4203,53 @@ EOF
         cat >> confdefs.h <<\EOF
 #define _WIN64 1
 EOF
 
     fi
 
     ;;
 
+*-wince*)
+    cat >> confdefs.h <<\EOF
+#define XP_PC 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define WIN32 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define WINCE 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define _PR_GLOBAL_THREADS_ONLY 1
+EOF
+
+
+    AR='lib -NOLOGO -OUT:"$@"'
+    AR_FLAGS=
+
+    OBJ_SUFFIX=obj
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
+
+    PR_MD_ARCH_DIR=windows
+    RESOLVE_LINK_SYMBOLS=1
+
+    MDCPUCFG_H=_win95.cfg
+    LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+    LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+
+    DLLFLAGS='-OUT:"$@"'
+    _DEBUG_FLAGS=-Zi
+    ;;
+
 *-ncr-sysv*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define SVR4 1
 EOF
@@ -4289,17 +4327,19 @@ EOF
     cat >> confdefs.h <<\EOF
 #define NETBSD 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define HAVE_BSD_FLOCK 1
 EOF
 
-    USE_NSPR_THREADS=1
+    if test -z "$USE_NSPR_THREADS"; then
+        USE_PTHREADS=1
+    fi
     MDCPUCFG_H=_netbsd.cfg
     PR_MD_CSRCS=netbsd.c
 
     DSO_CFLAGS='-fPIC -DPIC'
     CFLAGS="$CFLAGS -ansi -Wall"
     CXXFLAGS="$CXXFLAGS -ansi -Wall"
     MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
 
@@ -4496,27 +4536,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:4505: checking for machine/builtins.h" >&5
+echo "configure:4545: 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 4510 "configure"
+#line 4550 "configure"
 #include "confdefs.h"
 #include <machine/builtins.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4555: \"$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
@@ -4761,25 +4801,39 @@ EOF
 EOF
 
     CPU_ARCH=`uname -p`
     MDCPUCFG_H=_solaris.cfg
     PR_MD_CSRCS=solaris.c
     LD=/usr/ccs/bin/ld
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     RESOLVE_LINK_SYMBOLS=1
+    case "${OS_RELEASE}" in
+    5.8|5.9)
+        ;;
+    *)
+        # It is safe to use the -Bdirect linker flag on Solaris 10 or later.
+        USE_B_DIRECT=1
+        ;;
+    esac
     if test -n "$GNU_CC"; then
         DSO_CFLAGS=-fPIC
         if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
             GCC_USE_GNU_LD=1
         fi
-        DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore,-Bdirect' 
+        DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore' 
+        if test -n "$USE_B_DIRECT"; then
+            DSO_LDOPTS="$DSO_LDOPTS,-Bdirect"
+        fi
     else
         DSO_CFLAGS=-KPIC
-        DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore -Bdirect'
+        DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore'
+        if test -n "$USE_B_DIRECT"; then
+            DSO_LDOPTS="$DSO_LDOPTS -Bdirect"
+        fi
     fi
     if test -n "$GNU_CC"; then
         CFLAGS="$CFLAGS -Wall"
         CXXFLAGS="$CXXFLAGS -Wall"
         if test -n "$USE_MDUPDATE"; then
             CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
             CXXFLAGS="$CXXFLAGS -MDupdate \$(DEPENDENCIES)"
         fi
@@ -5022,63 +5076,63 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 
 
 case $target in
 *-darwin*|*-beos*)
     ;;
 *)
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5031: checking for dlopen in -ldl" >&5
+echo "configure:5085: 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 5039 "configure"
+#line 5093 "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:5050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5104: \"$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:5067: checking for dlfcn.h" >&5
+echo "configure:5121: 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 5072 "configure"
+#line 5126 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5131: \"$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
@@ -5101,23 +5155,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:5110: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5164: 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 5116 "configure"
+#line 5170 "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
@@ -5125,17 +5179,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 5134 "configure"
+#line 5188 "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
@@ -5149,22 +5203,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:5158: checking for $ac_func" >&5
+echo "configure:5212: 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 5163 "configure"
+#line 5217 "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();
@@ -5177,17 +5231,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:5186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5240: \"$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
@@ -5218,17 +5272,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:5227: checking for +Olit support" >&5
+echo "configure:5281: 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
@@ -5257,17 +5311,17 @@ esac
 
 case "$target_os" in
 darwin*)
     _HAVE_PTHREADS=1
     ;;
 *)
     
 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5266: checking for pthread_create in -lpthreads" >&5
+echo "configure:5320: 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);
         }
@@ -5279,17 +5333,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:5288: checking for pthread_create in -lpthread" >&5
+echo "configure:5342: 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);
         }
@@ -5301,17 +5355,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:5310: checking for pthread_create in -lc_r" >&5
+echo "configure:5364: 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);
         }
@@ -5323,17 +5377,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:5332: checking for pthread_create in -lc" >&5
+echo "configure:5386: 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);
         }
@@ -5455,17 +5509,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:5464: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5518: 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
@@ -5478,17 +5532,17 @@ echo "configure:5464: 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:5487: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5541: 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
@@ -5677,17 +5731,17 @@ EOF
 *-linux*|*-gnu*|*-k*bsd*-gnu)
     if test -n "$USE_NSPR_THREADS"; then
         cat >> confdefs.h <<\EOF
 #define _PR_LOCAL_THREADS_ONLY 1
 EOF
 
     fi
     ;;
-*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-os2*|*-beos*)
+*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*|*-os2*|*-beos*)
         USE_PTHREADS=
     _PTHREAD_LDFLAGS=
     USE_USER_PTHREADS=
     ;;
 *-netbsd*|*-openbsd*)
     if test -n "$USE_NSPR_THREADS"; then
         cat >> confdefs.h <<\EOF
 #define _PR_LOCAL_THREADS_ONLY 1
@@ -6011,17 +6065,17 @@ trap 'rm -f $CONFIG_STATUS conftest*; ex
 # Protect against Makefile macro expansion.
 cat > conftest.defs <<\EOF
 s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
 s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
 s%\[%\\&%g
 s%\]%\\&%g
 s%\$%$$%g
 EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '`
 rm -f conftest.defs
 
 
 # Without the "./", some shells look in PATH for config.status.
 : ${CONFIG_STATUS=./config.status}
 
 echo creating $CONFIG_STATUS
 rm -f $CONFIG_STATUS
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -45,17 +45,17 @@ AC_INIT(config/libc_r.h)
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_SYSTEM
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=7
-MOD_PATCH_VERSION=2
+MOD_PATCH_VERSION=4
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -379,17 +379,17 @@ fi
 if test -n "$MOZ_DEBUG"; then
     AC_DEFINE(DEBUG)
     DEFINES="$DEFINES -UNDEBUG"
 
     case "${target_os}" in
     beos*)
         DEFINES="$DEFINES -DDEBUG_${USER}"
         ;;
-    msvc*|mks*|cygwin*|mingw*|os2*)
+    msvc*|mks*|cygwin*|mingw*|wince*|os2*)
         DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
         ;;
     *) 
         DEFINES="$DEFINES -DDEBUG_`$WHOAMI`"
         ;;
     esac
 else
     AC_DEFINE(NDEBUG)
@@ -646,16 +646,17 @@ ASFLAGS='$(CFLAGS)'
 if test -n "$CROSS_COMPILE"; then
     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
     OS_RELEASE=
     OS_TEST="${target_cpu}"
     case "${target_os}" in
         linux*)       OS_ARCH=Linux ;;
         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
         mingw*)       OS_ARCH=WINNT ;;
+        wince*)       OS_ARCH=WINCE ;;
         darwin*)      OS_ARCH=Darwin ;;
     esac
 else
     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
     OS_RELEASE=`uname -r`
     OS_TEST=`uname -m`
 fi
 
@@ -812,17 +813,17 @@ AC_ARG_ENABLE(os2-high-mem,
 
 dnl ========================================================
 dnl Override of system specific host options
 dnl ========================================================
 case "$host" in
 *-mingw*)
     NSINSTALL=nsinstall
     ;;
-*-cygwin*|*-msvc*|*-mks*)
+*-cygwin*|*-msvc*|*-mks*|*-wince*)
     NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
     if test `echo "${PATH}" | grep -c \;` = 0; then
         CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
     fi
     ;;
 *-beos*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
     ;;
@@ -1679,16 +1680,41 @@ tools are selected during the Xcode/Deve
     esac
 
     if test "$USE_64"; then
         AC_DEFINE(_WIN64)
     fi
 
     ;;
 
+*-wince*)
+    AC_DEFINE(XP_PC)
+    AC_DEFINE(WIN32)
+    AC_DEFINE(WINCE)
+    AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
+
+    AR='lib -NOLOGO -OUT:"$@"'
+    AR_FLAGS=
+
+    OBJ_SUFFIX=obj
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
+
+    PR_MD_ARCH_DIR=windows
+    RESOLVE_LINK_SYMBOLS=1
+
+    MDCPUCFG_H=_win95.cfg
+    LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+    LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+
+    DLLFLAGS='-OUT:"$@"'
+    _DEBUG_FLAGS=-Zi
+    ;;
+
 *-ncr-sysv*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SVR4)
     AC_DEFINE(SYSV)
     AC_DEFINE(NCR)
     USE_NSPR_THREADS=1
     if test "$OS_RELEASE" = "2.03"; then
         AC_DEFINE(_PR_STAT_HAS_ST_ATIM)
@@ -1724,17 +1750,19 @@ mips-nec-sysv*)
     MDCPUCFG_H=_nec.cfg
     PR_MD_CSRCS=nec.c
     ;;
 
 *-netbsd*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(NETBSD)
     AC_DEFINE(HAVE_BSD_FLOCK)
-    USE_NSPR_THREADS=1
+    if test -z "$USE_NSPR_THREADS"; then
+        USE_PTHREADS=1
+    fi
     MDCPUCFG_H=_netbsd.cfg
     PR_MD_CSRCS=netbsd.c
 
     DSO_CFLAGS='-fPIC -DPIC'
     CFLAGS="$CFLAGS -ansi -Wall"
     CXXFLAGS="$CXXFLAGS -ansi -Wall"
     MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
 
@@ -1984,25 +2012,39 @@ mips-sony-newsos*)
     AC_DEFINE(SOLARIS)
     AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
     CPU_ARCH=`uname -p`
     MDCPUCFG_H=_solaris.cfg
     PR_MD_CSRCS=solaris.c
     LD=/usr/ccs/bin/ld
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     RESOLVE_LINK_SYMBOLS=1
+    case "${OS_RELEASE}" in
+    5.8|5.9)
+        ;;
+    *)
+        # It is safe to use the -Bdirect linker flag on Solaris 10 or later.
+        USE_B_DIRECT=1
+        ;;
+    esac
     if test -n "$GNU_CC"; then
         DSO_CFLAGS=-fPIC
         if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
             GCC_USE_GNU_LD=1
         fi
-        DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore,-Bdirect' 
+        DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore' 
+        if test -n "$USE_B_DIRECT"; then
+            DSO_LDOPTS="$DSO_LDOPTS,-Bdirect"
+        fi
     else
         DSO_CFLAGS=-KPIC
-        DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore -Bdirect'
+        DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore'
+        if test -n "$USE_B_DIRECT"; then
+            DSO_LDOPTS="$DSO_LDOPTS -Bdirect"
+        fi
     fi
     if test -n "$GNU_CC"; then
         CFLAGS="$CFLAGS -Wall"
         CXXFLAGS="$CXXFLAGS -Wall"
         if test -n "$USE_MDUPDATE"; then
             CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
             CXXFLAGS="$CXXFLAGS -MDupdate \$(DEPENDENCIES)"
         fi
@@ -2589,18 +2631,18 @@ case "$target" in
         fi
     fi
     ;;
 *-linux*|*-gnu*|*-k*bsd*-gnu)
     if test -n "$USE_NSPR_THREADS"; then
         AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
     fi
     ;;
-*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-os2*|*-beos*)
-    dnl win32, os2 & beos cannot use pthreads
+*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*|*-os2*|*-beos*)
+    dnl win32, wince, os2 & beos cannot use pthreads
     USE_PTHREADS=
     _PTHREAD_LDFLAGS=
     USE_USER_PTHREADS=
     ;;
 *-netbsd*|*-openbsd*)
     if test -n "$USE_NSPR_THREADS"; then
         AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
     fi
--- a/nsprpub/pr/include/md/_darwin.cfg
+++ b/nsprpub/pr/include/md/_darwin.cfg
@@ -39,17 +39,17 @@
 #define nspr_cpucfg___
 
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #define PR_AF_INET6 30  /* same as AF_INET6 */
 
-#if defined(__i386__) || defined(__x86_64__)
+#ifdef __LITTLE_ENDIAN__
 #undef IS_BIG_ENDIAN
 #define  IS_LITTLE_ENDIAN 1
 #else
 #undef IS_LITTLE_ENDIAN
 #define  IS_BIG_ENDIAN 1
 #endif
 
 #ifdef __x86_64__
--- a/nsprpub/pr/include/md/_darwin.h
+++ b/nsprpub/pr/include/md/_darwin.h
@@ -67,16 +67,17 @@
 #ifdef __x86_64__
 #define USE_DLFCN
 #else
 #define USE_MACH_DYLD
 #endif
 #define _PR_HAVE_SOCKADDR_LEN  
 #define _PR_STAT_HAS_ST_ATIMESPEC
 #define _PR_HAVE_LARGE_OFF_T
+#define _PR_HAVE_SYSV_SEMAPHORES
 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
 #define _PR_INET6
 /*
  * I'd prefer to use getipnodebyname and getipnodebyaddr but the
  * getipnodebyname(3) man page on Mac OS X 10.2 says they are not
  * thread-safe.  AI_V4MAPPED|AI_ADDRCONFIG doesn't work either.
  */
--- a/nsprpub/pr/include/md/_linux.h
+++ b/nsprpub/pr/include/md/_linux.h
@@ -412,21 +412,31 @@ extern void _MD_CleanupBeforeExit(void);
 #define _MD_SP_TYPE __ptr_t
 #else
 #error "Linux/MIPS pre-glibc2 not supported yet"
 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
 
 #elif defined(__arm__)
 /* ARM/Linux */
 #if defined(__GLIBC__) && __GLIBC__ >= 2
+#ifdef __ARM_EABI__
+/* EABI */
+#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[8]
+#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[7] = (val))
+#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
+#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[7])
+#define _MD_SP_TYPE __ptr_t
+#else /* __ARM_EABI__ */
+/* old ABI */
 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[20]
 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[19] = (val))
 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[19])
 #define _MD_SP_TYPE __ptr_t
+#endif /* __ARM_EABI__ */
 #else
 #error "ARM/Linux pre-glibc2 not supported yet"
 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
 
 #else
 
 #error "Unknown CPU architecture"
 
--- a/nsprpub/pr/include/md/_win95.cfg
+++ b/nsprpub/pr/include/md/_win95.cfg
@@ -41,19 +41,25 @@
 #ifndef XP_PC
 #define XP_PC
 #endif
 
 #ifndef WIN32
 #define WIN32
 #endif
 
+#ifdef _WIN32_WCE
+#ifndef WINCE
+#define WINCE
+#endif
+#else
 #ifndef WIN95
 #define WIN95
 #endif
+#endif
 
 #define PR_AF_INET6 23  /* same as AF_INET6 */
 
 #if defined(_M_IX86) || defined(_X86_)
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 
@@ -93,17 +99,17 @@
 #define PR_ALIGN_OF_INT64   8
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_WORD	4
 #define PR_ALIGN_OF_DWORD	8
 #define PR_ALIGN_OF_DOUBLE  4
 #define PR_ALIGN_OF_POINTER 4
 
 #define PR_BYTES_PER_WORD_LOG2	2
-#define PR_BYTES_PER_DWORD_LOG2	2
+#define PR_BYTES_PER_DWORD_LOG2	3
 
 #elif defined(_ALPHA_)
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 
 #define PR_BYTES_PER_BYTE   1
 #define PR_BYTES_PER_SHORT  2
@@ -237,16 +243,64 @@
 #define PR_ALIGN_OF_WORD	8
 #define PR_ALIGN_OF_DWORD	8
 #define PR_ALIGN_OF_DOUBLE  8
 #define PR_ALIGN_OF_POINTER 8
 
 #define PR_BYTES_PER_WORD_LOG2	3
 #define PR_BYTES_PER_DWORD_LOG2	3
 
+#elif defined(_ARM_)
+
+#define IS_LITTLE_ENDIAN 1
+#undef  IS_BIG_ENDIAN
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   4
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_WORD   4
+#define PR_BYTES_PER_DWORD  8
+#define PR_BYTES_PER_DOUBLE 8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    32
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_WORD    32
+#define PR_BITS_PER_DWORD   64
+#define PR_BITS_PER_DOUBLE  64
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   5
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_WORD_LOG2   5
+#define PR_BITS_PER_DWORD_LOG2  6
+#define PR_BITS_PER_DOUBLE_LOG2 6
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_WORD    4
+#define PR_ALIGN_OF_DWORD   8
+#define PR_ALIGN_OF_DOUBLE  4
+#define PR_ALIGN_OF_POINTER 4
+
+#define PR_BYTES_PER_WORD_LOG2  2
+#define PR_BYTES_PER_DWORD_LOG2 3
+
 #else /* defined(_M_IX86) || defined(_X86_) */
 
 #error unknown processor architecture
 
 #endif /* defined(_M_IX86) || defined(_X86_) */
 
 #ifndef HAVE_LONG_LONG
 #define HAVE_LONG_LONG
--- a/nsprpub/pr/include/md/_win95.h
+++ b/nsprpub/pr/include/md/_win95.h
@@ -51,16 +51,18 @@
 #define PR_LINKER_ARCH      "win32"
 #define _PR_SI_SYSNAME        "WIN95"
 #if defined(_M_IX86) || defined(_X86_)
 #define _PR_SI_ARCHITECTURE   "x86"
 #elif defined(_AMD64_)
 #define _PR_SI_ARCHITECTURE   "x86-64"
 #elif defined(_IA64_)
 #define _PR_SI_ARCHITECTURE   "ia64"
+#elif defined(_ARM_)
+#define _PR_SI_ARCHITECTURE   "arm"
 #else
 #error unknown processor architecture
 #endif
 
 #define HAVE_DLL
 #undef  HAVE_THREAD_AFFINITY
 #define _PR_HAVE_GETADDRINFO
 #define _PR_INET6_PROBE
--- a/nsprpub/pr/include/md/prosdep.h
+++ b/nsprpub/pr/include/md/prosdep.h
@@ -46,17 +46,17 @@
 PR_BEGIN_EXTERN_C
 
 #ifdef XP_PC
 
 #include "md/_pcos.h"
 #ifdef WINNT
 #include "md/_winnt.h"
 #include "md/_win32_errors.h"
-#elif defined(WIN95)
+#elif defined(WIN95) || defined(WINCE)
 #include "md/_win95.h"
 #include "md/_win32_errors.h"
 #elif defined(WIN16)
 #include "md/_win16.h"
 #elif defined(OS2)
 #include "md/_os2.h"
 #include "md/_os2_errors.h"
 #else
--- a/nsprpub/pr/include/pratom.h
+++ b/nsprpub/pr/include/pratom.h
@@ -105,17 +105,17 @@ NSPR_API(PRInt32)	PR_AtomicAdd(PRInt32 *
 **
 ** IMPORTANT NOTE TO NSPR MAINTAINERS:
 **    Implement these macros with compiler intrinsics only on platforms
 **    where the PR_AtomicXXX functions are truly atomic (i.e., where the
 **    configuration macro _PR_HAVE_ATOMIC_OPS is defined).  Otherwise,
 **    the macros and functions won't be compatible and can't be used
 **    interchangeably.
 */
-#if defined(_WIN32) && (_MSC_VER >= 1310)
+#if defined(_WIN32) && !defined(_WIN32_WCE) && (_MSC_VER >= 1310)
 
 long __cdecl _InterlockedIncrement(long volatile *Addend);
 #pragma intrinsic(_InterlockedIncrement)
 
 long __cdecl _InterlockedDecrement(long volatile *Addend);
 #pragma intrinsic(_InterlockedDecrement)
 
 long __cdecl _InterlockedExchange(long volatile *Target, long Value);
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -58,21 +58,21 @@ PR_BEGIN_EXTERN_C
 /*
 ** NSPR's version is used to determine the likelihood that the version you
 ** used to build your component is anywhere close to being compatible with
 ** what is in the underlying library.
 **
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.7.2"
+#define PR_VERSION  "4.7.4 Beta"
 #define PR_VMAJOR   4
 #define PR_VMINOR   7
-#define PR_VPATCH   2
-#define PR_BETA     PR_FALSE
+#define PR_VPATCH   4
+#define PR_BETA     PR_TRUE
 
 /*
 ** PRVersionCheck
 **
 ** The basic signature of the function that is called to provide version
 ** checking. The result will be a boolean that indicates the likelihood
 ** that the underling library will perform as the caller expects.
 **
--- a/nsprpub/pr/include/prnetdb.h
+++ b/nsprpub/pr/include/prnetdb.h
@@ -387,17 +387,17 @@ NSPR_API(PRStatus) PR_GetProtoByName(
 **                      for the failure can be retrieved by PR_GetError().
 ***********************************************************************/
 NSPR_API(PRStatus) PR_GetProtoByNumber(
     PRInt32 protocolnumber, char* buffer, PRInt32 bufsize, PRProtoEnt* result);
 
 /***********************************************************************
 ** FUNCTION:
 ** DESCRIPTION: PR_GetAddrInfoByName()
-**  Lookup a host by name. Equivalent to getaddrinfo(host, NULL, ...) of
+**  Look up a host by name. Equivalent to getaddrinfo(host, NULL, ...) of
 **  RFC 3493.
 **
 ** INPUTS:
 **  char *hostname      Character string defining the host name of interest
 **  PRUint16 af         May be PR_AF_UNSPEC or PR_AF_INET.
 **  PRIntn flags        May be either PR_AI_ADDRCONFIG or
 **                      PR_AI_ADDRCONFIG | PR_AI_NOCANONNAME. Include
 **                      PR_AI_NOCANONNAME to suppress the determination of
@@ -433,41 +433,41 @@ NSPR_API(void) PR_FreeAddrInfo(PRAddrInf
 ** FUNCTION:
 ** DESCRIPTION: PR_EnumerateAddrInfo()
 **  A stateless enumerator over a PRAddrInfo handle acquired from
 **  PR_GetAddrInfoByName() to inspect the possible network addresses.
 **
 ** INPUTS:
 **  void *enumPtr       Index pointer of the enumeration. The enumeration
 **                      starts and ends with a value of NULL.
-**  PRAddrInfo *addrInfo
+**  const PRAddrInfo *addrInfo
 **                      The PRAddrInfo handle returned by a successful
 **                      call to PR_GetAddrInfoByName().
 **  PRUint16 port       The port number to be assigned as part of the
 **                      PRNetAddr.
 ** OUTPUTS:
 **  PRNetAddr *result   A pointer to an address structure that will be
 **                      filled in by the call to the enumeration if the
-**                      result of the call is greater than zero.
+**                      result of the call is not NULL.
 ** RETURN:
 **  void*               The value that should be used for the next call
 **                      of the enumerator ('enumPtr'). The enumeration
-**                      is ended if this value is returned NULL.
+**                      is ended if this value is NULL.
 ***********************************************************************/
 NSPR_API(void *) PR_EnumerateAddrInfo(
     void *enumPtr, const PRAddrInfo *addrInfo, PRUint16 port, PRNetAddr *result);
 
 /***********************************************************************
 ** FUNCTION:
 ** DESCRIPTION: PR_GetCanonNameFromAddrInfo()
 **  Extracts the canonical name of the hostname passed to
 **  PR_GetAddrInfoByName().
 **
 ** INPUTS:
-**  PRAddrInfo *addrInfo 
+**  const PRAddrInfo *addrInfo 
 **                      The PRAddrInfo handle returned by a successful
 **                      call to PR_GetAddrInfoByName().
 ** RETURN:
 **  const char *        A const pointer to the canonical hostname stored
 **                      in the given PRAddrInfo handle. This pointer is
 **                      invalidated once the PRAddrInfo handle is destroyed
 **                      by a call to PR_FreeAddrInfo().
 ***********************************************************************/
--- a/nsprpub/pr/src/linking/prlink.c
+++ b/nsprpub/pr/src/linking/prlink.c
@@ -39,17 +39,17 @@
 #include "primpl.h"
 
 #include <string.h>
 
 #ifdef XP_BEOS
 #include <image.h>
 #endif
 
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
 #include <CodeFragments.h>
 #include <TextUtils.h>
 #include <Types.h>
 #include <Aliases.h>
 #include <CFURL.h>
 #include <CFBundle.h>
 #include <CFString.h>
 #include <CFDictionary.h>
@@ -150,18 +150,18 @@ struct _imcb *IAC$GL_IMAGE_LIST = NULL;
 
 #define MAX_DEVNAM 64
 #define MAX_FILNAM 255
 #endif  /* VMS */
 
 /*
  * On these platforms, symbols have a leading '_'.
  */
-#if defined(SUNOS4) || defined(DARWIN) || defined(NEXTSTEP) \
-    || defined(WIN16) || defined(XP_OS2) \
+#if defined(SUNOS4) || (defined(DARWIN) && defined(USE_MACH_DYLD)) \
+    || defined(NEXTSTEP) || defined(WIN16) || defined(XP_OS2) \
     || ((defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__))
 #define NEED_LEADING_UNDERSCORE
 #endif
 
 #define PR_LD_PATHW 0x8000  /* for PR_LibSpec_PathnameU */
 
 /************************************************************************/
 
@@ -174,17 +174,17 @@ struct PRLibrary {
 #ifdef XP_PC
 #ifdef XP_OS2
     HMODULE                     dlh;
 #else
     HINSTANCE                   dlh;
 #endif
 #endif
 
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
     CFragConnectionID           connection;
     CFBundleRef                 bundle;
     Ptr                         main;
     CFMutableDictionaryRef      wrappers;
     const struct mach_header*   image;
 #endif
 
 #ifdef XP_UNIX
@@ -218,41 +218,35 @@ static LoadLibraryWFn loadLibraryW = Loa
 
 #ifdef WIN32
 static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len);
 #endif
 
 /************************************************************************/
 
 #if !defined(USE_DLFCN) && !defined(HAVE_STRERROR)
-static char* errStrBuf = NULL;
 #define ERR_STR_BUF_LENGTH    20
-static char* errno_string(PRIntn oserr)
-{
-    if (errStrBuf == NULL)
-        errStrBuf = PR_MALLOC(ERR_STR_BUF_LENGTH);
-    PR_snprintf(errStrBuf, ERR_STR_BUF_LENGTH, "error %d", oserr);
-    return errStrBuf;
-}
 #endif
 
 static void DLLErrorInternal(PRIntn oserr)
 /*
 ** This whole function, and most of the code in this file, are run
 ** with a big hairy lock wrapped around it. Not the best of situations,
 ** but will eventually come up with the right answer.
 */
 {
     const char *error = NULL;
 #ifdef USE_DLFCN
     error = dlerror();  /* $$$ That'll be wrong some of the time - AOF */
 #elif defined(HAVE_STRERROR)
     error = strerror(oserr);  /* this should be okay */
 #else
-    error = errno_string(oserr);
+    char errStrBuf[ERR_STR_BUF_LENGTH];
+    PR_snprintf(errStrBuf, sizeof(errStrBuf), "error %d", oserr);
+    error = errStrBuf;
 #endif
     if (NULL != error)
         PR_SetErrorText(strlen(error), error);
 }  /* DLLErrorInternal */
 
 void _PR_InitLinker(void)
 {
     PRLibrary *lm = NULL;
@@ -377,20 +371,16 @@ void _PR_ShutdownLinker(void)
     
     PR_DestroyMonitor(pr_linker_lock);
     pr_linker_lock = NULL;
 
     if (_pr_currentLibPath) {
         free(_pr_currentLibPath);
         _pr_currentLibPath = NULL;
     }
-
-#if !defined(USE_DLFCN) && !defined(HAVE_STRERROR)
-    PR_DELETE(errStrBuf);
-#endif
 }
 #endif
 
 /******************************************************************************/
 
 PR_IMPLEMENT(PRStatus) PR_SetLibraryPath(const char *path)
 {
     PRStatus rv = PR_SUCCESS;
@@ -624,17 +614,17 @@ pr_LoadMachDyldModule(const char *name)
                 h = NULL;
             }
         }
     }
     return h;
 }
 #endif
 
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
 
 /*
 ** macLibraryLoadProc is a function definition for a Mac shared library
 ** loading method. The "name" param is the same full or partial pathname
 ** that was passed to pr_LoadLibraryByPathName. The function must fill
 ** in the fields of "lm" which apply to its library type. Returns
 ** PR_SUCCESS if successful.
 */
@@ -783,17 +773,17 @@ pr_LoadViaDyld(const char *name, PRLibra
             PR_LOG(_pr_linker_lm, PR_LOG_MIN, 
                    ("LoadMachDyldModule error %d:%d for file %s:\n%s",
                     linkEditError, errorNum, fileName, errorString));
         }
     }
     return (lm->dlh != NULL || lm->image != NULL) ? PR_SUCCESS : PR_FAILURE;
 }
 
-#endif /* XP_MACOSX */
+#endif /* XP_MACOSX && USE_MACH_DYLD */
 
 #ifdef WIN95
 static HMODULE WINAPI
 EmulateLoadLibraryW(LPCWSTR lpLibFileName)
 {
     HMODULE h;
     char nameA[MAX_PATH];
 
@@ -921,17 +911,17 @@ pr_LoadLibraryByPathname(const char *nam
     lm->name = strdup(name);
 #endif
     lm->dlh = h;
     lm->next = pr_loadmap;
     pr_loadmap = lm;
     }
 #endif /* WIN32 || WIN16 */
 
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
     {
     int     i;
     PRStatus status;
 
     static const macLibraryLoadProc loadProcs[] = {
 #ifdef __ppc__
         pr_LoadViaDyld, pr_LoadCFBundle, pr_LoadViaCFM
 #else  /* __ppc__ */
@@ -949,17 +939,17 @@ pr_LoadLibraryByPathname(const char *nam
         goto unlock;        
     }
     lm->name = strdup(name);
     lm->next = pr_loadmap;
     pr_loadmap = lm;
     }
 #endif
 
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(XP_UNIX) && !(defined(XP_MACOSX) && defined(USE_MACH_DYLD))
 #ifdef HAVE_DLL
     {
 #if defined(USE_DLFCN)
 #ifdef NTO
     /* Neutrino needs RTLD_GROUP to load Netscape plugins. (bug 71179) */
     int dl_flags = RTLD_GROUP;
 #elif defined(AIX)
     /* AIX needs RTLD_MEMBER to load an archive member.  (bug 228899) */
@@ -1013,17 +1003,17 @@ pr_LoadLibraryByPathname(const char *nam
         goto unlock;
     }
     lm->name = strdup(name);
     lm->dlh = h;
     lm->next = pr_loadmap;
     pr_loadmap = lm;
     }
 #endif /* HAVE_DLL */
-#endif /* XP_UNIX */
+#endif /* XP_UNIX && !(XP_MACOSX && USE_MACH_DYLD) */
 
     lm->refCount = 1;
 
 #ifdef XP_BEOS
     {
         image_info info;
         int32 cookie = 0;
         image_id imageid = B_ERROR;
@@ -1294,17 +1284,17 @@ PR_UnloadLibrary(PRLibrary *lib)
 #endif /* XP_UNIX */
 #ifdef XP_PC
     if (lib->dlh) {
         FreeLibrary((HINSTANCE)(lib->dlh));
         lib->dlh = (HINSTANCE)NULL;
     }
 #endif  /* XP_PC */
 
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
     /* Close the connection */
     if (lib->connection)
         CloseConnection(&(lib->connection));
     if (lib->bundle)
         CFRelease(lib->bundle);
     if (lib->wrappers)
         CFRelease(lib->wrappers);
     /* No way to unload an image (lib->image) */
@@ -1393,17 +1383,17 @@ pr_FindSymbolInLib(PRLibrary *lm, const 
     }
 #endif
 #endif  /* XP_OS2 */
 
 #if defined(WIN32) || defined(WIN16)
     f = GetProcAddress(lm->dlh, name);
 #endif  /* WIN32 || WIN16 */
 
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
 /* add this offset to skip the leading underscore in name */
 #define SYM_OFFSET 1
     if (lm->bundle) {
         CFStringRef nameRef = CFStringCreateWithCString(NULL, name + SYM_OFFSET, kCFStringEncodingASCII);
         if (nameRef) {
             f = CFBundleGetFunctionPointerForName(lm->bundle, nameRef);
             CFRelease(nameRef);
         }
@@ -1434,17 +1424,17 @@ pr_FindSymbolInLib(PRLibrary *lm, const 
                  NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
                  | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
         if (symbol != NULL)
             f = NSAddressOfSymbol(symbol);
         else
             f = NULL;
     }
 #undef SYM_OFFSET
-#endif /* XP_MACOSX */
+#endif /* XP_MACOSX && USE_MACH_DYLD */
 
 #ifdef XP_BEOS
     if( B_NO_ERROR != get_image_symbol( (image_id)lm->dlh, name, B_SYMBOL_TYPE_TEXT, &f ) ) {
         f = NULL;
     }
 #endif
 
 #ifdef XP_UNIX
@@ -1622,17 +1612,18 @@ PR_LoadStaticLibrary(const char *name, c
     PR_ExitMonitor(pr_linker_lock);
     return result;
 }
 
 PR_IMPLEMENT(char *)
 PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
 {
 #if defined(USE_DLFCN) && (defined(SOLARIS) || defined(FREEBSD) \
-        || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__))
+        || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
+        || defined(DARWIN))
     Dl_info dli;
     char *result;
 
     if (dladdr((void *)addr, &dli) == 0) {
         PR_SetError(PR_LIBRARY_NOT_LOADED_ERROR, _MD_ERRNO());
         DLLErrorInternal(_MD_ERRNO());
         return NULL;
     }
--- a/nsprpub/pr/src/md/windows/ntinrval.c
+++ b/nsprpub/pr/src/md/windows/ntinrval.c
@@ -37,24 +37,43 @@
 
 /*
  * NT interval timers
  *
  */
 
 #include "primpl.h"
 
+#ifdef WINCE
+typedef DWORD (*IntervalFuncType)(void);
+static IntervalFuncType intervalFunc;
+#endif
+
 void
 _PR_MD_INTERVAL_INIT()
 {
+#ifdef WINCE
+    HMODULE mmtimerlib = LoadLibraryW(L"mmtimer.dll");  /* XXX leaked! */
+    if (mmtimerlib) {
+        intervalFunc = (IntervalFuncType)GetProcAddress(mmtimerlib,
+                                                        "timeGetTime");
+    } else {
+        intervalFunc = &GetTickCount;
+    }
+#endif
 }
 
 PRIntervalTime 
 _PR_MD_GET_INTERVAL()
 {
-    return timeGetTime();  /* milliseconds since system start */
+    /* milliseconds since system start */
+#ifdef WINCE
+    return (*intervalFunc)();
+#else
+    return timeGetTime();
+#endif
 }
 
 PRIntervalTime 
 _PR_MD_INTERVAL_PER_SEC()
 {
     return 1000;
 }
--- a/nsprpub/pr/src/md/windows/w32poll.c
+++ b/nsprpub/pr/src/md/windows/w32poll.c
@@ -242,16 +242,22 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, 
         else
         {
             pd->out_flags = 0;
         }
     }
 
     if (0 != ready) return ready;  /* no need to block */
 
+    /*
+     * FD_SET does nothing if the fd_set's internal fd_array is full.  If
+     * nrd, nwt, or nex is greater than FD_SETSIZE, we know FD_SET must
+     * have failed to insert an osfd into the corresponding fd_set, and
+     * therefore we should fail.
+     */
     if ((nrd > FD_SETSIZE) || (nwt > FD_SETSIZE) || (nex > FD_SETSIZE)) {
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
         return -1;
     }
 
     rdp = (0 == nrd) ? NULL : &rd;
     wtp = (0 == nwt) ? NULL : &wt;
     exp = (0 == nex) ? NULL : &ex;
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -807,17 +807,17 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphor
 #include <fcntl.h>
 #include <sys/sem.h>
 
 /*
  * From the semctl(2) man page in glibc 2.0
  */
 #if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
     || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI) \
-    || defined(SYMBIAN)
+    || defined(DARWIN) || defined(SYMBIAN)
 /* union semun is defined by including <sys/sem.h> */
 #else
 /* according to X/OPEN we have to define it ourselves */
 union semun {
     int val;
     struct semid_ds *buf;
     unsigned short  *array;
 };
--- a/nsprpub/pr/tests/runtests.pl
+++ b/nsprpub/pr/tests/runtests.pl
@@ -116,42 +116,54 @@ sub print_begin {
     # Summary output
     print OF "$prog";
     # Full output
     $now = getTime;
     print "BEGIN TEST: $lprog ($now)\n\n";
 }
 
 sub print_end {
-$lprog = shift;
-$lstatus = shift;
+($lprog, $exit_status, $exit_signal, $exit_core) = @_;
 
-    if ($lstatus == 0) {
+    if (($exit_status == 0) && ($exit_signal == 0) && ($exit_core == 0)) {
         $str_status = "Passed";
     } else {
         $str_status = "FAILED";
     }
+    if ($exit_signal != 0) {
+    	$str_signal = " - signal $exit_signal";
+    } else {
+    	$str_signal = "";
+    }
+    if ($exit_core != 0) {
+    	$str_core = " - core dumped";
+    } else {
+    	$str_core = "";
+    }
     $now = getTime;
     # Full output
     print "\nEND TEST: $lprog ($now)\n";
-    print "TEST STATUS: $lprog = $str_status (errno $lstatus)\n";
+    print "TEST STATUS: $lprog = $str_status (exit status " . $exit_status . $str_signal . $str_core . ")\n";
     print "--------------------------------------------------\n\n";
     # Summary output
     print OF "\t\t\t$str_status\n";
 }
 
 sub ux_start_prog {
 # parameters:
 $lprog = shift; # command to run
 
     # Create a process group for the child
     # so we can kill all of it if needed
     setsid or die "setsid failed: $!";
     # Start test program    
     exec("./$lprog");
+    # We should not be here unless exec failed.
+    print "Faild to exec $lprog";
+    exit 1 << 8;
 }   
 
 sub ux_wait_timeout {
 # parameters:
 $lpid = shift;     # child process id
 $ltimeout = shift; # timeout
 
     if ($ltimeout == 0) {
@@ -166,29 +178,29 @@ sub ux_wait_timeout {
             $ret = waitpid($lpid, WNOHANG);
             if ($ret == 0) {
                 # Child still running
     #           print "Time left=$ltimeout\n";
                 sleep 1;
                 $ltimeout--;
             } else {
                 # Child has ended
-                $lstatus = $? % 256;
+                $lstatus = $?;
                 # Exit the wait loop and don't kill
                 $ltimeout = -1;
             }
         }
     }
     
     if ($ltimeout == 0) {
         # we ran all the timeout: it's time to kill the child
         print "Timeout ! Kill child process $lpid\n";
         # Kill the child process and group
         kill(-9,$lpid);
-        $lstatus = 1;
+        $lstatus = 9;
     }
     
     return $lstatus;
 }
 
 sub ux_test_prog {
 # parameters:
 $prog = shift;  # Program to test
@@ -196,17 +208,21 @@ sub ux_test_prog {
     $child_pid = fork;
     if ($child_pid == 0) {
         # we are in the child process
         print_begin($prog);
         ux_start_prog($prog);
     } else {
         # we are in the parent process
         $status = ux_wait_timeout($child_pid,$timeout);
-        print_end($prog, $status);
+        # See Perlvar for documentation of $?
+        # exit status = $status >> 8
+        # exit signal = $status & 127 (no signal = 0)
+        # core dump = $status & 128 (no core = 0)
+        print_end($prog, $status >> 8, $status & 127, $status & 128);
     }
 
     return $status;
 }
 
 sub win_path {
 $lpath = shift;
 
@@ -241,22 +257,23 @@ sub win_test_prog {
                            0,
                            NORMAL_PRIORITY_CLASS,
                            ".")|| die win_ErrorReport();
     $retwait = $ProcessObj->Wait($timeout * 1000);
         
     if ( $retwait == 0) {
         # the prog didn't finish after the timeout: kill
         $ProcessObj->Kill($status);
-        print "Timeout ! Process killed with error code $status\n";
+        print "Timeout ! Process killed with exit status $status\n";
     } else {
-        # the prog finished before the timeout: get exit code
+        # the prog finished before the timeout: get exit status
         $ProcessObj->GetExitCode($status);
     }
-    print_end($prog,$status);
+    # There is no signal, no core on Windows
+    print_end($prog, $status, 0, 0);
 
     return $status
 }
 
 # MAIN ---------------
 @progs = (
 "accept",
 "acceptread",
@@ -368,17 +385,16 @@ sub win_test_prog {
 "version",
 "writev",
 "xnotify",
 "zerolen");
 
 open_log;
 
 foreach $current_prog (@progs) {
-#   print "Current_prog=$current_prog\n";
     if ($osname =~ $WINOS) {
         win_test_prog($current_prog);
     } else {
         ux_test_prog($current_prog);
     }
 }
 
 close_log;
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -47,27 +47,28 @@
  */
 
 #include "prinit.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 /*
- * This release (4.7.2) is backward compatible with the
- * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7, and
- * 4.7.1 releases.  It, of course, is compatible with itself.
+ * This release (4.7.4) is backward compatible with the
+ * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7,
+ * 4.7.1, 4.7.2, and 4.7.3 releases.  It, of course, is
+ * compatible with itself.
  */
 static char *compatible_version[] = {
     "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
     "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1",
     "4.5", "4.5.1",
     "4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5",
     "4.6.6", "4.6.7", "4.6.8",
-    "4.7", "4.7.1", PR_VERSION
+    "4.7", "4.7.1", "4.7.2", "4.7.3", PR_VERSION
 };
 
 /*
  * This release is not backward compatible with the old
  * NSPR 2.1 and 3.x releases.
  *
  * Any release is incompatible with future releases and
  * patches.