Upgrade NSPR to NSPR_HEAD_20090321. This CVS tag includes
authorWan-Teh Chang <wtc@google.com>
Sun, 22 Mar 2009 09:44:55 -0700
changeset 26462 9560711165646da2bff775379e30997efbf7e1fd
parent 26461 306d51ee8b10315e5e907ccddb8c51eb35cc8e0c
child 26463 558a9f0a2171a4d46b99ae2df302de988464713b
push idunknown
push userunknown
push dateunknown
bugs439144, 449665, 442706, 432430, 476536, 478687, 480730, 480740, 480074, 469083, 433790
milestone1.9.2a1pre
Upgrade NSPR to NSPR_HEAD_20090321. This CVS tag includes the following changes: - Bug 439144: fixed strict aliasing issues in prdtoa.c - Bug 449665: suppress the parentheses warnings in prdtoa.c - Bug 442706: build for Symbian OS with autoconf and GNU make - Bug 432430: some more changes for the Symbian OS port - Bug 476536: added PR_ASSERT_CURRENT_THREAD_OWNS_LOCK and PR_ASSERT_CURRENT_THREAD_IN_MONITOR. - Bug 478687: made PRUint64/uint64 compatible with uint64_t for 64-bit Mac OS X - Bug 480730: PR_LoadLibrary for 64-bit MAC OS X should not search DYLD_LIBRARY_PATH if the library is specified as a pathname - Bug 480740: PR_ParseTimeString crash with dates >= year 3001 when compiled with Visual C++ 2005. - Bug 480074: better dependency resolution for import libraries - Bug 469083: ported NSPR test programs to WINCE - Bug 433790: removed some obsolete WIN16 code
nsprpub/config/Makefile.in
nsprpub/config/autoconf.mk.in
nsprpub/config/prdepend.h
nsprpub/config/rules.mk
nsprpub/configure
nsprpub/configure.in
nsprpub/lib/ds/plhash.c
nsprpub/lib/libc/src/plerror.c
nsprpub/lib/msgc/src/prgcapi.c
nsprpub/lib/msgc/src/prmsgc.c
nsprpub/lib/msgc/src/win16gc.c
nsprpub/lib/msgc/tests/Makefile.in
nsprpub/lib/prstreams/tests/testprstrm/Makefile.in
nsprpub/lib/tests/Makefile.in
nsprpub/pr/include/md/_pcos.h
nsprpub/pr/include/md/_unixos.h
nsprpub/pr/include/md/_win16.cfg
nsprpub/pr/include/md/_win16.h
nsprpub/pr/include/md/prosdep.h
nsprpub/pr/include/prdtoa.h
nsprpub/pr/include/prinet.h
nsprpub/pr/include/prinrval.h
nsprpub/pr/include/prio.h
nsprpub/pr/include/prlock.h
nsprpub/pr/include/prlog.h
nsprpub/pr/include/prlong.h
nsprpub/pr/include/prmon.h
nsprpub/pr/include/prnetdb.h
nsprpub/pr/include/prthread.h
nsprpub/pr/include/prtime.h
nsprpub/pr/include/prtypes.h
nsprpub/pr/src/bthreads/btlocks.c
nsprpub/pr/src/bthreads/btmon.c
nsprpub/pr/src/linking/prlink.c
nsprpub/pr/src/md/windows/Makefile.in
nsprpub/pr/src/md/windows/objs.mk
nsprpub/pr/src/md/windows/w16callb.c
nsprpub/pr/src/md/windows/w16error.c
nsprpub/pr/src/md/windows/w16fmem.c
nsprpub/pr/src/md/windows/w16gc.c
nsprpub/pr/src/md/windows/w16io.c
nsprpub/pr/src/md/windows/w16mem.c
nsprpub/pr/src/md/windows/w16null.c
nsprpub/pr/src/md/windows/w16proc.c
nsprpub/pr/src/md/windows/w16sock.c
nsprpub/pr/src/md/windows/w16stdio.c
nsprpub/pr/src/md/windows/w16thred.c
nsprpub/pr/src/misc/prdtoa.c
nsprpub/pr/src/misc/prlong.c
nsprpub/pr/src/misc/prtime.c
nsprpub/pr/src/misc/prtrace.c
nsprpub/pr/src/nspr.def
nsprpub/pr/src/pthreads/ptsynch.c
nsprpub/pr/src/pthreads/ptthread.c
nsprpub/pr/src/threads/combined/prulock.c
nsprpub/pr/src/threads/prmon.c
nsprpub/pr/tests/Makefile.in
nsprpub/pr/tests/accept.c
nsprpub/pr/tests/acceptread.c
nsprpub/pr/tests/acceptreademu.c
nsprpub/pr/tests/addrstr.c
nsprpub/pr/tests/anonfm.c
nsprpub/pr/tests/append.c
nsprpub/pr/tests/atomic.c
nsprpub/pr/tests/bigfile.c
nsprpub/pr/tests/bigfile2.c
nsprpub/pr/tests/bigfile3.c
nsprpub/pr/tests/bug1test.c
nsprpub/pr/tests/cleanup.c
nsprpub/pr/tests/cltsrv.c
nsprpub/pr/tests/concur.c
nsprpub/pr/tests/cvar.c
nsprpub/pr/tests/cvar2.c
nsprpub/pr/tests/dbmalloc.c
nsprpub/pr/tests/dbmalloc1.c
nsprpub/pr/tests/dceemu.c
nsprpub/pr/tests/dtoa.c
nsprpub/pr/tests/env.c
nsprpub/pr/tests/errcodes.c
nsprpub/pr/tests/errset.c
nsprpub/pr/tests/exit.c
nsprpub/pr/tests/foreign.c
nsprpub/pr/tests/forktest.c
nsprpub/pr/tests/formattm.c
nsprpub/pr/tests/freeif.c
nsprpub/pr/tests/fsync.c
nsprpub/pr/tests/getai.c
nsprpub/pr/tests/getproto.c
nsprpub/pr/tests/i2l.c
nsprpub/pr/tests/initclk.c
nsprpub/pr/tests/inrval.c
nsprpub/pr/tests/instrumt.c
nsprpub/pr/tests/intrio.c
nsprpub/pr/tests/intrupt.c
nsprpub/pr/tests/ipv6.c
nsprpub/pr/tests/join.c
nsprpub/pr/tests/joinkk.c
nsprpub/pr/tests/joinku.c
nsprpub/pr/tests/joinuk.c
nsprpub/pr/tests/joinuu.c
nsprpub/pr/tests/layer.c
nsprpub/pr/tests/lazyinit.c
nsprpub/pr/tests/libfilename.c
nsprpub/pr/tests/lltest.c
nsprpub/pr/tests/lock.c
nsprpub/pr/tests/logger.c
nsprpub/pr/tests/makedir.c
nsprpub/pr/tests/many_cv.c
nsprpub/pr/tests/mbcs.c
nsprpub/pr/tests/multiwait.c
nsprpub/pr/tests/nameshm1.c
nsprpub/pr/tests/nblayer.c
nsprpub/pr/tests/nonblock.c
nsprpub/pr/tests/nst_wince.h
nsprpub/pr/tests/ntioto.c
nsprpub/pr/tests/ntoh.c
nsprpub/pr/tests/obsints.c
nsprpub/pr/tests/op_excl.c
nsprpub/pr/tests/op_filok.c
nsprpub/pr/tests/openfile.c
nsprpub/pr/tests/parent.c
nsprpub/pr/tests/parsetm.c
nsprpub/pr/tests/pipeping.c
nsprpub/pr/tests/pipeping2.c
nsprpub/pr/tests/pipepong.c
nsprpub/pr/tests/pipepong2.c
nsprpub/pr/tests/pipeself.c
nsprpub/pr/tests/poll_nm.c
nsprpub/pr/tests/poll_to.c
nsprpub/pr/tests/prftest.c
nsprpub/pr/tests/prftest1.c
nsprpub/pr/tests/prftest2.c
nsprpub/pr/tests/primblok.c
nsprpub/pr/tests/priotest.c
nsprpub/pr/tests/provider.c
nsprpub/pr/tests/prpoll.c
nsprpub/pr/tests/prpollml.c
nsprpub/pr/tests/randseed.c
nsprpub/pr/tests/ranfile.c
nsprpub/pr/tests/rmdir.c
nsprpub/pr/tests/runtests.pl
nsprpub/pr/tests/runtests.sh
nsprpub/pr/tests/rwlocktest.c
nsprpub/pr/tests/sel_spd.c
nsprpub/pr/tests/select2.c
nsprpub/pr/tests/selintr.c
nsprpub/pr/tests/semaerr.c
nsprpub/pr/tests/semaerr1.c
nsprpub/pr/tests/semaping.c
nsprpub/pr/tests/semapong.c
nsprpub/pr/tests/sendzlf.c
nsprpub/pr/tests/server_test.c
nsprpub/pr/tests/servr_kk.c
nsprpub/pr/tests/servr_ku.c
nsprpub/pr/tests/servr_uk.c
nsprpub/pr/tests/servr_uu.c
nsprpub/pr/tests/sigpipe.c
nsprpub/pr/tests/sleep.c
nsprpub/pr/tests/socket.c
nsprpub/pr/tests/sockopt.c
nsprpub/pr/tests/sockping.c
nsprpub/pr/tests/sockpong.c
nsprpub/pr/tests/sproc_ch.c
nsprpub/pr/tests/sproc_p.c
nsprpub/pr/tests/stack.c
nsprpub/pr/tests/stat.c
nsprpub/pr/tests/strod.c
nsprpub/pr/tests/suspend.c
nsprpub/pr/tests/switch.c
nsprpub/pr/tests/system.c
nsprpub/pr/tests/testbit.c
nsprpub/pr/tests/testfile.c
nsprpub/pr/tests/thrpool_client.c
nsprpub/pr/tests/thrpool_server.c
nsprpub/pr/tests/thruput.c
nsprpub/pr/tests/time.c
nsprpub/pr/tests/tmocon.c
nsprpub/pr/tests/tpd.c
nsprpub/pr/tests/vercheck.c
nsprpub/pr/tests/version.c
nsprpub/pr/tests/wince_tester.cpp
nsprpub/pr/tests/xnotify.c
nsprpub/pr/tests/y2ktmo.c
nsprpub/pr/tests/yield.c
nsprpub/pr/tests/zerolen.c
--- a/nsprpub/config/Makefile.in
+++ b/nsprpub/config/Makefile.in
@@ -108,17 +108,17 @@ 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)
+ifeq (,$(filter-out SYMBIAN WINCE,$(OS_ARCH)))
 TARGETS = $(PROGS)
 else
 PROGS	+= $(OBJDIR)/nsinstall$(PROG_SUFFIX)
 TARGETS = $(PROGS) $(PLSRCS:.pl=)
 endif
 endif
 
 OUTOPTION = -o # end of the line
--- a/nsprpub/config/autoconf.mk.in
+++ b/nsprpub/config/autoconf.mk.in
@@ -119,12 +119,14 @@ WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCL
 
 MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
 ifdef MACOSX_DEPLOYMENT_TARGET
 export MACOSX_DEPLOYMENT_TARGET
 endif
 
 MACOS_SDK_DIR	= @MACOS_SDK_DIR@
 
+SYMBIAN_SDK_DIR = @SYMBIAN_SDK_DIR@
+
 NEXT_ROOT	= @NEXT_ROOT@
 ifdef NEXT_ROOT
 export NEXT_ROOT
 endif
--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -37,9 +37,8 @@
 
 /*
  * 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
@@ -104,17 +104,17 @@ endif
 # The names of these libraries can be generated by simply specifying
 # LIBRARY_NAME and LIBRARY_VERSION.
 #
 
 ifdef LIBRARY_NAME
 ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
 
 #
-# Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
+# Win95 and OS/2 require library names conforming to the 8.3 rule.
 # other platforms do not.
 #
 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
@@ -313,16 +313,20 @@ endif
 	rm -f $@
 	$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
 	$(RANLIB) $@
 
 ifeq ($(OS_TARGET), OS2)
 $(IMPORT_LIBRARY): $(MAPFILE)
 	rm -f $@
 	$(IMPLIB) $@ $(MAPFILE)
+else
+ifeq (,$(filter-out WIN95 WINCE,$(OS_TARGET)))
+$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
+endif
 endif
 
 $(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE)
 	@$(MAKE_OBJDIR)
 	rm -f $@
 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
 	echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
 	nm -B -C -g $(OBJS) \
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -27,16 +27,19 @@ ac_help="$ac_help
   --enable-optimize(=val) Enable code optimizations (val, ie. -O2) "
 ac_help="$ac_help
   --disable-debug         Do not compile in debugging symbols
   --enable-debug(=val)    Enable debugging (debug flags val)"
 ac_help="$ac_help
   --enable-win32-target=\$t
                           Specify win32 flavor. (WIN95 or WINNT)"
 ac_help="$ac_help
+  --enable-symbian-target=\$t
+                          Specify symbian flavor. (WINSCW or GCCE)"
+ac_help="$ac_help
   --enable-debug-rtl      Use the MSVC debug runtime library"
 ac_help="$ac_help
   --enable-n32            Enable n32 ABI support (IRIX only)"
 ac_help="$ac_help
   --enable-64bit          Enable 64-bit support (on certain platforms)"
 ac_help="$ac_help
   --enable-mdupdate       Enable use of certain compilers' mdupdate feature"
 ac_help="$ac_help
@@ -48,16 +51,19 @@ 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
+  --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"
 ac_help="$ac_help
   --enable-nspr-threads   Build using classic nspr threads"
 ac_help="$ac_help
@@ -620,17 +626,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:629: checking host system type" >&5
+echo "configure:635: 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; }
@@ -641,17 +647,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:650: checking target system type" >&5
+echo "configure:656: 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 ;;
@@ -659,17 +665,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:668: checking build system type" >&5
+echo "configure:674: 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 ;;
@@ -731,17 +737,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:740: checking for $ac_word" >&5
+echo "configure:746: 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"
@@ -883,18 +889,23 @@ if test "${enable_debug+set}" = set; the
         fi
 fi
 
 
 # Check whether --enable-win32-target or --disable-win32-target was given.
 if test "${enable_win32_target+set}" = set; then
   enableval="$enable_win32_target"
   OS_TARGET=`echo $enableval | tr a-z A-Z`
-else
-  OS_TARGET=
+fi
+
+
+# Check whether --enable-symbian-target or --disable-symbian-target was given.
+if test "${enable_symbian_target+set}" = set; then
+  enableval="$enable_symbian_target"
+  OS_TARGET=`echo $enableval | tr a-z A-Z`
 fi
 
 
 # Check whether --enable-debug-rtl or --disable-debug-rtl was given.
 if test "${enable_debug_rtl+set}" = set; then
   enableval="$enable_debug_rtl"
    if test "$enableval" = "yes"; then
 	    USE_DEBUG_RTL=1
@@ -1059,17 +1070,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:1068: checking for $ac_word" >&5
+echo "configure:1079: 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.
   ;;
   ?:/*)			 
@@ -1130,23 +1141,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:1139: checking for $host compiler" >&5
+echo "configure:1150: 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:1145: checking for $ac_word" >&5
+echo "configure:1156: 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"
@@ -1182,26 +1193,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:1191: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+echo "configure:1202: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
     cat > conftest.$ac_ext <<EOF
-#line 1193 "configure"
+#line 1204 "configure"
 #include "confdefs.h"
 
 int main() {
 return(0);
 ; return 0; }
 EOF
-if { (eval echo configure:1200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1211: \"$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
@@ -1220,17 +1231,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:1229: checking for $ac_word" >&5
+echo "configure:1240: 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"
@@ -1254,17 +1265,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:1263: checking for $ac_word" >&5
+echo "configure:1274: 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"
@@ -1284,17 +1295,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:1293: checking for $ac_word" >&5
+echo "configure:1304: 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
@@ -1335,17 +1346,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:1344: checking for $ac_word" >&5
+echo "configure:1355: 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"
@@ -1367,33 +1378,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:1376: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1387: 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 1387 "configure"
+#line 1398 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1403: \"$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
@@ -1409,31 +1420,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:1418: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1429: 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:1423: checking whether we are using GNU C" >&5
+echo "configure:1434: 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:1432: \"$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:1443: \"$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
 
@@ -1442,17 +1453,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:1451: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1462: 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
@@ -1479,17 +1490,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:1488: checking for $ac_word" >&5
+echo "configure:1499: 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"
@@ -1515,17 +1526,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:1524: checking for $ac_word" >&5
+echo "configure:1535: 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"
@@ -1547,33 +1558,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:1556: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1567: 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 1567 "configure"
+#line 1578 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1583: \"$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
@@ -1589,31 +1600,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:1598: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1609: 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:1603: checking whether we are using GNU C++" >&5
+echo "configure:1614: 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:1612: \"$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:1623: \"$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
 
@@ -1622,17 +1633,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:1631: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1642: 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
@@ -1667,17 +1678,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:1676: checking for $ac_word" >&5
+echo "configure:1687: 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"
@@ -1702,17 +1713,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:1711: checking for $ac_word" >&5
+echo "configure:1722: 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"
@@ -1737,17 +1748,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:1746: checking for $ac_word" >&5
+echo "configure:1757: 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"
@@ -1772,17 +1783,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:1781: checking for $ac_word" >&5
+echo "configure:1792: 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"
@@ -1807,17 +1818,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:1816: checking for $ac_word" >&5
+echo "configure:1827: 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"
@@ -1842,17 +1853,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:1851: checking for $ac_word" >&5
+echo "configure:1862: 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"
@@ -1877,17 +1888,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:1886: checking for $ac_word" >&5
+echo "configure:1897: 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"
@@ -1907,17 +1918,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:1916: checking for $ac_word" >&5
+echo "configure:1927: 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
@@ -1958,17 +1969,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:1967: checking for $ac_word" >&5
+echo "configure:1978: 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"
@@ -1990,33 +2001,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:1999: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2010: 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 2010 "configure"
+#line 2021 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2026: \"$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
@@ -2032,31 +2043,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:2041: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2052: 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:2046: checking whether we are using GNU C" >&5
+echo "configure:2057: 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:2055: \"$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:2066: \"$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
 
@@ -2065,17 +2076,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:2074: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2085: 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
@@ -2105,17 +2116,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:2114: checking for $ac_word" >&5
+echo "configure:2125: 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"
@@ -2137,33 +2148,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:2146: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:2157: 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 2157 "configure"
+#line 2168 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:2162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2173: \"$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
@@ -2179,31 +2190,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:2188: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2199: 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:2193: checking whether we are using GNU C++" >&5
+echo "configure:2204: 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:2202: \"$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:2213: \"$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
 
@@ -2212,17 +2223,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:2221: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:2232: 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
@@ -2246,72 +2257,72 @@ else
   else
     CXXFLAGS=
   fi
 fi
 
         fi
     fi
     echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2255: checking how to run the C preprocessor" >&5
+echo "configure:2266: 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 2270 "configure"
+#line 2281 "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:2276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2287: \"$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 2287 "configure"
+#line 2298 "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:2293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2304: \"$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 2304 "configure"
+#line 2315 "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:2310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2321: \"$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*
@@ -2328,17 +2339,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:2337: checking for $ac_word" >&5
+echo "configure:2348: 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"
@@ -2360,17 +2371,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:2369: checking for $ac_word" >&5
+echo "configure:2380: 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.
   ;;
   ?:/*)			 
@@ -2401,17 +2412,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:2410: checking for $ac_word" >&5
+echo "configure:2421: 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.
   ;;
   ?:/*)			 
@@ -2442,17 +2453,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:2451: checking for $ac_word" >&5
+echo "configure:2462: 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.
   ;;
   ?:/*)			 
@@ -2483,17 +2494,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:2492: checking for $ac_word" >&5
+echo "configure:2503: 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.
   ;;
   ?:/*)			 
@@ -2524,17 +2535,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:2533: checking for $ac_word" >&5
+echo "configure:2544: 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.
   ;;
   ?:/*)			 
@@ -2592,39 +2603,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:2601: checking for gcc -pipe support" >&5
+echo "configure:2612: 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 2616 "configure"
+#line 2627 "configure"
 #include "confdefs.h"
  #include <stdio.h> 
 int main() {
 printf("Hello World\n");
 ; return 0; }
 EOF
-if { (eval echo configure:2623: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2634: \"$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
@@ -2641,17 +2652,17 @@ rm -f conftest*
     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
 
 if test "$GNU_CC"; then
     echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6
-echo "configure:2650: checking for visibility(hidden) attribute" >&5
+echo "configure:2661: 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
@@ -2665,17 +2676,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:2674: checking for visibility pragma support" >&5
+echo "configure:2685: 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;
@@ -2718,17 +2729,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:2727: checking for $ac_word" >&5
+echo "configure:2738: 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.
   ;;
   ?:/*)			 
@@ -2821,19 +2832,16 @@ fi
 # Note: OS_TARGET should be specified on the command line for gmake.
 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
 # The difference between the Win95 target and the WinNT target is that
 # the WinNT target uses Windows NT specific features not available
 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
 # at lesser performance (the Win95 target uses threads; the WinNT target
 # uses fibers).
 #
-# When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
-# is built. See: win16_3.11.mk for lots more about the Win16 target.
-#
 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
 # cross-compilation.
 #
 
 #
 # The following hack allows one to build on a WIN95 machine (as if
 # s/he were cross-compiling on a WINNT host for a WIN95 target).
 # It also accomodates for MKS's uname.exe.  If you never intend
@@ -2922,19 +2930,16 @@ if test -n "$MOZILLA_CLIENT" && test "$O
     fi
 fi
 if test -z "$OS_TARGET"; then
     OS_TARGET=$OS_ARCH
 fi
 if test "$OS_TARGET" = "WIN95"; then
     OS_RELEASE="4.0"
 fi
-if test "$OS_TARGET" = "WIN16"; then
-    OS_RELEASE=
-fi
 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
 
 # Check whether --enable-os2-high-mem or --disable-os2-high-mem was given.
 if test "${enable_os2_high_mem+set}" = set; then
   enableval="$enable_os2_high_mem"
    if test "$enableval" = "no"; then
         MOZ_OS2_HIGH_MEMORY=
       else
@@ -2976,27 +2981,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:2985: checking for sys/atomic_op.h" >&5
+echo "configure:2990: 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 2990 "configure"
+#line 2995 "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:2995: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3000: \"$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
@@ -3143,36 +3148,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:3152: checking for gethostbyaddr in -lbind" >&5
+echo "configure:3157: 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 3160 "configure"
+#line 3165 "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:3171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3176: \"$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
@@ -4123,19 +4128,16 @@ EOF
 
     case "$OS_TARGET" in
     WINNT)
 	    MDCPUCFG_H=_winnt.cfg
 	    ;;
     WIN95)
 	    MDCPUCFG_H=_win95.cfg
 	    ;;
-    WIN16)
-	    MDCPUCFG_H=_win16.cfg
-	    ;;
     *)
 	    { echo "configure: error: Missing OS_TARGET for ${target}.  Use --enable-win32-target to set." 1>&2; exit 1; }
    	;;
     esac
 
     case "$target_cpu" in
     i*86)
 	if test -n "$USE_64"; then
@@ -4538,27 +4540,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:4547: checking for machine/builtins.h" >&5
+echo "configure:4549: 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 4552 "configure"
+#line 4554 "configure"
 #include "confdefs.h"
 #include <machine/builtins.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4559: \"$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
@@ -5001,16 +5003,136 @@ EOF
 
         MDCPUCFG_H=_unixware7.cfg
     fi
     PR_MD_CSRCS=unixware.c
     DSO_LDOPTS=-G
     CPU_ARCH=x86
     ;;
 
+*-symbian*)
+    # Check whether --with-symbian-sdk or --without-symbian-sdk was given.
+if test "${with_symbian_sdk+set}" = set; then
+  withval="$with_symbian_sdk"
+  SYMBIAN_SDK_DIR=$withval
+fi
+
+
+    echo -----------------------------------------------------------------------------
+    echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
+    echo -----------------------------------------------------------------------------
+
+    cat >> confdefs.h <<\EOF
+#define XP_UNIX 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define SYMBIAN 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define __arm__ 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define __SYMBIAN32__ 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define _UNICODE 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define NDEBUG 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define __SUPPORT_CPP_EXCEPTIONS__ 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define MOZ_STDERR_TO_STDOUT 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define HAVE_FCNTL_FILE_LOCKING 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
+    USE_PTHREADS=1
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    MKSHLIB=
+    DSO_LDOPTS=
+    DSO_CFLAGS=
+    VISIBILITY_FLAGS=
+    MDCPUCFG_H=_symbian.cfg
+    PR_MD_CSRCS=symbian.c
+    NSINSTALL=nsinstall
+    RANLIB='echo no ranlib '
+    CPU_ARCH=ARM
+    OS_ARCH=SYMBIAN
+    OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
+    CFLAGS="$CFLAGS -MD -nostdinc"
+    SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
+    echo -------------------------------------------------------
+    echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
+    echo -------------------------------------------------------
+    case "$OS_TARGET" in
+    WINSCW)
+        CC=mwccsym2.exe
+        CXX=mwccsym2.exe
+        LD=mwldsym2.exe
+        AR=mwldsym2.exe
+        WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
+        CFLAGS="$CFLAGS -O0 -inline off -wchar_t off -align 4 -warnings on -w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostderr -gccdep -cwd source -i- -I\$(VPATH)"
+        SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
+        AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
+        cat >> confdefs.h <<\EOF
+#define _DEBUG 1
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define __CW32__ 1
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define __WINS__ 1
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define __WINSCW__ 1
+EOF
+
+        DEFINES="$DEFINES -U_WIN32"
+	    ;;
+    GCCE)
+        CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
+        CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
+        SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
+        cat >> confdefs.h <<\EOF
+#define __GCCE__ 1
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define __EABI__ 1
+EOF
+
+        DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
+	    ;;
+    *)
+	    { echo "configure: error: Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'." 1>&2; exit 1; }
+   	;;
+    esac
+    CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
+    ;;
+
 *-os2*)
     cat >> confdefs.h <<\EOF
 #define XP_OS2 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define XP_PC 1
 EOF
@@ -5077,63 +5199,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:5086: checking for dlopen in -ldl" >&5
+echo "configure:5208: 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 5094 "configure"
+#line 5216 "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:5105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5227: \"$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:5122: checking for dlfcn.h" >&5
+echo "configure:5244: 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 5127 "configure"
+#line 5249 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5254: \"$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
@@ -5156,23 +5278,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:5165: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5287: 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 5171 "configure"
+#line 5293 "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
@@ -5180,17 +5302,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 5189 "configure"
+#line 5311 "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
@@ -5204,22 +5326,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:5213: checking for $ac_func" >&5
+echo "configure:5335: 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 5218 "configure"
+#line 5340 "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();
@@ -5232,17 +5354,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:5241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5363: \"$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
@@ -5273,17 +5395,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:5282: checking for +Olit support" >&5
+echo "configure:5404: 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
@@ -5312,17 +5434,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:5321: checking for pthread_create in -lpthreads" >&5
+echo "configure:5443: 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);
         }
@@ -5334,17 +5456,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:5343: checking for pthread_create in -lpthread" >&5
+echo "configure:5465: 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);
         }
@@ -5356,17 +5478,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:5365: checking for pthread_create in -lc_r" >&5
+echo "configure:5487: 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);
         }
@@ -5378,17 +5500,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:5387: checking for pthread_create in -lc" >&5
+echo "configure:5509: 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);
         }
@@ -5510,17 +5632,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:5519: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5641: 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
@@ -5533,17 +5655,17 @@ echo "configure:5519: 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:5542: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5664: 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
@@ -5942,16 +6064,17 @@ esac
 
 
 
 
 
 
 
 
+
 MAKEFILES="
 Makefile 
 config/Makefile
 config/autoconf.mk
 config/nsprincl.mk
 config/nsprincl.sh
 config/nspr-config
 lib/Makefile 
@@ -6066,17 +6189,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' ' '` # Manually modified for MKS support.
 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
@@ -6236,16 +6359,17 @@ s%@RC@%$RC%g
 s%@RCFLAGS@%$RCFLAGS%g
 s%@DLLFLAGS@%$DLLFLAGS%g
 s%@EXEFLAGS@%$EXEFLAGS%g
 s%@OS_DLLFLAGS@%$OS_DLLFLAGS%g
 s%@CYGWIN_WRAPPER@%$CYGWIN_WRAPPER%g
 s%@VISIBILITY_FLAGS@%$VISIBILITY_FLAGS%g
 s%@WRAP_SYSTEM_INCLUDES@%$WRAP_SYSTEM_INCLUDES%g
 s%@MACOS_SDK_DIR@%$MACOS_SDK_DIR%g
+s%@SYMBIAN_SDK_DIR@%$SYMBIAN_SDK_DIR%g
 s%@NEXT_ROOT@%$NEXT_ROOT%g
 s%@MT@%$MT%g
 
 CEOF
 EOF
 
 cat >> $CONFIG_STATUS <<\EOF
 
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -203,18 +203,22 @@ AC_ARG_ENABLE(debug,
                 _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
                 _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS
             fi
         fi])
 
 AC_ARG_ENABLE(win32-target,
     [  --enable-win32-target=\$t
                           Specify win32 flavor. (WIN95 or WINNT)],
-    OS_TARGET=`echo $enableval | tr a-z A-Z`,
-    OS_TARGET=)
+    OS_TARGET=`echo $enableval | tr a-z A-Z`)
+
+AC_ARG_ENABLE(symbian-target,
+    [  --enable-symbian-target=\$t
+                          Specify symbian flavor. (WINSCW or GCCE)],
+    OS_TARGET=`echo $enableval | tr a-z A-Z`)
 
 AC_ARG_ENABLE(debug-rtl,
     [  --enable-debug-rtl      Use the MSVC debug runtime library],
     [ if test "$enableval" = "yes"; then
 	    USE_DEBUG_RTL=1
       fi ])
 
 AC_ARG_ENABLE(n32,
@@ -689,19 +693,16 @@ fi
 # Note: OS_TARGET should be specified on the command line for gmake.
 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
 # The difference between the Win95 target and the WinNT target is that
 # the WinNT target uses Windows NT specific features not available
 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
 # at lesser performance (the Win95 target uses threads; the WinNT target
 # uses fibers).
 #
-# When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
-# is built. See: win16_3.11.mk for lots more about the Win16 target.
-#
 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
 # cross-compilation.
 #
 
 #
 # The following hack allows one to build on a WIN95 machine (as if
 # s/he were cross-compiling on a WINNT host for a WIN95 target).
 # It also accomodates for MKS's uname.exe.  If you never intend
@@ -790,19 +791,16 @@ if test -n "$MOZILLA_CLIENT" && test "$O
     fi
 fi
 if test -z "$OS_TARGET"; then
     OS_TARGET=$OS_ARCH
 fi
 if test "$OS_TARGET" = "WIN95"; then
     OS_RELEASE="4.0"
 fi
-if test "$OS_TARGET" = "WIN16"; then
-    OS_RELEASE=
-fi
 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
 
 dnl ========================================================
 dnl Enable high-memory support on OS/2 by default.
 dnl ========================================================
 AC_ARG_ENABLE(os2-high-mem,
     [  --disable-os2-high-mem  Disable high-memory support on OS/2],
     [ if test "$enableval" = "no"; then
@@ -1627,19 +1625,16 @@ tools are selected during the Xcode/Deve
 
     case "$OS_TARGET" in
     WINNT)
 	    MDCPUCFG_H=_winnt.cfg
 	    ;;
     WIN95)
 	    MDCPUCFG_H=_win95.cfg
 	    ;;
-    WIN16)
-	    MDCPUCFG_H=_win16.cfg
-	    ;;
     *)
 	    AC_MSG_ERROR([Missing OS_TARGET for ${target}.  Use --enable-win32-target to set.])
    	;;
     esac
 
     case "$target_cpu" in
     i*86)
 	if test -n "$USE_64"; then
@@ -2161,16 +2156,86 @@ mips-sony-newsos*)
         AC_DEFINE(_PR_HAVE_SOCKADDR_LEN)
         MDCPUCFG_H=_unixware7.cfg
     fi
     PR_MD_CSRCS=unixware.c
     DSO_LDOPTS=-G
     CPU_ARCH=x86
     ;;
 
+*-symbian*)
+    AC_ARG_WITH(symbian-sdk,
+    [  --with-symbian-sdk=SYMBIAN_SDK_DIR
+                          The path to the Symbian SDK],
+    SYMBIAN_SDK_DIR=$withval)
+
+    echo -----------------------------------------------------------------------------
+    echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
+    echo -----------------------------------------------------------------------------
+
+    AC_DEFINE(XP_UNIX)
+    AC_DEFINE(SYMBIAN)
+    AC_DEFINE(__arm__)
+    AC_DEFINE(__SYMBIAN32__)
+    AC_DEFINE(_UNICODE)
+    AC_DEFINE(NDEBUG)
+    AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
+    AC_DEFINE(MOZ_STDERR_TO_STDOUT)
+    AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
+    AC_DEFINE(HAVE_SOCKLEN_T)
+    USE_PTHREADS=1
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    MKSHLIB=
+    DSO_LDOPTS=
+    DSO_CFLAGS=
+    VISIBILITY_FLAGS=
+    MDCPUCFG_H=_symbian.cfg
+    PR_MD_CSRCS=symbian.c
+    NSINSTALL=nsinstall
+    RANLIB='echo no ranlib '
+    CPU_ARCH=ARM
+    OS_ARCH=SYMBIAN
+    OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
+    CFLAGS="$CFLAGS -MD -nostdinc"
+    SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
+    echo -------------------------------------------------------
+    echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
+    echo -------------------------------------------------------
+    case "$OS_TARGET" in
+    WINSCW)
+        CC=mwccsym2.exe
+        CXX=mwccsym2.exe
+        LD=mwldsym2.exe
+        AR=mwldsym2.exe
+        WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
+        CFLAGS="$CFLAGS -O0 -inline off -wchar_t off -align 4 -warnings on -w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostderr -gccdep -cwd source -i- -I\$(VPATH)"
+        SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
+        AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
+        AC_DEFINE(_DEBUG)
+        AC_DEFINE(__CW32__)
+        AC_DEFINE(__WINS__)
+        AC_DEFINE(__WINSCW__)
+        DEFINES="$DEFINES -U_WIN32"
+	    ;;
+    GCCE)
+        CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
+        CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
+        SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
+        AC_DEFINE(__GCCE__)
+        AC_DEFINE(__EABI__)
+        DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
+	    ;;
+    *)
+	    AC_MSG_ERROR([Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'.])
+   	;;
+    esac
+    CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
+    ;;
+
 *-os2*)
     AC_DEFINE(XP_OS2)
     AC_DEFINE(XP_PC)
     AC_DEFINE(BSD_SELECT)
     AC_DEFINE(TCPV40HDRS)
     LIB_SUFFIX=lib
     DLL_SUFFIX=dll
     RC=rc.exe
@@ -2818,16 +2883,17 @@ AC_SUBST(RC)
 AC_SUBST(RCFLAGS)
 AC_SUBST(DLLFLAGS)
 AC_SUBST(EXEFLAGS)
 AC_SUBST(OS_DLLFLAGS)
 AC_SUBST(CYGWIN_WRAPPER)
 AC_SUBST(VISIBILITY_FLAGS)
 AC_SUBST(WRAP_SYSTEM_INCLUDES)
 AC_SUBST(MACOS_SDK_DIR)
+AC_SUBST(SYMBIAN_SDK_DIR)
 AC_SUBST(NEXT_ROOT)
 AC_SUBST(MT)
 
 dnl ========================================================
 dnl Generate output files.
 dnl ========================================================
 MAKEFILES="
 Makefile 
--- a/nsprpub/lib/ds/plhash.c
+++ b/nsprpub/lib/ds/plhash.c
@@ -127,22 +127,16 @@ PL_NewHashTable(PRUint32 n, PLHashFuncti
     if (!allocOps) allocOps = &defaultHashAllocOps;
 
     ht = (PLHashTable*)((*allocOps->allocTable)(allocPriv, sizeof *ht));
     if (!ht)
 	return 0;
     memset(ht, 0, sizeof *ht);
     ht->shift = PL_HASH_BITS - n;
     n = 1 << n;
-#if defined(WIN16)
-    if (n > 16000) {
-        (*allocOps->freeTable)(allocPriv, ht);
-        return 0;
-    }
-#endif  /* WIN16 */
     nb = n * sizeof(PLHashEntry *);
     ht->buckets = (PLHashEntry**)((*allocOps->allocTable)(allocPriv, nb));
     if (!ht->buckets) {
         (*allocOps->freeTable)(allocPriv, ht);
         return 0;
     }
     memset(ht->buckets, 0, nb);
 
@@ -249,20 +243,16 @@ PL_HashTableRawAdd(PLHashTable *ht, PLHa
     PRUint32 i, n;
     PLHashEntry *he, *next, **oldbuckets;
     PRSize nb;
 
     /* Grow the table if it is overloaded */
     n = NBUCKETS(ht);
     if (ht->nentries >= OVERLOADED(n)) {
         oldbuckets = ht->buckets;
-#if defined(WIN16)
-        if (2 * n > 16000)
-            return 0;
-#endif  /* WIN16 */
         nb = 2 * n * sizeof(PLHashEntry *);
         ht->buckets = (PLHashEntry**)
             ((*ht->allocOps->allocTable)(ht->allocPriv, nb));
         if (!ht->buckets) {
             ht->buckets = oldbuckets;
             return 0;
         }
         memset(ht->buckets, 0, nb);
--- a/nsprpub/lib/libc/src/plerror.c
+++ b/nsprpub/lib/libc/src/plerror.c
@@ -64,25 +64,9 @@ const char *name = PR_ErrorToName(error)
 
 PR_IMPLEMENT(void) PL_PrintError(const char *msg)
 {
 	static PRFileDesc *fd = NULL;
 	if (NULL == fd) fd = PR_GetSpecialFD(PR_StandardError);
 	PL_FPrintError(fd, msg);
 }  /* PL_PrintError */
 
-#if defined(WIN16)
-/*
-** libmain() is a required function for win16
-**
-*/
-int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg, 
-  WORD cbHeapSize, LPSTR lpszCmdLine )
-{
-return TRUE;
-}
-#endif /* WIN16 */
-
-
-
-
-
 /* plerror.c */
--- a/nsprpub/lib/msgc/src/prgcapi.c
+++ b/nsprpub/lib/msgc/src/prgcapi.c
@@ -264,38 +264,25 @@ PR_IMPLEMENT(void) PR_GetEndFinalizeHook
     *hook = _pr_endFinalizeHook;
     *arg = _pr_endFinalizeHookArg;
     UNLOCK_GC();
 }
 
 #ifdef DEBUG
 #include "prprf.h"
 
-#if defined(WIN16)
-static FILE *tracefile = 0;
-#endif
-
 PR_IMPLEMENT(void) GCTrace(char *fmt, ...)
 {	
     va_list ap;
     char buf[400];
 
     va_start(ap, fmt);
     PR_vsnprintf(buf, sizeof(buf), fmt, ap);
     va_end(ap);
-#if defined(WIN16)
-    if ( tracefile == 0 )
-    {
-        tracefile = fopen( "xxxGCtr", "w" );
-    }
-    fprintf(tracefile, "%s\n", buf );
-    fflush(tracefile);
-#else
     PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS, ("%s", buf));
-#endif
 }
 #endif
 
 void _PR_InitGC(PRWord flags)
 {
     static char firstTime = 1;
 
     if (!firstTime) return;
--- a/nsprpub/lib/msgc/src/prmsgc.c
+++ b/nsprpub/lib/msgc/src/prmsgc.c
@@ -292,105 +292,40 @@ static PRWord bigAllocBytes = 0;
 /************************************************************************/
 
 /*
 ** Mark the start of an object in a segment. Note that we mark the header
 ** word (which we always have), not the data word (which we may not have
 ** for empty objects).
 ** XXX tune: put subtract of _sp->base into _sp->hbits pointer?
 */
-#if !defined(WIN16)
 #define SET_HBIT(_sp,_ph) \
     SET_BIT((_sp)->hbits, (((PRWord*)(_ph)) - ((PRWord*) (_sp)->base)))
 
 #define CLEAR_HBIT(_sp,_ph) \
     CLEAR_BIT((_sp)->hbits, (((PRWord*)(_ph)) - ((PRWord*) (_sp)->base)))
 
 #define IS_HBIT(_sp,_ph) \
     TEST_BIT((_sp)->hbits, (((PRWord*)(_ph)) - ((PRWord*) (_sp)->base)))
-#else
-
-#define SET_HBIT(_sp,_ph) set_hbit(_sp,_ph)
-
-#define CLEAR_HBIT(_sp,_ph) clear_hbit(_sp,_ph)
-
-#define IS_HBIT(_sp,_ph) is_hbit(_sp,_ph)
-
-static void
-set_hbit(GCSeg *sp, PRWord *p)
-{
-    unsigned int distance;
-    unsigned int index;
-    PRWord     mask;
-
-        PR_ASSERT( SELECTOROF(p) == SELECTOROF(sp->base) );
-        PR_ASSERT( OFFSETOF(p)   >= OFFSETOF(sp->base) );
-
-        distance = (OFFSETOF(p) - OFFSETOF(sp->base)) >> 2;
-    index    = distance >> PR_BITS_PER_WORD_LOG2;
-    mask     = 1L << (distance&(PR_BITS_PER_WORD-1));
-
-    sp->hbits[index] |= mask;
-}
-
-static void
-clear_hbit(GCSeg *sp, PRWord *p)
-{
-    unsigned int distance;
-    unsigned int index;
-    PRWord    mask;
-
-        PR_ASSERT( SELECTOROF(p) == SELECTOROF(sp->base) );
-        PR_ASSERT( OFFSETOF(p)   >= OFFSETOF(sp->base) );
-
-        distance = (OFFSETOF(p) - OFFSETOF(sp->base)) >> 2;
-    index    = distance >> PR_BITS_PER_WORD_LOG2;
-    mask     = 1L << (distance&(PR_BITS_PER_WORD-1));
-
-    sp->hbits[index] &= ~mask;
-}
-
-static int
-is_hbit(GCSeg *sp, PRWord *p)
-{
-    unsigned int distance;
-    unsigned int index;
-    PRWord    mask;
-
-        PR_ASSERT( SELECTOROF(p) == SELECTOROF(sp->base) );
-        PR_ASSERT( OFFSETOF(p)   >= OFFSETOF(sp->base) );
-
-        distance = (OFFSETOF(p) - OFFSETOF(sp->base)) >> 2;
-    index    = distance >> PR_BITS_PER_WORD_LOG2;
-    mask     = 1L << (distance&(PR_BITS_PER_WORD-1));
-
-    return ((sp->hbits[index] & mask) != 0);
-}
-
-
-#endif  /* WIN16 */
 
 /*
 ** Given a pointer into this segment, back it up until we are at the
 ** start of the object the pointer points into. Each heap segment has a
 ** bitmap that has one bit for each word of the objects it contains.  The
 ** bit's are set for the firstword of an object, and clear for it's other
 ** words.
 */
 static PRWord *FindObject(GCSeg *sp, PRWord *p)
 {
     PRWord *base;
     
     /* Align p to it's proper boundary before we start fiddling with it */
     p = (PRWord*) ((PRWord)p & ~(PR_BYTES_PER_WORD-1L));
 
     base = (PRWord *) sp->base;
-#if defined(WIN16)
-    PR_ASSERT( SELECTOROF(p) == SELECTOROF(base));
-#endif
     do {
     if (IS_HBIT(sp, p)) {
         return (p);
     }
     p--;
     } while ( p >= base );
 
     /* Heap is corrupted! */
@@ -399,25 +334,19 @@ static PRWord *FindObject(GCSeg *sp, PRW
     return NULL;
 }
 
 /************************************************************************/
 #if !defined(XP_PC) || defined(XP_OS2)
 #define OutputDebugString(msg)
 #endif 
 
-#if !defined(WIN16)
 #define IN_SEGMENT(_sp, _p)             \
     ((((char *)(_p)) >= (_sp)->base) &&    \
      (((char *)(_p)) < (_sp)->limit))
-#else
-#define IN_SEGMENT(_sp, _p)                  \
-    ((((PRWord)(_p)) >= ((PRWord)(_sp)->base)) && \
-     (((PRWord)(_p)) < ((PRWord)(_sp)->limit)))
-#endif
 
 static GCSeg *InHeap(void *p)
 {
     GCSeg *sp, *esp;
 
     if (lastInHeap && IN_SEGMENT(lastInHeap, p)) {
     return lastInHeap;
     }
@@ -460,23 +389,16 @@ static GCSeg* DoGrowHeap(PRInt32 request
         (long) sizeof(GCSegInfo), segInfo);
     OutputDebugString(str);
     }
 #endif
     if (!segInfo) {
     return 0;
     }
 
-#if defined(WIN16)
-    if (requestedSize > segmentSize) {
-    PR_DELETE(segInfo);
-    return 0;
-    }
-#endif
-
     /* Get more memory from the OS */
     if (exactly) {
     allocSize = requestedSize;
     base = (char *) PR_MALLOC(requestedSize);
     } else {
     allocSize = requestedSize;
     allocSize = (allocSize + _pr_pageSize - 1L) >> _pr_pageShift;
     allocSize <<= _pr_pageShift;
@@ -488,19 +410,16 @@ static GCSeg* DoGrowHeap(PRInt32 request
     }
 
     nhbits = (PRInt32)(
         (allocSize + PR_BYTES_PER_WORD - 1L) >> PR_BYTES_PER_WORD_LOG2);
     nhbytes = ((nhbits + PR_BITS_PER_WORD - 1L) >> PR_BITS_PER_WORD_LOG2)
     * sizeof(PRWord);
 
     /* Get bitmap memory from malloc heap */
-#if defined(WIN16)
-    PR_ASSERT( nhbytes < MAX_ALLOC_SIZE );
-#endif
     hbits = (PRWord *) PR_CALLOC((PRUint32)nhbytes);
     if (!hbits) {
     /* Loser! */
     PR_DELETE(segInfo);
     if (exactly) {
         PR_DELETE(base);
     } else {
       /* XXX do something about this */
@@ -796,26 +715,18 @@ static void PR_CALLBACK ProcessRootBlock
 #ifdef DEBUG
     void **base0 = base;
 #endif
 
     low = _pr_gcData.lowSeg;
     high = _pr_gcData.highSeg;
     while (--count >= 0) {
         p0 = (PRWord*) *base++;
-        /*
-        ** XXX:  
-        ** Until Win16 maintains lowSeg and highSeg correctly,
-        ** (ie. lowSeg=MIN(all segs) and highSeg = MAX(all segs))
-        ** Allways scan through the segment list
-        */
-#if !defined(WIN16)
         if (p0 < low) continue;                  /* below gc heap */
         if (p0 >= high) continue;                /* above gc heap */
-#endif
         /* NOTE: inline expansion of InHeap */
         /* Find segment */
     sp = lastInHeap;
         if (!sp || !IN_SEGMENT(sp,p0)) {
             GCSeg *esp;
             sp = segs;
         esp = segs + nsegs;
             for (; sp < esp; sp++) {
@@ -892,26 +803,18 @@ static void PR_CALLBACK ProcessRootBlock
 static void PR_CALLBACK ProcessRootPointer(void *ptr)
 {
   PRWord *p0, *p, h, tix, *segBase;
   GCSeg* sp;
   CollectorType *ct;
 
   p0 = (PRWord*) ptr;
 
-  /*
-  ** XXX:  
-  ** Until Win16 maintains lowSeg and highSeg correctly,
-  ** (ie. lowSeg=MIN(all segs) and highSeg = MAX(all segs))
-  ** Allways scan through the segment list
-  */
-#if !defined(WIN16)
   if (p0 < _pr_gcData.lowSeg) return;                  /* below gc heap */
   if (p0 >= _pr_gcData.highSeg) return;                /* above gc heap */
-#endif
 
   /* NOTE: inline expansion of InHeap */
   /* Find segment */
   sp = lastInHeap;
   if (!sp || !IN_SEGMENT(sp,p0)) {
     GCSeg *esp;
     sp = segs;
     esp = segs + nsegs;
@@ -1853,26 +1756,18 @@ PR_IMPLEMENT(void) PR_GC(void)
 static PRInt32 PR_CALLBACK
 pr_ConservativeWalkPointer(void* ptr, PRWalkFun walkRootPointer, void* data)
 {
   PRWord *p0, *p, *segBase;
   GCSeg* sp;
 
   p0 = (PRWord*) ptr;
 
-  /*
-  ** XXX:  
-  ** Until Win16 maintains lowSeg and highSeg correctly,
-  ** (ie. lowSeg=MIN(all segs) and highSeg = MAX(all segs))
-  ** Allways scan through the segment list
-  */
-#if !defined(WIN16)
   if (p0 < _pr_gcData.lowSeg) return 0;                  /* below gc heap */
   if (p0 >= _pr_gcData.highSeg) return 0;                /* above gc heap */
-#endif
 
   /* NOTE: inline expansion of InHeap */
   /* Find segment */
   sp = lastInHeap;
   if (!sp || !IN_SEGMENT(sp,p0)) {
     GCSeg *esp;
     sp = segs;
     esp = segs + nsegs;
@@ -2632,21 +2527,16 @@ static PRWord *BigAlloc(int cbix, PRInt3
             p++;
             chunkSize -= PR_BYTES_PER_WORD;
             _pr_gcData.freeMemory -= PR_BYTES_PER_WORD;
             _pr_gcData.busyMemory += PR_BYTES_PER_WORD;
             PR_ASSERT(((PRWord)p & (PR_BYTES_PER_DWORD-1)) != 0);
         }
 #endif
 
-#if defined(WIN16)
-            /* All memory MUST be aligned on 32bit boundaries */
-            PR_ASSERT( (((PRWord)p) & (PR_BYTES_PER_WORD-1)) == 0 );
-#endif
-
         /* Consume the *entire* segment with a single allocation */
         h = MAKE_HEADER(cbix, (chunkSize >> PR_BYTES_PER_WORD_LOG2));
         p[0] = h;
         SET_HBIT(sp, p);
         _pr_gcData.freeMemory -= chunkSize;
         _pr_gcData.busyMemory += chunkSize;
     return p;
     }
@@ -2797,43 +2687,23 @@ PR_IMPLEMENT(PRWord GCPTR *)PR_AllocMemo
     bytes = (PRInt32) requestedBytes;
 
     /*
     ** Align bytes to a multiple of a PRWord, then add in enough space
     ** to hold the header word.
     **
     ** MSVC 1.52 crashed on the ff. code because of the "complex" shifting :-(
     */
-#if !defined(WIN16) 
     /* Check for possible overflow of bytes before performing add */
     if ((MAX_INT - PR_BYTES_PER_WORD) < bytes ) return NULL;
     bytes = (bytes + PR_BYTES_PER_WORD - 1) >> PR_BYTES_PER_WORD_LOG2;
     bytes <<= PR_BYTES_PER_WORD_LOG2;
     /* Check for possible overflow of bytes before performing add */
     if ((MAX_INT - sizeof(PRWord)) < bytes ) return NULL;
     bytes += sizeof(PRWord);
-#else 
-    /* 
-    ** For WIN16 the shifts have been broken out into separate statements
-    ** to prevent the compiler from crashing...
-    */
-    {
-        PRWord shiftVal;
-
-        /* Check for possible overflow of bytes before performing add */
-        if ((MAX_INT - PR_BYTES_PER_WORD) < bytes ) return NULL;
-        bytes += PR_BYTES_PER_WORD - 1L;
-        shiftVal = PR_BYTES_PER_WORD_LOG2;
-        bytes >>= shiftVal;
-        bytes <<= shiftVal;
-        /* Check for possible overflow of bytes before performing add */
-        if ((MAX_INT - sizeof(PRWord)) < bytes ) return NULL;
-        bytes += sizeof(PRWord);
-    }
-#endif
     /*
      * Add in an extra word of memory for double-aligned memory. Some
      * percentage of the time this will waste a word of memory (too
      * bad). Howver, it makes the allocation logic much simpler and
      * faster.
      */
 #ifndef IS_64
     if (dub) {
@@ -3065,35 +2935,19 @@ PR_AllocSimpleMemory(PRWord requestedByt
     bytes = (PRInt32) requestedBytes;
 
     /*
     ** Align bytes to a multiple of a PRWord, then add in enough space
     ** to hold the header word.
     **
     ** MSVC 1.52 crashed on the ff. code because of the "complex" shifting :-(
     */
-#if !defined(WIN16) 
     bytes = (bytes + PR_BYTES_PER_WORD - 1) >> PR_BYTES_PER_WORD_LOG2;
     bytes <<= PR_BYTES_PER_WORD_LOG2;
     bytes += sizeof(PRWord);
-#else 
-    /* 
-    ** For WIN16 the shifts have been broken out into separate statements
-    ** to prevent the compiler from crashing...
-    */
-    {
-    PRWord shiftVal;
-
-    bytes += PR_BYTES_PER_WORD - 1L;
-    shiftVal = PR_BYTES_PER_WORD_LOG2;
-    bytes >>= shiftVal;
-    bytes <<= shiftVal;
-    bytes += sizeof(PRWord);
-    }
-#endif
     
     /*
      * Add in an extra word of memory for double-aligned memory. Some
      * percentage of the time this will waste a word of memory (too
      * bad). Howver, it makes the allocation logic much simpler and
      * faster.
      */
 #ifndef IS_64
@@ -3107,19 +2961,16 @@ PR_AllocSimpleMemory(PRWord requestedByt
     bytes += PR_BYTES_PER_WORD * 2;
     }
 #endif
 
 #if defined(GC_CHECK) || defined(GC_STATS) || defined(GC_TRACEROOTS)
     bytes += sizeof(GCBlockEnd);
 #endif
 
-#if defined(WIN16)
-    PR_ASSERT( bytes < MAX_ALLOC_SIZE );
-#endif
     /* Java can ask for objects bigger than 4M, but it won't get them */
     /*
      * This check was added because there is a fundamental limit of
      * the size field maintained by the gc code.  Going over the 4M
      * limit caused some bits to roll over into another bit field,
      * violating the max segment size and causing a bug.
      */
     if (bytes >= MAX_ALLOC_SIZE) {
@@ -3283,20 +3134,16 @@ PR_IMPLEMENT(void) PR_InitGC(
 
     if (!firstTime) return;
     firstTime = 0;
 
     _pr_msgc_lm = PR_NewLogModule("msgc");
     _pr_pageShift = PR_GetPageShift();
     _pr_pageSize = PR_GetPageSize();
 
-#if defined(WIN16)
-    PR_ASSERT( initialHeapSize < MAX_ALLOC_SIZE );
-#endif
-
   /* Setup initial heap size and initial segment size */
   if (0 != segSize) segmentSize = segSize;
 #ifdef DEBUG
     GC = PR_NewLogModule("GC");
     {
     char *ev = PR_GetEnv("GC_SEGMENT_SIZE");
     if (ev && ev[0]) {
       PRInt32 newSegmentSize = atoi(ev);
@@ -3338,29 +3185,16 @@ PR_IMPLEMENT(void) PR_InitGC(
 
   /* Allocate the initial segment for the heap */
   minBin = 31;
   maxBin = 0;
   GrowHeap(initialHeapSize);
     PR_RegisterRootFinder(ScanWeakFreeList, "scan weak free list", 0);
 }
 
-#if defined(WIN16)
-/*
-** For WIN16 the GC_IN_HEAP() macro must call the private InHeap function.
-** This public wrapper function makes this possible...
-*/
-PR_IMPLEMENT(PRBool)
-PR_GC_In_Heap(void *object)
-{
-    return InHeap( object ) != NULL;    
-}
-#endif
-
-
 /** Added by Vishy for sanity checking a few GC structures **/
 /** Can use SanityCheckGC to debug corrupted GC Heap situations **/
 
 #ifdef DEBUG
 
 static int SegmentOverlaps(int i, int j)
 {
   return
deleted file mode 100644
--- a/nsprpub/lib/msgc/src/win16gc.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#if defined(WIN16)
-#include <windows.h>
-#endif
-#include "prtypes.h"
-#include <stdlib.h>
-
-#define MAX_SEGMENT_SIZE (65536l - 4096l)
-
-/************************************************************************/
-/*
-** Machine dependent GC Heap management routines:
-**    _MD_GrowGCHeap
-*/
-/************************************************************************/
-
-void _MD_InitGC(void) {}
-
-extern void *
-_MD_GrowGCHeap(PRUint32 *sizep)
-{
-    void *addr;
-
-    if( *sizep > MAX_SEGMENT_SIZE ) {
-        *sizep = MAX_SEGMENT_SIZE;
-    }
-
-    addr = malloc((size_t)*sizep);
-    return addr;
-}
-
-HINSTANCE _pr_hInstance;
-
-int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg, 
-                      WORD cbHeapSize, LPSTR lpszCmdLine )
-{
-    _pr_hInstance = hInst;
-    return TRUE;
-}
-
-
--- a/nsprpub/lib/msgc/tests/Makefile.in
+++ b/nsprpub/lib/msgc/tests/Makefile.in
@@ -41,21 +41,16 @@ MOD_DEPTH	= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
-ifeq ($(OS_TARGET), WIN16)
-OS_CFLAGS = $(OS_EXE_CFLAGS)
-W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX)
-endif
-
 ifeq ($(OS_TARGET), OS2)
 OS_CFLAGS = $(OS_EXE_CFLAGS)
 endif
 
 CSRCS = gc1.c thrashgc.c
 
 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
@@ -74,27 +69,21 @@ INCLUDES = -I$(dist_includedir)
 LDOPTS = -L$(dist_libdir)
 NSPR_VERSION = $(MOD_MAJOR_VERSION)
 GC_VERSION = $(MOD_MAJOR_VERSION)
 LIBPR = -lnspr$(NSPR_VERSION)
 LIBPLC = -lplc$(NSPR_VERSION)
 LIBGC = -lmsgc$(GC_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
-  LIBPLC = $(dist_libdir)/plc$(NSPR_VERSION).lib
-  LIBGC= $(dist_libdir)/msgc$(GC_VERSION).lib
-else
   LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
   LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
   LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
   LIBGC= $(dist_libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
 endif
-endif
 
 ifeq ($(OS_ARCH),OS2)
   LDOPTS += -Zomf -Zlinker /PM:VIO
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
@@ -261,33 +250,16 @@ ifeq ($(AIX_PRE_4_2),1)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),WIN16)
-	echo system windows >w16link
-	echo name $@  >>w16link
-	echo option map >>w16link
-#	echo option CASEEXACT >>w16link
-	echo option stack=16K >>w16link
-	echo debug $(DEBUGTYPE) all >>w16link
-	echo file >>w16link
-	echo $< ,  >>w16link
-	echo $(W16STDIO) >>w16link
-	echo library  >>w16link
-	echo $(LIBPR),	     >>w16link
-	echo $(LIBPLC),		>>w16link
-	echo $(LIBGC),		 >>w16link
-	echo winsock.lib     >>w16link
-	wlink @w16link.
-else
 	link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
 else
 ifeq ($(OS_ARCH),OS2)
 	$(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
 else
 	$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@
 endif
 endif
--- a/nsprpub/lib/prstreams/tests/testprstrm/Makefile.in
+++ b/nsprpub/lib/prstreams/tests/testprstrm/Makefile.in
@@ -41,20 +41,16 @@ MOD_DEPTH	= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
-ifeq ($(OS_TARGET), WIN16)
-OS_CFLAGS = $(OS_EXE_CFLAGS)
-endif
-
 CXXSRCS =           \
 	testprstrm.cpp    \
 	$(NULL)
 
 OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
 
 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
@@ -70,30 +66,25 @@ INCLUDES = -I$(dist_includedir)
 
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
 LDOPTS = -L$(dist_libdir)
 LIBPR = -lnspr$(MOD_MAJOR_VERSION)
 LIBPRSTRMS = -lprstrms$(MOD_MAJOR_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
-  LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).lib
-else
   LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
   ifeq ($(OS_TARGET), WIN95)
     LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
     LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   else
     LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
     LIBPRSTRMS = $(dist_libdir)/libprstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   endif
 endif
-endif
 
 ifeq ($(OS_ARCH),OS2)
 LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
@@ -206,33 +197,17 @@ ifeq ($(AIX_PRE_4_2),1)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),WIN16)
-	echo system windows >w16link
-	echo option map >>w16link
-	echo option stack=10K >>w16link
-	echo option heapsize=32K >>w16link
-	echo debug $(DEBUGTYPE) all >>w16link
-	echo name $@  >>w16link
-	echo file >>w16link
-	echo $<  >>w16link
-	echo library  >>w16link
-	echo $(LIBPR),	     >>w16link
-	echo $(LIBPRSTRMS),		 >>w16link
-	echo winsock.lib     >>w16link
-	wlink @w16link.
-else
 	link $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) wsock32.lib -out:$@
-endif
 else
 ifeq ($(OS_ARCH),OS2)
 	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) $(OS_LIBS) $(EXTRA_LIBS)
 else
 	$(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPRSTRMS) $(EXTRA_LIBS) -o $@
 endif
 endif
 endif
--- a/nsprpub/lib/tests/Makefile.in
+++ b/nsprpub/lib/tests/Makefile.in
@@ -41,20 +41,16 @@ MOD_DEPTH	= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
-ifeq ($(OS_TARGET), WIN16)
-OS_CFLAGS = $(OS_EXE_CFLAGS)
-endif
-
 CSRCS = \
 	arena.c \
 	base64t.c \
 	getopt.c \
 	string.c
 
 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 CSRCS += arena.c
@@ -75,33 +71,27 @@ INCLUDES = -I$(dist_includedir)
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
 LDOPTS = -L$(dist_libdir)
 LIBPR = -lnspr$(MOD_MAJOR_VERSION)
 LIBPLC = -lplc$(MOD_MAJOR_VERSION)
 LIBPLDS = -lplds$(MOD_MAJOR_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
-  LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
-  LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).lib
-else
   LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
   ifeq ($(OS_TARGET), WIN95)
   LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   else
   LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   LIBPLC= $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   LIBPLDS= $(dist_libdir)/libplds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   endif
 endif
-endif
 
 ifeq ($(OS_ARCH),OS2)
 LDOPTS += -Zomf -Zlinker /PM:VIO
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
@@ -209,40 +199,21 @@ ifeq ($(AIX_PRE_4_2),1)
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),WIN16)
-	echo system windows >w16link
-	echo option map >>w16link
-	echo option stack=10K >>w16link
-	echo option heapsize=32K >>w16link
-	echo debug $(DEBUGTYPE) all >>w16link
-	echo name $@  >>w16link
-	echo file >>w16link
-	echo $<  >>w16link
-	echo library  >>w16link
-	echo $(LIBPR),	     >>w16link
-	echo $(LIBPLC),		 >>w16link
-	echo winsock.lib     >>w16link
-	wlink @w16link.
-else
 	link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) wsock32.lib -out:$@
-endif
 else
 ifeq ($(OS_ARCH),OS2)
 	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC)  $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
 else
 	$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@
 endif
 endif
 endif
 
 export:: $(TARGETS)
 clean::
 	rm -f $(TARGETS)
-
-
-
--- a/nsprpub/pr/include/md/_pcos.h
+++ b/nsprpub/pr/include/md/_pcos.h
@@ -41,22 +41,16 @@
 #define PR_DLL_SUFFIX		".dll"
 
 #include <stdlib.h>
 
 #define DIRECTORY_SEPARATOR         '\\'
 #define DIRECTORY_SEPARATOR_STR     "\\"
 #define PATH_SEPARATOR              ';'
 
-#ifdef WIN16
-#define GCPTR __far
-#else
-#define GCPTR
-#endif
-
 /*
 ** Routines for processing command line arguments
 */
 PR_BEGIN_EXTERN_C
 #ifndef XP_OS2
 extern char *optarg;
 extern int optind;
 extern int getopt(int argc, char **argv, char *spec);
--- a/nsprpub/pr/include/md/_unixos.h
+++ b/nsprpub/pr/include/md/_unixos.h
@@ -87,17 +87,16 @@
 #endif
 
 #define _PR_HAVE_O_APPEND
 
 #define PR_DIRECTORY_SEPARATOR		'/'
 #define PR_DIRECTORY_SEPARATOR_STR	"/"
 #define PR_PATH_SEPARATOR		':'
 #define PR_PATH_SEPARATOR_STR		":"
-#define GCPTR
 typedef int (*FARPROC)();
 
 /*
  * intervals at which GLOBAL threads wakeup to check for pending interrupt
  */
 #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
 extern PRIntervalTime intr_timeout_ticks;
 
deleted file mode 100644
--- a/nsprpub/pr/include/md/_win16.cfg
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
-** _win16.cfg -- prcpucfg.h for win16
-**
-**
-** lth. 14-Apr-1997. New. Made from _win95.cfg
-*/
-
-#ifndef nspr_cpucfg___
-#define nspr_cpucfg___
-
-#ifndef XP_PC
-#define XP_PC
-#endif
-
-#ifndef WIN16
-#define WIN16
-#undef  WIN32
-#endif
-
-#if defined(_M_IX86) || defined(_X86_)
-
-#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    2
-#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     16
-#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    4
-#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	4
-#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     2
-#define PR_ALIGN_OF_LONG    4
-#define PR_ALIGN_OF_INT64   8
-#define PR_ALIGN_OF_FLOAT   4
-#define PR_ALIGN_OF_WORD	2
-#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
-
-#else /* defined(_M_IX86) || defined(_X86_) */
-
-#error unknown processor architecture
-
-#endif /* defined(_M_IX86) || defined(_X86_) */
-
-#ifndef NO_NSPR_10_SUPPORT
-
-#define BYTES_PER_BYTE      PR_BYTES_PER_BYTE
-#define BYTES_PER_SHORT     PR_BYTES_PER_SHORT
-#define BYTES_PER_INT       PR_BYTES_PER_INT
-#define BYTES_PER_INT64     PR_BYTES_PER_INT64
-#define BYTES_PER_LONG      PR_BYTES_PER_LONG
-#define BYTES_PER_FLOAT     PR_BYTES_PER_FLOAT
-#define BYTES_PER_DOUBLE    PR_BYTES_PER_DOUBLE
-#define BYTES_PER_WORD      PR_BYTES_PER_WORD
-#define BYTES_PER_DWORD     PR_BYTES_PER_DWORD
-
-#define BITS_PER_BYTE       PR_BITS_PER_BYTE
-#define BITS_PER_SHORT      PR_BITS_PER_SHORT
-#define BITS_PER_INT        PR_BITS_PER_INT
-#define BITS_PER_INT64      PR_BITS_PER_INT64
-#define BITS_PER_LONG       PR_BITS_PER_LONG
-#define BITS_PER_FLOAT      PR_BITS_PER_FLOAT
-#define BITS_PER_DOUBLE     PR_BITS_PER_DOUBLE
-#define BITS_PER_WORD       PR_BITS_PER_WORD
-
-#define BITS_PER_BYTE_LOG2  PR_BITS_PER_BYTE_LOG2
-#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
-#define BITS_PER_INT_LOG2   PR_BITS_PER_INT_LOG2
-#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
-#define BITS_PER_LONG_LOG2  PR_BITS_PER_LONG_LOG2
-#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
-#define BITS_PER_DOUBLE_LOG2    PR_BITS_PER_DOUBLE_LOG2
-#define BITS_PER_WORD_LOG2  PR_BITS_PER_WORD_LOG2
-
-#define ALIGN_OF_SHORT      PR_ALIGN_OF_SHORT
-#define ALIGN_OF_INT        PR_ALIGN_OF_INT
-#define ALIGN_OF_LONG       PR_ALIGN_OF_LONG
-#define ALIGN_OF_INT64      PR_ALIGN_OF_INT64
-#define ALIGN_OF_FLOAT      PR_ALIGN_OF_FLOAT
-#define ALIGN_OF_DOUBLE     PR_ALIGN_OF_DOUBLE
-#define ALIGN_OF_POINTER    PR_ALIGN_OF_POINTER
-#define ALIGN_OF_WORD       PR_ALIGN_OF_WORD
-
-#define BYTES_PER_WORD_LOG2		PR_BYTES_PER_WORD_LOG2
-#define BYTES_PER_DWORD_LOG2    PR_BYTES_PER_DWORD_LOG2
-#define WORDS_PER_DWORD_LOG2    PR_WORDS_PER_DWORD_LOG2
-
-#endif /* NO_NSPR_10_SUPPORT */
-
-#undef  HAVE_LONG_LONG
-
-/*
-** HAVE_WATCOM_BUG_1
-** When HAVE_WATCOM_BUG_1 is defined, special case code is
-** used to circumvent the bug.
-** Functions declared __cdecl in DLLs returning floating point types
-** generate bad return code and will not return the intended result.
-*/
-#define HAVE_WATCOM_BUG_1
-
-/*
-** HAVE_WATCOM_BUG_2
-** When HAVE_WATCOM_BUG_2 is defined, special case code is
-** used to circumvent the bug.
-** Functions declared __cdecl in DLLs returning a structure by value
-** generate bad return values.
-** Yes, similar to Watcom Bug 1.
-*/
-#define HAVE_WATCOM_BUG_2
-
-#endif /* nspr_cpucfg___ */
deleted file mode 100644
--- a/nsprpub/pr/include/md/_win16.h
+++ /dev/null
@@ -1,568 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nspr_win16_defs_h___
-#define nspr_win16_defs_h___
-
-#include <windows.h>
-#include <winsock.h>
-#include <errno.h>
-#include <direct.h>
-
-#include "nspr.h"
-/* $$ fix this */
-#define Remind(x)
-
-/*
- * Internal configuration macros
- */
-
-#define PR_LINKER_ARCH      "win16"
-#define _PR_SI_SYSNAME        "WIN16"
-#define _PR_SI_ARCHITECTURE   "x86"    /* XXXMB hardcode for now */
-
-#define HAVE_DLL
-#define _PR_NO_PREEMPT
-#define _PR_LOCAL_THREADS_ONLY
-#undef  _PR_GLOBAL_THREADS_ONLY
-#undef  HAVE_THREAD_AFFINITY
-#define _PR_HAVE_ATOMIC_OPS
-
-/* --- Common User-Thread/Native-Thread Definitions --------------------- */
-
-extern struct PRLock        *_pr_schedLock;
-extern char                 * _pr_top_of_task_stack;
-
-
-/* --- Typedefs --- */
-
-#define PR_NUM_GCREGS           9
-typedef PRInt32	               PR_CONTEXT_TYPE[PR_NUM_GCREGS];
-
-#define _MD_MAGIC_THREAD	0x22222222
-#define _MD_MAGIC_THREADSTACK	0x33333333
-#define _MD_MAGIC_SEGMENT	0x44444444
-#define _MD_MAGIC_DIR		0x55555555
-#define _MD_MAGIC_CV        0x66666666
-
-
-typedef struct _PRWin16PollDesc
-{
-	PRInt32 osfd;
-	PRInt16 in_flags;
-	PRInt16 out_flags;
-} _PRWin16PollDesc;
-
-typedef struct PRPollQueue
-{
-    PRCList links;              /* for linking PRPollQueue's together */
-    _PRWin16PollDesc *pds;      /* array of poll descriptors */
-    PRUintn npds;				/* length of the array */
-    PRPackedBool on_ioq;        /* is this on the async i/o work q? */
-    PRIntervalTime timeout;     /* timeout, in ticks */
-    struct PRThread *thr;
-} PRPollQueue;
-
-#define _PR_POLLQUEUE_PTR(_qp) \
-    ((PRPollQueue *) ((char*) (_qp) - offsetof(PRPollQueue,links)))
-
-NSPR_API(PRInt32) _PR_WaitForFD(PRInt32 osfd, PRUintn how,
-					PRIntervalTime timeout);
-NSPR_API(void) _PR_Unblock_IO_Wait(struct PRThread *thr);
-
-#define _PR_MD_MAX_OSFD             FD_SETSIZE
-#define _PR_IOQ(_cpu)				((_cpu)->md.ioQ)
-#define _PR_ADD_TO_IOQ(_pq, _cpu) 	PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
-#define _PR_FD_READ_SET(_cpu)		((_cpu)->md.fd_read_set)
-#define _PR_FD_READ_CNT(_cpu)		((_cpu)->md.fd_read_cnt)
-#define _PR_FD_WRITE_SET(_cpu)		((_cpu)->md.fd_write_set)
-#define _PR_FD_WRITE_CNT(_cpu)		((_cpu)->md.fd_write_cnt)
-#define _PR_FD_EXCEPTION_SET(_cpu)	((_cpu)->md.fd_exception_set)
-#define _PR_FD_EXCEPTION_CNT(_cpu)	((_cpu)->md.fd_exception_cnt)
-#define _PR_IOQ_TIMEOUT(_cpu)		((_cpu)->md.ioq_timeout)
-#define _PR_IOQ_MAX_OSFD(_cpu)		((_cpu)->md.ioq_max_osfd)
-
-struct _MDCPU {
-    PRCList		ioQ;
-    fd_set		fd_read_set, fd_write_set, fd_exception_set;
-    PRInt16		fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
-				fd_exception_cnt[_PR_MD_MAX_OSFD];
-    PRUint32	ioq_timeout;
-    PRInt32		ioq_max_osfd;
-};
-
-struct _MDThread {
-    /* The overlapped structure must be first! */
-    HANDLE           blocked_sema;      /* Threads block on this when waiting
-                                         * for IO or CondVar.
-                                         */
-    PRInt32         errcode;        /* preserved errno for this thread */
-    CATCHBUF        context;        /* thread context for Throw() */
-    void           *SP;             /* Stack pointer, used only by GarbColl */
-    int             threadNumber;   /* instrumentation: order of creation */
-	_PRWin16PollDesc thr_pd;       /* poll descriptor for i/o */
-	PRPollQueue		thr_pq;        /* i/o parameters			*/
-    void           *exceptionContext; /* mfc exception context */
-    char            guardBand[24];  /* don't overwrite this */
-    PRUint32        magic;          /* self identifier, for debug */
-};
-
-struct _MDThreadStack {
-    PRUint32           magic;          /* for debugging */
-    PRIntn          cxByteCount;    /* number of stack bytes to move */
-    char *          stackTop;       /* high address on stack */
-};
-
-struct _MDSegment {
-    PRUint32           magic;          /* for debugging */
-};
-
-
-struct _MDLock {
-    PRUint32           magic;          /* for debugging */
-    PRUint32           mutex;
-};
-
-struct _MDDir {
-    PRUint32         magic;          /* for debugging */
-    struct  dirent  *dir;
-};
-
-struct _MDCVar {
-	PRUint32        magic;
-};
-
-struct _MDSemaphore {
-	PRInt32			unused;
-};
-
-struct _MDFileDesc {
-    PRInt32 osfd;
-};
-
-struct _MDProcess {
-    HANDLE handle;
-    DWORD id;
-};
-
-/*
-** Microsoft 'struct _stat'
-** ... taken directly from msvc 1.52c's header file sys/stat.h
-** see PR_Stat() implemented in w16io.c
-** See BugSplat: 98516
-*/
-#pragma pack(push)
-#pragma pack(2)
-
-typedef unsigned short _ino_t;
-typedef short _dev_t;
-typedef long _off_t;
-
-typedef struct _MDMSStat {
-    _dev_t st_dev;
-    _ino_t st_ino;
-    unsigned short st_mode;
-    short st_nlink;
-    short st_uid;
-    short st_gid;
-    _dev_t st_rdev;
-    _off_t st_size;
-    time_t st_atime;
-    time_t st_mtime;
-    time_t st_ctime;
-} _MDMSStat;
-#pragma pack(pop)
-
-/* --- Errors --- */
-    /* These are NSPR generated error codes which need to be unique from
-     * OS error codes.
-     */
-#define _MD_UNIQUEBASE                 50000
-#define _MD_EINTERRUPTED               _MD_UNIQUEBASE + 1
-#define _MD_ETIMEDOUT                  _MD_UNIQUEBASE + 2
-#define _MD_EIO                        _MD_UNIQUEBASE + 3
-
-struct PRProcess;
-struct PRProcessAttr;
-
-/* --- Create a new process --- */
-#define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
-extern struct PRProcess * _PR_CreateWindowsProcess(
-    const char *path,
-    char *const *argv,
-    char *const *envp,
-    const struct PRProcessAttr *attr
-);
-
-#define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
-extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
-
-/* --- Wait for a child process to terminate --- */
-#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
-extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process, 
-    PRInt32 *exitCode);
-
-#define _MD_KILL_PROCESS _PR_KillWindowsProcess
-extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
-
-
-/* --- Misc stuff --- */
-
-#define MD_ASSERTINT( x )             PR_ASSERT( (x) < 65535 )
-
-/* --- IO stuff --- */
-#define MAX_PATH    256
-#define _MD_ERRNO()                   errno
-#define GetLastError()                errno
-
-#define _MD_GET_FILE_ERROR()          errno
-#define _MD_SET_FILE_ERROR(_err)      errno = (_err)
-
-#define _MD_OPEN                      _PR_MD_OPEN
-#define _MD_READ                      _PR_MD_READ
-#define _MD_WRITE                     _PR_MD_WRITE
-#define _MD_WRITEV                    _PR_MD_WRITEV
-#define _MD_LSEEK                     _PR_MD_LSEEK
-#define _MD_LSEEK64                   _PR_MD_LSEEK64
-#define _MD_CLOSE_FILE                _PR_MD_CLOSE_FILE
-#define _MD_GETFILEINFO               _PR_MD_GETFILEINFO
-#define _MD_GETOPENFILEINFO           _PR_MD_GETOPENFILEINFO
-#define _MD_STAT                      _PR_MD_STAT
-#define _MD_RENAME                    _PR_MD_RENAME     
-#define _MD_ACCESS                    _PR_MD_ACCESS     
-#define _MD_DELETE                    _PR_MD_DELETE     
-#define _MD_MKDIR                     _PR_MD_MKDIR      
-#define _MD_RMDIR                     _PR_MD_RMDIR      
-#define _MD_LOCKFILE                  _PR_MD_LOCKFILE
-#define _MD_TLOCKFILE                 _PR_MD_TLOCKFILE
-#define _MD_UNLOCKFILE                _PR_MD_UNLOCKFILE
-
-
-/* --- Socket IO stuff --- */
-#define _MD_EACCES                WSAEACCES
-#define _MD_EADDRINUSE            WSAEADDRINUSE
-#define _MD_EADDRNOTAVAIL         WSAEADDRNOTAVAIL
-#define _MD_EAFNOSUPPORT          WSAEAFNOSUPPORT
-#define _MD_EAGAIN                WSAEWOULDBLOCK
-#define _MD_EALREADY              WSAEALREADY
-#define _MD_EBADF                 WSAEBADF
-#define _MD_ECONNREFUSED          WSAECONNREFUSED
-#define _MD_ECONNRESET            WSAECONNRESET
-#define _MD_EFAULT                WSAEFAULT
-#define _MD_EINPROGRESS           WSAEINPROGRESS
-#define _MD_EINTR                 WSAEINTR
-#define _MD_EINVAL                EINVAL
-#define _MD_EISCONN               WSAEISCONN
-#define _MD_ENETUNREACH           WSAENETUNREACH
-#define _MD_ENOENT                ENOENT
-#define _MD_ENOTCONN              WSAENOTCONN
-#define _MD_ENOTSOCK              WSAENOTSOCK
-#define _MD_EOPNOTSUPP            WSAEOPNOTSUPP
-#define _MD_EWOULDBLOCK           WSAEWOULDBLOCK
-#define _MD_GET_SOCKET_ERROR()    WSAGetLastError()
-#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
-
-#define _MD_INIT_FILEDESC(fd)
-#define _MD_MAKE_NONBLOCK             _PR_MD_MAKE_NONBLOCK
-#define _MD_SHUTDOWN                  _PR_MD_SHUTDOWN
-#define _MD_LISTEN                      _PR_MD_LISTEN
-#define _MD_CLOSE_SOCKET              _PR_MD_CLOSE_SOCKET
-#define _MD_SENDTO                    _PR_MD_SENDTO
-#define _MD_RECVFROM                  _PR_MD_RECVFROM
-#define _MD_SOCKETPAIR(s, type, proto, sv) -1
-#define _MD_GETSOCKNAME               _PR_MD_GETSOCKNAME
-#define _MD_GETPEERNAME               _PR_MD_GETPEERNAME
-#define _MD_GETSOCKOPT                _PR_MD_GETSOCKOPT
-#define _MD_SETSOCKOPT                _PR_MD_SETSOCKOPT
-#define _MD_SELECT                    select
-#define _MD_FSYNC                     _PR_MD_FSYNC
-#define _MD_SOCKETAVAILABLE           _PR_MD_SOCKETAVAILABLE
-
-#define _MD_INIT_ATOMIC()
-#define _MD_ATOMIC_INCREMENT(x)       (*x++)
-#define _MD_ATOMIC_ADD(ptr, val)      ((*x) += val)
-#define _MD_ATOMIC_DECREMENT(x)       (*x--)
-#define _MD_ATOMIC_SET(x,y)           (*x, y)
-
-#define _MD_INIT_IO                   _PR_MD_INIT_IO
-
-/* win95 doesn't have async IO */
-#define _MD_SOCKET                    _PR_MD_SOCKET
-#define _MD_CONNECT                   _PR_MD_CONNECT
-#define _MD_ACCEPT                    _PR_MD_ACCEPT
-#define _MD_BIND                      _PR_MD_BIND
-#define _MD_RECV                      _PR_MD_RECV
-#define _MD_SEND                      _PR_MD_SEND
-
-#define _MD_CHECK_FOR_EXIT()
-
-/* --- Scheduler stuff --- */
-#define _MD_PAUSE_CPU                 _PR_MD_PAUSE_CPU
-
-/* --- DIR stuff --- */
-#define PR_DIRECTORY_SEPARATOR        '\\'
-#define PR_DIRECTORY_SEPARATOR_STR    "\\"
-#define PR_PATH_SEPARATOR		';'
-#define PR_PATH_SEPARATOR_STR		";"
-#define _MD_OPEN_DIR                  _PR_MD_OPEN_DIR
-#define _MD_CLOSE_DIR                 _PR_MD_CLOSE_DIR
-#define _MD_READ_DIR                  _PR_MD_READ_DIR
-
-/* --- Segment stuff --- */
-#define _MD_INIT_SEGS()
-#define _MD_ALLOC_SEGMENT           _MD_AllocSegment
-#define _MD_FREE_SEGMENT            _MD_FreeSegment
-
-/* --- Environment Stuff --- */
-#define _MD_GET_ENV                 _PR_MD_GET_ENV
-#define _MD_PUT_ENV                 _PR_MD_PUT_ENV
-
-/* --- Threading Stuff --- */
-#define _MD_DEFAULT_STACK_SIZE      32767L
-#define _MD_INIT_THREAD             _PR_MD_INIT_THREAD
-#define _MD_CREATE_THREAD(t,f,p,sc,st,stsiz) (PR_SUCCESS)
-#define _MD_YIELD                   _PR_MD_YIELD
-#define _MD_SET_PRIORITY(t,p)            
-#define _MD_CLEAN_THREAD(t)
-#define _MD_SETTHREADAFFINITYMASK   _PR_MD_SETTHREADAFFINITYMASK
-#define _MD_GETTHREADAFFINITYMASK   _PR_MD_GETTHREADAFFINITYMASK
-#define _MD_EXIT_THREAD
-#define _MD_SUSPEND_THREAD          _PR_MD_SUSPEND_THREAD
-#define _MD_RESUME_THREAD           _PR_MD_RESUME_THREAD
-#define _MD_SUSPEND_CPU             _PR_MD_SUSPEND_CPU
-#define _MD_RESUME_CPU              _PR_MD_RESUME_CPU
-#define _MD_BEGIN_SUSPEND_ALL()
-#define _MD_BEGIN_RESUME_ALL()
-#define _MD_END_SUSPEND_ALL()
-#define _MD_END_RESUME_ALL()
-
-/* --- Lock stuff --- */
-/*
-** Win16 does not need MD locks.
-*/
-#define _PR_LOCK                    _MD_LOCK
-#define _PR_UNLOCK                  _MD_UNLOCK
-
-#define _MD_NEW_LOCK(l)             (PR_SUCCESS)
-#define _MD_FREE_LOCK(l)
-#define _MD_LOCK(l)
-#define _MD_TEST_AND_LOCK(l)        (-1)
-#define _MD_UNLOCK(l)
-
-/* --- lock and cv waiting --- */
-#define _MD_WAIT                      _PR_MD_WAIT
-#define _MD_WAKEUP_WAITER(a)
-#define _MD_WAKEUP_CPUS               _PR_MD_WAKEUP_CPUS
-
-/* --- CVar ------------------- */
-#define _MD_WAIT_CV					  _PR_MD_WAIT_CV
-#define _MD_NEW_CV					  _PR_MD_NEW_CV
-#define _MD_FREE_CV					  _PR_MD_FREE_CV
-#define _MD_NOTIFY_CV				  _PR_MD_NOTIFY_CV	
-#define _MD_NOTIFYALL_CV			  _PR_MD_NOTIFYALL_CV
-
-   /* XXXMB- the IOQ stuff is certainly not working correctly yet. */
-#define _MD_IOQ_LOCK()                
-#define _MD_IOQ_UNLOCK()              
-
-
-/* --- Initialization stuff --- */
-NSPR_API(void) _MD_INIT_RUNNING_CPU(struct _PRCPU *cpu );
-#define _MD_START_INTERRUPTS()
-#define _MD_STOP_INTERRUPTS()
-#define _MD_DISABLE_CLOCK_INTERRUPTS()
-#define _MD_ENABLE_CLOCK_INTERRUPTS()
-#define _MD_BLOCK_CLOCK_INTERRUPTS()
-#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
-#define _MD_EARLY_INIT                  _PR_MD_EARLY_INIT
-#define _MD_FINAL_INIT                  _PR_MD_FINAL_INIT
-#define _MD_INIT_CPUS()
-
-/* --- User Threading stuff --- */
-#define _MD_EXIT
-
-#define _MD_CLEANUP_BEFORE_EXIT              _PR_MD_CLEANUP_BEFORE_EXIT
-
-/* --- Intervals --- */
-#define _MD_INTERVAL_INIT                 _PR_MD_INTERVAL_INIT
-#define _MD_GET_INTERVAL                  _PR_MD_GET_INTERVAL
-#define _MD_INTERVAL_PER_SEC              _PR_MD_INTERVAL_PER_SEC
-#define _MD_INTERVAL_PER_MILLISEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000)
-#define _MD_INTERVAL_PER_MICROSEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000000)
-
-/* --- Scheduler stuff --- */
-#define LOCK_SCHEDULER()                 0
-#define UNLOCK_SCHEDULER()               0
-#define _PR_LockSched()                	 0
-#define _PR_UnlockSched()                0
-
-/* --- Initialization stuff --- */
-#define _MD_INIT_LOCKS()
-
-/* --- Stack stuff --- */
-#define _MD_INIT_STACK                   _PR_MD_INIT_STACK
-#define _MD_CLEAR_STACK(stack)
-
-/*
-** Watcom needs to see this to make the linker work.
-**
-*/
-NSPR_API(void) _PR_NativeDestroyThread(PRThread *thread);
-NSPR_API(void) _PR_UserDestroyThread(PRThread *thread);
-
-
-/*
-** If thread emulation is used, then setjmp/longjmp stores the register
-** state of each thread.
-**
-** CatchBuf layout:
-**  context[0] - IP
-**  context[1] - CS
-**  context[2] - SP
-**  context[3] - BP
-**  context[4] - SI
-**  context[5] - DI
-**  context[6] - DS
-**  context[7] - ?? (maybe flags)
-**  context[8] - SS
-*/
-#define PR_CONTEXT_TYPE     CATCHBUF
-#define PR_NUM_GCREGS       9
-
-#define _MD_GET_SP(thread)  ((thread)->md.SP)
-#define CONTEXT(_t)  ((_t)->md.context)
-
-/*
-** Initialize a thread context to run "e(o,a)" when started
-*/
-#define _MD_INIT_CONTEXT(_t, sp, epa, stat )   \
-{                                              \
-     *(stat) = PR_TRUE;                        \
-     Catch((_t)->md.context );             \
-     (_t)->md.context[0] = OFFSETOF(epa);         \
-     (_t)->md.context[1] = SELECTOROF(epa);                       \
-     (_t)->md.context[2] = OFFSETOF(_pr_top_of_task_stack - 64);  \
-     (_t)->md.context[3]  = 0;                 \
-}
-
-#define _MD_SWITCH_CONTEXT(_t)                 \
-    if (!Catch((_t)->md.context)) {            \
-        int     garbCollPlaceHolder;           \
-        (_t)->md.errcode = errno;              \
-        (_t)->md.SP = &garbCollPlaceHolder;    \
-        _PR_Schedule();                        \
-    }
-
-#define _MD_SAVE_CONTEXT(_t)                    \
-    {                                           \
-        int     garbCollPlaceHolder;            \
-        Catch((_t)->md.context);                \
-        (_t)->md.errcode = errno;               \
-        (_t)->md.SP = &garbCollPlaceHolder;     \
-    }
-
-/*
-** Restore a thread context, saved by _MD_SWITCH_CONTEXT
-*/
-#define _PR_MD_RESTORE_CONTEXT  _MD_RESTORE_CONTEXT
-
-/*
- * Memory-mapped files
- */
-
-struct _MDFileMap {
-    PRInt8 unused;
-};
-
-extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
-#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
-
-extern PRInt32 _MD_GetMemMapAlignment(void);
-#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
-
-extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
-        PRUint32 len);
-#define _MD_MEM_MAP _MD_MemMap
-
-extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
-#define _MD_MEM_UNMAP _MD_MemUnmap
-
-extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
-#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
-
-
-/* --- Error mapping ----------------------------------- */
-extern void _PR_MD_map_error( int err );
-
-#define _PR_MD_MAP_OPENDIR_ERROR        _PR_MD_map_error
-#define _PR_MD_MAP_CLOSEDIR_ERROR       _PR_MD_map_error
-#define _PR_MD_MAP_READDIR_ERROR        _PR_MD_map_error
-#define _PR_MD_MAP_DELETE_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_STAT_ERROR           _PR_MD_map_error
-#define _PR_MD_MAP_FSTAT_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_RENAME_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_ACCESS_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_MKDIR_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_RMDIR_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_READ_ERROR           _PR_MD_map_error
-#define _PR_MD_MAP_TRANSMITFILE_ERROR   _PR_MD_map_error
-#define _PR_MD_MAP_WRITE_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_LSEEK_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_FSYNC_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_CLOSE_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_SOCKET_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_RECV_ERROR           _PR_MD_map_error
-#define _PR_MD_MAP_RECVFROM_ERROR       _PR_MD_map_error
-#define _PR_MD_MAP_SEND_ERROR           _PR_MD_map_error
-#define _PR_MD_MAP_SENDTO_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_ACCEPT_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_ACCEPTEX_ERROR       _PR_MD_map_error
-#define _PR_MD_MAP_CONNECT_ERROR        _PR_MD_map_error
-#define _PR_MD_MAP_BIND_ERROR           _PR_MD_map_error
-#define _PR_MD_MAP_LISTEN_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_SHUTDOWN_ERROR       _PR_MD_map_error
-#define _PR_MD_MAP_GETSOCKNAME_ERROR    _PR_MD_map_error
-#define _PR_MD_MAP_GETPEERNAME_ERROR    _PR_MD_map_error
-#define _PR_MD_MAP_GETSOCKOPT_ERROR     _PR_MD_map_error
-#define _PR_MD_MAP_SETSOCKOPT_ERROR     _PR_MD_map_error
-#define _PR_MD_MAP_OPEN_ERROR           _PR_MD_map_error
-#define _PR_MD_MAP_GETHOSTNAME_ERROR    _PR_MD_map_error
-#define _PR_MD_MAP_SELECT_ERROR         _PR_MD_map_error
-#define _PR_MD_MAP_LOCKF_ERROR          _PR_MD_map_error
-#define _PR_MD_MAP_WSASTARTUP_ERROR     _PR_MD_map_error
-
-#endif /* nspr_win16_defs_h___ */
--- a/nsprpub/pr/include/md/prosdep.h
+++ b/nsprpub/pr/include/md/prosdep.h
@@ -49,18 +49,16 @@ PR_BEGIN_EXTERN_C
 
 #include "md/_pcos.h"
 #ifdef WINNT
 #include "md/_winnt.h"
 #include "md/_win32_errors.h"
 #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
 #error unknown Windows platform
 #endif
 
 #elif defined(XP_UNIX)
--- a/nsprpub/pr/include/prdtoa.h
+++ b/nsprpub/pr/include/prdtoa.h
@@ -48,24 +48,17 @@ PR_BEGIN_EXTERN_C
 ** s00. The string is scanned up to the first unrecognized
 ** character.
 **a
 ** If the value of se is not (char **)NULL, a  pointer  to
 ** the  character terminating the scan is returned in the location pointed
 ** to by se. If no number can be formed, se is set to s00, and
 ** zero is returned.
 */
-#if defined(HAVE_WATCOM_BUG_1)
-/* this is a hack to circumvent a bug in the Watcom C/C++ 11.0 compiler
-** When Watcom fixes the bug, remove the special case for Win16
-*/
-PRFloat64 __pascal __loadds __export
-#else
 NSPR_API(PRFloat64)
-#endif
 PR_strtod(const char *s00, char **se);
 
 /*
 ** PR_cnvtf()
 ** conversion routines for floating point
 ** prcsn - number of digits of precision to generate floating
 ** point value.
 */
--- a/nsprpub/pr/include/prinet.h
+++ b/nsprpub/pr/include/prinet.h
@@ -113,19 +113,15 @@ struct sockaddr_dl;
  * Do not include any system header files.
  *
  * Originally we were including <windows.h>.  It slowed down the
  * compilation of files that included NSPR headers, so we removed
  * the <windows.h> inclusion at customer's request, which created
  * an unfortunate inconsistency with other platforms.
  */
 
-#elif defined(WIN16)
-
-#include <winsock.h>
-
 #else
 
 #error Unknown platform
 
 #endif
 
 #endif /* prinet_h__ */
--- a/nsprpub/pr/include/prinrval.h
+++ b/nsprpub/pr/include/prinrval.h
@@ -73,16 +73,19 @@ typedef PRUint32 PRIntervalTime;
 
 /***********************************************************************
 ** DEFINES:     PR_INTERVAL_NO_WAIT
 **              PR_INTERVAL_NO_TIMEOUT
 ** DESCRIPTION:
 **  Two reserved constants are defined in the PRIntervalTime namespace.
 **  They are used to indicate that the process should wait no time (return
 **  immediately) or wait forever (never time out), respectively.
+**  Note: PR_INTERVAL_NO_TIMEOUT passed as input to PR_Connect is 
+**  interpreted as use the OS's connect timeout.
+**  
 ***********************************************************************/
 #define PR_INTERVAL_NO_WAIT 0UL
 #define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL
 
 /**********************************************************************/
 /****************************** FUNCTIONS *****************************/
 /**********************************************************************/
 
--- a/nsprpub/pr/include/prio.h
+++ b/nsprpub/pr/include/prio.h
@@ -1260,17 +1260,21 @@ NSPR_API(PRFileDesc*)    PR_OpenTCPSocke
  *     Initiate a connection on a socket.
  * INPUTS:
  *     PRFileDesc *fd
  *       Points to a PRFileDesc object representing a socket
  *     PRNetAddr *addr
  *       Specifies the address of the socket in its own communication
  *       space.
  *     PRIntervalTime timeout
- *       Time limit for completion of the connect operation.
+ *       The function uses the lesser of the provided timeout and
+ *       the OS's connect timeout.  In particular, if you specify
+ *       PR_INTERVAL_NO_TIMEOUT as the timeout, the OS's connection
+ *       time limit will be used.
+ *
  * OUTPUTS:
  *     None
  * RETURN: PRStatus
  *     Upon successful completion of connection initiation, PR_Connect
  *     returns PR_SUCCESS.  Otherwise, it returns PR_FAILURE.  Further
  *     failure information can be obtained by calling PR_GetError().
  **************************************************************************
  */
--- a/nsprpub/pr/include/prlock.h
+++ b/nsprpub/pr/include/prlock.h
@@ -111,11 +111,31 @@ NSPR_API(void) PR_Lock(PRLock *lock);
 ** INPUTS:      PRLock *lock
 **              Lock to unlocked.
 ** OUTPUTS:     void
 ** RETURN:      PR_STATUS
 **              Returns PR_FAILURE if the caller does not own the lock.
 ***********************************************************************/
 NSPR_API(PRStatus) PR_Unlock(PRLock *lock);
 
+/***********************************************************************
+** MACRO:    PR_ASSERT_CURRENT_THREAD_OWNS_LOCK
+** DESCRIPTION:
+**  If the current thread owns |lock|, this assertion is guaranteed to
+**  succeed.  Otherwise, the behavior of this function is undefined.
+** INPUTS:      PRLock *lock
+**              Lock to assert ownership of.
+** OUTPUTS:     void
+** RETURN:      None
+***********************************************************************/
+#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
+#define PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(/* PrLock* */ lock) \
+    PR_AssertCurrentThreadOwnsLock(lock)
+#else
+#define PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(/* PrLock* */ lock)
+#endif
+
+/* Don't call this function directly. */
+NSPR_API(void) PR_AssertCurrentThreadOwnsLock(PRLock *lock);
+
 PR_END_EXTERN_C
 
 #endif /* prlock_h___ */
--- a/nsprpub/pr/include/prlog.h
+++ b/nsprpub/pr/include/prlog.h
@@ -184,21 +184,17 @@ NSPR_API(void) PR_SetLogBuffering(PRIntn
 */
 NSPR_API(void) PR_LogPrint(const char *fmt, ...);
 
 /*
 ** Flush the log to its file.
 */
 NSPR_API(void) PR_LogFlush(void);
 
-/*
-** Windoze 16 can't support a large static string space for all of the
-** various debugging strings so logging is not enabled for it.
-*/
-#if (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16)
+#if defined(DEBUG) || defined(FORCE_PR_LOG)
 #define PR_LOGGING 1
 
 #define PR_LOG_TEST(_module,_level) \
     ((_module)->level >= (_level))
 
 /*
 ** Log something.
 **    "module" is the address of a PRLogModuleInfo structure
@@ -208,23 +204,23 @@ NSPR_API(void) PR_LogFlush(void);
 */
 #define PR_LOG(_module,_level,_args)     \
     PR_BEGIN_MACRO             \
       if (PR_LOG_TEST(_module,_level)) { \
       PR_LogPrint _args;         \
       }                     \
     PR_END_MACRO
 
-#else /* (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16) */
+#else /* defined(DEBUG) || defined(FORCE_PR_LOG) */
 
 #undef PR_LOGGING
 #define PR_LOG_TEST(module,level) 0
 #define PR_LOG(module,level,args)
 
-#endif /* (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16) */
+#endif /* defined(DEBUG) || defined(FORCE_PR_LOG) */
 
 #ifndef NO_NSPR_10_SUPPORT
 
 #ifdef PR_LOGGING
 #define PR_LOG_BEGIN    PR_LOG
 #define PR_LOG_END      PR_LOG
 #define PR_LOG_DEFINE   PR_NewLogModule
 #else
--- a/nsprpub/pr/include/prlong.h
+++ b/nsprpub/pr/include/prlong.h
@@ -54,41 +54,30 @@ PR_BEGIN_EXTERN_C
 ** DEFINES:     LL_MaxInt
 **              LL_MinInt
 **              LL_Zero
 **              LL_MaxUint
 ** DESCRIPTION:
 **      Various interesting constants and static variable
 **      initializer
 ***********************************************************************/
-#if defined(HAVE_WATCOM_BUG_2)
-PRInt64 __pascal __loadds __export
-    LL_MaxInt(void);
-PRInt64 __pascal __loadds __export
-    LL_MinInt(void);
-PRInt64 __pascal __loadds __export
-    LL_Zero(void);
-PRUint64 __pascal __loadds __export
-    LL_MaxUint(void);
-#else
 NSPR_API(PRInt64) LL_MaxInt(void);
 NSPR_API(PRInt64) LL_MinInt(void);
 NSPR_API(PRInt64) LL_Zero(void);
 NSPR_API(PRUint64) LL_MaxUint(void);
-#endif
 
 #if defined(HAVE_LONG_LONG)
 
 #if PR_BYTES_PER_LONG == 8
 #define LL_MAXINT   9223372036854775807L
 #define LL_MININT   (-LL_MAXINT - 1L)
 #define LL_ZERO     0L
 #define LL_MAXUINT  18446744073709551615UL
 #define LL_INIT(hi, lo)  ((hi ## L << 32) + lo ## L)
-#elif (defined(WIN32) || defined(WIN16)) && !defined(__GNUC__)
+#elif defined(WIN32) && !defined(__GNUC__)
 #define LL_MAXINT   9223372036854775807i64
 #define LL_MININT   (-LL_MAXINT - 1i64)
 #define LL_ZERO     0i64
 #define LL_MAXUINT  18446744073709551615ui64
 #define LL_INIT(hi, lo)  ((hi ## i64 << 32) + lo ## i64)
 #else
 #define LL_MAXINT   9223372036854775807LL
 #define LL_MININT   (-LL_MAXINT - 1LL)
--- a/nsprpub/pr/include/prmon.h
+++ b/nsprpub/pr/include/prmon.h
@@ -103,11 +103,26 @@ NSPR_API(PRStatus) PR_Notify(PRMonitor *
 
 /*
 ** Notify all of the threads waiting on the monitor's condition variable.
 ** All of threads waiting on the condition are scheduled to reenter the
 ** monitor.
 */
 NSPR_API(PRStatus) PR_NotifyAll(PRMonitor *mon);
 
+/*
+** PR_ASSERT_CURRENT_THREAD_IN_MONITOR
+** If the current thread is in |mon|, this assertion is guaranteed to
+** succeed.  Otherwise, the behavior of this function is undefined.
+*/
+#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
+#define PR_ASSERT_CURRENT_THREAD_IN_MONITOR(/* PRMonitor* */ mon) \
+    PR_AssertCurrentThreadInMonitor(mon)
+#else
+#define PR_ASSERT_CURRENT_THREAD_IN_MONITOR(/* PRMonitor* */ mon)
+#endif
+
+/* Don't call this function directly. */
+NSPR_API(void) PR_AssertCurrentThreadInMonitor(PRMonitor *mon);
+
 PR_END_EXTERN_C
 
 #endif /* prmon_h___ */
--- a/nsprpub/pr/include/prnetdb.h
+++ b/nsprpub/pr/include/prnetdb.h
@@ -63,17 +63,17 @@ NSPR_API(PRStatus) PR_NetAddrToString(
 /*
 ** Beware that WINSOCK.H defines h_addrtype and h_length as short.
 ** Client code does direct struct copies of hostent to PRHostEnt and
 ** hence the ifdef.
 */
 typedef struct PRHostEnt {
     char *h_name;       /* official name of host */
     char **h_aliases;   /* alias list */
-#if defined(WIN32) || defined(WIN16)
+#ifdef WIN32
     PRInt16 h_addrtype; /* host address type */
     PRInt16 h_length;   /* length of address */
 #else
     PRInt32 h_addrtype; /* host address type */
     PRInt32 h_length;   /* length of address */
 #endif
     char **h_addr_list; /* list of addresses from name server */
 } PRHostEnt;
@@ -349,17 +349,17 @@ NSPR_API(void) PR_ConvertIPv4AddrToIPv6(
 **  PRStatus            PR_SUCCESS if the lookup succeeds. If it fails
 **                      the result will be PR_FAILURE and the reason
 **                      for the failure can be retrieved by PR_GetError().
 ***********************************************************************/
 
 typedef struct PRProtoEnt {
     char *p_name;       /* official protocol name */
     char **p_aliases;   /* alias list */
-#if defined(WIN32) || defined(WIN16)
+#ifdef WIN32
     PRInt16 p_num;      /* protocol # */
 #else
     PRInt32 p_num;      /* protocol # */
 #endif
 } PRProtoEnt;
 
 NSPR_API(PRStatus) PR_GetProtoByName(
     const char* protocolname, char* buffer, PRInt32 bufsize, PRProtoEnt* result);
--- a/nsprpub/pr/include/prthread.h
+++ b/nsprpub/pr/include/prthread.h
@@ -34,17 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef prthread_h___
 #define prthread_h___
 
 /*
-** API for NSPR threads. On some architectures (MAC and WIN16
+** API for NSPR threads. On some architectures (Mac OS Classic
 ** notably) pre-emptibility is not guaranteed. Hard priority scheduling
 ** is not guaranteed, so programming using priority based synchronization
 ** is a no-no.
 **
 ** NSPR threads are scheduled based loosely on their client set priority.
 ** In general, a thread of a higher priority has a statistically better
 ** chance of running relative to threads of lower priority. However,
 ** NSPR uses multiple strategies to provide execution vehicles for thread
--- a/nsprpub/pr/include/prtime.h
+++ b/nsprpub/pr/include/prtime.h
@@ -110,28 +110,28 @@ typedef struct PRTimeParameters {
  *       ANSI C             time_t                  struct tm
  *       NSPR 1.0           PRInt64                   PRTime
  *       NSPR 2.0           PRTime                  PRExplodedTime
  */
 
 typedef struct PRExplodedTime {
     PRInt32 tm_usec;		    /* microseconds past tm_sec (0-99999)  */
     PRInt32 tm_sec;             /* seconds past tm_min (0-61, accomodating
-                                   up to two leap seconds) */	
+                                   up to two leap seconds) */
     PRInt32 tm_min;             /* minutes past tm_hour (0-59) */
     PRInt32 tm_hour;            /* hours past tm_day (0-23) */
     PRInt32 tm_mday;            /* days past tm_mon (1-31, note that it
 				                starts from 1) */
     PRInt32 tm_month;           /* months past tm_year (0-11, Jan = 0) */
     PRInt16 tm_year;            /* absolute year, AD (note that we do not
 				                count from 1900) */
 
     PRInt8 tm_wday;		        /* calculated day of the week
 				                (0-6, Sun = 0) */
-    PRInt16 tm_yday;            /* calculated day of the year 
+    PRInt16 tm_yday;            /* calculated day of the year
 				                (0-365, Jan 1 = 0) */
 
     PRTimeParameters tm_params;  /* time parameters used by conversion */
 } PRExplodedTime;
 
 /*
  * PRTimeParamFn --
  *
@@ -169,42 +169,34 @@ typedef PRTimeParameters (PR_CALLBACK *P
  * The values returned are not guaranteed to advance in a linear fashion
  * due to the application of time correction protocols which synchronize
  * computer clocks to some external time source. Consequently it should
  * not be depended on for interval timing.
  *
  * The implementation is machine dependent.
  * Cf. time_t time(time_t *tp) in ANSI C.
  */
-#if defined(HAVE_WATCOM_BUG_2)
-PRTime __pascal __export __loadds
-#else
-NSPR_API(PRTime) 
-#endif
+NSPR_API(PRTime)
 PR_Now(void);
 
 /*
  * Expand time binding it to time parameters provided by PRTimeParamFn.
  * The calculation is envisoned to proceed in the following steps:
  *   - From given PRTime, calculate PRExplodedTime in GMT
  *   - Apply the given PRTimeParamFn to the GMT that we just calculated
  *     to obtain PRTimeParameters.
  *   - Add the PRTimeParameters offsets to GMT to get the local time
  *     as PRExplodedTime.
  */
 
 NSPR_API(void) PR_ExplodeTime(
     PRTime usecs, PRTimeParamFn params, PRExplodedTime *exploded);
 
 /* Reverse operation of PR_ExplodeTime */
-#if defined(HAVE_WATCOM_BUG_2)
-PRTime __pascal __export __loadds
-#else
-NSPR_API(PRTime) 
-#endif
+NSPR_API(PRTime)
 PR_ImplodeTime(const PRExplodedTime *exploded);
 
 /*
  * Adjust exploded time to normalize field overflows after manipulation.
  * Note that the following fields of PRExplodedTime should not be
  * manipulated:
  *   - tm_month and tm_year: because the number of days in a month and
  *     number of days in a year are not constant, it is ambiguous to
@@ -293,17 +285,17 @@ NSPR_API(PRStatus) PR_ParseTimeString (
  */
 
 /**********************************************************************/
 /*********************** OLD COMPATIBILITYFUNCTIONS *******************/
 /**********************************************************************/
 #ifndef NO_NSPR_10_SUPPORT
 
 /* Format a time value into a buffer. Same semantics as strftime() */
-NSPR_API(PRUint32) PR_FormatTime(char *buf, int buflen, const char *fmt, 
+NSPR_API(PRUint32) PR_FormatTime(char *buf, int buflen, const char *fmt,
                                            const PRExplodedTime *tm);
 
 /* Format a time value into a buffer. Time is always in US English format, regardless
  * of locale setting.
  */
 NSPR_API(PRUint32)
 PR_FormatTimeUSEnglish( char* buf, PRUint32 bufSize,
                         const char* format, const PRExplodedTime* tm );
--- a/nsprpub/pr/include/prtypes.h
+++ b/nsprpub/pr/include/prtypes.h
@@ -107,49 +107,16 @@
 #define PR_IMPLEMENT(__type) __declspec(dllexport) __type
 #define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
 #define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
 
 #define PR_CALLBACK
 #define PR_CALLBACK_DECL
 #define PR_STATIC_CALLBACK(__x) static __x
 
-#elif defined(WIN16)
-
-#define PR_CALLBACK_DECL        __cdecl
-
-#if defined(_WINDLL)
-#define PR_EXPORT(__type) extern __type _cdecl _export _loadds
-#define PR_IMPORT(__type) extern __type _cdecl _export _loadds
-#define PR_EXPORT_DATA(__type) extern __type _export
-#define PR_IMPORT_DATA(__type) extern __type _export
-
-#define PR_EXTERN(__type) extern __type _cdecl _export _loadds
-#define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
-#define PR_EXTERN_DATA(__type) extern __type _export
-#define PR_IMPLEMENT_DATA(__type) __type _export
-
-#define PR_CALLBACK             __cdecl __loadds
-#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
-
-#else /* this must be .EXE */
-#define PR_EXPORT(__type) extern __type _cdecl _export
-#define PR_IMPORT(__type) extern __type _cdecl _export
-#define PR_EXPORT_DATA(__type) extern __type _export
-#define PR_IMPORT_DATA(__type) extern __type _export
-
-#define PR_EXTERN(__type) extern __type _cdecl _export
-#define PR_IMPLEMENT(__type) __type _cdecl _export
-#define PR_EXTERN_DATA(__type) extern __type _export
-#define PR_IMPLEMENT_DATA(__type) __type _export
-
-#define PR_CALLBACK             __cdecl __loadds
-#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
-#endif /* _WINDLL */
-
 #elif defined(XP_MAC)
 
 #define PR_EXPORT(__type) extern __declspec(export) __type
 #define PR_EXPORT_DATA(__type) extern __declspec(export) __type
 #define PR_IMPORT(__type) extern __declspec(export) __type
 #define PR_IMPORT_DATA(__type) extern __declspec(export) __type
 
 #define PR_EXTERN(__type) extern __declspec(export) __type
@@ -382,22 +349,24 @@ typedef long PRInt32;
 ** DESCRIPTION:
 **  The int64 types are known to be 64 bits each. Care must be used when
 **      declaring variables of type PRUint64 or PRInt64. Different hardware
 **      architectures and even different compilers have varying support for
 **      64 bit values. The only guaranteed portability requires the use of
 **      the LL_ macros (see prlong.h).
 ************************************************************************/
 #ifdef HAVE_LONG_LONG
-#if PR_BYTES_PER_LONG == 8
+/*
+ * On 64-bit Mac OS X, uint64 needs to be defined as unsigned long long to
+ * match uint64_t, otherwise our uint64 typedef conflicts with the uint64
+ * typedef in cssmconfig.h, which CoreServices.h includes indirectly.
+ */
+#if PR_BYTES_PER_LONG == 8 && !defined(__APPLE__)
 typedef long PRInt64;
 typedef unsigned long PRUint64;
-#elif defined(WIN16)
-typedef __int64 PRInt64;
-typedef unsigned __int64 PRUint64;
 #elif defined(WIN32) && !defined(__GNUC__)
 typedef __int64  PRInt64;
 typedef unsigned __int64 PRUint64;
 #else
 typedef long long PRInt64;
 typedef unsigned long long PRUint64;
 #endif /* PR_BYTES_PER_LONG == 8 */
 #else  /* !HAVE_LONG_LONG */
--- a/nsprpub/pr/src/bthreads/btlocks.c
+++ b/nsprpub/pr/src/bthreads/btlocks.c
@@ -109,8 +109,15 @@ PR_IMPLEMENT(PRStatus)
     lock->owner = NULL;
     if( atomic_add( &lock->benaphoreCount, -1 ) > 1 ) {
 
 	release_sem_etc( lock->semaphoreID, 1, B_DO_NOT_RESCHEDULE );
     }
 
     return PR_SUCCESS;
 }
+
+PR_IMPLEMENT(void)
+    PR_AssertCurrentThreadOwnsLock(PRLock *lock)
+{
+    PR_ASSERT(lock != NULL);
+    PR_ASSERT(lock->owner == find_thread( NULL ));
+}
--- a/nsprpub/pr/src/bthreads/btmon.c
+++ b/nsprpub/pr/src/bthreads/btmon.c
@@ -206,14 +206,28 @@ PR_IMPLEMENT(PRStatus)
     {
 	return( PR_FAILURE );
     }
 
     PR_NotifyAllCondVar( mon->cvar );
     return( PR_SUCCESS );
 }
 
+/*
+** Return the number of times that the current thread has entered the
+** lock. Returns zero if the current thread has not entered the lock.
+*/
 PR_IMPLEMENT(PRIntn)
     PR_GetMonitorEntryCount(PRMonitor *mon)
 {
-    return( mon->entryCount );
+    return( (mon->cvar->lock->owner == find_thread( NULL )) ?
+            mon->entryCount : 0 );
 }
 
+/*
+** If the current thread is in |mon|, this assertion is guaranteed to
+** succeed.  Otherwise, the behavior of this function is undefined.
+*/
+PR_IMPLEMENT(void)
+    PR_AssertCurrentThreadInMonitor(PRMonitor *mon)
+{
+    PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(mon->cvar->lock);
+}
--- a/nsprpub/pr/src/linking/prlink.c
+++ b/nsprpub/pr/src/linking/prlink.c
@@ -151,17 +151,17 @@ 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(USE_MACH_DYLD)) \
-    || defined(NEXTSTEP) || defined(WIN16) || defined(XP_OS2) \
+    || defined(NEXTSTEP) || defined(XP_OS2) \
     || ((defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__))
 #define NEED_LEADING_UNDERSCORE
 #endif
 
 #define PR_LD_PATHW 0x8000  /* for PR_LibSpec_PathnameU */
 
 /************************************************************************/
 
@@ -309,64 +309,35 @@ void _PR_InitLinker(void)
     if (lm) {
         PR_LOG(_pr_linker_lm, PR_LOG_MIN,
             ("Loaded library %s (init)", lm->name));
     }
 
     PR_ExitMonitor(pr_linker_lock);
 }
 
-#if defined(WIN16)
 /*
- * _PR_ShutdownLinker unloads all dlls loaded by the application via
- * calls to PR_LoadLibrary
- */
-void _PR_ShutdownLinker(void)
-{
-    PR_EnterMonitor(pr_linker_lock);
-
-    while (pr_loadmap) {
-    if (pr_loadmap->refCount > 1) {
-#ifdef DEBUG
-        fprintf(stderr, "# Forcing library to unload: %s (%d outstanding references)\n",
-            pr_loadmap->name, pr_loadmap->refCount);
-#endif
-        pr_loadmap->refCount = 1;
-    }
-    PR_UnloadLibrary(pr_loadmap);
-    }
-    
-    PR_ExitMonitor(pr_linker_lock);
-
-    PR_DestroyMonitor(pr_linker_lock);
-    pr_linker_lock = NULL;
-}
-#else
-/*
- * _PR_ShutdownLinker was originally only used on WIN16 (see above),
- * but I think it should also be used on other platforms.  However,
- * I disagree with the original implementation's unloading the dlls
- * for the application.  Any dlls that still remain on the pr_loadmap
- * list when NSPR shuts down are application programming errors.  The
- * only exception is pr_exe_loadmap, which was added to the list by
+ * _PR_ShutdownLinker does not unload the dlls loaded by the application
+ * via calls to PR_LoadLibrary.  Any dlls that still remain on the
+ * pr_loadmap list when NSPR shuts down are application programming errors.
+ * The only exception is pr_exe_loadmap, which was added to the list by
  * NSPR and hence should be cleaned up by NSPR.
  */
 void _PR_ShutdownLinker(void)
 {
     /* FIXME: pr_exe_loadmap should be destroyed. */
     
     PR_DestroyMonitor(pr_linker_lock);
     pr_linker_lock = NULL;
 
     if (_pr_currentLibPath) {
         free(_pr_currentLibPath);
         _pr_currentLibPath = NULL;
     }
 }
-#endif
 
 /******************************************************************************/
 
 PR_IMPLEMENT(PRStatus) PR_SetLibraryPath(const char *path)
 {
     PRStatus rv = PR_SUCCESS;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
@@ -900,31 +871,41 @@ pr_LoadLibraryByPathname(const char *nam
     /* 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) */
     int dl_flags = RTLD_MEMBER;
 #else
     int dl_flags = 0;
 #endif
-    void *h;
+    void *h = NULL;
 
     if (flags & PR_LD_LAZY) {
         dl_flags |= RTLD_LAZY;
     }
     if (flags & PR_LD_NOW) {
         dl_flags |= RTLD_NOW;
     }
     if (flags & PR_LD_GLOBAL) {
         dl_flags |= RTLD_GLOBAL;
     }
     if (flags & PR_LD_LOCAL) {
         dl_flags |= RTLD_LOCAL;
     }
+#if defined(DARWIN)
+    /* ensure the file exists if it contains a slash character i.e. path */
+    /* DARWIN's dlopen ignores the provided path and checks for the */
+    /* plain filename in DYLD_LIBRARY_PATH */
+    if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL ||
+        PR_Access(name, PR_ACCESS_EXISTS) == PR_SUCCESS) {
+            h = dlopen(name, dl_flags);
+        }
+#else
     h = dlopen(name, dl_flags);
+#endif
 #elif defined(USE_HPSHL)
     int shl_flags = 0;
     shl_t h;
 
     /*
      * Use the DYNAMIC_PATH flag only if 'name' is a plain file
      * name (containing no directory) to match the behavior of
      * dlopen().
@@ -1208,19 +1189,19 @@ pr_FindSymbolInLib(PRLibrary *lm, const 
      */
     if (rc != NO_ERROR) {
         name++;
         DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f);
     }
 #endif
 #endif  /* XP_OS2 */
 
-#if defined(WIN32) || defined(WIN16)
+#ifdef WIN32
     f = GetProcAddress(lm->dlh, name);
-#endif  /* WIN32 || WIN16 */
+#endif  /* WIN32 */
 
 #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);
--- a/nsprpub/pr/src/md/windows/Makefile.in
+++ b/nsprpub/pr/src/md/windows/Makefile.in
@@ -41,32 +41,16 @@ MOD_DEPTH	= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
-ifeq ($(OS_TARGET), WIN16)
-CSRCS = \
-	w16null.c \
-	w16thred.c \
-	w16proc.c \
-    w16fmem.c \
-    w16sock.c \
-    w16mem.c \
-    w16io.c  \
-    w16gc.c  \
-    w16error.c  \
-    w16stdio.c  \
-    w16callb.c \
-    ntinrval.c \
-    $(NULL)
-else
 ifeq (,$(filter-out WIN95 WINCE, $(OS_TARGET)))
 CSRCS =          \
     ntmisc.c \
     ntsec.c   \
     ntsem.c   \
     ntinrval.c \
     ntgc.c \
 	w95thred.c \
@@ -92,17 +76,16 @@ CSRCS =          \
     ntio.c    \
 	win32_errors.c \
     w32ipcsem.c \
     w32poll.c \
     w32rng.c \
     w32shm.c \
     $(NULL)
 endif
-endif
 
 TARGETS	= $(OBJS)
 
 INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES += -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
--- a/nsprpub/pr/src/md/windows/objs.mk
+++ b/nsprpub/pr/src/md/windows/objs.mk
@@ -63,30 +63,16 @@ CSRCS =	ntmisc.c \
 	w95sock.c \
 	win32_errors.c \
 	w32ipcsem.c \
 	w32poll.c \
 	w32rng.c \
 	w32shm.c \
 	w95dllmain.c
 else
-ifeq ($(OS_TARGET),WIN16)
-CSRCS =	w16null.c \
-	w16thred.c \
-	w16proc.c \
-	w16fmem.c \
-	w16sock.c \
-	w16mem.c \
-	w16io.c \
-	w16gc.c \
-	w16error.c \
-	w16stdio.c \
-	w16callb.c \
-	ntinrval.c
-endif # win16
 endif # win95
 endif # winnt
 
 CSRCS	+= $(PR_MD_CSRCS)
 ASFILES += $(PR_MD_ASFILES)
 
 OBJS += $(addprefix md/windows/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)))  \
 	$(addprefix md/windows/$(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX)))
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16callb.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
-** w16callb.c -- Implement Win16 Callback functions
-**
-** Functions here are to replace functions normally in
-** LIBC which are not implemented in MSVC's LIBC.
-** Some clients of NSPR expect to statically link
-** to NSPR and get these functions.
-**
-** Some are implemented as callbacks to the .EXE
-** some are implemented directly in this module.
-**
-*/
-
-#include "primpl.h"
-#include "windowsx.h"
-
-/*
-** _pr_callback_funcs -- This is where clients register the 
-** callback function structure.
-*/
-struct PRMethodCallbackStr * _pr_callback_funcs;
-
-/*
-** PR_MDInitWin16() -- Register the PRMethodCallback table pointer
-** 
-*/
-void PR_MDRegisterCallbacks(struct PRMethodCallbackStr *f)
-{
-    _pr_callback_funcs = f;
-}
-
-/*
-** NSPR re-implenentations of various C runtime functions:
-*/
-
-/*
-** PR_MD_printf() -- exported as printf()
-**
-*/
-int  PR_MD_printf(const char *fmt, ...)
-{
-    char buffer[1024];
-    int ret = 0;
-    va_list args;
-
-    va_start(args, fmt);
-
-#ifdef DEBUG
-    PR_vsnprintf(buffer, sizeof(buffer), fmt, args);
-    {   
-        if (_pr_callback_funcs != NULL && _pr_callback_funcs->auxOutput != NULL) {
-            (* _pr_callback_funcs->auxOutput)(buffer);
-        } else {
-            OutputDebugString(buffer);
-        }
-    }
-#endif
-
-    va_end(args);
-    return ret;
-}
-
-/*
-** PR_MD_sscanf() -- exported as sscanf()
-**
-*/
-int  PR_MD_sscanf(const char *buf, const char *fmt, ...)
-{
-	int		retval;
-	va_list	arglist;
-
-	va_start(arglist, fmt);
-	retval = vsscanf((const unsigned char *)buf, (const unsigned char *)fmt, arglist);
-	va_end(arglist);
-	return retval;
-}
-
-/*
-** PR_MD_strftime() -- exported as strftime
-**
-*/
-size_t PR_MD_strftime(char *s, size_t len, const char *fmt, const struct tm *p) 
-{
-    if( _pr_callback_funcs ) {
-        return (*_pr_callback_funcs->strftime)(s, len, fmt, p);
-    } else {
-        PR_ASSERT(0);
-        return 0;
-    }
-}
-
-
-/*
-** PR_MD_malloc() -- exported as malloc()
-**
-*/
-void *PR_MD_malloc( size_t size )
-{
-    if( _pr_callback_funcs ) {
-        return (*_pr_callback_funcs->malloc)( size );
-    } else {
-        return GlobalAllocPtr(GPTR, (DWORD)size);
-    }
-} /* end malloc() */
-
-/*
-** PR_MD_calloc() -- exported as calloc()
-**
-*/
-void *PR_MD_calloc( size_t n, size_t size )
-{
-    void *p;
-    size_t sz;
-    
-    if( _pr_callback_funcs ) {
-        return (*_pr_callback_funcs->calloc)( n, size );
-    } else {
-        sz = n * size;
-        p = GlobalAllocPtr(GPTR, (DWORD)sz );
-        memset( p, 0x00, sz );
-        return p;
-    }
-} /* end calloc() */
-
-/*
-** PR_MD_realloc() -- exported as realloc()
-**
-*/
-void *PR_MD_realloc( void* old_blk, size_t size )
-{
-    if( _pr_callback_funcs ) {
-        return (*_pr_callback_funcs->realloc)( old_blk, size );
-    } else {
-        return GlobalReAllocPtr( old_blk, (DWORD)size, GPTR);
-    }
-} /* end realloc */
-
-/*
-** PR_MD_free() -- exported as free()
-**
-*/
-void PR_MD_free( void *ptr )
-{
-    if( _pr_callback_funcs ) {
-        (*_pr_callback_funcs->free)( ptr );
-        return;
-    } else {
-        GlobalFreePtr( ptr );
-        return;
-    }
-} /* end free() */
-
-/*
-** PR_MD_getenv() -- exported as getenv()
-**
-*/
-char *PR_MD_getenv( const char *name )
-{
-    if( _pr_callback_funcs ) {
-        return (*_pr_callback_funcs->getenv)( name );
-    } else {
-        return 0;
-    }
-} /* end getenv() */
-
-
-/*
-** PR_MD_perror() -- exported as perror()
-**
-** well, not really (lth. 12/5/97).
-** XXX hold this thought.
-**
-*/
-void PR_MD_perror( const char *prefix )
-{
-    return;
-} /* end perror() */
-
-/*
-** PR_MD_putenv() -- exported as putenv()
-**
-*/
-int  PR_MD_putenv(const char *assoc)
-{
-    if( _pr_callback_funcs ) {
-        return (*_pr_callback_funcs->putenv)(assoc);
-    } else {
-        PR_ASSERT(0);
-        return NULL;
-    }
-}
-
-/*
-** PR_MD_fprintf() -- exported as fprintf()
-**
-*/
-int  PR_MD_fprintf(FILE *fPtr, const char *fmt, ...)
-{
-    char buffer[1024];
-    va_list args;
-
-    va_start(args, fmt);
-    PR_vsnprintf(buffer, sizeof(buffer), fmt, args);
-
-    if (fPtr == NULL) 
-    {
-        if (_pr_callback_funcs != NULL && _pr_callback_funcs->auxOutput != NULL) 
-        {
-            (* _pr_callback_funcs->auxOutput)(buffer);
-        } 
-        else 
-        {
-            OutputDebugString(buffer);
-        }
-    } 
-    else 
-    {
-        fwrite(buffer, 1, strlen(buffer), fPtr); /* XXX Is this a sec. hole? */
-    }
-
-    va_end(args);
-    return 0;
-}
-
-/* end w16callb.c */
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16error.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
-** Note: A single error mapping function is provided.
-**
-*/ 
-#include "prerror.h"
-#include <errno.h>
-#include <winsock.h>
-
-
-void _PR_MD_map_error( int err )
-{
-
-    switch ( err )
-    {
-        case  ENOENT:   /* No such file or directory */
-			PR_SetError(PR_FILE_NOT_FOUND_ERROR, err);
-            break;
-        case  E2BIG:    /* Argument list too big */
-            PR_SetError( PR_INVALID_ARGUMENT_ERROR, err );
-            break;
-        case  ENOEXEC:  /* Exec format error */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EBADF:    /* Bad file number */
-            PR_SetError( PR_BAD_DESCRIPTOR_ERROR, err );
-            break;
-        case  ENOMEM:   /* Not enough Memory */
-            PR_SetError( PR_OUT_OF_MEMORY_ERROR, err );
-            break;
-        case  EACCES:   /* Permission denied */
-            PR_SetError( PR_NO_ACCESS_RIGHTS_ERROR, err );
-            break;
-        case  EEXIST:   /* File exists */
-        
- /* RESTART here */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EXDEV:    /* Cross device link */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EINVAL:   /* Invalid argument */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENFILE:   /* File table overflow */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EMFILE:   /* Too many open files */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENOSPC:   /* No space left on device */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        /* math errors */
-        case  EDOM:     /* Argument too large */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ERANGE:   /* Result too large */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        /* file locking error */
-        case  EDEADLK:      /* Resource deadlock would occur */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EINTR:    /* Interrupt */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ECHILD:   /* Child does not exist */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        /* POSIX errors */
-        case  EAGAIN:   /* Resource unavailable, try again */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EBUSY:    /* Device or Resource is busy */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EFBIG:    /* File too large */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EIO:      /* I/O error */
-            PR_SetError( PR_IO_ERROR, err );
-            break;
-        case  EISDIR:   /* Is a directory */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENOTDIR:  /* Not a directory */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EMLINK:   /* Too many links */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENOTBLK:  /* Block device required */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENOTTY:   /* Not a character device */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENXIO:    /* No such device or address */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EPERM:    /* Not owner */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EPIPE:    /* Broken pipe */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EROFS:    /* Read only file system */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ESPIPE:   /* Illegal seek */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ESRCH:    /* No such process */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ETXTBSY:  /* Text file busy */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  EFAULT:   /* Bad address */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENAMETOOLONG: /* Name too long */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENODEV:   /* No such device */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENOLCK:   /* No locks available on system */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENOSYS:   /* Unknown system call */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-        case  ENOTEMPTY:    /* Directory not empty */
-        /* Normative Addendum error */
-        case  EILSEQ:   /* Multibyte/widw character encoding error */
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-            
-        /* WinSock errors */
-        case WSAEACCES:
-            PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, err);
-            break;
-        case WSAEADDRINUSE:
-            PR_SetError(PR_ADDRESS_IN_USE_ERROR, err);
-            break;
-        case WSAEADDRNOTAVAIL:
-            PR_SetError(PR_ADDRESS_NOT_AVAILABLE_ERROR, err);
-            break;
-        case WSAEAFNOSUPPORT:
-            PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
-            break;
-        case WSAEBADF:
-            PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err);
-            break;
-        case WSAECONNREFUSED:
-            PR_SetError(PR_CONNECT_REFUSED_ERROR, err);
-            break;
-        case WSAEFAULT:
-            PR_SetError(PR_ACCESS_FAULT_ERROR, err);
-            break;
-        case WSAEINVAL:
-            PR_SetError(PR_BUFFER_OVERFLOW_ERROR, err);
-            break;
-        case WSAEISCONN:
-            PR_SetError(PR_IS_CONNECTED_ERROR, err);
-            break;
-        case WSAEMFILE:
-            PR_SetError(PR_PROC_DESC_TABLE_FULL_ERROR, err);
-            break;
-        case WSAENETDOWN:
-        case WSAENETUNREACH:
-            PR_SetError(PR_NETWORK_UNREACHABLE_ERROR, err);
-            break;
-        case WSAENOBUFS:
-            PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
-            break;
-        case WSAENOPROTOOPT:
-        case WSAEMSGSIZE:
-            PR_SetError(PR_INVALID_ARGUMENT_ERROR, err);
-            break;
-        case WSAENOTCONN:
-            PR_SetError(PR_NOT_CONNECTED_ERROR, err);
-            break;
-        case WSAENOTSOCK:
-            PR_SetError(PR_NOT_SOCKET_ERROR, err);
-            break;
-        case WSAEOPNOTSUPP:
-            PR_SetError(PR_NOT_TCP_SOCKET_ERROR, err);
-            break;
-        case WSAEPROTONOSUPPORT:
-            PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
-            break;
-        case WSAETIMEDOUT:
-            PR_SetError(PR_IO_TIMEOUT_ERROR, err);
-            break;
-        case WSAEINTR:
-            PR_SetError(PR_PENDING_INTERRUPT_ERROR, err );
-            break;
-        case WSASYSNOTREADY:
-        case WSAVERNOTSUPPORTED:
-            PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
-            break;
-		case WSAEWOULDBLOCK:
-			PR_SetError(PR_WOULD_BLOCK_ERROR, err);
-			break;
-            
-        default:
-            PR_SetError( PR_UNKNOWN_ERROR, err );
-            break;
-    }
-    return;
-} /* end _MD_map_win16_error() */
-
-
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16fmem.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "primpl.h"
-
-/*
- **********************************************************************
- *
- * Memory-mapped files are not implemented on Win16.
- *
- **********************************************************************
- */
-
-PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return PR_FAILURE;
-}
-
-PRInt32 _MD_GetMemMapAlignment(void)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return -1;
-}
-
-void * _MD_MemMap(
-    PRFileMap *fmap,
-    PRInt64 offset,
-    PRUint32 len)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return NULL;
-}
-
-PRStatus _MD_MemUnmap(void *addr, PRUint32 len)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return PR_FAILURE;
-}
-
-PRStatus _MD_CloseFileMap(PRFileMap *fmap)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return PR_FAILURE;
-}
-
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16gc.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "primpl.h"
-#include <sys/timeb.h>
-
-PRWord *
-_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) 
-{
-    if (isCurrent) 
-    {
-        _MD_SAVE_CONTEXT(t);
-    }
-    /*
-    ** In Win16 because the premption is "cooperative" it can never be the 
-    ** case that a register holds the sole reference to an object.  It
-    ** will always have been pushed onto the stack before the thread
-    ** switch...  So don't bother to scan the registers...
-    */
-    *np = 0;
-
-    return (PRWord *) CONTEXT(t);
-}
-
-#if 0
-#ifndef SPORT_MODEL
-
-#define MAX_SEGMENT_SIZE (65536l - 4096l)
-
-/************************************************************************/
-/*
-** Machine dependent GC Heap management routines:
-**    _MD_GrowGCHeap
-*/
-/************************************************************************/
-
-extern void *
-_MD_GrowGCHeap(uint32 *sizep)
-{
-    void *addr;
-
-    if( *sizep > MAX_SEGMENT_SIZE ) {
-        *sizep = MAX_SEGMENT_SIZE;
-    }
-
-    addr = malloc((size_t)*sizep);
-    return addr;
-}
-
-#endif /* SPORT_MODEL */
-#endif /* 0 */
-
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16io.c
+++ /dev/null
@@ -1,855 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "primpl.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <share.h>
-#include <sys/locking.h>
-
-
-/*
-** Sleep this many milliseconds on each I/O operation
-** to cause an intentional thread switch. 
-*/
-#define _PR_MD_WIN16_DELAY 1
-
-
-/*
-** PR_MD_RegisterW16StdioCallbacks() -- Register Win16 stdio callback functions
-**
-** This public function call is unique to Win16. 
-** ... Sigh ... So much for platform independence.
-** 
-** To get stdio to work from a command line executable, the stdio stream
-** calls must be issued from the .EXE file; calling them from the .DLL
-** sends the output to the bit-bucket. Therefore, the .EXE wanting to
-** do stdio to the console window (must be built as a "quickwin" application)
-** must have the wrapper functions defined in this module statically linked
-** into the .EXE.
-**
-** There appears to be nothing you can do to get stdio to work from a
-** Win16 GUI application. Oh Well!
-**
-*/
-PRStdinRead   _pr_md_read_stdin = 0;
-PRStdoutWrite _pr_md_write_stdout = 0;
-PRStderrWrite _pr_md_write_stderr = 0;
-
-PRStatus
-PR_MD_RegisterW16StdioCallbacks( PRStdinRead inReadf, PRStdoutWrite outWritef, PRStderrWrite errWritef )
-{
-    _pr_md_write_stdout = outWritef;
-    _pr_md_write_stderr = errWritef;
-    _pr_md_read_stdin   = inReadf;
-    
-    return(PR_SUCCESS);
-} /* end PR_MD_RegisterW16StdioCallbacks() */
-
-
-/*
-** _PR_MD_OPEN() -- Open a file
-**
-** Returns: a fileHandle or -1
-**
-**
-*/
-PRInt32
-_PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
-{
-    PRInt32 file;
-    int     access = O_BINARY;
-    int     rights = 0;
-    
-    
-    /*
-    ** Map NSPR open flags to os open flags
-    */
-    if (osflags & PR_RDONLY )
-        access |= O_RDONLY;
-    if (osflags & PR_WRONLY )
-        access |= O_WRONLY;
-    if (osflags & PR_RDWR )
-        access |= O_RDWR;
-    if (osflags & PR_CREATE_FILE )
-    {
-        access |= O_CREAT;
-        rights |= S_IRWXU;
-    }
-    if (osflags & PR_TRUNCATE)
-        access |= O_TRUNC;
-    if (osflags & PR_APPEND)
-        access |= O_APPEND;
-    else
-        access |= O_RDONLY;
-        
-    /*
-    ** Open the file
-    */        
-    file = (PRInt32) sopen( name, access, SH_DENYNO, rights );
-    if ( -1 == (PRInt32)file )
-    {
-        _PR_MD_MAP_OPEN_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return file;
-}
-
-/*
-** _PR_MD_READ() - Read something
-**
-** Returns: bytes read or -1
-**
-*/
-PRInt32
-_PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len)
-{
-    PRInt32     rv;
-    
-    if ( (PR_GetDescType(fd) == PR_DESC_FILE) &&
-         ( fd->secret->md.osfd == PR_StandardInput ) &&
-         ( _pr_md_write_stdout ))
-    {
-        rv = (*_pr_md_read_stdin)( buf, len);    
-    }
-    else
-    {
-        rv = read( fd->secret->md.osfd, buf, len );
-    }
-    
-    if ( rv == -1)
-    {
-        _PR_MD_MAP_READ_ERROR( errno );
-    }
-    
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return rv;
-}
-
-/*
-** _PR_MD_WRITE() - Write something
-**
-** Returns:  bytes written or -1
-**
-** Note: for file handles 1 and 2 (stdout and stderr)
-** call the Win16 NSPR stdio callback functions, if they are 
-** registered.
-**
-*/
-PRInt32
-_PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len)
-{
-    PRInt32     rv;
-
-    if ( (PR_GetDescType(fd) == PR_DESC_FILE))
-    {
-        switch ( fd->secret->md.osfd )
-        {
-            case  PR_StandardOutput :
-                if ( _pr_md_write_stdout )
-                    rv = (*_pr_md_write_stdout)( (void *)buf, len);
-                else
-                    rv = len; /* fake success */
-                break;
-                
-            case  PR_StandardError  :
-                if ( _pr_md_write_stderr )
-                    rv = (*_pr_md_write_stderr)( (void *)buf, len);    
-                else
-                    rv = len; /* fake success */
-                break;
-                
-            default:
-                rv = write( fd->secret->md.osfd, buf, len );
-                if ( rv == -1 )
-                {
-                    _PR_MD_MAP_WRITE_ERROR( errno );
-                }
-                break;
-        }
-    }
-    else
-    {
-        rv = write( fd->secret->md.osfd, buf, len );
-        if ( rv == -1 )
-        {
-            _PR_MD_MAP_WRITE_ERROR( errno );
-        }
-    }
-    
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return rv;
-} /* --- end _PR_MD_WRITE() --- */
-
-/*
-** _PR_MD_LSEEK() - Seek to position in a file
-**
-** Note: 'whence' maps directly to PR_...
-**
-** Returns:
-**
-*/
-PRInt32
-_PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, int whence)
-{
-    PRInt32     rv;
-    
-    rv = lseek( fd->secret->md.osfd, offset, whence );
-    if ( rv == -1 )
-    {
-        _PR_MD_MAP_LSEEK_ERROR( errno );
-        
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return( rv );
-}
-
-/*
-** _PR_MD_LSEEK64() -- Seek to position in file, 64bit offset.
-**
-*/
-PRInt64
-_PR_MD_LSEEK64( PRFileDesc *fd, PRInt64 offset, int whence )
-{
-    PRInt64 test;
-    PRInt32 rv, off;
-    LL_SHR(test, offset, 32);
-    if (!LL_IS_ZERO(test))
-    {
-        PR_SetError(PR_FILE_TOO_BIG_ERROR, 0);
-        LL_I2L(test, -1);
-        return test;
-    }
-    LL_L2I(off, offset);
-    rv = _PR_MD_LSEEK(fd, off, whence);
-    LL_I2L(test, rv);
-    return test;
-} /* end _PR_MD_LSEEK64() */
-
-/*
-** _PR_MD_FSYNC() - Flush file buffers.
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_FSYNC(PRFileDesc *fd)
-{
-    PRInt32     rv;
-    
-    rv = (PRInt32) fsync( fd->secret->md.osfd );
-    if ( rv == -1 )
-    {
-        _PR_MD_MAP_FSYNC_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return(rv);
-}
-
-/*
-** _PR_MD_CLOSE() - Close an open file handle
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_CLOSE_FILE(PRInt32 osfd)
-{
-    PRInt32     rv;
-    
-    rv = (PRInt32) close( osfd );
-    if ( rv == -1 )
-    {
-        _PR_MD_MAP_CLOSE_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return(rv);
-} /* --- end _MD_CloseFile() --- */
-
-
-/* --- DIR IO ------------------------------------------------------------ */
-#define GetFileFromDIR(d)       (d)->d_entry.cFileName
-
-/*
-** FlipSlashes() - Make forward slashes ('/') into backslashes
-**
-** Returns: void
-**
-**
-*/
-void FlipSlashes(char *cp, int len)
-{
-    while (--len >= 0) {
-    if (cp[0] == '/') {
-        cp[0] = PR_DIRECTORY_SEPARATOR;
-    }
-    cp++;
-    }
-}
-
-
-/*
-** _PR_MD_OPEN_DIR() - Open a Directory.
-**
-** Returns:
-**
-**
-*/
-PRStatus
-_PR_MD_OPEN_DIR(_MDDir *d, const char *name)
-{
-    d->dir = opendir( name );
-    
-    if ( d->dir == NULL )
-    {
-        _PR_MD_MAP_OPENDIR_ERROR( errno );
-        return( PR_FAILURE );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return( PR_SUCCESS );
-}
-
-
-/*
-** _PR_MD_READ_DIR() - read next directory entry
-**
-**
-*/
-char *
-_PR_MD_READ_DIR(_MDDir *d, PRIntn flags)
-{
-    struct dirent *de;
-    int err;
-
-	for (;;) 
-    {
-		de = readdir( d->dir );
-		if ( de == NULL ) {
-			_PR_MD_MAP_READDIR_ERROR( errno);
-			return 0;
-		}		
-		if ((flags & PR_SKIP_DOT) &&
-		    (de->d_name[0] == '.') && (de->d_name[1] == 0))
-			continue;
-		if ((flags & PR_SKIP_DOT_DOT) &&
-		    (de->d_name[0] == '.') && (de->d_name[1] == '.') &&
-		    (de->d_name[2] == 0))
-			continue;
-		break;
-	}
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-	return de->d_name;
-}
-
-/*
-** _PR_MD_CLOSE_DIR() - Close a directory.
-**
-**
-*/
-PRInt32
-_PR_MD_CLOSE_DIR(_MDDir *d)
-{
-    PRInt32     rv;
-    
-    if ( d->dir ) 
-    {
-        rv = closedir( d->dir );
-        if (rv != 0) 
-        {
-            _PR_MD_MAP_CLOSEDIR_ERROR( errno );
-        }
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return rv;
-}
-
-
-/*
-** _PR_MD_DELETE() - Delete a file.
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_DELETE(const char *name)
-{
-    PRInt32     rv;
-    
-    rv = (PRInt32) remove( name );
-    if ( rv != 0 )
-    {
-        _PR_MD_MAP_DELETE_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return(rv);
-}
-
-
-/*
-** _PR_MD_STAT() - Get file attributes by filename
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_STAT(const char *fn, struct stat *info)
-{
-    PRInt32     rv;
-    
-    rv = _stat(fn, (struct _stat *)info);
-    if ( rv == -1 )
-    {
-        _PR_MD_MAP_STAT_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return( rv );
-}
-
-/*
-** _PR_MD_GETFILEINFO() - Get file attributes by filename
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_GETFILEINFO(const char *fn, PRFileInfo *info)
-{
-    struct _stat sb;
-    PRInt32 rv;
- 
-    if ( (rv = _stat(fn, &sb)) == 0 ) {
-        if (info) {
-            if (S_IFREG & sb.st_mode)
-                info->type = PR_FILE_FILE ;
-            else if (S_IFDIR & sb.st_mode)
-                info->type = PR_FILE_DIRECTORY;
-            else
-                info->type = PR_FILE_OTHER;
-            info->size = sb.st_size;
-            LL_I2L(info->modifyTime, sb.st_mtime);
-            LL_I2L(info->creationTime, sb.st_ctime);
-        }
-    }
-    else
-    {
-        _PR_MD_MAP_STAT_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return rv;
-}
-
-PRInt32
-_PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info)
-{
-    PRFileInfo info32;
-    
-    PRInt32 rv = _PR_MD_GETFILEINFO(fn, &info32);
-    if (0 == rv)
-    {
-        info->type = info32.type;
-        info->modifyTime = info32.modifyTime;
-        info->creationTime = info32.creationTime;
-        LL_I2L(info->size, info32.size);
-    }
-    return(rv);
-}
-
-/*
-** _PR_MD_GETOPENFILEINFO() - Get file attributes from an open file handle
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_GETOPENFILEINFO(const PRFileDesc *fd, PRFileInfo *info)
-{
-    struct stat statBuf;
-    PRInt32 rv = PR_SUCCESS;
-    
-    rv = fstat( fd->secret->md.osfd, &statBuf );
-    if ( rv == 0)
-    {
-        if (statBuf.st_mode & S_IFREG )
-            info->type = PR_FILE_FILE;
-        else if ( statBuf.st_mode & S_IFDIR )
-            info->type = PR_FILE_DIRECTORY;
-        else
-            info->type = PR_FILE_OTHER;
-        info->size = statBuf.st_size;
-        LL_I2L(info->modifyTime, statBuf.st_mtime);
-        LL_I2L(info->creationTime, statBuf.st_ctime);
-        
-    }
-    else
-    {
-        _PR_MD_MAP_FSTAT_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return(rv);
-}
-
-PRInt32
-_PR_MD_GETOPENFILEINFO64(const PRFileDesc *fd, PRFileInfo64 *info)
-{
-    PRFileInfo info32;
-    
-    PRInt32 rv = _PR_MD_GETOPENFILEINFO(fd, &info32);
-    if (0 == rv)
-    {
-        info->type = info32.type;
-        info->modifyTime = info32.modifyTime;
-        info->creationTime = info32.creationTime;
-        LL_I2L(info->size, info32.size);
-    }
-    return(rv);
-}
-
-/*
-** _PR_MD_RENAME() - Rename a file
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_RENAME(const char *from, const char *to)
-{
-    PRInt32 rv;
-    
-    rv = rename( from, to );
-    if ( rv == -1 )
-    {
-        _PR_MD_MAP_RENAME_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return( rv );
-}
-
-/*
-** _PR_MD_ACCESS() - Return file acesss attribute.
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_ACCESS(const char *name, PRIntn how)
-{
-    PRInt32     rv;
-    int         mode = 0;
-    
-    if ( how & PR_ACCESS_WRITE_OK )
-        mode |= W_OK;
-    if ( how & PR_ACCESS_READ_OK )
-        mode |= R_OK;
-        
-    rv = (PRInt32) access( name, mode );        
-    if ( rv == -1 )
-    {
-        _PR_MD_MAP_ACCESS_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return(rv);
-}
-
-/*
-** _PR_MD_MKDIR() - Make a directory
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_MKDIR(const char *name, PRIntn mode)
-{
-    PRInt32 rv;
-        
-    rv = mkdir( name );
-    if ( rv == 0 )
-    {
-        PR_Sleep( _PR_MD_WIN16_DELAY );    
-        return PR_SUCCESS;
-    }
-    else
-    {
-        _PR_MD_MAP_MKDIR_ERROR( errno );
-        PR_Sleep( _PR_MD_WIN16_DELAY );    
-        return PR_FAILURE;
-    }
-}
-
-/*
-** _PR_MD_RMDIR() - Delete a directory
-**
-** Returns:
-**
-**
-*/
-PRInt32
-_PR_MD_RMDIR(const char *name)
-{
-    PRInt32 rv;
-    
-    rv = (PRInt32) rmdir( name );
-    if ( rv == -1 )
-    {
-        _PR_MD_MAP_RMDIR_ERROR( errno );
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return(rv);
-}
-
-/*
-** _PR_MD_LOCKFILE() - Lock a file.
-**
-** The _locking() call locks relative to the current file pointer.
-** This function is required to lock all of the file, so,
-** 1. Seek to the beginning of the file, preserving the original position.
-** 2. Lock the file, pausing if it is locked by someone else, and
-**    try again.
-** 3. Re-position to the original position in the file.
-**
-** For unlocking, a similar protocol of positioning is required.
-**
-*/
-PRStatus
-_PR_MD_LOCKFILE(PRInt32 f)
-{
-    PRInt32 rv = PR_SUCCESS;    /* What we return to our caller */
-    long    seekOrigin;         /* original position in file */
-    PRInt32 rc;                 /* what the system call returns to us */
-
-    /*
-    ** Seek to beginning of file, saving original position.
-    */    
-    seekOrigin = lseek( f, 0l, SEEK_SET );
-    if ( rc == -1 )
-    {
-        _PR_MD_MAP_LSEEK_ERROR( errno );
-        return( PR_FAILURE );
-    }
-    
-    /*
-    ** Attempt to lock the file.
-    ** If someone else has it, Sleep-a-while and try again.
-    */
-    for( rc = -1; rc != 0; )
-    {
-        rc = _locking( f, _LK_NBLCK , 0x7fffffff );
-        if ( rc == -1 )
-        {
-            if ( errno == EACCES )
-            {
-                PR_Sleep( 100 );
-                continue;
-            }
-            else
-            {
-                _PR_MD_MAP_LOCKF_ERROR( errno );
-                rv = PR_FAILURE;
-                break;
-            }
-        }
-    } /* end for() */
-    
-    /*
-    ** Now that the file is locked, re-position to
-    ** the original file position.
-    **
-    */
-    rc = lseek( f, seekOrigin, SEEK_SET );
-    if ( rc == -1 )
-    {
-        _PR_MD_MAP_LSEEK_ERROR( errno );
-        rv = PR_FAILURE;
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return PR_SUCCESS;
-} /* end _PR_MD_LOCKFILE() */
-
-/*
-** _PR_MD_TLOCKFILE() - Test and Lock file.
-**
-** The _locking() call locks relative to the current file pointer.
-** This function is required to lock all of the file, so,
-** 1. Seek to the beginning of the file, preserving the original position.
-** 2. Attempt to Lock the file.
-**    If the file is locked by someone else, try NO MORE.
-** 3. Re-position to the original position in the file.
-**
-** See the discussion of _PR_MD_LOCKFILE
-**
-**
-*/
-PRStatus
-_PR_MD_TLOCKFILE(PRInt32 f)
-{
-    PRInt32 rv = PR_SUCCESS;    /* What we return */
-    long    seekOrigin;         /* original position in file */
-    PRInt32 rc;                 /* return value from system call */
-
-    /*
-    ** Seek to beginning of file, saving original position.
-    */    
-    seekOrigin = lseek( f, 0l, SEEK_SET );
-    if ( rc == -1 )
-    {
-        _PR_MD_MAP_LSEEK_ERROR( errno );
-        return( PR_FAILURE );
-    }
-    
-    /*
-    ** Attempt to lock the file. One ping; one ping only, Vasily.
-    ** If someone else has it, Reposition and return failure.
-    */
-    rc = _locking( f, _LK_NBLCK , 0x7fffffff );
-    if ( rc == -1 )
-    {
-        if ( errno != EACCES )
-            _PR_MD_MAP_LOCKF_ERROR( errno );
-        rv = PR_FAILURE;
-    }
-    
-    /*
-    ** Now that the file is locked, maybe, re-position to
-    ** the original file position.
-    */
-    rc = lseek( f, seekOrigin, SEEK_SET );
-    if ( rc == -1 )
-    {
-        _PR_MD_MAP_LSEEK_ERROR( errno );
-        rv = PR_FAILURE;
-    }
-    
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return rv;
-} /* end _PR_MD_TLOCKFILE() */
-
-
-/*
-** _PR_MD_UNLOCKFILE() - Unlock a file.
-**
-** See the discussion of _PR_MD_LOCKFILE
-**
-*/
-PRStatus
-_PR_MD_UNLOCKFILE(PRInt32 f)
-{
-    PRInt32 rv = PR_SUCCESS;    /* What we return */
-    long    seekOrigin;         /* original position in file */
-    PRInt32 rc;                 /* return value from system call */
-
-    /*
-    ** Seek to beginning of file, saving original position.
-    */    
-    seekOrigin = lseek( f, 0l, SEEK_SET );
-    if ( rc == -1 )
-    {
-        _PR_MD_MAP_LSEEK_ERROR( errno );
-        return( PR_FAILURE );
-    }
-    
-    /*
-    ** Unlock the file.
-    */
-    rc = _locking( f, _LK_UNLCK , 0x7fffffff );
-    if ( rc == -1 )
-    {
-        _PR_MD_MAP_LOCKF_ERROR( errno );
-        rv = PR_FAILURE;
-    }
-    
-    /*
-    ** Now that the file is unlocked, re-position to
-    ** the original file position.
-    */
-    rc = lseek( f, seekOrigin, SEEK_SET );
-    if ( rc == -1 )
-    {
-        _PR_MD_MAP_LSEEK_ERROR( errno );
-        rv = PR_FAILURE;
-    }
-    PR_Sleep( _PR_MD_WIN16_DELAY );    
-    return rv;
-} /* end _PR_MD_UNLOCKFILE() */
-
-/*
-** PR_Stat() -- Return status on a file
-**
-** This is a hack! ... See BugSplat: 98516 
-** Basically, this hack takes a name and stat buffer as input.
-** The input stat buffer is presumed to be a Microsoft stat buffer.
-** The functions does a Watcom stat() then maps the result to
-** the MS stat buffer. ...
-**
-*/
-PR_IMPLEMENT(PRInt32) PR_Stat(const char *name, struct stat *buf)
-{
-    PRInt32     rv;
-    _MDMSStat   *mssb = (_MDMSStat*) buf; /* this is Microsoft's stat buffer */
-    struct stat statBuf;   /* this is Watcom's stat buffer */
-
-    /* First, get Watcom's idea of stat
-    ** then reformat it into a Microsoft idea of stat
-    */
-    rv = (PRInt32) _stat( name, &statBuf);
-    if (rv == 0l )
-    {
-        mssb->st_dev = statBuf.st_dev;
-        mssb->st_ino = statBuf.st_ino; /* not used, really */
-        mssb->st_mode = statBuf.st_mode;
-        mssb->st_nlink = 1; /* always 1, says MS */
-        mssb->st_uid = statBuf.st_uid;
-        mssb->st_gid = statBuf.st_gid;
-        mssb->st_rdev = statBuf.st_rdev; /* please Gh0d! Let these be the same */
-        mssb->st_size = statBuf.st_size;
-        mssb->st_atime = statBuf.st_atime;
-        mssb->st_mtime = statBuf.st_mtime;
-        mssb->st_ctime = statBuf.st_ctime;
-    }
-    return rv;
-} /* end PR_Stat() */
-
-
-
-/* $$ end W16io.c */
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16mem.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*******************************************************************
-** w16mem.c -- Implement memory segment functions.
-**
-** 
-********************************************************************
-*/
-#include "primpl.h"
-
-
-/*
-**	Allocate a new memory segment.
-**	
-**	Return the segment's access rights and size.  
-*/
-PRStatus _MD_AllocSegment(PRSegment *seg, PRUint32 size, void *vaddr)
-{
-	PR_ASSERT(seg != 0);
-	PR_ASSERT(size != 0);
-	PR_ASSERT(vaddr == 0);
-
-	/*	
-	** Take the actual memory for the segment out of our Figment heap.
-	*/
-
-	seg->vaddr = (char *)malloc(size);
-
-	if (seg->vaddr == NULL) {
-		return PR_FAILURE;
-	}
-
-	seg->size = size;	
-
-	return PR_SUCCESS;
-} /* --- end _MD_AllocSegment() --- */
-
-
-/*
-**	Free previously allocated memory segment.
-*/
-void _MD_FreeSegment(PRSegment *seg)
-{
-	PR_ASSERT((seg->flags & _PR_SEG_VM) == 0);
-
-	if (seg->vaddr != NULL)
-		free( seg->vaddr );
-    return;
-} /* --- end _MD_FreeSegment() --- */
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16null.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "primpl.h"
-#include <sys/timeb.h>
-
-
-struct _MDLock          _pr_ioq_lock;
-HINSTANCE               _pr_hInstance = NULL;
-char *                  _pr_top_of_task_stack;
-_PRInterruptTable       _pr_interruptTable[] = { { 0 } };
-
-/*
- *-----------------------------------------------------------------------
- *
- * PR_Now --
- *
- *     Returns the current time in microseconds since the epoch.
- *     The epoch is midnight January 1, 1970 GMT.
- *     The implementation is machine dependent.  This is the
- *     implementation for Windows.
- *     Cf. time_t time(time_t *tp)
- *
- *-----------------------------------------------------------------------
- */
-
-#if defined(HAVE_WATCOM_BUG_2)
-PRTime __pascal __export __loadds
-#else
-PR_IMPLEMENT(PRTime)
-#endif
-PR_Now(void)
-{
-    PRInt64 s, ms, ms2us, s2us;
-    struct timeb b;
-
-    ftime(&b);
-    LL_I2L(ms2us, PR_USEC_PER_MSEC);
-    LL_I2L(s2us, PR_USEC_PER_SEC);
-    LL_I2L(s, b.time);
-    LL_I2L(ms, (PRInt32)b.millitm);
-    LL_MUL(ms, ms, ms2us);
-    LL_MUL(s, s, s2us);
-    LL_ADD(s, s, ms);
-    return s;       
-}
-
-
-
-char *_PR_MD_GET_ENV(const char *name)
-{
-    return NULL;
-}
-
-PRIntn
-_PR_MD_PUT_ENV(const char *name)
-{
-    return NULL;
-}
-
-int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg, 
-                      WORD cbHeapSize, LPSTR lpszCmdLine )
-{
-    _pr_hInstance = hInst;
-    return TRUE;
-}
-
-
-
-void
-_PR_MD_EARLY_INIT()
-{
-    _tzset();
-    return;
-}
-
-void
-_PR_MD_WAKEUP_CPUS( void )
-{
-    return;
-}    
-
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16proc.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "primpl.h"
-#include <sys/timeb.h>
-
-
-/* 
-** Create Process.
-*/
-PRProcess * _PR_CreateWindowsProcess(
-    const char *path,
-    char *const *argv,
-    char *const *envp,
-    const PRProcessAttr *attr)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return NULL;
-}
-
-PRStatus _PR_DetachWindowsProcess(PRProcess *process)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return PR_FAILURE;
-}
-
-PRStatus _PR_WaitWindowsProcess(PRProcess *process,
-    PRInt32 *exitCode)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return PR_FAILURE;
-}
-
-PRStatus _PR_KillWindowsProcess(PRProcess *process)
-{
-    PR_ASSERT(!"Not implemented");
-    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-    return PR_FAILURE;
-}
-
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16sock.c
+++ /dev/null
@@ -1,1170 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "primpl.h"
-
-static  int winsockNotPresent = 0;
-
-void
-_PR_MD_INIT_IO()
-{
-    int rv;
-    
-    WORD WSAVersion = 0x0101;
-    WSADATA WSAData;
-
-    rv = WSAStartup( WSAVersion, &WSAData );
-    if ( rv != 0 )
-    {
-        _PR_MD_MAP_WSASTARTUP_ERROR(WSAGetLastError());
-        winsockNotPresent = 1;
-    }
-    return;
-}
-
-void
-_PR_MD_CLEANUP_BEFORE_EXIT(void)
-{
-    int rv;
-    int err;
-    
-    rv = WSACleanup();
-    if ( rv == SOCKET_ERROR )
-    {
-        err = WSAGetLastError();
-        PR_ASSERT(0);
-    }
-    return;
-} /* end _PR_MD_CLEANUP_BEFORE_EXIT() */
-
-/* --- SOCKET IO --------------------------------------------------------- */
-
-PRStatus 
-_MD_WindowsGetHostName(char *name, PRUint32 namelen)
-{
-    PRIntn  rv;
-    PRInt32 syserror;
-    
-    rv = gethostname(name, (PRInt32) namelen);
-    if (0 == rv) {
-        return PR_SUCCESS;
-    }
-    syserror = WSAGetLastError();
-    PR_ASSERT(WSANOTINITIALISED != syserror);
-    _PR_MD_MAP_GETHOSTNAME_ERROR(syserror);
-    return PR_FAILURE;
-}
-
-
-PRInt32
-_PR_MD_SOCKET(int af, int type, int flags)
-{
-    SOCKET      sock;
-    PRUint32    one = 1;
-    PRInt32     rv;
-    PRInt32     err;
-
-    if ( winsockNotPresent )
-        return( (PRInt32)INVALID_SOCKET );
-
-    sock = socket(af, type, flags);
-
-    if (sock == INVALID_SOCKET ) 
-    {
-        int rv = GetLastError();
-        closesocket(sock);
-        _PR_MD_MAP_SOCKET_ERROR(rv);
-        return (PRInt32)INVALID_SOCKET;
-    }
-
-    /*
-    ** Make the socket Non-Blocking
-    */
-    rv = ioctlsocket( sock, FIONBIO, &one);
-    if ( rv != 0 )
-    {
-        err = WSAGetLastError();
-        return -1;
-    }
-
-    return (PRInt32)sock;
-}
-
-
-PRInt32
-_PR_MD_SOCKETAVAILABLE(PRFileDesc *fd)
-{
-    PRUint32 result;
-
-    if (ioctlsocket(fd->secret->md.osfd, FIONREAD, &result) < 0) {
-        PR_SetError(PR_BAD_DESCRIPTOR_ERROR, WSAGetLastError());
-        return -1;
-    }
-    return result;
-}
-
-
-/*
-** _MD_CloseSocket() -- Close a socket
-**
-*/
-PRInt32
-_PR_MD_CLOSE_SOCKET(PRInt32 osfd)
-{
-    PRInt32 rv;
-
-    rv = closesocket((SOCKET) osfd );
-    if (rv < 0)
-        _PR_MD_MAP_CLOSE_ERROR(WSAGetLastError());
-
-    return rv;
-}
-
-PRInt32 _PR_MD_LISTEN(PRFileDesc *fd, PRIntn backlog)
-{
-    int rv, err;
-
-	rv = listen(fd->secret->md.osfd, backlog);
-	if ( rv == SOCKET_ERROR ) {
-		_PR_MD_MAP_LISTEN_ERROR(WSAGetLastError());
-        return(-1);
-	}
-	return(rv);
-}
-
-PRInt32
-_PR_MD_ACCEPT(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
-       PRIntervalTime timeout )
-{
-    PRInt32 osfd = fd->secret->md.osfd;
-    PRThread    *me = _PR_MD_CURRENT_THREAD();
-    PRInt32     err;
-    PRIntn      rv;
-
-    MD_ASSERTINT( *addrlen );    
-
-    while ((rv = (SOCKET)accept(osfd, (struct sockaddr *) addr,
-                                        (int *)addrlen)) == INVALID_SOCKET ) {
-        err = WSAGetLastError();
-		if ( err == WSAEWOULDBLOCK ) {
-			if (fd->secret->nonblocking) {
-				break;
-			}
-            if (_PR_WaitForFD(osfd, PR_POLL_READ, timeout) == 0) {
-                if ( _PR_PENDING_INTERRUPT(me))
-                {
-                    me->flags &= ~_PR_INTERRUPT;
-                    PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                } else
-                {
-                    PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
-                }
-                rv = -1;
-                goto done;
-            } else if (_PR_PENDING_INTERRUPT(me)) {
-                me->flags &= ~_PR_INTERRUPT;
-                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                rv = -1;
-                goto done;
-            }
-        } else if ((err == WSAEINTR) && (!_PR_PENDING_INTERRUPT(me))){
-            continue;
-        } else {
-            break;
-        }
-    }
-    if (rv < 0) {
-        _PR_MD_MAP_ACCEPT_ERROR(err);
-    }
-done:
-    if ( rv == INVALID_SOCKET )
-        return(-1 );
-    else
-        return(rv);
-} /* end _MD_Accept() */
-
-
-PRInt32
-_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, 
-               PRIntervalTime timeout)
-{
-    PRInt32 osfd = fd->secret->md.osfd;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-    PRInt32 rv, err;
-
-    while ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {
-        err = WSAGetLastError();
-        if (err == WSAEISCONN) {
-            rv = 0;
-            break;
-        }
-        /* for winsock1.1, it reports EALREADY as EINVAL */
-		if ((err == WSAEWOULDBLOCK)
-            ||(err == WSAEALREADY) 
-            || (err = WSAEINVAL)) {
-			if (fd->secret->nonblocking) {
-				break;
-			}
-            if (_PR_WaitForFD(osfd, PR_POLL_WRITE, timeout) == 0) {
-                if ( _PR_PENDING_INTERRUPT(me))
-                {
-                    me->flags &= ~_PR_INTERRUPT;
-                    PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                } else
-                {
-                    PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
-                }
-                rv = -1;
-                goto done;
-            } else if (_PR_PENDING_INTERRUPT(me)) {
-                me->flags &= ~_PR_INTERRUPT;
-                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                rv = -1;
-                goto done;
-            }
-        } else if ((err == WSAEINTR) && (!_PR_PENDING_INTERRUPT(me))){
-            continue;
-        } else {
-            break;
-        }
-    }
-
-    if (rv < 0) {
-        _PR_MD_MAP_CONNECT_ERROR(err);
-    }
-done:
-    return rv;
-}
-
-PRInt32
-_PR_MD_BIND(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen)
-{
-    PRInt32 rv;
-    int one = 1;
-
-    rv = bind(fd->secret->md.osfd, (const struct sockaddr *)&(addr->inet), addrlen);
-
-    if (rv == SOCKET_ERROR)  {
-        _PR_MD_MAP_BIND_ERROR(WSAGetLastError());
-        return -1;
-    }
-
-    return 0;
-}
-
-
-PRInt32
-_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, 
-            PRIntervalTime timeout)
-{
-    PRInt32 osfd = fd->secret->md.osfd;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-    PRInt32 rv, err;
-
-    while ((rv = recv(osfd,buf,amount,flags)) == -1) {
-        err = WSAGetLastError();
-		if ( err == WSAEWOULDBLOCK ) {
-			if (fd->secret->nonblocking) {
-				break;
-			}
-            if (_PR_WaitForFD(osfd, PR_POLL_READ, timeout) == 0) {
-                if ( _PR_PENDING_INTERRUPT(me))
-                {
-                    me->flags &= ~_PR_INTERRUPT;
-                    PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                } else
-                {
-                    PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
-                }
-                rv = -1;
-                goto done;
-            } else if (_PR_PENDING_INTERRUPT(me)) {
-                me->flags &= ~_PR_INTERRUPT;
-                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                rv = -1;
-                goto done;
-            }
-        } else if ((err == WSAEINTR) && (!_PR_PENDING_INTERRUPT(me))){
-            continue;
-        } else {
-            break;
-        }
-    }
-    if (rv < 0) {
-        _PR_MD_MAP_RECV_ERROR(err);
-    }
-done:
-    return(rv);
-}
-
-PRInt32
-_PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
-            PRIntervalTime timeout)
-{
-    PRInt32 osfd = fd->secret->md.osfd;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-    PRInt32 rv, err;
-
-    while ((rv = send(osfd,buf,amount,flags)) == -1) {
-        err = WSAGetLastError();
-		if ( err == WSAEWOULDBLOCK ) {
-			if (fd->secret->nonblocking) {
-				break;
-			}
-            if (_PR_WaitForFD(osfd, PR_POLL_WRITE, timeout) == 0) {
-                if ( _PR_PENDING_INTERRUPT(me))
-                {
-                    me->flags &= ~_PR_INTERRUPT;
-                    PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                } else
-                {
-                    PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
-                }
-                rv = -1;
-                goto done;
-            } else if (_PR_PENDING_INTERRUPT(me)) {
-                me->flags &= ~_PR_INTERRUPT;
-                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                rv = -1;
-                goto done;
-            }
-        } else if ((err == WSAEINTR) && (!_PR_PENDING_INTERRUPT(me))){
-            continue;
-        } else {
-            break;
-        }
-    }
-    if (rv < 0) {
-        _PR_MD_MAP_SEND_ERROR(err);
-    }
-done:
-    return rv;
-}
-
-PRInt32
-_PR_MD_SENDTO(PRFileDesc*fd, const void *buf, PRInt32 amount, PRIntn flags,
-              const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout)
-{
-    PRInt32 osfd = fd->secret->md.osfd;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-    PRInt32 rv, err;
-
-    while ((rv = sendto(osfd, buf, amount, flags,
-            (struct sockaddr *) addr, addrlen)) == -1) {
-        err = WSAGetLastError();
-		if ( err == WSAEWOULDBLOCK ) {
-			if (fd->secret->nonblocking) {
-				break;
-			}
-            if (_PR_WaitForFD(osfd, PR_POLL_WRITE, timeout) == 0) {
-                if ( _PR_PENDING_INTERRUPT(me))
-                {
-                    me->flags &= ~_PR_INTERRUPT;
-                    PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                } else
-                {
-                    PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
-                }
-                rv = -1;
-                goto done;
-            } else if (_PR_PENDING_INTERRUPT(me)) {
-                me->flags &= ~_PR_INTERRUPT;
-                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                rv = -1;
-                goto done;
-            }
-        } else if ((err == WSAEINTR) && (!_PR_PENDING_INTERRUPT(me))){
-            continue;
-        } else {
-            break;
-        }
-    }
-    if (rv < 0) {
-        _PR_MD_MAP_SENDTO_ERROR(err);
-    }
-done:
-    return rv;
-}
-
-PRInt32
-_PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
-                PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout)
-{
-    PRInt32 osfd = fd->secret->md.osfd;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-    PRInt32 rv, err;
-
-    while ((*addrlen = PR_NETADDR_SIZE(addr)),
-                ((rv = recvfrom(osfd, buf, amount, flags,
-                (struct sockaddr FAR *) addr,(int FAR *)addrlen)) == -1)) {
-        err = WSAGetLastError();
-		if ( err == WSAEWOULDBLOCK ) {
-			if (fd->secret->nonblocking) {
-				break;
-			}
-            if (_PR_WaitForFD(osfd, PR_POLL_READ, timeout) == 0) {
-                if ( _PR_PENDING_INTERRUPT(me))
-                {
-                    me->flags &= ~_PR_INTERRUPT;
-                    PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                } else
-                {
-                    PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
-                }
-                rv = -1;
-                goto done;
-            } else if (_PR_PENDING_INTERRUPT(me)) {
-                me->flags &= ~_PR_INTERRUPT;
-                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
-                rv = -1;
-                goto done;
-            }
-        } else if ((err == WSAEINTR) && (!_PR_PENDING_INTERRUPT(me))){
-            continue;
-        } else {
-            break;
-        }
-    }
-    if (rv < 0) {
-        _PR_MD_MAP_RECVFROM_ERROR(err);
-    }
-done:
-    return(rv);
-}
-
-PRInt32
-_PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
-{
-    int index;
-    int sent = 0;
-    int rv;
-
-    for (index=0; index < iov_size; index++) 
-    {
-
-/*
- * XXX To be fixed
- * should call PR_Send
- */
-
-        rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout);
-        if (rv > 0) 
-            sent += rv;
-        if ( rv != iov[index].iov_len ) 
-        {
-            if (sent <= 0)
-                return -1;
-            return -1;
-        }
-    }
-    return sent;
-}
-
-PRInt32
-_PR_MD_SHUTDOWN(PRFileDesc *fd, PRIntn how)
-{
-PRInt32 rv;
-
-    rv = shutdown(fd->secret->md.osfd, how);
-    if (rv < 0)
-        _PR_MD_MAP_SHUTDOWN_ERROR(WSAGetLastError());
-    return rv;
-}
-
-PRStatus
-_PR_MD_GETSOCKNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len)
-{
-    PRInt32 rv;
-
-    rv = getsockname((SOCKET)fd->secret->md.osfd, (struct sockaddr *)addr, (int *)len);
-    if (rv==0)
-        return PR_SUCCESS;
-    else {
-        _PR_MD_MAP_GETSOCKNAME_ERROR(WSAGetLastError());
-        return PR_FAILURE;
-    }
-}
-
-PRStatus
-_PR_MD_GETPEERNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len)
-{
-    PRInt32 rv;
-
-    rv = getpeername((SOCKET)fd->secret->md.osfd, (struct sockaddr *)addr, (int*)len);
-    if (rv==0)
-        return PR_SUCCESS;
-    else {
-        _PR_MD_MAP_GETPEERNAME_ERROR(WSAGetLastError());
-        return PR_FAILURE;
-    }
-}
-
-PRStatus
-_PR_MD_GETSOCKOPT(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen)
-{
-    PRInt32 rv;
-
-    rv = getsockopt((SOCKET)fd->secret->md.osfd, level, optname, optval, (int*)optlen);
-    if (rv==0)
-        return PR_SUCCESS;
-    else {
-        _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError());
-        return PR_FAILURE;
-    }
-}
-
-PRStatus
-_PR_MD_SETSOCKOPT(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen)
-{
-    PRInt32 rv;
-
-    rv = setsockopt((SOCKET)fd->secret->md.osfd, level, optname, optval, optlen);
-    if (rv==0)
-        return PR_SUCCESS;
-    else {
-        _PR_MD_MAP_SETSOCKOPT_ERROR(WSAGetLastError());
-        return PR_FAILURE;
-    }
-}
-
-void
-_PR_MD_MAKE_NONBLOCK(PRFileDesc *f)
-{
-    return; // do nothing!
-}
-
-/*
-** Wait for I/O on a single descriptor.
- *
- * return 0, if timed-out, else return 1
-*/
-PRInt32
-_PR_WaitForFD(PRInt32 osfd, PRUintn how, PRIntervalTime timeout)
-{
-    _PRWin16PollDesc *pd;
-    PRPollQueue      *pq;
-    PRIntn is;
-    PRInt32 rv = 1;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-
-    PR_ASSERT(!(me->flags & _PR_IDLE_THREAD));
-
-    pd = &me->md.thr_pd;
-    pq = &me->md.thr_pq;
-    if (timeout == PR_INTERVAL_NO_WAIT) return 0;
-
-    pd->osfd = osfd;
-    pd->in_flags = how;
-    pd->out_flags = 0;
-
-    pq->pds = pd;
-    pq->npds = 1;
-
-    _PR_INTSOFF(is);
-    _PR_MD_IOQ_LOCK();
-    _PR_THREAD_LOCK(me);
-
-	if (_PR_PENDING_INTERRUPT(me)) {
-    	_PR_THREAD_UNLOCK(me);
-    	_PR_MD_IOQ_UNLOCK();
-		return 0;
-	}
-
-    pq->thr = me;
-    pq->on_ioq = PR_TRUE;
-    pq->timeout = timeout;
-    _PR_ADD_TO_IOQ((*pq), me->cpu);
-    if (how == PR_POLL_READ) {
-        FD_SET(osfd, &_PR_FD_READ_SET(me->cpu));
-        (_PR_FD_READ_CNT(me->cpu))[osfd]++;
-    } else if (how == PR_POLL_WRITE) {
-        FD_SET(osfd, &_PR_FD_WRITE_SET(me->cpu));
-        (_PR_FD_WRITE_CNT(me->cpu))[osfd]++;
-    } else {
-        FD_SET(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
-        (_PR_FD_EXCEPTION_CNT(me->cpu))[osfd]++;
-    }
-    if (_PR_IOQ_MAX_OSFD(me->cpu) < osfd)
-        _PR_IOQ_MAX_OSFD(me->cpu) = osfd;
-    if (_PR_IOQ_TIMEOUT(me->cpu) > timeout)
-        _PR_IOQ_TIMEOUT(me->cpu) = timeout;
-        
-    _PR_THREAD_LOCK(me);
-
-    _PR_SLEEPQ_LOCK(me->cpu);
-    _PR_ADD_SLEEPQ(me, timeout);
-    me->state = _PR_IO_WAIT;
-    me->io_pending = PR_TRUE;
-    me->io_suspended = PR_FALSE;
-    _PR_SLEEPQ_UNLOCK(me->cpu);
-    _PR_THREAD_UNLOCK(me);
-    _PR_MD_IOQ_UNLOCK();
-
-    _PR_MD_WAIT(me, timeout);
-    me->io_pending = PR_FALSE;
-    me->io_suspended = PR_FALSE;
-
-    /*
-    ** If we timed out the pollq might still be on the ioq. Remove it
-    ** before continuing.
-    */
-    if (pq->on_ioq) {
-        _PR_INTSOFF(is);
-        _PR_MD_IOQ_LOCK();
-    /*
-     * Need to check pq.on_ioq again
-     */
-        if (pq->on_ioq) {
-            PR_REMOVE_LINK(&pq->links);
-            if (how == PR_POLL_READ) {
-                if ((--(_PR_FD_READ_CNT(me->cpu))[osfd]) == 0)
-                    FD_CLR(osfd, &_PR_FD_READ_SET(me->cpu));
-            
-            } else if (how == PR_POLL_WRITE) {
-                if ((--(_PR_FD_WRITE_CNT(me->cpu))[osfd]) == 0)
-                    FD_CLR(osfd, &_PR_FD_WRITE_SET(me->cpu));
-            } else {
-                if ((--(_PR_FD_EXCEPTION_CNT(me->cpu))[osfd]) == 0)
-                    FD_CLR(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
-            }
-        }
-        _PR_MD_IOQ_UNLOCK();
-        rv = 0;
-    }
-    _PR_FAST_INTSON(is);
-   return(rv);
-}
-
-/*
- * Unblock threads waiting for I/O
- *    used when interrupting threads
- *
- * NOTE: The thread lock should held when this function is called.
- * On return, the thread lock is released.
- */
-void _PR_Unblock_IO_Wait(PRThread *thr)
-{
-    int pri = thr->priority;
-    _PRCPU *cpu = thr->cpu;
- 
-    PR_ASSERT(thr->flags & (_PR_ON_SLEEPQ | _PR_ON_PAUSEQ));
-    _PR_SLEEPQ_LOCK(cpu);
-    _PR_DEL_SLEEPQ(thr, PR_TRUE);
-    _PR_SLEEPQ_UNLOCK(cpu);
-
-    PR_ASSERT(!(thr->flags & _PR_IDLE_THREAD));
-    thr->state = _PR_RUNNABLE;
-    _PR_RUNQ_LOCK(cpu);
-    _PR_ADD_RUNQ(thr, cpu, pri);
-    _PR_RUNQ_UNLOCK(cpu);
-    _PR_THREAD_UNLOCK(thr);
-    _PR_MD_WAKEUP_WAITER(thr);
-}
-
-/*
-** Scan through io queue and find any bad fd's that triggered the error
-** from _MD_SELECT
-*/
-static void FindBadFDs(void)
-{
-    PRCList *q;
-    PRThread *me = _MD_CURRENT_THREAD();
-    int sockOpt;
-    int sockOptLen = sizeof(sockOpt);
-
-    PR_ASSERT(!_PR_IS_NATIVE_THREAD(me));
-    q = (_PR_IOQ(me->cpu)).next;
-    _PR_IOQ_MAX_OSFD(me->cpu) = -1;
-    _PR_IOQ_TIMEOUT(me->cpu) = PR_INTERVAL_NO_TIMEOUT;
-    while (q != &_PR_IOQ(me->cpu)) {
-        PRPollQueue *pq = _PR_POLLQUEUE_PTR(q);
-        PRBool notify = PR_FALSE;
-        _PRWin16PollDesc *pds = pq->pds;
-        _PRWin16PollDesc *epds = pds + pq->npds;
-        PRInt32 pq_max_osfd = -1;
-
-        q = q->next;
-        for (; pds < epds; pds++) {
-            PRInt32 osfd = pds->osfd;
-            pds->out_flags = 0;
-            PR_ASSERT(osfd >= 0 || pds->in_flags == 0);
-            if (pds->in_flags == 0) {
-                continue;  /* skip this fd */
-            }
-            if ( getsockopt(osfd, 
-                    (int)SOL_SOCKET, 
-                    SO_TYPE, 
-                    (char*)&sockOpt, 
-                    &sockOptLen) == SOCKET_ERROR ) 
-            {
-                if ( WSAGetLastError() == WSAENOTSOCK )
-                {
-                    PR_LOG(_pr_io_lm, PR_LOG_MAX,
-                        ("file descriptor %d is bad", osfd));
-                    pds->out_flags = PR_POLL_NVAL;
-                    notify = PR_TRUE;
-                }
-            }
-            if (osfd > pq_max_osfd) {
-                pq_max_osfd = osfd;
-            }
-        }
-
-        if (notify) {
-            PRIntn pri;
-            PR_REMOVE_LINK(&pq->links);
-            pq->on_ioq = PR_FALSE;
-
-            /*
-         * Decrement the count of descriptors for each desciptor/event
-         * because this I/O request is being removed from the
-         * ioq
-         */
-            pds = pq->pds;
-            for (; pds < epds; pds++) {
-                PRInt32 osfd = pds->osfd;
-                PRInt16 in_flags = pds->in_flags;
-                PR_ASSERT(osfd >= 0 || in_flags == 0);
-                if (in_flags & PR_POLL_READ) {
-                    if (--(_PR_FD_READ_CNT(me->cpu))[osfd] == 0)
-                        FD_CLR(osfd, &_PR_FD_READ_SET(me->cpu));
-                }
-                if (in_flags & PR_POLL_WRITE) {
-                    if (--(_PR_FD_WRITE_CNT(me->cpu))[osfd] == 0)
-                        FD_CLR(osfd, &_PR_FD_WRITE_SET(me->cpu));
-                }
-                if (in_flags & PR_POLL_EXCEPT) {
-                    if (--(_PR_FD_EXCEPTION_CNT(me->cpu))[osfd] == 0)
-                        FD_CLR(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
-                }
-            }
-
-            _PR_THREAD_LOCK(pq->thr);
-            if (pq->thr->flags & (_PR_ON_PAUSEQ|_PR_ON_SLEEPQ)) {
-                _PRCPU *cpu = pq->thr->cpu;
-                
-                _PR_SLEEPQ_LOCK(pq->thr->cpu);
-                _PR_DEL_SLEEPQ(pq->thr, PR_TRUE);
-                _PR_SLEEPQ_UNLOCK(pq->thr->cpu);
-
-                pri = pq->thr->priority;
-                pq->thr->state = _PR_RUNNABLE;
-
-                _PR_RUNQ_LOCK(cpu);
-                _PR_ADD_RUNQ(pq->thr, cpu, pri);
-                _PR_RUNQ_UNLOCK(cpu);
-            }
-            _PR_THREAD_UNLOCK(pq->thr);
-        } else {
-            if (pq->timeout < _PR_IOQ_TIMEOUT(me->cpu))
-                _PR_IOQ_TIMEOUT(me->cpu) = pq->timeout;
-            if (_PR_IOQ_MAX_OSFD(me->cpu) < pq_max_osfd)
-                _PR_IOQ_MAX_OSFD(me->cpu) = pq_max_osfd;
-        }
-    }
-} /* end FindBadFDs() */
-
-/*
-** Called by the scheduler when there is nothing to do. This means that
-** all threads are blocked on some monitor somewhere.
-**
-** Pause the current CPU. longjmp to the cpu's pause stack
-*/
-PRInt32 _PR_MD_PAUSE_CPU( PRIntervalTime ticks)
-{
-    PRThread *me = _MD_CURRENT_THREAD();
-    struct timeval timeout, *tvp;
-    fd_set r, w, e;
-    fd_set *rp, *wp, *ep;
-    PRInt32 max_osfd, nfd;
-    PRInt32 rv;
-    PRCList *q;
-    PRUint32 min_timeout;
-
-    PR_ASSERT(_PR_MD_GET_INTSOFF() != 0);
-
-    /*
-     * assigment of fd_sets
-     */
-    r = _PR_FD_READ_SET(me->cpu);
-    w = _PR_FD_WRITE_SET(me->cpu);
-    e = _PR_FD_EXCEPTION_SET(me->cpu);
-
-    rp = &r;
-    wp = &w;
-    ep = &e;
-
-    max_osfd = _PR_IOQ_MAX_OSFD(me->cpu) + 1;
-    min_timeout = _PR_IOQ_TIMEOUT(me->cpu);
-    /*
-    ** Compute the minimum timeout value: make it the smaller of the
-    ** timeouts specified by the i/o pollers or the timeout of the first
-    ** sleeping thread.
-    */
-    q = _PR_SLEEPQ(me->cpu).next;
-
-    if (q != &_PR_SLEEPQ(me->cpu)) {
-        PRThread *t = _PR_THREAD_PTR(q);
-
-        if (t->sleep < min_timeout) {
-            min_timeout = t->sleep;
-        }
-    }
-    if (min_timeout > ticks) {
-        min_timeout = ticks;
-    }
-
-    if (min_timeout == PR_INTERVAL_NO_TIMEOUT) {
-        tvp = NULL;
-    } else {
-        timeout.tv_sec = PR_IntervalToSeconds(min_timeout);
-        timeout.tv_usec = PR_IntervalToMicroseconds(min_timeout)
-            % PR_USEC_PER_SEC;
-        tvp = &timeout;
-    }
-
-    _PR_MD_IOQ_UNLOCK();
-    _MD_CHECK_FOR_EXIT();
-    /*
-     * check for i/o operations
-     */
-
-    nfd = _MD_SELECT(max_osfd, rp, wp, ep, tvp);
-
-    _MD_CHECK_FOR_EXIT();
-    _PR_MD_IOQ_LOCK();
-    /*
-    ** Notify monitors that are associated with the selected descriptors.
-    */
-    if (nfd > 0) {
-        q = _PR_IOQ(me->cpu).next;
-        _PR_IOQ_MAX_OSFD(me->cpu) = -1;
-        _PR_IOQ_TIMEOUT(me->cpu) = PR_INTERVAL_NO_TIMEOUT;
-        while (q != &_PR_IOQ(me->cpu)) {
-            PRPollQueue *pq = _PR_POLLQUEUE_PTR(q);
-            PRBool notify = PR_FALSE;
-            _PRWin16PollDesc *pds = pq->pds;
-            _PRWin16PollDesc *epds = pds + pq->npds;
-            PRInt32 pq_max_osfd = -1;
-
-            q = q->next;
-            for (; pds < epds; pds++) {
-                PRInt32 osfd = pds->osfd;
-                PRInt16 in_flags = pds->in_flags;
-                PRInt16 out_flags = 0;
-                PR_ASSERT(osfd >= 0 || in_flags == 0);
-                if ((in_flags & PR_POLL_READ) && FD_ISSET(osfd, rp)) {
-                    out_flags |= PR_POLL_READ;
-                }
-                if ((in_flags & PR_POLL_WRITE) && FD_ISSET(osfd, wp)) {
-                    out_flags |= PR_POLL_WRITE;
-                }
-                if ((in_flags & PR_POLL_EXCEPT) && FD_ISSET(osfd, ep)) {
-                    out_flags |= PR_POLL_EXCEPT;
-                }
-                pds->out_flags = out_flags;
-                if (out_flags) {
-                    notify = PR_TRUE;
-                }
-                if (osfd > pq_max_osfd) {
-                    pq_max_osfd = osfd;
-                }
-            }
-            if (notify == PR_TRUE) {
-                PRIntn pri;
-                PRThread *thred;
-
-                PR_REMOVE_LINK(&pq->links);
-                pq->on_ioq = PR_FALSE;
-
-                /*
-                 * Decrement the count of descriptors for each desciptor/event
-                 * because this I/O request is being removed from the
-                 * ioq
-                 */
-                pds = pq->pds;
-                for (; pds < epds; pds++) {
-                    PRInt32 osfd = pds->osfd;
-                    PRInt16 in_flags = pds->in_flags;
-                    PR_ASSERT(osfd >= 0 || in_flags == 0);
-                    if (in_flags & PR_POLL_READ) {
-                        if (--(_PR_FD_READ_CNT(me->cpu))[osfd] == 0)
-                            FD_CLR(osfd, &_PR_FD_READ_SET(me->cpu));
-                    }
-                    if (in_flags & PR_POLL_WRITE) {
-                        if (--(_PR_FD_WRITE_CNT(me->cpu))[osfd] == 0)
-                            FD_CLR(osfd, &_PR_FD_WRITE_SET(me->cpu));
-                    }
-                    if (in_flags & PR_POLL_EXCEPT) {
-                        if (--(_PR_FD_EXCEPTION_CNT(me->cpu))[osfd] == 0)
-                            FD_CLR(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
-                    }
-                }
-                 thred = pq->thr;
-                _PR_THREAD_LOCK(thred);
-                if (pq->thr->flags & (_PR_ON_PAUSEQ|_PR_ON_SLEEPQ)) {
-                    _PRCPU *cpu = thred->cpu;
-                    _PR_SLEEPQ_LOCK(pq->thr->cpu);
-                    _PR_DEL_SLEEPQ(pq->thr, PR_TRUE);
-                    _PR_SLEEPQ_UNLOCK(pq->thr->cpu);
-
-                    pri = pq->thr->priority;
-                    pq->thr->state = _PR_RUNNABLE;
-
-                    pq->thr->cpu = cpu;
-                    _PR_RUNQ_LOCK(cpu);
-                    _PR_ADD_RUNQ(pq->thr, cpu, pri);
-                    _PR_RUNQ_UNLOCK(cpu);
-                    if (_pr_md_idle_cpus > 1)
-                        _PR_MD_WAKEUP_WAITER(thred);
-                }
-                _PR_THREAD_UNLOCK(thred);
-            } else {
-                if (pq->timeout < _PR_IOQ_TIMEOUT(me->cpu))
-                    _PR_IOQ_TIMEOUT(me->cpu) = pq->timeout;
-                if (_PR_IOQ_MAX_OSFD(me->cpu) < pq_max_osfd)
-                    _PR_IOQ_MAX_OSFD(me->cpu) = pq_max_osfd;
-            }
-        }
-    } else if (nfd < 0) {
-        if ( WSAGetLastError() == WSAENOTSOCK )
-        {
-            FindBadFDs();
-        } else {
-            PR_LOG(_pr_io_lm, PR_LOG_MAX, ("select() failed with errno %d",
-                errno));
-        }
-    }
-    _PR_MD_IOQ_UNLOCK();
-    return(0);
-    
-} /* end _PR_MD_PAUSE_CPU() */
-
-
-/*
-** _MD_pr_poll() -- Implement MD polling
-**
-** The function was snatched (re-used) from the unix implementation.
-** 
-** The native thread stuff was deleted.
-** The pollqueue is instantiated on the mdthread structure
-** to keep the stack frame from being corrupted when this
-** thread is waiting on the poll.
-**
-*/
-extern PRInt32 
-_MD_PR_POLL(PRPollDesc *pds, PRIntn npds,
-                        PRIntervalTime timeout)
-{
-    PRPollDesc *pd, *epd;
-    PRInt32 n, err, pdcnt;
-    PRIntn is;
-    _PRWin16PollDesc *spds, *spd;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-    PRPollQueue *pq;
-
-    pq = &me->md.thr_pq;
-    
-    /*
-     * XXX
-     *   PRPollDesc has a PRFileDesc field, fd, while the IOQ
-     *   is a list of PRPollQueue structures, each of which contains
-     *   a _PRWin16PollDesc. A _PRWin16PollDesc struct contains
-     *   the OS file descriptor, osfd, and not a PRFileDesc.
-     *   So, we have allocate memory for _PRWin16PollDesc structures,
-     *   copy the flags information from the pds list and have pq
-     *   point to this list of _PRWin16PollDesc structures.
-     *
-     *   It would be better if the memory allocation can be avoided.
-     */
-
-    spds = (_PRWin16PollDesc*) PR_MALLOC(npds * sizeof(_PRWin16PollDesc));
-    if (!spds) {
-        PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
-           return -1;
-    }
-    spd = spds;
-
-    _PR_INTSOFF(is);
-    _PR_MD_IOQ_LOCK();
-       _PR_THREAD_LOCK(me);
-
-    if (_PR_PENDING_INTERRUPT(me)) {
-        me->flags &= ~_PR_INTERRUPT;
-        PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
-        _PR_THREAD_UNLOCK(me);
-        _PR_MD_IOQ_UNLOCK();
-        PR_DELETE(spds);
-           return -1;
-    }
-
-    pdcnt = 0;
-    for (pd = pds, epd = pd + npds; pd < epd; pd++) {
-        PRInt32 osfd;
-        PRInt16 in_flags = pd->in_flags;
-        PRFileDesc *bottom = pd->fd;
-
-        if ((NULL == bottom) || (in_flags == 0)) {
-            continue;
-        }
-        while (bottom->lower != NULL) {
-            bottom = bottom->lower;
-        }
-        osfd = bottom->secret->md.osfd;
-
-        PR_ASSERT(osfd >= 0 || in_flags == 0);
-
-        spd->osfd = osfd;
-        spd->in_flags = pd->in_flags;
-        spd++;
-        pdcnt++;
-
-        if (in_flags & PR_POLL_READ)  {
-            FD_SET(osfd, &_PR_FD_READ_SET(me->cpu));
-            _PR_FD_READ_CNT(me->cpu)[osfd]++;
-        }
-        if (in_flags & PR_POLL_WRITE) {
-            FD_SET(osfd, &_PR_FD_WRITE_SET(me->cpu));
-            (_PR_FD_WRITE_CNT(me->cpu))[osfd]++;
-        }
-        if (in_flags & PR_POLL_EXCEPT) {
-            FD_SET(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
-            (_PR_FD_EXCEPTION_CNT(me->cpu))[osfd]++;
-        }
-        if (osfd > _PR_IOQ_MAX_OSFD(me->cpu))
-            _PR_IOQ_MAX_OSFD(me->cpu) = osfd;
-    }
-    if (timeout < _PR_IOQ_TIMEOUT(me->cpu))
-        _PR_IOQ_TIMEOUT(me->cpu) = timeout;
-
-
-    pq->pds = spds;
-    pq->npds = pdcnt;
-
-    pq->thr = me;
-    pq->on_ioq = PR_TRUE;
-    pq->timeout = timeout;
-    _PR_ADD_TO_IOQ((*pq), me->cpu);
-    _PR_SLEEPQ_LOCK(me->cpu);
-    _PR_ADD_SLEEPQ(me, timeout);
-    me->state = _PR_IO_WAIT;
-    me->io_pending = PR_TRUE;
-    me->io_suspended = PR_FALSE;
-    _PR_SLEEPQ_UNLOCK(me->cpu);
-    _PR_THREAD_UNLOCK(me);
-    _PR_MD_IOQ_UNLOCK();
-
-    _PR_MD_WAIT(me, timeout);
-
-    me->io_pending = PR_FALSE;
-    me->io_suspended = PR_FALSE;
-
-    /*
-     * Copy the out_flags from the _PRWin16PollDesc structures to the
-     * user's PRPollDesc structures and free the allocated memory
-     */
-    spd = spds;
-    for (pd = pds, epd = pd + npds; pd < epd; pd++) {
-        if ((NULL == pd->fd) || (pd->in_flags == 0)) {
-            pd->out_flags = 0;
-            continue;
-        }
-        pd->out_flags = spd->out_flags;
-        spd++;
-    }
-    PR_DELETE(spds);
-
-    /*
-    ** If we timed out the pollq might still be on the ioq. Remove it
-    ** before continuing.
-    */
-    if (pq->on_ioq) {
-        _PR_INTSOFF(is);
-        _PR_MD_IOQ_LOCK();
-        /*
-         * Need to check pq.on_ioq again
-         */
-        if (pq->on_ioq == PR_TRUE) {
-            PR_REMOVE_LINK(&pq->links);
-            for (pd = pds, epd = pd + npds; pd < epd; pd++) {
-                PRInt32 osfd;
-                PRInt16 in_flags = pd->in_flags;
-                PRFileDesc *bottom = pd->fd;
-
-                if ((NULL == bottom) || (in_flags == 0)) {
-                    continue;
-                }
-                while (bottom->lower != NULL) {
-                    bottom = bottom->lower;
-                }
-                osfd = bottom->secret->md.osfd;
-                PR_ASSERT(osfd >= 0 || in_flags == 0);
-                if (in_flags & PR_POLL_READ)  {
-                    if (--(_PR_FD_READ_CNT(me->cpu))[osfd] == 0)
-                        FD_CLR(osfd, &_PR_FD_READ_SET(me->cpu));
-                }
-                if (in_flags & PR_POLL_WRITE) {
-                    if (--(_PR_FD_WRITE_CNT(me->cpu))[osfd] == 0)
-                            FD_CLR(osfd, &_PR_FD_WRITE_SET(me->cpu));
-                }
-                if (in_flags & PR_POLL_EXCEPT) {
-                    if (--(_PR_FD_EXCEPTION_CNT(me->cpu))[osfd] == 0)
-                            FD_CLR(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
-                }
-            }
-        }
-        _PR_MD_IOQ_UNLOCK();
-        _PR_INTSON(is);
-    }
-    if (_PR_PENDING_INTERRUPT(me)) {
-        me->flags &= ~_PR_INTERRUPT;
-        PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
-           return -1;
-    } else {
-        n = 0;
-        if (pq->on_ioq == PR_FALSE) {
-            /* Count the number of ready descriptors */
-            while (--npds >= 0) {
-            if (pds->out_flags) {
-                n++;
-            }
-                pds++;
-            }
-        }
-        return n;
-    }
-} /* end _MD_pr_poll() */
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16stdio.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
- 
-/*
-** w16stdio.c -- Callback functions for Win16 stdio read/write.
-**
-**
-*/
-#include "primpl.h"
-
-/*
-** _PL_MDStdioWrite() -- Win16 hackery to get console output
-**
-** Returns: number of bytes written.
-**
-*/
-PRInt32
-_PL_W16StdioWrite( void *buf, PRInt32 amount )
-{
-    int   rc;
-    
-    rc = fputs( buf, stdout );
-    if ( rc == EOF )
-    {
-        // something about errno
-        return(PR_FAILURE);
-    }
-    return( strlen(buf));
-} /* end _PL_fputs() */
-
-/*
-** _PL_W16StdioRead() -- Win16 hackery to get console input
-**
-*/
-PRInt32
-_PL_W16StdioRead( void *buf, PRInt32 amount )
-{
-    char *bp;
-
-    bp = fgets( buf, (int) amount, stdin );
-    if ( bp == NULL )
-    {
-        // something about errno
-        return(PR_FAILURE);
-    }
-    
-    return( strlen(buf));
-} /* end _PL_fgets() */
-/* --- end w16stdio.c --- */
-
-/*
-** Wrappers, linked into the client, that call
-** functions in LibC
-**
-*/
-
-/*
-** _PL_W16CallBackPuts() -- Wrapper for puts()
-**
-*/
-int PR_CALLBACK _PL_W16CallBackPuts( const char *outputString )
-{
-    return( puts( outputString ));
-} /* end _PL_W16CallBackPuts()  */    
-
-/*
-** _PL_W16CallBackStrftime() -- Wrapper for strftime()
-**
-*/
-size_t PR_CALLBACK _PL_W16CallBackStrftime( 
-    char *s, 
-    size_t len, 
-    const char *fmt,
-    const struct tm *p )
-{
-    return( strftime( s, len, fmt, p ));
-} /* end _PL_W16CallBackStrftime()  */    
-
-/*
-** _PL_W16CallBackMalloc() -- Wrapper for malloc()
-**
-*/
-void * PR_CALLBACK _PL_W16CallBackMalloc( size_t size )
-{
-    return( malloc( size ));
-} /* end _PL_W16CallBackMalloc()  */    
-
-/*
-** _PL_W16CallBackCalloc() -- Wrapper for calloc()
-**
-*/
-void * PR_CALLBACK _PL_W16CallBackCalloc( size_t n, size_t size )
-{
-    return( calloc( n, size ));
-} /* end _PL_W16CallBackCalloc()  */    
-
-/*
-** _PL_W16CallBackRealloc() -- Wrapper for realloc()
-**
-*/
-void * PR_CALLBACK _PL_W16CallBackRealloc( 
-    void *old_blk, 
-    size_t size )
-{
-    return( realloc( old_blk, size ));
-} /* end _PL_W16CallBackRealloc()  */
-
-/*
-** _PL_W16CallBackFree() -- Wrapper for free()
-**
-*/
-void PR_CALLBACK _PL_W16CallBackFree( void *ptr )
-{
-    free( ptr );
-    return;
-} /* end _PL_W16CallBackFree()  */
-
-/*
-** _PL_W16CallBackGetenv() -- Wrapper for getenv()
-**
-*/
-void * PR_CALLBACK _PL_W16CallBackGetenv( const char *name )
-{
-    return( getenv( name ));
-} /* end _PL_W16CallBackGetenv  */
-
-
-/*
-** _PL_W16CallBackPutenv() -- Wrapper for putenv()
-**
-*/
-int PR_CALLBACK _PL_W16CallBackPutenv( const char *assoc )
-{
-    return( putenv( assoc ));
-} /* end _PL_W16CallBackGetenv  */
deleted file mode 100644
--- a/nsprpub/pr/src/md/windows/w16thred.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape Portable Runtime (NSPR).
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "primpl.h"
-#include <sys/timeb.h>
-#include <stdio.h>
-
-/*
-** DispatchTrace -- define a thread dispatch trace entry
-**
-** The DispatchTrace oject(s) are instantiated in a single
-** array. Think of the array as a push-down stack; entry
-** zero is the most recent, entry one the next most recent, etc.
-** For each time PR_MD_RESTORE_CONTEXT() is called, the array
-** is Pushed down and entry zero is overwritten with data
-** for the newly dispatched thread.
-**
-** Function TraceDispatch() manages the DispatchTrace array.
-**
-*/
-typedef struct DispatchTrace
-{
-    PRThread *          thread;
-    PRUint32            state;
-    PRInt16             mdThreadNumber;
-    PRInt16             unused;
-    PRThreadPriority    priority;
-    
-} DispatchTrace, *DispatchTracePtr ;
-
-static void TraceDispatch( PRThread *thread );
-
-
-PRThread                *_pr_primordialThread;
-
-/*
-** Note: the static variables must be on the data-segment because
-** the stack is destroyed during shadow-stack copy operations.
-**
-*/
-static char * pSource;          /* ptr to sourc of a "shadow-stack" copy */
-static char * pTarget;          /* ptr to target of a "shadow-stack" copy */
-static int   cxByteCount;       /* number of bytes for "shadow-stack" copy */
-static int   bytesMoved;        /* instrumentation: WRT "shadow-stack" copy */
-static FILE *    file1 = 0;     /* instrumentation: WRT debug */
-
-#define NUM_DISPATCHTRACE_OBJECTS  24
-static DispatchTrace dt[NUM_DISPATCHTRACE_OBJECTS] = {0}; /* instrumentation: WRT dispatch */
-static PRUint32 dispatchCount = 0;  /* instrumentation: number of thread dispatches */
-
-static int OldPriorityOfPrimaryThread   = -1;
-static int TimeSlicesOnNonPrimaryThread =  0;
-static PRUint32 threadNumber = 1;   /* Instrumentation: monotonically increasing number */
-
-
-
-/*
-** _PR_MD_FINAL_INIT() -- Final MD Initialization
-**
-** Poultry Problems! ... The stack, as allocated by PR_NewStack()
-** is called from here, late in initialization, because PR_NewStack()
-** requires lots of things working. When some elements of the
-** primordial thread are created, early in initialization, the
-** shadow stack is not one of these things. The "shadow stack" is
-** created here, late in initiailization using PR_NewStack(), to
-** ensure consistency in creation of the related objects.
-** 
-** A new ThreadStack, and all its affiliated structures, is allocated
-** via the call to PR_NewStack(). The PRThread structure in the
-** new stack is ignored; the old PRThread structure is used (why?).
-** The old PRThreadStack structure is abandoned.
-**
-*/
-void
-_PR_MD_FINAL_INIT()
-{
-    PRThreadStack *     stack = 0;
-    PRInt32             stacksize = 0;
-    PRThread *          me = _PR_MD_CURRENT_THREAD();
-    
-    _PR_ADJUST_STACKSIZE( stacksize );
-    stack = _PR_NewStack( stacksize );
-    
-    me->stack = stack;
-    stack->thr = me;
-    
-    return;
-} /* --- end _PR_MD_FINAL_INIT() --- */
-
-
-void
-_MD_INIT_RUNNING_CPU( struct _PRCPU *cpu )
-{
-	PR_INIT_CLIST(&(cpu->md.ioQ));
-	cpu->md.ioq_max_osfd = -1;
-	cpu->md.ioq_timeout = PR_INTERVAL_NO_TIMEOUT;
-}    
-
-
-void
-_PR_MD_YIELD( void )
-{
-    PR_ASSERT(0);
-}
-
-/*
-** _PR_MD_INIT_STACK() -- Win16 specific Stack initialization.
-**
-**
-*/
-
-void
-_PR_MD_INIT_STACK( PRThreadStack *ts, PRIntn redzone )
-{
-    ts->md.stackTop = ts->stackTop - sizeof(PRThread);
-    ts->md.cxByteCount = 0;
-    
-    return;
-} /* --- end _PR_MD_INIT_STACK() --- */
-
-/*
-**  _PR_MD_INIT_THREAD() -- Win16 specific Thread initialization.
-**
-*/
-PRStatus
-_PR_MD_INIT_THREAD(PRThread *thread)
-{
-    if ( thread->flags & _PR_PRIMORDIAL)
-    {
-        _pr_primordialThread = thread;
-        thread->md.threadNumber = 1;
-    }
-    else
-    {
-        thread->md.threadNumber = ++threadNumber;
-    }
-
-    thread->md.magic = _MD_MAGIC_THREAD;
-    strcpy( thread->md.guardBand, "GuardBand" );
-    
-    return PR_SUCCESS;
-}
-
-
-PRStatus
-_PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks)
-{
-    _MD_SWITCH_CONTEXT( thread );
-    
-    return( PR_SUCCESS );
-}
-
-void *PR_W16GetExceptionContext(void)
-{
-    return _MD_CURRENT_THREAD()->md.exceptionContext;
-}
-
-void
-PR_W16SetExceptionContext(void *context)
-{
-    _MD_CURRENT_THREAD()->md.exceptionContext = context;
-}
-
-
-
-
-/*
-** _MD_RESTORE_CONTEXT() -- Resume execution of thread 't'.
-**
-** Win16 threading is based on the NSPR 2.0 general model of
-** user threads. It differs from the general model in that a 
-** single "real" stack segment is used for execution of all 
-** threads. The context of the suspended threads is preserved
-** in the md.context [and related members] of the PRThread 
-** structure. The stack context of the suspended thread is
-** preserved in a "shadow stack" object.
-**
-** _MD_RESTORE_CONTEXT() implements most of the thread switching
-** for NSPR's implementation of Win16 theads.
-**
-** Operations Notes:
-**
-** Function PR_NewStack() in prustack.c allocates a new
-** PRThreadStack, PRStack, PRSegment, and a "shadow" stack
-** for a thread. These structures are wired together to
-** form the basis of Win16 threads. The thread and shadow
-** stack structures are created as part of PR_CreateThread().
-** 
-** Note! Some special "magic" is applied to the "primordial"
-** thread. The physical layout of the PRThread, PRThreadStack,
-** shadow stack, ... is somewhat different. Watch yourself when
-** mucking around with it. ... See _PR_MD_FINAL_INIT() for most
-** of the special treatment of the primordial thread.
-**
-** Function _PR_MD_INIT_STACK() initializes the value of
-** PRThreadStack member md.cxByteCount to zero; there
-** is no context to be restored for a thread's initial
-** dispatch. The value of member md.stackTop is set to
-** point to the highest usable address on the shadow stack.
-** This point corresponds to _pr_top_of_task_stack on the
-** system's operating stack.
-**
-** _pr_top_of_task_stack points to a place on the system stack
-** considered to be "close to the top". Stack context is preserved
-** relative to this point.
-**
-** Reminder: In x86 architecture, the stack grows "down".
-** That is: the stack pointer (SP register) is decremented
-** to push objects onto the stack or when a call is made.
-** 
-** Function _PR_MD_WAIT() invokes macro _MD_SWITCH_CONTEXT();
-** this causes the hardware registers to be preserved in a
-** CATCHBUF structure using function Catch() [see _win16.h], 
-** then calls PR_Schedule() to select a new thread for dispatch. 
-** PR_Schedule() calls _MD_RESTORE_CONTEXT() to cause the thread 
-** being suspended's stack to be preserved, to restore the 
-** stack of the to-be-dispactched thread, and to restore the 
-** to-be-dispactched thread's hardware registers.
-**
-** At the moment _PR_MD_RESTORE_CONTEXT() is called, the stack
-** pointer (SP) is less than the reference pointer
-** _pr_top_of_task_stack. The distance difference between the SP and
-** _pr_top_of_task_stack is the amount of stack that must be preserved.
-** This value, cxByteCount, is calculated then preserved in the
-** PRThreadStack.md.cxByteCount for later use (size of stack
-** context to restore) when this thread is dispatched again.
-** 
-** A C language for() loop is used to copy, byte-by-byte, the
-** stack data being preserved starting at the "address of t"
-** [Note: 't' is the argument passed to _PR_MD_RESTORE_CONTEXT()]
-** for the length of cxByteCount.
-**
-** variables pSource and pTarget are the calculated source and
-** destination pointers for the stack copy operation. These
-** variables are static scope because they cannot be instantiated
-** on the stack itself, since the stack is clobbered by restoring
-** the to-be-dispatched thread's stack context.
-**
-** After preserving the suspended thread's stack and architectural
-** context, the to-be-dispatched thread's stack context is copied
-** from its shadow stack to the system operational stack. The copy
-** is done in a small fragment of in-line assembly language. Note:
-** In NSPR 1.0, a while() loop was used to do the copy; when compiled
-** with the MS C 1.52c compiler, the short while loop used no
-** stack variables. The Watcom compiler, specified for use on NSPR 2.0,
-** uses stack variables to implement the same while loop. This is
-** a no-no! The copy operation clobbers these variables making the
-** results of the copy ... unpredictable ... So, a short piece of
-** inline assembly language is used to effect the copy.
-**
-** Following the restoration of the to-be-dispatched thread's
-** stack context, another short inline piece of assemble language
-** is used to set the SP register to correspond to what it was
-** when the to-be-dispatched thread was suspended. This value
-** uses the thread's stack->md.cxByteCount as a negative offset 
-** from _pr_top_of_task_stack as the new value of SP.
-**
-** Finally, Function Throw() is called to restore the architectural
-** context of the to-be-dispatched thread.
-**
-** At this point, the newly dispatched thread appears to resume
-** execution following the _PR_MD_SWITCH_CONTEXT() macro.
-**
-** OK, this ain't rocket-science, but it can confuse you easily.
-** If you have to work on this stuff, please take the time to
-** draw, on paper, the structures (PRThread, PRThreadStack,
-** PRSegment, the "shadow stack", the system stack and the related
-** global variables). Hand step it thru the debugger to make sure
-** you understand it very well before making any changes. ...
-** YMMV.
-** 
-*/
-void _MD_RESTORE_CONTEXT(PRThread *t)
-{
-    dispatchCount++;
-    TraceDispatch( t );
-    /*	
-    **	This is a good opportunity to make sure that the main
-    **	mozilla thread actually gets some time.  If interrupts
-    **	are on, then we know it is safe to check if the main
-    **	thread is being starved.  If moz has not been scheduled
-    **	for a long time, then then temporarily bump the fe priority 
-    **	up so that it gets to run at least one. 
-    */	
-// #if 0 // lth. condition off for debug.
-    if (_pr_primordialThread == t) {
-        if (OldPriorityOfPrimaryThread != -1) {
-            PR_SetThreadPriority(_pr_primordialThread, OldPriorityOfPrimaryThread);
-            OldPriorityOfPrimaryThread = -1;
-        }
-        TimeSlicesOnNonPrimaryThread = 0;
-    } else {
-        TimeSlicesOnNonPrimaryThread++;
-    }
-
-    if ((TimeSlicesOnNonPrimaryThread >= 20) && (OldPriorityOfPrimaryThread == -1)) {
-        OldPriorityOfPrimaryThread = PR_GetThreadPriority(_pr_primordialThread);
-        PR_SetThreadPriority(_pr_primordialThread, 31);
-        TimeSlicesOnNonPrimaryThread = 0;
-    }
-// #endif
-    /*
-    ** Save the Task Stack into the "shadow stack" of the current thread
-    */
-    cxByteCount  = (int) ((PRUint32) _pr_top_of_task_stack - (PRUint32) &t );
-    pSource      = (char *) &t;
-    pTarget      = (char *)((PRUint32)_pr_currentThread->stack->md.stackTop 
-                            - (PRUint32)cxByteCount );
-    _pr_currentThread->stack->md.cxByteCount = cxByteCount;
-    
-    for( bytesMoved = 0; bytesMoved < cxByteCount; bytesMoved++ )
-        *(pTarget + bytesMoved ) = *(pSource + bytesMoved );
-    
-    /* Mark the new thread as the current thread */
-    _pr_currentThread = t;
-
-    /*
-    ** Now copy the "shadow stack" of the new thread into the Task Stack
-    **
-    ** REMEMBER:
-    **    After the stack has been copied, ALL local variables in this function
-    **    are invalid !!
-    */
-    cxByteCount  = t->stack->md.cxByteCount;
-    pSource      = t->stack->md.stackTop - cxByteCount;
-    pTarget      = _pr_top_of_task_stack - cxByteCount;
-    
-    errno = (_pr_currentThread)->md.errcode;
-    
-    __asm 
-    {
-        mov cx, cxByteCount
-        mov si, WORD PTR [pSource]
-        mov di, WORD PTR [pTarget]
-        mov ax, WORD PTR [pTarget + 2]
-        mov es, ax
-        mov ax, WORD PTR [pSource + 2]
-        mov bx, ds
-        mov ds, ax
-        rep movsb
-        mov ds, bx
-    }
-
-    /* 
-    ** IMPORTANT:
-    ** ----------
-    ** SS:SP is now invalid :-( This means that all local variables and
-    ** function arguments are invalid and NO function calls can be
-    ** made !!! We must fix up SS:SP so that function calls can safely
-    ** be made...
-    */
-
-    __asm {
-        mov     ax, WORD PTR [_pr_top_of_task_stack]
-        sub     ax, cxByteCount
-        mov     sp, ax
-    };
-
-    /*
-    ** Resume execution of thread: t by restoring the thread's context.
-    **
-    */
-    Throw((_pr_currentThread)->md.context, 1);
-} /* --- end MD_RESTORE_CONTEXT() --- */
-
-
-static void TraceDispatch( PRThread *thread )
-{
-    int i;
-    
-    /*
-    ** push all DispatchTrace objects to down one slot.
-    ** Note: the last entry is lost; last-1 becomes last, etc.
-    */
-    for( i = NUM_DISPATCHTRACE_OBJECTS -2; i >= 0; i-- )
-    {
-        dt[i +1] = dt[i];
-    }
-    
-    /*
-    ** Build dt[0] from t
-    */
-    dt->thread = thread;
-    dt->state = thread->state;
-    dt->mdThreadNumber = thread->md.threadNumber;
-    dt->priority = thread->priority;
-    
-    return;
-} /* --- end TraceDispatch() --- */
-
-
-/* $$ end W16thred.c */
--- a/nsprpub/pr/src/misc/prdtoa.c
+++ b/nsprpub/pr/src/misc/prdtoa.c
@@ -30,16 +30,26 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+/*
+ * This file is based on the third-party code dtoa.c.  We minimize our
+ * modifications to third-party code to make it easy to merge new versions.
+ * The author of dtoa.c was not willing to add the parentheses suggested by
+ * GCC, so we suppress these warnings.
+ */
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+#pragma GCC diagnostic ignored "-Wparentheses"
+#endif
+
 #include "primpl.h"
 
 #define MULTIPLE_THREADS
 #define ACQUIRE_DTOA_LOCK(n)	PR_Lock(dtoa_lock[n])
 #define FREE_DTOA_LOCK(n)	PR_Unlock(dtoa_lock[n])
 
 static PRLock *dtoa_lock[2];
 
@@ -212,21 +222,16 @@ void _PR_CleanupDtoa(void)
  *	You must also invoke freedtoa(s) to free the value s returned by
  *	dtoa.  You may do so whether or not MULTIPLE_THREADS is #defined.
  * #define NO_IEEE_Scale to disable new (Feb. 1997) logic in strtod that
  *	avoids underflows on inputs whose result does not underflow.
  *	If you #define NO_IEEE_Scale on a machine that uses IEEE-format
  *	floating-point numbers and flushes underflows to zero rather
  *	than implementing gradual underflow, then you must also #define
  *	Sudden_Underflow.
- * #define YES_ALIAS to permit aliasing certain double values with
- *	arrays of ULongs.  This leads to slightly better code with
- *	some compilers and was always used prior to 19990916, but it
- *	is not strictly legal and can cause trouble with aggressively
- *	optimizing compilers (e.g., gcc 2.95.1 under -O2).
  * #define USE_LOCALE to use the current locale's decimal_point value.
  * #define SET_INEXACT if IEEE arithmetic is being used and extra
  *	computation should be done to set the inexact flag when the
  *	result is inexact and avoid setting inexact when the result
  *	is exact.  In this case, dtoa.c must be compiled in
  *	an environment, perhaps provided by #include "dtoa.c" in a
  *	suitable wrapper, that defines two functions,
  *		int get_inexact(void);
@@ -353,34 +358,23 @@ extern "C" {
 #endif
 
 #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(IEEE_ARM) + defined(VAX) + defined(IBM) != 1
 Exactly one of IEEE_8087, IEEE_MC68k, IEEE_ARM, VAX, or IBM should be defined.
 #endif
 
 typedef union { double d; ULong L[2]; } U;
 
-#ifdef YES_ALIAS
-#define dval(x) x
+#define dval(x) (x).d
 #ifdef IEEE_8087
-#define word0(x) ((ULong *)&x)[1]
-#define word1(x) ((ULong *)&x)[0]
+#define word0(x) (x).L[1]
+#define word1(x) (x).L[0]
 #else
-#define word0(x) ((ULong *)&x)[0]
-#define word1(x) ((ULong *)&x)[1]
-#endif
-#else
-#ifdef IEEE_8087
-#define word0(x) ((U*)&x)->L[1]
-#define word1(x) ((U*)&x)->L[0]
-#else
-#define word0(x) ((U*)&x)->L[0]
-#define word1(x) ((U*)&x)->L[1]
-#endif
-#define dval(x) ((U*)&x)->d
+#define word0(x) (x).L[0]
+#define word1(x) (x).L[1]
 #endif
 
 /* The following definition of Storeinc is appropriate for MIPS processors.
  * An alternative that might be better on some machines is
  * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
  */
 #if defined(IEEE_8087) + defined(IEEE_ARM) + defined(VAX)
 #define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
@@ -1179,24 +1173,25 @@ diff
 		wa--;
 	c->wds = wa;
 	return c;
 	}
 
  static double
 ulp
 #ifdef KR_headers
-	(x) double x;
+	(dx) double dx;
 #else
-	(double x)
+	(double dx)
 #endif
 {
 	register Long L;
-	double a;
+	U x, a;
 
+	dval(x) = dx;
 	L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
 #ifndef Avoid_Underflow
 #ifndef Sudden_Underflow
 	if (L > 0) {
 #endif
 #endif
 #ifdef IBM
 		L |= Exp_msk1 >> 4;
@@ -1228,17 +1223,17 @@ b2d
 #ifdef KR_headers
 	(a, e) Bigint *a; int *e;
 #else
 	(Bigint *a, int *e)
 #endif
 {
 	ULong *xa, *xa0, w, y, z;
 	int k;
-	double d;
+	U d;
 #ifdef VAX
 	ULong d0, d1;
 #else
 #define d0 word0(d)
 #define d1 word1(d)
 #endif
 
 	xa0 = a->x;
@@ -1291,29 +1286,34 @@ b2d
 #undef d1
 #endif
 	return dval(d);
 	}
 
  static Bigint *
 d2b
 #ifdef KR_headers
-	(d, e, bits) double d; int *e, *bits;
+	(dd, e, bits) double dd; int *e, *bits;
 #else
-	(double d, int *e, int *bits)
+	(double dd, int *e, int *bits)
 #endif
 {
+	U d;
 	Bigint *b;
 	int de, k;
 	ULong *x, y, z;
 #ifndef Sudden_Underflow
 	int i;
 #endif
 #ifdef VAX
 	ULong d0, d1;
+#endif
+
+	dval(d) = dd;
+#ifdef VAX
 	d0 = word0(d) >> 16 | word0(d) << 16;
 	d1 = word1(d) >> 16 | word1(d) << 16;
 #else
 #define d0 word0(d)
 #define d1 word1(d)
 #endif
 
 #ifdef Pack_32
@@ -1434,17 +1434,17 @@ d2b
  static double
 ratio
 #ifdef KR_headers
 	(a, b) Bigint *a, *b;
 #else
 	(Bigint *a, Bigint *b)
 #endif
 {
-	double da, db;
+	U da, db;
 	int k, ka, kb;
 
 	dval(da) = b2d(a, &ka);
 	dval(db) = b2d(b, &kb);
 #ifdef Pack_32
 	k = ka - kb + 32*(a->wds - b->wds);
 #else
 	k = ka - kb + 16*(a->wds - b->wds);
@@ -1608,17 +1608,18 @@ PR_strtod
 #endif
 {
 #ifdef Avoid_Underflow
 	int scale;
 #endif
 	int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
 		 e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
 	CONST char *s, *s0, *s1;
-	double aadj, aadj1, adj, rv, rv0;
+	double aadj, aadj1, adj;
+	U aadj2, rv, rv0;
 	Long L;
 	ULong y, z;
 	Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
 #ifdef SET_INEXACT
 	int inexact, oldinexact;
 #endif
 #ifdef Honor_FLT_ROUNDS
 	int rounding;
@@ -2371,17 +2372,19 @@ PR_strtod
 #ifdef Avoid_Underflow
 			if (scale && y <= 2*P*Exp_msk1) {
 				if (aadj <= 0x7fffffff) {
 					if ((z = aadj) <= 0)
 						z = 1;
 					aadj = z;
 					aadj1 = dsign ? aadj : -aadj;
 					}
-				word0(aadj1) += (2*P+1)*Exp_msk1 - y;
+				dval(aadj2) = aadj1;
+				word0(aadj2) += (2*P+1)*Exp_msk1 - y;
+				aadj1 = dval(aadj2);
 				}
 			adj = aadj1 * ulp(dval(rv));
 			dval(rv) += adj;
 #else
 #ifdef Sudden_Underflow
 			if ((word0(rv) & Exp_mask) <= P*Exp_msk1) {
 				dval(rv0) = dval(rv);
 				word0(rv) += P*Exp_msk1;
@@ -2706,20 +2709,20 @@ freedtoa(char *s)
  *	   "uniformly" distributed input, the probability is
  *	   something like 10^(k-15) that we must resort to the Long
  *	   calculation.
  */
 
  static char *
 dtoa
 #ifdef KR_headers
-	(d, mode, ndigits, decpt, sign, rve)
-	double d; int mode, ndigits, *decpt, *sign; char **rve;
+	(dd, mode, ndigits, decpt, sign, rve)
+	double dd; int mode, ndigits, *decpt, *sign; char **rve;
 #else
-	(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
+	(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve)
 #endif
 {
  /*	Arguments ndigits, decpt, sign are similar to those
 	of ecvt and fcvt; trailing zeros are suppressed from
 	the returned string.  If not null, *rve is set to point
 	to the end of the return value.  If d is +-Infinity or NaN,
 	then *decpt is set to 9999.
 
@@ -2755,32 +2758,34 @@ dtoa
 		j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
 		spec_case, try_quick;
 	Long L;
 #ifndef Sudden_Underflow
 	int denorm;
 	ULong x;
 #endif
 	Bigint *b, *b1, *delta, *mlo, *mhi, *S;
-	double d2, ds, eps;
+	U d, d2, eps;
+	double ds;
 	char *s, *s0;
 #ifdef Honor_FLT_ROUNDS
 	int rounding;
 #endif
 #ifdef SET_INEXACT
 	int inexact, oldinexact;
 #endif
 
 #ifndef MULTIPLE_THREADS
 	if (dtoa_result) {
 		freedtoa(dtoa_result);
 		dtoa_result = 0;
 		}
 #endif
 
+	dval(d) = dd;
 	if (word0(d) & Sign_bit) {
 		/* set sign for everything, including 0's and NaNs */
 		*sign = 1;
 		word0(d) &= ~Sign_bit;	/* clear sign bit */
 		}
 	else
 		*sign = 0;
 
@@ -3351,17 +3356,19 @@ dtoa
 			if (s == s0) {
 				k++;
 				*s++ = '1';
 				goto ret;
 				}
 		++*s++;
 		}
 	else {
+#ifdef Honor_FLT_ROUNDS
  trimzeros:
+#endif
 		while(*--s == '0');
 		s++;
 		}
  ret:
 	Bfree(S);
 	if (mhi) {
 		if (mlo && mlo != mhi)
 			Bfree(mlo);
@@ -3430,23 +3437,25 @@ PR_dtoa(PRFloat64 d, PRIntn mode, PRIntn
 ** This should be reparameterized so that you can send in a
 **   prcn for the positive and negative ranges.  For now, 
 **   conform to the ECMA JavaScript spec which says numbers
 **   less than 1e-6 are in scientific notation.
 ** Also, the ECMA spec says that there should always be a
 **   '+' or '-' after the 'e' in scientific notation
 */
 PR_IMPLEMENT(void)
-PR_cnvtf(char *buf,int bufsz, int prcsn,double fval)
+PR_cnvtf(char *buf, int bufsz, int prcsn, double dfval)
 {
     PRIntn decpt, sign, numdigits;
     char *num, *nump;
     char *bufp = buf;
     char *endnum;
+    U fval;
 
+    dval(fval) = dfval;
     /* If anything fails, we store an empty string in 'buf' */
     num = (char*)PR_MALLOC(bufsz);
     if (num == NULL) {
         buf[0] = '\0';
         return;
     }
     /* XXX Why use mode 1? */
     if (PR_dtoa(dval(fval),1,prcsn,&decpt,&sign,&endnum,num,bufsz)
--- a/nsprpub/pr/src/misc/prlong.c
+++ b/nsprpub/pr/src/misc/prlong.c
@@ -37,31 +37,20 @@
 
 #include "primpl.h"
 
 static PRInt64 ll_zero = LL_INIT( 0x00000000,0x00000000 );
 static PRInt64 ll_maxint = LL_INIT( 0x7fffffff, 0xffffffff );
 static PRInt64 ll_minint = LL_INIT( 0x80000000, 0x00000000 );
 static PRUint64 ll_maxuint = LL_INIT( 0xffffffff, 0xffffffff );
 
-#if defined(HAVE_WATCOM_BUG_2)
-PRInt64 __pascal __loadds __export
-    LL_Zero(void) { return ll_zero; }
-PRInt64 __pascal __loadds __export
-    LL_MaxInt(void) { return ll_maxint; }
-PRInt64 __pascal __loadds __export
-    LL_MinInt(void) { return ll_minint; }
-PRUint64 __pascal __loadds __export
-    LL_MaxUint(void) { return ll_maxuint; }
-#else
 PR_IMPLEMENT(PRInt64) LL_Zero(void) { return ll_zero; }
 PR_IMPLEMENT(PRInt64) LL_MaxInt(void) { return ll_maxint; }
 PR_IMPLEMENT(PRInt64) LL_MinInt(void) { return ll_minint; }
 PR_IMPLEMENT(PRUint64) LL_MaxUint(void) { return ll_maxuint; }
-#endif
 
 #ifndef HAVE_LONG_LONG
 /*
 ** Divide 64-bit a by 32-bit b, which must be normalized so its high bit is 1.
 */
 static void norm_udivmod32(PRUint32 *qp, PRUint32 *rp, PRUint64 a, PRUint32 b)
 {
     PRUint32 d1, d0, q1, q0;
--- a/nsprpub/pr/src/misc/prtime.c
+++ b/nsprpub/pr/src/misc/prtime.c
@@ -45,20 +45,18 @@
 #include "prinit.h"
 #include "prtime.h"
 #include "prlock.h"
 #include "prprf.h"
 #include "prlog.h"
 
 #include <string.h>
 #include <ctype.h>
-
-#ifdef XP_MAC
+#include <errno.h>  /* for EINVAL */
 #include <time.h>
-#endif
 
 /* 
  * The COUNT_LEAPS macro counts the number of leap years passed by
  * till the start of the given year Y.  At the start of the year 4
  * A.D. the number of leap years passed by is 0, while at the start of
  * the year 5 A.D. this count is 1. The number of years divisible by
  * 100 but not divisible by 400 (the non-leap years) is deducted from
  * the count to get the correct number of leap years.
@@ -160,30 +158,30 @@ ComputeGMT(PRTime time, PRExplodedTime *
     /* Compute day of week.  Epoch started on a Thursday. */
 
     gmt->tm_wday = (numDays + 4) % 7;
     if (gmt->tm_wday < 0) {
         gmt->tm_wday += 7;
     }
 
     /* Compute the time of day. */
-    
+
     gmt->tm_hour = rem / 3600;
     rem %= 3600;
     gmt->tm_min = rem / 60;
     gmt->tm_sec = rem % 60;
 
     /*
      * Compute the year by finding the 400 year period, then working
      * down from there.
      *
      * Since numDays is originally the number of days since January 1, 1970,
      * we must change it to be the number of days from January 1, 0001.
      */
-    
+
     numDays += 719162;       /* 719162 = days from year 1 up to 1970 */
     tmp = numDays / 146097;  /* 146097 = days in 400 years */
     rem = numDays % 146097;
     gmt->tm_year = tmp * 400 + 1;
 
     /* Compute the 100 year period. */
 
     tmp = rem / 36524;    /* 36524 = days in 100 years */
@@ -194,17 +192,17 @@ ComputeGMT(PRTime time, PRExplodedTime *
     }
     gmt->tm_year += tmp * 100;
 
     /* Compute the 4 year period. */
 
     tmp = rem / 1461;     /* 1461 = days in 4 years */
     rem %= 1461;
     gmt->tm_year += tmp * 4;
-    
+
     /* Compute which year in the 4. */
 
     tmp = rem / 365;
     rem %= 365;
     if (tmp == 4) {       /* the 4th year is a leap year */
         tmp = 3;
         rem = 365;
     }
@@ -254,21 +252,17 @@ PR_ExplodeTime(
  *
  * PR_ImplodeTime --
  *
  *     Cf. time_t mktime(struct tm *tp)
  *     Note that 1 year has < 2^25 seconds.  So an PRInt32 is large enough.
  *
  *------------------------------------------------------------------------
  */
-#if defined(HAVE_WATCOM_BUG_2)
-PRTime __pascal __export __loadds
-#else
 PR_IMPLEMENT(PRTime)
-#endif
 PR_ImplodeTime(const PRExplodedTime *exploded)
 {
     PRExplodedTime copy;
     PRTime retVal;
     PRInt64 secPerDay, usecPerSec;
     PRInt64 temp;
     PRInt64 numSecs64;
     PRInt32 numDays;
@@ -508,18 +502,16 @@ PR_NormalizeTime(PRExplodedTime *time, P
  *     The following uses localtime() from the standard C library.
  *     (time.h)  This is our fallback implementation.  Unix and PC
  *     use this version.  Mac has its own machine-dependent
  *     implementation of this function.
  *
  *-------------------------------------------------------------------------
  */
 
-#include <time.h>
-
 #if defined(HAVE_INT_LOCALTIME_R)
 
 /*
  * In this case we could define the macro as
  *     #define MT_safe_localtime(timer, result) \
  *             (localtime_r(timer, result) == 0 ? result : NULL)
  * I chose to compare the return value of localtime_r with -1 so 
  * that I can catch the cases where localtime_r returns a pointer
@@ -1562,16 +1554,22 @@ PR_ParseTimeStringToExplodedTime(
   if (date != -1)
         result->tm_mday = date;
   if (month != TT_UNKNOWN)
         result->tm_month = (((int)month) - ((int)TT_JAN));
   if (year != -1)
         result->tm_year = year;
   if (dotw != TT_UNKNOWN)
         result->tm_wday = (((int)dotw) - ((int)TT_SUN));
+  /*
+   * Mainly to compute wday and yday, but normalized time is also required
+   * by the check below that works around a Visual C++ 2005 mktime problem.
+   */
+  PR_NormalizeTime(result, PR_GMTParameters);
+  /* The remaining work is to set the gmt and dst offsets in tm_params. */
 
   if (zone == TT_UNKNOWN && default_to_gmt)
         {
           /* No zone was specified, so pretend the zone was GMT. */
           zone = TT_GMT;
           zone_offset = 0;
         }
 
@@ -1611,17 +1609,42 @@ PR_ParseTimeStringToExplodedTime(
                   localTime.tm_mday = result->tm_mday;
                   localTime.tm_mon = result->tm_month;
                   localTime.tm_year = result->tm_year - 1900;
                   /* Set this to -1 to tell mktime "I don't care".  If you set
                      it to 0 or 1, you are making assertions about whether the
                      date you are handing it is in daylight savings mode or not;
                      and if you're wrong, it will "fix" it for you. */
                   localTime.tm_isdst = -1;
+
+#if _MSC_VER == 1400  /* 1400 = Visual C++ 2005 (8.0) */
+                  /*
+                   * mktime will return (time_t) -1 if the input is a date
+                   * after 23:59:59, December 31, 3000, US Pacific Time (not
+                   * UTC as documented): 
+                   * http://msdn.microsoft.com/en-us/library/d1y53h2a(VS.80).aspx
+                   * But if the year is 3001, mktime also invokes the invalid
+                   * parameter handler, causing the application to crash.  This
+                   * problem has been reported in
+                   * http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=266036.
+                   * We avoid this crash by not calling mktime if the date is
+                   * out of range.  To use a simple test that works in any time
+                   * zone, we consider year 3000 out of range as well.  (See
+                   * bug 480740.)
+                   */
+                  if (result->tm_year >= 3000) {
+                      /* Emulate what mktime would have done. */
+                      errno = EINVAL;
+                      secs = (time_t) -1;
+                  } else {
+                      secs = mktime(&localTime);
+                  }
+#else
                   secs = mktime(&localTime);
+#endif
                   if (secs != (time_t) -1)
                     {
                       PRTime usecs64;
                       LL_I2L(usecs64, secs);
                       LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
                       LL_MUL(usecs64, usecs64, usec_per_sec);
                       PR_ExplodeTime(usecs64, PR_LocalTimeParameters, result);
                       return PR_SUCCESS;
@@ -1633,18 +1656,16 @@ PR_ParseTimeStringToExplodedTime(
                    the zone offset on 00:00:00 2 Jan 1970 GMT. */
                 secs = 86400;
                 (void) MT_safe_localtime(&secs, &localTime);
                 zone_offset = localTime.tm_min
                               + 60 * localTime.tm_hour
                               + 1440 * (localTime.tm_mday - 2);
         }
 
-  /* mainly to compute wday and yday */
-  PR_NormalizeTime(result, PR_GMTParameters);
   result->tm_params.tp_gmt_offset = zone_offset * 60;
   result->tm_params.tp_dst_offset = dst_offset * 60;
 
   return PR_SUCCESS;
 }
 
 PR_IMPLEMENT(PRStatus)
 PR_ParseTimeString(
--- a/nsprpub/pr/src/misc/prtrace.c
+++ b/nsprpub/pr/src/misc/prtrace.c
@@ -416,17 +416,17 @@ PR_IMPLEMENT(void)
         PR_Unlock( logLock );
         /*
         ** Gh0D! This is awful!
         ** Anyway, to minimize lost trace data segments,
         ** I inserted the PR_Sleep(0) to cause a context switch
         ** so that the log thread could run.
         ** I know, it perturbs the universe and may cause
         ** funny things to happen in the optimized builds.
-        ** Take it out, loose data; leave it in risk Heisenberg.
+        ** Take it out, lose data; leave it in risk Heisenberg.
         */
         /* PR_Sleep(0); */
     }
 
     return;
 } /* end PR_Trace() */
 
 /*
--- a/nsprpub/pr/src/nspr.def
+++ b/nsprpub/pr/src/nspr.def
@@ -464,8 +464,13 @@ EXPORTS ;-
 ;+NSPR_4.6 {
 ;+	global:
 		PR_GetPhysicalMemorySize;
 ;+} NSPR_4.5;
 ;+NSPR_4.7 {
 ;+	global:
 		PR_ParseTimeStringToExplodedTime;
 ;+} NSPR_4.6;
+;+NSPR_4.8 {
+;+	global:
+		PR_AssertCurrentThreadOwnsLock;
+		PR_AssertCurrentThreadInMonitor;
+;+} NSPR_4.7;
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -203,18 +203,22 @@ PR_IMPLEMENT(void) PR_Lock(PRLock *lock)
 {
     PRIntn rv;
     PR_ASSERT(lock != NULL);
     rv = pthread_mutex_lock(&lock->mutex);
     PR_ASSERT(0 == rv);
     PR_ASSERT(0 == lock->notified.length);
     PR_ASSERT(NULL == lock->notified.link);
     PR_ASSERT(PR_FALSE == lock->locked);
+    /* Nb: the order of the next two statements is not critical to
+     * the correctness of PR_AssertCurrentThreadOwnsLock(), but 
+     * this particular order makes the assertion more likely to
+     * catch errors. */
+    lock->owner = pthread_self();
     lock->locked = PR_TRUE;
-    lock->owner = pthread_self();
 #if defined(DEBUG)
     pt_debug.locks_acquired += 1;
 #endif
 }  /* PR_Lock */
 
 PR_IMPLEMENT(PRStatus) PR_Unlock(PRLock *lock)
 {
     PRIntn rv;
@@ -236,16 +240,24 @@ PR_IMPLEMENT(PRStatus) PR_Unlock(PRLock 
     else pt_PostNotifies(lock, PR_TRUE);
 
 #if defined(DEBUG)
     pt_debug.locks_released += 1;
 #endif
     return PR_SUCCESS;
 }  /* PR_Unlock */
 
+PR_IMPLEMENT(void) PR_AssertCurrentThreadOwnsLock(PRLock *lock)
+{
+    /* Nb: the order of the |locked| and |owner==me| checks is not critical 
+     * to the correctness of PR_AssertCurrentThreadOwnsLock(), but 
+     * this particular order makes the assertion more likely to
+     * catch errors. */
+    PR_ASSERT(lock->locked && pthread_equal(lock->owner, pthread_self()));
+}
 
 /**************************************************************/
 /**************************************************************/
 /***************************CONDITIONS*************************/
 /**************************************************************/
 /**************************************************************/
 
 
@@ -511,16 +523,21 @@ PR_IMPLEMENT(void) PR_DestroyMonitor(PRM
 PR_IMPLEMENT(PRIntn) PR_GetMonitorEntryCount(PRMonitor *mon)
 {
     pthread_t self = pthread_self();
     if (pthread_equal(mon->owner, self))
         return mon->entryCount;
     return 0;
 }
 
+PR_IMPLEMENT(void) PR_AssertCurrentThreadInMonitor(PRMonitor *mon)
+{
+    PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(&mon->lock);
+}
+
 PR_IMPLEMENT(void) PR_EnterMonitor(PRMonitor *mon)
 {
     pthread_t self = pthread_self();
 
     PR_ASSERT(mon != NULL);
     /*
      * This is safe only if mon->owner (a pthread_t) can be
      * read in one instruction.  Perhaps mon->owner should be
--- a/nsprpub/pr/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -47,16 +47,23 @@
 #include "primpl.h"
 #include "prpdce.h"
 
 #include <pthread.h>
 #include <unistd.h>
 #include <string.h>
 #include <signal.h>
 
+#ifdef SYMBIAN
+/* In Open C sched_get_priority_min/max do not work properly, so we undefine
+ * _POSIX_THREAD_PRIORITY_SCHEDULING here.
+ */
+#undef _POSIX_THREAD_PRIORITY_SCHEDULING
+#endif
+
 /*
  * Record whether or not we have the privilege to set the scheduling
  * policy and priority of threads.  0 means that privilege is available.
  * EPERM means that privilege is not available.
  */
 
 static PRIntn pt_schedpriv = 0;
 extern PRLock *_pr_sleeplock;
--- a/nsprpub/pr/src/threads/combined/prulock.c
+++ b/nsprpub/pr/src/threads/combined/prulock.c
@@ -399,16 +399,26 @@ PR_IMPLEMENT(PRStatus) PR_Unlock(PRLock 
     _PR_LOCK_UNLOCK(lock);
     if (!_PR_IS_NATIVE_THREAD(me))
     	_PR_INTSON(is);
     return PR_SUCCESS;
 #endif  /* _PR_GLOBAL_THREADS_ONLY */
 }
 
 /*
+**  If the current thread owns |lock|, this assertion is guaranteed to
+**  succeed.  Otherwise, the behavior of this function is undefined.
+*/
+PR_IMPLEMENT(void) PR_AssertCurrentThreadOwnsLock(PRLock *lock)
+{
+    PRThread *me = _PR_MD_CURRENT_THREAD();
+    PR_ASSERT(lock->owner == me);
+}
+
+/*
 ** Test and then lock the lock if it's not already locked by some other
 ** thread. Return PR_FALSE if some other thread owned the lock at the
 ** time of the call.
 */
 PR_IMPLEMENT(PRBool) PR_TestAndLock(PRLock *lock)
 {
     PRThread *me = _PR_MD_CURRENT_THREAD();
     PRBool rv = PR_FALSE;
--- a/nsprpub/pr/src/threads/prmon.c
+++ b/nsprpub/pr/src/threads/prmon.c
@@ -140,16 +140,25 @@ PR_IMPLEMENT(PRStatus) PR_ExitMonitor(PR
 */
 PR_IMPLEMENT(PRIntn) PR_GetMonitorEntryCount(PRMonitor *mon)
 {
     return (mon->cvar->lock->owner == _PR_MD_CURRENT_THREAD()) ?
         mon->entryCount : 0;
 }
 
 /*
+** If the current thread is in |mon|, this assertion is guaranteed to
+** succeed.  Otherwise, the behavior of this function is undefined.
+*/
+PR_IMPLEMENT(void) PR_AssertCurrentThreadInMonitor(PRMonitor *mon)
+{
+    PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(mon->cvar->lock);
+}
+
+/*
 ** Wait for a notify on the condition variable. Sleep for "ticks" amount
 ** of time (if "tick" is 0 then the sleep is indefinite). While
 ** the thread is waiting it exits the monitors lock (as if it called
 ** PR_ExitMonitor as many times as it had called PR_EnterMonitor).  When
 ** the wait has finished the thread regains control of the monitors lock
 ** with the same entry count as before the wait began.
 **
 ** The thread waiting on the monitor will be resumed when the monitor is
--- a/nsprpub/pr/tests/Makefile.in
+++ b/nsprpub/pr/tests/Makefile.in
@@ -120,16 +120,17 @@ CSRCS =             \
 	op_2long.c      \
 	op_excl.c		\
 	op_filnf.c		\
 	op_filok.c		\
 	op_noacc.c		\
 	op_nofil.c		\
 	openfile.c		\
 	parent.c    	\
+	parsetm.c    	\
 	peek.c    		\
 	perf.c    		\
 	pipeping.c		\
 	pipeping2.c		\
 	pipepong.c		\
 	pipepong2.c		\
 	pipeself.c		\
 	poll_er.c		\
@@ -198,48 +199,78 @@ CSRCS =             \
 	udpsrv.c	    \
 	writev.c        \
 	xnotify.c       \
 	y2k.c           \
 	y2ktmo.c        \
 	zerolen.c       \
 	$(NULL)
 
+ifeq ($(OS_ARCH),WINCE)
+TESTPROGS =          \
+    wince_tester.cpp  \
+    $(NULL)
+endif
+
 ifeq ($(OS_TARGET),OS2)
 CSRCS +=            \
 	sleep.c			\
 	stat.c		    \
 	yield.c         \
 	$(NULL)
 endif
 
-ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
+DLL_SUFFIX = .dll
 else
 PROG_SUFFIX =
+DLL_SUFFIX = 
 endif
 
+ifeq ($(OS_ARCH),WINCE)
+PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(DLL_SUFFIX))) $(addprefix $(OBJDIR)/, $(TESTPROGS:.cpp=$(PROG_SUFFIX)))
+else
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
+endif
 
 TARGETS = $(PROGS)
 
 INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 ifeq ($(OS_ARCH), WINNT)
 ifdef NS_USE_GCC
   EXTRA_LIBS += -lwsock32
 else
   EXTRA_LIBS += wsock32.lib
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
-  ifdef PROFILE                                                                              
-    LDOPTS += -PROFILE -MAP                                                                  
+  ifdef PROFILE
+    LDOPTS += -PROFILE -MAP
   endif # profile
 endif # NS_USE_GCC
 endif
 
+ifeq ($(OS_ARCH),WINCE)
+ifdef NS_USE_GCC
+  EXTRA_LIBS += -lws2 -lcoredll
+else
+  INCLUDES += -FInst_wince.h
+  EXTRA_LIBS += ws2.lib coredll.lib
+  LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO -PDB:$(@:.dll=.pdb)
+  EXE_EXTRA_LDOPTS = -SUBSYSTEM:CONSOLE
+  ifdef PROFILE
+    LDOPTS += -PROFILE -MAP
+  endif # profile
+endif # NS_USE_GCC
+
+# Use CC to compile all CPP files / also use all CC flags
+CCC = $(CC)
+CXXFLAGS = $(CFLAGS)
+endif
+
 ifeq ($(OS_ARCH),OS2)
 EXTRA_LIBS = $(OS_LIBS)
 LDOPTS = -Zomf -Zlinker /PM:VIO -Zlinker /ST:0x64000
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 # Use an absolute pathname as the runtime library path (for the -R
 # or -rpath linker option or the LD_RUN_PATH environment variable).
@@ -481,20 +512,46 @@ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -out:$@
 ifdef MT
 	@if test -f $@.manifest; then \
 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 		rm -f $@.manifest; \
 	fi
 endif
 else
+ifeq ($(OS_ARCH),WINCE)
+	$(PURE) $(LD) $(XCFLAGS) $< $(LDOPTS:.exe=.pdb) $(EXE_EXTRA_LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -OUT:$@
+else
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@
+endif # wince
 endif # WINNT
 endif # AIX_PRE_4_2
 
+
+ifeq ($(OS_ARCH),WINCE)
+$(OBJS): $(OBJDIR)/%.$(OBJ_SUFFIX): nst_wince.h
+
+# WinCE HAS to be different.  Turns out that the OS swallows crashes
+#   and returns a result code of zero -- an indication of success for
+#   the shell script.  AND, WinCE does not really have a good shell 
+#   to use for testing, anyway.
+#
+# To combat both issues, we need to build the tests as stand-alone
+# DLLs, then dynamically load the DLLs one at a time inside a test
+# program.  Each DLL's test will be run inside a TRY/CATCH construct,
+# allowing the testing program to do what the shell script already
+# does naturally. 
+#
+# This section builds DLLs instead of EXEs for each of the tests.
+# - wolfe@lobo.us
+$(OBJDIR)/%$(DLL_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
+	@$(MAKE_OBJDIR)
+	$(PURE) $(LD) $(XCFLAGS) $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -DLL -OUT:$@ $< 
+endif # wince
+
 export:: $(TARGETS)
 clean::
 	rm -f $(TARGETS)
 
 # The following tests call BSD socket functions, so they need to link
 # with -lsocket on some platforms.
 ifeq ($(OS_ARCH),SunOS)
 ifneq ($(OS_RELEASE),4.1.3_U1)
--- a/nsprpub/pr/tests/accept.c
+++ b/nsprpub/pr/tests/accept.c
@@ -78,17 +78,17 @@
 #define ACCEPT_READ_FAST_CB    0x5
 
 #define CLIENT_NORMAL        0x1
 #define CLIENT_TIMEOUT_ACCEPT    0x2
 #define CLIENT_TIMEOUT_SEND    0x3
 
 #define SERVER_MAX_BIND_COUNT        100
 
-#if defined(XP_MAC) || defined(XP_OS2)
+#if defined(XP_MAC) || defined(XP_OS2) || defined(SYMBIAN)
 #define TIMEOUTSECS 10
 #else
 #define TIMEOUTSECS 2
 #endif
 PRIntervalTime timeoutTime;
 
 static PRInt32 count = 1;
 static PRFileDesc *output;
--- a/nsprpub/pr/tests/acceptread.c
+++ b/nsprpub/pr/tests/acceptread.c
@@ -60,17 +60,21 @@ static PRStatus PrintAddress(const PRNet
         std_out, "Accepted connection from (0x%p)%s:%d\n",
         address, buffer, address->inet.port);
     return rv;
 }  /* PrintAddress */
 
 static void ConnectingThread(void *arg)
 {
     PRInt32 nbytes;
+#ifdef SYMBIAN
+    char buf[256];
+#else
     char buf[1024];
+#endif
     PRFileDesc *sock;
     PRNetAddr peer_addr, *addr;
 
     addr = (PRNetAddr*)arg;
 
     sock = PR_NewTCPSocket();
     if (sock == NULL)
     {
@@ -177,17 +181,17 @@ static void AcceptingThread(void *arg)
             PL_FPrintError(err_out, "PR_Close (server) failed");
     }
 
     rv = PR_Close(listen_sock);
     if (PR_FAILURE == rv)
         PL_FPrintError(err_out, "PR_Close (server) failed");
 }  /* AcceptingThread */
 
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
 {
     PRHostEnt he;
     PRStatus status;
     PRIntn next_index;
     PRUint16 port_number;
     char netdb_buf[PR_NETDB_BUF_SIZE];
     PRNetAddr client_addr, server_addr;
     PRThread *client_thread, *server_thread;
--- a/nsprpub/pr/tests/acceptreademu.c
+++ b/nsprpub/pr/tests/acceptreademu.c
@@ -75,17 +75,21 @@ static PRStatus PrintAddress(const PRNet
         std_out, "Accepted connection from (0x%p)%s:%d\n",
         address, buffer, address->inet.port);
     return rv;
 }  /* PrintAddress */
 
 static void ConnectingThread(void *arg)
 {
     PRInt32 nbytes;
+#ifdef SYMBIAN
+    char buf[256];
+#else
     char buf[1024];
+#endif
     PRFileDesc *sock;
     PRNetAddr peer_addr, *addr;
 
     addr = (PRNetAddr*)arg;
 
     sock = PR_NewTCPSocket();