Bug 450696: Updated NSPR to the NSPR_4_7_2_BETA2 CVS tag. r=kaie
authorWan-Teh Chang <wtc@google.com>
Mon, 01 Sep 2008 12:15:40 -0700
changeset 18550 a9ce01b87b4c7fd76e589fd5b49b8c2170904e5f
parent 18548 377f7d847c62cec3bca7102d9e7c00ab1e1fed41
child 18551 e2c3679da76e998c5986a95a0e1e8ef27e0c6b76
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaie
bugs450696
milestone1.9.1b1pre
Bug 450696: Updated NSPR to the NSPR_4_7_2_BETA2 CVS tag. r=kaie
nsprpub/admin/repackage.sh
nsprpub/config/Makefile.in
nsprpub/config/now.c
nsprpub/config/rules.mk
nsprpub/configure
nsprpub/configure.in
nsprpub/lib/ds/Makefile.in
nsprpub/lib/ds/plarena.c
nsprpub/lib/ds/plhash.h
nsprpub/lib/libc/src/Makefile.in
nsprpub/lib/libc/src/strcase.c
nsprpub/lib/libc/src/strccmp.c
nsprpub/lib/libc/src/strcstr.c
nsprpub/lib/msgc/tests/Makefile.in
nsprpub/lib/prstreams/Makefile.in
nsprpub/lib/prstreams/tests/testprstrm/Makefile.in
nsprpub/lib/prstreams/tests/testprstrm/testprstrm.cpp
nsprpub/lib/tests/Makefile.in
nsprpub/pr/include/md/_darwin.cfg
nsprpub/pr/include/md/_darwin.h
nsprpub/pr/include/md/_os2.h
nsprpub/pr/include/md/_os2_errors.h
nsprpub/pr/include/md/_pcos.h
nsprpub/pr/include/md/_pth.h
nsprpub/pr/include/md/_solaris.h
nsprpub/pr/include/md/_symbian.cfg
nsprpub/pr/include/md/_symbian.h
nsprpub/pr/include/md/_unixos.h
nsprpub/pr/include/md/prosdep.h
nsprpub/pr/include/prinet.h
nsprpub/pr/include/prinit.h
nsprpub/pr/include/prio.h
nsprpub/pr/include/private/pprio.h
nsprpub/pr/include/private/primpl.h
nsprpub/pr/include/prtypes.h
nsprpub/pr/src/Makefile.in
nsprpub/pr/src/cplus/tests/Makefile.in
nsprpub/pr/src/io/Makefile.in
nsprpub/pr/src/io/prlog.c
nsprpub/pr/src/io/prmapopt.c
nsprpub/pr/src/io/prprf.c
nsprpub/pr/src/io/prsocket.c
nsprpub/pr/src/md/beos/bnet.c
nsprpub/pr/src/md/os2/Makefile.in
nsprpub/pr/src/md/os2/objs.mk
nsprpub/pr/src/md/os2/os2_errors.c
nsprpub/pr/src/md/os2/os2cv.c
nsprpub/pr/src/md/os2/os2io.c
nsprpub/pr/src/md/os2/os2poll.c
nsprpub/pr/src/md/os2/os2sock.c
nsprpub/pr/src/md/os2/os2thred.c
nsprpub/pr/src/md/os2/os2vacpp.asm
nsprpub/pr/src/md/prosdep.c
nsprpub/pr/src/md/unix/Makefile.in
nsprpub/pr/src/md/unix/os_Darwin.s
nsprpub/pr/src/md/unix/os_Darwin_x86_64.s
nsprpub/pr/src/md/unix/os_SunOS.s
nsprpub/pr/src/md/unix/solaris.c
nsprpub/pr/src/md/unix/symbian.c
nsprpub/pr/src/md/unix/uxrng.c
nsprpub/pr/src/md/windows/ntio.c
nsprpub/pr/src/md/windows/w95io.c
nsprpub/pr/src/misc/prnetdb.c
nsprpub/pr/src/misc/prsystem.c
nsprpub/pr/src/misc/prtime.c
nsprpub/pr/src/pthreads/ptio.c
nsprpub/pr/src/pthreads/ptsynch.c
nsprpub/pr/tests/Makefile.in
nsprpub/pr/tests/README.TXT
nsprpub/pr/tests/attach.c
nsprpub/pr/tests/foreign.c
nsprpub/pr/tests/provider.c
nsprpub/pr/tests/prpoll.c
nsprpub/pr/tests/runtests.pl
nsprpub/pr/tests/sel_spd.c
nsprpub/pr/tests/sigpipe.c
nsprpub/pr/tests/sleep.c
nsprpub/pr/tests/testfile.c
nsprpub/pr/tests/thrpool_server.c
nsprpub/pr/tests/tmocon.c
nsprpub/pr/tests/vercheck.c
nsprpub/tools/Makefile.in
--- a/nsprpub/admin/repackage.sh
+++ b/nsprpub/admin/repackage.sh
@@ -59,20 +59,20 @@
 # Note! Files written with Gnu tar are not readable by some non-Gnu
 # versions. Sun, in particular.
 # 
 # 
 # 
 # 
 # ------------------------------------------------------------------
 
-FROMTOP=/share/builds/components/nspr20/v4.7.1
-TOTOP=./v4.7.1
-NSPRDIR=nspr-4.7.1
-SOURCETAG=NSPR_4_7_1_RTM
+FROMTOP=/share/builds/components/nspr20/v4.7.2
+TOTOP=./v4.7.2
+NSPRDIR=nspr-4.7.2
+SOURCETAG=NSPR_4_7_2_RTM
 
 #
 # enumerate Unix object directories on /s/b/c
 UNIX_OBJDIRS="
 HP-UXB.11.11_64_DBG.OBJ
 HP-UXB.11.11_64_OPT.OBJ
 HP-UXB.11.11_DBG.OBJ
 HP-UXB.11.11_OPT.OBJ
--- a/nsprpub/config/Makefile.in
+++ b/nsprpub/config/Makefile.in
@@ -97,26 +97,18 @@ ifeq ($(OS_ARCH), IRIX)
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
     ifeq ($(USE_64),1)
         XLDOPTS += +DD64
     endif
 endif
 
-ifeq ($(MOZ_OS2_TOOLS),EMX)
+ifeq ($(OS_ARCH), OS2)
 XCFLAGS = $(OS_CFLAGS)
-ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF)
-XLDOPTS = -Zlinker /PM:VIO
-endif
-endif
-
-ifeq ($(MOZ_OS2_TOOLS),PGCC)
-XCFLAGS = $(OS_CFLAGS)
-XLDOPTS = -Zlinker /PM:VIO
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 PROGS	= $(OBJDIR)/now$(PROG_SUFFIX)
 
 ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
 TARGETS = $(PROGS)
@@ -144,17 +136,13 @@ ifdef WRAP_SYSTEM_INCLUDES
 export::
 	if test ! -d system_wrappers; then mkdir system_wrappers; fi
 	$(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers < $(srcdir)/system-headers
 	$(INSTALL) system_wrappers $(dist_includedir)
 endif
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(LD) $(EXEFLAGS) $<
-else
 	$(CC) $(XCFLAGS) $< $(LDFLAGS) $(XLDOPTS) $(OUTOPTION)$@
-endif
 
 install:: nspr.m4
 	$(NSINSTALL) -D $(DESTDIR)$(datadir)/aclocal
 	$(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(datadir)/aclocal
--- a/nsprpub/config/now.c
+++ b/nsprpub/config/now.c
@@ -35,22 +35,20 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #if defined(VMS)
 #include <sys/timeb.h>
-#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
+#elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
 #include <sys/time.h>
 #elif defined(WIN32)
 #include <windows.h>
-#elif defined(XP_OS2_VACPP)
-#include <sys/timeb.h>
 #else
 #error "Architecture not supported"
 #endif
 
 
 int main(int argc, char **argv)
 {
 #if defined(OMIT_LIB_BUILD_TIME)
@@ -67,17 +65,17 @@ int main(int argc, char **argv)
 #elif defined(VMS)
     long long now;
     struct timeb b;
     ftime(&b);
     now = b.time;
     now *= 1000000;
     now += (1000 * b.millitm);
     fprintf(stdout, "%Ld", now);
-#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
+#elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
     long long now;
     struct timeval tv;
 #ifdef HAVE_SVID_GETTOD
     gettimeofday(&tv);
 #else
     gettimeofday(&tv, NULL);
 #endif
     now = ((1000000LL) * tv.tv_sec) + (long long)tv.tv_usec;
@@ -101,42 +99,16 @@ int main(int argc, char **argv)
 #ifdef __GNUC__
     now = (now - 116444736000000000LL) / 10LL;
     fprintf(stdout, "%lld", now);
 #else
     now = (now - 116444736000000000i64) / 10i64;
     fprintf(stdout, "%I64d", now);
 #endif
 
-#elif defined(XP_OS2_VACPP)
-/* no long long or i64 so we use a string */
-#include <string.h>
-  char buf[24];
-  char tbuf[7];
-  time_t now;
-  long mtime;
-  int i;
-
-  struct timeb b;
-  ftime(&b);
-  now = b.time;
-  _ltoa(now, buf, 10);
-
-  mtime = b.millitm * 1000;
-  if (mtime == 0){
-    ++now;
-    strcat(buf, "000000");
-  } else {
-     _ltoa(mtime, tbuf, 10);
-     for (i = strlen(tbuf); i < 6; ++i)
-       strcat(buf, "0");
-     strcat(buf, tbuf);
-  }
-  fprintf(stdout, "%s", buf);
-
 #else
 #error "Architecture not supported"
 #endif
 
     return 0;
 }  /* main */
 
 /* now.c */
--- a/nsprpub/config/rules.mk
+++ b/nsprpub/config/rules.mk
@@ -159,20 +159,16 @@ endif
 # of assembly language source files).
 #
 
 ifndef OBJS
 OBJS		= $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
 		  $(addprefix $(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
 endif
 
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-EXTRA_LIBS := $(patsubst -l%,$(DIST)/lib/%.$(LIB_SUFFIX),$(EXTRA_LIBS))
-endif
-
 ALL_TRASH		= $(TARGETS) $(OBJS) $(RES) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
 			  $(NOSUCHFILE) \
 			  so_locations
 
 ifeq ($(OS_ARCH),OpenVMS)
 ALL_TRASH		+= $(wildcard *.c*_defines)
 ifdef SHARED_LIBRARY
 VMS_SYMVEC_FILE		= $(SHARED_LIBRARY:.$(DLL_SUFFIX)=_symvec.opt)
@@ -301,34 +297,26 @@ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
 ifdef MT
 	@if test -f $@.manifest; then \
 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 		rm -f $@.manifest; \
 	fi
 endif	# MSVC with manifest tool
 else	# WINNT && !GCC
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(CC) $(OBJS) -Fe$@ $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
-else
 	$(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)
-endif
 endif	# WINNT && !GCC
 ifdef ENABLE_STRIP
 	$(STRIP) $@
 endif
 
 $(LIBRARY): $(OBJS)
 	@$(MAKE_OBJDIR)
 	rm -f $@
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(AR) $(subst /,\\,$(OBJS)) $(AR_FLAGS)
-else
 	$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
-endif
 	$(RANLIB) $@
 
 ifeq ($(OS_TARGET), OS2)
 $(IMPORT_LIBRARY): $(MAPFILE)
 	rm -f $@
 	$(IMPLIB) $@ $(MAPFILE)
 endif
 
@@ -348,29 +336,25 @@ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
 ifdef MT
 	@if test -f $@.manifest; then \
 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
 		rm -f $@.manifest; \
 	fi
 endif	# MSVC with manifest tool
 else	# WINNT && !GCC
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
-else	# !os2 vacpp
 ifeq ($(OS_TARGET), OpenVMS)
 	@if test ! -f $(VMS_SYMVEC_FILE); then \
 	  if test -f $(VMS_SYMVEC_FILE_MODULE); then \
 	    echo Creating component options file $(VMS_SYMVEC_FILE); \
 	    cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
 	  fi; \
 	fi
 endif	# OpenVMS
 	$(MKSHLIB) $(OBJS) $(RES) $(EXTRA_LIBS)
-endif   # OS2 vacpp
 endif	# WINNT && !GCC
 endif	# AIX 4.1
 ifdef ENABLE_STRIP
 	$(STRIP) $@
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 $(RES): $(RESNAME)
@@ -391,26 +375,21 @@ ifeq ($(OS_ARCH),SunOS)
 	sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
 endif
 ifeq ($(OS_ARCH),OS2)
 	echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@
 	echo PROTMODE >> $@
 	echo CODE    LOADONCALL MOVEABLE DISCARDABLE >> $@
 	echo DATA    PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
 	echo EXPORTS >> $@
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	grep -v ';+' $< | grep -v ';-' | \
-	sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' >> $@
-else
 	grep -v ';+' $< | grep -v ';-' | \
 	sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \
 	awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}'	>> $@
 	$(ADD_TO_DEF_FILE)
 endif
-endif
 
 #
 # Translate source filenames to absolute paths. This is required for
 # debuggers under Windows and OS/2 to find source files automatically.
 #
 
 ifeq (,$(filter-out AIX OS2,$(OS_ARCH)))
 NEED_ABSOLUTE_PATH = 1
@@ -425,57 +404,43 @@ PWD := $(shell pwd)
 abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
 endif
 
 $(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
 	@$(MAKE_OBJDIR)
 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
 else
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
-else
 ifdef NEED_ABSOLUTE_PATH
 	$(CCC) -o $@ -c $(CCCFLAGS) $(call abspath,$<)
 else
 	$(CCC) -o $@ -c $(CCCFLAGS) $<
 endif
 endif
-endif
 
 WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
 WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
 WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
 $(OBJDIR)/%.$(OBJ_SUFFIX): %.c
 	@$(MAKE_OBJDIR)
 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
 else
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
-else
 ifdef NEED_ABSOLUTE_PATH
 	$(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
 else
 	$(CC) -o $@ -c $(CFLAGS) $<
 endif
 endif
-endif
 
 
 $(OBJDIR)/%.$(OBJ_SUFFIX): %.s
 	@$(MAKE_OBJDIR)
 	$(AS) -o $@ $(ASFLAGS) -c $<
 
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-$(OBJDIR)/%.$(OBJ_SUFFIX): %.asm
-	@$(MAKE_OBJDIR)
-	$(AS) -Fdo:./$(OBJDIR) $(ASFLAGS) $<
-endif
-
 %.i: %.c
 	$(CC) -C -E $(CFLAGS) $< > $*.i
 
 %: %.pl
 	rm -f $@; cp $< $@; chmod +x $@
 
 #
 # HACK ALERT
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -59,19 +59,16 @@ ac_help="$ac_help
 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
   --with-bthreads         Use system bthreads library as thread subsystem
                           (BeOS only)"
 ac_help="$ac_help
-  --with-native-threads   Use native system threads as thread subsystem
-                          (Solaris only)"
-ac_help="$ac_help
   --enable-ipv6           Compile ipv6 support"
 ac_help="$ac_help
   --enable-boehm          Enable the Boehm Garbage Collector"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
 # dashes changed to underlines.
 build=NONE
@@ -623,17 +620,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:632: checking host system type" >&5
+echo "configure:629: 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; }
@@ -644,17 +641,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:653: checking target system type" >&5
+echo "configure:650: 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 ;;
@@ -662,17 +659,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:671: checking build system type" >&5
+echo "configure:668: 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 ;;
@@ -687,17 +684,17 @@ echo "$ac_t""$build" 1>&6
 test "$host_alias" != "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=7
-MOD_PATCH_VERSION=1
+MOD_PATCH_VERSION=2
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -734,17 +731,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:743: checking for $ac_word" >&5
+echo "configure:740: 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"
@@ -1062,17 +1059,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:1071: checking for $ac_word" >&5
+echo "configure:1068: 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.
   ;;
   ?:/*)			 
@@ -1133,23 +1130,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:1142: checking for $host compiler" >&5
+echo "configure:1139: 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:1148: checking for $ac_word" >&5
+echo "configure:1145: 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"
@@ -1185,26 +1182,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:1194: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+echo "configure:1191: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
     cat > conftest.$ac_ext <<EOF
-#line 1196 "configure"
+#line 1193 "configure"
 #include "confdefs.h"
 
 int main() {
 return(0);
 ; return 0; }
 EOF
-if { (eval echo configure:1203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1200: \"$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
@@ -1223,17 +1220,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:1232: checking for $ac_word" >&5
+echo "configure:1229: 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"
@@ -1257,17 +1254,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:1266: checking for $ac_word" >&5
+echo "configure:1263: 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"
@@ -1287,17 +1284,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:1296: checking for $ac_word" >&5
+echo "configure:1293: 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
@@ -1338,17 +1335,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:1347: checking for $ac_word" >&5
+echo "configure:1344: 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"
@@ -1370,33 +1367,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:1379: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1376: 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 1390 "configure"
+#line 1387 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1392: \"$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
@@ -1412,31 +1409,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:1421: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1418: 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:1426: checking whether we are using GNU C" >&5
+echo "configure:1423: 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:1435: \"$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:1432: \"$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
 
@@ -1445,17 +1442,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:1454: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1451: 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
@@ -1482,17 +1479,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:1491: checking for $ac_word" >&5
+echo "configure:1488: 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"
@@ -1518,17 +1515,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:1527: checking for $ac_word" >&5
+echo "configure:1524: 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"
@@ -1550,33 +1547,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:1559: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1556: 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 1570 "configure"
+#line 1567 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1572: \"$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
@@ -1592,31 +1589,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:1601: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1598: 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:1606: checking whether we are using GNU C++" >&5
+echo "configure:1603: 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:1615: \"$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:1612: \"$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
 
@@ -1625,17 +1622,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:1634: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1631: 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
@@ -1670,17 +1667,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:1679: checking for $ac_word" >&5
+echo "configure:1676: 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"
@@ -1705,17 +1702,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:1714: checking for $ac_word" >&5
+echo "configure:1711: 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"
@@ -1740,17 +1737,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:1749: checking for $ac_word" >&5
+echo "configure:1746: 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"
@@ -1775,17 +1772,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:1784: checking for $ac_word" >&5
+echo "configure:1781: 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"
@@ -1810,17 +1807,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:1819: checking for $ac_word" >&5
+echo "configure:1816: 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"
@@ -1845,17 +1842,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:1854: checking for $ac_word" >&5
+echo "configure:1851: 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"
@@ -1880,17 +1877,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:1889: checking for $ac_word" >&5
+echo "configure:1886: 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"
@@ -1910,17 +1907,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:1919: checking for $ac_word" >&5
+echo "configure:1916: 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
@@ -1961,17 +1958,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:1970: checking for $ac_word" >&5
+echo "configure:1967: 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"
@@ -1993,33 +1990,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:2002: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1999: 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 2013 "configure"
+#line 2010 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2015: \"$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
@@ -2035,31 +2032,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:2044: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2041: 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:2049: checking whether we are using GNU C" >&5
+echo "configure:2046: 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:2058: \"$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:2055: \"$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
 
@@ -2068,17 +2065,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:2077: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2074: 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
@@ -2108,17 +2105,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:2117: checking for $ac_word" >&5
+echo "configure:2114: 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"
@@ -2140,33 +2137,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:2149: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:2146: 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 2160 "configure"
+#line 2157 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:2165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2162: \"$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
@@ -2182,31 +2179,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:2191: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2188: 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:2196: checking whether we are using GNU C++" >&5
+echo "configure:2193: 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:2205: \"$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:2202: \"$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
 
@@ -2215,17 +2212,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:2224: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:2221: 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
@@ -2249,72 +2246,72 @@ else
   else
     CXXFLAGS=
   fi
 fi
 
         fi
     fi
     echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2258: checking how to run the C preprocessor" >&5
+echo "configure:2255: 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 2273 "configure"
+#line 2270 "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:2279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2276: \"$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 2290 "configure"
+#line 2287 "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:2296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2293: \"$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 2307 "configure"
+#line 2304 "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:2313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2310: \"$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*
@@ -2331,17 +2328,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:2340: checking for $ac_word" >&5
+echo "configure:2337: 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"
@@ -2363,17 +2360,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:2372: checking for $ac_word" >&5
+echo "configure:2369: 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.
   ;;
   ?:/*)			 
@@ -2404,17 +2401,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:2413: checking for $ac_word" >&5
+echo "configure:2410: 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.
   ;;
   ?:/*)			 
@@ -2445,17 +2442,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:2454: checking for $ac_word" >&5
+echo "configure:2451: 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.
   ;;
   ?:/*)			 
@@ -2486,17 +2483,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:2495: checking for $ac_word" >&5
+echo "configure:2492: 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.
   ;;
   ?:/*)			 
@@ -2527,17 +2524,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:2536: checking for $ac_word" >&5
+echo "configure:2533: 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.
   ;;
   ?:/*)			 
@@ -2595,39 +2592,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:2604: checking for gcc -pipe support" >&5
+echo "configure:2601: 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 2619 "configure"
+#line 2616 "configure"
 #include "confdefs.h"
  #include <stdio.h> 
 int main() {
 printf("Hello World\n");
 ; return 0; }
 EOF
-if { (eval echo configure:2626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2623: \"$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
@@ -2644,17 +2641,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:2653: checking for visibility(hidden) attribute" >&5
+echo "configure:2650: 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
@@ -2668,17 +2665,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:2677: checking for visibility pragma support" >&5
+echo "configure:2674: 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;
@@ -2721,17 +2718,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:2730: checking for $ac_word" >&5
+echo "configure:2727: 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.
   ;;
   ?:/*)			 
@@ -2978,27 +2975,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:2987: checking for sys/atomic_op.h" >&5
+echo "configure:2984: 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 2992 "configure"
+#line 2989 "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:2997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2994: \"$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
@@ -3145,36 +3142,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:3154: checking for gethostbyaddr in -lbind" >&5
+echo "configure:3151: 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 3162 "configure"
+#line 3159 "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:3173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3170: \"$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
@@ -3344,43 +3341,43 @@ EOF
     cat >> confdefs.h <<\EOF
 #define DARWIN 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define HAVE_BSD_FLOCK 1
 EOF
 
+    cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
     CFLAGS="$CFLAGS -Wmost -fno-common"
     case "${target_cpu}" in
         i*86*)
-            cat >> confdefs.h <<\EOF
-#define i386 1
-EOF
-
-            CPU_ARCH=i386
-            PR_MD_ASFILES=os_Darwin_x86.s
+            if test -n "$USE_64"; then
+                CPU_ARCH=x86_64
+                CC="$CC -arch x86_64"
+            else        
+                CPU_ARCH=i386
+            fi
             ;;
         *)
-            cat >> confdefs.h <<\EOF
-#define ppc 1
-EOF
-
             CPU_ARCH=ppc
-            PR_MD_ASFILES=os_Darwin_ppc.s
             ;;
     esac
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     STRIP="$STRIP -x -S"
     DLL_SUFFIX=dylib
     USE_PTHREADS=1
     MDCPUCFG_H=_darwin.cfg
     PR_MD_CSRCS=darwin.c
+    PR_MD_ASFILES=os_Darwin.s
 
     # Add Mac OS X support for loading CFM & CFBundle plugins
     if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then
         cat >> confdefs.h <<\EOF
 #define XP_MACOSX 1
 EOF
 
         OS_TARGET=MacOSX
@@ -3511,17 +3508,17 @@ EOF
 #define HAVE_BSD_FLOCK 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define HAVE_SOCKLEN_T 1
 EOF
 
     CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
     if test "$MOZ_OBJFORMAT" = "elf"; then
         DLL_SUFFIX=so
     else
         DLL_SUFFIX=so.1.0
     fi
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
@@ -3732,17 +3729,17 @@ EOF
             fi
         fi
         DEFAULT_IMPL_STRATEGY=_PTH
     fi
 
     if test "$DEFAULT_IMPL_STRATEGY" = "_EMU"; then
         USE_NSPR_THREADS=1
         USE_PTHREADS=
-        USE_USER_THREADS=
+        USE_USER_PTHREADS=
     elif test "$DEFAULT_IMPL_STRATEGY" = "_PTH"; then
         USE_PTHREADS=1
         if test "$USE_NSPR_THREADS"; then
             USE_PTHREADS=
         fi
         if test "$USE_USER_PTHREADS"; then
             USE_PTHREADS=
         fi
@@ -4499,27 +4496,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:4508: checking for machine/builtins.h" >&5
+echo "configure:4505: 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 4513 "configure"
+#line 4510 "configure"
 #include "confdefs.h"
 #include <machine/builtins.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4515: \"$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
@@ -4727,17 +4724,17 @@ EOF
         _OPTIMIZE_FLAGS=
         OS_LIBS="$OS_LIBS -lm"
     fi
     MDCPUCFG_H=_sunos4.cfg
     PR_MD_CSRCS=sunos4.c
     ;;
 
 *-solaris*)
-    if test -z "$USE_USER_THREADS" && test -z "$USE_NATIVE_THREADS"; then
+    if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define SVR4 1
@@ -4758,16 +4755,17 @@ EOF
     cat >> confdefs.h <<\EOF
 #define SOLARIS 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define HAVE_FCNTL_FILE_LOCKING 1
 EOF
 
+    CPU_ARCH=`uname -p`
     MDCPUCFG_H=_solaris.cfg
     PR_MD_CSRCS=solaris.c
     LD=/usr/ccs/bin/ld
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     RESOLVE_LINK_SYMBOLS=1
     if test -n "$GNU_CC"; then
         DSO_CFLAGS=-fPIC
         if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
@@ -4887,18 +4885,18 @@ EOF
     *)
         # Solaris 8 or higher has IPv6.
         cat >> confdefs.h <<\EOF
 #define _PR_INET6 1
 EOF
 
         ;;
     esac
-    if test "$OS_TEST" = "sun4u"; then
-        # 64-bit Solaris requires SPARC V9 architecture, so the following
+    if test "$CPU_ARCH" = "sparc"; then
+        # 64-bit Solaris SPARC requires V9 architecture, so the following
         # is not needed.
         if test -z "$USE_64"; then
             ULTRASPARC_LIBRARY=nspr_flt
         fi
     fi
     # Purify requires that binaries linked against nspr also
     # be linked against -lrt (or -lposix4) so add it to OS_LIBS
     _rev=`uname -r`
@@ -4973,102 +4971,47 @@ EOF
     DLL_SUFFIX=dll
     RC=rc.exe
     PR_MD_ARCH_DIR=os2
     PROG_SUFFIX=.exe
     NSINSTALL=nsinstall
     MDCPUCFG_H=_os2.cfg
     RESOLVE_LINK_SYMBOLS=1
 
-    # EMX/GCC build
-    if test -n "$GNU_CC"; then
-        cat >> confdefs.h <<\EOF
-#define XP_OS2_EMX 1
-EOF
-
-        cat >> confdefs.h <<\EOF
+    cat >> confdefs.h <<\EOF
 #define OS2 1
 EOF
 
-        AR=emxomfar
-        AR_FLAGS='r $@'
-        CFLAGS="$CFLAGS -Wall -Zomf"
-        CXXFLAGS="$CFLAGS -Wall -Zomf"
-        MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
-        DSO_CFLAGS=
-        DSO_LDOPTS='-Zomf -Zdll -Zmap'
-        LDFLAGS='-Zmap'
-        _OPTIMIZE_FLAGS="-O2 -s"
-        _DEBUG_FLAGS="-g -fno-inline"
-        if test -n "$MOZ_OPTIMIZE"; then
-          DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
-        fi
-        OS_LIBS="-lsocket"
-        IMPLIB='emximp -o'
-        FILTER='emxexp -o'
-        if test -n "$MOZ_OS2_HIGH_MEMORY"; then
-          DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
-          LDFLAGS="$LDFLAGS -Zhigh-mem"
-          cat >> confdefs.h <<\EOF
+    AR=emxomfar
+    AR_FLAGS='r $@'
+    CFLAGS="$CFLAGS -Wall -Zomf"
+    CXXFLAGS="$CFLAGS -Wall -Zomf"
+    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    DSO_CFLAGS=
+    DSO_LDOPTS='-Zomf -Zdll -Zmap'
+    LDFLAGS='-Zmap'
+    _OPTIMIZE_FLAGS="-O2 -s"
+    _DEBUG_FLAGS="-g -fno-inline"
+    if test -n "$MOZ_OPTIMIZE"; then
+      DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
+    fi
+    OS_LIBS="-lsocket"
+    IMPLIB='emximp -o'
+    FILTER='emxexp -o'
+    if test -n "$MOZ_OS2_HIGH_MEMORY"; then
+      DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
+      LDFLAGS="$LDFLAGS -Zhigh-mem"
+      cat >> confdefs.h <<\EOF
 #define MOZ_OS2_HIGH_MEMORY 1
 EOF
 
-        fi
-
-        # GCC for OS/2 currently predefines these, but we don't want them
-        DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
-
-    # Visual Age C++ build
-    elif test "$VACPP" = "yes"; then
-        cat >> confdefs.h <<\EOF
-#define XP_OS2_VACPP 1
-EOF
-
-        cat >> confdefs.h <<\EOF
-#define OS2 4
-EOF
-
-        cat >> confdefs.h <<\EOF
-#define _X86_ 1
-EOF
-
-        OBJ_SUFFIX=obj
-        AS=alp
-        ASFLAGS='-Mb'
-        ASM_SUFFIX=asm
-        AR=-ilib
-        AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
-        CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        HOST_CFLAGS="$CFLAGS"
-        OS_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        OS_EXE_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        CXXFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        OS_LIBS='so32dll.lib tcp32dll.lib'
-        LD='-ilink'
-        MKSHLIB='$(LD) $(DSO_LDOPTS)'
-        IMPLIB='implib -nologo -noignorecase'
-        FILTER='cppfilt -q -B -P'
-        _OPTIMIZE_FLAGS='/O+ /Gl+ /qtune=pentium /qarch=pentium'
-        _DEBUG_FLAGS='/Ti+ '
-        LDFLAGS='/NOL /M /L'
-        DLLFLAGS="$DLLFLAGS /O:\$@ /DLL /INC:_dllentry /MAP:\$(@:.dll=.map) /L /NOL"
-        EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /L /NOL'
-        if test -n "$MOZ_DEBUG"; then
-          LDFLAGS="$LDFLAGS /DE"
-          DLLFLAGS="$DLLFLAGS /DE"
-          EXEFLAGS="$EXEFLAGS /DE"
-        fi
-        if test -n "$MOZ_OPTIMIZE"; then
-          LDFLAGS="$LDFLAGS /OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
-          DLLFLAGS="$DLLFLAGS /OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
-          EXEFLAGS="$EXEFLAGS /OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
-        fi
-        LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
-        LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
     fi
+
+    # GCC for OS/2 currently predefines these, but we don't want them
+    DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
     ;;
 
 *)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     ;;
@@ -5079,63 +5022,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:5088: checking for dlopen in -ldl" >&5
+echo "configure:5031: 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 5096 "configure"
+#line 5039 "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:5107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5050: \"$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:5124: checking for dlfcn.h" >&5
+echo "configure:5067: 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 5129 "configure"
+#line 5072 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5134: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5077: \"$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
@@ -5158,23 +5101,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:5167: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5110: 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 5173 "configure"
+#line 5116 "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
@@ -5182,17 +5125,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 5191 "configure"
+#line 5134 "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
@@ -5206,22 +5149,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:5215: checking for $ac_func" >&5
+echo "configure:5158: 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 5220 "configure"
+#line 5163 "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();
@@ -5234,17 +5177,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:5243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5186: \"$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
@@ -5275,17 +5218,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:5284: checking for +Olit support" >&5
+echo "configure:5227: 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
@@ -5314,17 +5257,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:5323: checking for pthread_create in -lpthreads" >&5
+echo "configure:5266: 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);
         }
@@ -5336,17 +5279,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:5345: checking for pthread_create in -lpthread" >&5
+echo "configure:5288: 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);
         }
@@ -5358,17 +5301,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:5367: checking for pthread_create in -lc_r" >&5
+echo "configure:5310: 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);
         }
@@ -5380,17 +5323,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:5389: checking for pthread_create in -lc" >&5
+echo "configure:5332: 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);
         }
@@ -5479,29 +5422,16 @@ if test "${with_bthreads+set}" = set; th
   	if test "$withval" = "yes"; then
     	    USE_BTHREADS=1
 	        USE_USER_PTHREADS=
 	        USE_PTHREADS=
 	    fi
 fi
 
     ;;
-
-*-solaris*)
-    # Check whether --with-native-threads or --without-native-threads was given.
-if test "${with_native_threads+set}" = set; then
-  withval="$with_native_threads"
-   if test "$withval" = "yes"; then
-	    USE_NATIVE_THREADS=1
-	    USE_USER_PTHREADS=
-	    USE_PTHREADS=
-	  fi
-fi
-
-    ;;
 esac
 
 fi # SKIP_LIBRARY_CHECKS
 
 # Check whether --enable-ipv6 or --disable-ipv6 was given.
 if test "${enable_ipv6+set}" = set; then
   enableval="$enable_ipv6"
    if test "$enableval" = "yes"; then
@@ -5525,17 +5455,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:5534: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5464: 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
@@ -5548,17 +5478,17 @@ echo "configure:5534: 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:5557: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5487: 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
@@ -5779,30 +5709,23 @@ EOF
             cat >> confdefs.h <<\EOF
 #define _PR_HAVE_THREADSAFE_GETHOST 1
 EOF
 
         fi
     fi
     ;;
 *-solaris*)
-    if test -n "$USE_NATIVE_THREADS"; then
+    if test -n "$USE_NSPR_THREADS"; then
         cat >> confdefs.h <<\EOF
-#define _PR_GLOBAL_THREADS_ONLY 1
-EOF
-
-    else
-        if test -n "$USE_NSPR_THREADS"; then
-            cat >> confdefs.h <<\EOF
 #define _PR_LOCAL_THREADS_ONLY 1
 EOF
 
-        fi
     fi
-    if test -z "$USE_NSPR_THREADS"; then
+    if test -n "$USE_PTHREADS"; then
         cat >> confdefs.h <<\EOF
 #define _REENTRANT 1
 EOF
 
         cat >> confdefs.h <<\EOF
 #define HAVE_POINTER_LOCALTIME_R 1
 EOF
 
@@ -5811,19 +5734,16 @@ EOF
                PR_MD_ASFILES=os_SunOS_x86_64.s
             else
                PR_MD_ASFILES=os_SunOS_x86.s
             fi
         else
             if test -n "$USE_64"; then
                 PR_MD_ASFILES=os_SunOS_sparcv9.s
             fi
-            if test -n "$USE_NATIVE_THREADS"; then
-                PR_MD_ASFILES="$PR_MD_ASFILES os_SunOS.s"
-            fi
         fi
     fi
     ;;
 *-nto*)
     if test -n "$USE_PTHREADS"; then
         cat >> confdefs.h <<\EOF
 #define _PR_HAVE_GETHOST_R 1
 EOF
@@ -5967,17 +5887,16 @@ esac
 
 
 
 
 
 
 
 
-
 MAKEFILES="
 Makefile 
 config/Makefile
 config/autoconf.mk
 config/nsprincl.mk
 config/nsprincl.sh
 config/nspr-config
 lib/Makefile 
@@ -6092,17 +6011,17 @@ trap 'rm -f $CONFIG_STATUS conftest*; ex
 # Protect against Makefile macro expansion.
 cat > conftest.defs <<\EOF
 s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
 s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
 s%\[%\\&%g
 s%\]%\\&%g
 s%\$%$$%g
 EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '`
 rm -f conftest.defs
 
 
 # Without the "./", some shells look in PATH for config.status.
 : ${CONFIG_STATUS=./config.status}
 
 echo creating $CONFIG_STATUS
 rm -f $CONFIG_STATUS
@@ -6213,17 +6132,16 @@ s%@USE_IPV6@%$USE_IPV6%g
 s%@USE_N32@%$USE_N32%g
 s%@USE_64@%$USE_64%g
 s%@OBJECT_MODE@%$OBJECT_MODE%g
 s%@GC_LEAK_DETECTOR@%$GC_LEAK_DETECTOR%g
 s%@ENABLE_STRIP@%$ENABLE_STRIP%g
 s%@USE_PTHREADS@%$USE_PTHREADS%g
 s%@USE_BTHREADS@%$USE_BTHREADS%g
 s%@USE_USER_PTHREADS@%$USE_USER_PTHREADS%g
-s%@USE_NATIVE_THREADS@%$USE_NATIVE_THREADS%g
 s%@USE_NSPR_THREADS@%$USE_NSPR_THREADS%g
 s%@LIBNSPR@%$LIBNSPR%g
 s%@LIBPLC@%$LIBPLC%g
 s%@MOD_MAJOR_VERSION@%$MOD_MAJOR_VERSION%g
 s%@MOD_MINOR_VERSION@%$MOD_MINOR_VERSION%g
 s%@MOD_PATCH_VERSION@%$MOD_PATCH_VERSION%g
 s%@NSPR_MODNAME@%$NSPR_MODNAME%g
 s%@MDCPUCFG_H@%$MDCPUCFG_H%g
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -45,17 +45,17 @@ AC_INIT(config/libc_r.h)
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_SYSTEM
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=7
-MOD_PATCH_VERSION=1
+MOD_PATCH_VERSION=2
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -991,37 +991,40 @@ case "$target" in
     esac
 
     ;;
 
 *-darwin*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(DARWIN)
     AC_DEFINE(HAVE_BSD_FLOCK)
+    AC_DEFINE(HAVE_SOCKLEN_T)
     CFLAGS="$CFLAGS -Wmost -fno-common"
     case "${target_cpu}" in
         i*86*)
-            AC_DEFINE(i386)
-            CPU_ARCH=i386
-            PR_MD_ASFILES=os_Darwin_x86.s
+            if test -n "$USE_64"; then
+                CPU_ARCH=x86_64
+                CC="$CC -arch x86_64"
+            else        
+                CPU_ARCH=i386
+            fi
             ;;
         *)
-            AC_DEFINE(ppc)
             CPU_ARCH=ppc
-            PR_MD_ASFILES=os_Darwin_ppc.s
             ;;
     esac
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     STRIP="$STRIP -x -S"
     DLL_SUFFIX=dylib
     USE_PTHREADS=1
     MDCPUCFG_H=_darwin.cfg
     PR_MD_CSRCS=darwin.c
+    PR_MD_ASFILES=os_Darwin.s
 
     # Add Mac OS X support for loading CFM & CFBundle plugins
     if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then
         AC_DEFINE(XP_MACOSX)
         OS_TARGET=MacOSX
 
         if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
             dnl Use the specified value
@@ -1161,17 +1164,17 @@ tools are selected during the Xcode/Deve
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(FREEBSD)
     AC_DEFINE(HAVE_BSD_FLOCK)
     AC_DEFINE(HAVE_SOCKLEN_T)
     CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
     if test "$MOZ_OBJFORMAT" = "elf"; then
         DLL_SUFFIX=so
     else
         DLL_SUFFIX=so.1.0
     fi
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
@@ -1310,17 +1313,17 @@ tools are selected during the Xcode/Deve
             fi
         fi
         DEFAULT_IMPL_STRATEGY=_PTH
     fi
 
     if test "$DEFAULT_IMPL_STRATEGY" = "_EMU"; then
         USE_NSPR_THREADS=1
         USE_PTHREADS=
-        USE_USER_THREADS=
+        USE_USER_PTHREADS=
     elif test "$DEFAULT_IMPL_STRATEGY" = "_PTH"; then
         USE_PTHREADS=1
         if test "$USE_NSPR_THREADS"; then
             USE_PTHREADS=
         fi
         if test "$USE_USER_PTHREADS"; then
             USE_PTHREADS=
         fi
@@ -1965,26 +1968,27 @@ mips-sony-newsos*)
         _OPTIMIZE_FLAGS=
         OS_LIBS="$OS_LIBS -lm"
     fi
     MDCPUCFG_H=_sunos4.cfg
     PR_MD_CSRCS=sunos4.c
     ;;
 
 *-solaris*)
-    if test -z "$USE_USER_THREADS" && test -z "$USE_NATIVE_THREADS"; then
+    if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SVR4)
     AC_DEFINE(SYSV)
     AC_DEFINE(__svr4)
     AC_DEFINE(__svr4__)
     AC_DEFINE(SOLARIS)
     AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
+    CPU_ARCH=`uname -p`
     MDCPUCFG_H=_solaris.cfg
     PR_MD_CSRCS=solaris.c
     LD=/usr/ccs/bin/ld
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     RESOLVE_LINK_SYMBOLS=1
     if test -n "$GNU_CC"; then
         DSO_CFLAGS=-fPIC
         if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
@@ -2083,18 +2087,18 @@ mips-sony-newsos*)
         ;;
     solaris2.7*)
         ;;
     *)
         # Solaris 8 or higher has IPv6.
         AC_DEFINE(_PR_INET6)
         ;;
     esac
-    if test "$OS_TEST" = "sun4u"; then
-        # 64-bit Solaris requires SPARC V9 architecture, so the following
+    if test "$CPU_ARCH" = "sparc"; then
+        # 64-bit Solaris SPARC requires V9 architecture, so the following
         # is not needed.
         if test -z "$USE_64"; then
             ULTRASPARC_LIBRARY=nspr_flt
         fi
     fi
     # Purify requires that binaries linked against nspr also
     # be linked against -lrt (or -lposix4) so add it to OS_LIBS
     _rev=`uname -r`
@@ -2133,84 +2137,41 @@ mips-sony-newsos*)
     DLL_SUFFIX=dll
     RC=rc.exe
     PR_MD_ARCH_DIR=os2
     PROG_SUFFIX=.exe
     NSINSTALL=nsinstall
     MDCPUCFG_H=_os2.cfg
     RESOLVE_LINK_SYMBOLS=1
 
-    # EMX/GCC build
-    if test -n "$GNU_CC"; then
-        AC_DEFINE(XP_OS2_EMX)
-        AC_DEFINE(OS2)
-        AR=emxomfar
-        AR_FLAGS='r $@'
-        CFLAGS="$CFLAGS -Wall -Zomf"
-        CXXFLAGS="$CFLAGS -Wall -Zomf"
-        MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
-        DSO_CFLAGS=
-        DSO_LDOPTS='-Zomf -Zdll -Zmap'
-        LDFLAGS='-Zmap'
-        _OPTIMIZE_FLAGS="-O2 -s"
-        _DEBUG_FLAGS="-g -fno-inline"
-        if test -n "$MOZ_OPTIMIZE"; then
-          DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
-        fi
-        OS_LIBS="-lsocket"
-        IMPLIB='emximp -o'
-        FILTER='emxexp -o'
-        if test -n "$MOZ_OS2_HIGH_MEMORY"; then
-          DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
-          LDFLAGS="$LDFLAGS -Zhigh-mem"
-          AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
-        fi
-
-        # GCC for OS/2 currently predefines these, but we don't want them
-        DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
+    AC_DEFINE(OS2)
+    AR=emxomfar
+    AR_FLAGS='r $@'
+    CFLAGS="$CFLAGS -Wall -Zomf"
+    CXXFLAGS="$CFLAGS -Wall -Zomf"
+    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    DSO_CFLAGS=
+    DSO_LDOPTS='-Zomf -Zdll -Zmap'
+    LDFLAGS='-Zmap'
+    _OPTIMIZE_FLAGS="-O2 -s"
+    _DEBUG_FLAGS="-g -fno-inline"
+    if test -n "$MOZ_OPTIMIZE"; then
+      DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
+    fi
+    OS_LIBS="-lsocket"
+    IMPLIB='emximp -o'
+    FILTER='emxexp -o'
+    if test -n "$MOZ_OS2_HIGH_MEMORY"; then
+      DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
+      LDFLAGS="$LDFLAGS -Zhigh-mem"
+      AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
+    fi
 
-    # Visual Age C++ build
-    elif test "$VACPP" = "yes"; then
-        AC_DEFINE(XP_OS2_VACPP)
-        AC_DEFINE(OS2,4)
-        AC_DEFINE(_X86_)
-        OBJ_SUFFIX=obj
-        AS=alp
-        ASFLAGS='-Mb'
-        ASM_SUFFIX=asm
-        AR=-ilib
-        AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
-        CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        HOST_CFLAGS="$CFLAGS"
-        OS_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        OS_EXE_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        CXXFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
-        OS_LIBS='so32dll.lib tcp32dll.lib'
-        LD='-ilink'
-        MKSHLIB='$(LD) $(DSO_LDOPTS)'
-        IMPLIB='implib -nologo -noignorecase'
-        FILTER='cppfilt -q -B -P'
-        _OPTIMIZE_FLAGS='/O+ /Gl+ /qtune=pentium /qarch=pentium'
-        _DEBUG_FLAGS='/Ti+ '
-        LDFLAGS='/NOL /M /L'
-        DLLFLAGS="$DLLFLAGS /O:\$@ /DLL /INC:_dllentry /MAP:\$(@:.dll=.map) /L /NOL"
-        EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /L /NOL'
-        if test -n "$MOZ_DEBUG"; then
-          LDFLAGS="$LDFLAGS /DE"
-          DLLFLAGS="$DLLFLAGS /DE"
-          EXEFLAGS="$EXEFLAGS /DE"
-        fi
-        if test -n "$MOZ_OPTIMIZE"; then
-          LDFLAGS="$LDFLAGS /OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
-          DLLFLAGS="$DLLFLAGS /OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
-          EXEFLAGS="$EXEFLAGS /OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
-        fi
-        LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
-        LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
-    fi
+    # GCC for OS/2 currently predefines these, but we don't want them
+    DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
     ;;
 
 *)
     AC_DEFINE(XP_UNIX)
     ;;
    
 esac
 
@@ -2443,27 +2404,16 @@ case "$target" in
     [  --with-bthreads         Use system bthreads library as thread subsystem
                           (BeOS only)],
     [	if test "$withval" = "yes"; then
     	    USE_BTHREADS=1
 	        USE_USER_PTHREADS=
 	        USE_PTHREADS=
 	    fi])
     ;;
-
-*-solaris*)
-    AC_ARG_WITH(native-threads,
-    [  --with-native-threads   Use native system threads as thread subsystem
-                          (Solaris only)],
-    [ if test "$withval" = "yes"; then
-	    USE_NATIVE_THREADS=1
-	    USE_USER_PTHREADS=
-	    USE_PTHREADS=
-	  fi])
-    ;;
 esac
 
 fi # SKIP_LIBRARY_CHECKS
 
 AC_ARG_ENABLE(ipv6,
     [  --enable-ipv6           Compile ipv6 support],
     [ if test "$enableval" = "yes"; then
 	    USE_IPV6=1
@@ -2663,39 +2613,32 @@ case "$target" in
         if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
             :
         else
             AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
         fi
     fi
     ;;
 *-solaris*)
-    if test -n "$USE_NATIVE_THREADS"; then
-        AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
-    else
-        if test -n "$USE_NSPR_THREADS"; then
-            AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
-        fi
+    if test -n "$USE_NSPR_THREADS"; then
+        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
     fi
-    if test -z "$USE_NSPR_THREADS"; then
+    if test -n "$USE_PTHREADS"; then
         AC_DEFINE(_REENTRANT)
         AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
         if test "$OS_TEST" = "i86pc"; then
             if test -n "$USE_64"; then
                PR_MD_ASFILES=os_SunOS_x86_64.s
             else
                PR_MD_ASFILES=os_SunOS_x86.s
             fi
         else
             if test -n "$USE_64"; then
                 PR_MD_ASFILES=os_SunOS_sparcv9.s
             fi
-            if test -n "$USE_NATIVE_THREADS"; then
-                PR_MD_ASFILES="$PR_MD_ASFILES os_SunOS.s"
-            fi
         fi
     fi
     ;;
 *-nto*)
     if test -n "$USE_PTHREADS"; then
         AC_DEFINE(_PR_HAVE_GETHOST_R)
         AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
     fi
@@ -2775,17 +2718,16 @@ AC_SUBST(USE_N32)
 AC_SUBST(USE_64)
 AC_SUBST(OBJECT_MODE)
 AC_SUBST(GC_LEAK_DETECTOR)
 AC_SUBST(ENABLE_STRIP)
 
 AC_SUBST(USE_PTHREADS)
 AC_SUBST(USE_BTHREADS)
 AC_SUBST(USE_USER_PTHREADS)
-AC_SUBST(USE_NATIVE_THREADS)
 AC_SUBST(USE_NSPR_THREADS)
 
 AC_SUBST(LIBNSPR)
 AC_SUBST(LIBPLC)
 
 AC_SUBST(MOD_MAJOR_VERSION)
 AC_SUBST(MOD_MINOR_VERSION)
 AC_SUBST(MOD_PATCH_VERSION)
--- a/nsprpub/lib/ds/Makefile.in
+++ b/nsprpub/lib/ds/Makefile.in
@@ -157,22 +157,18 @@ GARBAGE += $(TINC)
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
-else
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
-endif
 #
 # Version information generation (end)
 #
 
 #
 # The Client build wants the shared libraries in $(dist_bindir),
 # so we also install them there.
 #
--- a/nsprpub/lib/ds/plarena.c
+++ b/nsprpub/lib/ds/plarena.c
@@ -59,16 +59,17 @@ static PLArenaStats *arena_stats_list;
 #else
 #define COUNT(pool,what)  /* nothing */
 #endif
 
 #define PL_ARENA_DEFAULT_ALIGN  sizeof(double)
 
 static PRLock    *arenaLock;
 static PRCallOnceType once;
+static const PRCallOnceType pristineCallOnce;
 
 /*
 ** InitializeArenas() -- Initialize arena operations.
 **
 ** InitializeArenas() is called exactly once and only once from 
 ** LockArena(). This function creates the arena protection 
 ** lock: arenaLock.
 **
@@ -366,16 +367,17 @@ PR_IMPLEMENT(void) PL_ArenaFinish(void)
         PR_DELETE(a);
     }
     arena_freelist = NULL;
 
     if (arenaLock) {
         PR_DestroyLock(arenaLock);
         arenaLock = NULL;
     }
+    once = pristineCallOnce;
 }
 
 #ifdef PL_ARENAMETER
 PR_IMPLEMENT(void) PL_ArenaCountAllocation(PLArenaPool *pool, PRUint32 nb)
 {
     pool->stats.nallocs++;
     pool->stats.nbytes += nb;
     if (nb > pool->stats.maxalloc)
--- a/nsprpub/lib/ds/plhash.h
+++ b/nsprpub/lib/ds/plhash.h
@@ -47,25 +47,18 @@ PR_BEGIN_EXTERN_C
 
 typedef struct PLHashEntry  PLHashEntry;
 typedef struct PLHashTable  PLHashTable;
 typedef PRUint32 PLHashNumber;
 #define PL_HASH_BITS 32  /* Number of bits in PLHashNumber */
 typedef PLHashNumber (PR_CALLBACK *PLHashFunction)(const void *key);
 typedef PRIntn (PR_CALLBACK *PLHashComparator)(const void *v1, const void *v2);
 
-#if defined(XP_OS2_VACPP) && defined(VACPP_FLIP) /* for nsSpaceManager.cpp */
-PR_END_EXTERN_C                                  /* and nsHTMLDocument.cpp */
-#endif
 typedef PRIntn (PR_CALLBACK *PLHashEnumerator)(PLHashEntry *he, PRIntn i, void *arg);
 
-#if defined(XP_OS2_VACPP) && defined(VACPP_FLIP)
-PR_BEGIN_EXTERN_C
-#endif
-
 /* Flag bits in PLHashEnumerator's return value */
 #define HT_ENUMERATE_NEXT       0       /* continue enumerating entries */
 #define HT_ENUMERATE_STOP       1       /* stop enumerating entries */
 #define HT_ENUMERATE_REMOVE     2       /* remove and free the current entry */
 #define HT_ENUMERATE_UNHASH     4       /* just unhash the current entry */
 
 typedef struct PLHashAllocOps {
     void *              (PR_CALLBACK *allocTable)(void *pool, PRSize size);
--- a/nsprpub/lib/libc/src/Makefile.in
+++ b/nsprpub/lib/libc/src/Makefile.in
@@ -49,23 +49,22 @@ include $(topsrcdir)/config/config.mk
 
 INCLUDES = -I$(dist_includedir)
 
 CSRCS =\
 	plvrsion.c  \
 	strlen.c  \
 	strcpy.c  \
 	strdup.c  \
+	strcase.c \
 	strcat.c  \
 	strcmp.c  \
-	strccmp.c \
 	strchr.c  \
 	strpbrk.c \
 	strstr.c  \
-	strcstr.c \
 	strtok.c  \
 	base64.c \
 	plerror.c \
 	plgetopt.c \
 	$(NULL)
 
 LIBRARY_NAME	= plc
 LIBRARY_VERSION	= $(MOD_MAJOR_VERSION)
@@ -160,22 +159,18 @@ GARBAGE += $(TINC)
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
-else
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
-endif
 #
 # Version information generation (end)
 #
 
 #
 # The Client build wants the shared libraries in $(dist_bindir),
 # so we also install them there.
 #
new file mode 100644
--- /dev/null
+++ b/nsprpub/lib/libc/src/strcase.c
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** 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 "plstr.h"
+
+static const unsigned char uc[] =
+{
+    '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+    '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+    '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+    '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+    ' ',    '!',    '"',    '#',    '$',    '%',    '&',    '\'',
+    '(',    ')',    '*',    '+',    ',',    '-',    '.',    '/',
+    '0',    '1',    '2',    '3',    '4',    '5',    '6',    '7',
+    '8',    '9',    ':',    ';',    '<',    '=',    '>',    '?',
+    '@',    'A',    'B',    'C',    'D',    'E',    'F',    'G',
+    'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
+    'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
+    'X',    'Y',    'Z',    '[',    '\\',   ']',    '^',    '_',
+    '`',    'A',    'B',    'C',    'D',    'E',    'F',    'G',
+    'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
+    'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
+    'X',    'Y',    'Z',    '{',    '|',    '}',    '~',    '\177',
+    0200,   0201,   0202,   0203,   0204,   0205,   0206,   0207,
+    0210,   0211,   0212,   0213,   0214,   0215,   0216,   0217,
+    0220,   0221,   0222,   0223,   0224,   0225,   0226,   0227,
+    0230,   0231,   0232,   0233,   0234,   0235,   0236,   0237,
+    0240,   0241,   0242,   0243,   0244,   0245,   0246,   0247,
+    0250,   0251,   0252,   0253,   0254,   0255,   0256,   0257,
+    0260,   0261,   0262,   0263,   0264,   0265,   0266,   0267,
+    0270,   0271,   0272,   0273,   0274,   0275,   0276,   0277,
+    0300,   0301,   0302,   0303,   0304,   0305,   0306,   0307,
+    0310,   0311,   0312,   0313,   0314,   0315,   0316,   0317,
+    0320,   0321,   0322,   0323,   0324,   0325,   0326,   0327,
+    0330,   0331,   0332,   0333,   0334,   0335,   0336,   0337,
+    0340,   0341,   0342,   0343,   0344,   0345,   0346,   0347,
+    0350,   0351,   0352,   0353,   0354,   0355,   0356,   0357,
+    0360,   0361,   0362,   0363,   0364,   0365,   0366,   0367,
+    0370,   0371,   0372,   0373,   0374,   0375,   0376,   0377
+};
+
+PR_IMPLEMENT(PRIntn)
+PL_strcasecmp(const char *a, const char *b)
+{
+    const unsigned char *ua = (const unsigned char *)a;
+    const unsigned char *ub = (const unsigned char *)b;
+
+    if( ((const char *)0 == a) || (const char *)0 == b ) 
+        return (PRIntn)(a-b);
+
+    while( (uc[*ua] == uc[*ub]) && ('\0' != *a) )
+    {
+        a++;
+        ua++;
+        ub++;
+    }
+
+    return (PRIntn)(uc[*ua] - uc[*ub]);
+}
+
+PR_IMPLEMENT(PRIntn)
+PL_strncasecmp(const char *a, const char *b, PRUint32 max)
+{
+    const unsigned char *ua = (const unsigned char *)a;
+    const unsigned char *ub = (const unsigned char *)b;
+
+    if( ((const char *)0 == a) || (const char *)0 == b ) 
+        return (PRIntn)(a-b);
+
+    while( max && (uc[*ua] == uc[*ub]) && ('\0' != *a) )
+    {
+        a++;
+        ua++;
+        ub++;
+        max--;
+    }
+
+    if( 0 == max ) return (PRIntn)0;
+
+    return (PRIntn)(uc[*ua] - uc[*ub]);
+}
+
+PR_IMPLEMENT(char *)
+PL_strcasestr(const char *big, const char *little)
+{
+    PRUint32 ll;
+
+    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
+    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
+
+    ll = strlen(little);
+
+    for( ; *big; big++ )
+        /* obvious improvement available here */
+            if( 0 == PL_strncasecmp(big, little, ll) )
+                return (char *)big;
+
+    return (char *)0;
+}
+
+PR_IMPLEMENT(char *)
+PL_strcaserstr(const char *big, const char *little)
+{
+    const char *p;
+    PRUint32 bl, ll;
+
+    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
+    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
+
+    bl = strlen(big);
+    ll = strlen(little);
+    if( bl < ll ) return (char *)0;
+    p = &big[ bl - ll ];
+
+    for( ; p >= big; p-- )
+        /* obvious improvement available here */
+            if( 0 == PL_strncasecmp(p, little, ll) )
+                return (char *)p;
+
+    return (char *)0;
+}
+
+PR_IMPLEMENT(char *)
+PL_strncasestr(const char *big, const char *little, PRUint32 max)
+{
+    PRUint32 ll;
+
+    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
+    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
+
+    ll = strlen(little);
+    if( ll > max ) return (char *)0;
+    max -= ll;
+    max++;
+
+    for( ; max && *big; big++, max-- )
+        /* obvious improvement available here */
+            if( 0 == PL_strncasecmp(big, little, ll) )
+                return (char *)big;
+
+    return (char *)0;
+}
+
+PR_IMPLEMENT(char *)
+PL_strncaserstr(const char *big, const char *little, PRUint32 max)
+{
+    const char *p;
+    PRUint32 ll;
+
+    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
+    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
+
+    ll = strlen(little);
+
+    for( p = big; max && *p; p++, max-- )
+        ;
+
+    p -= ll;
+    if( p < big ) return (char *)0;
+
+    for( ; p >= big; p-- )
+        /* obvious improvement available here */
+            if( 0 == PL_strncasecmp(p, little, ll) )
+                return (char *)p;
+
+    return (char *)0;
+}
deleted file mode 100644
--- a/nsprpub/lib/libc/src/strccmp.c
+++ /dev/null
@@ -1,115 +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 "plstr.h"
-
-static const unsigned char uc[] =
-{
-    '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
-    '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
-    '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
-    '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
-    ' ',    '!',    '"',    '#',    '$',    '%',    '&',    '\'',
-    '(',    ')',    '*',    '+',    ',',    '-',    '.',    '/',
-    '0',    '1',    '2',    '3',    '4',    '5',    '6',    '7',
-    '8',    '9',    ':',    ';',    '<',    '=',    '>',    '?',
-    '@',    'A',    'B',    'C',    'D',    'E',    'F',    'G',
-    'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
-    'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-    'X',    'Y',    'Z',    '[',    '\\',   ']',    '^',    '_',
-    '`',    'A',    'B',    'C',    'D',    'E',    'F',    'G',
-    'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
-    'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-    'X',    'Y',    'Z',    '{',    '|',    '}',    '~',    '\177',
-    0200,   0201,   0202,   0203,   0204,   0205,   0206,   0207,
-    0210,   0211,   0212,   0213,   0214,   0215,   0216,   0217,
-    0220,   0221,   0222,   0223,   0224,   0225,   0226,   0227,
-    0230,   0231,   0232,   0233,   0234,   0235,   0236,   0237,
-    0240,   0241,   0242,   0243,   0244,   0245,   0246,   0247,
-    0250,   0251,   0252,   0253,   0254,   0255,   0256,   0257,
-    0260,   0261,   0262,   0263,   0264,   0265,   0266,   0267,
-    0270,   0271,   0272,   0273,   0274,   0275,   0276,   0277,
-    0300,   0301,   0302,   0303,   0304,   0305,   0306,   0307,
-    0310,   0311,   0312,   0313,   0314,   0315,   0316,   0317,
-    0320,   0321,   0322,   0323,   0324,   0325,   0326,   0327,
-    0330,   0331,   0332,   0333,   0334,   0335,   0336,   0337,
-    0340,   0341,   0342,   0343,   0344,   0345,   0346,   0347,
-    0350,   0351,   0352,   0353,   0354,   0355,   0356,   0357,
-    0360,   0361,   0362,   0363,   0364,   0365,   0366,   0367,
-    0370,   0371,   0372,   0373,   0374,   0375,   0376,   0377
-};
-
-PR_IMPLEMENT(PRIntn)
-PL_strcasecmp(const char *a, const char *b)
-{
-    const unsigned char *ua = (const unsigned char *)a;
-    const unsigned char *ub = (const unsigned char *)b;
-
-    if( ((const char *)0 == a) || (const char *)0 == b ) 
-        return (PRIntn)(a-b);
-
-    while( (uc[*ua] == uc[*ub]) && ('\0' != *a) )
-    {
-        a++;
-        ua++;
-        ub++;
-    }
-
-    return (PRIntn)(uc[*ua] - uc[*ub]);
-}
-
-PR_IMPLEMENT(PRIntn)
-PL_strncasecmp(const char *a, const char *b, PRUint32 max)
-{
-    const unsigned char *ua = (const unsigned char *)a;
-    const unsigned char *ub = (const unsigned char *)b;
-
-    if( ((const char *)0 == a) || (const char *)0 == b ) 
-        return (PRIntn)(a-b);
-
-    while( max && (uc[*ua] == uc[*ub]) && ('\0' != *a) )
-    {
-        a++;
-        ua++;
-        ub++;
-        max--;
-    }
-
-    if( 0 == max ) return (PRIntn)0;
-
-    return (PRIntn)(uc[*ua] - uc[*ub]);
-}
deleted file mode 100644
--- a/nsprpub/lib/libc/src/strcstr.c
+++ /dev/null
@@ -1,124 +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 "plstr.h"
-
-PR_IMPLEMENT(char *)
-PL_strcasestr(const char *big, const char *little)
-{
-    PRUint32 ll;
-
-    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
-    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
-
-    ll = PL_strlen(little);
-
-    for( ; *big; big++ )
-        /* obvious improvement available here */
-            if( 0 == PL_strncasecmp(big, little, ll) )
-                return (char *)big;
-
-    return (char *)0;
-}
-
-PR_IMPLEMENT(char *)
-PL_strcaserstr(const char *big, const char *little)
-{
-    const char *p;
-    PRUint32 bl, ll;
-
-    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
-    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
-
-    bl = PL_strlen(big);
-    ll = PL_strlen(little);
-    if( bl < ll ) return (char *)0;
-    p = &big[ bl - ll ];
-
-    for( ; p >= big; p-- )
-        /* obvious improvement available here */
-            if( 0 == PL_strncasecmp(p, little, ll) )
-                return (char *)p;
-
-    return (char *)0;
-}
-
-PR_IMPLEMENT(char *)
-PL_strncasestr(const char *big, const char *little, PRUint32 max)
-{
-    PRUint32 ll;
-
-    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
-    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
-
-    ll = PL_strlen(little);
-    if( ll > max ) return (char *)0;
-    max -= ll;
-    max++;
-
-    for( ; max && *big; big++, max-- )
-        /* obvious improvement available here */
-            if( 0 == PL_strncasecmp(big, little, ll) )
-                return (char *)big;
-
-    return (char *)0;
-}
-
-PR_IMPLEMENT(char *)
-PL_strncaserstr(const char *big, const char *little, PRUint32 max)
-{
-    const char *p;
-    PRUint32 ll;
-
-    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
-    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
-
-    ll = PL_strlen(little);
-
-    for( p = big; max && *p; p++, max-- )
-        ;
-
-    p -= ll;
-    if( p < big ) return (char *)0;
-
-    for( ; p >= big; p-- )
-        /* obvious improvement available here */
-            if( 0 == PL_strncasecmp(p, little, ll) )
-                return (char *)p;
-
-    return (char *)0;
-}
--- a/nsprpub/lib/msgc/tests/Makefile.in
+++ b/nsprpub/lib/msgc/tests/Makefile.in
@@ -87,25 +87,18 @@ 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)
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-  LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
-  LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
-  LIBPLC = $(dist_libdir)/plc$(NSPR_VERSION).lib
-  LIBGC= $(dist_libdir)/msgc$(GC_VERSION).lib
-else
   LDOPTS += -Zomf -Zlinker /PM:VIO
 endif
-endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
 LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
 
@@ -155,32 +148,23 @@ ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
 LDOPTS += -R $(PWD)/$(dist_libdir)
 endif
 endif
 
-ifneq ($(LOCAL_THREADS_ONLY),1)
-# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
-# even though we already linked with these system libraries
-# when we built libnspr.so.
-ifeq ($(OS_RELEASE), 5.4)
-EXTRA_LIBS = -lthread
-endif
-
+# SunOS 5.5 needs to link with -lpthread, even though we already
+# linked with this system library when we built libnspr.so.
 ifeq ($(OS_RELEASE), 5.5)
 ifdef USE_PTHREADS
 EXTRA_LIBS = -lpthread
-else
-EXTRA_LIBS = -lthread
 endif
 endif
-endif # LOCAL_THREADS_ONLY
 endif # SunOS
 
 ifeq ($(OS_ARCH),NEC)
 EXTRA_LIBS = $(OS_LIBS)
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
 # option for ld on other platforms.
 export LD_RUN_PATH = $(PWD)/$(dist_libdir)
--- a/nsprpub/lib/prstreams/Makefile.in
+++ b/nsprpub/lib/prstreams/Makefile.in
@@ -88,19 +88,17 @@ CXXSRCS = \
 OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)) $(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
 
 ifeq ($(OS_ARCH), WINNT)
         RES=$(OBJDIR)/prstrms.res
         RESNAME=prstrms.rc
         OS_LIBS = user32.lib
 else
     ifeq ($(OS_ARCH),OS2)
-      ifneq ($(MOZ_OS2_TOOLS),VACPP)
-         OS_LIBS = -lstdcpp
-      endif
+        OS_LIBS = -lstdcpp
     else
     ifeq ($(OS_ARCH), AIX)
       ifeq ($(OS_RELEASE), 4.1)
         ifeq ($(CLASSIC_NSPR),1)
             OS_LIBS += -lC -lc
         else
             OS_LIBS += -lC_r -lc_r
         endif
@@ -178,22 +176,18 @@ endif
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
-else
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
-endif
 #
 # Version information generation (end)
 #
 
 export:: $(TARGETS) $(HEADERS)
 	$(INSTALL) -m 444 $(HEADERS) $(dist_includedir)
 	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
 ifeq ($(OS_ARCH),OS2)
--- a/nsprpub/lib/prstreams/tests/testprstrm/Makefile.in
+++ b/nsprpub/lib/prstreams/tests/testprstrm/Makefile.in
@@ -86,23 +86,17 @@ else
   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)
-  ifeq ($(MOZ_OS2_TOOLS),VACPP)
-    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768
-    LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
-    LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
-  else
-    LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
-  endif
+LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
 LDOPTS += -rpath $(PWD)/$(dist_libdir)
@@ -130,23 +124,20 @@ endif
 
 # Solaris
 ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
 LDOPTS += -R $(PWD)/$(dist_libdir)
-# CC on SunOS 5.4 and 5.5.x need to link with -lthread or -lpthread
-# (or use the -mt switch) even though we already linked with these
-# system libraries when we built libnspr.so.
+# CC on SunOS 5.5.x needs to link with -lpthread even though we already
+# linked with this system library when we built libnspr.so.
 ifdef USE_PTHREADS
 EXTRA_LIBS = -lpthread
-else
-EXTRA_LIBS = -lthread
 endif # USE_PTHREADS
 endif # NS_USE_GCC
 endif # 4.1.3_U1
 endif # SunOS
 
 ifeq ($(OS_ARCH), NCR)
 # XXX: We see some strange problems when we link with libnspr.so.
 # So for now we use static libraries on NCR.  The shared library
--- a/nsprpub/lib/prstreams/tests/testprstrm/testprstrm.cpp
+++ b/nsprpub/lib/prstreams/tests/testprstrm/testprstrm.cpp
@@ -35,34 +35,31 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "prinit.h"
 #include "prstrms.h"
 #include "prio.h"
 #include <string.h>
 #include <stdio.h>
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
 #include <sys/types.h>
 #include <sys/stat.h>
 #endif
 
 const unsigned int MaxCnt = 1;
 
 void threadwork(void *mytag);
 
 
 typedef struct threadarg {
     void *mytag;
 } threadarg;
 
 void 
-#ifdef XP_OS2_VACPP
-_Optlink
-#endif
 threadmain(void *mytag)
 {
     threadarg arg;
 
     arg.mytag = mytag;
 
     threadwork(&arg);
 }
--- a/nsprpub/lib/tests/Makefile.in
+++ b/nsprpub/lib/tests/Makefile.in
@@ -94,24 +94,17 @@ 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)
-  ifeq ($(MOZ_OS2_TOOLS),VACPP)
-    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768
-    LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
-    LIBPLC = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
-    LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)	
-  else
-    LDOPTS += -Zomf -Zlinker /PM:VIO
-  endif
+LDOPTS += -Zomf -Zlinker /PM:VIO
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
 LDOPTS += -rpath $(PWD)/$(dist_libdir)
@@ -154,28 +147,21 @@ ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
 LDOPTS += -R $(PWD)/$(dist_libdir)
 endif
 endif
 
-# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
-# even though we already linked with these system libraries
-# when we built libnspr.so.
-ifeq ($(OS_RELEASE), 5.4)
-EXTRA_LIBS = -lthread
-endif
-
+# SunOS 5.5 needs to link with -lpthread, even though we already
+# linked with this system library when we built libnspr.so.
 ifeq ($(OS_RELEASE), 5.5)
 ifdef USE_PTHREADS
 EXTRA_LIBS = -lpthread
-else
-EXTRA_LIBS = -lthread
 endif
 endif
 endif # SunOS
 
 ifeq ($(OS_ARCH), NCR)
 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
 # implicitly by $(CC)) again even though we already linked with these
 # system libraries when we built libnspr.so.
--- a/nsprpub/pr/include/md/_darwin.cfg
+++ b/nsprpub/pr/include/md/_darwin.cfg
@@ -39,30 +39,78 @@
 #define nspr_cpucfg___
 
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #define PR_AF_INET6 30  /* same as AF_INET6 */
 
-#if defined(i386)
+#if defined(__i386__) || defined(__x86_64__)
 #undef IS_BIG_ENDIAN
 #define  IS_LITTLE_ENDIAN 1
 #else
 #undef IS_LITTLE_ENDIAN
 #define  IS_BIG_ENDIAN 1
 #endif
 
+#ifdef __x86_64__
+#define IS_64
+#endif
+
 #ifndef HAVE_LONG_LONG
 #define	HAVE_LONG_LONG
 #endif
 #undef	HAVE_ALIGNED_DOUBLES
 #define	HAVE_ALIGNED_LONGLONGS 1
 
+#ifdef IS_64
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   8
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   8
+#define PR_BYTES_PER_DWORD  8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    64
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    64
+#define PR_BITS_PER_DWORD   64
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   6
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   6
+#define PR_BITS_PER_DWORD_LOG2  6
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    8
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD    8
+#define PR_ALIGN_OF_DWORD   8
+
+#else /* IS_64 */
+
 #define PR_BYTES_PER_BYTE   1
 #define PR_BYTES_PER_SHORT  2
 #define PR_BYTES_PER_INT    4
 #define PR_BYTES_PER_INT64  8
 #define PR_BYTES_PER_LONG   4
 #define PR_BYTES_PER_FLOAT  4
 #define PR_BYTES_PER_DOUBLE 8
 #define PR_BYTES_PER_WORD   4
@@ -93,16 +141,18 @@
 #define PR_ALIGN_OF_INT     4
 #define PR_ALIGN_OF_LONG    4
 #define PR_ALIGN_OF_INT64   4
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_DOUBLE  4
 #define PR_ALIGN_OF_POINTER 4
 #define PR_ALIGN_OF_WORD    4
 
+#endif /* IS_64 */
+
 #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
--- a/nsprpub/pr/include/md/_darwin.h
+++ b/nsprpub/pr/include/md/_darwin.h
@@ -45,29 +45,35 @@
 #ifdef XP_MACOSX
 #include <AvailabilityMacros.h>
 #endif
 
 #define PR_LINKER_ARCH	"darwin"
 #define _PR_SI_SYSNAME  "DARWIN"
 #ifdef __i386__
 #define _PR_SI_ARCHITECTURE "x86"
+#elif defined(__x86_64__)
+#define _PR_SI_ARCHITECTURE "x86-64"
 #elif defined(__ppc__)
 #define _PR_SI_ARCHITECTURE "ppc"
 #endif
 #define PR_DLL_SUFFIX		".dylib"
 
 #define _PR_VMBASE              0x30000000
 #define _PR_STACK_VMBASE	0x50000000
 #define _MD_DEFAULT_STACK_SIZE	65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
 #undef  HAVE_STACK_GROWING_UP
 #define HAVE_DLL
+#ifdef __x86_64__
+#define USE_DLFCN
+#else
 #define USE_MACH_DYLD
+#endif
 #define _PR_HAVE_SOCKADDR_LEN  
 #define _PR_STAT_HAS_ST_ATIMESPEC
 #define _PR_HAVE_LARGE_OFF_T
 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
 #define _PR_INET6
 /*
  * I'd prefer to use getipnodebyname and getipnodebyaddr but the
@@ -97,40 +103,55 @@
 #endif /* DT >= 10.2 */
 #endif /* XP_MACOSX */
 #define _PR_IPV6_V6ONLY_PROBE
 /* The IPV6_V6ONLY socket option is not defined on Mac OS X 10.1. */
 #ifndef IPV6_V6ONLY
 #define IPV6_V6ONLY 27
 #endif
 
-#if defined(__ppc__)
+#ifdef __ppc__
 #define _PR_HAVE_ATOMIC_OPS
 #define _MD_INIT_ATOMIC()
 extern PRInt32 _PR_DarwinPPC_AtomicIncrement(PRInt32 *val);
 #define _MD_ATOMIC_INCREMENT(val)   _PR_DarwinPPC_AtomicIncrement(val)
 extern PRInt32 _PR_DarwinPPC_AtomicDecrement(PRInt32 *val);
 #define _MD_ATOMIC_DECREMENT(val)   _PR_DarwinPPC_AtomicDecrement(val)
 extern PRInt32 _PR_DarwinPPC_AtomicSet(PRInt32 *val, PRInt32 newval);
 #define _MD_ATOMIC_SET(val, newval) _PR_DarwinPPC_AtomicSet(val, newval)
 extern PRInt32 _PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val);
 #define _MD_ATOMIC_ADD(ptr, val)    _PR_DarwinPPC_AtomicAdd(ptr, val)
-#elif defined(__i386__)
+#endif /* __ppc__ */
+
+#ifdef __i386__
 #define _PR_HAVE_ATOMIC_OPS
 #define _MD_INIT_ATOMIC()
 extern PRInt32 _PR_Darwin_x86_AtomicIncrement(PRInt32 *val);
 #define _MD_ATOMIC_INCREMENT(val)   _PR_Darwin_x86_AtomicIncrement(val)
 extern PRInt32 _PR_Darwin_x86_AtomicDecrement(PRInt32 *val);
 #define _MD_ATOMIC_DECREMENT(val)   _PR_Darwin_x86_AtomicDecrement(val)
 extern PRInt32 _PR_Darwin_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
 #define _MD_ATOMIC_SET(val, newval) _PR_Darwin_x86_AtomicSet(val, newval)
 extern PRInt32 _PR_Darwin_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
 #define _MD_ATOMIC_ADD(ptr, val)    _PR_Darwin_x86_AtomicAdd(ptr, val)
 #endif /* __i386__ */
 
+#ifdef __x86_64__
+#define _PR_HAVE_ATOMIC_OPS
+#define _MD_INIT_ATOMIC()
+extern PRInt32 _PR_Darwin_x86_64_AtomicIncrement(PRInt32 *val);
+#define _MD_ATOMIC_INCREMENT(val)   _PR_Darwin_x86_64_AtomicIncrement(val)
+extern PRInt32 _PR_Darwin_x86_64_AtomicDecrement(PRInt32 *val);
+#define _MD_ATOMIC_DECREMENT(val)   _PR_Darwin_x86_64_AtomicDecrement(val)
+extern PRInt32 _PR_Darwin_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
+#define _MD_ATOMIC_SET(val, newval) _PR_Darwin_x86_64_AtomicSet(val, newval)
+extern PRInt32 _PR_Darwin_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
+#define _MD_ATOMIC_ADD(ptr, val)    _PR_Darwin_x86_64_AtomicAdd(ptr, val)
+#endif /* __x86_64__ */
+
 #define USE_SETJMP
 
 #if !defined(_PR_PTHREADS)
 
 #include <setjmp.h>
 
 #define PR_CONTEXT_TYPE	jmp_buf
 
--- a/nsprpub/pr/include/md/_os2.h
+++ b/nsprpub/pr/include/md/_os2.h
@@ -48,44 +48,16 @@
 #define INCL_WPS
 #include <os2.h>
 #include <sys/select.h>
 
 #include "prio.h"
 
 #include <errno.h>
 
-#ifdef XP_OS2_VACPP
-/* TODO RAMSEMs need to be written for GCC/EMX */
-#define USE_RAMSEM
-#endif
-
-#ifdef USE_RAMSEM
-#pragma pack(4)
-
-#pragma pack(2)
-typedef struct _RAMSEM
-{
-   ULONG   ulTIDPID;
-   ULONG   hevSem;
-   ULONG   cLocks;
-   USHORT  cWaiting;
-   USHORT  cPosts;
-} RAMSEM, *PRAMSEM;
-
-typedef struct _CRITICAL_SECTION
-{
-    ULONG ulReserved[4]; /* Same size as RAMSEM */
-} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION;
-#pragma pack(4)
-
-APIRET _Optlink SemRequest486(PRAMSEM, ULONG);
-APIRET _Optlink SemReleasex86(PRAMSEM, ULONG);
-#endif
-
 /*
  * Internal configuration macros
  */
 
 #define PR_LINKER_ARCH      "os2"
 #define _PR_SI_SYSNAME        "OS2"
 #define _PR_SI_ARCHITECTURE   "x86"    /* XXXMB hardcode for now */
 
@@ -182,21 +154,17 @@ struct _MDNotified {
         struct _MDCVar *cv;            /* the condition variable notified */
         PRIntn times;                  /* and the number of times notified */
         struct PRThread *notifyHead;   /* list of threads to wake up */
     } cv[_MD_CV_NOTIFIED_LENGTH];
     _MDNotified *link;                 /* link to another of these, or NULL */
 };
 
 struct _MDLock {
-#ifdef USE_RAMSEM
-    CRITICAL_SECTION mutex;            /* this is recursive on NT */
-#else
-    HMTX mutex;                        /* this is recursive on NT */
-#endif
+    HMTX mutex;                        /* this is recursive on OS/2 */
 
     /*
      * When notifying cvars, there is no point in actually
      * waking up the threads waiting on the cvars until we've
      * released the lock.  So, we temporarily record the cvars.
      * When doing an unlock, we'll then wake up the waiting threads.
      */
     struct _MDNotified notified;     /* array of conditions notified */
@@ -247,20 +215,16 @@ extern PRInt32 _MD_CloseFile(PRInt32 osf
 #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 --- */
 
 /* The ones that don't map directly may need to be re-visited... */
-#ifdef XP_OS2_VACPP
-#define EPIPE                     EBADF
-#define EIO                       ECONNREFUSED
-#endif
 #define _MD_EACCES                EACCES
 #define _MD_EADDRINUSE            EADDRINUSE
 #define _MD_EADDRNOTAVAIL         EADDRNOTAVAIL
 #define _MD_EAFNOSUPPORT          EAFNOSUPPORT
 #define _MD_EAGAIN                EWOULDBLOCK
 #define _MD_EALREADY              EALREADY
 #define _MD_EBADF                 EBADF
 #define _MD_ECONNREFUSED          ECONNREFUSED
@@ -287,21 +251,17 @@ extern void _MD_MakeNonblock(PRFileDesc 
 #define _MD_INIT_FD_INHERITABLE       (_PR_MD_INIT_FD_INHERITABLE)
 #define _MD_QUERY_FD_INHERITABLE      (_PR_MD_QUERY_FD_INHERITABLE)
 #define _MD_SHUTDOWN                  (_PR_MD_SHUTDOWN)
 #define _MD_LISTEN                    _PR_MD_LISTEN
 extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
 #define _MD_CLOSE_SOCKET              _MD_CloseSocket
 #define _MD_SENDTO                    (_PR_MD_SENDTO)
 #define _MD_RECVFROM                  (_PR_MD_RECVFROM)
-#ifdef XP_OS2_VACPP
-#define _MD_SOCKETPAIR(s, type, proto, sv) -1
-#else
 #define _MD_SOCKETPAIR                (_PR_MD_SOCKETPAIR)
-#endif
 #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_FSYNC                     _PR_MD_FSYNC
 #define _MD_SET_FD_INHERITABLE        (_PR_MD_SET_FD_INHERITABLE)
 
@@ -371,36 +331,21 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd
 #define _MD_BEGIN_RESUME_ALL()
 #define _MD_END_SUSPEND_ALL()
 #define _MD_END_RESUME_ALL()
 
 /* --- Lock stuff --- */
 #define _PR_LOCK                      _MD_LOCK
 #define _PR_UNLOCK					  _MD_UNLOCK
 
-#ifdef USE_RAMSEM
-#define _MD_NEW_LOCK                  (_PR_MD_NEW_LOCK)
-#define _MD_FREE_LOCK(lock)           (DosCloseEventSem(((PRAMSEM)(&((lock)->mutex)))->hevSem))
-#define _MD_LOCK(lock)                (SemRequest486(&((lock)->mutex), -1))
-#define _MD_TEST_AND_LOCK(lock)       (SemRequest486(&((lock)->mutex), -1),0)
-#define _MD_UNLOCK(lock)              \
-    PR_BEGIN_MACRO \
-    if (0 != (lock)->notified.length) { \
-        md_UnlockAndPostNotifies((lock), NULL, NULL); \
-    } else { \
-        SemReleasex86( &(lock)->mutex, 0 ); \
-    } \
-    PR_END_MACRO
-#else
 #define _MD_NEW_LOCK                  (_PR_MD_NEW_LOCK)
 #define _MD_FREE_LOCK(lock)           (DosCloseMutexSem((lock)->mutex))
 #define _MD_LOCK(lock)                (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT))
 #define _MD_TEST_AND_LOCK(lock)       (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT),0)
 #define _MD_UNLOCK                    (_PR_MD_UNLOCK)
-#endif
 
 /* --- lock and cv waiting --- */
 #define _MD_WAIT                      (_PR_MD_WAIT)
 #define _MD_WAKEUP_WAITER             (_PR_MD_WAKEUP_WAITER)
 
 /* --- CVar ------------------- */
 #define _MD_WAIT_CV					  (_PR_MD_WAIT_CV)
 #define _MD_NEW_CV					  (_PR_MD_NEW_CV)
--- a/nsprpub/pr/include/md/_os2_errors.h
+++ b/nsprpub/pr/include/md/_os2_errors.h
@@ -125,20 +125,18 @@ NSPR_API(void) _MD_os2_map_bind_error(PR
 #define	_PR_MD_MAP_BIND_ERROR	_MD_os2_map_bind_error
 
 NSPR_API(void) _MD_os2_map_listen_error(PRInt32 err);
 #define	_PR_MD_MAP_LISTEN_ERROR	_MD_os2_map_listen_error
 
 NSPR_API(void) _MD_os2_map_shutdown_error(PRInt32 err);
 #define	_PR_MD_MAP_SHUTDOWN_ERROR	_MD_os2_map_shutdown_error
 
-#ifndef XP_OS2_VACPP
 NSPR_API(void) _MD_os2_map_socketpair_error(int err);
 #define	_PR_MD_MAP_SOCKETPAIR_ERROR	_MD_os2_map_socketpair_error
-#endif
 
 NSPR_API(void) _MD_os2_map_getsockname_error(PRInt32 err);
 #define	_PR_MD_MAP_GETSOCKNAME_ERROR	_MD_os2_map_getsockname_error
 
 NSPR_API(void) _MD_os2_map_getpeername_error(PRInt32 err);
 #define	_PR_MD_MAP_GETPEERNAME_ERROR	_MD_os2_map_getpeername_error
 
 NSPR_API(void) _MD_os2_map_getsockopt_error(PRInt32 err);
--- a/nsprpub/pr/include/md/_pcos.h
+++ b/nsprpub/pr/include/md/_pcos.h
@@ -51,30 +51,30 @@
 #else
 #define GCPTR
 #endif
 
 /*
 ** Routines for processing command line arguments
 */
 PR_BEGIN_EXTERN_C
-#ifndef XP_OS2_EMX
+#ifndef XP_OS2
 extern char *optarg;
 extern int optind;
 extern int getopt(int argc, char **argv, char *spec);
 #endif
 PR_END_EXTERN_C
 
 
 /*
 ** Definitions of directory structures amd functions
 ** These definitions are from:
 **      <dirent.h>
 */
-#ifdef XP_OS2_EMX
+#ifdef XP_OS2
 #include <sys/types.h>
 #endif
 #include <sys/stat.h>
 #include <io.h>
 #include <fcntl.h>          /* O_BINARY */
 
 #ifdef OS2
 extern PRStatus _MD_OS2GetHostName(char *name, PRUint32 namelen);
--- a/nsprpub/pr/include/md/_pth.h
+++ b/nsprpub/pr/include/md/_pth.h
@@ -142,17 +142,17 @@
 #define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) \
 	(!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
 #define _PT_PTHREAD_COPY_THR_HANDLE(st, dt)   (dt) = (st)
 #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
 	|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
 	|| defined(HPUX) || defined(FREEBSD) \
 	|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
 	|| defined(VMS) || defined(NTO) || defined(DARWIN) \
-	|| defined(UNIXWARE) || defined(RISCOS)
+	|| defined(UNIXWARE) || defined(RISCOS)	|| defined(SYMBIAN)
 #ifdef __GNU__
 /* Hurd pthreads don't have an invalid value for pthread_t. -- rmh */
 #error Using Hurd pthreads
 #endif
 #define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t)  (t) = 0
 #define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t)  (t) == 0
 #define _PT_PTHREAD_COPY_THR_HANDLE(st, dt)   (dt) = (st)
 #else 
@@ -199,17 +199,17 @@
 
 /*
  * These platforms don't have sigtimedwait()
  */
 #if (defined(AIX) && !defined(AIX4_3_PLUS)) \
 	|| defined(LINUX) || defined(__GNU__)|| defined(__GLIBC__) \
 	|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
 	|| defined(BSDI) || defined(VMS) || defined(UNIXWARE) \
-	|| defined(DARWIN)
+	|| defined(DARWIN) || defined(SYMBIAN)
 #define PT_NO_SIGTIMEDWAIT
 #endif
 
 #if defined(OSF1) || defined(VMS)
 #define PT_PRIO_MIN            PRI_OTHER_MIN
 #define PT_PRIO_MAX            PRI_OTHER_MAX
 #elif defined(IRIX)
 #include <sys/sched.h>
@@ -230,17 +230,17 @@
 #define PT_PRIO_MAX            PRI_OTHER_MAX
 #else /* defined(_PR_DCETHREADS) */
 #include <sys/sched.h>
 #define PT_PRIO_MIN            sched_get_priority_min(SCHED_OTHER)
 #define PT_PRIO_MAX            sched_get_priority_max(SCHED_OTHER)
 #endif /* defined(_PR_DCETHREADS) */
 
 #elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
-	|| defined(FREEBSD)
+	|| defined(FREEBSD) || defined(SYMBIAN)
 #define PT_PRIO_MIN            sched_get_priority_min(SCHED_OTHER)
 #define PT_PRIO_MAX            sched_get_priority_max(SCHED_OTHER)
 #elif defined(NTO)
 /*
  * Neutrino has functions that return the priority range but
  * they return invalid numbers, so I just hard coded these here
  * for now.  Jerry.Kirk@Nexarecorp.com
  */
@@ -290,15 +290,15 @@ extern int (*_PT_aix_yield_fcn)();
 		struct timespec onemillisec = {0};		\
 		onemillisec.tv_nsec = 1000000L;			\
         nanosleep(&onemillisec,NULL);			\
     PR_END_MACRO
 #elif defined(HPUX) || defined(SOLARIS) \
 	|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
 	|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
 	|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
-	|| defined(UNIXWARE) || defined(RISCOS)
+	|| defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
 #define _PT_PTHREAD_YIELD()            	sched_yield()
 #else
 #error "Need to define _PT_PTHREAD_YIELD for this platform"
 #endif
 
 #endif /* nspr_pth_defs_h_ */
--- a/nsprpub/pr/include/md/_solaris.h
+++ b/nsprpub/pr/include/md/_solaris.h
@@ -70,26 +70,22 @@
 #define	HAVE_DLL
 #define	USE_DLFCN
 #define NEED_STRFTIME_LOCK
 
 /*
  * Intel x86 has atomic instructions.
  *
  * Sparc v8 does not have instructions to efficiently implement
- * atomic increment/decrement operations.  In the local threads
- * only and pthreads versions, we use the default atomic routine
- * implementation in pratom.c.  The obsolete global threads only
- * version uses a global mutex_t to implement the atomic routines
- * in solaris.c, which is actually equivalent to the default
- * implementation.
+ * atomic increment/decrement operations.  We use the default
+ * atomic routine implementation in pratom.c.
  *
  * 64-bit Solaris requires sparc v9, which has atomic instructions.
  */
-#if defined(i386) || defined(_PR_GLOBAL_THREADS_ONLY) || defined(IS_64)
+#if defined(i386) || defined(IS_64)
 #define _PR_HAVE_ATOMIC_OPS
 #endif
 
 #define _PR_POLL_AVAILABLE
 #define _PR_USE_POLL
 #define _PR_STAT_HAS_ST_ATIM
 #ifdef SOLARIS2_5
 #define _PR_HAVE_SYSV_SEMAPHORES
@@ -135,17 +131,17 @@ struct _md_sockaddr_in6 {
     PRUint16 sin6_family;
     PRUint16 sin6_port;
     PRUint32 sin6_flowinfo;
     struct _md_in6_addr sin6_addr;
     PRUint32 sin6_scope_id;
     PRUint32 __sin6_src_id;
 };
 #endif
-#if defined(_PR_GLOBAL_THREADS_ONLY) || defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS)
 #define _PR_HAVE_GETHOST_R
 #define _PR_HAVE_GETHOST_R_POINTER
 #endif
 
 #include "prinrval.h"
 NSPR_API(PRIntervalTime) _MD_Solaris_GetInterval(void);
 #define _MD_GET_INTERVAL                  _MD_Solaris_GetInterval
 NSPR_API(PRIntervalTime) _MD_Solaris_TicksPerSecond(void);
@@ -172,302 +168,31 @@ NSPR_API(PRInt32) _MD_AtomicSet(PRInt32 
 
 #if defined(_PR_PTHREADS)
 
 NSPR_API(void)		_MD_EarlyInit(void);
 
 #define _MD_EARLY_INIT		_MD_EarlyInit
 #define _MD_FINAL_INIT		_PR_UnixInit
 
-#elif defined(_PR_GLOBAL_THREADS_ONLY)
-
-#include "prthread.h"
-
-#include <ucontext.h>
-
-/*
-** Iinitialization Related definitions
-*/
-
-NSPR_API(void)		_MD_EarlyInit(void);
-
-#define _MD_EARLY_INIT		_MD_EarlyInit
-#define _MD_FINAL_INIT		_PR_UnixInit
-
-#define _MD_GET_SP(threadp)	threadp->md.sp
-
-/*
-** Clean-up the thread machine dependent data structure
-*/
-#define	_MD_INIT_THREAD				_MD_InitializeThread
-#define	_MD_INIT_ATTACHED_THREAD	_MD_InitializeThread
-
-NSPR_API(PRStatus) _MD_CreateThread(PRThread *thread, 
-					void (*start)(void *), 
-					PRThreadPriority priority,
-					PRThreadScope scope, 
-					PRThreadState state, 
-					PRUint32 stackSize);
-#define _MD_CREATE_THREAD _MD_CreateThread
-
-#define	_PR_CONTEXT_TYPE	ucontext_t
-
-#define CONTEXT(_thread) (&(_thread)->md.context)
-
-#include <thread.h>
-#include <sys/lwp.h>
-#include <synch.h>
-
-extern struct PRLock *_pr_schedLock;
+#else /* _PR_PTHREADS */
 
 /*
-** Thread Local Storage 
-*/
-
-#define THREAD_KEY_T thread_key_t
-
-extern struct PRThread *_pr_attached_thread_tls();
-extern struct PRThread *_pr_current_thread_tls();
-extern struct _PRCPU *_pr_current_cpu_tls();
-extern struct PRThread *_pr_last_thread_tls();
-
-extern THREAD_KEY_T threadid_key;
-extern THREAD_KEY_T cpuid_key;
-extern THREAD_KEY_T last_thread_key;
-
-#define _MD_GET_ATTACHED_THREAD() _pr_attached_thread_tls()
-#define _MD_CURRENT_THREAD() _pr_current_thread_tls()
-#define _MD_CURRENT_CPU() _pr_current_cpu_tls()
-#define _MD_LAST_THREAD() _pr_last_thread_tls()
-	
-#define _MD_SET_CURRENT_THREAD(newval) 			\
-	PR_BEGIN_MACRO					\
-	thr_setspecific(threadid_key, (void *)newval);	\
-	PR_END_MACRO
-
-#define _MD_SET_CURRENT_CPU(newval) 			\
-	PR_BEGIN_MACRO					\
-	thr_setspecific(cpuid_key, (void *)newval);	\
-	PR_END_MACRO
-
-#define _MD_SET_LAST_THREAD(newval)	 			\
-	PR_BEGIN_MACRO						\
-	thr_setspecific(last_thread_key, (void *)newval);	\
-	PR_END_MACRO
-	
-#define	_MD_CLEAN_THREAD(_thread)	_MD_cleanup_thread(_thread)
-extern void _MD_exit_thread(PRThread *thread);
-#define _MD_EXIT_THREAD(thread)		_MD_exit_thread(thread)
-
-#define	_MD_SUSPEND_THREAD(thread)	_MD_Suspend(thread)
-#define	_MD_RESUME_THREAD(thread)	thr_continue((thread)->md.handle)
-
-/* XXXX Needs to be defined - Prashant */
-#define _MD_SUSPEND_CPU(cpu)
-#define _MD_RESUME_CPU(cpu)
-
-extern void _MD_Begin_SuspendAll(void);
-extern void _MD_End_SuspendAll(void);
-extern void _MD_End_ResumeAll(void);
-#define _MD_BEGIN_SUSPEND_ALL()		_MD_Begin_SuspendAll()
-#define _MD_BEGIN_RESUME_ALL()		
-#define	_MD_END_SUSPEND_ALL()		_MD_End_SuspendAll()
-#define	_MD_END_RESUME_ALL()		_MD_End_ResumeAll()
-
-#define _MD_INIT_LOCKS()
-#define _MD_NEW_LOCK(md_lockp) (mutex_init(&((md_lockp)->lock),USYNC_THREAD,NULL) ? PR_FAILURE : PR_SUCCESS)
-#define _MD_FREE_LOCK(md_lockp) mutex_destroy(&((md_lockp)->lock))
-#define _MD_UNLOCK(md_lockp) mutex_unlock(&((md_lockp)->lock))
-#define _MD_TEST_AND_LOCK(md_lockp) mutex_trylock(&((md_lockp)->lock))
-struct _MDLock;
-NSPR_API(void) _MD_lock(struct _MDLock *md_lock);
-#undef PROFILE_LOCKS
-#ifndef PROFILE_LOCKS
-#define _MD_LOCK(md_lockp) _MD_lock(md_lockp)
-#else
-#define _MD_LOCK(md_lockp)                 \
-    PR_BEGIN_MACRO \
-    int rv = _MD_TEST_AND_LOCK(md_lockp); \
-    if (rv == 0) { \
-        (md_lockp)->hitcount++; \
-    } else { \
-        (md_lockp)->misscount++; \
-        _MD_lock(md_lockp); \
-    } \
-    PR_END_MACRO
-#endif
-
-#define _PR_LOCK_HEAP() if (_pr_heapLock) _MD_LOCK(&_pr_heapLock->md)
-#define _PR_UNLOCK_HEAP() if (_pr_heapLock) _MD_UNLOCK(&_pr_heapLock->md)
-
-#define _MD_ATTACH_THREAD(threadp)
-
-
-#define THR_KEYCREATE thr_keycreate
-#define THR_SELF thr_self
-#define _MD_NEW_CV(condp) cond_init(&((condp)->cv), USYNC_THREAD, 0)
-#define COND_WAIT(condp, mutexp) cond_wait(condp, mutexp)
-#define COND_TIMEDWAIT(condp, mutexp, tspec) \
-                                     cond_timedwait(condp, mutexp, tspec)
-#define _MD_NOTIFY_CV(condp, lockp) cond_signal(&((condp)->cv))
-#define _MD_NOTIFYALL_CV(condp,unused) cond_broadcast(&((condp)->cv))	
-#define _MD_FREE_CV(condp) cond_destroy(&((condp)->cv))
-#define _MD_YIELD() thr_yield()
-#include <time.h>
-/* 
- * Because clock_gettime() on Solaris/x86 2.4 always generates a
- * segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
- * which is implemented using gettimeofday().
- */
-#if defined(i386) && defined(SOLARIS2_4)
-extern int _pr_solx86_clock_gettime(clockid_t clock_id, struct timespec *tp);
-#define GETTIME(tt) _pr_solx86_clock_gettime(CLOCK_REALTIME, (tt))
-#else
-#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
-#endif  /* i386 && SOLARIS2_4 */
-
-#define MUTEX_T mutex_t
-#define COND_T cond_t
-
-#define _MD_NEW_SEM(md_semp,_val)  sema_init(&((md_semp)->sem),_val,USYNC_THREAD,NULL)
-#define _MD_DESTROY_SEM(md_semp) sema_destroy(&((md_semp)->sem))
-#define _MD_WAIT_SEM(md_semp) sema_wait(&((md_semp)->sem))
-#define _MD_POST_SEM(md_semp) sema_post(&((md_semp)->sem))
-
-#define _MD_SAVE_ERRNO(_thread)
-#define _MD_RESTORE_ERRNO(_thread)
-#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
-
-extern struct _MDLock _pr_ioq_lock;
-#define _MD_IOQ_LOCK()		_MD_LOCK(&_pr_ioq_lock)
-#define _MD_IOQ_UNLOCK()	_MD_UNLOCK(&_pr_ioq_lock)
-
-extern PRStatus _MD_wait(struct PRThread *, PRIntervalTime timeout);
-#define _MD_WAIT _MD_wait
-
-extern PRStatus _MD_WakeupWaiter(struct PRThread *);
-#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
-
-NSPR_API(void) _MD_InitIO(void);
-#define _MD_INIT_IO _MD_InitIO
-
-#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
-    PR_BEGIN_MACRO \
-    *status = PR_TRUE; \
-    PR_END_MACRO
-#define _MD_SWITCH_CONTEXT(_thread)
-#define _MD_RESTORE_CONTEXT(_newThread)
-
-struct _MDLock {
-    MUTEX_T lock;
-#ifdef PROFILE_LOCKS
-    PRInt32 hitcount;
-    PRInt32 misscount;
-#endif
-};
-
-struct _MDCVar {
-    COND_T cv;
-};
-
-struct _MDSemaphore {
-    sema_t sem;
-};
-
-struct _MDThread {
-    _PR_CONTEXT_TYPE context;
-    thread_t handle;
-    lwpid_t lwpid;
-    uint_t sp;		/* stack pointer */
-    uint_t threadID;	/* ptr to solaris-internal thread id structures */
-    struct _MDSemaphore waiter_sem;
-};
-
-struct _MDThreadStack {
-    PRInt8 notused;
-};
-
-struct _MDSegment {
-    PRInt8 notused;
-};
-
-/*
- * md-specific cpu structure field, common to all Unix platforms
- */
-#define _PR_MD_MAX_OSFD FD_SETSIZE
-
-struct _MDCPU_Unix {
-    PRCList ioQ;
-    PRUint32 ioq_timeout;
-    PRInt32 ioq_max_osfd;
-    PRInt32 ioq_osfd_cnt;
-#ifndef _PR_USE_POLL
-    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];
-#else
-	struct pollfd *ioq_pollfds;
-	int ioq_pollfds_size;
-#endif	/* _PR_USE_POLL */
-};
-
-#define _PR_IOQ(_cpu)			((_cpu)->md.md_unix.ioQ)
-#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
-#define _PR_FD_READ_SET(_cpu)		((_cpu)->md.md_unix.fd_read_set)
-#define _PR_FD_READ_CNT(_cpu)		((_cpu)->md.md_unix.fd_read_cnt)
-#define _PR_FD_WRITE_SET(_cpu)		((_cpu)->md.md_unix.fd_write_set)
-#define _PR_FD_WRITE_CNT(_cpu)		((_cpu)->md.md_unix.fd_write_cnt)
-#define _PR_FD_EXCEPTION_SET(_cpu)	((_cpu)->md.md_unix.fd_exception_set)
-#define _PR_FD_EXCEPTION_CNT(_cpu)	((_cpu)->md.md_unix.fd_exception_cnt)
-#define _PR_IOQ_TIMEOUT(_cpu)		((_cpu)->md.md_unix.ioq_timeout)
-#define _PR_IOQ_MAX_OSFD(_cpu)		((_cpu)->md.md_unix.ioq_max_osfd)
-#define _PR_IOQ_OSFD_CNT(_cpu)		((_cpu)->md.md_unix.ioq_osfd_cnt)
-#define _PR_IOQ_POLLFDS(_cpu)		((_cpu)->md.md_unix.ioq_pollfds)
-#define _PR_IOQ_POLLFDS_SIZE(_cpu)	((_cpu)->md.md_unix.ioq_pollfds_size)
-
-#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu)	32
-
-
-struct _MDCPU {
-	struct _MDCPU_Unix md_unix;
-};
-
-/* The following defines the unwrapped versions of select() and poll(). */
-extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
-	fd_set *exceptfds, struct timeval *timeout);
-#define _MD_SELECT	_select
-
-#include <poll.h>
-#define _MD_POLL _poll
-extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
-
-PR_BEGIN_EXTERN_C
-
-/*
-** Missing function prototypes
-*/
-extern int gethostname (char *name, int namelen);
-
-PR_END_EXTERN_C
-
-#else /* _PR_GLOBAL_THREADS_ONLY */
-
-/*
- * LOCAL_THREADS_ONLY implementation on Solaris
+ * _PR_LOCAL_THREADS_ONLY implementation on Solaris
  */
 
 #include "prthread.h"
 
 #include <errno.h>
 #include <ucontext.h>
 #include <sys/stack.h>
 #include <synch.h>
 
 /*
-** Iinitialization Related definitions
+** Initialization Related definitions
 */
 
 NSPR_API(void)				_MD_EarlyInit(void);
 NSPR_API(void)				_MD_SolarisInit();
 #define _MD_EARLY_INIT		_MD_EarlyInit
 #define _MD_FINAL_INIT		_MD_SolarisInit
 #define	_MD_INIT_THREAD		_MD_InitializeThread
 
@@ -793,14 +518,14 @@ PR_BEGIN_EXTERN_C
 
 /*
 ** Missing function prototypes
 */
 extern int gethostname (char *name, int namelen);
 
 PR_END_EXTERN_C
 
-#endif /* _PR_GLOBAL_THREADS_ONLY */
+#endif /* _PR_PTHREADS */
 
 extern void _MD_solaris_map_sendfile_error(int err);
 
 #endif /* nspr_solaris_defs_h___ */
 
new file mode 100644
--- /dev/null
+++ b/nsprpub/pr/include/md/_symbian.cfg
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** 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_cpucfg___
+#define nspr_cpucfg___
+
+#ifndef XP_UNIX
+#define XP_UNIX
+#endif
+
+#ifndef SYMBIAN
+#define SYMBIAN
+#endif
+
+#define PR_AF_INET6 0x0806  /* same as AF_INET6 */
+
+#ifdef __arm__
+
+#define IS_LITTLE_ENDIAN 1
+#undef  IS_BIG_ENDIAN
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   4
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   4
+#define PR_BYTES_PER_DWORD  8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    32
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    32
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   5
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   5
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
+#ifdef __WINS__
+#define PR_ALIGN_OF_INT64   4
+#define PR_ALIGN_OF_DOUBLE  4
+#else
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_DOUBLE  8
+#endif
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#else
+
+#error "Unknown CPU architecture"
+
+#endif
+
+#ifndef HAVE_LONG_LONG
+#define	HAVE_LONG_LONG
+#endif
+#if PR_ALIGN_OF_DOUBLE == 8
+#define HAVE_ALIGNED_DOUBLES
+#endif
+#if PR_ALIGN_OF_INT64 == 8
+#define HAVE_ALIGNED_LONGLONGS
+#endif
+
+#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 */
+
+#endif /* nspr_cpucfg___ */
new file mode 100644
--- /dev/null
+++ b/nsprpub/pr/include/md/_symbian.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** 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_symbian_defs_h___
+#define nspr_symbian_defs_h___
+
+#include "prthread.h"
+
+/*
+ * Internal configuration macros
+ */
+
+#define _PR_SI_SYSNAME  "SYMBIAN"
+#ifdef __arm__
+#define _PR_SI_ARCHITECTURE "arm"
+#else
+#error "Unknown CPU architecture"
+#endif
+#define PR_DLL_SUFFIX		".dll"
+
+#undef	HAVE_STACK_GROWING_UP
+
+#ifdef DYNAMIC_LIBRARY
+#define HAVE_DLL
+#define USE_DLFCN
+#endif
+
+#define _PR_STAT_HAS_ONLY_ST_ATIME
+#define _PR_NO_LARGE_FILES
+#define _PR_HAVE_SYSV_SEMAPHORES
+#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
+
+#ifndef _PR_PTHREADS
+#error "Classic NSPR is not implemented"
+#endif
+
+extern void _MD_EarlyInit(void);
+extern PRIntervalTime _PR_UNIX_GetInterval(void);
+extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
+
+#define _MD_EARLY_INIT                  _MD_EarlyInit
+#define _MD_FINAL_INIT                  _PR_UnixInit
+#define _MD_GET_INTERVAL                _PR_UNIX_GetInterval
+#define _MD_INTERVAL_PER_SEC            _PR_UNIX_TicksPerSecond
+
+/* For writev() */
+#include <sys/uio.h>
+
+#endif /* nspr_symbian_defs_h___ */
--- a/nsprpub/pr/include/md/_unixos.h
+++ b/nsprpub/pr/include/md/_unixos.h
@@ -63,25 +63,27 @@
 #include "prmem.h"
 #include "prclist.h"
 
 /*
  * For select(), fd_set, and struct timeval.
  *
  * In The Single UNIX(R) Specification, Version 2,
  * the header file for select() is <sys/time.h>.
+ * In Version 3, the header file for select() is
+ * changed to <sys/select.h>.
  *
  * fd_set is defined in <sys/types.h>.  Usually
  * <sys/time.h> includes <sys/types.h>, but on some
  * older systems <sys/time.h> does not include
  * <sys/types.h>, so we include it explicitly.
  */
 #include <sys/time.h>
 #include <sys/types.h>
-#if defined(AIX)  /* Only pre-4.2 AIX needs it, but for simplicity... */
+#if defined(AIX) || defined(SYMBIAN)
 #include <sys/select.h>
 #endif
 
 #define _PR_HAVE_O_APPEND
 
 #define PR_DIRECTORY_SEPARATOR		'/'
 #define PR_DIRECTORY_SEPARATOR_STR	"/"
 #define PR_PATH_SEPARATOR		':'
--- a/nsprpub/pr/include/md/prosdep.h
+++ b/nsprpub/pr/include/md/prosdep.h
@@ -136,16 +136,19 @@ PR_BEGIN_EXTERN_C
 #include "md/_openvms.h"
 
 #elif defined(NTO)
 #include "md/_nto.h"
 
 #elif defined(RISCOS)
 #include "md/_riscos.h"
 
+#elif defined(SYMBIAN)
+#include "md/_symbian.h"
+
 #else
 #error unknown Unix flavor
 
 #endif
 
 #include "md/_unixos.h"
 #include "md/_unix_errors.h"
 
--- a/nsprpub/pr/include/prinet.h
+++ b/nsprpub/pr/include/prinet.h
@@ -33,32 +33,38 @@
  * 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 ***** */
 
 /*
  * File:		prinet.h
  * Description:
- *     Header file used to find the system header files for socket support.
+ *     Header file used to find the system header files for socket support[1].
  *     This file serves the following purposes:
  *     - A cross-platform, "get-everything" socket header file.  On
  *       Unix, socket support is scattered in several header files,
  *       while Windows and Mac have a "get-everything" socket header
- *       file.
+ *       file[2].
  *     - NSPR needs the following macro definitions and function
  *       prototype declarations from these header files:
  *           AF_INET
  *           INADDR_ANY, INADDR_LOOPBACK, INADDR_BROADCAST
  *           ntohl(), ntohs(), htonl(), ntons().
  *       NSPR does not define its own versions of these macros and
  *       functions.  It simply uses the native versions, which have
  *       the same names on all supported platforms.
- *     This file is intended to be included by nspr20 public header
+ *     This file is intended to be included by NSPR public header
  *     files, such as prio.h.  One should not include this file directly.
+ *
+ * Notes:
+ *     1. This file should have been an internal header.  Please do not
+ *        depend on it to pull in the system header files you need.
+ *     2. WARNING: This file is no longer cross-platform as it is a no-op
+ *        for WIN32!  See the comment in the WIN32 section for details.
  */
 
 #ifndef prinet_h__
 #define prinet_h__
 
 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
 #include <sys/types.h>
 #include <sys/socket.h>		/* AF_INET */
@@ -98,17 +104,24 @@ struct sockaddr_dl;
  * on these platforms.
  */
 #if defined(BSDI) || defined(OSF1)
 #include <machine/endian.h>
 #endif
 
 #elif defined(WIN32)
 
-/* Do not include any system header files. */
+/*
+ * 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>
 
 #elif defined(XP_MAC)
 
 #include "macsocket.h"
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -58,21 +58,21 @@ PR_BEGIN_EXTERN_C
 /*
 ** NSPR's version is used to determine the likelihood that the version you
 ** used to build your component is anywhere close to being compatible with
 ** what is in the underlying library.
 **
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.7.1"
+#define PR_VERSION  "4.7.2 Beta 2"
 #define PR_VMAJOR   4
 #define PR_VMINOR   7
-#define PR_VPATCH   1
-#define PR_BETA     PR_FALSE
+#define PR_VPATCH   2
+#define PR_BETA     PR_TRUE
 
 /*
 ** PRVersionCheck
 **
 ** The basic signature of the function that is called to provide version
 ** checking. The result will be a boolean that indicates the likelihood
 ** that the underling library will perform as the caller expects.
 **
--- a/nsprpub/pr/include/prio.h
+++ b/nsprpub/pr/include/prio.h
@@ -192,17 +192,17 @@ union PRNetAddr {
     } inet;
     struct {
         PRUint16 family;                /* address family (AF_INET6) */
         PRUint16 port;                  /* port number */
         PRUint32 flowinfo;              /* routing information */
         PRIPv6Addr ip;                  /* the actual 128 bits of address */
         PRUint32 scope_id;              /* set of interfaces for a scope */
     } ipv6;
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
     struct {                            /* Unix domain socket address */
         PRUint16 family;                /* address family (AF_UNIX) */
 #ifdef XP_OS2
         char path[108];                 /* null-terminated pathname */
                                         /* bind fails if size is not 108. */
 #else
         char path[104];                 /* null-terminated pathname */
 #endif
--- a/nsprpub/pr/include/private/pprio.h
+++ b/nsprpub/pr/include/private/pprio.h
@@ -60,18 +60,30 @@ typedef PRInt32 PROsfd;
 
 /* Return the method tables for files, tcp sockets and udp sockets */
 NSPR_API(const PRIOMethods*)    PR_GetFileMethods(void);
 NSPR_API(const PRIOMethods*)    PR_GetTCPMethods(void);
 NSPR_API(const PRIOMethods*)    PR_GetUDPMethods(void);
 NSPR_API(const PRIOMethods*)    PR_GetPipeMethods(void);
 
 /*
-** Convert a NSPR Socket Handle to a Native Socket handle.
-** This function will be obsoleted with the next release; avoid using it.
+** Convert a NSPR socket handle to a native socket handle.
+**
+** Using this function makes your code depend on the properties of the
+** current NSPR implementation, which may change (although extremely
+** unlikely because of NSPR's backward compatibility requirement).  Avoid
+** using it if you can.
+**
+** If you use this function, you need to understand what NSPR does to
+** the native handle.  For example, NSPR puts native socket handles in
+** non-blocking mode or associates them with an I/O completion port (the
+** WINNT build configuration only).  Your use of the native handle should
+** not interfere with NSPR's use of the native handle.  If your code
+** changes the configuration of the native handle, (e.g., changes it to
+** blocking or closes it), NSPR will not work correctly.
 */
 NSPR_API(PROsfd)       PR_FileDesc2NativeHandle(PRFileDesc *);
 NSPR_API(void)         PR_ChangeFileDescNativeHandle(PRFileDesc *, PROsfd);
 NSPR_API(PRFileDesc*)  PR_AllocFileDesc(PROsfd osfd,
                                          const PRIOMethods *methods);
 NSPR_API(void)         PR_FreeFileDesc(PRFileDesc *fd);
 /*
 ** Import an existing OS file to NSPR. 
--- a/nsprpub/pr/include/private/primpl.h
+++ b/nsprpub/pr/include/private/primpl.h
@@ -1393,33 +1393,33 @@ extern PRUintn _PR_NetAddrSize(const PRN
 ** EINVAL.
 **
 ** To pass the correct socket address length to socket
 ** functions, define the macro _PR_HAVE_MD_SOCKADDR_IN6 and
 ** define struct _md_sockaddr_in6 to be isomorphic to
 ** struct sockaddr_in6.
 */
 
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
 #define PR_NETADDR_SIZE(_addr) 					\
         ((_addr)->raw.family == PR_AF_INET		\
         ? sizeof((_addr)->inet)					\
         : ((_addr)->raw.family == PR_AF_INET6	\
         ? sizeof(struct _md_sockaddr_in6)		\
         : sizeof((_addr)->local)))
 #else
 #define PR_NETADDR_SIZE(_addr) 					\
         ((_addr)->raw.family == PR_AF_INET		\
         ? sizeof((_addr)->inet)					\
         : sizeof(struct _md_sockaddr_in6))
 #endif /* defined(XP_UNIX) */
 
 #else
 
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
 #define PR_NETADDR_SIZE(_addr) 					\
         ((_addr)->raw.family == PR_AF_INET		\
         ? sizeof((_addr)->inet)					\
         : ((_addr)->raw.family == PR_AF_INET6	\
         ? sizeof((_addr)->ipv6)					\
         : sizeof((_addr)->local)))
 #else
 #define PR_NETADDR_SIZE(_addr) 					\
--- a/nsprpub/pr/include/prtypes.h
+++ b/nsprpub/pr/include/prtypes.h
@@ -172,30 +172,36 @@
 #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(XP_OS2_VACPP) 
+#elif defined(SYMBIAN)
 
-#define PR_EXPORT(__type) extern __type
-#define PR_EXPORT_DATA(__type) extern __type
-#define PR_IMPORT(__type) extern __type
-#define PR_IMPORT_DATA(__type) extern __type
+#define PR_EXPORT(__type) extern __declspec(dllexport) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+#ifdef __WINS__
+#define PR_IMPORT(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
+#else
+#define PR_IMPORT(__type) extern __declspec(dllimport) __type
+#define PR_IMPORT_DATA(__type) extern __declspec(dllimport) __type
+#endif
 
 #define PR_EXTERN(__type) extern __type
 #define PR_IMPLEMENT(__type) __type
 #define PR_EXTERN_DATA(__type) extern __type
 #define PR_IMPLEMENT_DATA(__type) __type
-#define PR_CALLBACK _Optlink
+
+#define PR_CALLBACK
 #define PR_CALLBACK_DECL
-#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
+#define PR_STATIC_CALLBACK(__x) static __x
 
 #else /* Unix */
 
 /* GCC 3.3 and later support the visibility attribute. */
 #if (__GNUC__ >= 4) || \
     (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
 #define PR_VISIBILITY_DEFAULT __attribute__((visibility("default")))
 #else
--- a/nsprpub/pr/src/Makefile.in
+++ b/nsprpub/pr/src/Makefile.in
@@ -43,21 +43,16 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 DIRS = io linking malloc md memory misc threads
 
-# For VAC++ 4 geticcdata rule in config/OS2.mk
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-CSRCS = prvrsion.c
-endif
-
 ifeq ($(USE_PTHREADS), 1)
 	DIRS += pthreads
 endif
 
 ifeq ($(USE_BTHREADS), 1)
 	DIRS += bthreads
 endif
 
@@ -92,27 +87,23 @@ ifeq (5.7, $(LIBRT_TEST))
 LIBRT=-lrt
 else
 LIBRT=-lposix4
 endif
 
 ifdef USE_PTHREADS
 OS_LIBS			= -lpthread ${LIBRT} -lsocket -lnsl -ldl -lc
 else
-ifdef LOCAL_THREADS_ONLY
 OS_LIBS			= -lsocket -lnsl -ldl -lc
-else
-OS_LIBS			= -lthread ${LIBRT} -lsocket -lnsl -ldl -lc
-endif	# LOCAL_THREADS_ONLY
 endif	# USE_PTHREADS
-ifeq ($(OS_TEST),sun4u)
+ifeq ($(CPU_ARCH),sparc)
 ifndef USE_64
 DSO_LDOPTS	+= -Wl,-f,\$$ORIGIN/cpu/\$$ISALIST/lib$(ULTRASPARC_LIBRARY)$(LIBRARY_VERSION).so
 endif
-endif	# sun4u
+endif	# sparc
 endif	# 4.1.3_U1
 endif	# SunOS
 
 ifeq ($(OS_ARCH), IRIX)
 ifeq ($(USE_PTHREADS), 1)
 OS_LIBS = -lpthread
 endif
 OS_LIBS += -lc
@@ -237,16 +228,17 @@ OBJS = \
     io/$(OBJDIR)/prpolevt.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prprf.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prscanf.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prstdio.$(OBJ_SUFFIX) \
     threads/$(OBJDIR)/prcmon.$(OBJ_SUFFIX) \
 	threads/$(OBJDIR)/prrwlock.$(OBJ_SUFFIX) \
 	threads/$(OBJDIR)/prtpd.$(OBJ_SUFFIX) \
     linking/$(OBJDIR)/prlink.$(OBJ_SUFFIX) \
+    malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX) \
     malloc/$(OBJDIR)/prmem.$(OBJ_SUFFIX) \
     md/$(OBJDIR)/prosdep.$(OBJ_SUFFIX) \
     memory/$(OBJDIR)/prshm.$(OBJ_SUFFIX) \
     memory/$(OBJDIR)/prshma.$(OBJ_SUFFIX) \
     memory/$(OBJDIR)/prseg.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/pralarm.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/pratom.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prcountr.$(OBJ_SUFFIX) \
@@ -264,21 +256,16 @@ OBJS = \
     misc/$(OBJDIR)/prolock.$(OBJ_SUFFIX)	 \
     misc/$(OBJDIR)/prrng.$(OBJ_SUFFIX)	 \
     misc/$(OBJDIR)/prsystem.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prthinfo.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prtpool.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prtrace.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prtime.$(OBJ_SUFFIX)
 
-# ilib now rejects empty objects
-ifneq ($(MOZ_OS2_TOOLS),VACPP)
-OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX)
-endif
-
 ifdef USE_PTHREADS
 OBJS += \
     pthreads/$(OBJDIR)/ptsynch.$(OBJ_SUFFIX) \
     pthreads/$(OBJDIR)/ptio.$(OBJ_SUFFIX) \
     pthreads/$(OBJDIR)/ptthread.$(OBJ_SUFFIX) \
     pthreads/$(OBJDIR)/ptmisc.$(OBJ_SUFFIX)
 else
 OBJS += \
@@ -380,22 +367,18 @@ GARBAGE += $(TINC)
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/prvrsion.$(OBJ_SUFFIX): prvrsion.c $(TINC)
 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
 	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
-else
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
-endif
 #
 # Version information generation (end)
 #
 
 
 #
 # The Client build wants the shared libraries in $(dist_bindir)
 # so we also install them there.
--- a/nsprpub/pr/src/cplus/tests/Makefile.in
+++ b/nsprpub/pr/src/cplus/tests/Makefile.in
@@ -104,53 +104,38 @@ ifeq ($(OS_ARCH), SunOS)
     ifneq ($(OS_RELEASE), 4.1.3_U1)
         ifdef NS_USE_GCC
             LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
         else
             LDOPTS += -R $(PWD)/$(dist_libdir)
         endif
     endif
 
-    ifneq ($(LOCAL_THREADS_ONLY),1)
-# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
-# even though we already linked with these system libraries
-# when we built libnspr.so.
-        ifeq ($(OS_RELEASE), 5.4)
-            EXTRA_LIBS = -lthread
+# SunOS 5.5 needs to link with -lpthread, even though we already
+# linked with this system library when we built libnspr.so.
+    ifeq ($(OS_RELEASE), 5.5)
+        ifdef USE_PTHREADS
+            EXTRA_LIBS = -lpthread
         endif
-
-        ifeq ($(OS_RELEASE), 5.5)
-            ifdef USE_PTHREADS
-                EXTRA_LIBS = -lpthread
-            else
-                EXTRA_LIBS = -lthread
-            endif
-        endif
-    endif # LOCAL_THREADS_ONLY
+    endif
 endif # SunOS
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
   LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
   LIBPL = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
 else
   LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
   LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   LIBPL = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
 endif
 endif
 
 ifeq ($(OS_ARCH),OS2)
-  ifeq ($(MOZ_OS2_TOOLS),VACPP)
-    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
-    LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
-    LIBPLC = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
-  else
-    LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
-  endif
+LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), OSF1)
 LDOPTS += -rpath $(PWD)/$(dist_libdir)
--- a/nsprpub/pr/src/io/Makefile.in
+++ b/nsprpub/pr/src/io/Makefile.in
@@ -80,18 +80,10 @@ 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
 
-# An OS/2 Optimization bug causes PR_snprintf() to produce wrong result.
-# This suppresses optimization for this single compilation unit.
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-$(OBJDIR)/prprf.obj: prprf.c
-	@$(MAKE_OBJDIR)
-	$(CC) -Fo$@ -c $(filter-out /O+, $(CFLAGS)) $<
-endif
-
 export:: $(TARGETS)
 
--- a/nsprpub/pr/src/io/prlog.c
+++ b/nsprpub/pr/src/io/prlog.c
@@ -16,44 +16,32 @@
  * 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):
+ *   IBM Corporation
  *
  * 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 ***** */
 
-/*
- * Contributors:
- *
- * This Original Code has been modified by IBM Corporation.
- * Modifications made by IBM described herein are
- * Copyright (c) International Business Machines Corporation, 2000.
- * Modifications to Mozilla code or documentation identified per
- * MPL Section 3.3
- *
- * Date         Modified by     Description of modification
- * 04/10/2000   IBM Corp.       Added DebugBreak() definitions for OS/2
- */
-
 #include "primpl.h"
 #include "prenv.h"
 #include "prprf.h"
 #include <string.h>
 
 /*
  * Lock used to lock the log.
  *
@@ -539,45 +527,31 @@ PR_IMPLEMENT(void) PR_LogFlush(void)
 }
 
 PR_IMPLEMENT(void) PR_Abort(void)
 {
     PR_LogPrint("Aborting");
     abort();
 }
 
-#if defined(XP_OS2)
-/*
- * Added definitions for DebugBreak() for 2 different OS/2 compilers.
- * Doing the int3 on purpose for Visual Age so that a developer can
- * step over the instruction if so desired.  Not always possible if
- * trapping due to exception handling IBM-AKR
- */
-#if defined(XP_OS2_VACPP)
-#include <builtin.h>
-static void DebugBreak(void) { _interrupt(3); }
-#elif defined(XP_OS2_EMX)
-static void DebugBreak(void) { asm("int $3"); }
-#else
-static void DebugBreak(void) { }
-#endif
-#endif /* XP_OS2 */
-
 PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln)
 {
     PR_LogPrint("Assertion failure: %s, at %s:%d\n", s, file, ln);
 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
     fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
 #endif
 #ifdef XP_MAC
     dprintf("Assertion failure: %s, at %s:%d\n", s, file, ln);
 #endif
-#if defined(WIN32) || defined(XP_OS2)
+#ifdef WIN32
     DebugBreak();
 #endif
+#ifdef XP_OS2
+    asm("int $3");
+#endif
 #ifndef XP_MAC
     abort();
 #endif
 }
 
 #ifdef XP_MAC
 PR_IMPLEMENT(void) PR_Init_Log(void)
 {
--- a/nsprpub/pr/src/io/prmapopt.c
+++ b/nsprpub/pr/src/io/prmapopt.c
@@ -65,17 +65,18 @@
 
 #include "primpl.h"
 
 #if defined(NEXTSTEP)
 /* NEXTSTEP is special: this must come before netinet/tcp.h. */
 #include <netinet/in_systm.h>  /* n_short, n_long, n_time */
 #endif
 
-#if defined(XP_UNIX) || defined(OS2) || (defined(XP_BEOS) && defined(BONE_VERSION))
+#if (defined(XP_UNIX) && !defined(SYMBIAN)) \
+    || defined(OS2) || (defined(XP_BEOS) && defined(BONE_VERSION))
 #include <netinet/tcp.h>  /* TCP_NODELAY, TCP_MAXSEG */
 #endif
 
 #ifndef _PR_PTHREADS
 
 PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionData *data)
 {
     PRStatus rv;
--- a/nsprpub/pr/src/io/prprf.c
+++ b/nsprpub/pr/src/io/prprf.c
@@ -1155,21 +1155,16 @@ static int LimitStuff(SprintfState *ss, 
 ** sprintf into a fixed size buffer. Make sure there is a NUL at the end
 ** when finished.
 */
 PR_IMPLEMENT(PRUint32) PR_snprintf(char *out, PRUint32 outlen, const char *fmt, ...)
 {
     va_list ap;
     PRUint32 rv;
 
-    PR_ASSERT((PRInt32)outlen > 0);
-    if ((PRInt32)outlen <= 0) {
-	return 0;
-    }
-
     va_start(ap, fmt);
     rv = PR_vsnprintf(out, outlen, fmt, ap);
     va_end(ap);
     return rv;
 }
 
 PR_IMPLEMENT(PRUint32) PR_vsnprintf(char *out, PRUint32 outlen,const char *fmt,
                                   va_list ap)
--- a/nsprpub/pr/src/io/prsocket.c
+++ b/nsprpub/pr/src/io/prsocket.c
@@ -42,34 +42,34 @@
 /************************************************************************/
 
 /* These two functions are only used in assertions. */
 #if defined(DEBUG)
 
 PRBool IsValidNetAddr(const PRNetAddr *addr)
 {
     if ((addr != NULL)
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
 	    && (addr->raw.family != PR_AF_LOCAL)
 #endif
 	    && (addr->raw.family != PR_AF_INET6)
 	    && (addr->raw.family != PR_AF_INET)) {
         return PR_FALSE;
     }
     return PR_TRUE;
 }
 
 static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len)
 {
     /*
      * The definition of the length of a Unix domain socket address
      * is not uniform, so we don't check it.
      */
     if ((addr != NULL)
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
             && (addr->raw.family != AF_UNIX)
 #endif
             && (PR_NETADDR_SIZE(addr) != addr_len)) {
 #if defined(LINUX) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 1
         /*
          * In glibc 2.1, struct sockaddr_in6 is 24 bytes.  In glibc 2.2
          * and in the 2.4 kernel, struct sockaddr_in6 has the scope_id
          * field and is 28 bytes.  It is possible for socket functions
@@ -1288,17 +1288,17 @@ PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRIn
 {
 	PROsfd osfd;
 	PRFileDesc *fd;
 	PRInt32 tmp_domain = domain;
 
 	if (!_pr_initialized) _PR_ImplicitInitialization();
 	if (PR_AF_INET != domain
 			&& PR_AF_INET6 != domain
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
 			&& PR_AF_LOCAL != domain
 #endif
 			) {
 		PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, 0);
 		return NULL;
 	}
 
 #if defined(_PR_INET6_PROBE)
--- a/nsprpub/pr/src/md/beos/bnet.c
+++ b/nsprpub/pr/src/md/beos/bnet.c
@@ -434,31 +434,45 @@ done:
 PRInt32 _MD_writev(
     PRFileDesc *fd, const PRIOVec *iov,
     PRInt32 iov_size, PRIntervalTime timeout)
 {
     PRInt32 rv, err;
     PRThread *me = _PR_MD_CURRENT_THREAD();
     PRInt32 index, amount = 0;
     PRInt32 osfd = fd->secret->md.osfd;
+    struct iovec osiov[PR_MAX_IOVECTOR_SIZE];
+
+    /* Ensured by PR_Writev */
+    PR_ASSERT(iov_size <= PR_MAX_IOVECTOR_SIZE);
+
+    /*
+     * We can't pass iov to writev because PRIOVec and struct iovec
+     * may not be binary compatible.  Make osiov a copy of iov and
+     * pass osiov to writev.
+     */
+    for (index = 0; index < iov_size; index++) {
+        osiov[index].iov_base = iov[index].iov_base;
+        osiov[index].iov_len = iov[index].iov_len;
+    }
 
     /*
      * Calculate the total number of bytes to be sent; needed for
      * optimization later.
      * We could avoid this if this number was passed in; but it is
      * probably not a big deal because iov_size is usually small (less than
      * 3)
      */
     if (!fd->secret->nonblocking) {
         for (index=0; index<iov_size; index++) {
             amount += iov[index].iov_len;
         }
     }
 
-    while ((rv = writev(osfd, (const struct iovec*)iov, iov_size)) == -1) {
+    while ((rv = writev(osfd, osiov, iov_size)) == -1) {
         err = _MD_ERRNO();
         if ((err == EAGAIN) || (err == EWOULDBLOCK))    {
             if (fd->secret->nonblocking) {
                 break;
             }
             if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))<0)
                 goto done;
 
--- a/nsprpub/pr/src/md/os2/Makefile.in
+++ b/nsprpub/pr/src/md/os2/Makefile.in
@@ -57,23 +57,17 @@ CSRCS = \
     os2cv.c \
     os2sock.c \
     os2_errors.c \
     os2poll.c \
     os2rng.c \
     $(NULL)
 endif
 
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-ASFILES = os2vacpp.asm
-endif
-
-ifeq ($(MOZ_OS2_TOOLS),EMX)
 ASFILES = os2emx.s os2vaclegacy.s
-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/os2/objs.mk
+++ b/nsprpub/pr/src/md/os2/objs.mk
@@ -47,19 +47,13 @@ CSRCS = \
 	os2misc.c    \
 	os2inrval.c  \
 	os2sem.c     \
 	os2_errors.c \
 	os2poll.c    \
 	os2rng.c     \
 	$(NULL)
 
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-ASFILES = os2vacpp.asm
-endif
-
-ifeq ($(MOZ_OS2_TOOLS),EMX)
 ASFILES = os2emx.s os2vaclegacy.s
-endif
 
 OBJS += $(addprefix md/os2/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)))  \
 	$(addprefix md/os2/$(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
 
--- a/nsprpub/pr/src/md/os2/os2_errors.c
+++ b/nsprpub/pr/src/md/os2/os2_errors.c
@@ -873,17 +873,16 @@ void _MD_os2_map_shutdown_error(PRInt32 
 			PR_SetError(PR_NOT_CONNECTED_ERROR, err);
 			break;
 		default:
 			PR_SetError(PR_UNKNOWN_ERROR, err);
 			break;
 	}
 }
 
-#ifndef XP_OS2_VACPP
 void _MD_os2_map_socketpair_error(PRInt32 err)
 {
   switch (err) {
     case ENOMEM:
       PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
       break;
     case EAFNOSUPPORT:
       PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
@@ -897,17 +896,16 @@ void _MD_os2_map_socketpair_error(PRInt3
     case EPROTOTYPE:
       PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
       break;
     default:
       _MD_os2_map_default_error(err);
       return;
   }
 }
-#endif
 
 void _MD_os2_map_getsockname_error(PRInt32 err)
 {
 	switch (err) {
 		case EBADF:
 			PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err);
 			break;
 		case ENOTSOCK:
--- a/nsprpub/pr/src/md/os2/os2cv.c
+++ b/nsprpub/pr/src/md/os2/os2cv.c
@@ -46,52 +46,16 @@
  *  or PR_NotifyAllCondVar is called, the condition notifies are simply
  *  recorded in the _MDLock structure.  We defer the condition notifies
  *  until right after we unlock the lock.  This way the awakened threads
  *  have a better chance to reaquire the lock.
  */
  
 #include "primpl.h"
 
-#ifdef USE_RAMSEM
-ULONG _Far16 _Pascal Dos16GetInfoSeg(PSEL pselGlobal, PSEL pselLocal);
-
-#ifdef XP_OS2_EMX
-typedef unsigned short BOOL16;
-#endif
-
-typedef struct _LINFOSEG
-{
-    USHORT  pidCurrent;
-    USHORT  pidParent;
-    USHORT  prtyCurrent;
-    USHORT  tidCurrent;
-    USHORT  sgCurrent;
-    UCHAR   rfProcStatus;
-    UCHAR   dummy1;
-    BOOL16  fForeground;
-    UCHAR   typProcess;
-    UCHAR   dummy2;
-    SEL     selEnvironment;
-    USHORT  offCmdLine;
-    USHORT  cbDataSegment;
-    USHORT  cbStack;
-    USHORT  cbHeap;
-    USHORT  hmod;
-    SEL     selDS;
-    SEL     selPack;
-    SEL     selPackShr;
-    SEL     selPackPck;
-    ULONG   ulReserved;
-} LINFOSEG;
-typedef LINFOSEG FAR *PLINFOSEG;
-
-PLINFOSEG plisCurrent = NULL;
-#endif
-
 /*
  * AddThreadToCVWaitQueueInternal --
  *
  * Add the thread to the end of the condition variable's wait queue.
  * The CV's lock must be locked when this function is called.
  */
 
 static void
@@ -197,21 +161,17 @@ md_UnlockAndPostNotifies(
         notified = notified->link;
     } while (NULL != notified);
 
     if (waitThred) {
         AddThreadToCVWaitQueueInternal(waitThred, waitCV);
     }
 
     /* Release the lock before notifying */
-#ifdef USE_RAMSEM
-      SemReleasex86(&lock->mutex, 0);
-#else
-      DosReleaseMutexSem(lock->mutex);
-#endif
+    DosReleaseMutexSem(lock->mutex);
 
     notified = &post;  /* this is where we start */
     do {
         for (index = 0; index < notified->length; ++index) {
             PRThread *thred;
             PRThread *next;
 
             thred = notified->cv[index].notifyHead;
@@ -308,34 +268,26 @@ void
 
     /*
      * If we have pending notifies, post them now.
      */
     if (0 != lock->notified.length) {
         md_UnlockAndPostNotifies(lock, thred, cv);
     } else {
         AddThreadToCVWaitQueueInternal(thred, cv);
-#ifdef USE_RAMSEM
-        SemReleasex86( &lock->mutex, 0 );
-#else
         DosReleaseMutexSem(lock->mutex); 
-#endif
     }
 
     /* Wait for notification or timeout; don't really care which */
     rv = DosWaitEventSem(thred->md.blocked_sema, msecs);
     if (rv == NO_ERROR) {
         DosResetEventSem(thred->md.blocked_sema, &count);
     }
 
-#ifdef USE_RAMSEM
-    SemRequest486(&(lock->mutex), -1);
-#else
     DosRequestMutexSem((lock->mutex), SEM_INDEFINITE_WAIT);
-#endif
 
     PR_ASSERT(rv == NO_ERROR || rv == ERROR_TIMEOUT);
 
     if(rv == ERROR_TIMEOUT)
     {
        if (thred->md.inCVWaitQueue) {
            PR_ASSERT((cv->waitTail != NULL && cv->waitHead != NULL)
                    || (cv->waitTail == NULL && cv->waitHead == NULL));
@@ -382,51 +334,20 @@ void
 {
     md_PostNotifyToCvar(cv, lock, PR_FALSE);
     return;
 }
 
 PRStatus
 _PR_MD_NEW_LOCK(_MDLock *lock)
 {
-#ifdef USE_RAMSEM
-    // It's better if this API traps when pCriticalSect is not a valid
-    // pointer, because we can't return an error code and if we just return
-    // the API caller will have nasty bugs that are hard to find.
-   
-    PRAMSEM pramsem = (PRAMSEM)(&(lock->mutex));
-    /* First time, set up addresses of processor specific functions
-     */
-    if (plisCurrent == NULL)
-    {
-        SEL selGlobal = 0, selLocal = 0;
-   
-        /* Convert 16 bit global information segment to 32 bit address
-         * by performing CRMA on the 16 bit address: "shift" operation
-         * to convert sel to flat, "and" operation to mask the address
-         * to 32-bit
-         */
-        Dos16GetInfoSeg(&selGlobal, &selLocal);
-        plisCurrent = (PLINFOSEG)(((ULONG)selLocal << 13) &
-                      (ULONG)0x1fff0000);
-   
-    }
-   
-    memset(pramsem, 0, sizeof(pramsem));
-    DosCreateEventSem(0, &pramsem->hevSem, DC_SEM_SHARED, 0);
-   
-    lock->notified.length=0;
-    lock->notified.link=NULL;
-    return PR_SUCCESS;
-#else
     DosCreateMutexSem(0, &(lock->mutex), 0, 0);
     (lock)->notified.length=0;
     (lock)->notified.link=NULL;
     return PR_SUCCESS;
-#endif
 }
 
 void
 _PR_MD_NOTIFYALL_CV(_MDCVar *cv, _MDLock *lock)
 {
     md_PostNotifyToCvar(cv, lock, PR_TRUE);
     return;
 }
--- a/nsprpub/pr/src/md/os2/os2io.c
+++ b/nsprpub/pr/src/md/os2/os2io.c
@@ -30,54 +30,30 @@
  * 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 Original Code has been modified by IBM Corporation.
- * Modifications made by IBM described herein are
- * Copyright (c) International Business Machines
- * Corporation, 2000
- *
- * Modifications to Mozilla code or documentation
- * identified per MPL Section 3.3
- *
- * Date             Modified by     Description of modification
- * 03/23/2000       IBM Corp.       Changed write() to DosWrite(). EMX i/o
- *                                  calls cannot be intermixed with DosXXX
- *                                  calls since EMX remaps file/socket
- *                                  handles.
- * 04/27/2000       IBM Corp.       Changed open file to be more like NT and
- *                                  better handle PR_TRUNCATE | PR_CREATE_FILE
- *                                  and also fixed _PR_MD_SET_FD_INHERITABLE
- */
-
 /* OS2 IO module
  *
  * Assumes synchronous I/O.
  *
  */
 
 #include "primpl.h"
 #include "prio.h"
 #include <ctype.h>
 #include <string.h>
-#ifdef XP_OS2_VACPP
-#include <direct.h>
-#else
 #include <limits.h>
 #include <dirent.h>
 #include <fcntl.h>
 #include <io.h>
-#endif
 
 struct _MDLock               _pr_ioq_lock;
 
 static PRBool isWSEB = PR_FALSE; /* whether we are using an OS/2 kernel that supports large files */
 
 typedef APIRET (*DosOpenLType)(PSZ pszFileName, PHFILE pHf, PULONG pulAction,
                             LONGLONG cbFile, ULONG ulAttribute,
                             ULONG fsOpenFlags, ULONG fsOpenMode,
--- a/nsprpub/pr/src/md/os2/os2poll.c
+++ b/nsprpub/pr/src/md/os2/os2poll.c
@@ -34,19 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * This file implements _PR_MD_PR_POLL for OS/2.
  */
 
-#ifdef XP_OS2_EMX
- #include <sys/time.h> /* For timeval. */
-#endif
+#include <sys/time.h> /* For timeval. */
 
 #include "primpl.h"
 
 #ifndef BSD_SELECT
 /* Utility functions called when using OS/2 select */
 
 PRBool IsSocketSet( PRInt32 osfd, int* socks, int start, int count )
 {
--- a/nsprpub/pr/src/md/os2/os2sock.c
+++ b/nsprpub/pr/src/md/os2/os2sock.c
@@ -43,32 +43,22 @@
 /*Note from DSR111297 - it should be noted that there are two flavors of select() on OS/2    */
 /*There is standard BSD (which is kind of slow) and a new flavor of select() that takes      */
 /*an integer list of sockets, the number of read sockets, write sockets, except sockets, and */
 /*a millisecond count for timeout. In the interest of performance I have choosen the OS/2    */
 /*specific version of select(). See OS/2 TCP/IP Programmer's Toolkit for more info.          */ 
 
 #include "primpl.h"
 
-#ifdef XP_OS2_EMX
- #include <sys/time.h> /* For timeval. */
-#endif
+#include <sys/time.h> /* For timeval. */
 
 #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
 #define READ_FD   1
 #define WRITE_FD  2
 
-#ifdef XP_OS2_VACPP
-#define _OS2_WRITEV writev
-#define _OS2_IOCTL ioctl
-#else
-#define _OS2_WRITEV so_writev
-#define _OS2_IOCTL so_ioctl
-#endif
-
 /* --- SOCKET IO --------------------------------------------------------- */
 
 
 PRInt32
 _PR_MD_SOCKET(int domain, int type, int flags)
 {
     PRInt32 osfd, err;
 
@@ -100,17 +90,17 @@ PRInt32
     return rv;
 }
 
 PRInt32
 _MD_SocketAvailable(PRFileDesc *fd)
 {
     PRInt32 result;
 
-    if (_OS2_IOCTL(fd->secret->md.osfd, FIONREAD, (char *) &result, sizeof(result)) < 0) {
+    if (so_ioctl(fd->secret->md.osfd, FIONREAD, (char *) &result, sizeof(result)) < 0) {
         PR_SetError(PR_BAD_DESCRIPTOR_ERROR, sock_errno());
         return -1;
     }
     return result;
 }
 
 static PRInt32
 socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
@@ -528,31 +518,45 @@ done:
 PRInt32
 _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size,
               PRIntervalTime timeout)
 {
     PRInt32 rv, err;
     PRThread *me = _PR_MD_CURRENT_THREAD();
     PRInt32 index, amount = 0;
     PRInt32 osfd = fd->secret->md.osfd;
+    struct iovec osiov[PR_MAX_IOVECTOR_SIZE];
+
+    /* Ensured by PR_Writev */
+    PR_ASSERT(iov_size <= PR_MAX_IOVECTOR_SIZE);
+
+    /*
+     * We can't pass iov to so_writev because PRIOVec and struct iovec
+     * may not be binary compatible.  Make osiov a copy of iov and
+     * pass osiov to so_writev .
+     */
+    for (index = 0; index < iov_size; index++) {
+        osiov[index].iov_base = iov[index].iov_base;
+        osiov[index].iov_len = iov[index].iov_len;
+    }
 
      /*
       * Calculate the total number of bytes to be sent; needed for
       * optimization later.
       * We could avoid this if this number was passed in; but it is
       * probably not a big deal because iov_size is usually small (less than
       * 3)
       */
     if (!fd->secret->nonblocking) {
         for (index=0; index<iov_size; index++) {
             amount += iov[index].iov_len;
         }
     }
 
-    while ((rv = _OS2_WRITEV(osfd, (const struct iovec*)iov, iov_size)) == -1) {
+    while ((rv = so_writev(osfd, osiov, iov_size)) == -1) {
         err = sock_errno();
         if ((err == EWOULDBLOCK))    {
             if (fd->secret->nonblocking) {
                 break;
             }
             if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))<0)
                 goto done;
         } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))){
@@ -587,30 +591,28 @@ PRInt32
     PRInt32 rv;
 
     rv = shutdown(fd->secret->md.osfd, how);
     if (rv < 0)
         _PR_MD_MAP_SHUTDOWN_ERROR(sock_errno());
     return rv;
 }
 
-#ifndef XP_OS2_VACPP
 PRInt32
 _PR_MD_SOCKETPAIR(int af, int type, int flags, PRInt32 *osfd)
 {
     PRInt32 rv, err;
 
     rv = socketpair(af, type, flags, osfd);
     if (rv < 0) {
         err = _MD_ERRNO();
         _PR_MD_MAP_SOCKETPAIR_ERROR(err);
     }
     return rv;
 }
-#endif
 
 PRStatus
 _PR_MD_GETSOCKNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen)
 {
     PRInt32 rv, err;
 
     rv = getsockname(fd->secret->md.osfd,
                      (struct sockaddr *) addr, (int *)addrlen);
@@ -670,15 +672,15 @@ void
     PRInt32 err;
     PRUint32  one = 1;
     
     if (osfd <= 2) {
         /* Don't mess around with stdin, stdout or stderr */
         return;
     }
 
-    err = _OS2_IOCTL( osfd, FIONBIO, (char *) &one, sizeof(one));
+    err = so_ioctl( osfd, FIONBIO, (char *) &one, sizeof(one));
     if ( err != 0 )
     {
         err = sock_errno();
         _PR_MD_MAP_SOCKET_ERROR(err);
     }
 }
--- a/nsprpub/pr/src/md/os2/os2thred.c
+++ b/nsprpub/pr/src/md/os2/os2thred.c
@@ -32,25 +32,17 @@
  * 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 <process.h>  /* for _beginthread() */
-
-#ifdef XP_OS2_VACPP
-#include <time.h>     /* for _tzset() */
-#endif
-
-#ifdef XP_OS2_EMX
 #include <signal.h>
-#endif
-
 #include <float.h>
 
 /* --- globals ------------------------------------------------ */
 _NSPR_TLS*        pThreadLocalStorage = 0;
 _PRInterruptTable             _pr_interruptTable[] = { { 0 } };
 APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
 
 void
@@ -70,20 +62,16 @@ void
 void
 _PR_MD_EARLY_INIT()
 {
    HMODULE hmod;
 
    if (DosLoadModule(NULL, 0, "DOSCALL1", &hmod) == 0)
        DosQueryProcAddr(hmod, 877, "DOSQUERYTHREADCONTEXT",
                         (PFN *)&QueryThreadContext);
-
-#ifdef XP_OS2_VACPP
-   _tzset();
-#endif
 }
 
 static void
 _pr_SetThreadMDHandle(PRThread *thread)
 {
    PTIB ptib;
    PPIB ppib;
    PRUword rc;
@@ -218,28 +206,20 @@ PRStatus
                   PRThreadPriority priority, 
                   PRThreadScope scope, 
                   PRThreadState state, 
                   PRUint32 stackSize)
 {
     PARAMSTORE* params = PR_Malloc(sizeof(PARAMSTORE));
     params->start = start;
     params->thread = thread;
-#ifdef XP_OS2_VACPP /* No exception handler for VACPP */
-    thread->md.handle = thread->id = (TID) _beginthread(
-                    (void(* _Optlink)(void*))start,
-                    NULL, 
-                    thread->stack->stackSize,
-                    thread);
-#else
     thread->md.handle = thread->id = (TID) _beginthread(ExcpStartFunc,
                                                         NULL, 
                                                         thread->stack->stackSize,
                                                         params);
-#endif
     if(thread->md.handle == -1) {
         return PR_FAILURE;
     }
 
     /*
      * On OS/2, a thread is created with a thread priority of
      * THREAD_PRIORITY_NORMAL
      */
deleted file mode 100644
--- a/nsprpub/pr/src/md/os2/os2vacpp.asm
+++ /dev/null
@@ -1,266 +0,0 @@
-; -*- Mode: asm; tab-width: 8; c-basic-offset: 4 -*-
-
-; ***** 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
-; IBM Corporation.
-; Portions created by the Initial Developer are Copyright (C) 2001
-; 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 *****
-
-; Windows uses inline assembly for their atomic functions, so we have
-; created an assembly file for VACPP on OS/2.
-;
-; This assembly file also contains an implementation of RAM semaphores.
-;
-; Notes:
-;   The ulTIDPID element of the RAMSEM structure is overloaded in the 386
-;   implementation to hold the TID:PID in the lower 31 bits and the lock
-;   bit in the high bit
-
-        page ,132
-
-        .486P
-        ASSUME  CS:FLAT,  DS:FLAT,  SS:FLAT,  ES:FLAT,  FS:FLAT
-
-        EXTRN   Dos32PostEventSem:PROC
-        EXTRN   Dos32WaitEventSem:PROC
-        EXTRN   Dos32ResetEventSem:PROC
-
-ramsem  STRUC
-        ramsem_ulTIDPID         DD      ?
-        ramsem_hevSem           DD      ?
-        ramsem_cLocks           DD      ?
-        ramsem_cWaiting         DW      ?
-        ramsem_cPosts           DW      ?
-ramsem  ENDS
-
-ERROR_SEM_TIMEOUT               equ     121
-ERROR_NOT_OWNER                 equ     288
-SEM_RELEASE_UNOWNED             equ     1
-SEM_RELEASE_ALL                 equ     2
-TS_LOCKBIT                      equ     31
-
-
-DATA    SEGMENT DWORD USE32 PUBLIC 'DATA'
-
-        EXTRN   plisCurrent:DWORD
-
-DATA    ENDS
-
-CODE32  SEGMENT USE32 PUBLIC 'CODE'
-
-        PUBLIC  SemRequest486
-        PUBLIC  SemReleasex86
-
-        PUBLIC  _PR_MD_ATOMIC_SET
-        PUBLIC  _PR_MD_ATOMIC_ADD
-        PUBLIC  _PR_MD_ATOMIC_INCREMENT
-        PUBLIC  _PR_MD_ATOMIC_DECREMENT
-
-;;;---------------------------------------------------------------------------
-;;; APIRET _Optlink SemRequest(PRAMSEM pramsem, ULONG ulTimeout);
-;;;
-;;; Registers:
-;;;   EAX - packed TID:PID word
-;;;   ECX - address of RAMSEM structure
-;;;   EDX - length of timeout in milli-seconds
-;;;---------------------------------------------------------------------------
-
-        ALIGN   10H
-SemRequest486     PROC
-        push    ebx                                  ; Save ebx (volatile)
-        mov     ecx, eax                             ; PRAMSEM must be in ecx,
-                                                     ; not eax, for cmpxchg
-
-        mov     ebx, dword ptr [plisCurrent]
-        mov     eax, dword ptr [ebx+4]               ; Place thread id in high
-                                                     ; word, process id in low
-        mov     ax,  word ptr [ebx]                  ; word
-        mov     ebx,eax
-
-req486_test:
-        xor     eax,eax
-        cmp     (ramsem PTR [ecx]).ramsem_ulTIDPID, ebx ; If we own the sem, just
-        jz short req486_inc_exit                      ; increment the use count
-
-        lock inc     (ramsem PTR [ecx]).ramsem_cWaiting ; inc waiting flag
-
-;       lock                                         ; Uncomment for SMP
-        DB      0F0h
-;       cmpxchg (ramsem PTR [ecx]).ramsem_ulTIDPID, ebx
-;         (byte 3 is the offset of ulProcessThread into the RAMSEM structure)
-        DB      00Fh
-        DB      0B1h
-        DB      019h
-        jnz short req486_sleep
-
-req486_inc_exit:
-   lock inc     (ramsem PTR [ecx]).ramsem_cLocks
-
-req486_exit:
-        pop     ebx                                  ; Restore ebx
-        ret
-
-req486_sleep:
-        push    ecx                                  ; Save ecx (volatile)
-        push    edx                                  ; Save edx (volatile)
-        push    edx                                  ; timeout
-        push    (ramsem PTR [ecx]).ramsem_hevSem
-        call    Dos32WaitEventSem
-        add     esp, 8
-        pop     edx                                  ; restore edx
-        pop     ecx                                  ; restore ecx
-        or      eax, eax
-        jne     req486_exit                          ; Exit, if error
-
-        push    ecx                                  ; Save ecx (volatile)
-        push    edx                                  ; Save edx (volatile)
-        sub     esp, 4                               ; Use stack space for
-        push    esp                                  ;  dummy pulPostCt
-        push    (ramsem PTR [ecx]).ramsem_hevSem
-        call    Dos32ResetEventSem
-        add     esp, 12
-        pop     edx                                  ; restore edx
-        pop     ecx                                  ; restore ecx
-        jmp     req486_test                          ; Retry the semaphore
-
-SemRequest486     ENDP
-
-;;;---------------------------------------------------------------------
-;;; APIRET _Optlink SemReleasex86(PRAMSEM pramsem, ULONG flFlags);
-;;;
-;;; Registers:
-;;;   EAX - address of RAMSEM structure
-;;;   ECX - temporary variable
-;;;   EDX - flags
-;;;---------------------------------------------------------------------
-
-        ALIGN   10H
-SemReleasex86     PROC
-        test    edx, SEM_RELEASE_UNOWNED             ; If set, don't bother
-        jnz short rel_ownerok                        ; getting/checking PID/TID
-
-        push    ebx                                  ; Save ebx (volatile)
-        mov     ebx, dword ptr [plisCurrent]
-        mov     ecx, dword ptr [ebx+4]               ; Place thread id in high
-                                                     ; word, process id in low
-        mov     cx,  word ptr [ebx]                  ; word
-        pop     ebx                                  ; Restore ebx
-
-        sub     ecx, (ramsem PTR [eax]).ramsem_ulTIDPID ; This thread the owner?
-        shl     ecx,1                                ; Don't compare top bit
-        jnz short rel_notowner
-
-rel_ownerok:
-        test    edx, SEM_RELEASE_ALL
-        jnz short rel_clear
-
-   lock dec     (ramsem PTR [eax]).ramsem_cLocks
-        jnz short rel_exit
-
-rel_disown:
-        mov     (ramsem PTR [eax]).ramsem_ulTIDPID, 0
-
-   lock inc     (ramsem PTR [eax]).ramsem_cPosts
-        mov     cx, (ramsem PTR [eax]).ramsem_cWaiting
-        cmp     (ramsem PTR [eax]).ramsem_cPosts, cx
-        jne short rel_post
-
-rel_exit:
-        xor     eax, eax
-        ret
-
-rel_clear:
-   lock mov     (ramsem PTR [eax]).ramsem_cLocks,0
-        jmp     rel_disown
-
-rel_notowner:
-        mov     eax, ERROR_NOT_OWNER
-        ret
-
-rel_post:
-        mov     (ramsem PTR [eax]).ramsem_cPosts, cx
-        push    (ramsem PTR [eax]).ramsem_hevSem
-        call    Dos32PostEventSem
-        add     esp,4
-        xor     eax,eax
-        ret
-SemReleasex86     ENDP
-
-;;;---------------------------------------------------------------------
-;;; PRInt32 _Optlink _PR_MD_ATOMIC_SET(PRInt32* val, PRInt32 newval)
-;;;---------------------------------------------------------------------
-        ALIGN   10H
-_PR_MD_ATOMIC_SET     proc
-        xchg    dword ptr [eax],edx
-        mov eax, edx;
-        ret
-_PR_MD_ATOMIC_SET     endp
-
-;;;---------------------------------------------------------------------
-;;; PRInt32 _Optlink _PR_MD_ATOMIC_ADD(PRInt32* ptr, PRInt32 val)
-;;;---------------------------------------------------------------------
-        ALIGN   10H
-_PR_MD_ATOMIC_ADD     proc
-        mov ecx, edx
-        lock xadd dword ptr [eax], edx
-        mov eax, edx
-        add eax, ecx
-        ret
-_PR_MD_ATOMIC_ADD     endp
-
-;;;---------------------------------------------------------------------
-;;; PRInt32 _Optlink _PR_MD_ATOMIC_INCREMENT(PRInt32* val)
-;;;---------------------------------------------------------------------
-        ALIGN   10H
-_PR_MD_ATOMIC_INCREMENT     proc
-        mov edx, 1
-        lock xadd dword ptr [eax], edx
-        mov eax, edx
-        inc eax
-        ret
-_PR_MD_ATOMIC_INCREMENT     endp
-
-;;;---------------------------------------------------------------------
-;;; PRInt32 _Optlink _PR_MD_ATOMIC_DECREMENT(PRInt32* val)
-;;;---------------------------------------------------------------------
-        ALIGN   10H
-_PR_MD_ATOMIC_DECREMENT     proc
-        mov edx, 0ffffffffh
-        lock xadd dword ptr [eax], edx
-        mov eax, edx
-        dec eax
-        ret
-_PR_MD_ATOMIC_DECREMENT     endp
-
-CODE32  ENDS
-END
--- a/nsprpub/pr/src/md/prosdep.c
+++ b/nsprpub/pr/src/md/prosdep.c
@@ -61,17 +61,17 @@ static void GetPageSize(void)
 {
 	PRInt32 pageSize;
 
     /* Get page size */
 #ifdef XP_UNIX
 #if defined SUNOS4 || defined BSDI || defined AIX \
         || defined LINUX || defined __GNU__ || defined __GLIBC__ \
         || defined FREEBSD || defined NETBSD || defined OPENBSD \
-        || defined DARWIN || defined NEXTSTEP
+        || defined DARWIN || defined NEXTSTEP || defined SYMBIAN
     _pr_pageSize = getpagesize();
 #elif defined(HPUX)
     /* I have no idea. Don't get me started. --Rob */
     _pr_pageSize = sysconf(_SC_PAGE_SIZE);
 #else
     _pr_pageSize = sysconf(_SC_PAGESIZE);
 #endif
 #endif /* XP_UNIX */
--- a/nsprpub/pr/src/md/unix/Makefile.in
+++ b/nsprpub/pr/src/md/unix/Makefile.in
@@ -64,17 +64,17 @@ endif
 
 CSRCS += $(PR_MD_CSRCS)
 ASFILES += $(PR_MD_ASFILES)
 
 TARGETS = $(OBJS)
 
 ifeq ($(OS_ARCH),SunOS)
 	ifneq ($(OS_RELEASE),4.1.3_U1)
-		ifeq ($(OS_TEST),sun4u)
+		ifeq ($(CPU_ARCH),sparc)
 		ifdef USE_64
 			ULTRASPARC_ASFILES = os_SunOS_sparcv9.s
 			ULTRASPARC_ASOBJS = $(addprefix $(OBJDIR)/,$(ULTRASPARC_ASFILES:.s=.$(OBJ_SUFFIX)))
 		else
 			LIBRARY_NAME = $(ULTRASPARC_LIBRARY)
 			LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
 			ULTRASPARC_ASFILES = os_SunOS_ultrasparc.s
 			ULTRASPARC_ASOBJS = $(addprefix $(OBJDIR)/,$(ULTRASPARC_ASFILES:.s=.$(OBJ_SUFFIX)))
@@ -92,17 +92,17 @@ INCLUDES = -I$(dist_includedir) -I$(tops
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
 ifeq ($(OS_ARCH),SunOS)
 ifneq ($(OS_RELEASE),4.1.3_U1)
-ifeq ($(OS_TEST),sun4u)
+ifeq ($(CPU_ARCH),sparc)
 
 ifdef USE_64
 $(ULTRASPARC_ASOBJS): $(ULTRASPARC_ASFILES)
 	/usr/ccs/bin/as -o $@ -K PIC -P -D_ASM -D__STDC__=0 -xarch=v9 $<
 else
 $(SHARED_LIBRARY): $(ULTRASPARC_ASOBJS)
 	$(LD) -G -z text -z endfiltee -o $@ $(ULTRASPARC_ASOBJS)
 	$(INSTALL) -m 444 $@ $(dist_libdir)/cpu/sparcv8plus
new file mode 100644
--- /dev/null
+++ b/nsprpub/pr/src/md/unix/os_Darwin.s
@@ -0,0 +1,45 @@
+# -*- 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) 2008
+# 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 *****
+
+#ifdef __i386__
+#include "os_Darwin_x86.s"
+#elif defined(__x86_64__)
+#include "os_Darwin_x86_64.s"
+#elif defined(__ppc__)
+#include "os_Darwin_ppc.s"
+#endif
new file mode 100644
--- /dev/null
+++ b/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s
@@ -0,0 +1,95 @@
+# -*- 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) 2004
+# 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 *****
+
+# PRInt32 __PR_Darwin_x86_64_AtomicIncrement(PRInt32 *val)
+#
+# Atomically increment the integer pointed to by 'val' and return
+# the result of the increment.
+#
+    .text
+    .globl __PR_Darwin_x86_64_AtomicIncrement
+    .align 4
+__PR_Darwin_x86_64_AtomicIncrement:
+    movl $1, %eax
+    lock
+    xaddl %eax, (%rdi)
+    incl %eax
+    ret
+
+# PRInt32 __PR_Darwin_x86_64_AtomicDecrement(PRInt32 *val)
+#
+# Atomically decrement the integer pointed to by 'val' and return
+# the result of the decrement.
+#
+    .text
+    .globl __PR_Darwin_x86_64_AtomicDecrement
+    .align 4
+__PR_Darwin_x86_64_AtomicDecrement:
+    movl $-1, %eax
+    lock
+    xaddl %eax, (%rdi)
+    decl %eax
+    ret
+
+# PRInt32 __PR_Darwin_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
+#
+# Atomically set the integer pointed to by 'val' to the new
+# value 'newval' and return the old value.
+#
+    .text
+    .globl __PR_Darwin_x86_64_AtomicSet
+    .align 4
+__PR_Darwin_x86_64_AtomicSet:
+    movl %esi, %eax
+    xchgl %eax, (%rdi)
+    ret
+
+# PRInt32 __PR_Darwin_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+#
+# Atomically add 'val' to the integer pointed to by 'ptr'
+# and return the result of the addition.
+#
+    .text
+    .globl __PR_Darwin_x86_64_AtomicAdd
+    .align 4
+__PR_Darwin_x86_64_AtomicAdd:
+    movl %esi, %eax
+    lock
+    xaddl %eax, (%rdi)
+    addl %esi, %eax
+    ret
deleted file mode 100644
--- a/nsprpub/pr/src/md/unix/os_SunOS.s
+++ /dev/null
@@ -1,71 +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 ***** */
-
-	.text
-
-/*
- * sol_getsp()
- *
- * Return the current sp (for debugging)
- */
-	.global sol_getsp
-sol_getsp:
-	retl
-   	mov     %sp, %o0
-
-
-/*
- * sol_curthread()
- *
- * Return a unique identifier for the currently active thread.
- */
-	.global sol_curthread
-sol_curthread:
-    retl
-    mov %g7, %o0
-                  
-
-	.global __MD_FlushRegisterWindows
-	.global _MD_FlushRegisterWindows
-
-__MD_FlushRegisterWindows:
-_MD_FlushRegisterWindows:
-
-	ta	3
-	ret
-	restore
-
--- a/nsprpub/pr/src/md/unix/solaris.c
+++ b/nsprpub/pr/src/md/unix/solaris.c
@@ -81,710 +81,16 @@ void _MD_EarlyInit(void)
 
 PRWord *_MD_HomeGCRegisters(PRThread *t, PRIntn isCurrent, PRIntn *np)
 {
 	*np = 0;
 	return NULL;
 }
 #endif /* _PR_PTHREADS */
 
-#if !defined(i386) && !defined(IS_64)
-#if defined(_PR_HAVE_ATOMIC_OPS)
-/* NOTE:
- * SPARC v9 (Ultras) do have an atomic test-and-set operation.  But
- * SPARC v8 doesn't.  We should detect in the init if we are running on
- * v8 or v9, and then use assembly where we can.
- *
- * This code uses the Solaris threads API.  It can be used in both the
- * pthreads and Solaris threads versions of nspr20 because "POSIX threads
- * and Solaris threads are fully compatible even within the same process",
- * to quote from pthread_create(3T).
- */
-
-#include <thread.h>
-#include <synch.h>
-
-static mutex_t _solaris_atomic = DEFAULTMUTEX;
-
-PRInt32
-_MD_AtomicIncrement(PRInt32 *val)
-{
-    PRInt32 rv;
-    if (mutex_lock(&_solaris_atomic) != 0)
-        PR_ASSERT(0);
-
-    rv = ++(*val);
-
-    if (mutex_unlock(&_solaris_atomic) != 0)\
-        PR_ASSERT(0);
-
-	return rv;
-}
-
-PRInt32
-_MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-{
-    PRInt32 rv;
-    if (mutex_lock(&_solaris_atomic) != 0)
-        PR_ASSERT(0);
-
-    rv = ((*ptr) += val);
-
-    if (mutex_unlock(&_solaris_atomic) != 0)\
-        PR_ASSERT(0);
-
-	return rv;
-}
-
-PRInt32
-_MD_AtomicDecrement(PRInt32 *val)
-{
-    PRInt32 rv;
-    if (mutex_lock(&_solaris_atomic) != 0)
-        PR_ASSERT(0);
-
-    rv = --(*val);
-
-    if (mutex_unlock(&_solaris_atomic) != 0)\
-        PR_ASSERT(0);
-
-	return rv;
-}
-
-PRInt32
-_MD_AtomicSet(PRInt32 *val, PRInt32 newval)
-{
-    PRInt32 rv;
-    if (mutex_lock(&_solaris_atomic) != 0)
-        PR_ASSERT(0);
-
-    rv = *val;
-    *val = newval;
-
-    if (mutex_unlock(&_solaris_atomic) != 0)\
-        PR_ASSERT(0);
-
-	return rv;
-}
-#endif  /* _PR_HAVE_ATOMIC_OPS */
-#endif  /* !defined(i386) */
-
-#if defined(_PR_GLOBAL_THREADS_ONLY)
-#include <signal.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <thread.h>
-
-#include <sys/lwp.h>
-#include <sys/procfs.h>
-#include <sys/syscall.h>
-extern int syscall();  /* not declared in sys/syscall.h */
-
-static sigset_t old_mask;	/* store away original gc thread sigmask */
-static PRIntn gcprio;		/* store away original gc thread priority */
-
-THREAD_KEY_T threadid_key;
-THREAD_KEY_T cpuid_key;
-THREAD_KEY_T last_thread_key;
-static sigset_t set, oldset;
-
-static void
-threadid_key_destructor(void *value)
-{
-    PRThread *me = (PRThread *)value;
-    PR_ASSERT(me != NULL);
-    /* the thread could be PRIMORDIAL (thus not ATTACHED) */
-    if (me->flags & _PR_ATTACHED) {
-        /*
-         * The Solaris thread library sets the thread specific
-         * data (the current thread) to NULL before invoking
-         * the destructor.  We need to restore it to prevent the
-         * _PR_MD_CURRENT_THREAD() call in _PRI_DetachThread()
-         * from attaching the thread again.
-         */
-        _PR_MD_SET_CURRENT_THREAD(me);
-        _PRI_DetachThread();
-    }
-}
-
-void _MD_EarlyInit(void)
-{
-    THR_KEYCREATE(&threadid_key, threadid_key_destructor);
-    THR_KEYCREATE(&cpuid_key, NULL);
-    THR_KEYCREATE(&last_thread_key, NULL);
-    sigemptyset(&set);
-    sigaddset(&set, SIGALRM);
-}
-
-PRStatus _MD_CreateThread(PRThread *thread, 
-					void (*start)(void *), 
-					PRThreadPriority priority,
-					PRThreadScope scope, 
-					PRThreadState state, 
-					PRUint32 stackSize) 
-{
-	PRInt32 flags;
-	
-    /* mask out SIGALRM for native thread creation */
-    thr_sigsetmask(SIG_BLOCK, &set, &oldset); 
-
-    /*
-     * Note that we create joinable threads with the THR_DETACHED
-     * flag.  The reasons why we don't use thr_join to implement
-     * PR_JoinThread are:
-     * - We use a termination condition variable in the PRThread
-     *   structure to implement PR_JoinThread across all classic
-     *   nspr implementation strategies.
-     * - The native threads may be recycled by NSPR to run other
-     *   new NSPR threads, so the native threads may not terminate
-     *   when the corresponding NSPR threads terminate.  
-     */
-    flags = THR_SUSPENDED|THR_DETACHED;
-    if (_PR_IS_GCABLE_THREAD(thread) || (thread->flags & _PR_BOUND_THREAD) ||
-    							(scope == PR_GLOBAL_BOUND_THREAD))
-		flags |= THR_BOUND;
-
-    if (thr_create(NULL, thread->stack->stackSize,
-                  (void *(*)(void *)) start, (void *) thread, 
-				  flags,
-                  &thread->md.handle)) {
-        thr_sigsetmask(SIG_SETMASK, &oldset, NULL); 
-        return PR_FAILURE;
-    }
-
-    /* When the thread starts running, then the lwpid is set to the right
-     * value. Until then we want to mark this as 'uninit' so that
-     * its register state is initialized properly for GC */
-
-    thread->md.lwpid = -1;
-    thr_sigsetmask(SIG_SETMASK, &oldset, NULL); 
-    _MD_NEW_SEM(&thread->md.waiter_sem, 0);
-
-    if ((scope == PR_GLOBAL_THREAD) || (scope == PR_GLOBAL_BOUND_THREAD)) {
-		thread->flags |= _PR_GLOBAL_SCOPE;
-    }
-
-    _MD_SET_PRIORITY(&(thread->md), priority);
-
-    /* Activate the thread */
-    if (thr_continue( thread->md.handle ) ) {
-	return PR_FAILURE;
-    }
-    return PR_SUCCESS;
-}
-
-void _MD_cleanup_thread(PRThread *thread)
-{
-    thread_t hdl;
-
-    hdl = thread->md.handle;
-
-    /* 
-    ** First, suspend the thread (unless it's the active one)
-    ** Because we suspend it first, we don't have to use LOCK_SCHEDULER to
-    ** prevent both of us modifying the thread structure at the same time.
-    */
-    if ( thread != _PR_MD_CURRENT_THREAD() ) {
-        thr_suspend(hdl);
-    }
-    PR_LOG(_pr_thread_lm, PR_LOG_MIN,
-            ("(0X%x)[DestroyThread]\n", thread));
-
-    _MD_DESTROY_SEM(&thread->md.waiter_sem);
-}
-
-void _MD_exit_thread(PRThread *thread)
-{
-    _MD_CLEAN_THREAD(thread);
-    _MD_SET_CURRENT_THREAD(NULL);
-}
-
-void _MD_SET_PRIORITY(_MDThread *md_thread,
-        PRThreadPriority newPri)
-{
-	PRIntn nativePri;
-
-	if (newPri < PR_PRIORITY_FIRST) {
-		newPri = PR_PRIORITY_FIRST;
-	} else if (newPri > PR_PRIORITY_LAST) {
-		newPri = PR_PRIORITY_LAST;
-	}
-	/* Solaris priorities are from 0 to 127 */
-	nativePri = newPri * 127 / PR_PRIORITY_LAST;
-	if(thr_setprio((thread_t)md_thread->handle, nativePri)) {
-		PR_LOG(_pr_thread_lm, PR_LOG_MIN,
-		   ("_PR_SetThreadPriority: can't set thread priority\n"));
-	}
-}
-
-void _MD_WAIT_CV(
-    struct _MDCVar *md_cv, struct _MDLock *md_lock, PRIntervalTime timeout)
-{
-    struct timespec tt;
-    PRUint32 msec;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
-
-	PR_ASSERT((!suspendAllOn) || (suspendAllThread != me));
-
-    if (PR_INTERVAL_NO_TIMEOUT == timeout) {
-        COND_WAIT(&md_cv->cv, &md_lock->lock);
-    } else {
-        msec = PR_IntervalToMilliseconds(timeout);
-
-        GETTIME(&tt);
-        tt.tv_sec += msec / PR_MSEC_PER_SEC;
-        tt.tv_nsec += (msec % PR_MSEC_PER_SEC) * PR_NSEC_PER_MSEC;
-        /* Check for nsec overflow - otherwise we'll get an EINVAL */
-        if (tt.tv_nsec >= PR_NSEC_PER_SEC) {
-            tt.tv_sec++;
-            tt.tv_nsec -= PR_NSEC_PER_SEC;
-        }
-        COND_TIMEDWAIT(&md_cv->cv, &md_lock->lock, &tt);
-    }
-}
-
-void _MD_lock(struct _MDLock *md_lock)
-{
-#ifdef DEBUG
-    /* This code was used for GC testing to make sure that we didn't attempt
-     * to grab any locks while threads are suspended.
-     */
-    PRLock *lock;
-    
-    if ((suspendAllOn) && (suspendAllThread == _PR_MD_CURRENT_THREAD())) {
-        lock = ((PRLock *) ((char*) (md_lock) - offsetof(PRLock,ilock)));
-	PR_ASSERT(lock->owner == NULL);
-        return;
-    }
-#endif /* DEBUG */
-
-    mutex_lock(&md_lock->lock);
-}
-
-PRThread *_pr_attached_thread_tls()
-{
-    PRThread *ret;
-
-    thr_getspecific(threadid_key, (void **)&ret);
-    return ret;
-}
-
-PRThread *_pr_current_thread_tls()
-{
-    PRThread *thread;
-
-    thread = _MD_GET_ATTACHED_THREAD();
-
-    if (NULL == thread) {
-        thread = _PRI_AttachThread(
-            PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL, 0);
-    }
-    PR_ASSERT(thread != NULL);
-
-    return thread;
-}
-
-PRStatus
-_MD_wait(PRThread *thread, PRIntervalTime ticks)
-{
-        _MD_WAIT_SEM(&thread->md.waiter_sem);
-        return PR_SUCCESS;
-}
-
-PRStatus
-_MD_WakeupWaiter(PRThread *thread)
-{
-	if (thread == NULL) {
-		return PR_SUCCESS;
-	}
-	_MD_POST_SEM(&thread->md.waiter_sem);
-	return PR_SUCCESS;
-}
-
-_PRCPU *_pr_current_cpu_tls()
-{
-    _PRCPU *ret;
-
-    thr_getspecific(cpuid_key, (void **)&ret);
-    return ret;
-}
-
-PRThread *_pr_last_thread_tls()
-{
-    PRThread *ret;
-
-    thr_getspecific(last_thread_key, (void **)&ret);
-    return ret;
-}
-
-_MDLock _pr_ioq_lock;
-
-void
-_MD_InitIO(void)
-{
-    _MD_NEW_LOCK(&_pr_ioq_lock);
-}
-
-PRStatus _MD_InitializeThread(PRThread *thread)
-{
-    if (!_PR_IS_NATIVE_THREAD(thread))
-        return PR_SUCCESS;
-    /* sol_curthread is an asm routine which grabs GR7; GR7 stores an internal
-     * thread structure ptr used by solaris.  We'll use this ptr later
-     * with suspend/resume to find which threads are running on LWPs.
-     */
-    thread->md.threadID = sol_curthread();
-		/* prime the sp; substract 4 so we don't hit the assert that
-		 * curr sp > base_stack
-		 */
-    thread->md.sp = (uint_t) thread->stack->allocBase - sizeof(long);
-    thread->md.lwpid = _lwp_self();
-    thread->md.handle = THR_SELF();
-
-	/* all threads on Solaris are global threads from NSPR's perspective
-	 * since all of them are mapped to Solaris threads.
-	 */
-    thread->flags |= _PR_GLOBAL_SCOPE;
- 
- 	/* For primordial/attached thread, we don't create an underlying native thread.
- 	 * So, _MD_CREATE_THREAD() does not get called.  We need to do initialization
- 	 * like allocating thread's synchronization variables and set the underlying
- 	 * native thread's priority.
- 	 */
-	if (thread->flags & (_PR_PRIMORDIAL | _PR_ATTACHED)) {
-	    _MD_NEW_SEM(&thread->md.waiter_sem, 0);
-	    _MD_SET_PRIORITY(&(thread->md), thread->priority);
-	}
-	return PR_SUCCESS;
-}
-
-/* Sleep for n milliseconds, n < 1000   */
-void solaris_msec_sleep(int n)
-{
-    struct timespec ts;
-
-    ts.tv_sec = 0;
-    ts.tv_nsec = 1000000*n;
-    if (syscall(SYS_nanosleep, &ts, 0, 0) < 0) {
-        PR_ASSERT(0);
-    }
-}      
-
-#define VALID_SP(sp, bottom, top)   \
-	(((uint_t)(sp)) > ((uint_t)(bottom)) && ((uint_t)(sp)) < ((uint_t)(top)))
-
-void solaris_record_regs(PRThread *t, prstatus_t *lwpstatus)
-{
-#ifdef sparc
-	long *regs = (long *)&t->md.context.uc_mcontext.gregs[0];
-
-	PR_ASSERT(_PR_IS_GCABLE_THREAD(t));
-	PR_ASSERT(t->md.threadID == lwpstatus->pr_reg[REG_G7]);
-
-	t->md.sp = lwpstatus->pr_reg[REG_SP];
-	PR_ASSERT(VALID_SP(t->md.sp, t->stack->stackBottom, t->stack->stackTop));
-
-	regs[0] = lwpstatus->pr_reg[R_G1];
-	regs[1] = lwpstatus->pr_reg[R_G2];
-	regs[2] = lwpstatus->pr_reg[R_G3];
-	regs[3] = lwpstatus->pr_reg[R_G4];
-	regs[4] = lwpstatus->pr_reg[R_O0];
-	regs[5] = lwpstatus->pr_reg[R_O1];
-	regs[6] = lwpstatus->pr_reg[R_O2];
-	regs[7] = lwpstatus->pr_reg[R_O3];
-	regs[8] = lwpstatus->pr_reg[R_O4];
-	regs[9] = lwpstatus->pr_reg[R_O5];
-	regs[10] = lwpstatus->pr_reg[R_O6];
-	regs[11] = lwpstatus->pr_reg[R_O7];
-#elif defined(i386)
-	/*
-	 * To be implemented and tested
-	 */
-	PR_ASSERT(0);
-	PR_ASSERT(t->md.threadID == lwpstatus->pr_reg[GS]);
-	t->md.sp = lwpstatus->pr_reg[UESP];
-#endif
-}   
-
-void solaris_preempt_off()
-{
-    sigset_t set;
- 
-    (void)sigfillset(&set);
-    syscall(SYS_sigprocmask, SIG_SETMASK, &set, &old_mask);
-}
-
-void solaris_preempt_on()
-{
-    syscall(SYS_sigprocmask, SIG_SETMASK, &old_mask, NULL);      
-}
-
-int solaris_open_main_proc_fd()
-{
-    char buf[30];
-    int fd;
-
-    /* Not locked, so must be created while threads coming up */
-    PR_snprintf(buf, sizeof(buf), "/proc/%ld", getpid());
-    if ( (fd = syscall(SYS_open, buf, O_RDONLY)) < 0) {
-        return -1;
-    }
-    return fd;
-}
-
-/* Return a file descriptor for the /proc entry corresponding to the
- * given lwp. 
- */
-int solaris_open_lwp(lwpid_t id, int lwp_main_proc_fd)
-{
-    int result;
-
-    if ( (result = syscall(SYS_ioctl, lwp_main_proc_fd, PIOCOPENLWP, &id)) <0)
-        return -1; /* exited??? */
-
-    return result;
-}
-void _MD_Begin_SuspendAll()
-{
-    solaris_preempt_off();
-
-    PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin_SuspendAll\n"));
-    /* run at highest prio so I cannot be preempted */
-    thr_getprio(thr_self(), &gcprio);
-    thr_setprio(thr_self(), 0x7fffffff); 
-    suspendAllOn = PR_TRUE;
-    suspendAllThread = _PR_MD_CURRENT_THREAD();
-}
-
-void _MD_End_SuspendAll()
-{
-}
-
-void _MD_End_ResumeAll()
-{
-    PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End_ResumeAll\n"));
-    thr_setprio(thr_self(), gcprio);
-    solaris_preempt_on();
-    suspendAllThread = NULL;
-    suspendAllOn = PR_FALSE;
-}
-
-void _MD_Suspend(PRThread *thr)
-{
-   int lwp_fd, result;
-   prstatus_t lwpstatus;
-   int lwp_main_proc_fd = 0;
-  
-   if (!_PR_IS_GCABLE_THREAD(thr) || !suspendAllOn){
-     /*XXX When the suspendAllOn is set, we will be trying to do lwp_suspend
-      * during that time we can't call any thread lib or libc calls. Hence
-      * make sure that no suspension is requested for Non gcable thread
-      * during suspendAllOn */
-      PR_ASSERT(!suspendAllOn);
-      thr_suspend(thr->md.handle);
-      return;
-   }
-
-    /* XXX Primordial thread can't be bound to an lwp, hence there is no
-     * way we can assume that we can get the lwp status for primordial
-     * thread reliably. Hence we skip this for primordial thread, hoping
-     * that the SP is saved during lock and cond. wait. 
-     * XXX - Again this is concern only for java interpreter, not for the
-     * server, 'cause primordial thread in the server does not do java work
-     */
-    if (thr->flags & _PR_PRIMORDIAL)
-      return;
-    
-    /* XXX Important Note: If the start function of a thread is not called,
-     * lwpid is -1. Then, skip this thread. This thread will get caught
-     * in PR_NativeRunThread before calling the start function, because
-     * we hold the pr_activeLock during suspend/resume */
-
-    /* if the thread is not started yet then don't do anything */
-    if (!suspendAllOn || thr->md.lwpid == -1)
-      return;
-
-    if (_lwp_suspend(thr->md.lwpid) < 0) { 
-       PR_ASSERT(0);
-       return;
-    }
-
-    if ( (lwp_main_proc_fd = solaris_open_main_proc_fd()) < 0) {
-        PR_ASSERT(0);
-        return;   /* XXXMB ARGH, we're hosed! */
-    }
-
-   if ( (lwp_fd = solaris_open_lwp(thr->md.lwpid, lwp_main_proc_fd)) < 0) {
-           PR_ASSERT(0);
-           close(lwp_main_proc_fd);
-	   return;
-   }
-   if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) {
-            /* Hopefully the thread just died... */
-           close(lwp_fd);
-           close(lwp_main_proc_fd);
-	   return;
-   }
-            while ( !(lwpstatus.pr_flags & PR_STOPPED) ) {
-                if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) {
-                    PR_ASSERT(0);  /* ARGH SOMETHING WRONG! */
-                    break;
-                }
-                solaris_msec_sleep(1);
-            }
-            solaris_record_regs(thr, &lwpstatus);
-            close(lwp_fd);
-   close(lwp_main_proc_fd);
-}
-
-#ifdef OLD_CODE
-
-void _MD_SuspendAll()
-{
-    /* On solaris there are threads, and there are LWPs. 
-     * Calling _PR_DoSingleThread would freeze all of the threads bound to LWPs
-     * but not necessarily stop all LWPs (for example if someone did
-     * an attachthread of a thread which was not bound to an LWP).
-     * So now go through all the LWPs for this process and freeze them.
-     *
-     * Note that if any thread which is capable of having the GC run on it must
-     * had better be a LWP with a single bound thread on it.  Otherwise, this 
-     * might not stop that thread from being run.
-     */
-    PRThread *current = _PR_MD_CURRENT_THREAD();
-    prstatus_t status, lwpstatus;
-    int result, index, lwp_fd;
-    lwpid_t me = _lwp_self();
-    int err;
-    int lwp_main_proc_fd;
-
-    solaris_preempt_off();
-
-    /* run at highest prio so I cannot be preempted */
-    thr_getprio(thr_self(), &gcprio);
-    thr_setprio(thr_self(), 0x7fffffff); 
-
-    current->md.sp = (uint_t)&me;	/* set my own stack pointer */
-
-    if ( (lwp_main_proc_fd = solaris_open_main_proc_fd()) < 0) {
-        PR_ASSERT(0);
-        solaris_preempt_on();
-        return;   /* XXXMB ARGH, we're hosed! */
-    }
-
-    if ( (result = syscall(SYS_ioctl, lwp_main_proc_fd, PIOCSTATUS, &status)) < 0) {
-        err = errno;
-        PR_ASSERT(0);
-        goto failure;   /* XXXMB ARGH, we're hosed! */
-    }
-
-    num_lwps = status.pr_nlwp;
-
-    if ( (all_lwps = (lwpid_t *)PR_MALLOC((num_lwps+1) * sizeof(lwpid_t)))==NULL) {
-        PR_ASSERT(0);
-        goto failure;   /* XXXMB ARGH, we're hosed! */
-    }
-           
-    if ( (result = syscall(SYS_ioctl, lwp_main_proc_fd, PIOCLWPIDS, all_lwps)) < 0) {
-        PR_ASSERT(0);
-        PR_DELETE(all_lwps);
-        goto failure;   /* XXXMB ARGH, we're hosed! */
-    }
-
-    for (index=0; index< num_lwps; index++) {
-        if (all_lwps[index] != me)  {
-            if (_lwp_suspend(all_lwps[index]) < 0) { 
-                /* could happen if lwp exited */
-                all_lwps[index] = me;	/* dummy it up */
-            }
-        }
-    }
-
-    /* Turns out that lwp_suspend is not a blocking call.
-     * Go through the list and make sure they are all stopped.
-     */
-    for (index=0; index< num_lwps; index++) {
-        if (all_lwps[index] != me)  {
-            if ( (lwp_fd = solaris_open_lwp(all_lwps[index], lwp_main_proc_fd)) < 0) {
-                PR_ASSERT(0);
-                PR_DELETE(all_lwps);
-                all_lwps = NULL;
-                goto failure;   /* XXXMB ARGH, we're hosed! */
-            }
-
-            if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) {
-                /* Hopefully the thread just died... */
-                close(lwp_fd);
-                continue;
-            }
-            while ( !(lwpstatus.pr_flags & PR_STOPPED) ) {
-                if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) {
-                    PR_ASSERT(0);  /* ARGH SOMETHING WRONG! */
-                    break;
-                }
-                solaris_msec_sleep(1);
-            }
-            solaris_record_regs(&lwpstatus);
-            close(lwp_fd);
-        }
-    }
-
-    close(lwp_main_proc_fd);
-
-    return;
-failure:
-    solaris_preempt_on();
-    thr_setprio(thr_self(), gcprio);
-    close(lwp_main_proc_fd);
-    return;
-}
-
-void _MD_ResumeAll()
-{
-    int i;
-    lwpid_t me = _lwp_self();
- 
-    for (i=0; i < num_lwps; i++) {
-        if (all_lwps[i] == me)
-            continue;
-        if ( _lwp_continue(all_lwps[i]) < 0) {
-            PR_ASSERT(0);  /* ARGH, we are hosed! */
-        }
-    }
-
-    /* restore priority and sigmask */
-    thr_setprio(thr_self(), gcprio);
-    solaris_preempt_on();
-    PR_DELETE(all_lwps);
-    all_lwps = NULL;
-}
-#endif /* OLD_CODE */
-
-#ifdef USE_SETJMP
-PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
-{
-    if (isCurrent) {
-		(void) setjmp(CONTEXT(t));
-    }
-    *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
-    return (PRWord *) CONTEXT(t);
-}
-#else
-PRWord *_MD_HomeGCRegisters(PRThread *t, PRIntn isCurrent, PRIntn *np)
-{
-    if (isCurrent) {
-		(void) getcontext(CONTEXT(t));
-    }
-    *np = NGREG;
-    return (PRWord*) &t->md.context.uc_mcontext.gregs[0];
-}
-#endif  /* USE_SETJMP */
-
-#else /* _PR_GLOBAL_THREADS_ONLY */
-
 #if defined(_PR_LOCAL_THREADS_ONLY)
 
 void _MD_EarlyInit(void)
 {
 }
 
 void _MD_SolarisInit()
 {
@@ -855,18 +161,16 @@ PRWord *_MD_HomeGCRegisters(PRThread *t,
     }
     *np = NGREG;
     return (PRWord*) &t->md.context.uc_mcontext.gregs[0];
 }
 #endif  /* USE_SETJMP */
 
 #endif  /* _PR_LOCAL_THREADS_ONLY */
 
-#endif /* _PR_GLOBAL_THREADS_ONLY */
-
 #ifndef _PR_PTHREADS
 #if defined(i386) && defined(SOLARIS2_4)
 /* 
  * Because clock_gettime() on Solaris/x86 2.4 always generates a
  * segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
  * which is implemented using gettimeofday().
  */
 
new file mode 100644
--- /dev/null
+++ b/nsprpub/pr/src/md/unix/symbian.c
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** 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"
+
+void _MD_EarlyInit(void)
+{
+}
+
+PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
+{
+    *np = 0;
+    return NULL;
+}
--- a/nsprpub/pr/src/md/unix/uxrng.c
+++ b/nsprpub/pr/src/md/unix/uxrng.c
@@ -134,17 +134,18 @@ GetHighResClock(void *buf, size_t maxbyt
 
 static size_t
 GetHighResClock(void *buf, size_t maxbytes)
 {
     return 0;
 }
 
 #elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
-    || defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD))
+    || defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD) \
+    || defined(SYMBIAN))
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
 static int      fdDevRandom;
 static PRCallOnceType coOpenDevRandom;
 
 static PRStatus OpenDevRandom( void )
--- a/nsprpub/pr/src/md/windows/ntio.c
+++ b/nsprpub/pr/src/md/windows/ntio.c
@@ -3648,17 +3648,20 @@ PRInt32 IsFileLocal(HANDLE hFile)
 
    if (!GetFileInformationByHandle(hFile, &Info))
       return -1;
 
    // look to see if the volume serial number has been cached.
    _MD_LOCK(&cachedVolumeLock);
    while(dwIndex <= dwLastCachedDrive)
       if (dwCachedVolumeSerialNumbers[dwIndex++] == Info.dwVolumeSerialNumber)
+      {
+         _MD_UNLOCK(&cachedVolumeLock);
          return _PR_LOCAL_FILE;
+      }
    _MD_UNLOCK(&cachedVolumeLock);
 
    // volume serial number not found in the cache.  Check removable files.
    // removable drives are noted as a bitmask.  If the bit associated with 
    // a specific drive is set, then we should query its volume serial number
    // as its possible it has changed.
    dwMask = dwRemoveableDrivesToCheck;
    dwIndex = 0;
--- a/nsprpub/pr/src/md/windows/w95io.c
+++ b/nsprpub/pr/src/md/windows/w95io.c
@@ -331,17 +331,16 @@ PRInt32
 }
 
 PRInt32
 _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len)
 {
     PROsfd f = fd->secret->md.osfd;
     PRInt32 bytes;
     int rv;
-    PRThread *me = _PR_MD_CURRENT_THREAD();
     
     rv = WriteFile((HANDLE)f,
             buf,
             len,
             &bytes,
             NULL );
             
     if (rv == 0) 
--- a/nsprpub/pr/src/misc/prnetdb.c
+++ b/nsprpub/pr/src/misc/prnetdb.c
@@ -695,21 +695,17 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByName(
             PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
             return rv;
         }
     }
 #endif
 
 	LOCK_DNS();
 
-#ifdef XP_OS2_VACPP
-	h = GETHOSTBYNAME((char *)name);
-#else
 	h = GETHOSTBYNAME(name);
-#endif
     
 	if (NULL == h)
 	{
 	    PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, _MD_GETHOST_ERRNO());
 	}
 	else
 	{
 		_PRIPAddrConversion conversion = _PRIPAddrNoConversion;
@@ -928,21 +924,17 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByNam
     }
     else
     {
         LOCK_DNS();
     	h = GETHOSTBYNAME(name);
     }
 #else /* _PR_INET6 */
     LOCK_DNS();
-#ifdef XP_OS2_VACPP
-    h = GETHOSTBYNAME((char *)name);
-#else
     h = GETHOSTBYNAME(name);
-#endif
 #endif /* _PR_INET6 */
     
 	if (NULL == h)
 	{
 #if defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME)
 	    PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, error_num);
 #elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYNAME)
     	if (_pr_ipv6_is_present())
@@ -1096,21 +1088,17 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
     }
 	else
     {
         LOCK_DNS();
 		h = GETHOSTBYADDR(addr, addrlen, af);
     }
 #else	/* _PR_HAVE_GETIPNODEBYADDR */
     LOCK_DNS();
-#ifdef XP_OS2_VACPP
-	h = GETHOSTBYADDR((char *)addr, addrlen, af);
-#else
 	h = GETHOSTBYADDR(addr, addrlen, af);
-#endif
 #endif /* _PR_HAVE_GETIPNODEBYADDR */
 	if (NULL == h)
 	{
 #if defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYADDR)
 		PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, error_num);
 #elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYADDR)
     	if (_pr_ipv6_is_present())
 	    	PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, error_num);
@@ -1180,21 +1168,17 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
  * This may seem like a silly thing to do, but the compiler SHOULD
  * complain if getprotobyname_r() is implemented on some system and
  * we're not using it. For sure these signatures are different than
  * any usable implementation.
  */
 
 static struct protoent *getprotobyname_r(const char* name)
 {
-#ifdef XP_OS2_VACPP
-	return getprotobyname((char *)name);
-#else
 	return getprotobyname(name);
-#endif
 } /* getprotobyname_r */
 
 static struct protoent *getprotobynumber_r(PRInt32 number)
 {
 	return getprotobynumber(number);
 } /* getprotobynumber_r */
 
 #endif /* !defined(_PR_HAVE_GETPROTO_R) */
@@ -1375,17 +1359,17 @@ PRUintn _PR_NetAddrSize(const PRNetAddr*
     if (AF_INET == addr->raw.family)
         addrsize = sizeof(addr->inet);
     else if (PR_AF_INET6 == addr->raw.family)
 #if defined(_PR_INET6)
         addrsize = sizeof(struct sockaddr_in6);
 #else
         addrsize = sizeof(addr->ipv6);
 #endif
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
     else if (AF_UNIX == addr->raw.family)
         addrsize = sizeof(addr->local);
 #endif
     else addrsize = 0;
 
     return addrsize;
 }  /* _PR_NetAddrSize */
 
@@ -2218,21 +2202,17 @@ static PRStatus pr_StringToNetAddrFB(con
         addr->raw.family = PR_AF_INET6;
         return PR_SUCCESS;
     }
     PR_ASSERT(0 == rv);
     /* clean up after the failed StringToV6Addr() call */
     memset(&addr->ipv6.ip, 0, sizeof(addr->ipv6.ip));
 
     addr->inet.family = AF_INET;
-#ifdef XP_OS2_VACPP
-    addr->inet.ip = inet_addr((char *)string);
-#else
     addr->inet.ip = inet_addr(string);
-#endif
     if ((PRUint32) -1 == addr->inet.ip)
     {
         /*
          * The string argument is a malformed address string.
          */
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
         status = PR_FAILURE;
     }
--- a/nsprpub/pr/src/misc/prsystem.c
+++ b/nsprpub/pr/src/misc/prsystem.c
@@ -254,17 +254,17 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProc
 #elif defined(HPUX)
     numCpus = mpctl( MPC_GETNUMSPUS, 0, 0 );
     if ( numCpus < 1 )  {
         numCpus = -1; /* set to -1 for return value on error */
         _PR_MD_MAP_DEFAULT_ERROR( _MD_ERRNO() );
     }
 #elif defined(IRIX)
     numCpus = sysconf( _SC_NPROC_ONLN );
-#elif defined(RISCOS)
+#elif defined(RISCOS) || defined(SYMBIAN)
     numCpus = 1;
 #elif defined(XP_UNIX)
     numCpus = sysconf( _SC_NPROCESSORS_ONLN );
 #else
 #error "An implementation is required"
 #endif
     return(numCpus);
 } /* end PR_GetNumberOfProcessors() */
--- a/nsprpub/pr/src/misc/prtime.c
+++ b/nsprpub/pr/src/misc/prtime.c
@@ -566,28 +566,28 @@ static struct tm *MT_safe_localtime(cons
      * that case, we also return a NULL pointer and the struct tm
      * object pointed to by 'result' is not modified.
      *
      * Watcom C/C++ 11.0 localtime() treats time_t as unsigned long
      * hence, does not recognize negative values of clock as pre-1/1/70.
      * We have to manually check (WIN16 only) for negative value of
      * clock and return NULL.
      *
-     * With negative values of clock, emx returns the struct tm for
+     * With negative values of clock, OS/2 returns the struct tm for
      * clock plus ULONG_MAX. So we also have to check for the invalid
      * structs returned for timezones west of Greenwich when clock == 0.
      */
     
 #if defined(XP_MAC)
     tmPtr = Maclocaltime(clock);
 #else
     tmPtr = localtime(clock);
 #endif
 
-#if defined(WIN16) || defined(XP_OS2_EMX)
+#if defined(WIN16) || defined(XP_OS2)
     if ( (PRInt32) *clock < 0 ||
          ( (PRInt32) *clock == 0 && tmPtr->tm_year != 70))
         result = NULL;
     else
         *result = *tmPtr;
 #else
     if (tmPtr) {
         *result = *tmPtr;
@@ -1709,17 +1709,17 @@ PR_FormatTime(char *buf, int buflen, con
 
 /*
  * On some platforms, for example SunOS 4, struct tm has two additional
  * fields: tm_zone and tm_gmtoff.
  */
 
 #if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS) \
         || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \
-        || defined(DARWIN)
+        || defined(DARWIN) || defined(SYMBIAN)
     a.tm_zone = NULL;
     a.tm_gmtoff = tm->tm_params.tp_gmt_offset + tm->tm_params.tp_dst_offset;
 #endif
 
     return strftime(buf, buflen, fmt, &a);
 }
 
 
--- a/nsprpub/pr/src/pthreads/ptio.c
+++ b/nsprpub/pr/src/pthreads/ptio.c
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* ***** 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/
  *
@@ -451,17 +451,17 @@ static void pt_poll_now_with_select(pt_C
 					FD_ZERO(&wr);
 					FD_SET(op->arg1.osfd, &wr);
 					wrp = &wr;
 				} else
 					wrp = NULL;
 
 				rv = select(op->arg1.osfd + 1, rdp, wrp, NULL, &tv);
 
-				if (self->state & PT_THREAD_ABORTED)
+				if (_PT_THREAD_INTERRUPTED(self))
 				{
 					self->state &= ~PT_THREAD_ABORTED;
 					op->result.code = -1;
 					op->syserrno = EINTR;
 					op->status = pt_continuation_done;
 					return;
 				}
 
@@ -512,17 +512,17 @@ static void pt_poll_now_with_select(pt_C
 				if (msecs > PT_DEFAULT_POLL_MSEC) {
 					wait_for_remaining = PR_FALSE;
 					msecs = PT_DEFAULT_POLL_MSEC;
 				}
 				tv.tv_sec = msecs/PR_MSEC_PER_SEC;
 				tv.tv_usec = (msecs % PR_MSEC_PER_SEC) * PR_USEC_PER_MSEC;
 				rv = select(op->arg1.osfd + 1, rdp, wrp, NULL, &tv);
 
-				if (self->state & PT_THREAD_ABORTED)
+				if (_PT_THREAD_INTERRUPTED(self))
 				{
 					self->state &= ~PT_THREAD_ABORTED;
 					op->result.code = -1;
 					op->syserrno = EINTR;
 					op->status = pt_continuation_done;
 					return;
 				}
 
@@ -593,17 +593,17 @@ static void pt_poll_now(pt_Continuation 
 				struct pollfd tmp_pfd;
 
 				tmp_pfd.revents = 0;
 				tmp_pfd.fd = op->arg1.osfd;
 				tmp_pfd.events = op->event;
 
 				rv = poll(&tmp_pfd, 1, msecs);
 				
-				if (self->state & PT_THREAD_ABORTED)
+				if (_PT_THREAD_INTERRUPTED(self))
 				{
 					self->state &= ~PT_THREAD_ABORTED;
 					op->result.code = -1;
 					op->syserrno = EINTR;
 					op->status = pt_continuation_done;
 					return;
 				}
 
@@ -651,17 +651,17 @@ static void pt_poll_now(pt_Continuation 
     			msecs = (PRInt32)PR_IntervalToMilliseconds(remaining);
 				if (msecs > PT_DEFAULT_POLL_MSEC)
 				{
 					wait_for_remaining = PR_FALSE;
 					msecs = PT_DEFAULT_POLL_MSEC;
 				}
 				rv = poll(&tmp_pfd, 1, msecs);
 				
-				if (self->state & PT_THREAD_ABORTED)
+				if (_PT_THREAD_INTERRUPTED(self))
 				{
 					self->state &= ~PT_THREAD_ABORTED;
 					op->result.code = -1;
 					op->syserrno = EINTR;
 					op->status = pt_continuation_done;
 					return;
 				}
 
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -806,17 +806,18 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphor
 
 #include <fcntl.h>
 #include <sys/sem.h>
 
 /*
  * From the semctl(2) man page in glibc 2.0
  */
 #if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
-    || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI)
+    || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI) \
+    || defined(SYMBIAN)
 /* union semun is defined by including <sys/sem.h> */
 #else
 /* according to X/OPEN we have to define it ourselves */
 union semun {
     int val;
     struct semid_ds *buf;
     unsigned short  *array;
 };
--- a/nsprpub/pr/tests/Makefile.in
+++ b/nsprpub/pr/tests/Makefile.in
@@ -231,22 +231,18 @@ else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
   ifdef PROFILE                                                                              
     LDOPTS += -PROFILE -MAP                                                                  
   endif # profile
 endif # NS_USE_GCC
 endif
 
 ifeq ($(OS_ARCH),OS2)
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-  LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
-else
-  EXTRA_LIBS = $(OS_LIBS)
-  LDOPTS = -Zomf -Zlinker /PM:VIO -Zlinker /ST:0x64000
-endif
+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).
 ifeq (,$(patsubst /%,,$(DIST)))
 # $(DIST) is already an absolute pathname.
 ABSOLUTE_LIB_DIR = $(dist_libdir)
@@ -327,23 +323,19 @@ ifeq ($(OS_ARCH), SunOS)
         else
             ifeq ($(USE_CPLUS), 1)
                 CC = CC
             endif
             LDOPTS += -R $(ABSOLUTE_LIB_DIR)
         endif
     endif
 
-    ifneq ($(LOCAL_THREADS_ONLY),1)
-        ifdef USE_PTHREADS
-            EXTRA_LIBS = -lpthread
-        else
-            EXTRA_LIBS = -lthread
-        endif
-    endif # LOCAL_THREADS_ONLY
+    ifdef USE_PTHREADS
+        EXTRA_LIBS = -lpthread
+    endif
 endif # SunOS
 
 ifeq ($(OS_ARCH), NEC)
     EXTRA_LIBS = $(OS_LIBS)
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
 # option for ld on other platforms.
     export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
@@ -489,21 +481,17 @@ 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 ($(MOZ_OS2_TOOLS),VACPP)
-	$(LD) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(OS_LIBS) $(EXTRA_LIBS)
-else
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@
-endif # OS/2
 endif # WINNT
 endif # AIX_PRE_4_2
 
 export:: $(TARGETS)
 clean::
 	rm -f $(TARGETS)
 
 # The following tests call BSD socket functions, so they need to link
--- a/nsprpub/pr/tests/README.TXT
+++ b/nsprpub/pr/tests/README.TXT
@@ -62,17 +62,17 @@ dbmalloc1.c
 
 dceemu.c
 	Tests special functions for DCE emulation.
 
 depend.c
 	Obsoltet. Tests early spec for library dependency.
 
 dlltest.c
-	Tests dynamic library fucntions. Used with dll/my.c
+	Tests dynamic library functions. Used with dll/my.c
 
 dtoa.c
 	Tests conversions of double to string.
 
 exit.c
 	Tests PR_ProcessExit() declared in prinit.h
 
 fileio.c
--- a/nsprpub/pr/tests/attach.c
+++ b/nsprpub/pr/tests/attach.c
@@ -327,23 +327,18 @@ int main(int argc, char **argv)
     if (debug_mode) PR_ASSERT(rv != -1);
 	else  if (rv != -1) {
 		failed_already=1;
 		goto exit_now;
 	}
 
 #elif defined(OS2)
 
-# ifdef __EMX__
     threadID = (TID) _beginthread((void *)threadStartFunc, NULL,
             32768, NULL); 
-# else
-    threadID = (TID) _beginthread((void(* _Optlink)(void*))threadStartFunc, NULL,
-            32768, NULL); 
-# endif
     if (threadID == -1) {
         fprintf(stderr, "thread creation failed: error code %d\n", errno);
         failed_already=1;
         goto exit_now;
     }
     rv = DosWaitThread(&threadID, DCWW_WAIT);
     if (debug_mode) {
         PR_ASSERT(rv == NO_ERROR);
--- a/nsprpub/pr/tests/foreign.c
+++ b/nsprpub/pr/tests/foreign.c
@@ -61,17 +61,17 @@
 #include "prtypes.h"
 #include "prprf.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 static enum {
-    thread_nspr, thread_pthread, thread_uithread, thread_sproc, thread_win32
+    thread_nspr, thread_pthread, thread_sproc, thread_win32
 } thread_provider;
 
 typedef void (*StartFn)(void*);
 typedef struct StartObject
 {
     StartFn start;
     void *arg;
 } StartObject;
@@ -92,28 +92,16 @@ static void *pthread_start(void *arg)
     StartFn start = ((StartObject*)arg)->start;
     void *data = ((StartObject*)arg)->arg;
     PR_Free(arg);
     start(data);
     return NULL;
 }  /* pthread_start */
 #endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
 
-#if defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
-#include <thread.h>
-static void *uithread_start(void *arg)
-{
-    StartFn start = ((StartObject*)arg)->start;
-    void *data = ((StartObject*)arg)->arg;
-    PR_Free(arg);
-    start(data);
-    return NULL;
-}  /* uithread_start */
-#endif /* defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY) */
-
 #if defined(IRIX) && !defined(_PR_PTHREADS)
 #include <sys/types.h>
 #include <sys/prctl.h>
 static void sproc_start(void *arg, PRSize size)
 {
     StartObject *so = (StartObject*)arg;
     StartFn start = so->start;
     void *data = so->arg;
@@ -177,39 +165,16 @@ static PRStatus CreateThread(StartFn sta
             return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
         }
 #else
         PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
         rv = PR_FAILURE;
         break;
 #endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
 
-    case thread_uithread:
-#if defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
-        {
-            int rv;
-            thread_t id;
-            long flags;
-            StartObject *start_object;
-            start_object = PR_NEW(StartObject);
-            PR_ASSERT(NULL != start_object);
-            start_object->start = start;
-            start_object->arg = arg;
-
-            flags = THR_DETACHED;
-
-            rv = thr_create(NULL, NULL, uithread_start, start_object, flags, &id);
-            return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
-        }
-#else
-        PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-        rv = PR_FAILURE;
-        break;
-#endif /* defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY) */
-
     case thread_sproc:
 #if defined(IRIX) && !defined(_PR_PTHREADS)
         {
             PRInt32 pid;
             StartObject *start_object;
             start_object = PR_NEW(StartObject);
             PR_ASSERT(NULL != start_object);
             start_object->start = start;
@@ -366,18 +331,16 @@ PRIntn main(PRIntn argc, char **argv)
 	PRInt32	thread_cnt = DEFAULT_THREAD_COUNT;
 	PLOptStatus os;
 	PLOptState *opt = PL_CreateOptState(argc, argv, "dt:");
 
 #if defined(WIN32)
 	thread_provider = thread_win32;
 #elif defined(_PR_PTHREADS)
 	thread_provider = thread_pthread;
-#elif defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
-	thread_provider = thread_uithread;
 #elif defined(IRIX)
 	thread_provider = thread_sproc;
 #else
     thread_provider = thread_nspr;
 #endif
 
 
 	while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
--- a/nsprpub/pr/tests/provider.c
+++ b/nsprpub/pr/tests/provider.c
@@ -125,17 +125,17 @@ typedef enum Verbosity
     TEST_LOG_WARNING,
     TEST_LOG_NOTICE,
     TEST_LOG_INFO,
     TEST_LOG_STATUS,
     TEST_LOG_VERBOSE
 } Verbosity;
 
 static enum {
-    thread_nspr, thread_pthread, thread_uithread, thread_sproc, thread_win32
+    thread_nspr, thread_pthread, thread_sproc, thread_win32
 } thread_provider;
 
 static PRInt32 domain = AF_INET;
 static PRInt32 protocol = 6;  /* TCP */
 static PRFileDesc *debug_out = NULL;
 static PRBool debug_mode = PR_FALSE;
 static PRBool pthread_stats = PR_FALSE;
 static Verbosity verbosity = TEST_LOG_ALWAYS;
@@ -654,30 +654,16 @@ static void *pthread_start(void *arg)
     StartFn start = so->start;
     void *data = so->arg;
     PR_Free(so);
     start(data);
     return NULL;
 }  /* pthread_start */
 #endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
 
-#if defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
-#include <thread.h>
-
-static void *uithread_start(void *arg)
-{
-    StartObject *so = (StartObject*)arg;
-    StartFn start = so->start;
-    void *data = so->arg;
-    PR_Free(so);
-    start(data);
-    return NULL;
-}  /* uithread_start */
-#endif /* defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY) */
-
 #if defined(IRIX) && !defined(_PR_PTHREADS)
 #include <sys/types.h>
 #include <sys/prctl.h>
 static void sproc_start(void *arg, PRSize size)
 {
     StartObject *so = (StartObject*)arg;
     StartFn start = so->start;
     void *data = so->arg;
@@ -708,21 +694,16 @@ static PRStatus JoinThread(PRThread *thr
     case thread_nspr:
         rv = PR_JoinThread(thread);
         break;
     case thread_pthread:
 #if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
         rv = PR_SUCCESS;
         break;
 #endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
-    case thread_uithread:
-#if defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
-        rv = PR_SUCCESS;
-        break;
-#endif /* defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY) */
     case thread_win32:
 #if defined(WIN32)
         rv = PR_SUCCESS;
         break;
 #endif
     default:
         rv = PR_FAILURE;
         break;
@@ -772,39 +753,16 @@ static PRStatus NewThread(
             return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
         }
 #else
         PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
         rv = PR_FAILURE;
 #endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
         break;
 
-    case thread_uithread:
-#if defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
-        {
-            int rv;
-            thread_t id;
-            long flags;
-            StartObject *start_object;
-            start_object = PR_NEW(StartObject);
-            PR_ASSERT(NULL != start_object);
-            start_object->start = start;
-            start_object->arg = arg;
-
-            flags = THR_DETACHED;
-
-            rv = thr_create(NULL, NULL, uithread_start, start_object, flags, &id);
-            return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
-        }
-#else
-        PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
-        rv = PR_FAILURE;
-#endif /* defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY) */
-        break;
-
     case thread_sproc:
 #if defined(IRIX) && !defined(_PR_PTHREADS)
         {
             PRInt32 pid;
             StartObject *start_object;
             start_object = PR_NEW(StartObject);
             PR_ASSERT(NULL != start_object);
             start_object->start = start;
@@ -1105,17 +1063,17 @@ static void Help(void)
     PR_fprintf(debug_out, "\t-a <n>       threads allowed in accept        (5)\n");
     PR_fprintf(debug_out, "\t-b <n>       backlock for listen              (5)\n");
     PR_fprintf(debug_out, "\t-c <threads> number of clients to create      (1)\n");
     PR_fprintf(debug_out, "\t-w <threads> minimal number of server threads (1)\n");
     PR_fprintf(debug_out, "\t-W <threads> maximum number of server threads (1)\n");
     PR_fprintf(debug_out, "\t-e <seconds> duration of the test in seconds  (10)\n");
     PR_fprintf(debug_out, "\t-s <string>  dsn name of server               (localhost)\n");
     PR_fprintf(debug_out, "\t-G           use GLOBAL threads               (LOCAL)\n");
-    PR_fprintf(debug_out, "\t-T <string>  thread provider ('n' | 'p' | 'u' | 'w')(n)\n");
+    PR_fprintf(debug_out, "\t-T <string>  thread provider ('n' | 'p' | 'w')(n)\n");
     PR_fprintf(debug_out, "\t-X           use XTP as transport             (TCP)\n");
     PR_fprintf(debug_out, "\t-6           Use IPv6                         (IPv4)\n");
     PR_fprintf(debug_out, "\t-v           verbosity (accumulative)         (0)\n");
     PR_fprintf(debug_out, "\t-p           pthread statistics               (FALSE)\n");
     PR_fprintf(debug_out, "\t-d           debug mode                       (FALSE)\n");
     PR_fprintf(debug_out, "\t-h           this message\n");
 }  /* Help */
 
@@ -1157,18 +1115,16 @@ PRIntn main(PRIntn argc, char** argv)
 
     PLOptStatus os;
     PLOptState *opt = PL_CreateOptState(argc, argv, "GX6b:a:c:w:W:e:s:T:vdhp");
 
 #if defined(WIN32)
 	thread_provider = thread_win32;
 #elif defined(_PR_PTHREADS)
 	thread_provider = thread_pthread;
-#elif defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
-	thread_provider = thread_uithread;
 #elif defined(IRIX)
 	thread_provider = thread_sproc;
 #else
     thread_provider = thread_nspr;
 #endif
 
     debug_out = PR_GetSpecialFD(PR_StandardError);
 
@@ -1190,17 +1146,16 @@ PRIntn main(PRIntn argc, char** argv)
             accepting = atoi(opt->value);
             break;
         case 'b':  /* the value for backlock */
             backlog = atoi(opt->value);
             break;
         case 'T':  /* the thread provider */
             if ('n' == *opt->value) thread_provider = thread_nspr;
             else if ('p' == *opt->value) thread_provider = thread_pthread;
-            else if ('u' == *opt->value) thread_provider = thread_uithread;
             else if ('w' == *opt->value) thread_provider = thread_win32;
             else {Help(); return 2; }
             break;
         case 'c':  /* number of client threads */
             clients = atoi(opt->value);
             break;
         case 'w':  /* minimum server worker threads */
             workersMin = atoi(opt->value);
@@ -1419,18 +1374,16 @@ PRIntn main(PRIntn argc, char** argv)
     TEST_LOG(
         cltsrv_log_file, TEST_LOG_ALWAYS, 
         ("main(0x%p): test complete\n", PR_GetCurrentThread()));
 
 	if (thread_provider == thread_win32)
 		thread_type = "\nWin32 Thread Statistics\n";
 	else if (thread_provider == thread_pthread)
 		thread_type = "\npthread Statistics\n";
-	else if (thread_provider == thread_uithread)
-		thread_type = "\nUnix International (UI) Thread Statistics\n";
 	else if (thread_provider == thread_sproc)
 		thread_type = "\nsproc Statistics\n";
     else {
 		PR_ASSERT(thread_provider == thread_nspr);
 		thread_type = "\nPRThread Statistics\nn";
 	}
 
     PT_FPrintStats(debug_out, thread_type);
--- a/nsprpub/pr/tests/prpoll.c
+++ b/nsprpub/pr/tests/prpoll.c
@@ -34,20 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifdef WIN32
 #include <windows.h>
 #endif
 
-#ifdef XP_OS2_VACPP
-#include <io.h>      /* for close() */
-#endif
-
 #ifdef XP_UNIX
 #include <unistd.h>  /* for close() */
 #endif
 
 #include "prinit.h"
 #include "prio.h"
 #include "prlog.h"
 #include "prprf.h"
new file mode 100644
--- /dev/null
+++ b/nsprpub/pr/tests/runtests.pl
@@ -0,0 +1,384 @@
+#!/usr/bin/perl
+#
+# ***** 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
+# Sun Microsystems, Inc.
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Christophe Ravel <christophe.ravel@sun.com>, Sun Microsystems
+#   Slavomir Katuscak <slavomir.katuscak@sun.com>, Sun Microsystems
+#
+# 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 *****
+
+use POSIX qw(:sys_wait_h);
+use POSIX qw(setsid);
+use FileHandle;
+
+# Constants
+$WINOS = "MSWin32";
+
+$osname = $^O;
+
+use Cwd;
+if ($osname =~ $WINOS) {
+    # Windows
+    require Win32::Process;
+    require Win32;
+}
+
+# Get environment variables.
+$output_file = $ENV{NSPR_TEST_LOGFILE};
+$timeout = $ENV{TEST_TIMEOUT};
+
+$timeout = 0 if (!defined($timeout));
+
+sub getTime {
+    ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
+
+    $year = 1900 + $yearOffset;
+
+    $theTime = sprintf("%04d-%02d-%02d %02d:%02d:%02d",$year,$month,$dayOfMonth,$hour,$minute,$second);
+    return $theTime;
+}
+
+sub open_log {
+
+    if (!defined($output_file)) {
+        print "No output file.\n";
+        # null device
+        if ($osname =~ $WINOS) {
+            $output_file = "nul";
+        } else {
+            $output_file = "/dev/null";
+        }
+    }
+    
+    # use STDOUT for OF (to print summary of test results)
+    open(OF, ">&STDOUT") or die "Can't reuse STDOUT for OF\n";
+    OF->autoflush;
+    # reassign STDOUT to $output_file (to print details of test results)
+    open(STDOUT, ">$output_file") or die "Can't open file $output_file for STDOUT\n";
+    STDOUT->autoflush;
+    # redirect STDERR to STDOUT
+    open(STDERR, ">&STDOUT") or die "Can't redirect STDERR to STDOUT\n";
+    STDERR->autoflush;
+    
+    # Print header test in summary
+    $now = getTime;
+    print OF "\nNSPR Test Results - tests\n";
+    print OF "\nBEGIN\t\t\t$now\n";
+    print OF "NSPR_TEST_LOGFILE\t$output_file\n";
+    print OF "TEST_TIMEOUT\t$timeout\n\n";
+    print OF "\nTest\t\t\tResult\n\n";
+}
+
+sub close_log {
+    # end of test marker in summary
+    $now = getTime;
+    print OF "END\t\t\t$now\n";
+
+    close(OF) or die "Can't close file OF\n";
+    close(STDERR) or die "Can't close STDERR\n";
+    close(STDOUT) or die "Can't close STDOUT\n";
+}
+
+sub print_begin {
+$lprog = shift;
+
+    # Summary output
+    print OF "$prog";
+    # Full output
+    $now = getTime;
+    print "BEGIN TEST: $lprog ($now)\n\n";
+}
+
+sub print_end {
+$lprog = shift;
+$lstatus = shift;
+
+    if ($lstatus == 0) {
+        $str_status = "Passed";
+    } else {
+        $str_status = "FAILED";
+    }
+    $now = getTime;
+    # Full output
+    print "\nEND TEST: $lprog ($now)\n";
+    print "TEST STATUS: $lprog = $str_status (errno $lstatus)\n";
+    print "--------------------------------------------------\n\n";
+    # Summary output
+    print OF "\t\t\t$str_status\n";
+}
+
+sub ux_start_prog {
+# parameters:
+$lprog = shift; # command to run
+
+    # Create a process group for the child
+    # so we can kill all of it if needed
+    setsid or die "setsid failed: $!";
+    # Start test program    
+    exec("./$lprog");
+}   
+
+sub ux_wait_timeout {
+# parameters:
+$lpid = shift;     # child process id
+$ltimeout = shift; # timeout
+
+    if ($ltimeout == 0) {
+        # No timeout: use blocking wait
+        $ret = waitpid($lpid,0);
+        # Exit and don't kill
+        $lstatus = $? % 256;
+        $ltimeout = -1;
+    } else {
+        while ($ltimeout > 0) {
+            # Check status of child using non blocking wait
+            $ret = waitpid($lpid, WNOHANG);
+            if ($ret == 0) {
+                # Child still running
+    #           print "Time left=$ltimeout\n";
+                sleep 1;
+                $ltimeout--;
+            } else {
+                # Child has ended
+                $lstatus = $? % 256;
+                # Exit the wait loop and don't kill
+                $ltimeout = -1;
+            }
+        }
+    }
+    
+    if ($ltimeout == 0) {
+        # we ran all the timeout: it's time to kill the child
+        print "Timeout ! Kill child process $lpid\n";
+        # Kill the child process and group
+        kill(-9,$lpid);
+        $lstatus = 1;
+    }
+    
+    return $lstatus;
+}
+
+sub ux_test_prog {
+# parameters:
+$prog = shift;  # Program to test
+
+    $child_pid = fork;
+    if ($child_pid == 0) {
+        # we are in the child process
+        print_begin($prog);
+        ux_start_prog($prog);
+    } else {
+        # we are in the parent process
+        $status = ux_wait_timeout($child_pid,$timeout);
+        print_end($prog, $status);
+    }
+
+    return $status;
+}
+
+sub win_path {
+$lpath = shift;
+
+    # MSYS drive letter = /c/ -> c:/
+    $lpath =~ s/^\/(\w)\//$1:\//;
+    # Cygwin drive letter = /cygdrive/c/ -> c:/
+    $lpath =~ s/^\/cygdrive\/(\w)\//$1:\//;
+    # replace / with \\
+    $lpath =~ s/\//\\\\/g;
+    
+    return $lpath;
+}
+
+sub win_ErrorReport{
+    print Win32::FormatMessage( Win32::GetLastError() );
+}
+
+sub win_test_prog {
+# parameters:
+$prog = shift;  # Program to test
+
+    $status = 1;
+    $curdir = getcwd;
+    $curdir = win_path($curdir);
+    $prog_path = "$curdir\\$prog.exe";
+    
+    print_begin($prog);
+    
+    Win32::Process::Create($ProcessObj,
+                           "$prog_path",
+                           "$prog",
+                           0,
+                           NORMAL_PRIORITY_CLASS,
+                           ".")|| die win_ErrorReport();
+    $retwait = $ProcessObj->Wait($timeout * 1000);
+        
+    if ( $retwait == 0) {
+        # the prog didn't finish after the timeout: kill
+        $ProcessObj->Kill($status);
+        print "Timeout ! Process killed with error code $status\n";
+    } else {
+        # the prog finished before the timeout: get exit code
+        $ProcessObj->GetExitCode($status);
+    }
+    print_end($prog,$status);
+
+    return $status
+}
+
+# MAIN ---------------
+@progs = (
+"accept",
+"acceptread",
+"acceptreademu",
+"affinity",
+"alarm",
+"anonfm",
+"atomic",
+"attach",
+"bigfile",
+"cleanup",
+"cltsrv",
+"concur",
+"cvar",
+"cvar2",
+"dlltest",
+"dtoa",
+"errcodes",
+"exit",
+"fdcach",
+"fileio",
+"foreign",
+"formattm",
+"fsync",
+"gethost",
+"getproto",
+"i2l",
+"initclk",
+"inrval",
+"instrumt",
+"intrio",
+"intrupt",
+"io_timeout",
+"ioconthr",
+"join",
+"joinkk",
+"joinku",
+"joinuk",
+"joinuu",
+"layer",
+"lazyinit",
+"libfilename",
+"lltest",
+"lock",
+"lockfile",
+"logger",
+"many_cv",
+"multiwait",
+"nameshm1",
+"nblayer",
+"nonblock",
+"ntioto",
+"ntoh",
+"op_2long",
+"op_excl",
+"op_filnf",
+"op_filok",
+"op_nofil",
+"parent",
+"peek",
+"perf",
+"pipeping",
+"pipeping2",
+"pipeself",
+"poll_nm",
+"poll_to",
+"pollable",
+"prftest",
+"primblok",
+"provider",
+"prpollml",
+"ranfile",
+"randseed",
+"rwlocktest",
+"sel_spd",
+"selct_er",
+"selct_nm",
+"selct_to",
+"selintr",
+"sema",
+"semaerr",
+"semaping",
+"sendzlf",
+"server_test",
+"servr_kk",
+"servr_uk",
+"servr_ku",
+"servr_uu",
+"short_thread",
+"sigpipe",
+"socket",
+"sockopt",
+"sockping",
+"sprintf",
+"stack",
+"stdio",
+"str2addr",
+"strod",
+"switch",
+"system",
+"testbit",
+"testfile",
+"threads",
+"timemac",
+"timetest",
+"tpd",
+"udpsrv",
+"vercheck",
+"version",
+"writev",
+"xnotify",
+"zerolen");
+
+open_log;
+
+foreach $current_prog (@progs) {
+#   print "Current_prog=$current_prog\n";
+    if ($osname =~ $WINOS) {
+        win_test_prog($current_prog);
+    } else {
+        ux_test_prog($current_prog);
+    }
+}
+
+close_log;
--- a/nsprpub/pr/tests/sel_spd.c
+++ b/nsprpub/pr/tests/sel_spd.c
@@ -448,22 +448,22 @@ static void Measure(void (*func)(void), 
     d = (double)PR_IntervalToMicroseconds(stop - start);
 
     printf("%40s: %6.2f usec\n", msg, d / _iterations);
 }
 
 
 int main(int argc, char **argv)
 {
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
 	int opt;
 	PR_IMPORT_DATA(char *) optarg;
 #endif
 
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
 	while ( (opt = getopt(argc, argv, "c:s:i:t:v")) != EOF) {
 		switch(opt) {
 			case 'i':
 				_iterations = atoi(optarg);
 				break;
 			case 't':
 				_threads_max = _threads = atoi(optarg);
 				break;
--- a/nsprpub/pr/tests/sigpipe.c
+++ b/nsprpub/pr/tests/sigpipe.c
@@ -44,37 +44,32 @@
  *
  *************************************************************************
  */
 
 #if !defined(XP_UNIX) && !defined(XP_OS2)
 
 int main(void)
 {
-    /* This test applies to Unix and OS/2 (emx build). */
+    /* This test applies to Unix and OS/2. */
     return 0;
 }
 
 #else /* XP_UNIX && OS/2 */
 
 #include "nspr.h"
 
 #ifdef XP_OS2
 #define INCL_DOSQUEUES
 #define INCL_DOSERRORS
 #include <os2.h>
 #endif
 
 #include <stdio.h>
-#ifdef XP_OS2_VACPP
-#define EPIPE EBADF  /* IBM's write() doesn't return EPIPE */
-#include <io.h>
-#else
 #include <unistd.h>
-#endif
 #include <errno.h>
 
 static void Test(void *arg)
 {
 #ifdef XP_OS2
     HFILE pipefd[2];
 #else
     int pipefd[2];
--- a/nsprpub/pr/tests/sleep.c
+++ b/nsprpub/pr/tests/sleep.c
@@ -47,21 +47,16 @@
 #include <sys/time.h>
 
 #if defined(HAVE_SVID_GETTOD)
 #define GTOD(_a) gettimeofday(_a)
 #else
 #define GTOD(_a) gettimeofday((_a), NULL)
 #endif
 
-#if defined (XP_OS2_VACPP)
-#define INCL_DOSPROCESS
-#include <os2.h>
-#endif
-
 static PRIntn rv = 0;
 
 static void Other(void *unused)
 {
     PRIntn didit = 0;
     while (PR_SUCCESS == PR_Sleep(PR_MillisecondsToInterval(250)))
     {
         fprintf(stderr, ".");
--- a/nsprpub/pr/tests/testfile.c
+++ b/nsprpub/pr/tests/testfile.c
@@ -47,20 +47,18 @@
 #endif
 #if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
 #include <pthread.h>
 #endif
 
 #if defined(XP_OS2)
 #define INCL_DOSFILEMGR
 #include <os2.h>
-#ifdef XP_OS2_EMX
 #include <getopt.h>
 #include <errno.h>
-#endif /* XP_OS2_EMX */
 #endif /* XP_OS2 */
 
 static int _debug_on = 0;
 
 #ifdef XP_MAC
 #include "prlog.h"
 #include "primpl.h"
 #define printf PR_LogPrint
@@ -948,22 +946,22 @@ HANDLE hfile;
  * Test file and directory NSPR APIs
  */
 
 int main(int argc, char **argv)
 {
 #ifdef WIN32
 	PRUint32 len;
 #endif
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
         int opt;
         extern char *optarg;
 	extern int optind;
 #endif
-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
+#if defined(XP_UNIX) || defined(XP_OS2)
         while ((opt = getopt(argc, argv, "d")) != EOF) {
                 switch(opt) {
                         case 'd':
                                 _debug_on = 1;
                                 break;
                         default:
                                 break;
                 }
--- a/nsprpub/pr/tests/thrpool_server.c
+++ b/nsprpub/pr/tests/thrpool_server.c
@@ -53,17 +53,17 @@
 #ifdef XP_UNIX
 #include <sys/mman.h>
 #endif
 #if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
 #include <pthread.h>
 #endif
 
 /* for getcwd */
-#if defined(XP_UNIX) || defined (XP_OS2_EMX) || defined(XP_BEOS)
+#if defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS)
 #include <unistd.h>
 #elif defined(XP_PC)
 #include <direct.h>
 #endif
 
 #ifdef WIN32
 #include <process.h>
 #endif
--- a/nsprpub/pr/tests/tmocon.c
+++ b/nsprpub/pr/tests/tmocon.c
@@ -61,17 +61,17 @@
 #include "plerror.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 /* for getcwd */
-#if defined(XP_UNIX) || defined (XP_OS2_EMX) || defined(XP_BEOS)
+#if defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS)
 #include <unistd.h>
 #elif defined(XP_PC)
 #include <direct.h>
 #endif
 
 #ifdef XP_MAC
 #include "prlog.h"
 #define printf PR_LogPrint
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -47,41 +47,42 @@
  */
 
 #include "prinit.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 /*
- * This release (4.7) is backward compatible with the
- * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, and 4.6.x releases.
- * It, of course, is compatible with itself.
+ * This release (4.7.2) is backward compatible with the
+ * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7, and
+ * 4.7.1 releases.  It, of course, is compatible with itself.
  */
 static char *compatible_version[] = {
     "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
     "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1",
     "4.5", "4.5.1",
-    "4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5", "4.6.6", "4.6.7", "4.6.8",
-    "4.7", PR_VERSION
+    "4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5",
+    "4.6.6", "4.6.7", "4.6.8",
+    "4.7", "4.7.1", PR_VERSION
 };
 
 /*
  * This release is not backward compatible with the old
  * NSPR 2.1 and 3.x releases.
  *
  * Any release is incompatible with future releases and
  * patches.
  */
 static char *incompatible_version[] = {
     "2.1 19980529",
     "3.0", "3.0.1",
     "3.1", "3.1.1", "3.1.2", "3.1.3",
     "3.5", "3.5.1",
-    "4.7.3",
+    "4.7.9",
     "4.8", "4.8.1",
     "10.0", "11.1", "12.14.20"
 };
 
 int main()
 {
     int idx;
     int num_compatible = sizeof(compatible_version) / sizeof(char *);
--- a/nsprpub/tools/Makefile.in
+++ b/nsprpub/tools/Makefile.in
@@ -85,23 +85,17 @@ ifeq ($(OS_TARGET), WIN16)
 else
 LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
 LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
 LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
 endif
 endif
 
 ifeq ($(OS_ARCH),OS2)
-  ifeq ($(MOZ_OS2_TOOLS),VACPP)
-    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
-    LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
-    LIBPLC= $(dist_libdir)/plc$(NSPR_VERSION).lib
-  else
-    LDOPTS += -Zomf -Zlinker /PM:VIO
-  endif
+LDOPTS += -Zomf -Zlinker /PM:VIO
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
 LDOPTS += -rpath $(PWD)/$(dist_libdir)
@@ -127,28 +121,21 @@ ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
 LDOPTS += -R $(PWD)/$(dist_libdir)
 endif
 endif
 
-# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
-# even though we already linked with these system libraries
-# when we built libnspr.so.
-ifeq ($(OS_RELEASE), 5.4)
-EXTRA_LIBS = -lthread
-endif
-
+# SunOS 5.5 needs to link with -lpthread, even though we already
+# linked with this system library when we built libnspr.so.
 ifeq ($(OS_RELEASE), 5.5)
 ifdef USE_PTHREADS
 EXTRA_LIBS = -lpthread
-else
-EXTRA_LIBS = -lthread
 endif
 endif
 endif # SunOS
 
 ifeq ($(OS_ARCH), NCR)
 # XXX: We see some strange problems when we link with libnspr.so.
 # So for now we use static libraries on NCR.  The shared library
 # stuff below is commented out.