fixup commit for branch 'nsfile_symlink_flag_07112000_BRANCH' nsfile_symlink_flag_07112000_BRANCH
authorcvs2hg
Sat, 08 Jul 2000 11:23:04 +0000
branchnsfile_symlink_flag_07112000_BRANCH
changeset 1474 95ee226c8f372c591d8c763a34c7871b8087b1da
parent 1204 e4d8a15c51158af9808e53c5c3ec90954f504042
push idunknown
push userunknown
push dateunknown
fixup commit for branch 'nsfile_symlink_flag_07112000_BRANCH'
Makefile
Makefile.in
config/BSD_OS.mk
config/Linux.mk
config/Makefile.in
config/NTO.mk
config/NetBSD.mk
config/OS2.mk
config/OpenBSD.mk
config/Rhapsody.mk
config/WIN32.mk
config/arch.mk
config/config.mk
config/rules.mk
configure
configure.in
lib/ds/plhash.c
lib/ds/plhash.h
macbuild/NSPR20PPC.mcp
macbuild/NSPRConfig.h
pr/include/md/_aix32in6.cfg
pr/include/md/_aix64.cfg
pr/include/md/_beos.cfg
pr/include/md/_bsdi.cfg
pr/include/md/_darwin.cfg
pr/include/md/_darwin.h
pr/include/md/_freebsd.cfg
pr/include/md/_linux.h
pr/include/md/_macos.h
pr/include/md/_netbsd.cfg
pr/include/md/_netbsd.h
pr/include/md/_nto.cfg
pr/include/md/_openbsd.cfg
pr/include/md/_openvms.cfg
pr/include/md/_openvms.h
pr/include/md/_os2.cfg
pr/include/md/_pth.h
pr/include/md/_rhapsody.cfg
pr/include/md/_rhapsody.h
pr/include/md/_solaris.h
pr/include/obsolete/protypes.h
pr/include/prinit.h
pr/include/prio.h
pr/include/private/primpl.h
pr/include/prtypes.h
pr/src/Makefile
pr/src/Makefile.in
pr/src/bthreads/btcvar.c
pr/src/bthreads/btthread.c
pr/src/io/pripv6.c
pr/src/io/prlog.c
pr/src/io/prsocket.c
pr/src/linking/prlink.c
pr/src/md/mac/macdll.c
pr/src/md/mac/macsockotpt.c
pr/src/md/mac/mdmac.c
pr/src/md/mac/prcpucfg.h
pr/src/md/os2/os2io.c
pr/src/md/unix/Makefile
pr/src/md/unix/Makefile.in
pr/src/md/unix/darwin.c
pr/src/md/unix/objs.mk
pr/src/md/unix/os_Linux_x86.s
pr/src/md/unix/rhapsody.c
pr/src/md/unix/uxproces.c
pr/src/md/unix/uxrng.c
pr/src/md/windows/ntio.c
pr/src/md/windows/w95io.c
pr/src/misc/prnetdb.c
pr/src/misc/prthinfo.c
pr/src/pthreads/ptio.c
pr/src/pthreads/ptsynch.c
pr/src/threads/combined/pruthr.c
pr/tests/Makefile
pr/tests/Makefile.in
pr/tests/ipv6.c
pr/tests/tpd.c
--- a/Makefile
+++ b/Makefile
@@ -39,16 +39,21 @@ ifdef PR_CLIENT_BUILD
 export::
 	rm -r -f $(DIST)/../public/nspr
 ifdef PR_CLIENT_BUILD_UNIX
 	rm -f $(DIST)/lib/libnspr.a
 	rm -f $(DIST)/bin/libnspr.$(DLL_SUFFIX)
 endif
 endif
 
+distclean::
+	@echo "cd pr/tests; $(MAKE) $@"
+	@$(MAKE) -C pr/tests $@
+	rm -f config/my_config.mk config/my_overrides.mk
+
 release::
 	echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df
 	@if test -f imports.df; then \
 	    echo "cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
 	    cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
 	else \
 	    echo "echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
 	    echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
--- a/Makefile.in
+++ b/Makefile.in
@@ -26,16 +26,18 @@ include $(MOD_DEPTH)/config/autoconf.mk
 
 DIRS = config pr lib
 
 ifdef MOZILLA_CLIENT
 PR_CLIENT_BUILD = 1
 PR_CLIENT_BUILD_UNIX = 1
 endif
 
+DIST_GARBAGE = config.cache config.log config.status
+
 include $(topsrcdir)/config/rules.mk
 
 #
 # The -ll option of zip converts CR LF to LF.
 #
 ifeq ($(OS_ARCH),WINNT)
 ZIP_ASCII_OPT = -ll
 endif
@@ -44,16 +46,22 @@ ifdef PR_CLIENT_BUILD
 export::
 	rm -r -f $(DIST)/../public/nspr
 ifdef PR_CLIENT_BUILD_UNIX
 	rm -f $(DIST)/lib/libnspr.a
 	rm -f $(DIST)/bin/libnspr.$(DLL_SUFFIX)
 endif
 endif
 
+# Delete config/autoconf.mk last because it is included by every makefile.
+distclean::
+	@echo "cd pr/tests; $(MAKE) $@"
+	@$(MAKE) -C pr/tests $@
+	rm -f config/autoconf.mk
+
 release::
 	echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df
 	@if test -f imports.df; then \
 	    echo "cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
 	    cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
 	else \
 	    echo "echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
 	    echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
--- a/config/BSD_OS.mk
+++ b/config/BSD_OS.mk
@@ -16,17 +16,17 @@
 #
 
 #
 # Config stuff for BSD/OS Unix.
 #
 
 include $(MOD_DEPTH)/config/UNIX.mk
 
-ifeq (,$(filter-out 1.1 4.0 4.0.1,$(OS_RELEASE)))
+ifeq (,$(filter-out 1.1 4.%,$(OS_RELEASE)))
 CC		= gcc -Wall -Wno-format
 CCC		= g++
 else
 CC		= shlicc2
 CCC		= shlicc2
 endif
 RANLIB		= ranlib
 
@@ -59,17 +59,17 @@ endif
 
 NOSUCHFILE	= /no-such-file
 
 ifeq ($(OS_RELEASE),1.1)
 OS_CFLAGS	+= -D_PR_STAT_HAS_ONLY_ST_ATIME -D_PR_NEED_H_ERRNO
 else
 OS_CFLAGS	+= -DHAVE_DLL -DUSE_DLFCN -D_PR_STAT_HAS_ST_ATIMESPEC
 OS_LIBS		= -ldl
-ifeq (,$(filter-out 4.0 4.0.1,$(OS_RELEASE)))
+ifeq (,$(filter-out 4.%,$(OS_RELEASE)))
 MKSHLIB		= $(CC) $(DSO_LDOPTS)
 DSO_CFLAGS	= -fPIC
 DSO_LDOPTS	= -shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)
 else
 MKSHLIB		= $(LD) $(DSO_LDOPTS)
 DSO_LDOPTS	= -r
 endif
 endif
--- a/config/Linux.mk
+++ b/config/Linux.mk
@@ -42,22 +42,20 @@ ifeq ($(CLASSIC_NSPR),1)
 IMPL_STRATEGY		= _EMU
 DEFINES			+= -D_PR_LOCAL_THREADS_ONLY
 else
 USE_PTHREADS		= 1
 IMPL_STRATEGY		= _PTH
 DEFINES			+= -D_REENTRANT
 endif
 
-USE_IPV6 = 1
-
 ifeq (86,$(findstring 86,$(OS_TEST)))
 CPU_ARCH		:= x86
 else
-ifeq (,$(filter-out armv4l sa110,$(OS_TEST)))
+ifeq (,$(filter-out arm% sa110,$(OS_TEST)))
 CPU_ARCH		:= arm
 else
 CPU_ARCH		:= $(OS_TEST)
 endif
 endif
 CPU_ARCH_TAG		= _$(CPU_ARCH)
 
 CC			= gcc
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -22,16 +22,20 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 # Indicate that this directory builds build tools.
 INTERNAL_TOOLS	= 1
 
+# autoconf.mk must be deleted last (from the top-level directory)
+# because it is included by every makefile.
+DIST_GARBAGE	= nsprincl.mk nsprincl.sh
+
 include $(topsrcdir)/config/config.mk
 
 CSRCS	= nsinstall.c now.c
 
 PLSRCS	= nfspwd.pl
 
 ifeq ($(OS_ARCH), WINNT)
 PROG_SUFFIX = .exe
--- a/config/NTO.mk
+++ b/config/NTO.mk
@@ -50,25 +50,25 @@ LD			 = $(CC)
 CCC			 = $(CC)
 
 # Old Flags  -DNO_REGEX   -DSTRINGS_ALIGNED
 
 OS_CFLAGS	 = -Wc,-Wall -Wc,-Wno-parentheses -DNTO  \
 			   -D_QNX_SOURCE -DHAVE_POINTER_LOCALTIME_R -shared
 
 COMPILER_TAG = _qcc
-MKSHLIB		 = qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -g2 -M
+MKSHLIB		 = qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M
 
 RANLIB		 = ranlib
 G++INCLUDES	 =
 OS_LIBS		 =
 EXTRA_LIBS  = -lsocket
 
 ifdef BUILD_OPT
-OPTIMIZER = -O2
+OPTIMIZER = -O1
 else
-OPTIMIZER = -O2 -gdwarf-2
+OPTIMIZER = -O1 -gstabs
 endif
 
 NOSUCHFILE	= /no-such-file
 
 GARBAGE		+= *.map
 
--- a/config/NetBSD.mk
+++ b/config/NetBSD.mk
@@ -20,16 +20,20 @@
 #
 
 include $(MOD_DEPTH)/config/UNIX.mk
 
 CC			= gcc
 CCC			= g++
 RANLIB			= ranlib
 
+ifndef OBJECT_FMT
+OBJECT_FMT		:= $(shell if echo __ELF__ | $${CC:-cc} -E - | grep -q __ELF__ ; then echo a.out ; else echo ELF ; fi)
+endif
+
 OS_REL_CFLAGS		=
 ifeq (86,$(findstring 86,$(OS_TEST)))
 CPU_ARCH		= x86
 else
 CPU_ARCH		= $(OS_TEST)
 endif
 
 OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe -DNETBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
@@ -39,30 +43,25 @@ OS_LIBS			= -lc_r
 # XXX probably should define _THREAD_SAFE too.
 else
 OS_LIBS			= -lc
 DEFINES			+= -D_PR_LOCAL_THREADS_ONLY
 endif
 
 ARCH			= netbsd
 
+ifeq ($(OBJECT_FMT),ELF)
+DLL_SUFFIX		= so
+else
 DLL_SUFFIX		= so.1.0
+endif
 
-DSO_CFLAGS		= -fPIC
+DSO_CFLAGS		= -fPIC -DPIC
 DSO_LDFLAGS		=
-DSO_LDOPTS		= -Bshareable
-ifeq ($(OS_TEST),alpha)
-DSO_LDOPTS		= -shared
-endif
-ifeq ($(OS_TEST),mips)
-DSO_LDOPTS		= -shared
-endif
-ifeq ($(OS_TEST),pmax)  
-DSO_LDOPTS		= -shared
-endif
+DSO_LDOPTS		= -x -shared
 
 ifdef LIBRUNPATH
 DSO_LDOPTS		+= -R$(LIBRUNPATH)
 endif
 
 MKSHLIB			= $(LD) $(DSO_LDOPTS)
 
 G++INCLUDES		= -I/usr/include/g++
--- a/config/OS2.mk
+++ b/config/OS2.mk
@@ -62,18 +62,18 @@ RC 			= rc.exe
 
 GARBAGE =
 
 XP_DEFINE 		= -DXP_PC
 LIB_SUFFIX 		= lib
 DLL_SUFFIX 		= dll
 OBJ_SUFFIX		= obj
 
-OS_CFLAGS     		= -W3 -Wcnd- -gm -gd+ -sd- -su4 -ge-
-OS_EXE_CFLAGS 		= -W3 -Wcnd- -gm -gd+ -sd- -su4 
+OS_CFLAGS     		= -W3 -Wcnd- -gm -gd+ -sd- -su4 -ge- -Mp
+OS_EXE_CFLAGS 		= -W3 -Wcnd- -gm -gd+ -sd- -su4 -Mp
 AR_EXTRA_ARGS 		= 
 
 ifdef BUILD_OPT
 OPTIMIZER		= -O+ -Oi 
 DEFINES 		= -UDEBUG -U_DEBUG -DNDEBUG
 DLLFLAGS		= -DLL -OUT:$@ -MAP:$(@:.dll=.map)
 EXEFLAGS    		= -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
 OBJDIR_TAG 		= _OPT
--- a/config/OpenBSD.mk
+++ b/config/OpenBSD.mk
@@ -30,26 +30,26 @@ ifeq (86,$(findstring 86,$(OS_TEST)))
 CPU_ARCH               = x86
 else
 CPU_ARCH               = $(OS_TEST)
 endif
 
 OS_CFLAGS              = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe $(THREAD_FLAG) -DOPENBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
 
 ifeq ($(USE_PTHREADS),1)
-OS_LIBS                        = -lc_r
 THREAD_FLAG		+= -pthread
 # XXX probably should define _THREAD_SAFE too.
 else
-OS_LIBS                        = -lc
 DEFINES                        += -D_PR_LOCAL_THREADS_ONLY
 endif
 
 ARCH                   = openbsd
 
+DLL_SUFFIX             = so.1.0
+
 DSO_CFLAGS             = -fPIC
 DSO_LDFLAGS            =
 DSO_LDOPTS             = -Bshareable
 ifeq ($(OS_TEST),alpha)
 DSO_LDOPTS             = -shared
 endif
 ifeq ($(OS_TEST),mips)
 DSO_LDOPTS             = -shared
--- a/config/Rhapsody.mk
+++ b/config/Rhapsody.mk
@@ -16,22 +16,29 @@
 #
 
 #
 # Config stuff for Rhapsody
 #
 
 include $(MOD_DEPTH)/config/UNIX.mk
 
+#
+# The default implementation strategy for Rhapsody is pthreads.
+#
+ifeq ($(CLASSIC_NSPR),1)
+IMPL_STRATEGY   = _EMU
+DEFINES         += -D_PR_LOCAL_THREADS_ONLY
+else
+USE_PTHREADS    = 1
+IMPL_STRATEGY   = _PTH
+endif
+
 CC              = cc
-ifeq ($(OS_RELEASE),5.0)
-CCC             = cc++
-else
 CCC             = c++
-endif
 RANLIB			= ranlib
 
 ifeq (86,$(findstring 86,$(OS_TEST)))
 OS_REL_CFLAGS   = -mno-486 -Di386
 CPU_ARCH        = i386
 else
 OS_REL_CFLAGS   = -Dppc
 CPU_ARCH		= ppc
@@ -44,18 +51,16 @@ endif
 # or it may be a declaration of a symbol defined in another file:
 #     extern int x;
 # Use the -fno-common option to force all commons to become true
 # definitions so that the linker can catch multiply-defined symbols.
 # Also, common symbols are not allowed with Rhapsody dynamic libraries.
 
 OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wmost -fno-common -pipe -DRHAPSODY -DHAVE_STRERROR -DHAVE_BSD_FLOCK
 
-DEFINES			+= -D_PR_LOCAL_THREADS_ONLY
-
 ARCH			= rhapsody
 
 # May override this with -bundle to create a loadable module.
 DSO_LDOPTS		= -dynamiclib -compatibility_version 1 -current_version 1 -all_load
 
 MKSHLIB			= $(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS)
 DLL_SUFFIX		= dylib
 
--- a/config/WIN32.mk
+++ b/config/WIN32.mk
@@ -48,24 +48,17 @@ XP_DEFINE = -DXP_PC
 OBJ_SUFFIX = obj
 LIB_SUFFIX = lib
 DLL_SUFFIX = dll
 
 OS_CFLAGS = -W3 -nologo -GF -Gy
 
 ifdef BUILD_OPT
 OS_CFLAGS += -MD
-# The -O2 optimization of MSVC 6.0 SP3 appears to generate
-# code that is unsafe for our use of fibers and static thread
-# local storage.  We temporarily work around this problem by
-# turning off global optimizations (-Og).
 OPTIMIZER = -O2
-ifeq ($(OS_TARGET),WINNT)
-OPTIMIZER += -Og-
-endif
 DEFINES = -UDEBUG -U_DEBUG -DNDEBUG
 DLLFLAGS = -OUT:"$@"
 OBJDIR_TAG = _OPT
 
 # Add symbolic information for use by a profiler
 ifdef MOZ_PROFILE
 OPTIMIZER += -Z7
 DLLFLAGS += -DEBUG -DEBUGTYPE:CV
--- a/config/arch.mk
+++ b/config/arch.mk
@@ -45,37 +45,41 @@ endif
 ifeq ($(OS_ARCH),UNIX_SV)
 ifneq ($(findstring NCR,$(shell grep NCR /etc/bcheckrc | head -1 )),)
 OS_ARCH		:= NCR
 else
 OS_ARCH		:= UNIXWARE
 OS_RELEASE	:= $(shell uname -v)
 endif
 endif
+ifeq ($(OS_ARCH),Mac OS)
+OS_ARCH		:= Rhapsody
+endif
 ifeq ($(OS_ARCH),ncr)
 OS_ARCH		:= NCR
 endif
 # This is the only way to correctly determine the actual OS version on NCR boxes.
 ifeq ($(OS_ARCH),NCR)
 OS_RELEASE	:= $(shell awk '{print $$3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$$/\2.\3/')
 endif
-ifeq ($(OS_ARCH),procnto)
-OS_ARCH      := NTO
-OS_RELEASE := _$(OS_TEST)$(OS_RELEASE)
-endif
 ifeq ($(OS_ARCH),UNIX_System_V)
 OS_ARCH		:= NEC
 endif
 ifneq (,$(findstring POSIX_for_OpenVMS,$(OS_ARCH)))
 OS_ARCH		:= OpenVMS
 CPU_ARCH	:= $(shell uname -Wh)
 OS_RELEASE	:= $(shell uname -v)
 endif
 ifeq ($(OS_ARCH),QNX)
-OS_RELEASE	:= $(shell uname -v | sed 's/^\([0-9]\)\([0-9]*\)$$/\1.\2/')
+	ifeq ($(OS_RELEASE),6.00)
+		OS_ARCH := NTO
+		OS_RELEASE := _$(OS_TEST)$(OS_RELEASE)
+	else
+		OS_RELEASE := $(shell uname -v | sed 's/^\([0-9]\)\([0-9]*\)$$/\1.\2/')
+	endif
 endif
 ifeq ($(OS_ARCH),SCO_SV)
 OS_ARCH		:= SCOOS
 OS_RELEASE	:= 5.0
 endif
 ifeq ($(OS_ARCH),SINIX-N)
 OS_ARCH		:= SINIX
 endif
--- a/config/config.mk
+++ b/config/config.mk
@@ -70,16 +70,20 @@ endif
 endif
 
 ifdef BUILD_DEBUG_GC
 DEFINES		+= -DDEBUG_GC
 endif
 
 GARBAGE		+= $(DEPENDENCIES) core $(wildcard core.[0-9]*)
 
+ifdef USE_AUTOCONF
+DIST_GARBAGE += Makefile
+endif
+
 DEFINES += -DFORCE_PR_LOG
 
 ifeq ($(_PR_NO_CLOCK_TIMER),1)
 DEFINES += -D_PR_NO_CLOCK_TIMER
 endif
 
 ifeq ($(USE_PTHREADS), 1)
 DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -188,16 +188,20 @@ clean::
 clobber::
 	rm -rf $(OBJS) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE)
 	+$(LOOP_OVER_DIRS)
 
 realclean clobber_all::
 	rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH)
 	+$(LOOP_OVER_DIRS)
 
+distclean::
+	rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE)
+	+$(LOOP_OVER_DIRS)
+
 release:: export
 ifdef RELEASE_BINS
 	@echo "Copying executable programs and scripts to release directory"
 	@if test -z "$(BUILD_NUMBER)"; then \
 		echo "BUILD_NUMBER must be defined"; \
 		false; \
 	else \
 		true; \
--- a/configure
+++ b/configure
@@ -663,35 +663,16 @@ build_os=`echo $build | sed 's/^\([^-]*\
 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}-
 
 
-  
-  echo $ac_n "checking cached system tuple""... $ac_c" 1>&6
-echo "configure:674: checking cached system tuple" >&5
-  if { test x"${ac_cv_host_system_type+set}" = x"set" &&
-       test x"$ac_cv_host_system_type" != x"$host"; } ||
-     { test x"${ac_cv_build_system_type+set}" = x"set" &&
-       test x"$ac_cv_build_system_type" != x"$build"; } ||
-     { test x"${ac_cv_target_system_type+set}" = x"set" &&
-       test x"$ac_cv_target_system_type" != x"$target"; }; then
-      echo "$ac_t""different" 1>&6
-      { echo "configure: error: remove config.cache and re-run configure" 1>&2; exit 1; }
-  else
-    echo "$ac_t""ok" 1>&6
-  fi
-  ac_cv_host_system_type="$host"
-  ac_cv_build_system_type="$build"
-  ac_cv_target_system_type="$target"
-
-
 
 cat >> confdefs.h <<\EOF
 #define USE_AUTOCONF 1
 EOF
 
 
 NSPR_VERSION=4
 NSPR_MODNAME=nspr20
@@ -795,17 +776,17 @@ if test "${enable_mdupdate+set}" = set; 
 	    USE_MDUPDATE=1
       fi 
 fi
 
 
 # Extract the first word of "whoami", so it can be a program name with args.
 set dummy whoami; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:804: checking for $ac_word" >&5
+echo "configure:785: 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.
   ;;
   ?:/*)			 
@@ -855,24 +836,24 @@ 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:864: checking for $host compiler" >&5
+echo "configure:845: checking for $host compiler" >&5
     if test -z "$HOST_CC"; then
 	    for ac_prog in 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:871: checking for $ac_word" >&5
+echo "configure:852: 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"
@@ -909,26 +890,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:918: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+echo "configure:899: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
     cat > conftest.$ac_ext <<EOF
-#line 920 "configure"
+#line 901 "configure"
 #include "confdefs.h"
 
 int main() {
 return(0);
 ; return 0; }
 EOF
-if { (eval echo configure:927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:908: \"$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
@@ -939,17 +920,17 @@ rm -f conftest*
     LDFLAGS=$_SAVE_LDFLAGS
 
     if test -z "$CC"; then
 	    for ac_prog in "${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:948: checking for $ac_word" >&5
+echo "configure:929: 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"
@@ -974,17 +955,17 @@ test -n "$CC" && break
 done
 test -n "$CC" || CC=":"
 
     fi
     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:983: checking for $ac_word" >&5
+echo "configure:964: 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"
@@ -1004,17 +985,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:1013: checking for $ac_word" >&5
+echo "configure:994: 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
@@ -1055,17 +1036,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:1064: checking for $ac_word" >&5
+echo "configure:1045: 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"
@@ -1087,33 +1068,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:1096: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1077: 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 1107 "configure"
+#line 1088 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1093: \"$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
@@ -1129,31 +1110,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:1138: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1119: 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:1143: checking whether we are using GNU C" >&5
+echo "configure:1124: 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:1152: \"$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:1133: \"$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
 
@@ -1162,17 +1143,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:1171: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1152: 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
@@ -1199,17 +1180,17 @@ else
 fi
 
     if test -z "$CXX"; then
 	    for ac_prog in "${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:1208: checking for $ac_word" >&5
+echo "configure:1189: 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"
@@ -1236,17 +1217,17 @@ test -n "$CXX" || CXX=":"
 
     fi
     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:1245: checking for $ac_word" >&5
+echo "configure:1226: 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"
@@ -1268,33 +1249,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:1277: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1258: 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 1288 "configure"
+#line 1269 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1274: \"$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
@@ -1310,31 +1291,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:1319: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1300: 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:1324: checking whether we are using GNU C++" >&5
+echo "configure:1305: 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:1333: \"$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:1314: \"$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
 
@@ -1343,17 +1324,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:1352: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1333: 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
@@ -1380,17 +1361,17 @@ else
 fi
 
     if test -z "$RANLIB"; then
 	    for ac_prog in "${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:1389: checking for $ac_word" >&5
+echo "configure:1370: 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"
@@ -1417,17 +1398,17 @@ test -n "$RANLIB" || RANLIB=":"
 
     fi
     if test -z "$AR"; then
 	    for ac_prog in "${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:1426: checking for $ac_word" >&5
+echo "configure:1407: 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"
@@ -1454,17 +1435,17 @@ test -n "$AR" || AR=":"
 
     fi
     if test -z "$AS"; then
 	    for ac_prog in "${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:1463: checking for $ac_word" >&5
+echo "configure:1444: 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"
@@ -1491,17 +1472,17 @@ test -n "$AS" || AS=":"
 
     fi
     if test -z "$LD"; then
 	    for ac_prog in "${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:1500: checking for $ac_word" >&5
+echo "configure:1481: 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"
@@ -1528,17 +1509,17 @@ test -n "$LD" || LD=":"
 
     fi
     if test -z "$DLLTOOL"; then
 	    for ac_prog in "${target_alias}-dlltool" "${target}-dlltool"
 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:1537: checking for $ac_word" >&5
+echo "configure:1518: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$DLLTOOL"; then
   ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1565,17 +1546,17 @@ test -n "$DLLTOOL" || DLLTOOL=":"
 
     fi
     if test -z "$WINDRES"; then
 	    for ac_prog in "${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:1574: checking for $ac_word" >&5
+echo "configure:1555: 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"
@@ -1600,17 +1581,17 @@ test -n "$WINDRES" && break
 done
 test -n "$WINDRES" || WINDRES=":"
 
     fi
 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:1609: checking for $ac_word" >&5
+echo "configure:1590: 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"
@@ -1630,17 +1611,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:1639: checking for $ac_word" >&5
+echo "configure:1620: 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
@@ -1681,17 +1662,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:1690: checking for $ac_word" >&5
+echo "configure:1671: 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"
@@ -1713,33 +1694,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:1722: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1703: 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 1733 "configure"
+#line 1714 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1719: \"$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
@@ -1755,31 +1736,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:1764: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1745: 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:1769: checking whether we are using GNU C" >&5
+echo "configure:1750: 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:1778: \"$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:1759: \"$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
 
@@ -1788,17 +1769,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:1797: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1778: 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
@@ -1824,17 +1805,17 @@ else
   fi
 fi
 
     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:1833: checking for $ac_word" >&5
+echo "configure:1814: 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"
@@ -1856,33 +1837,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:1865: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1846: 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 1876 "configure"
+#line 1857 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1862: \"$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
@@ -1898,31 +1879,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:1907: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1888: 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:1912: checking whether we are using GNU C++" >&5
+echo "configure:1893: 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:1921: \"$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:1902: \"$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
 
@@ -1931,17 +1912,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:1940: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1921: 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
@@ -1965,17 +1946,17 @@ else
   else
     CXXFLAGS=
   fi
 fi
 
     # 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:1974: checking for $ac_word" >&5
+echo "configure:1955: 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"
@@ -1997,17 +1978,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:2006: checking for $ac_word" >&5
+echo "configure:1987: 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.
   ;;
   ?:/*)			 
@@ -2038,17 +2019,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:2047: checking for $ac_word" >&5
+echo "configure:2028: 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.
   ;;
   ?:/*)			 
@@ -2079,17 +2060,17 @@ test -n "$AR" && break
 done
 test -n "$AR" || AR=":"
 
     for ac_prog in 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:2088: checking for $ac_word" >&5
+echo "configure:2069: 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.
   ;;
   ?:/*)			 
@@ -2120,17 +2101,17 @@ test -n "$LD" && break
 done
 test -n "$LD" || LD=":"
 
     for ac_prog in dlltool
 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:2129: checking for $ac_word" >&5
+echo "configure:2110: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$DLLTOOL" in
   /*)
   ac_cv_path_DLLTOOL="$DLLTOOL" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2161,17 +2142,17 @@ test -n "$DLLTOOL" && break
 done
 test -n "$DLLTOOL" || DLLTOOL=":"
 
     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:2170: checking for $ac_word" >&5
+echo "configure:2151: 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.
   ;;
   ?:/*)			 
@@ -2225,17 +2206,17 @@ rm -f a.out
 # SunOS /usr/etc/install
 # IRIX /sbin/install
 # AIX /bin/install
 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:2234: checking for a BSD compatible install" >&5
+echo "configure:2215: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
   for ac_dir in $PATH; do
     # Account for people who put trailing slashes in PATH elements.
     case "$ac_dir/" in
@@ -2278,17 +2259,17 @@ echo "$ac_t""$INSTALL" 1>&6
 # It thinks the first close brace ends the variable substitution.
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:2287: checking whether ln -s works" >&5
+echo "configure:2268: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftestdata
 if ln -s X conftestdata 2>/dev/null
 then
   rm -f conftestdata
   ac_cv_prog_LN_S="ln -s"
@@ -2303,17 +2284,17 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
 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:2312: checking for $ac_word" >&5
+echo "configure:2293: 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.
   ;;
   ?:/*)			 
@@ -2348,16 +2329,17 @@ test -n "$PERL" || PERL=":"
 OBJ_SUFFIX=o
 LIB_SUFFIX=a
 DLL_SUFFIX=so
 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
 PR_MD_ASFILES=
 PR_MD_CSRCS=
 PR_MD_ARCH_DIR=unix
 AR_FLAGS='cr $@'
+AS='$(CC)'
 
 OS_TARGET=`uname -s`
 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
 OS_RELEASE=`uname -r`
 OS_TEST=`uname -m`
 
 case "$host" in
 *-mingw*)
@@ -2886,16 +2868,20 @@ EOF
         cat >> confdefs.h <<\EOF
 #define __alpha 1
 EOF
 
         CFLAGS="$CFLAGS -mieee"
         CXXFLAGS="$CXXFLAGS -mieee"
         _OPTIMIZE_FLAGS=-O2
         ;;
+    i?86)
+        PR_MD_ASFILES=os_Linux_x86.s
+        _OPTIMIZE_FLAGS=-O2
+        ;;
     m68k)
         _OPTIMIZE_FLAGS=-O
         CFLAGS="$CFLAGS -m68020-40"
         CXXFLAGS="$CXXFLAGS -m68020-40"
         ;;
     *)
         _OPTIMIZE_FLAGS=-O2
         ;;
@@ -2967,21 +2953,21 @@ EOF
 
 *-nto*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     MDCPUCFG_H=_nto.cfg
     PR_MD_CSRCS=nto.c
-    MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -o $(@:$(OBJDIR)/%.so=%.so)'
+    MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)'
     CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -DNTO -D_QNX_SOURCE -DHAVE_POINTER_LOCALTIME_R -shared"
     OS_LIBS="-lsocket"
-    _OPTIMIZE_FLAGS="-O2"
-    _DEBUG_FLAGS="-O2 -gdwarf-2"
+    _OPTIMIZE_FLAGS="-O1"
+    _DEBUG_FLAGS="-O1 -gstabs"
     COMPILER_TAG="_qcc"
     CC="qcc -Vgcc_ntox86 -w"
     CXX="QCC -Vgcc_ntox86 -w"
     CPP="qcc -Vgcc_ntox86 -w"
     LD="qcc -Vgcc_ntox86 -nostdlib"
     AR="qcc -Vgcc_ntox86 -M -a "
     AR_FLAGS="$@"
 	;;
@@ -3108,72 +3094,72 @@ esac
 if test "$enable_shared" = no; then
     MKSHLIB=
 fi
 
 
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:3117: checking how to run the C preprocessor" >&5
+echo "configure:3103: 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 3132 "configure"
+#line 3118 "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:3138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3124: \"$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 3149 "configure"
+#line 3135 "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:3155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3141: \"$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 3166 "configure"
+#line 3152 "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:3172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3158: \"$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*
@@ -3189,23 +3175,23 @@ fi
   CPP="$ac_cv_prog_CPP"
 else
   ac_cv_prog_CPP="$CPP"
 fi
 echo "$ac_t""$CPP" 1>&6
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:3198: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:3184: 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 3204 "configure"
+#line 3190 "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
@@ -3213,17 +3199,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 3222 "configure"
+#line 3208 "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
@@ -3237,22 +3223,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:3246: checking for $ac_func" >&5
+echo "configure:3232: 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 3251 "configure"
+#line 3237 "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();
@@ -3265,17 +3251,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:3274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3260: \"$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
@@ -3293,36 +3279,36 @@ else
   echo "$ac_t""no" 1>&6
 fi
 done
 
 
 
 
 echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6
-echo "configure:3302: checking for pthread_attr_init in -lpthread" >&5
+echo "configure:3288: checking for pthread_attr_init in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_attr_init | 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="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3310 "configure"
+#line 3296 "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 pthread_attr_init();
 
 int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:3321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3307: \"$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
@@ -3331,36 +3317,36 @@ LIBS="$ac_save_LIBS"
 
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; 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_attr_init in -lc_r""... $ac_c" 1>&6
-echo "configure:3340: checking for pthread_attr_init in -lc_r" >&5
+echo "configure:3326: checking for pthread_attr_init in -lc_r" >&5
 ac_lib_var=`echo c_r'_'pthread_attr_init | 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="-lc_r  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3348 "configure"
+#line 3334 "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 pthread_attr_init();
 
 int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:3359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3345: \"$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
@@ -3369,36 +3355,36 @@ LIBS="$ac_save_LIBS"
 
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; 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_attr_init in -lc""... $ac_c" 1>&6
-echo "configure:3378: checking for pthread_attr_init in -lc" >&5
+echo "configure:3364: checking for pthread_attr_init in -lc" >&5
 ac_lib_var=`echo c'_'pthread_attr_init | 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="-lc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3386 "configure"
+#line 3372 "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 pthread_attr_init();
 
 int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:3397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3383: \"$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
@@ -3515,17 +3501,17 @@ if test "${enable_ipv6+set}" = set; then
       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:3524: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:3510: 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
 	    CFLAGS="$CFLAGS -pthread"
 	    CXXFLAGS="$CXXFLAGS -pthread"
 	fi
@@ -3585,22 +3571,22 @@ EOF
 	    cat >> confdefs.h <<\EOF
 #define _REENTRANT 1
 EOF
 
 	    ;;
     esac
 
     echo $ac_n "checking for pthread_create""... $ac_c" 1>&6
-echo "configure:3594: checking for pthread_create" >&5
+echo "configure:3580: checking for pthread_create" >&5
 if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3599 "configure"
+#line 3585 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pthread_create(); 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 pthread_create();
@@ -3613,17 +3599,17 @@ int main() {
 #if defined (__stub_pthread_create) || defined (__stub___pthread_create)
 choke me
 #else
 pthread_create();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_pthread_create=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_pthread_create=no"
 fi
@@ -3632,36 +3618,36 @@ fi
 
 if eval "test \"`echo '$ac_cv_func_'pthread_create`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
 else
   echo "$ac_t""no" 1>&6
 
        echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:3641: checking for pthread_create in -lpthread" >&5
+echo "configure:3627: checking for pthread_create in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_create | 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="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3649 "configure"
+#line 3635 "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 pthread_create();
 
 int main() {
 pthread_create()
 ; return 0; }
 EOF
-if { (eval echo configure:3660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3646: \"$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
@@ -3750,22 +3736,22 @@ EOF
                 PR_MD_ASFILES="$PR_MD_ASFILES os_SunOS_32.s"
             fi
         fi
     fi
     ;;
 esac
 
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:3759: checking for dlopen" >&5
+echo "configure:3745: checking for dlopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3764 "configure"
+#line 3750 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); 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 dlopen();
@@ -3778,17 +3764,17 @@ int main() {
 #if defined (__stub_dlopen) || defined (__stub___dlopen)
 choke me
 #else
 dlopen();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dlopen=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_dlopen=no"
 fi
@@ -3797,36 +3783,36 @@ fi
 
 if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
 else
   echo "$ac_t""no" 1>&6
 
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:3806: checking for dlopen in -ldl" >&5
+echo "configure:3792: 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 3814 "configure"
+#line 3800 "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:3825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3811: \"$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
@@ -3911,16 +3897,58 @@ fi
 
 
 
 
 
 
 
 
+MAKEFILES="
+Makefile 
+config/Makefile
+config/autoconf.mk
+config/nsprincl.mk
+config/nsprincl.sh
+lib/Makefile 
+lib/ds/Makefile 
+lib/libc/Makefile 
+lib/libc/include/Makefile 
+lib/libc/src/Makefile 
+pr/Makefile 
+pr/include/Makefile 
+pr/include/md/Makefile 
+pr/include/obsolete/Makefile 
+pr/include/private/Makefile 
+pr/src/Makefile 
+pr/src/io/Makefile 
+pr/src/linking/Makefile 
+pr/src/malloc/Makefile 
+pr/src/md/Makefile 
+pr/src/md/${PR_MD_ARCH_DIR}/Makefile 
+pr/src/memory/Makefile 
+pr/src/misc/Makefile 
+pr/src/threads/Makefile 
+pr/tests/Makefile 
+pr/tests/dll/Makefile 
+"
+
+
+if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
+    MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
+elif test -n "$USE_PTHREADS"; then
+    MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
+elif test -n "$USE_BTHREADS"; then
+    MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
+fi
+
+if test -n "$USE_CPLUS"; then
+    MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
+fi
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
 # scripts and configure runs.  It is not useful on other systems.
 # If it contains results you don't want to keep, you may remove or edit it.
 #
 # By default, configure uses ./config.cache as the cache file,
@@ -4024,60 +4052,17 @@ do
     echo "\$ac_cs_usage"; exit 0 ;;
   *) echo "\$ac_cs_usage"; exit 1 ;;
   esac
 done
 
 ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "
-Makefile 
-config/Makefile
-config/autoconf.mk
-config/nsprincl.mk
-config/nsprincl.sh
-lib/Makefile 
-lib/ds/Makefile 
-lib/libc/Makefile 
-lib/libc/include/Makefile 
-lib/libc/src/Makefile 
-lib/msgc/Makefile 
-lib/msgc/include/Makefile 
-lib/msgc/src/Makefile 
-lib/msgc/tests/Makefile
-lib/prstreams/Makefile 
-lib/tests/Makefile 
-pr/Makefile 
-pr/include/Makefile 
-pr/include/md/Makefile 
-pr/include/obsolete/Makefile 
-pr/include/private/Makefile 
-pr/src/Makefile 
-pr/src/bthreads/Makefile 
-pr/src/cplus/Makefile 
-pr/src/cplus/tests/Makefile 
-pr/src/io/Makefile 
-pr/src/linking/Makefile 
-pr/src/malloc/Makefile 
-pr/src/md/Makefile 
-pr/src/md/beos/Makefile 
-pr/src/md/os2/Makefile 
-pr/src/md/unix/Makefile 
-pr/src/md/windows/Makefile 
-pr/src/memory/Makefile 
-pr/src/misc/Makefile 
-pr/src/pthreads/Makefile 
-pr/src/threads/Makefile 
-pr/src/threads/combined/Makefile 
-pr/tests/Makefile 
-pr/tests/dll/Makefile 
-pr/tests/w16gui/Makefile 
-tools/Makefile 
-" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "$MAKEFILES" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
 # Protect against being on the right side of a sed subst in config.status.
 sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
 $ac_vpsub
 $extrasub
@@ -4210,59 +4195,17 @@ while $ac_more_lines; do
 done
 if test -z "$ac_sed_cmds"; then
   ac_sed_cmds=cat
 fi
 EOF
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile 
-config/Makefile
-config/autoconf.mk
-config/nsprincl.mk
-config/nsprincl.sh
-lib/Makefile 
-lib/ds/Makefile 
-lib/libc/Makefile 
-lib/libc/include/Makefile 
-lib/libc/src/Makefile 
-lib/msgc/Makefile 
-lib/msgc/include/Makefile 
-lib/msgc/src/Makefile 
-lib/msgc/tests/Makefile
-lib/prstreams/Makefile 
-lib/tests/Makefile 
-pr/Makefile 
-pr/include/Makefile 
-pr/include/md/Makefile 
-pr/include/obsolete/Makefile 
-pr/include/private/Makefile 
-pr/src/Makefile 
-pr/src/bthreads/Makefile 
-pr/src/cplus/Makefile 
-pr/src/cplus/tests/Makefile 
-pr/src/io/Makefile 
-pr/src/linking/Makefile 
-pr/src/malloc/Makefile 
-pr/src/md/Makefile 
-pr/src/md/beos/Makefile 
-pr/src/md/os2/Makefile 
-pr/src/md/unix/Makefile 
-pr/src/md/windows/Makefile 
-pr/src/memory/Makefile 
-pr/src/misc/Makefile 
-pr/src/pthreads/Makefile 
-pr/src/threads/Makefile 
-pr/src/threads/combined/Makefile 
-pr/tests/Makefile 
-pr/tests/dll/Makefile 
-pr/tests/w16gui/Makefile 
-tools/Makefile 
-"}
+CONFIG_FILES=\${CONFIG_FILES-"$MAKEFILES"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
   case "$ac_file" in
   *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
   *) ac_file_in="${ac_file}.in" ;;
@@ -4323,9 +4266,8 @@ EOF
 cat >> $CONFIG_STATUS <<\EOF
 
 exit 0
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
-
--- a/configure.in
+++ b/configure.in
@@ -26,17 +26,16 @@ AC_INIT(config/libc_r.h)
 d=`pwd`
 if test "${srcdir}" = "$d" || test "${srcdir}" = "."  ; then
    echo "Do not build in the srcdir as it will override Makefiles used by non-autoconf build."
    exit 1;
 fi
 
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_SYSTEM
-AC_VALIDATE_CACHED_SYSTEM_TUPLE
 AC_PREFIX_DEFAULT(\${MOD_DEPTH}/dist)
 
 dnl Set this define to make fixes w/o breaking anything else.
 AC_DEFINE(USE_AUTOCONF)
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
@@ -242,16 +241,17 @@ dnl ====================================
 OBJ_SUFFIX=o
 LIB_SUFFIX=a
 DLL_SUFFIX=so
 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
 PR_MD_ASFILES=
 PR_MD_CSRCS=
 PR_MD_ARCH_DIR=unix
 AR_FLAGS='cr $@'
+AS='$(CC)'
 
 OS_TARGET=`uname -s`
 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
 OS_RELEASE=`uname -r`
 OS_TEST=`uname -m`
 
 dnl ========================================================
 dnl Override of system specific host options
@@ -573,16 +573,20 @@ case "$target" in
     case "${target_cpu}" in
     alpha)
         AC_DEFINE(_ALPHA_)
         AC_DEFINE(__alpha)
         CFLAGS="$CFLAGS -mieee"
         CXXFLAGS="$CXXFLAGS -mieee"
         _OPTIMIZE_FLAGS=-O2
         ;;
+    i?86)
+        PR_MD_ASFILES=os_Linux_x86.s
+        _OPTIMIZE_FLAGS=-O2
+        ;;
     m68k)
         _OPTIMIZE_FLAGS=-O
         CFLAGS="$CFLAGS -m68020-40"
         CXXFLAGS="$CXXFLAGS -m68020-40"
         ;;
     *)
         _OPTIMIZE_FLAGS=-O2
         ;;
@@ -633,21 +637,21 @@ case "$target" in
 	    ;;
     esac
     ;;
 
 *-nto*)
     AC_DEFINE(XP_UNIX)
     MDCPUCFG_H=_nto.cfg
     PR_MD_CSRCS=nto.c
-    MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -o $(@:$(OBJDIR)/%.so=%.so)'
+    MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)'
     CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -DNTO -D_QNX_SOURCE -DHAVE_POINTER_LOCALTIME_R -shared"
     OS_LIBS="-lsocket"
-    _OPTIMIZE_FLAGS="-O2"
-    _DEBUG_FLAGS="-O2 -gdwarf-2"
+    _OPTIMIZE_FLAGS="-O1"
+    _DEBUG_FLAGS="-O1 -gstabs"
     COMPILER_TAG="_qcc"
     CC="qcc -Vgcc_ntox86 -w"
     CXX="QCC -Vgcc_ntox86 -w"
     CPP="qcc -Vgcc_ntox86 -w"
     LD="qcc -Vgcc_ntox86 -nostdlib"
     AR="qcc -Vgcc_ntox86 -M -a "
     AR_FLAGS="$@"
 	;;
@@ -1072,55 +1076,54 @@ AC_SUBST(AIX_LINK_OPTS)
 AC_SUBST(NOSUCHFILE)
 AC_SUBST(MOZ_OBJFORMAT)
 AC_SUBST(ULTRASPARC_LIBRARY)
 AC_SUBST(ULTRASPARC_FILTER_LIBRARY)
 
 dnl ========================================================
 dnl Generate output files.
 dnl ========================================================
-AC_OUTPUT([
+MAKEFILES="
 Makefile 
 config/Makefile
 config/autoconf.mk
 config/nsprincl.mk
 config/nsprincl.sh
 lib/Makefile 
 lib/ds/Makefile 
 lib/libc/Makefile 
 lib/libc/include/Makefile 
 lib/libc/src/Makefile 
-lib/msgc/Makefile 
-lib/msgc/include/Makefile 
-lib/msgc/src/Makefile 
-lib/msgc/tests/Makefile
-lib/prstreams/Makefile 
-lib/tests/Makefile 
 pr/Makefile 
 pr/include/Makefile 
 pr/include/md/Makefile 
 pr/include/obsolete/Makefile 
 pr/include/private/Makefile 
 pr/src/Makefile 
-pr/src/bthreads/Makefile 
-pr/src/cplus/Makefile 
-pr/src/cplus/tests/Makefile 
 pr/src/io/Makefile 
 pr/src/linking/Makefile 
 pr/src/malloc/Makefile 
 pr/src/md/Makefile 
-pr/src/md/beos/Makefile 
-pr/src/md/os2/Makefile 
-pr/src/md/unix/Makefile 
-pr/src/md/windows/Makefile 
+pr/src/md/${PR_MD_ARCH_DIR}/Makefile 
 pr/src/memory/Makefile 
 pr/src/misc/Makefile 
-pr/src/pthreads/Makefile 
 pr/src/threads/Makefile 
-pr/src/threads/combined/Makefile 
 pr/tests/Makefile 
 pr/tests/dll/Makefile 
-pr/tests/w16gui/Makefile 
-tools/Makefile 
-])
+"
+
+dnl lib/tests/Makefile
+dnl pr/tests/w16gui/Makefile
+dnl tools/Makefile
 
-dnl lib/prstreams/tests/testprstrm/Makefile 
-dnl lib/tests/windows/makefile 
+if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
+    MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
+elif test -n "$USE_PTHREADS"; then
+    MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
+elif test -n "$USE_BTHREADS"; then
+    MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
+fi
+
+if test -n "$USE_CPLUS"; then
+    MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
+fi
+
+AC_OUTPUT([$MAKEFILES])
--- a/lib/ds/plhash.c
+++ b/lib/ds/plhash.c
@@ -190,16 +190,44 @@ PL_HashTableRawLookup(PLHashTable *ht, P
         hep = &he->next;
 #ifdef HASHMETER
         ht->nsteps++;
 #endif
     }
     return hep;
 }
 
+/*
+** Same as PL_HashTableRawLookup but doesn't reorder the hash entries.
+*/
+PR_IMPLEMENT(PLHashEntry *const *)
+PL_HashTableRawLookupConst(const PLHashTable *ht, PLHashNumber keyHash,
+                           const void *key)
+{
+    PLHashEntry *he, *const *hep;
+    PLHashNumber h;
+
+#ifdef HASHMETER
+    ht->nlookups++;
+#endif
+    h = keyHash * GOLDEN_RATIO;
+    h >>= ht->shift;
+    hep = &ht->buckets[h];
+    while ((he = *hep) != 0) {
+        if (he->keyHash == keyHash && (*ht->keyCompare)(key, he->key)) {
+            break;
+        }
+        hep = &he->next;
+#ifdef HASHMETER
+        ht->nsteps++;
+#endif
+    }
+    return hep;
+}
+
 PR_IMPLEMENT(PLHashEntry *)
 PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep,
                    PLHashNumber keyHash, const void *key, void *value)
 {
     PRUint32 i, n;
     PLHashEntry *he, *next, **oldbuckets;
     PRSize nb;
 
@@ -344,16 +372,33 @@ PL_HashTableLookup(PLHashTable *ht, cons
     hep = PL_HashTableRawLookup(ht, keyHash, key);
     if ((he = *hep) != 0) {
         return he->value;
     }
     return 0;
 }
 
 /*
+** Same as PL_HashTableLookup but doesn't reorder the hash entries.
+*/
+PR_IMPLEMENT(void *)
+PL_HashTableLookupConst(const PLHashTable *ht, const void *key)
+{
+    PLHashNumber keyHash;
+    PLHashEntry *he, *const *hep;
+
+    keyHash = (*ht->keyHash)(key);
+    hep = PL_HashTableRawLookupConst(ht, keyHash, key);
+    if ((he = *hep) != 0) {
+        return he->value;
+    }
+    return 0;
+}
+
+/*
 ** Iterate over the entries in the hash table calling func for each
 ** entry found. Stop if "f" says to (return value & PR_ENUMERATE_STOP).
 ** Return a count of the number of elements scanned.
 */
 PR_IMPLEMENT(int)
 PL_HashTableEnumerateEntries(PLHashTable *ht, PLHashEnumerator f, void *arg)
 {
     PLHashEntry *he, **hep;
--- a/lib/ds/plhash.h
+++ b/lib/ds/plhash.h
@@ -99,16 +99,19 @@ PR_EXTERN(PLHashEntry *)
 PL_HashTableAdd(PLHashTable *ht, const void *key, void *value);
 
 PR_EXTERN(PRBool)
 PL_HashTableRemove(PLHashTable *ht, const void *key);
 
 PR_EXTERN(void *)
 PL_HashTableLookup(PLHashTable *ht, const void *key);
 
+PR_EXTERN(void *)
+PL_HashTableLookupConst(const PLHashTable *ht, const void *key);
+
 PR_EXTERN(PRIntn)
 PL_HashTableEnumerateEntries(PLHashTable *ht, PLHashEnumerator f, void *arg);
 
 /* General-purpose C string hash function. */
 PR_EXTERN(PLHashNumber)
 PL_HashString(const void *key);
 
 /* Compare strings using strcmp(), return true if equal. */
@@ -118,16 +121,20 @@ PL_CompareStrings(const void *v1, const 
 /* Stub function just returns v1 == v2 */
 PR_EXTERN(PRIntn)
 PL_CompareValues(const void *v1, const void *v2);
 
 /* Low level access methods */
 PR_EXTERN(PLHashEntry **)
 PL_HashTableRawLookup(PLHashTable *ht, PLHashNumber keyHash, const void *key);
 
+PR_EXTERN(PLHashEntry *const *)
+PL_HashTableRawLookupConst(const PLHashTable *ht, PLHashNumber keyHash,
+                           const void *key);
+
 PR_EXTERN(PLHashEntry *)
 PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep, PLHashNumber keyHash,
                    const void *key, void *value);
 
 PR_EXTERN(void)
 PL_HashTableRawRemove(PLHashTable *ht, PLHashEntry **hep, PLHashEntry *he);
 
 /* This can be trivially implemented using PL_HashTableEnumerateEntries. */
index fa75d4da838d1eb430448e405ea838791c68382a..ba5ad5536dd54148cc8bf4c7f570bad80eda7edc
GIT binary patch
literal 153941
zc%1Eh34mNhwRZKrcV@Eh8wrpG0to~r3nYY5agxbGAd?K4iGj!@)6?CV>7+Nhdq~2s
zk0`i{0)oqP0R?=h_{66u?x;L>5qCfoR8&OVp8{_A&v)zG?%UmWsbShoAa#<j>rCC#
z)phHhI;X0-x=uWoOA8@PAtH-}vEhTlIPd#HOgTt-cSMYcaHu1fNN$f63aMNn+EvKy
zNyba!s3J>5n1pDKh(m{*3x^Ixgq<tI@sV<az3pv6yzmhIQC38ZZSKrvWAR+@CoB@<
zB402LmeU%tOIjRx$h_YiCtfX#Z=Ekh`&E?LLWl|xT_?l>A^#Q+i6;9^KNhl1KcOT^
zh@ljMNw5e_@_s}MVGLm`VH{yRVFF<yVG?07VH#mNVFqC)VHROFVGiLK!d${U!m)(o
zB4`gG<`bfX69^{~P9iKIoJ=@{u#m8ba4O+6!eT-vVKZSp;dH_ogbjpN!V<z#!ZN~g
z!kL7#2rCFH39AU_5ZVYA61EY#2-^u46Lt_TA@mY<5_S>#2>paOAwk$p7$6K1QiMH(
zy@WI&L%5Vspf>FhQeL?KHt2;=Amj-dJO^ll5LX<kd2OOMR=U_xOJjtq6}SsUq?$(T
zwseU`>|Ad1vDAdI*4)qtOwkL8R(Ex6qVf)2boVna$6a3ek8P1_B4dsJS1l1aIPy=a
zqKUF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4lxZlf$%6h)D8Rg3u;704GDtdlBY#YY|U;dJcp5Fx><k;Zz@O_&6+?|V{
z%N!?s5<Z{x;c={CbIkC0_<n((%N6Jo96x*>#xtzvE79LMmUz0gtmixDVr;{4#aCcF
z$a?;LjP*Fi_=*S1<@CM^`X=Lz8_U05(eu+Yq8xj?4bOx1{1f{{IS%=X$IAEBdllxU
z9Fu(N*vft7&#O$GR{W!KU)TRhI15I`S@2)1=bwA8aN?F5D^e9b@1`*TFGLwDq0ds!
wd;d;jVJDt>40ez8{1tB%PHc1I>{Baxem~-+bDZ;4&{wJFJ6A0i9P|AD15Q!TNdN!<
--- a/macbuild/NSPRConfig.h
+++ b/macbuild/NSPRConfig.h
@@ -19,9 +19,9 @@
 #define OLDROUTINELOCATIONS 0
 
 #define XP_MAC 1
 #define _PR_NO_PREEMPT 1
 #define _NO_FAST_STRING_INLINES_ 1
 #define FORCE_PR_LOG 1
 #define NSPR20 1
 #define NSPR_AS_SHARED_LIB
-
+#define TARGET_CARBON 0
--- a/pr/include/md/_aix32in6.cfg
+++ b/pr/include/md/_aix32in6.cfg
@@ -68,19 +68,16 @@
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_DOUBLE  4
 #define PR_ALIGN_OF_POINTER 4
 
 #define	HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
-#ifndef _PR_INET6
-#define _PR_INET6
-#endif
 #define PR_AF_INET6 24  /* same as AF_INET6 */
 
 #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
--- a/pr/include/md/_aix64.cfg
+++ b/pr/include/md/_aix64.cfg
@@ -69,19 +69,16 @@
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_DOUBLE  4
 #define PR_ALIGN_OF_POINTER 8
 
 #define	HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
-#ifndef _PR_INET6
-#define _PR_INET6
-#endif
 #define PR_AF_INET6 24  /* same as AF_INET6 */
 
 #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
--- a/pr/include/md/_beos.cfg
+++ b/pr/include/md/_beos.cfg
@@ -22,16 +22,18 @@
 #define XP_BEOS
 #undef XP_UNIX
 #endif
 
 #ifndef BEOS
 #define BEOS
 #endif
 
+#define PR_AF_INET6 5  /* same as AF_INET6 */
+
 #ifdef __powerpc__
 #undef  IS_LITTLE_ENDIAN
 #define IS_BIG_ENDIAN 1
 #else
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #endif
 
--- a/pr/include/md/_bsdi.cfg
+++ b/pr/include/md/_bsdi.cfg
@@ -22,16 +22,18 @@
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #ifndef BSDI
 #define BSDI
 #endif
 
+#define PR_AF_INET6 24  /* same as AF_INET6 */
+
 #if defined(__i386__)
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #define HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
--- a/pr/include/md/_darwin.cfg
+++ b/pr/include/md/_darwin.cfg
@@ -22,16 +22,18 @@
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #ifndef RHAPOSDY
 #define RHAPOSDY
 #endif
 
+#define PR_AF_INET6 30  /* same as AF_INET6 */
+
 #if defined(i386)
 #undef IS_BIG_ENDIAN
 #define  IS_LITTLE_ENDIAN 1
 #else
 #undef IS_LITTLE_ENDIAN
 #define  IS_BIG_ENDIAN 1
 #endif
 
--- a/pr/include/md/_darwin.h
+++ b/pr/include/md/_darwin.h
@@ -37,18 +37,18 @@
 #define _MD_DEFAULT_STACK_SIZE	65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
 #undef  HAVE_STACK_GROWING_UP
 #define HAVE_DLL
 #define USE_MACH_DYLD
 #define _PR_HAVE_SOCKADDR_LEN  
 #define _PR_STAT_HAS_ST_ATIMESPEC
-#define _PR_TIMESPEC_HAS_TS_SEC
 #define _PR_NO_LARGE_FILES
+#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
 #define USE_SETJMP
 
 #if !defined(_PR_PTHREADS)
 
 #include <setjmp.h>
 
 #define PR_CONTEXT_TYPE	jmp_buf
--- a/pr/include/md/_freebsd.cfg
+++ b/pr/include/md/_freebsd.cfg
@@ -28,16 +28,18 @@
 #endif
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #define	HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
+#define PR_AF_INET6 28  /* same as AF_INET6 */
+
 #if defined(__i386__)
 
 #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
--- a/pr/include/md/_linux.h
+++ b/pr/include/md/_linux.h
@@ -54,28 +54,42 @@
 #undef	HAVE_STACK_GROWING_UP
 
 /*
  * Elf linux supports dl* functions
  */
 #define HAVE_DLL
 #define USE_DLFCN
 
+#if defined(__i386__)
+#define _PR_HAVE_ATOMIC_OPS
+#define _MD_INIT_ATOMIC()
+extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val);
+#define _MD_ATOMIC_INCREMENT          _PR_x86_AtomicIncrement
+extern PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val);
+#define _MD_ATOMIC_DECREMENT          _PR_x86_AtomicDecrement
+extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
+#define _MD_ATOMIC_ADD                _PR_x86_AtomicAdd
+extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
+#define _MD_ATOMIC_SET                _PR_x86_AtomicSet
+#endif
+
 #define USE_SETJMP
 #if defined(__GLIBC__) && __GLIBC__ >= 2
 #define _PR_POLL_AVAILABLE
 #endif
 #undef _PR_USE_POLL
 #define _PR_STAT_HAS_ONLY_ST_ATIME
 #if defined(__alpha)
 #define _PR_HAVE_LARGE_OFF_T
 #else
 #define _PR_NO_LARGE_FILES
 #endif
-#ifdef _PR_INET6
+#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
+#define _PR_INET6
 #define _PR_HAVE_GETHOSTBYNAME2
 #define _PR_INET6_PROBE
 #endif
 #define _PR_HAVE_SYSV_SEMAPHORES
 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
 #ifdef _PR_PTHREADS
 
@@ -92,21 +106,21 @@ extern void _MD_CleanupBeforeExit(void);
 
 #ifdef __powerpc__
 /*
  * PowerPC based MkLinux
  *
  * On the PowerPC, the new style jmp_buf isn't used until glibc
  * 2.1.
  */
-#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_GPR1]
 #else
 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__misc[0]
-#endif /* __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 */
+#endif /* glibc 2.1 or later */
 #define _MD_SET_FP(_t, val)
 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
 #define _MD_GET_FP_PTR(_t) ((void *) 0)
 /* aix = 64, macos = 70 */
 #define PR_NUM_GCREGS  64
 
 #elif defined(__alpha)
 /* Alpha based Linux */
--- a/pr/include/md/_macos.h
+++ b/pr/include/md/_macos.h
@@ -377,16 +377,29 @@ extern char* _MD_ReadDir(struct _MDDir *
 */
 
 #define _MD_PIPEAVAILABLE(fd) -1
 
 /*
 ** Socket I/O Related definitions
 */
 
+#if UNIVERSAL_INTERFACES_VERSION >= 0x0330
+/* In Universal Interfaces 3.3 and later, these are enums. */
+#define IP_TTL IP_TTL
+#define IP_TOS IP_TOS
+#define IP_ADD_MEMBERSHIP IP_ADD_MEMBERSHIP
+#define IP_DROP_MEMBERSHIP IP_DROP_MEMBERSHIP
+#define IP_MULTICAST_IF IP_MULTICAST_IF
+#define IP_MULTICAST_TTL IP_MULTICAST_TTL
+#define IP_MULTICAST_LOOP IP_MULTICAST_LOOP
+#define TCP_NODELAY TCP_NODELAY
+#define TCP_MAXSEG TCP_MAXSEG
+#endif
+
 #define _MD_SOCKET 			_MD_socket
 #define _MD_BIND			_MD_bind
 #define _MD_LISTEN			_MD_listen
 #define _MD_GETSOCKNAME		_MD_getsockname
 
 extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
 #define _MD_GETSOCKOPT		_MD_getsockopt
 
--- a/pr/include/md/_netbsd.cfg
+++ b/pr/include/md/_netbsd.cfg
@@ -22,16 +22,18 @@
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #ifndef NETBSD
 #define NETBSD
 #endif
 
+#define PR_AF_INET6 24  /* same as AF_INET6 */
+
 #if defined(__i386__) || defined(__arm32__)
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #define	HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
--- a/pr/include/md/_netbsd.h
+++ b/pr/include/md/_netbsd.h
@@ -34,29 +34,35 @@
 #elif defined(__sparc__)
 #define _PR_SI_ARCHITECTURE "sparc"
 #elif defined(__mips__)
 #define _PR_SI_ARCHITECTURE "mips"
 #elif defined(__arm32__)
 #define _PR_SI_ARCHITECTURE "arm32"
 #endif
 
+#if defined(__ELF__)
+#define PR_DLL_SUFFIX		".so"
+#else
 #define PR_DLL_SUFFIX		".so.1.0"
+#endif
 
 #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
 #define USE_DLFCN
 #define _PR_HAVE_SOCKADDR_LEN
 #define _PR_NO_LARGE_FILES
 #define _PR_STAT_HAS_ST_ATIMESPEC
+#define _PR_POLL_AVAILABLE
+#define _PR_USE_POLL
 #define _PR_HAVE_SYSV_SEMAPHORES
 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
 #define USE_SETJMP
 
 #ifndef _PR_PTHREADS
 #include <setjmp.h>
 
@@ -205,15 +211,18 @@ struct _MDCPU {
 #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
 #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
 
 /*
  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
  * unwrapped version.
  */
 #define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
+#if defined(_PR_POLL_AVAILABLE)
+#include <poll.h>
 #define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
+#endif
 
 #if NetBSD1_3 == 1L
 typedef unsigned int nfds_t;
 #endif
 
 #endif /* nspr_netbsd_defs_h___ */
--- a/pr/include/md/_nto.cfg
+++ b/pr/include/md/_nto.cfg
@@ -22,16 +22,18 @@
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #ifndef NTO
 #define NTO
 #endif
 
+#define PR_AF_INET6 24  /* same as AF_INET6 */
+
 #ifdef __i386__
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 
 #define PR_BYTES_PER_BYTE   1L
 #define PR_BYTES_PER_SHORT  2L
 #define PR_BYTES_PER_INT    4L
--- a/pr/include/md/_openbsd.cfg
+++ b/pr/include/md/_openbsd.cfg
@@ -22,16 +22,18 @@
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #ifndef OPENBSD
 #define OPENBSD
 #endif
 
+#define PR_AF_INET6 24  /* same as AF_INET6 */
+
 #if defined(__i386__) || defined(__arm32__)
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #define	HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
--- a/pr/include/md/_openvms.cfg
+++ b/pr/include/md/_openvms.cfg
@@ -31,16 +31,18 @@
 #undef  IS_BIG_ENDIAN
 #define	HAVE_LONG_LONG
 #define HAVE_ALIGNED_DOUBLES
 #define HAVE_ALIGNED_LONGLONGS
 #ifdef IS_64
 #undef IS_64
 #endif
 
+#define PR_AF_INET6 26  /* same as AF_INET6 */
+
 #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
--- a/pr/include/md/_openvms.h
+++ b/pr/include/md/_openvms.h
@@ -76,16 +76,27 @@ struct ip_mreq {
 #define HAVE_DLL
 #define USE_DLFCN
 
 #define _PR_POLL_AVAILABLE
 #define _PR_USE_POLL
 #define _PR_STAT_HAS_ONLY_ST_ATIME
 #define _PR_NO_LARGE_FILES
 
+/* IPv6 support */
+#define _PR_HAVE_GETIPNODEBYNAME
+#define _PR_HAVE_GETIPNODEBYADDR
+#define _PR_INET6_PROBE
+#ifndef _PR_INET6
+#define AF_INET6 26
+#define AI_V4MAPPED 0x00000010
+#define AI_ALL      0x00000008
+#define AI_ADDRCONFIG 0x00000020
+#endif
+
 #undef  USE_SETJMP
 
 #include <setjmp.h>
 
 /*
  * A jmp_buf is actually a struct sigcontext.  The sc_sp field of
  * struct sigcontext is the stack pointer.
  */
--- a/pr/include/md/_os2.cfg
+++ b/pr/include/md/_os2.cfg
@@ -34,16 +34,18 @@
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #ifdef NO_LONG_LONG
 #undef HAVE_LONG_LONG
 #else
 #define HAVE_LONG_LONG 1
 #endif
 
+#define PR_AF_INET6 24  /* same as AF_INET6 */
+
 #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
--- a/pr/include/md/_pth.h
+++ b/pr/include/md/_pth.h
@@ -88,17 +88,17 @@
 #if defined(_PR_DCETHREADS)
 #define _PT_PTHREAD_ZERO_THR_HANDLE(t)        memset(&(t), 0, sizeof(pthread_t))
 #define _PT_PTHREAD_THR_HANDLE_IS_ZERO(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(HPUX) || defined(LINUX) || defined(FREEBSD) \
 	|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
-	|| defined(VMS) || defined(NTO)
+	|| defined(VMS) || defined(NTO) || defined(RHAPSODY)
 #define _PT_PTHREAD_ZERO_THR_HANDLE(t)        (t) = 0
 #define _PT_PTHREAD_THR_HANDLE_IS_ZERO(t)     (t) == 0
 #define _PT_PTHREAD_COPY_THR_HANDLE(st, dt)   (dt) = (st)
 #else 
 #error "pthreads is not supported for this architecture"
 #endif
 
 #if defined(_PR_DCETHREADS)
@@ -199,17 +199,17 @@
  * Solaris doesn't seem to have macros for the min/max priorities.
  * The range of 0-127 is mentioned in the pthread_setschedparam(3T)
  * man pages, and pthread_setschedparam indeed allows 0-127.  However,
  * pthread_attr_setschedparam does not allow 0; it allows 1-127.
  */
 #define PT_PRIO_MIN            1
 #define PT_PRIO_MAX            127
 #elif defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
-	|| defined(BSDI) /* XXX */
+	|| defined(BSDI) || defined(RHAPSODY) /* XXX */
 #define PT_PRIO_MIN            0
 #define PT_PRIO_MAX            126
 #else
 #error "pthreads is not supported for this architecture"
 #endif
 
 /*
  * The _PT_PTHREAD_YIELD function is called from a signal handler.
@@ -232,15 +232,15 @@ extern int (*_PT_aix_yield_fcn)();
 #define _PT_PTHREAD_YIELD() \
     PR_BEGIN_MACRO               				\
 		struct timespec onemillisec = {0};		\
 		onemillisec.tv_nsec = 1000000L;			\
         nanosleep(&onemillisec,NULL);			\
     PR_END_MACRO
 #elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \
 	|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
-	|| defined(BSDI) || defined(NTO)
+	|| defined(BSDI) || defined(NTO) || defined(RHAPSODY)
 #define _PT_PTHREAD_YIELD()            	sched_yield()
 #else
 #error "Need to define _PT_PTHREAD_YIELD for this platform"
 #endif
 
 #endif /* nspr_pth_defs_h_ */
--- a/pr/include/md/_rhapsody.cfg
+++ b/pr/include/md/_rhapsody.cfg
@@ -22,16 +22,18 @@
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #ifndef RHAPOSDY
 #define RHAPOSDY
 #endif
 
+#define PR_AF_INET6 30  /* same as AF_INET6 */
+
 #if defined(i386)
 #undef IS_BIG_ENDIAN
 #define  IS_LITTLE_ENDIAN 1
 #else
 #undef IS_LITTLE_ENDIAN
 #define  IS_BIG_ENDIAN 1
 #endif
 
--- a/pr/include/md/_rhapsody.h
+++ b/pr/include/md/_rhapsody.h
@@ -37,18 +37,18 @@
 #define _MD_DEFAULT_STACK_SIZE	65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
 #undef  HAVE_STACK_GROWING_UP
 #define HAVE_DLL
 #define USE_MACH_DYLD
 #define _PR_HAVE_SOCKADDR_LEN  
 #define _PR_STAT_HAS_ST_ATIMESPEC
-#define _PR_TIMESPEC_HAS_TS_SEC
 #define _PR_NO_LARGE_FILES
+#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
 #define USE_SETJMP
 
 #if !defined(_PR_PTHREADS)
 
 #include <setjmp.h>
 
 #define PR_CONTEXT_TYPE	jmp_buf
--- a/pr/include/md/_solaris.h
+++ b/pr/include/md/_solaris.h
@@ -65,27 +65,50 @@
 #if !defined(sparc) || !defined(IS_64)
 #define _PR_HAVE_ATOMIC_CAS
 #endif
 #endif
 
 #define _PR_POLL_AVAILABLE
 #define _PR_USE_POLL
 #define _PR_STAT_HAS_ST_ATIM
+#ifdef SOLARIS2_5
+#define _PR_HAVE_SYSV_SEMAPHORES
+#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
+#else
 #define _PR_HAVE_POSIX_SEMAPHORES
 #define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
+#endif
 #define _PR_HAVE_GETIPNODEBYNAME
 #define _PR_HAVE_GETIPNODEBYADDR
 #define _PR_INET6_PROBE
 #define _PR_ACCEPT_INHERIT_NONBLOCK
 #ifndef _PR_INET6
 #define AF_INET6 26
 #define AI_V4MAPPED 0x0001 
 #define AI_ALL      0x0002
 #define AI_ADDRCONFIG   0x0004
+#define _PR_HAVE_MD_SOCKADDR_IN6
+/* isomorphic to struct in6_addr on Solaris 8 */
+struct _md_in6_addr {
+    union {
+        PRUint8  _S6_u8[16];
+        PRUint32 _S6_u32[4];
+        PRUint32 __S6_align;
+    } _S6_un;
+};
+/* isomorphic to struct sockaddr_in6 on Solaris 8 */
+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
 
 #include "prinrval.h"
 NSPR_API(PRIntervalTime) _MD_Solaris_GetInterval(void);
 #define _MD_GET_INTERVAL                  _MD_Solaris_GetInterval
 NSPR_API(PRIntervalTime) _MD_Solaris_TicksPerSecond(void);
 #define _MD_INTERVAL_PER_SEC              _MD_Solaris_TicksPerSecond
 
--- a/pr/include/obsolete/protypes.h
+++ b/pr/include/obsolete/protypes.h
@@ -46,17 +46,18 @@ typedef PRIntn intn;
  */
 #include <ints.h>
 #include <types.h>
 #else
 
 /* SVR4 typedef of uint is commonly found on UNIX machines. */
 #ifdef XP_UNIX
 #include <sys/types.h>
-#else
+#endif
+#if !defined(XP_UNIX) || defined(NTO)
 typedef PRUintn uint;
 #endif
 
 typedef PRUint64 uint64;
 #if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
 typedef PRUint32 uint32;
 #else
 typedef unsigned long uint32;
--- a/pr/include/prinit.h
+++ b/pr/include/prinit.h
@@ -39,21 +39,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> <build date>"
 */
-#define PR_VERSION  "4.0"
+#define PR_VERSION  "4.0.1 Beta"
 #define PR_VMAJOR   4
 #define PR_VMINOR   0
-#define PR_VPATCH   0
-#define PR_BETA     PR_FALSE
+#define PR_VPATCH   1
+#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/pr/include/prio.h
+++ b/pr/include/prio.h
@@ -174,44 +174,16 @@ union PRNetAddr {
     struct {                            /* Unix domain socket address */
         PRUint16 family;                /* address family (AF_UNIX) */
         char path[104];                 /* null-terminated pathname */
     } local;
 #endif
 };
 
 /*
-** The PR_NETADDR_SIZE macro can only be called on a PRNetAddr union
-** whose 'family' field is set.  It returns the size of the union
-** member corresponding to the specified address family.
-*/
-
-#if defined(_PR_INET6)
-
-#define PR_NETADDR_SIZE(_addr) PR_NetAddrSize(_addr)
-
-#else
-
-#if defined(XP_UNIX)
-#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) 					\
-        ((_addr)->raw.family == PR_AF_INET		\
-        ? sizeof((_addr)->inet)					\
-        : sizeof((_addr)->ipv6))
-#endif /* defined(XP_UNIX) */
-
-#endif /* defined(_PR_INET6) */
-
-/*
 ***************************************************************************
 ** PRSockOption
 **
 ** The file descriptors can have predefined options set after they file
 ** descriptor is created to change their behavior. Only the options in
 ** the following enumeration are supported.
 ***************************************************************************
 */
@@ -1103,18 +1075,16 @@ NSPR_API(PRStatus) PR_MakeDir(const char
  *        If successful, will return a status of PR_SUCCESS. Otherwise
  *        a value of PR_FAILURE. The reason for the failure may be re-
  *        trieved using PR_GetError().
  **************************************************************************
  */
 
 NSPR_API(PRStatus) PR_RmDir(const char *name);
 
-NSPR_API(PRUintn) PR_NetAddrSize(const PRNetAddr* addr);
-
 /*
  *************************************************************************
  * FUNCTION: PR_NewUDPSocket
  * DESCRIPTION:
  *     Create a new UDP socket.
  * INPUTS:
  *     None
  * OUTPUTS:
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -1263,16 +1263,79 @@ extern void _PR_Putfd(PRFileDesc *fd);
 extern PRIntn _PR_InvalidInt(void);
 extern PRInt16 _PR_InvalidInt16(void);
 extern PRInt64 _PR_InvalidInt64(void);
 extern PRStatus _PR_InvalidStatus(void);
 extern PRFileDesc *_PR_InvalidDesc(void);
 
 extern PRIOMethods _pr_faulty_methods;
 
+/*
+** The PR_NETADDR_SIZE macro can only be called on a PRNetAddr union
+** whose 'family' field is set.  It returns the size of the union
+** member corresponding to the specified address family.
+*/
+
+extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr);
+
+#if defined(_PR_INET6)
+
+#define PR_NETADDR_SIZE(_addr) _PR_NetAddrSize(_addr)
+
+#elif defined(_PR_HAVE_MD_SOCKADDR_IN6)
+
+/*
+** Under the following conditions:
+** 1. _PR_INET6 is not defined;
+** 2. _PR_INET6_PROBE is defined;
+** 3. struct sockaddr_in6 has nonstandard fields at the end
+**    (e.g., on Solaris 8),
+** (_addr)->ipv6 is smaller than struct sockaddr_in6, and
+** hence we can't pass sizeof((_addr)->ipv6) to socket
+** functions such as connect because they would fail with
+** 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)
+#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)
+#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) 					\
+        ((_addr)->raw.family == PR_AF_INET		\
+        ? sizeof((_addr)->inet)					\
+        : sizeof((_addr)->ipv6))
+#endif /* defined(XP_UNIX) */
+
+#endif /* defined(_PR_INET6) */
+
 extern PRStatus _PR_MapOptionName(
     PRSockOption optname, PRInt32 *level, PRInt32 *name);
 extern void _PR_InitThreads(
     PRThreadType type, PRThreadPriority priority, PRUintn maxPTDs);
 
 struct PRLock {
 #if defined(_PR_PTHREADS)
     pthread_mutex_t mutex;          /* the underlying lock */
--- a/pr/include/prtypes.h
+++ b/pr/include/prtypes.h
@@ -153,23 +153,19 @@
 #define PR_EXPORT_DATA(__type) extern __type
 #define PR_IMPORT(__type) extern __type
 #define PR_IMPORT_DATA(__type) extern __type
 
 #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
+#define PR_CALLBACK _Optlink
 #define PR_CALLBACK_DECL
-#ifndef XP_OS2_VACPP
-#define PR_STATIC_CALLBACK(__x) static __x
-#else
-#define PR_STATIC_CALLBACK(__x) static __x _Optlink
-#endif
+#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
 
 #else /* Unix */
 
 #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
 
--- a/pr/src/Makefile
+++ b/pr/src/Makefile
@@ -369,16 +369,18 @@ SH_NOW = $(shell $(NOW))
 ifeq ($(OS_ARCH), WINNT)
 	SUF = i64
 else
 	SUF = LL
 endif
 
 DEFINES     += -D_NSPR_BUILD_
 
+GARBAGE     += $(TINC)
+
 $(TINC):
 	@$(MAKE_OBJDIR)
 	@$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC)
 	@if test ! -z "$(SH_NOW)"; then \
 	    $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \
 	else \
 	    true; \
 	fi
--- a/pr/src/Makefile.in
+++ b/pr/src/Makefile.in
@@ -375,16 +375,18 @@ else
 	SUF = i64
 endif
 else
 	SUF = LL
 endif
 
 DEFINES		+= -D_NSPR_BUILD_
 
+GARBAGE		+= $(TINC)
+
 $(TINC):
 	@$(MAKE_OBJDIR)
 	@$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC)
 	@if test ! -z "$(SH_NOW)"; then \
 	    $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \
 	else \
 	    true; \
 	fi
--- a/pr/src/bthreads/btcvar.c
+++ b/pr/src/bthreads/btcvar.c
@@ -83,44 +83,56 @@ PR_IMPLEMENT(void)
 ** Returns PR_FAILURE if the caller has not locked the lock associated
 ** with the condition variable or the thread was interrupted (PR_Interrupt()).
 ** The particular reason can be extracted with PR_GetError().
 */
 PR_IMPLEMENT(PRStatus)
     PR_WaitCondVar (PRCondVar *cvar, PRIntervalTime timeout)
 {
     status_t result;
-
-    /*
-    ** This is an entirely stupid bug, but...  If you call
-    ** acquire_sem_etc with a timeout of exactly 1,000,000 microseconds
-    ** it returns immediately with B_NO_ERROR.  1,000,010 microseconds
-    ** returns as expected.  Running BeOS/Intel R3.1 at this time.
-    ** Forwarded to Be, Inc. for resolution, Bug ID 980624-225956
-    **
-    ** Update: Be couldn't reproduce it, but removing timeout++ still
-    **         exhibits the problem on BeOS/Intel R4 and BeOS/PPC R4.
-    */
-
-    timeout++;
+    bigtime_t interval;
 
     PR_Unlock( cvar->lock );
 
-    if( PR_INTERVAL_NO_WAIT != timeout )
-    {
-	if( PR_INTERVAL_NO_TIMEOUT == timeout )
-	{
-	    if( acquire_sem( cvar->isem ) != B_NO_ERROR ) return PR_FAILURE;
+    switch (timeout) {
+    case PR_INTERVAL_NO_WAIT:
+        /* nothing to do */
+        break;
+
+    case PR_INTERVAL_NO_TIMEOUT:
+        /* wait as long as necessary */
+        if( acquire_sem( cvar->isem ) != B_NO_ERROR ) return PR_FAILURE;
+        break;
+
+    default:
+        interval = (bigtime_t)PR_IntervalToMicroseconds(timeout);
 
-	} else
-	{
-	    result = acquire_sem_etc( cvar->isem, 1, B_TIMEOUT, PR_IntervalToMicroseconds( timeout ) );
-	    if( result != B_NO_ERROR && result != B_TIMED_OUT )
-		return PR_FAILURE;
-	}
+        /*
+        ** in R5, this problem seems to have been resolved, so we
+        ** won't bother with it
+        */
+#if !defined(B_BEOS_VERSION_5) || (B_BEOS_VERSION < B_BEOS_VERSION_5)
+        /*
+        ** This is an entirely stupid bug, but...  If you call
+        ** acquire_sem_etc with a timeout of exactly 1,000,000 microseconds
+        ** it returns immediately with B_NO_ERROR.  1,000,010 microseconds
+        ** returns as expected.  Running BeOS/Intel R3.1 at this time.
+        ** Forwarded to Be, Inc. for resolution, Bug ID 980624-225956
+        **
+        ** Update: Be couldn't reproduce it, but removing timeout++ still
+        **         exhibits the problem on BeOS/Intel R4 and BeOS/PPC R4.
+        */
+        if (interval == 1000000)
+            interval = 1000010;
+#endif	/* !defined(B_BEOS_VERSION_5) || (B_BEOS_VERSION < B_BEOS_VERSION_5) */
+
+        result = acquire_sem_etc( cvar->isem, 1, B_RELATIVE_TIMEOUT, interval);
+        if( result != B_NO_ERROR && result != B_TIMED_OUT )
+            return PR_FAILURE;
+        break;
     }
 
     PR_Lock( cvar->lock );
 
     return PR_SUCCESS;
 }
 
 /*
@@ -157,9 +169,11 @@ PR_IMPLEMENT(PRStatus)
 {
     sem_info semInfo;
 
     if( get_sem_info( cvar->isem, &semInfo ) != B_NO_ERROR )
 	return PR_FAILURE;
 
     if( release_sem_etc( cvar->isem, semInfo.count, 0 ) != B_NO_ERROR )
 	return PR_FAILURE;
+
+    return PR_SUCCESS;
 }
--- a/pr/src/bthreads/btthread.c
+++ b/pr/src/bthreads/btthread.c
@@ -669,48 +669,44 @@ PR_IMPLEMENT(void*)
 
 
 PR_IMPLEMENT(PRStatus)
     PR_Interrupt (PRThread* thred)
 {
     PRIntn rv;
 
     PR_ASSERT(thred != NULL);
-    rv = resume_thread( thred->md.tid );
-
-    if( rv == B_BAD_THREAD_STATE )
-    {
-	/*
-	** We have a thread that's not suspended, but is
-	** blocked.  Suspend it THEN resume it.  The
-	** function call that's hanging will return
-	** B_INTERRUPTED
-	*/
 
-	rv = suspend_thread( thred->md.tid );
-	if( rv != B_NO_ERROR )
-	{
-	    PR_SetError( PR_UNKNOWN_ERROR, rv );
-	    return( PR_FAILURE );
-	}
-	rv = resume_thread( thred->md.tid );
-	if( rv != B_NO_ERROR )
-	{
-	    PR_SetError( PR_UNKNOWN_ERROR, rv );
-	    return( PR_FAILURE );
-	}
+    /*
+    ** there seems to be a bug in beos R5 in which calling
+    ** resume_thread() on a blocked thread returns B_OK instead
+    ** of B_BAD_THREAD_STATE (beos bug #20000422-19095).  as such,
+    ** to interrupt a thread, we will simply suspend then resume it
+    ** (no longer call resume_thread(), check for B_BAD_THREAD_STATE,
+    ** the suspend/resume to wake up a blocked thread).  this wakes
+    ** up blocked threads properly, and doesn't hurt unblocked threads
+    ** (they simply get stopped then re-started immediately)
+    */
+
+    rv = suspend_thread( thred->md.tid );
+    if( rv != B_NO_ERROR )
+    {
+        /* this doesn't appear to be a valid thread_id */
+        PR_SetError( PR_UNKNOWN_ERROR, rv );
+        return PR_FAILURE;
     }
 
+    rv = resume_thread( thred->md.tid );
     if( rv != B_NO_ERROR )
     {
-	PR_SetError( PR_UNKNOWN_ERROR, rv );
-	return( PR_FAILURE );
+        PR_SetError( PR_UNKNOWN_ERROR, rv );
+        return PR_FAILURE;
     }
 
-    return( PR_SUCCESS );
+    return PR_SUCCESS;
 }
 
 PR_IMPLEMENT(void)
     PR_ClearInterrupt ()
 {
 }
 
 PR_IMPLEMENT(PRStatus)
--- a/pr/src/io/pripv6.c
+++ b/pr/src/io/pripv6.c
@@ -144,35 +144,39 @@ static PRInt32 PR_CALLBACK Ipv6ToIpv4Soc
 
 static PRFileDesc* PR_CALLBACK Ipv6ToIpv4SocketAccept (
     PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout)
 {
     PRStatus rv;
     PRFileDesc *newfd;
     PRFileDesc *newstack;
 	PRNetAddr tmp_ipv4addr;
+    PRNetAddr *addrlower = NULL;
 
     PR_ASSERT(fd != NULL);
     PR_ASSERT(fd->lower != NULL);
 
     newstack = PR_NEW(PRFileDesc);
     if (NULL == newstack)
     {
         PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
         return NULL;
     }
     *newstack = *fd;  /* make a copy of the accepting layer */
 
-    newfd = (fd->lower->methods->accept)(fd->lower, &tmp_ipv4addr, timeout);
+    if (addr)
+        addrlower = &tmp_ipv4addr;
+    newfd = (fd->lower->methods->accept)(fd->lower, addrlower, timeout);
     if (NULL == newfd)
     {
         PR_DELETE(newstack);
         return NULL;
     }
-	_PR_ConvertToIpv6NetAddr(&tmp_ipv4addr, addr);
+    if (addr)
+        _PR_ConvertToIpv6NetAddr(&tmp_ipv4addr, addr);
 
     rv = PR_PushIOLayer(newfd, PR_TOP_IO_LAYER, newstack);
     PR_ASSERT(PR_SUCCESS == rv);
     return newfd;  /* that's it */
 }
 
 static PRInt32 PR_CALLBACK Ipv6ToIpv4SocketAcceptRead(PRFileDesc *sd,
 			PRFileDesc **nd, PRNetAddr **ipv6_raddr, void *buf, PRInt32 amount,
@@ -267,21 +271,39 @@ void *_pr_freehostent_fp;
 PRStatus _pr_init_ipv6()
 {
     const PRIOMethods *stubMethods;
 
 #if defined(_PR_INET6_PROBE)
 
 #if !defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME)
 	PRLibrary *lib;	
-	_pr_getipnodebyname_fp = PR_FindSymbolAndLibrary("getipnodebyname", &lib);
+#if defined(VMS)
+#define GETIPNODEBYNAME "DECC$GETIPNODEBYNAME"
+#define GETIPNODEBYADDR "DECC$GETIPNODEBYADDR"
+#define FREEHOSTENT     "DECC$FREEHOSTENT"
+#define GAISTRERROR     "DECC$GAISTRERROR"
+	typedef char * (*_pr_getstrerror_t)(int);
+	_pr_getstrerror_t _pr_gaistrerror_fp;
+	_pr_getipnodebyname_fp = NULL;
+	_pr_gaistrerror_fp = (_pr_getstrerror_t)PR_FindSymbolAndLibrary(GAISTRERROR, &lib);
+	if (NULL != _pr_gaistrerror_fp) {
+		if (NULL != (*_pr_gaistrerror_fp)(0))
+			_pr_getipnodebyname_fp = PR_FindSymbol(lib, GETIPNODEBYNAME);
+	}
+#else
+#define GETIPNODEBYNAME "getipnodebyname"
+#define GETIPNODEBYADDR "getipnodebyaddr"
+#define FREEHOSTENT     "freehostent"
+	_pr_getipnodebyname_fp = PR_FindSymbolAndLibrary(GETIPNODEBYNAME, &lib);
+#endif
 	if (NULL != _pr_getipnodebyname_fp) {
-		_pr_freehostent_fp = PR_FindSymbol(lib, "freehostent");
+		_pr_freehostent_fp = PR_FindSymbol(lib, FREEHOSTENT);
 		if (NULL != _pr_freehostent_fp) {
-			_pr_getipnodebyaddr_fp = PR_FindSymbol(lib, "getipnodebyaddr");
+			_pr_getipnodebyaddr_fp = PR_FindSymbol(lib, GETIPNODEBYADDR);
 			if (NULL != _pr_getipnodebyaddr_fp)
 				_pr_ipv6_is_present = PR_TRUE;
 			else
 				_pr_ipv6_is_present = PR_FALSE;
 		} else
 			_pr_ipv6_is_present = PR_FALSE;
 		(void)PR_UnloadLibrary(lib);
 	} else
--- a/pr/src/io/prlog.c
+++ b/pr/src/io/prlog.c
@@ -9,16 +9,27 @@
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  * for the specific language governing rights and limitations under the
  * NPL.
  * 
  * The Initial Developer of this code under the NPL is Netscape
  * Communications Corporation.  Portions created by Netscape are
  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  * Reserved.
+ *
+ * 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>
 
 /*
@@ -50,17 +61,17 @@ static PRLock *_pr_logLock;
     _PR_LOCK_UNLOCK(_pr_logLock); \
     PR_ASSERT(_me == _PR_MD_CURRENT_THREAD()); \
     if (!_PR_IS_NATIVE_THREAD(_me)) \
         _PR_INTSON(_is); \
 }
 
 #endif
 
-#if defined(XP_PC) && !defined(XP_OS2_VACPP)
+#if defined(XP_PC)
 #define strcasecmp stricmp
 #define strncasecmp strnicmp
 #endif
 
 /*
  * On NT, we can't define _PUT_LOG as PR_Write or _PR_MD_WRITE,
  * because every asynchronous file io operation leads to a fiber context
  * switch.  So we define _PUT_LOG as fputs (from stdio.h).  A side
@@ -427,26 +438,44 @@ PR_IMPLEMENT(void) PR_LogFlush(void)
 
 PR_IMPLEMENT(void) PR_Abort(void)
 {
     PR_LogPrint("Aborting");
     abort();
 }
 
 #ifdef DEBUG
+#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)
+/* Force a trap */
+static void DebugBreak(void) { int *pTrap=NULL; *pTrap = 1; }
+#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
-#ifdef WIN32
+#if defined(WIN32) || defined(XP_OS2)
     DebugBreak();
 #endif
 #ifndef XP_MAC
     abort();
 #endif
 }
 #endif /* DEBUG */
 
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -1299,17 +1299,17 @@ PR_IMPLEMENT(PRStatus) PR_NewTCPSocketPa
 
     osfd[0] = osfd[1] = INVALID_SOCKET;
     listenSock = socket(AF_INET, SOCK_STREAM, 0);
     if (listenSock == INVALID_SOCKET) {
         goto failed;
     }
     selfAddr.sin_family = AF_INET;
     selfAddr.sin_port = 0;
-    selfAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+    selfAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* BugZilla: 35408 */
     addrLen = sizeof(selfAddr);
     if (bind(listenSock, (struct sockaddr *) &selfAddr,
             addrLen) == SOCKET_ERROR) {
         goto failed;
     }
     if (getsockname(listenSock, (struct sockaddr *) &selfAddr,
             &addrLen) == SOCKET_ERROR) {
         goto failed;
@@ -1377,17 +1377,17 @@ failed:
     PRNetAddr selfAddr;
     PRUint16 port;
 
     f[0] = f[1] = NULL;
     listenSock = PR_NewTCPSocket();
     if (listenSock == NULL) {
         goto failed;
     }
-    PR_InitializeNetAddr(PR_IpAddrAny, 0, &selfAddr);
+    PR_InitializeNetAddr(PR_IpAddrLoopback, 0, &selfAddr); /* BugZilla: 35408 */
     if (PR_Bind(listenSock, &selfAddr) == PR_FAILURE) {
         goto failed;
     }
     if (PR_GetSockName(listenSock, &selfAddr) == PR_FAILURE) {
         goto failed;
     }
     port = ntohs(selfAddr.inet.port);
     if (PR_Listen(listenSock, 5) == PR_FAILURE) {
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -59,17 +59,18 @@
 #endif /* XP_UNIX */
 
 #define _PR_DEFAULT_LD_FLAGS PR_LD_LAZY
 
 /*
  * On these platforms, symbols have a leading '_'.
  */
 #if defined(SUNOS4) || defined(RHAPSODY) || defined(NEXTSTEP) \
-    || defined(OPENBSD) || defined(WIN16) || defined(NETBSD)
+    || defined(OPENBSD) || defined(WIN16) \
+    || (defined(NETBSD) && !defined(__ELF__))
 #define NEED_LEADING_UNDERSCORE
 #endif
 
 #ifdef XP_PC
 typedef PRStaticLinkTable *NODL_PROC(void);
 #endif
 
 /************************************************************************/
@@ -475,38 +476,43 @@ PR_LoadLibrary(const char *name)
 ** Dynamically load a library. Only load libraries once, so scan the load
 ** map first.
 */
 static PRLibrary*
 pr_LoadLibraryByPathname(const char *name, PRIntn flags)
 {
     PRLibrary *lm;
     PRLibrary* result;
+    PRInt32 oserr;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     /* See if library is already loaded */
     PR_EnterMonitor(pr_linker_lock);
 
     result = pr_UnlockedFindLibrary(name);
     if (result != NULL) goto unlock;
 
     lm = PR_NEWZAP(PRLibrary);
-    if (lm == NULL) goto unlock;
+    if (lm == NULL) {
+        oserr = _MD_ERRNO();
+        goto unlock;
+    }
     lm->staticTable = NULL;
 
 #ifdef XP_OS2  /* Why isn't all this stuff in MD code?! */
     {
         HMODULE h;
         UCHAR pszError[_MAX_PATH];
         ULONG ulRc = NO_ERROR;
 
         retry:
               ulRc = DosLoadModule(pszError, _MAX_PATH, (PSZ) name, &h);
           if (ulRc != NO_ERROR) {
+              oserr = ulRc;
               PR_DELETE(lm);
               goto unlock;
           }
           lm->name = strdup(name);
           lm->dlh  = h;
           lm->next = pr_loadmap;
           pr_loadmap = lm;
     }
@@ -514,16 +520,17 @@ pr_LoadLibraryByPathname(const char *nam
 
 #if defined(WIN32) || defined(WIN16)
     {
     HINSTANCE h;
     NODL_PROC *pfn;
 
     h = LoadLibrary(name);
     if (h < (HINSTANCE)HINSTANCE_ERROR) {
+        oserr = _MD_ERRNO();
         PR_DELETE(lm);
         goto unlock;
     }
     lm->name = strdup(name);
     lm->dlh = h;
     lm->next = pr_loadmap;
     pr_loadmap = lm;
 
@@ -533,17 +540,17 @@ pr_LoadLibraryByPathname(const char *nam
 
         pfn = (NODL_PROC *)GetProcAddress(h, "NODL_TABLE");
         if (pfn != NULL) {
             lm->staticTable = (*pfn)();
         }
     }
 #endif /* WIN32 || WIN16 */
 
-#if defined(XP_MAC) && GENERATINGCFM
+#if defined(XP_MAC) && TARGET_RT_MAC_CFM
     {
     OSErr                err;
     Ptr                    main;
     CFragConnectionID    connectionID;
     Str255                errName;
     Str255                pName;
     char                cName[64];
     const char*                libName;
@@ -557,17 +564,17 @@ pr_LoadLibraryByPathname(const char *nam
      * library name can not contain a ":", we can test for the
      * presence of a ":" to see which type of library we should load.
      * or its a full UNIX path which we for now assume is Java
      * enumerating all the paths (see below)
      */
     if (strchr(name, PR_PATH_SEPARATOR) == NULL)
     {
         if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL)
-    {
+        {
         /*
          * The name did not contain a ":", so it must be a
          * library name.  Convert the name to a Pascal string
          * and try to find the library.
          */
         }
         else
         {
@@ -589,17 +596,20 @@ pr_LoadLibraryByPathname(const char *nam
          */
 #if 0
         err = NSGetSharedLibrary(pName, &connectionID, &main);
 #else
         err = GetSharedLibrary(pName, kCompiledCFragArch, kReferenceCFrag,
                 &connectionID, &main, errName);
 #endif
         if (err != noErr)
+        {
+            oserr = err;
             goto unlock;    
+        }
         
         libName = name;
     }
     else    
     {
         /*
          * The name did contain a ":", so it must be a full path name.
          * Now we have to do a lot of work to convert the path name to
@@ -619,17 +629,20 @@ pr_LoadLibraryByPathname(const char *nam
         CInfoPBRec pb;
         FSSpec fileSpec;
         PRUint32 index;
         Boolean tempUnusedBool;
 
         /* Copy the name: we'll change it */
         cMacPath = strdup(name);    
         if (cMacPath == NULL)
+        {
+            oserr = _MD_ERRNO();
             goto unlock;
+        }
             
         /* First, get the vRefNum */
         position = strchr(cMacPath, PR_PATH_SEPARATOR);
         if ((position == cMacPath) || (position == NULL))
             fileSpec.vRefNum = 0;        /* Use application relative searching */
         else
         {
             char cVolName[32];
@@ -641,62 +654,70 @@ pr_LoadLibraryByPathname(const char *nam
         /* Next, break the path and file name apart */
         index = 0;
         while (cMacPath[index] != 0)
             index++;
         while (cMacPath[index] != PR_PATH_SEPARATOR && index > 0)
             index--;
         if (index == 0 || index == strlen(cMacPath))
         {
+            oserr = _MD_ERRNO();
             PR_DELETE(cMacPath);
             goto unlock;
         }
         cMacPath[index] = 0;
         cFileName = &(cMacPath[index + 1]);
         
         /* Convert the path and name into Pascal strings */
-        strcpy((char*) &pName, cMacPath);
-        c2pstr((char*) &pName);
-        strcpy((char*) &fileSpec.name, cFileName);
-        c2pstr((char*) &fileSpec.name);
+        PStrFromCStr(cMacPath, pName);
+        PStrFromCStr(cFileName, fileSpec.name);
         strcpy(cName, cFileName);
         PR_DELETE(cMacPath);
         cMacPath = NULL;
         
         /* Now we can look up the path on the volume */
         pb.dirInfo.ioNamePtr = pName;
         pb.dirInfo.ioVRefNum = fileSpec.vRefNum;
         pb.dirInfo.ioDrDirID = 0;
         pb.dirInfo.ioFDirIndex = 0;
         err = PBGetCatInfoSync(&pb);
         if (err != noErr)
+        {
+            oserr = err;
             goto unlock;
+        }
         fileSpec.parID = pb.dirInfo.ioDrDirID;
 
         /* Resolve an alias if this was one */
         err = ResolveAliasFile(&fileSpec, true, &tempUnusedBool,
                 &tempUnusedBool);
         if (err != noErr)
+        {
+            oserr = err;
             goto unlock;
+        }
 
         /* Finally, try to load the library */
         err = GetDiskFragment(&fileSpec, 0, kCFragGoesToEOF, fileSpec.name, 
                         kLoadCFrag, &connectionID, &main, errName);
 
         libName = cName;
         if (err != noErr)
+        {
+            oserr = err;
             goto unlock;
+        }
     }
     
     lm->name = strdup(libName);
     lm->dlh = connectionID;
     lm->next = pr_loadmap;
     pr_loadmap = lm;
     }
-#elif defined(XP_MAC) && !GENERATINGCFM
+#elif defined(XP_MAC) && !TARGET_RT_MAC_CFM
     {
 
     }
 #endif
 
 #ifdef XP_UNIX
 #ifdef HAVE_DLL
     {
@@ -729,22 +750,23 @@ pr_LoadLibraryByPathname(const char *nam
     }
     /* No equivalent of PR_LD_GLOBAL and PR_LD_LOCAL. */
     h = shl_load(name, shl_flags, 0L);
 #elif defined(USE_MACH_DYLD)
     NSObjectFileImage ofi;
     NSModule h = NULL;
     if (NSCreateObjectFileImageFromFile(name, &ofi)
             == NSObjectFileImageSuccess) {
-        h = NSLinkModule(ofi, name, TRUE);
+        h = NSLinkModule(ofi, name, NSLINKMODULE_OPTION_PRIVATE);
     }
 #else
 #error Configuration error
 #endif
     if (!h) {
+        oserr = _MD_ERRNO();
         PR_DELETE(lm);
         goto unlock;
     }
     lm->name = strdup(name);
     lm->dlh = h;
     lm->next = pr_loadmap;
     pr_loadmap = lm;
     }
@@ -764,36 +786,34 @@ pr_LoadLibraryByPathname(const char *nam
 			h = info.id;
 			lm->refCount++;	/* it has been already loaded implcitly, so pretend it already had a control structure and ref */
 		}
 
 	if(h == B_ERROR)
 		h = load_add_on( name );
 
 	if( h == B_ERROR || h <= 0 ) {
-	    h = 0;
-	    result = NULL;
+	    oserr = h;
 	    PR_DELETE( lm );
-	    lm = NULL;
 	    goto unlock;
 	}
 	lm->name = strdup(name);
 	lm->dlh = (void*)h;
 	lm->next = pr_loadmap;
 	pr_loadmap = lm;
     }
 #endif
 
     result = lm;    /* success */
     PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", lm->name));
 
   unlock:
     if (result == NULL) {
-        PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO());
-        DLLErrorInternal(_MD_ERRNO());  /* sets error text */
+        PR_SetError(PR_LOAD_LIBRARY_ERROR, oserr);
+        DLLErrorInternal(oserr);  /* sets error text */
     }
     PR_ExitMonitor(pr_linker_lock);
     return result;
 }
 
 PR_IMPLEMENT(PRLibrary*) 
 PR_FindLibrary(const char *name)
 {
@@ -971,17 +991,17 @@ PR_UnloadLibrary(PRLibrary *lib)
 #endif /* XP_UNIX */
 #ifdef XP_PC
     if (lib->dlh) {
         FreeLibrary((HINSTANCE)(lib->dlh));
         lib->dlh = (HINSTANCE)NULL;
     }
 #endif  /* XP_PC */
 
-#if defined(XP_MAC) && GENERATINGCFM
+#if defined(XP_MAC) && TARGET_RT_MAC_CFM
     /* Close the connection */
     CloseConnection(&(lib->dlh));
 #endif
 
     /* unlink from library search list */
     if (pr_loadmap == lib)
     pr_loadmap = pr_loadmap->next;
     else if (pr_loadmap != NULL) {
@@ -1078,17 +1098,24 @@ pr_FindSymbolInLib(PRLibrary *lm, const 
 #ifdef HAVE_DLL
 #ifdef USE_DLFCN
     f = dlsym(lm->dlh, name);
 #elif defined(USE_HPSHL)
     if (shl_findsym(&lm->dlh, name, TYPE_PROCEDURE, &f) == -1) {
         f = NULL;
     }
 #elif defined(USE_MACH_DYLD)
-    f = NSAddressOfSymbol(NSLookupAndBindSymbol(name));
+    {
+        NSSymbol symbol;
+        symbol = NSLookupSymbolInModule(lm->dlh, name);
+        if (symbol != NULL)
+            f = NSAddressOfSymbol(symbol);
+        else
+            f = NULL;
+    }
 #endif
 #endif /* HAVE_DLL */
 #endif /* XP_UNIX */
     if (f == NULL) {
         PR_SetError(PR_FIND_SYMBOL_ERROR, _MD_ERRNO());
         DLLErrorInternal(_MD_ERRNO());
     }
     return f;
--- a/pr/src/md/mac/macdll.c
+++ b/pr/src/md/mac/macdll.c
@@ -525,16 +525,25 @@ OSErr NSLoadIndexedFragment(const FSSpec
 	Str255		errName;
 	OSErr			err;
 
 	*outFragName = NULL;
 	
 	err = GetIndexedFragmentOffsets(fileSpec, fragmentIndex, &fragOffset, &fragLength, &fragNameBlock);
 	if (err != noErr) return err;
 				
+	if (fragNameBlock)
+	{
+		UInt32 nameLen = strlen(fragNameBlock);
+		if (nameLen > 63)
+			nameLen = 63;
+		BlockMoveData(fragNameBlock, &fragName[1], nameLen);
+		fragName[0] = nameLen;
+	}
+
 	err = GetDiskFragment(fileSpec, fragOffset, fragLength, fragName, 
 					kLoadCFrag, outConnectionID, &main, errName);
 	if (err != noErr)
 	{
 		free(fragNameBlock);
 		return err;
 	}
 
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -24,16 +24,22 @@
 #include <Gestalt.h>
 #include <OpenTransport.h>
 #include <OSUtils.h>
 
 #define GESTALT_OPEN_TPT_PRESENT        gestaltOpenTptPresentMask
 #define GESTALT_OPEN_TPT_TCP_PRESENT    gestaltOpenTptTCPPresentMask
 
 #include <OpenTptInternet.h>    // All the internet typedefs
+
+#if (UNIVERSAL_INTERFACES_VERSION >= 0x0330)
+// for some reason Apple removed this typedef.
+typedef struct OTConfiguration	OTConfiguration;
+#endif
+
 #include "primpl.h"
 
 typedef enum SndRcvOpCode {
     kSTREAM_SEND,
     kSTREAM_RECEIVE,
     kDGRAM_SEND,
     kDGRAM_RECEIVE
 } SndRcvOpCode;
@@ -43,45 +49,41 @@ static struct {
 	InetSvcRef  serviceRef;
 	PRThread *  thread;
 	void *      cookie;
 } dnsContext;
 
 static PRBool gOTInitialized;
 
 static pascal void  DNSNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie);
-static pascal void  NotifierRoutine(void * contextPtr, OTEventCode code, 
-            OTResult result, void * cookie);
+static pascal void  NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie);
+static pascal void  RawEndpointNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie);
 
 static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PRBool *exceptReady);
 
 extern void WaitOnThisThread(PRThread *thread, PRIntervalTime timeout);
 extern void DoneWaitingOnThisThread(PRThread *thread);
 
 #if TARGET_CARBON
 OTClientContextPtr  clientContext = NULL;
 
-OTNotifyUPP	DNSNotifierRoutineUPP;
-OTNotifyUPP notifierRoutineUPP;
-
-#define DNS_NOTIFIER_ROUTINE	DNSNotifierRoutineUPP
-#define NOTIFIER_ROUTINE		notifierRoutineUPP
-#define INIT_OPEN_TRANSPORT()	InitOpenTransport(clientContext, kInitOTForExtensionMask)
-#define OT_OPEN_INTERNET_SERVICES(config, flags, err)	OTOpenInternetServices(config, flags, err, clientContext)
-#define OT_OPEN_ENDPOINT(config, flags, info, err)		OTOpenEndpoint(config, flags, info, err, clientContext)
+#define INIT_OPEN_TRANSPORT()	InitOpenTransportInContext(kInitOTForExtensionMask, &clientContext)
+#define OT_OPEN_INTERNET_SERVICES(config, flags, err)	OTOpenInternetServicesInContext(config, flags, err, clientContext)
+#define OT_OPEN_ENDPOINT(config, flags, info, err)		OTOpenEndpointInContext(config, flags, info, err, clientContext)
 
 #else
 
-#define DNS_NOTIFIER_ROUTINE	DNSNotifierRoutine
-#define NOTIFIER_ROUTINE		NotifierRoutine
 #define INIT_OPEN_TRANSPORT()	InitOpenTransport()
 #define OT_OPEN_INTERNET_SERVICES(config, flags, err)	OTOpenInternetServices(config, flags, err)
 #define OT_OPEN_ENDPOINT(config, flags, info, err)		OTOpenEndpoint(config, flags, info, err)
 #endif /* TARGET_CARBON */
 
+static OTNotifyUPP	DNSNotifierRoutineUPP;
+static OTNotifyUPP NotifierRoutineUPP;
+static OTNotifyUPP RawEndpointNotifierRoutineUPP;
 
 void _MD_InitNetAccess()
 {
     OSErr       err;
     OSStatus    errOT;
     PRBool      hasOTTCPIP = PR_FALSE;
     PRBool      hasOT = PR_FALSE;
     long        gestaltResult;
@@ -92,24 +94,19 @@ void _MD_InitNetAccess()
             hasOT = PR_TRUE;
     
     if (hasOT)
         if (gestaltResult & GESTALT_OPEN_TPT_TCP_PRESENT)
             hasOTTCPIP = PR_TRUE;
         
     PR_ASSERT(hasOTTCPIP == PR_TRUE);
 
-#if TARGET_CARBON
     DNSNotifierRoutineUPP	=  NewOTNotifyUPP(DNSNotifierRoutine);
-    notifierRoutineUPP		=  NewOTNotifyUPP(NotifierRoutine);
-
-    errOT = OTAllocClientContext((UInt32)0, &clientContext);
-    PR_ASSERT(err == kOTNoError);
-#endif
-
+    NotifierRoutineUPP		=  NewOTNotifyUPP(NotifierRoutine);
+    RawEndpointNotifierRoutineUPP = NewOTNotifyUPP(RawEndpointNotifierRoutine);
 
     errOT = INIT_OPEN_TRANSPORT();
     PR_ASSERT(err == kOTNoError);
 
 	dnsContext.lock = PR_NewLock();
 	PR_ASSERT(dnsContext.lock != NULL);
 
 	dnsContext.thread = _PR_MD_CURRENT_THREAD();
@@ -124,28 +121,28 @@ static void _MD_FinishInitNetAccess()
 {
     OSStatus    errOT;
 
     dnsContext.serviceRef = OT_OPEN_INTERNET_SERVICES(kDefaultInternetServicesPath, NULL, &errOT);
     if (errOT != kOTNoError) return;    /* no network -- oh well */
     PR_ASSERT((dnsContext.serviceRef != NULL) && (errOT == kOTNoError));
 
     /* Install notify function for DNR Address To String completion */
-    errOT = OTInstallNotifier(dnsContext.serviceRef, DNS_NOTIFIER_ROUTINE, &dnsContext);
+    errOT = OTInstallNotifier(dnsContext.serviceRef, DNSNotifierRoutineUPP, &dnsContext);
     PR_ASSERT(errOT == kOTNoError);
 
     /* Put us into async mode */
     errOT = OTSetAsynchronous(dnsContext.serviceRef);
     PR_ASSERT(errOT == kOTNoError);
     
     gOTInitialized = PR_TRUE;
 }
 
 
-pascal void  DNSNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
+static pascal void  DNSNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
 {
 #pragma unused(contextPtr)
     _PRCPU *    cpu    = _PR_MD_CURRENT_CPU(); 
 	
 	if (code == T_DNRSTRINGTOADDRCOMPLETE) {
 		dnsContext.thread->md.osErrCode = result;
 		dnsContext.cookie = cookie;
 		if (_PR_MD_GET_INTSOFF()) {
@@ -257,17 +254,17 @@ WakeUpNotifiedThread(PRThread *thread, O
 		}
 		DoneWaitingOnThisThread(thread);
 	}
 }
 
 // Notification routine
 // Async callback routine.
 // A5 is OK. Cannot allocate memory here
-pascal void  NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
+static pascal void  NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
 {
 	PRFilePrivate *secret  = (PRFilePrivate *) contextPtr;
 	_MDFileDesc * md       = &(secret->md);
 	EndpointRef   endpoint = (EndpointRef)secret->md.osfd;
     PRThread *    thread   = NULL;
 	OSStatus      err;
 	OTResult	  resultOT;
     TDiscon		  discon;
@@ -1032,17 +1029,17 @@ typedef struct RawEndpointAndThread
 {
 	PRThread *  thread;
 	EndpointRef endpoint;
 } RawEndpointAndThread;
 
 // Notification routine for raw endpoints not yet attached to a PRFileDesc.
 // Async callback routine.
 // A5 is OK. Cannot allocate memory here
-pascal void  RawEndpointNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
+static pascal void  RawEndpointNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
 {
 	RawEndpointAndThread *endthr = (RawEndpointAndThread *) contextPtr;
     PRThread *    thread   = endthr->thread;
     EndpointRef * endpoint = endthr->endpoint;
     _PRCPU *      cpu      = _PR_MD_CURRENT_CPU(); 
 	OSStatus      err;
 	OTResult	  resultOT;
 
@@ -1189,17 +1186,17 @@ PRInt32 _MD_accept(PRFileDesc *fd, PRNet
     if (newosfd == -1)
         return -1;
             
 	// Attach the raw endpoint handler to this endpoint for now.
 	endthr = (RawEndpointAndThread *) PR_Malloc(sizeof(RawEndpointAndThread));
 	endthr->thread = me;
 	endthr->endpoint = (EndpointRef) newosfd;
 	
-	err = OTInstallNotifier((ProviderRef) newosfd, RawEndpointNotifierRoutine, endthr);
+	err = OTInstallNotifier((ProviderRef) newosfd, RawEndpointNotifierRoutineUPP, endthr);
     PR_ASSERT(err == kOTNoError);
     
 	err = OTSetAsynchronous((EndpointRef) newosfd);
 	PR_ASSERT(err == kOTNoError);
 
     // Bind to a local port; let the system assign it.
     bindAddr.inet.family = AF_INET;
     bindAddr.inet.port = bindAddr.inet.ip = 0;
@@ -1345,32 +1342,28 @@ static PRInt32 SendReceiveStream(PRFileD
 {
     OSStatus err;
     OTResult result;
     EndpointRef endpoint = (EndpointRef) fd->secret->md.osfd;
     PRThread *me = _PR_MD_CURRENT_THREAD();
     PRInt32 bytesLeft = amount;
 
     PR_ASSERT(flags == 0);
+    PR_ASSERT(opCode == kSTREAM_SEND || opCode == kSTREAM_RECEIVE);
     
     if (endpoint == NULL) {
         err = kEBADFErr;
         goto ErrorExit;
     }
         
     if (buf == NULL) {
         err = kEFAULTErr;
         goto ErrorExit;
     }
     
-    if (opCode != kSTREAM_SEND && opCode != kSTREAM_RECEIVE) {
-        err = kEINVALErr;
-        goto ErrorExit;
-    }
-        
     while (bytesLeft > 0) {
     
         PrepareForAsyncCompletion(me, fd->secret->md.osfd);    
 
         if (opCode == kSTREAM_SEND) {
         	do {
 
 				fd->secret->md.write.thread = me;
@@ -1429,16 +1422,20 @@ static PRInt32 SendReceiveStream(PRFileD
   			   		PrepareForAsyncCompletion(me, fd->secret->md.osfd);  
 				}
 			}
 			// Retry read if we had to wait for data to show up.
 			while(1);
         }
 
 		me->io_pending = PR_FALSE;
+        if (opCode == kSTREAM_SEND)
+            fd->secret->md.write.thread = nil;
+        else
+            fd->secret->md.read.thread  = nil;
 
         if (result > 0) {
             buf = (void *) ( (UInt32) buf + (UInt32)result );
             bytesLeft -= result;
             if (opCode == kSTREAM_RECEIVE)
                 return result;
         } else {
 			switch (result) {
@@ -1466,19 +1463,23 @@ static PRInt32 SendReceiveStream(PRFileD
 					
 				default:
 					err = result;
 					goto ErrorExit;
 			}
 		}
     }
 
+    PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == nil :
+                                       fd->secret->md.read.thread  == nil);
     return amount;
 
 ErrorExit:
+    PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == nil :
+                                       fd->secret->md.read.thread  == nil);
     macsock_map_error(err);
     return -1;
 }                               
 
 
 PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, 
                                PRIntn flags, PRIntervalTime timeout)
 {
@@ -1784,17 +1785,17 @@ void _MD_makenonblock(PRFileDesc *fd)
 	OSStatus	err;
 	
 	// Install fd->secret as the contextPtr for the Notifier function associated with this 
 	// endpoint. We use this instead of the fd itself because:
 	//            (a) in cases where you import I/O layers, the containing 
 	//                fd changes, but the secret structure does not;
 	//            (b) the notifier func refers only to the secret data structure
 	//                anyway.
-	err = OTInstallNotifier(endpointRef, NOTIFIER_ROUTINE, fd->secret);
+	err = OTInstallNotifier(endpointRef, NotifierRoutineUPP, fd->secret);
 	PR_ASSERT(err == kOTNoError);
 	
 	// Now that we have a NotifierRoutine installed, we can make the endpoint asynchronous
 	err = OTSetAsynchronous(endpointRef);
 	PR_ASSERT(err == kOTNoError);
 }
 
 
@@ -1861,17 +1862,18 @@ PR_IMPLEMENT(unsigned long) inet_addr(co
 {
     OSStatus err;
     InetHost host;    
 
     if (!gOTInitialized)
     	_MD_FinishInitNetAccess();
 
     err = OTInetStringToHost((char*) cp, &host);
-    PR_ASSERT(err == kOTNoError);
+    if (err != kOTNoError)
+        return -1;
     
     return host;
 }
 
 
 static char *sAliases[1] = {NULL};
 static struct hostent sHostEnt = {NULL, &sAliases[0], AF_INET, sizeof (long), NULL};
 static InetHostInfo sHostInfo;
--- a/pr/src/md/mac/mdmac.c
+++ b/pr/src/md/mac/mdmac.c
@@ -339,17 +339,17 @@ void PR_InitMemory(void) {
 //	THIS IS *** VERY *** IMPORTANT... our CFM Termination proc.
 //	This allows us to deactivate our Time Mananger task even
 //	if we are not totally gracefully exited.  If this is not
 //	done then we will randomly crash at later times when the
 //	task is called after the app heap is gone.
 
 #if TARGET_CARBON
 extern OTClientContextPtr	clientContext;
-#define CLOSE_OPEN_TRANSPORT()	CloseOpenTransport(clientContext)
+#define CLOSE_OPEN_TRANSPORT()	CloseOpenTransportInContext(clientContext)
 
 #else
 
 #define CLOSE_OPEN_TRANSPORT()	CloseOpenTransport()
 #endif /* TARGET_CARBON */
 
 extern pascal void __NSTerminate(void);
 
@@ -734,16 +734,16 @@ extern long _MD_GetOSVersion(char *buf, 
 
 	return 0;
 }
 
 extern long _MD_GetArchitecture(char *buf, long count)
 {
 	long	len;
 	
-#if defined(GENERATINGPOWERPC) && GENERATINGPOWERPC	
+#if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC	
 	len = PR_snprintf(buf, count, "PowerPC");
 #else
 	len = PR_snprintf(buf, count, "Motorola68k");
 #endif
 
 	return 0;
 }
--- a/pr/src/md/mac/prcpucfg.h
+++ b/pr/src/md/mac/prcpucfg.h
@@ -107,11 +107,11 @@
 #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 /* NO_NSPR_10_SUPPORT */
 
 #endif /* nspr_cpucfg___ */
--- a/pr/src/md/os2/os2io.c
+++ b/pr/src/md/os2/os2io.c
@@ -9,16 +9,33 @@
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  * for the specific language governing rights and limitations under the
  * NPL.
  * 
  * The Initial Developer of this code under the NPL is Netscape
  * Communications Corporation.  Portions created by Netscape are
  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  * Reserved.
+ *
+ * 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.
  *
  */
 
@@ -102,35 +119,50 @@ PRStatus
  *  as in 0666, in the case of opening the logFile. 
  *
  */
 PRInt32
 _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
 {
     HFILE file;
     PRInt32 access = OPEN_SHARE_DENYNONE;
-    PRInt32 flags = OPEN_ACTION_OPEN_IF_EXISTS;
+    PRInt32 flags = 0L;
     PRInt32 rc;
     PRUword actionTaken;
 
     ULONG CurMaxFH = 0;
     LONG ReqCount = 1;
     ULONG fattr;
- 
+
+    if (osflags & PR_SYNC) access |= OPEN_FLAGS_WRITE_THROUGH;
+
     if (osflags & PR_RDONLY)
         access |= OPEN_ACCESS_READONLY;
     else if (osflags & PR_WRONLY)
         access |= OPEN_ACCESS_WRITEONLY;
     else if(osflags & PR_RDWR)
         access |= OPEN_ACCESS_READWRITE;
-    if (osflags & PR_CREATE_FILE)
-        flags |= OPEN_ACTION_CREATE_IF_NEW;
-    else if (osflags & PR_TRUNCATE){
-        flags &= ~OPEN_ACTION_OPEN_IF_EXISTS;
-        flags |= OPEN_ACTION_REPLACE_IF_EXISTS;
+
+    if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL )
+    {
+        flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS;
+    }
+    else if (osflags & PR_CREATE_FILE)
+    {
+        if (osflags & PR_TRUNCATE)
+            flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS;
+        else
+            flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;
+    } 
+    else
+    {
+        if (osflags & PR_TRUNCATE)
+            flags = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS;
+        else
+            flags = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;
     }
 
     if (isxdigit(mode) == 0) /* file attribs are hex, UNIX modes octal */
       fattr = ((ULONG)mode == FILE_HIDDEN) ? FILE_HIDDEN : FILE_NORMAL;
     else fattr = FILE_NORMAL;
 
     /* OS/2 sets the Max file handles per process to 20 by default */
     DosSetRelMaxFH(&ReqCount, &CurMaxFH);
@@ -177,33 +209,26 @@ PRInt32
 }
 
 PRInt32
 _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len)
 {
     PRInt32 bytes;
     int rv; 
 
-    /* No longer using DosWrite since it doesn't convert \n to \n\r like C runtime does */
-#if 0
     rv = DosWrite((HFILE)fd->secret->md.osfd,
                   (PVOID)buf,
                   len,
-                  &bytes);
+                  (PULONG)&bytes);
 
     if (rv != NO_ERROR) 
     {
-		_PR_MD_MAP_WRITE_ERROR(rv);
+        _PR_MD_MAP_WRITE_ERROR(rv);
         return -1;
     }
-#else
-    bytes = write(fd->secret->md.osfd, buf, len);
-    if (bytes == -1) 
-       _PR_MD_MAP_WRITE_ERROR(errno);
-#endif
 
     return bytes;
 } /* --- end _PR_MD_WRITE() --- */
 
 PRInt32
 _PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence)
 {
     PRInt32 rv;
@@ -713,17 +738,17 @@ PRStatus
 
     rv = DosQueryFHState((HFILE)fd->secret->md.osfd, &flags);
     if (rv != 0) {
         PR_SetError(PR_UNKNOWN_ERROR, _MD_ERRNO());
         return PR_FAILURE;
     }
 
     if (inheritable)
-      flags &= OPEN_FLAGS_NOINHERIT;
+      flags &= ~OPEN_FLAGS_NOINHERIT;
     else
       flags |= OPEN_FLAGS_NOINHERIT;
 
     rv = DosSetFHState((HFILE)fd->secret->md.osfd, flags);
     if (rv != 0) {
         PR_SetError(PR_UNKNOWN_ERROR, _MD_ERRNO());
         return PR_FAILURE;
     }
--- a/pr/src/md/unix/Makefile
+++ b/pr/src/md/unix/Makefile
@@ -232,16 +232,22 @@ ifeq ($(OS_ARCH),SunOS)
             ifneq ($(USE_64),1)
             ASFILES += os_$(OS_ARCH)_32.s
             endif
         endif
     endif
     endif
 endif
 
+ifeq ($(OS_ARCH),Linux)
+    ifeq ($(CPU_ARCH),x86)
+        ASFILES   = os_Linux_x86.s
+    endif
+endif
+
 ifeq ($(OS_ARCH), SINIX)
     ifeq ($(CPU_ARCH),mips)
         ASFILES   = os_ReliantUNIX.s
     endif
 endif
 
 ifeq ($(OS_ARCH)$(OS_RELEASE),BSD_OS2.1)
     ASFILES = os_BSD_386_2.s
--- a/pr/src/md/unix/Makefile.in
+++ b/pr/src/md/unix/Makefile.in
@@ -243,16 +243,22 @@ ifeq ($(OS_ARCH),SunOS)
             ifneq ($(USE_64),1)
             ASFILES += os_$(OS_ARCH)_32.s
             endif
         endif
     endif
     endif
 endif
 
+ifeq ($(OS_ARCH),Linux)
+    ifeq ($(CPU_ARCH),x86)
+        ASFILES   = os_Linux_x86.s
+    endif
+endif
+
 ifeq ($(OS_ARCH), SINIX)
     ifeq ($(CPU_ARCH),mips)
         ASFILES   = os_ReliantUNIX.s
     endif
 endif
 
 ifeq ($(OS_ARCH)$(OS_RELEASE),BSD_OS2.1)
     ASFILES = os_BSD_386_2.s
--- a/pr/src/md/unix/darwin.c
+++ b/pr/src/md/unix/darwin.c
@@ -82,18 +82,37 @@ PRStatus
     PRThreadState state,
     PRUint32 stackSize)
 {
     PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for Rhapsody.");
 	return PR_FAILURE;
 }
 #endif /* ! _PR_PTHREADS */
 
+#if defined(_PR_PTHREADS)
+
 /*
-** Whoops, we don't have a syscall stub for this
+** Stubs for unimplemented functions
 */
-int mprotect (caddr_t addr, size_t size, int prot)
+
+int pthread_condattr_init(pthread_condattr_t *attr)
+{
+    return 0;
+}
+
+int pthread_kill(pthread_t thread, int sig)
 {
-   return -1;
-} 
+    return ENOSYS;
+}
+
+typedef struct siginfo_t siginfo_t;
+
+int sigtimedwait(const sigset_t *set, siginfo_t *info,
+    const struct timespec *timeout)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+#endif /* _PR_PTHREADS */
 
 /* rhapsody.c */
 
--- a/pr/src/md/unix/objs.mk
+++ b/pr/src/md/unix/objs.mk
@@ -230,16 +230,22 @@ ifeq ($(OS_ARCH),SunOS)
             ifneq ($(USE_64),1)
             ASFILES += os_$(OS_ARCH)_32.s
             endif
         endif
     endif
     endif
 endif
 
+ifeq ($(OS_ARCH),Linux)
+    ifeq ($(CPU_ARCH),x86)
+        ASFILES   = os_Linux_x86.s
+    endif
+endif
+
 ifeq ($(OS_ARCH), SINIX)
     ifeq ($(CPU_ARCH),mips)
         ASFILES   = os_ReliantUNIX.s
     endif
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
     ASFILES   = os_HPUX.s
new file mode 100644
--- /dev/null
+++ b/pr/src/md/unix/os_Linux_x86.s
@@ -0,0 +1,95 @@
+/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/
+/ The contents of this file are subject to the Netscape Public License
+/ Version 1.1 (the "NPL"); you may not use this file except in
+/ compliance with the NPL.  You may obtain a copy of the NPL at
+/ http://www.mozilla.org/NPL/
+/ 
+/ Software distributed under the NPL is distributed on an "AS IS" basis,
+/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+/ for the specific language governing rights and limitations under the
+/ NPL.
+/ 
+/ The Initial Developer of this code under the NPL is Netscape
+/ Communications Corporation.  Portions created by Netscape are
+/ Copyright (C) 2000 Netscape Communications Corporation.  All Rights
+/ Reserved.
+/
+
+/ PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
+/
+/ Atomically increment the integer pointed to by 'val' and return
+/ the result of the increment.
+/
+    .text
+    .globl _PR_x86_AtomicIncrement
+    .align 4
+_PR_x86_AtomicIncrement:
+    movl 4(%esp), %ecx
+    movl $1, %eax
+    lock
+    xaddl %eax, (%ecx)
+    incl %eax
+    ret
+
+/ PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
+/
+/ Atomically decrement the integer pointed to by 'val' and return
+/ the result of the decrement.
+/
+    .text
+    .globl _PR_x86_AtomicDecrement
+    .align 4
+_PR_x86_AtomicDecrement:
+    movl 4(%esp), %ecx
+    movl $-1, %eax
+    lock
+    xaddl %eax, (%ecx)
+    decl %eax
+    ret
+
+/ PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
+/
+/ Atomically set the integer pointed to by 'val' to the new
+/ value 'newval' and return the old value.
+/
+/ An alternative implementation:
+/   .text
+/   .globl _PR_x86_AtomicSet
+/   .align 4
+/_PR_x86_AtomicSet:
+/   movl 4(%esp), %ecx
+/   movl 8(%esp), %edx
+/   movl (%ecx), %eax
+/retry:
+/   lock
+/   cmpxchgl %edx, (%ecx)
+/   jne retry
+/   ret
+/
+    .text
+    .globl _PR_x86_AtomicSet
+    .align 4
+_PR_x86_AtomicSet:
+    movl 4(%esp), %ecx
+    movl 8(%esp), %eax
+    lock
+    xchgl %eax, (%ecx)
+    ret
+
+/ PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+/
+/ Atomically add 'val' to the integer pointed to by 'ptr'
+/ and return the result of the addition.
+/
+    .text
+    .globl _PR_x86_AtomicAdd
+    .align 4
+_PR_x86_AtomicAdd:
+    movl 4(%esp), %ecx
+    movl 8(%esp), %eax
+    movl %eax, %edx
+    lock
+    xaddl %eax, (%ecx)
+    addl %edx, %eax
+    ret
--- a/pr/src/md/unix/rhapsody.c
+++ b/pr/src/md/unix/rhapsody.c
@@ -82,18 +82,37 @@ PRStatus
     PRThreadState state,
     PRUint32 stackSize)
 {
     PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for Rhapsody.");
 	return PR_FAILURE;
 }
 #endif /* ! _PR_PTHREADS */
 
+#if defined(_PR_PTHREADS)
+
 /*
-** Whoops, we don't have a syscall stub for this
+** Stubs for unimplemented functions
 */
-int mprotect (caddr_t addr, size_t size, int prot)
+
+int pthread_condattr_init(pthread_condattr_t *attr)
+{
+    return 0;
+}
+
+int pthread_kill(pthread_t thread, int sig)
 {
-   return -1;
-} 
+    return ENOSYS;
+}
+
+typedef struct siginfo_t siginfo_t;
+
+int sigtimedwait(const sigset_t *set, siginfo_t *info,
+    const struct timespec *timeout)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+#endif /* _PR_PTHREADS */
 
 /* rhapsody.c */
 
--- a/pr/src/md/unix/uxproces.c
+++ b/pr/src/md/unix/uxproces.c
@@ -22,17 +22,21 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <sys/wait.h>
 #if defined(AIX)
 #include <dlfcn.h>  /* For dlopen, dlsym, dlclose */
 #endif
 
+#if defined(RHAPSODY)
+#include <crt_externs.h>
+#else
 extern char **environ;
+#endif
 
 /*
  * HP-UX 9 doesn't have the SA_RESTART flag.
  */
 #ifndef SA_RESTART
 #define SA_RESTART 0
 #endif
 
@@ -151,17 +155,21 @@ ForkAndExec(
     if (!process) {
         PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
         return NULL;
     }
 
     childEnvp = envp;
     if (attr && attr->fdInheritBuffer) {
         if (NULL == childEnvp) {
+#ifdef RHAPSODY
+            childEnvp = *(_NSGetEnviron());
+#else
             childEnvp = environ;
+#endif
         }
         for (nEnv = 0; childEnvp[nEnv]; nEnv++) {
         }
         newEnvp = (char **) PR_MALLOC((nEnv + 2) * sizeof(char *));
         if (NULL == newEnvp) {
             PR_DELETE(process);
             PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
             return NULL;
--- a/pr/src/md/unix/uxrng.c
+++ b/pr/src/md/unix/uxrng.c
@@ -256,17 +256,18 @@ GetHighResClock(void *buf, size_t maxbyt
 
 #elif defined(NEC)
 
 static size_t
 GetHighResClock(void *buf, size_t maxbytes)
 {
     return 0;
 }
-#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) || defined(QNX)
+#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) \
+    || defined(QNX) || defined(RHAPSODY)
 #include <sys/times.h>
 
 static size_t
 GetHighResClock(void *buf, size_t maxbytes)
 {
     int ticks;
     struct tms buffer;
 
--- a/pr/src/md/windows/ntio.c
+++ b/pr/src/md/windows/ntio.c
@@ -739,17 +739,17 @@ void _PR_Unblock_IO_Wait(PRThread *thr)
         PR_ASSERT(thr->flags & (_PR_ON_SLEEPQ | _PR_ON_PAUSEQ));
         _PR_SLEEPQ_LOCK(cpu);
         _PR_DEL_SLEEPQ(thr, PR_TRUE);
         _PR_SLEEPQ_UNLOCK(cpu);
 		/*
 		 * this thread will continue to run on the same cpu until the
 		 * I/O is aborted by closing the FD or calling CancelIO
 		 */
-		thr->md.thr_bound_cpu = me->cpu;
+		thr->md.thr_bound_cpu = cpu;
 
         PR_ASSERT(!(thr->flags & _PR_IDLE_THREAD));
         _PR_AddThreadToRunQ(me, thr);
     }
     _PR_THREAD_UNLOCK(thr);
     rv = _PR_MD_WAKEUP_WAITER(thr);
     PR_ASSERT(PR_SUCCESS == rv);
 }
@@ -2039,17 +2039,17 @@ PRStatus
                         SO_CONNECT_TIME,
                         (char *) &seconds,
                         (PINT) &bytes);
         if (rv == NO_ERROR) {
             if (seconds == 0xffffffff) {
                 PR_SetError(PR_NOT_CONNECTED_ERROR, 0);
                 return PR_FAILURE;
             }
-            *len = PR_NETADDR_SIZE(addr);
+            *len = PR_NETADDR_SIZE(&fd->secret->md.peer_addr);
             memcpy(addr, &fd->secret->md.peer_addr, *len);
             return PR_SUCCESS;
         } else {
             _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError());
             return PR_FAILURE;
         }
     } else { 
         rv = getpeername((SOCKET)fd->secret->md.osfd,
@@ -3011,17 +3011,20 @@ PRInt32
          * a root directory or a pathname that ends in a slash.
          */
         if (NULL == _mbspbrk(fn, ".\\/")) {
             _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
             return -1;
         } 
         len = GetFullPathName(fn, sizeof(pathbuf), pathbuf,
                 &filePart);
-        PR_ASSERT(0 != len);
+        if (0 == len) {
+            _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
+            return -1;
+        }
         if (len > sizeof(pathbuf)) {
             PR_SetError(PR_NAME_TOO_LONG_ERROR, 0);
             return -1;
         }
         if (IsRootDirectory(pathbuf, sizeof(pathbuf))) {
             info->type = PR_FILE_DIRECTORY;
             info->size = 0;
             /*
--- a/pr/src/md/windows/w95io.c
+++ b/pr/src/md/windows/w95io.c
@@ -768,17 +768,20 @@ PRInt32
          * a root directory or a pathname that ends in a slash.
          */
         if (NULL == _mbspbrk(fn, ".\\/")) {
             _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
             return -1;
         } 
         len = GetFullPathName(fn, sizeof(pathbuf), pathbuf,
                 &filePart);
-        PR_ASSERT(0 != len);
+        if (0 == len) {
+            _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
+            return -1;
+        }
         if (len > sizeof(pathbuf)) {
             PR_SetError(PR_NAME_TOO_LONG_ERROR, 0);
             return -1;
         }
         if (IsRootDirectory(pathbuf, sizeof(pathbuf))) {
             info->type = PR_FILE_DIRECTORY;
             info->size = 0;
             /*
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -858,17 +858,17 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByNumb
         }
 		PR_Unlock(_getproto_lock);
 	}
 #endif  /* all that crap */
     return rv;
 
 }
 
-PR_IMPLEMENT(PRUintn) PR_NetAddrSize(const PRNetAddr* addr)
+PRUintn _PR_NetAddrSize(const PRNetAddr* addr)
 {
     PRUintn addrsize;
 
     /*
      * RFC 2553 added a new field (sin6_scope_id) to
      * struct sockaddr_in6.  PRNetAddr's ipv6 member has a
      * scope_id field to match the new field.  In order to
      * work with older implementations supporting RFC 2133,
@@ -885,17 +885,17 @@ PR_IMPLEMENT(PRUintn) PR_NetAddrSize(con
 #endif
 #if defined(XP_UNIX)
     else if (AF_UNIX == addr->raw.family)
         addrsize = sizeof(addr->local);
 #endif
     else addrsize = 0;
 
     return addrsize;
-}  /* PR_NetAddrSize */
+}  /* _PR_NetAddrSize */
 
 PR_IMPLEMENT(PRIntn) PR_EnumerateHostEnt(
     PRIntn enumIndex, const PRHostEnt *hostEnt, PRUint16 port, PRNetAddr *address)
 {
     void *addr = hostEnt->h_addr_list[enumIndex++];
     memset(address, 0, sizeof(PRNetAddr));
     if (NULL == addr) enumIndex = 0;
     else
--- a/pr/src/misc/prthinfo.c
+++ b/pr/src/misc/prthinfo.c
@@ -135,29 +135,16 @@ PR_ThreadScanStackPointers(PRThread* t,
         return status;
 
     ptd = t->privateData;
     for (index = 0; index < t->tpdLength; index++, ptd++) {
         status = scanFun(t, (void**)ptd, 1, scanClosure);
         if (status != PR_SUCCESS)
             return status;
     }
-
-#ifdef GC_LEAK_DETECTOR
-    /*
-    ** if the thread was allocated on its own stack, conservatively
-    ** scan the thread object itself to keep all data structures
-    ** referenced by the thread visible to the garbage collector.
-    */
-    if (t->threadAllocatedOnStack) {
-        status = scanFun(t, (void**)t, (sizeof(PRThread) + 3) / sizeof(void*), scanClosure);
-        if (status != PR_SUCCESS)
-            return status;
-    }
-#endif
     
     return PR_SUCCESS;
 }
 
 /* transducer for PR_EnumerateThreads */
 typedef struct PRScanStackData {
     PRScanStackFun      scanFun;
     void*               scanClosure;
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -118,31 +118,31 @@ static ssize_t (*pt_aix_sendfile_fptr)()
 #if !(defined(LINUX) && defined(__alpha))
 #include <netinet/tcp.h>  /* TCP_NODELAY, TCP_MAXSEG */
 #endif
 
 #if defined(SOLARIS)
 #define _PRSockOptVal_t char *
 #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \
     || defined(LINUX) || defined(FREEBSD) || defined(BSDI) || defined(VMS) \
-    || defined(NTO) || defined(OPENBSD)
+    || defined(NTO) || defined(OPENBSD) || defined(RHAPSODY)
 #define _PRSockOptVal_t void *
 #else
 #error "Cannot determine architecture"
 #endif
 
 #if (defined(HPUX) && !defined(HPUX10_30) && !defined(HPUX11))
 #define _PRSelectFdSetArg_t int *
 #elif defined(AIX4_1)
 #define _PRSelectFdSetArg_t void *
 #elif defined(IRIX) || (defined(AIX) && !defined(AIX4_1)) \
     || defined(OSF1) || defined(SOLARIS) \
     || defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) \
     || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
-    || defined(BSDI) || defined(VMS) || defined(NTO)
+    || defined(BSDI) || defined(VMS) || defined(NTO) || defined(RHAPSODY)
 #define _PRSelectFdSetArg_t fd_set *
 #else
 #error "Cannot determine architecture"
 #endif
 
 static PRFileDesc *pt_SetMethods(
     PRIntn osfd, PRDescType type, PRBool isAcceptedSocket);
 
@@ -2419,17 +2419,18 @@ static PRIOMethods _pr_socketpollfd_meth
     (PRReservedFN)_PR_InvalidInt, 
     (PRReservedFN)_PR_InvalidInt, 
     (PRReservedFN)_PR_InvalidInt, 
     (PRReservedFN)_PR_InvalidInt
 };
 
 #if defined(HPUX) || defined(OSF1) || defined(SOLARIS) || defined (IRIX) \
     || defined(AIX) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) \
-    || defined(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO)
+    || defined(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO) \
+    || defined(RHAPSODY)
 #define _PR_FCNTL_FLAGS O_NONBLOCK
 #else
 #error "Can't determine architecture"
 #endif
 
 /*
  * Put a Unix file descriptor in non-blocking mode.
  */
--- a/pr/src/pthreads/ptsynch.c
+++ b/pr/src/pthreads/ptsynch.c
@@ -243,17 +243,17 @@ static PRIntn pt_TimedWait(
     return (rv == -1 && errno == EAGAIN) ? 0 : rv;
 #else
     return (rv == ETIMEDOUT) ? 0 : rv;
 #endif
 }  /* pt_TimedWait */
 
 
 /*
- * Notifies just get posted to the to the protecting mutex. The
+ * Notifies just get posted to the protecting mutex. The
  * actual notification is done when the lock is released so that
  * MP systems don't contend for a lock that they can't have.
  */
 static void pt_PostNotifyToCvar(PRCondVar *cvar, PRBool broadcast)
 {
     PRIntn index = 0;
     _PT_Notified *notified = &cvar->lock->notified;
 
@@ -644,16 +644,24 @@ PR_IMPLEMENT(PRSemaphore*) PR_NewSem(PRU
             }
             PR_DestroyLock(lock);
         }
         PR_DELETE(semaphore);
     }
     return NULL;
 }
 
+/*
+ * Define the interprocess named semaphore functions.
+ * There are three implementations:
+ * 1. POSIX semaphore based;
+ * 2. System V semaphore based;
+ * 3. unsupported (fails with PR_NOT_IMPLEMENTED_ERROR).
+ */
+
 #ifdef _PR_HAVE_POSIX_SEMAPHORES
 #include <fcntl.h>
 
 PR_IMPLEMENT(PRSem *) PR_OpenSemaphore(
     const char *name,
     PRIntn flags,
     PRIntn mode,
     PRUintn value)
@@ -745,19 +753,17 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphor
     if (0 != rv)
     {
         _PR_MD_MAP_DEFAULT_ERROR(errno);
         return PR_FAILURE;
     }
     return PR_SUCCESS;
 }
     
-#endif /* _PR_HAVE_POSIX_SEMAPHORES */
-
-#ifdef _PR_HAVE_SYSV_SEMAPHORES
+#elif defined(_PR_HAVE_SYSV_SEMAPHORES)
 
 #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)) \
@@ -956,17 +962,53 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphor
     if (semctl(semid, 0, IPC_RMID, unused) == -1)
     { 
         _PR_MD_MAP_DEFAULT_ERROR(errno);
         return PR_FAILURE;
     }
     return PR_SUCCESS;
 }
 
-#endif /* _PR_HAVE_SYSV_SEMAPHORES */
+#else /* neither POSIX nor System V semaphores are available */
+
+PR_IMPLEMENT(PRSem *) PR_OpenSemaphore(
+    const char *name,
+    PRIntn flags,
+    PRIntn mode,
+    PRUintn value)
+{
+    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+    return NULL;
+}
+
+PR_IMPLEMENT(PRStatus) PR_WaitSemaphore(PRSem *sem)
+{
+    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+    return PR_FAILURE;
+}
+
+PR_IMPLEMENT(PRStatus) PR_PostSemaphore(PRSem *sem)
+{
+    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+    return PR_FAILURE;
+}
+
+PR_IMPLEMENT(PRStatus) PR_CloseSemaphore(PRSem *sem)
+{
+    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+    return PR_FAILURE;
+}
+
+PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name)
+{
+    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+    return PR_FAILURE;
+}
+
+#endif /* end of interprocess named semaphore functions */
 
 /**************************************************************/
 /**************************************************************/
 /******************ROUTINES FOR DCE EMULATION******************/
 /**************************************************************/
 /**************************************************************/
 
 #include "prpdce.h"
--- a/pr/src/threads/combined/pruthr.c
+++ b/pr/src/threads/combined/pruthr.c
@@ -1243,16 +1243,24 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread
             thread = (PRThread*) top;
         /*
          * Make stack 64-byte aligned
          */
             if ((PRUptrdiff)top & 0x3f) {
                 top = (char*)((PRUptrdiff)top & ~0x3f);
             }
 #endif
+#if defined(GC_LEAK_DETECTOR)
+            /*
+             * sorry, it is not safe to allocate the thread on the stack,
+             * because we assign to this object before the GC can learn
+             * about this thread. we'll just leak thread objects instead.
+             */
+            thread = PR_NEW(PRThread);
+#endif
             stack->thr = thread;
             memset(thread, 0, sizeof(PRThread));
             thread->threadAllocatedOnStack = 1;
 #else
             thread = _PR_MD_CREATE_USER_THREAD(stackSize, start, arg);
             if (!thread) {
                 PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
                 return NULL;
--- a/pr/tests/Makefile
+++ b/pr/tests/Makefile
@@ -418,17 +418,17 @@ EXTRA_LIBS = -ldl
 endif
 endif
 
 ifeq ($(USE_PTHREADS),1)
 LIBPTHREAD = -lpthread
 ifeq ($(OS_ARCH),AIX)
 LIBPTHREAD = -lpthreads
 endif
-ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO,$(OS_ARCH)))
+ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Rhapsody,$(OS_ARCH)))
 LIBPTHREAD =
 endif
 ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
 LIBPTHREAD = -ldce
 endif
 endif
 
 #####################################################
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -420,17 +420,17 @@ EXTRA_LIBS = -ldl
 endif
 endif
 
 ifeq ($(USE_PTHREADS),1)
 LIBPTHREAD = -lpthread
 ifeq ($(OS_ARCH),AIX)
 LIBPTHREAD = -lpthreads
 endif
-ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO,$(OS_ARCH)))
+ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Rhapsody,$(OS_ARCH)))
 LIBPTHREAD =
 endif
 ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
 LIBPTHREAD = -ldce
 endif
 endif
 
 endif # !USE_AUTOCONF
--- a/pr/tests/ipv6.c
+++ b/pr/tests/ipv6.c
@@ -11,25 +11,16 @@
  * NPL.
  * 
  * The Initial Developer of this code under the NPL is Netscape
  * Communications Corporation.  Portions created by Netscape are
  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  * Reserved.
  */
 
-#ifdef XP_BEOS
-#include <stdio.h>
-int main()
-{
-    printf( "BeOS does not support IPv6\n" );
-    return 0;
-}
-#else
-
 #include "prio.h"
 #include "prenv.h"
 #include "prmem.h"
 #include "prlink.h"
 #include "prsystem.h"
 #include "prnetdb.h"
 #include "prprf.h"
 #include "prvrsion.h"
@@ -40,55 +31,58 @@ int main()
 
 #include <string.h>
 
 #define DNS_BUFFER 100
 #define ADDR_BUFFER 100
 #define HOST_BUFFER 1024
 #define PROTO_BUFFER 1500
 
+#define NETADDR_SIZE(addr) \
+    (PR_AF_INET == (addr)->raw.family ? \
+    sizeof((addr)->inet) : sizeof((addr)->ipv6))
+
 static PRFileDesc *err = NULL;
 
 static void Help(void)
 {
     PR_fprintf(err, "Usage: [-V] [-h]\n");
     PR_fprintf(err, "\t<nul>    Name of host to lookup          (default: self)\n");
     PR_fprintf(err, "\t-V       Display runtime version info    (default: FALSE)\n");
     PR_fprintf(err, "\t-h       This message and nothing else\n");
 }  /* Help */
 
 static void DumpAddr(const PRNetAddr* address, const char *msg)
 {
     PRUint32 *word = (PRUint32*)address;
     PRUint32 addr_len = sizeof(PRNetAddr);
-    PR_fprintf(err, "%s[%d]\t", msg, PR_NETADDR_SIZE(address));
+    PR_fprintf(err, "%s[%d]\t", msg, NETADDR_SIZE(address));
     while (addr_len > 0)
     {
         PR_fprintf(err, " %08x", *word++);
         addr_len -= sizeof(PRUint32);
     }
     PR_fprintf(err, "\n");
 }  /* DumpAddr */
 
 static PRStatus PrintAddress(const PRNetAddr* address)
 {
     PRNetAddr translation;
     char buffer[ADDR_BUFFER];
     PRStatus rv = PR_NetAddrToString(address, buffer, sizeof(buffer));
-    memset(&translation, 0, sizeof(PRNetAddr));
     if (PR_FAILURE == rv) PL_FPrintError(err, "PR_NetAddrToString");
     else
     {
         PR_fprintf(err, "\t%s\n", buffer);
         memset(&translation, 0, sizeof(translation));
         rv = PR_StringToNetAddr(buffer, &translation);
         if (PR_FAILURE == rv) PL_FPrintError(err, "PR_StringToNetAddr");
         else
         {
-            PRSize addr_len = PR_NETADDR_SIZE(address);
+            PRSize addr_len = NETADDR_SIZE(address);
             if (0 != memcmp(address, &translation, addr_len))
             {
                 PR_fprintf(err, "Address translations do not match\n");
                 DumpAddr(address, "original");
                 DumpAddr(&translation, "translate");
                 rv = PR_FAILURE;
             }
         }
@@ -97,17 +91,16 @@ static PRStatus PrintAddress(const PRNet
 }  /* PrintAddress */
 
 PRIntn main(PRIntn argc, char **argv)
 {
     PRStatus rv;
     PLOptStatus os;
     PRHostEnt host;
     PRProtoEnt proto;
-    PRBool ipv6 = PR_FALSE;
     const char *name = NULL;
     PRBool failed = PR_FALSE, version = PR_FALSE;
     PLOptState *opt = PL_CreateOptState(argc, argv, "Vh");
 
     err = PR_GetSpecialFD(PR_StandardError);
 
     while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
     {
@@ -125,22 +118,20 @@ PRIntn main(PRIntn argc, char **argv)
             Help();  /* so give him an earful */
             return 2;  /* but not a lot else */
         }
     }
     PL_DestroyOptState(opt);
 
     if (version)
     {
-#if defined(XP_UNIX) || defined(XP_OS2)
-#define NSPR_LIB "nspr21"
-#elif defined(WIN32)
-#define NSPR_LIB "libnspr21"
+#if defined(WINNT)
+#define NSPR_LIB "libnspr4"
 #else
-#error "Architecture not supported"
+#define NSPR_LIB "nspr4"
 #endif
         const PRVersionDescription *version_info;
         char *nspr_path = PR_GetEnv("LD_LIBRARY_PATH");
         char *nspr_name = PR_GetLibraryName(nspr_path, NSPR_LIB);
         PRLibrary *runtime = PR_LoadLibrary(nspr_name);
         if (NULL == runtime)
             PL_FPrintError(err, "PR_LoadLibrary");
         else
@@ -231,10 +222,8 @@ PRIntn main(PRIntn argc, char **argv)
         ** Get Proto by name/number
         */
         rv = PR_GetProtoByName("tcp", &buffer[1], sizeof(buffer) - 1, &proto);
         rv = PR_GetProtoByNumber(6, &buffer[3], sizeof(buffer) - 3, &proto);
     }
 
     return (failed) ? 1 : 0;
 }
-
-#endif /* XP_BEOS */
--- a/pr/tests/tpd.c
+++ b/pr/tests/tpd.c
@@ -104,25 +104,23 @@ static void PR_CALLBACK Thread(void *nul
     did = should = PR_FALSE;
     for (keys = 0; keys < 4; ++keys)
     {
         rv = PR_SetThreadPrivate(key[keys], key_string[keys]);
         MY_ASSERT(PR_SUCCESS == rv);
     }
     PrintProgress(__LINE__);
 
-#if !defined(DEBUG)
     did = should = PR_FALSE;
     for (keys = 4; keys < 8; ++keys)
     {
         rv = PR_SetThreadPrivate(key[keys], key_string[keys]);
         MY_ASSERT(PR_FAILURE == rv);
     }
     PrintProgress(__LINE__);
-#endif
     
     did = PR_FALSE; should = PR_TRUE;
     for (keys = 0; keys < 4; ++keys)
     {
         rv = PR_SetThreadPrivate(key[keys], key_string[keys]);
         MY_ASSERT(PR_SUCCESS == rv);
     }
     PrintProgress(__LINE__);
@@ -209,25 +207,25 @@ static PRIntn PR_CALLBACK Tpd(PRIntn arg
     did = should = PR_FALSE;
     for (keys = 0; keys < 4; ++keys)
     {
         rv = PR_SetThreadPrivate(key[keys], key_string[keys]);
         MY_ASSERT(PR_SUCCESS == rv);
     }
     PrintProgress(__LINE__);
 
-#if !defined(DEBUG)
+    for (keys = 4; keys < 8; ++keys)
+		key[keys] = 4096;		/* set to invalid value */
     did = should = PR_FALSE;
     for (keys = 4; keys < 8; ++keys)
     {
         rv = PR_SetThreadPrivate(key[keys], key_string[keys]);
         MY_ASSERT(PR_FAILURE == rv);
     }
     PrintProgress(__LINE__);
-#endif
     
     did = PR_FALSE; should = PR_TRUE;
     for (keys = 0; keys < 4; ++keys)
     {
         rv = PR_SetThreadPrivate(key[keys], key_string[keys]);
         MY_ASSERT(PR_SUCCESS == rv);
     }
     PrintProgress(__LINE__);