Sync'ing long lost changes between Makefile & Makefile.in
authorcls%seawood.org
Sat, 30 Dec 2000 00:47:58 +0000
changeset 1651 4dc28392b606ac889c2b6fc1a00637ecff88935e
parent 1647 3e1aeaa37ef2671bbc720e62edb1300152c20b4e
child 1653 58cb1bb962e4106a209d1f0f0a777507f108c9e9
push idunknown
push userunknown
push dateunknown
Sync'ing long lost changes between Makefile & Makefile.in
config/Makefile.in
lib/ds/Makefile.in
lib/libc/src/Makefile.in
lib/msgc/src/Makefile.in
lib/msgc/tests/Makefile.in
lib/prstreams/Makefile.in
lib/prstreams/tests/testprstrm/Makefile.in
lib/tests/Makefile.in
pr/include/md/Makefile.in
pr/src/Makefile.in
pr/src/cplus/tests/Makefile.in
pr/src/md/Makefile.in
pr/src/md/os2/Makefile.in
pr/src/md/windows/Makefile.in
pr/src/misc/Makefile.in
pr/tests/Makefile.in
pr/tests/dll/Makefile.in
tools/Makefile.in
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -43,21 +43,26 @@ include $(MOD_DEPTH)/config/autoconf.mk
 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
+CSRCS	= now.c
 
+# This version hasn't been ported for us; the one in mozilla/config has
+ifneq ($(OS_ARCH),OS2)
+CSRCS  += nsinstall.c
+ 
 PLSRCS	= nfspwd.pl
+endif
 
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 # Temporary workaround to disable the generation of
 # library build time because now.c uses the 'long long'
 # data type that's not available on some platforms.
@@ -83,30 +88,37 @@ ifeq ($(OS_ARCH), IRIX)
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
     ifeq ($(USE_64),1)
         XLDOPTS += +DA2.0W
     endif
 endif
 
-ifdef XP_OS2_EMX
+ifeq ($(MOZ_OS2_TOOLS),EMX)
+XCFLAGS = $(OS_EXE_CFLAGS)
+ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF)
+XLDOPTS = -Zlinker /PM:VIO
+endif
+endif
+
+ifeq ($(MOZ_OS2_TOOLS),PGCC)
 XCFLAGS = $(OS_EXE_CFLAGS)
 XLDOPTS = -Zlinker /PM:VIO
 endif
 
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 OS_CFLAGS = $(OS_EXE_CFLAGS)
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 PROGS	= $(OBJDIR)/now$(PROG_SUFFIX)
 
-ifeq ($(OS_ARCH),WINNT)
+ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
 TARGETS = $(PROGS)
 else
 PROGS	+= $(OBJDIR)/nsinstall$(PROG_SUFFIX)
 TARGETS = $(PROGS) $(PLSRCS:.pl=)
 endif
 
 OUTOPTION = -o # end of the line
 ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
--- a/lib/ds/Makefile.in
+++ b/lib/ds/Makefile.in
@@ -64,55 +64,56 @@ HEADERS = \
 	plarena.h \
 	plhash.h \
 	$(NULL)
 
 HEADERS := $(addprefix $(srcdir)/, $(HEADERS))
 
 ifndef USE_AUTOCONF
 ifeq ($(OS_ARCH), WINNT)
-ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
+ifeq ($(OS_TARGET), WIN16)
 # OS_CFLAGS = $(OS_EXE_CFLAGS)
-ifdef XP_OS2_EMX
-EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)
-else
 EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX)
-endif
 else
 DLLBASE=/BASE:0x30000000
 RES=$(OBJDIR)/plds.res
 RESNAME=plds.rc
 OS_LIBS = user32.lib
 ifeq ($(OS_TARGET),WIN95)
 EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib
 else
 EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib
 endif
 
 ifdef MOZ_DEBUG
 ifdef GLOWCODE
 EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
 endif
 endif
+endif
 
-endif
+else
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
+EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX)
+
 else
 ifeq ($(OS_ARCH), AIX)
 ifeq ($(CLASSIC_NSPR),1)
 OS_LIBS += -lc
 else
 OS_LIBS += -lc_r
 endif
 endif
 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
 EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr
 else
 EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)
 endif
 endif
+endif
 
 # On NCR and SCOOS, we can't link with extra libraries when
 # we build a shared library.  If we do so, the linker doesn't
 # complain, but we would run into weird problems at run-time.
 # Therefore on these platforms, we link just the .o files.
 ifeq ($(OS_ARCH),NCR)
 EXTRA_LIBS =
 endif
@@ -140,21 +141,17 @@ include $(topsrcdir)/config/rules.mk
 ECHO = echo
 TINC = $(OBJDIR)/_pl_bld.h
 PROD = $(notdir $(SHARED_LIBRARY))
 NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
 SH_DATE = $(shell date)
 SH_NOW = $(shell $(NOW))
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),OS2)
-	SUF =
-else
 	SUF = i64
-endif
 else
 	SUF = LL
 endif
 
 GARBAGE += $(TINC)
 
 $(TINC):
 	@$(MAKE_OBJDIR)
@@ -164,24 +161,24 @@ GARBAGE += $(TINC)
 	else \
 	    true; \
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
-ifdef XP_OS2_EMX
-	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
+ifeq ($(MOZ_OS2_TOOLS), VACPP)
 	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
-endif
 else
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
+endif
 #
 # Version information generation (end)
 #
 
 #
 # The Client build wants the shared libraries in $(DIST)/bin,
 # so we also install them there.
 #
--- a/lib/libc/src/Makefile.in
+++ b/lib/libc/src/Makefile.in
@@ -73,53 +73,54 @@ CSRCS =\
 
 LIBRARY_NAME	= plc
 LIBRARY_VERSION	= $(MOD_VERSION)
 
 RELEASE_LIBS = $(TARGETS)
 
 ifndef USE_AUTOCONF
 ifeq ($(OS_ARCH),WINNT)
-ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
-ifdef XP_OS2_EMX
-EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)
-else
+ifeq ($(OS_TARGET), WIN16)
 EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib
-endif
 else
 DLLBASE=/BASE:0x30000000
 RES=$(OBJDIR)/plc.res
 RESNAME=plc.rc
 ifeq ($(OS_TARGET),WIN95)
 EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib
 else
 EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib
 endif
 
 ifdef MOZ_DEBUG
 ifdef GLOWCODE
 EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
 endif
 endif
+endif
 
-endif
+else
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
+EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX)
+
 else
 ifeq ($(OS_ARCH), AIX)
 ifeq ($(CLASSIC_NSPR),1)
 OS_LIBS += -lc
 else
 OS_LIBS += -lc_r
 endif
 endif
 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
 EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr
 else
 EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)
 endif
 endif
+endif
 
 # On NCR and SCOOS, we can't link with extra libraries when
 # we build a shared library.  If we do so, the linker doesn't
 # complain, but we would run into weird problems at run-time.
 # Therefore on these platforms, we link just the .o files.
 ifeq ($(OS_ARCH),NCR)
 EXTRA_LIBS =
 endif
@@ -140,21 +141,17 @@ include $(topsrcdir)/config/rules.mk
 ECHO = echo
 TINC = $(OBJDIR)/_pl_bld.h
 PROD = $(notdir $(SHARED_LIBRARY))
 NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
 SH_DATE = $(shell date)
 SH_NOW = $(shell $(NOW))
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),OS2)
-	SUF =
-else
 	SUF = i64
-endif
 else
 	SUF = LL
 endif
 
 GARBAGE += $(TINC)
 
 $(TINC):
 	@$(MAKE_OBJDIR)
@@ -164,24 +161,24 @@ GARBAGE += $(TINC)
 	else \
 	    true; \
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
-ifdef XP_OS2_EMX
-	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
+ifeq ($(MOZ_OS2_TOOLS), VACPP)
 	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
-endif
 else
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
+endif
 #
 # Version information generation (end)
 #
 
 #
 # The Client build wants the shared libraries in $(DIST)/bin,
 # so we also install them there.
 #
--- a/lib/msgc/src/Makefile.in
+++ b/lib/msgc/src/Makefile.in
@@ -52,59 +52,64 @@ endif
 INCLUDES = -I$(DIST)/include -I../include
 
 CSRCS = prgcapi.c prmsgc.c
 
 ifeq ($(OS_ARCH),WINNT)
 ifeq ($(OS_TARGET),WIN16)
 CSRCS += win16gc.c
 else
-ifeq ($(OS_TARGET),OS2)
+CSRCS += win32gc.c
+endif
+else
+ifeq ($(OS_ARCH),OS2)
 CSRCS += os2gc.c
 else
-CSRCS += win32gc.c
-endif
+CSRCS += unixgc.c
 endif
-else
-CSRCS += unixgc.c
 endif
 
 NSPR_VERSION = $(MOD_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
+ifeq ($(OS_TARGET), WIN16)
 EXTRA_LIBS = $(DIST)/lib/nspr$(NSPR_VERSION).lib
 else
 DLLBASE=/BASE:0x30000000
 #RES=$(OBJDIR)/ds.res
 #RESNAME=$(MOD_DEPTH)/pr/src/nspr.rc
 #OS_LIBS = user32.lib
 EXTRA_LIBS = $(DIST)/lib/libnspr$(NSPR_VERSION).lib
 
 ifdef MOZ_DEBUG
 ifdef GLOWCODE
 EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
 endif
 endif
+endif
 
-endif
+else
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
+EXTRA_LIBS = $(DIST)/lib/nspr$(NSPR_VERSION).$(LIB_SUFFIX)
+
 else
 ifeq ($(OS_ARCH), AIX)
 ifeq ($(CLASSIC_NSPR),1)
 OS_LIBS += -lc
 else
 OS_LIBS += -lc_r
 endif
 endif
 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
 EXTRA_LIBS = -L$(DIST)/lib -lnspr$(NSPR_VERSION)_shr
 else
 EXTRA_LIBS = -L$(DIST)/lib -lnspr$(NSPR_VERSION)
 endif
 endif
+endif
 
 # On NCR and SCOOS, we can't link with extra libraries when
 # we build a shared library.  If we do so, the linker doesn't
 # complain, but we would run into weird problems at run-time.
 # Therefore on these platforms, we link just the .o files.
 ifeq ($(OS_ARCH),NCR)
 EXTRA_LIBS =
 endif
--- a/lib/msgc/tests/Makefile.in
+++ b/lib/msgc/tests/Makefile.in
@@ -48,17 +48,17 @@ W16STDIO = $(MOD_DEPTH)/pr/src/md/window
 endif
 
 ifeq ($(OS_TARGET), OS2)
 OS_CFLAGS = $(OS_EXE_CFLAGS)
 endif
 
 CSRCS = gc1.c thrashgc.c
 
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
@@ -75,27 +75,31 @@ LIBPLC = -lplc$(NSPR_VERSION)
 LIBGC = -lmsgc$(GC_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
   LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib
   LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib
   LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib
 else
-ifeq ($(OS_TARGET),OS2)
+  LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
+  LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
+  LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
+  LIBGC= $(DIST)/lib/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
+endif
+endif
+
+ifeq ($(OS_ARCH),OS2)
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
   LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
   LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib
   LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib
   LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib
 else
-  LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
-  LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
-  LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
-  LIBGC= $(DIST)/lib/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
-endif
+  LDOPTS += -Zomf -Zlinker /PM:VIO
 endif
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
@@ -286,24 +290,22 @@ ifeq ($(OS_TARGET),WIN16)
 	echo $(W16STDIO) >>w16link
 	echo library  >>w16link
 	echo $(LIBPR),	     >>w16link
 	echo $(LIBPLC),		>>w16link
 	echo $(LIBGC),		 >>w16link
 	echo winsock.lib     >>w16link
 	wlink @w16link.
 else
-ifeq ($(OS_TARGET),OS2)
-	$(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) so32dll.lib tcp32dll.lib -MAP:$(@:.exe=.map) -out:$@
+	link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
 else
-	link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
-endif
-endif
+ifeq ($(OS_ARCH),OS2)
+	$(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
 else
 	$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@
 endif
-
+endif
 endif
 
 export:: $(TARGETS)
 export:: install
 clean::
 	rm -f $(TARGETS)
--- a/lib/prstreams/Makefile.in
+++ b/lib/prstreams/Makefile.in
@@ -43,31 +43,31 @@ include $(MOD_DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/config.mk
 
 ifndef USE_AUTOCONF
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
     ifeq ($(OS_RELEASE),4.1.3_U1)
         OPTIMIZER =
     else
-	# The C++ compiler in Workshop 5.0 uses standard
-	# iostreams as default.  -library=iostream will
-	# allow Workshop 5.0 to work with classic iostreams.
-	ifndef NS_USE_GCC
-	CCC_VERSION := $(shell $(CCC) -V 2>&1)
-	ifneq (,$(findstring 5.0,$(CCC_VERSION)))
-	CCC_ONLY_FLAGS += -library=iostream
-	endif
-	endif
+        # The C++ compiler in Workshop 5.0 uses standard
+        # iostreams as default.  -library=iostream will
+        # allow Workshop 5.0 to work with classic iostreams.
+        ifndef NS_USE_GCC
+        CCC_VERSION := $(shell $(CCC) -V 2>&1)
+        ifneq (,$(findstring 5.0,$(CCC_VERSION)))
+        CCC_ONLY_FLAGS += -library=iostream
+        endif
+        endif
     endif
 endif
 
 ifeq ($(OS_ARCH), IRIX)
     ifneq ($(OS_RELEASE),5.3)
-	CCC_ONLY_FLAGS += -exceptions
+        CCC_ONLY_FLAGS += -exceptions
     endif
 endif
 
 ifeq ($(OS_ARCH), BeOS)
     CFLAGS += -frtti -fexceptions
 endif
 endif # !USE_AUTOCONF
 
@@ -82,30 +82,37 @@ CSRCS = \
 CXXSRCS = \
 	prstrms.cpp \
 	$(NULL)
 
 OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)) $(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
 
 ifndef USE_AUTOCONF
 ifeq ($(OS_ARCH), WINNT)
-    ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
+    ifeq ($(OS_TARGET), WIN16)
         EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib
     else
         DLLBASE=/BASE:0x30000000
         RES=$(OBJDIR)/prstrms.res
         RESNAME=prstrms.rc
         OS_LIBS = user32.lib
         ifeq ($(OS_TARGET), WIN95)
             EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib
         else
             EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib
         endif
     endif
 else
+    ifeq ($(OS_ARCH),OS2)
+      ifeq ($(MOZ_OS2_TOOLS),VACPP)
+         EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX)
+      else
+         EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -lstdcpp
+      endif
+    else
     ifeq ($(OS_ARCH), AIX)
       ifeq ($(OS_RELEASE), 4.1)
         ifeq ($(CLASSIC_NSPR),1)
             OS_LIBS += -lC -lc
         else
             OS_LIBS += -lC_r -lc_r
         endif
       else
@@ -120,16 +127,17 @@ else
       endif
     endif
     ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
         EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr
     else
         EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)
     endif
 endif
+endif
 
 # On NCR and SCOOS, we can't link with extra libraries when
 # we build a shared library.  If we do so, the linker doesn't
 # complain, but we would run into weird problems at run-time.
 # Therefore on these platforms, we link just the object files.
 ifeq ($(OS_ARCH),NCR)
     EXTRA_LIBS =
 endif
@@ -164,21 +172,17 @@ include $(topsrcdir)/config/rules.mk
 ECHO = echo
 TINC = $(OBJDIR)/_pl_bld.h
 PROD = $(notdir $(SHARED_LIBRARY))
 NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
 SH_DATE = $(shell date)
 SH_NOW = $(shell $(NOW))
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),OS2)
-	SUF =
-else
 	SUF = i64
-endif
 else
 	SUF = LL
 endif
 
 $(TINC):
 	@$(MAKE_OBJDIR)
 	@$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC)
 	@if test ! -z "$(SH_NOW)"; then \
@@ -186,31 +190,34 @@ endif
 	else \
 	    true; \
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
-ifdef XP_OS2_EMX
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
+ifeq ($(MOZ_OS2_TOOLS), VACPP)
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
+else
+	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
 endif
-else
-	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
 #
 # Version information generation (end)
 #
 
 export:: $(TARGETS) $(HEADERS)
 	$(INSTALL) -m 444 $(HEADERS) $(DIST)/include
 	$(INSTALL) -m 444 $(TARGETS) $(DIST)/lib
+ifeq ($(OS_ARCH),OS2)
+	$(INSTALL) -m 444 $(TARGETS) $(DIST)/bin
+endif
 ifeq ($(OS_ARCH),HP-UX)
 ifdef SHARED_LIBRARY
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib
 endif
 endif
 ifeq ($(OS_ARCH),OpenVMS)
 	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/lib
 ifdef SHARED_LIBRARY
--- a/lib/prstreams/tests/testprstrm/Makefile.in
+++ b/lib/prstreams/tests/testprstrm/Makefile.in
@@ -47,17 +47,17 @@ OS_CFLAGS = $(OS_EXE_CFLAGS)
 endif
 
 CXXSRCS =           \
 	testprstrm.cpp    \
 	$(NULL)
 
 OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
 
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
@@ -81,16 +81,26 @@ else
     LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).$(LIB_SUFFIX)
   else
     LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
     LIBPRSTRMS = $(DIST)/lib/libprstrms$(MOD_VERSION).$(LIB_SUFFIX)
   endif
 endif
 endif
 
+ifeq ($(OS_ARCH),OS2)
+  ifeq ($(MOZ_OS2_TOOLS),VACPP)
+    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768
+    LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib
+    LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).$(LIB_SUFFIX)
+  else
+    LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
+  endif
+endif
+
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
 LDOPTS += -rpath $(PWD)/$(DIST)/lib
 endif
 
@@ -219,17 +229,23 @@ ifeq ($(OS_TARGET),WIN16)
 	echo $(LIBPR),	     >>w16link
 	echo $(LIBPRSTRMS),		 >>w16link
 	echo winsock.lib     >>w16link
 	wlink @w16link.
 else
 	link $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) wsock32.lib -out:$@
 endif
 else
+ifeq ($(OS_ARCH),OS2)
+	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) $(OS_LIBS) $(EXTRA_LIBS)
+else
 	$(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPRSTRMS) $(EXTRA_LIBS) -o $@
 endif
-
+endif
 endif
 
 export:: $(TARGETS)
 install:: export
 clean::
 	rm -f $(TARGETS)
+
+testlinker:
+	echo $(LINK)
--- a/lib/tests/Makefile.in
+++ b/lib/tests/Makefile.in
@@ -49,17 +49,21 @@ endif
 ifeq ($(OS_TARGET), WIN16)
 OS_CFLAGS = $(OS_EXE_CFLAGS)
 endif
 
 CSRCS = \
 	string.c \
 	base64t.c
 
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+CSRCS += arena.c
+endif
+
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
@@ -87,16 +91,27 @@ else
   else
   LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
   LIBPLC= $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX)
   LIBPLDS= $(DIST)/lib/libplds$(MOD_VERSION).$(LIB_SUFFIX)
   endif
 endif
 endif
 
+ifeq ($(OS_ARCH),OS2)
+  ifeq ($(MOZ_OS2_TOOLS),VACPP)
+    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768
+    LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib
+    LIBPLC = $(DIST)/lib/plc$(MOD_VERSION).lib
+    LIBPLDS= $(DIST)/lib/plds$(MOD_VERSION).$(LIB_SUFFIX)	
+  else
+    LDOPTS += -Zomf -Zlinker /PM:VIO
+  endif
+endif
+
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
 LDOPTS += -rpath $(PWD)/$(DIST)/lib
 endif
 
@@ -218,19 +233,22 @@ ifeq ($(OS_TARGET),WIN16)
 	echo $(LIBPR),	     >>w16link
 	echo $(LIBPLC),		 >>w16link
 	echo winsock.lib     >>w16link
 	wlink @w16link.
 else
 	link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) wsock32.lib -out:$@
 endif
 else
+ifeq ($(OS_ARCH),OS2)
+	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC)  $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
+else
 	$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@
 endif
-
+endif
 endif
 
 export:: $(TARGETS)
 install:: export
 clean::
 	rm -f $(TARGETS)
 
 
--- a/pr/include/md/Makefile.in
+++ b/pr/include/md/Makefile.in
@@ -58,23 +58,23 @@ endif
 
 ifeq ($(OS_ARCH),WINNT)
 ifeq ($(OS_TARGET), WIN95)
 MDCPUCFG_H = _win95.cfg
 else
 ifeq ($(OS_TARGET), WIN16)
 MDCPUCFG_H = _win16.cfg
 else
-ifeq ($(OS_TARGET),OS2)
-MDCPUCFG_H = _os2.cfg
-else
 MDCPUCFG_H = _winnt.cfg
 endif
 endif
 endif
+
+ifeq ($(OS_ARCH),OS2)
+MDCPUCFG_H = _os2.cfg
 endif
 
 ifeq ($(OS_ARCH),AIX)
 ifeq ($(USE_64),1)
 MDCPUCFG_H = _aix64.cfg
 else
 ifeq ($(USE_IPV6),1)
 MDCPUCFG_H = _aix32in6.cfg
@@ -182,26 +182,32 @@ endif
 
 ifeq ($(OS_ARCH),BeOS)
 MDCPUCFG_H = _beos.cfg
 endif
 
 endif # ! USE_AUTOCONF
 
 export:: $(MDCPUCFG_H)
+ifeq ($(MOZ_BITS),16)
+	cp $(DIST)/include/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h
+	$(INSTALL) -m 444 $(MDCPUCFG_H) $(MOZ_INCL)
+	mv -f $(DIST)/include/$(MDCPUCFG_H) $(MOZ_INCL)/prcpucfg.h
+else
 	$(INSTALL) -m 444 $(CONFIGS) $(DIST)/include/md
 	$(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(DIST)/include
 ifneq ($(OS_ARCH),OpenVMS)
 	mv -f $(DIST)/include/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h
 else
 # mv'ing a link causes the file itself to move, not the link.
 	rm -f $(DIST)/include/$(MDCPUCFG_H)
 	rm -f $(DIST)/include/prcpucfg.h
 	ln -fs `pwd`/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h
 endif
+endif
 
 release:: export
 	@echo "Copying machine-dependent prcpucfg.h"
 	@if test -z "$(BUILD_NUMBER)"; then \
 		echo "BUILD_NUMBER must be defined"; \
 		false; \
 	fi
 	@if test ! -d $(RELEASE_INCLUDE_DIR); then \
--- a/pr/src/Makefile.in
+++ b/pr/src/Makefile.in
@@ -39,16 +39,21 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 DIRS = io linking malloc md memory misc threads
 
+# For VAC++ 4 geticcdata rule in config/OS2.mk
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
+CSRCS = prvrsion.c
+endif
+
 ifeq ($(USE_PTHREADS), 1)
 	DIRS += pthreads
 endif
 
 ifeq ($(USE_BTHREADS), 1)
 	DIRS += bthreads
 endif
 
@@ -111,17 +116,17 @@ ifneq ($(USE_PTHREADS),1)
 BUILD_AIX_RTL_LIBC = 1
 AIX_RTL_LIBC	= $(OBJDIR)/libc.a
 endif
 endif
 endif
 
 ifeq ($(OS_ARCH),OSF1)
 ifeq ($(USE_PTHREADS), 1)
-OS_LIBS 	= -lpthread
+OS_LIBS 	= -lpthread -lrt
 endif
 ifneq ($(OS_RELEASE),V2.0)
 OS_LIBS		+= -lc_r
 endif
 endif
 
 ifeq ($(OS_ARCH),Linux)
 ifeq ($(USE_PTHREADS), 1)
@@ -131,17 +136,17 @@ OS_LIBS		= -ldl -lc
 endif
 endif
 
 ifeq ($(OS_ARCH),HP-UX)
 ifeq ($(USE_PTHREADS), 1)
 ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
 OS_LIBS 	= -ldce
 else
-OS_LIBS 	= -lpthread
+OS_LIBS 	= -lpthread -lrt
 endif
 endif
 ifeq ($(PTHREADS_USER), 1)
 OS_LIBS 	= -lpthread
 endif
 ifeq ($(basename $(OS_RELEASE)),A.09)
 OS_LIBS		+= -ldld -L/lib/pa1.1 -lm
 else
@@ -153,24 +158,20 @@ ifeq ($(OS_ARCH),UNIXWARE)
 OS_LIBS		= -lsocket -lc
 endif
 
 ifeq ($(OS_ARCH),NEWS-OS)
 OS_LIBS		= -lsocket -lnsl -lgen -lresolv
 endif
 
 ifeq ($(OS_ARCH),WINNT)
-ifeq ($(OS_TARGET),OS2)
-# We define this in os2.mk.
-else
 ifneq ($(OS_TARGET),WIN16)
 OS_LIBS		= advapi32.lib wsock32.lib
 endif
 endif
-endif
 
 ifdef GC_LEAK_DETECTOR
 OS_LIBS		+= -L$(DIST)/lib -lboehm
 endif
 
 endif # USE_AUTOCONF
 #
 # Define platform-dependent OBJS
@@ -189,17 +190,16 @@ OBJS = \
     io/$(OBJDIR)/prpolevt.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prprf.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prscanf.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prstdio.$(OBJ_SUFFIX) \
     threads/$(OBJDIR)/prcmon.$(OBJ_SUFFIX) \
 	threads/$(OBJDIR)/prrwlock.$(OBJ_SUFFIX) \
 	threads/$(OBJDIR)/prtpd.$(OBJ_SUFFIX) \
     linking/$(OBJDIR)/prlink.$(OBJ_SUFFIX) \
-    malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX) \
     malloc/$(OBJDIR)/prmem.$(OBJ_SUFFIX) \
     md/$(OBJDIR)/prosdep.$(OBJ_SUFFIX) \
     memory/$(OBJDIR)/prshm.$(OBJ_SUFFIX) \
     memory/$(OBJDIR)/prshma.$(OBJ_SUFFIX) \
     memory/$(OBJDIR)/prseg.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/pralarm.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/pratom.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prcountr.$(OBJ_SUFFIX) \
@@ -213,19 +213,25 @@ OBJS = \
     misc/$(OBJDIR)/pripc.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prlog2.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prlong.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prnetdb.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prolock.$(OBJ_SUFFIX)	 \
     misc/$(OBJDIR)/prrng.$(OBJ_SUFFIX)	 \
     misc/$(OBJDIR)/prsystem.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prthinfo.$(OBJ_SUFFIX) \
+    misc/$(OBJDIR)/prtpool.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prtrace.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prtime.$(OBJ_SUFFIX)
 
+# ilib now rejects empty objects
+ifneq ($(MOZ_OS2_TOOLS),VACPP)
+OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX)
+endif
+
 ifdef USE_PTHREADS
 OBJS += \
     pthreads/$(OBJDIR)/ptsynch.$(OBJ_SUFFIX) \
     pthreads/$(OBJDIR)/ptio.$(OBJ_SUFFIX) \
     pthreads/$(OBJDIR)/ptthread.$(OBJ_SUFFIX) \
     pthreads/$(OBJDIR)/ptmisc.$(OBJ_SUFFIX)
 else
 OBJS += \
@@ -273,17 +279,17 @@ ifdef USE_AUTOCONF
 include $(srcdir)/md/$(PR_MD_ARCH_DIR)/objs.mk
 ifdef USE_BTHREADS
 include $(srcdir)/bthreads/objs.mk
 endif
 
 else
 
 ifeq ($(OS_ARCH), WINNT)
-ifneq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
+ifneq ($(OS_TARGET),WIN16)
 DLLBASE=/BASE:0x30000000
 RES=$(OBJDIR)/nspr.res
 RESNAME=nspr.rc
 ifdef MOZ_DEBUG
 ifdef GLOWCODE
 EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
 endif
 endif
@@ -316,62 +322,66 @@ else
 ifeq ($(OS_TARGET), WIN95)
 OBJS +=	md/windows/$(OBJDIR)/w95io.$(OBJ_SUFFIX) \
 	md/windows/$(OBJDIR)/w95sock.$(OBJ_SUFFIX) \
 	md/windows/$(OBJDIR)/w95thred.$(OBJ_SUFFIX) \
 	md/windows/$(OBJDIR)/w95cv.$(OBJ_SUFFIX) \
 	md/windows/$(OBJDIR)/ntgc.$(OBJ_SUFFIX) \
 	md/windows/$(OBJDIR)/ntmisc.$(OBJ_SUFFIX) \
 	md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/ntsec.$(OBJ_SUFFIX)	\
 	md/windows/$(OBJDIR)/ntsem.$(OBJ_SUFFIX)	\
 	md/windows/$(OBJDIR)/win32_errors.$(OBJ_SUFFIX) \
-        md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX)    \
+	md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX)	\
 	md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX)	\
-        md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX)       \
-        md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX)       \
+	md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX)	\
+	md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX)	\
 	md/windows/$(OBJDIR)/w95dllmain.$(OBJ_SUFFIX)
 else
-ifeq ($(OS_TARGET),OS2)
+OBJS +=	md/windows/$(OBJDIR)/ntdllmn.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/ntio.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/ntgc.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/ntthread.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/ntmisc.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/ntsec.$(OBJ_SUFFIX)	\
+	md/windows/$(OBJDIR)/ntsem.$(OBJ_SUFFIX)	\
+	md/windows/$(OBJDIR)/win32_errors.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX) \
+	md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX)	\
+	md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX)	\
+	md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX)
+endif
+endif
+
+else
+
+ifeq ($(OS_ARCH),OS2)
 OBJS +=	md/os2/$(OBJDIR)/os2io.$(OBJ_SUFFIX) \
 	md/os2/$(OBJDIR)/os2sock.$(OBJ_SUFFIX) \
 	md/os2/$(OBJDIR)/os2thred.$(OBJ_SUFFIX) \
 	md/os2/$(OBJDIR)/os2cv.$(OBJ_SUFFIX) \
 	md/os2/$(OBJDIR)/os2gc.$(OBJ_SUFFIX) \
 	md/os2/$(OBJDIR)/os2misc.$(OBJ_SUFFIX) \
 	md/os2/$(OBJDIR)/os2inrval.$(OBJ_SUFFIX) \
 	md/os2/$(OBJDIR)/os2sem.$(OBJ_SUFFIX)	\
 	md/os2/$(OBJDIR)/os2_errors.$(OBJ_SUFFIX) \
-	md/os2/$(OBJDIR)/os2poll.$(OBJ_SUFFIX)
-else
-OBJS +=	md/windows/$(OBJDIR)/ntdllmn.$(OBJ_SUFFIX) \
-	md/windows/$(OBJDIR)/ntio.$(OBJ_SUFFIX) \
-	md/windows/$(OBJDIR)/ntgc.$(OBJ_SUFFIX) \
-	md/windows/$(OBJDIR)/ntthread.$(OBJ_SUFFIX) \
-	md/windows/$(OBJDIR)/ntmisc.$(OBJ_SUFFIX) \
-	md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) \
-	md/windows/$(OBJDIR)/ntsem.$(OBJ_SUFFIX)	\
-	md/windows/$(OBJDIR)/win32_errors.$(OBJ_SUFFIX) \
-        md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX) \
-        md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX)       \
-        md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX)       \
-	md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX)
-endif
-endif
-endif
-
+	md/os2/$(OBJDIR)/os2poll.$(OBJ_SUFFIX) \
+	md/os2/$(OBJDIR)/os2rng.$(OBJ_SUFFIX)
 else
 
 ifeq ($(OS_ARCH), BeOS)
 	include $(srcdir)/md/beos/objs.mk
 	include $(srcdir)/bthreads/objs.mk
 else
 	# Unix
 	include $(srcdir)/md/unix/objs.mk
 endif
 endif
+endif
 endif # !USE_AUTOCONF
 
 LIBRARY_NAME = nspr
 LIBRARY_VERSION = $(MOD_VERSION)
 
 RELEASE_LIBS = $(TARGETS)
 
 include $(topsrcdir)/config/rules.mk
@@ -382,27 +392,29 @@ TARGETS		+= $(AIX_RTL_LIBC)
 endif
 
 #
 # Version information generation (begin)
 #
 ECHO = echo
 INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 TINC = $(OBJDIR)/_pr_bld.h
+
+ifeq ($(OS_TARGET),OS2)
+PROD = nspr$(MOD_VERSION).$(DLL_SUFFIX)
+else
 PROD = $(notdir $(SHARED_LIBRARY))
+endif
+
 NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
 SH_DATE = $(shell date)
 SH_NOW = $(shell $(NOW))
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),OS2)
-	SUF =
-else
 	SUF = i64
-endif
 else
 	SUF = LL
 endif
 
 DEFINES		+= -D_NSPR_BUILD_
 
 GARBAGE += $(TINC)
 
@@ -414,24 +426,24 @@ GARBAGE += $(TINC)
 	else \
 	    true; \
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/prvrsion.$(OBJ_SUFFIX): prvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
-ifdef XP_OS2_EMX
-	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
+ifeq ($(MOZ_OS2_TOOLS), VACPP)
 	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
-endif
 else
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
+endif
 #
 # Version information generation (end)
 #
 
 
 #
 # The Client build wants the shared libraries in $(DIST)/bin,
 # so we also install them there.
--- a/pr/src/cplus/tests/Makefile.in
+++ b/pr/src/cplus/tests/Makefile.in
@@ -54,17 +54,17 @@ CXXSRCS =           \
 	time.cpp        \
 	fileio.cpp      \
 	switch.cpp      \
 	tpd.cpp         \
 	$(NULL)
 
 OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
 
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
@@ -129,16 +129,26 @@ ifeq ($(OS_TARGET), WIN16)
   LIBPL = $(DIST)/lib/plc$(MOD_VERSION).lib
 else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
   LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
   LIBPL = $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX)
 endif
 endif
 
+ifeq ($(OS_ARCH),OS2)
+  ifeq ($(MOZ_OS2_TOOLS),VACPP)
+    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
+    LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib
+    LIBPLC = $(DIST)/lib/plc$(MOD_VERSION).lib
+  else
+    LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
+  endif
+endif
+
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), OSF1)
 LDOPTS += -rpath $(PWD)/$(DIST)/lib
 endif
 
@@ -255,18 +265,21 @@ ifeq ($(OS_TARGET),WIN16)
 	echo $(LIBPR),	            >>w16link
 	echo $(LIBPL),	            >>w16link
 	echo winsock.lib            >>w16link
 	wlink @w16link.
 else
 	link $(LDOPTS) $< $(LIBPR) $(LIBPL) wsock32.lib -out:$@
 endif
 else
+ifeq ($(OS_ARCH),OS2)
+	$(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
+else
 	$(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPL) $(EXTRA_LIBS) -o $@
 endif
-
+endif
 endif
 
 export:: $(TARGETS)
 install:: export
 clean::
 	rm -f $(TARGETS)
 
--- a/pr/src/md/Makefile.in
+++ b/pr/src/md/Makefile.in
@@ -40,27 +40,28 @@ VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 ifdef USE_AUTOCONF
 DIRS = $(PR_MD_ARCH_DIR)
 else
+
 ifeq ($(OS_ARCH),WINNT)
-  ifeq ($(OS_TARGET),OS2)
+    DIRS = windows
+else
+  ifeq ($(OS_ARCH),OS2)
     DIRS = os2
   else
-    DIRS = windows
-  endif
-else
   ifeq ($(OS_ARCH),BeOS)
     DIRS = beos
   else
     DIRS = unix
+    endif
   endif
 endif
 
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
--- a/pr/src/md/os2/Makefile.in
+++ b/pr/src/md/os2/Makefile.in
@@ -49,16 +49,17 @@ CSRCS = \
     os2inrval.c \
     os2gc.c \
     os2thred.c \
     os2io.c \
     os2cv.c \
     os2sock.c \
     os2_errors.c \
     os2poll.c \
+    os2rng.c \
     $(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
 INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
--- a/pr/src/md/windows/Makefile.in
+++ b/pr/src/md/windows/Makefile.in
@@ -60,34 +60,36 @@ CSRCS = \
     w16stdio.c  \
     w16callb.c \
     ntinrval.c \
     $(NULL)
 else
 ifeq ($(OS_TARGET), WIN95)
 CSRCS =          \
     ntmisc.c \
+    ntsec.c   \
     ntsem.c   \
     ntinrval.c \
     ntgc.c \
 	w95thred.c \
 	w95io.c \
 	w95cv.c \
+	w32rng.c \
 	w95sock.c \
 	win32_errors.c \
     w32ipcsem.c \
     w32poll.c \
-    w32rng.c \
     w32shm.c \
     w95dllmain.c \
     $(NULL)
 else
 CSRCS =          \
     ntdllmn.c \
     ntmisc.c \
+    ntsec.c   \
     ntsem.c   \
     ntinrval.c \
     ntgc.c \
     ntthread.c \
     ntio.c    \
 	win32_errors.c \
     w32ipcsem.c \
     w32poll.c \
--- a/pr/src/misc/Makefile.in
+++ b/pr/src/misc/Makefile.in
@@ -61,21 +61,22 @@ CSRCS = \
 	prerror.c  \
 	prerrortable.c  \
 	prinit.c   \
 	prinrval.c \
 	pripc.c \
 	prlog2.c   \
 	prlong.c   \
 	prnetdb.c  \
+	prolock.c  \
 	prrng.c    \
-	prolock.c  \
 	prsystem.c \
 	prtime.c   \
 	prthinfo.c \
+	prtpool.c \
 	prtrace.c  \
 	$(NULL)
 
 ifndef USE_PTHREADS
 CSRCS += \
 	pripcsem.c \
 	$(NULL)
 endif
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -107,21 +107,21 @@ CSRCS =             \
 	lltest.c        \
 	lock.c          \
 	lockfile.c      \
 	logger.c		\
 	makedir.c		\
 	multiacc.c		\
 	multiwait.c		\
 	many_cv.c		\
-	nameshm1.c	\
+	nameshm1.c      \
 	nbconn.c		\
 	nblayer.c		\
 	nonblock.c		\
-	ntioto.c	\
+	ntioto.c        \
 	ntoh.c			\
 	obsints.c		\
 	op_2long.c      \
 	op_excl.c		\
 	op_filnf.c		\
 	op_filok.c		\
 	op_noacc.c		\
 	op_nofil.c		\
@@ -142,31 +142,31 @@ CSRCS =             \
 	prftest1.c		\
 	prftest2.c		\
 	primblok.c		\
 	priotest.c		\
 	provider.c		\
 	prpoll.c		\
 	prpollml.c		\
 	ranfile.c       \
-	randseed.c	\
+	randseed.c      \
 	rwlocktest.c    \
 	sel_spd.c  		\
 	selct_er.c	    \
 	selct_nm.c	    \
 	selct_to.c	    \
 	select2.c  		\
 	selintr.c  		\
 	sem.c 	  		\
-	sema.c			\
-	semaerr.c		\
-	semaerr1.c		\
-	semaping.c		\
-	semapong.c		\
-	sendzlf.c		\
+	sema.c 	  		\
+	semaerr.c 		\
+	semaerr1.c 		\
+	semaping.c 		\
+	semapong.c 		\
+	sendzlf.c 		\
 	server_test.c	\
 	servr_kk.c		\
 	servr_ku.c		\
 	servr_uk.c		\
 	servr_uu.c		\
 	short_thread.c	\
 	sigpipe.c		\
 	socket.c		\
@@ -180,42 +180,44 @@ CSRCS =             \
 	stdio.c		    \
 	str2addr.c		\
 	strod.c			\
 	suspend.c		\
 	switch.c		\
 	system.c		\
 	testbit.c    	\
 	testfile.c    	\
+	thrpool_server.c \
+	thrpool_client.c \
 	threads.c 	  	\
 	thruput.c 	  	\
 	timemac.c		\
 	timetest.c		\
 	tmoacc.c        \
 	tmocon.c        \
 	tpd.c			\
 	vercheck.c		\
 	version.c	    \
 	udpsrv.c	    \
 	writev.c        \
 	xnotify.c       \
 	y2k.c           \
-	y2ktmo.c	\
+	y2ktmo.c        \
 	zerolen.c       \
 	$(NULL)
 
 ifeq ($(OS_TARGET),OS2)
 CSRCS +=            \
 	sleep.c			\
 	stat.c		    \
 	yield.c         \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS)
@@ -230,38 +232,40 @@ LIBPLC = -lplc$(MOD_VERSION)
 
 ifndef USE_AUTOCONF
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
   LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib
   LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib
 else
-ifeq ($(OS_TARGET), OS2)
-ifdef XP_OS2_VACPP
-  LDOPTS =
-  LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib
-  LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib
-else
-  LDOPTS = -Zlinker /PM:VIO
-endif
-else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
   ifeq ($(OS_TARGET), WIN95)
     LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX)
     LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).$(LIB_SUFFIX)
   else
     LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
     LIBPLC= $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX)
   endif
   ifdef PROFILE                                                                              
     LDOPTS += -PROFILE -MAP                                                                  
   endif # profile
 endif
 endif
+
+ifeq ($(OS_ARCH),OS2)
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
+  LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
+  LIBPR  = $(DIST)/lib/nspr$(MOD_VERSION).lib
+  LIBPLC = $(DIST)/lib/plc$(MOD_VERSION).lib
+else
+ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF)
+  LDOPTS = -Zlinker /PM:VIO
+endif
+endif
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 # Use an absolute pathname as the runtime library path (for the -R
 # or -rpath linker option or the LD_RUN_PATH environment variable).
 ifeq (,$(patsubst /%,,$(DIST)))
 # $(DIST) is already an absolute pathname.
 ABSOLUTE_LIB_DIR = $(DIST)/lib
@@ -306,18 +310,18 @@ ifeq ($(OS_ARCH), OSF1)
     else
         LDOPTS += -rpath $(ABSOLUTE_LIB_DIR)
     endif
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
     LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR)
     ifeq ($(USE_64),1)
-	LDOPTS += +DA2.0W
-	EXTRA_LIBS = -lpthread
+        LDOPTS += +DA2.0W
+        EXTRA_LIBS = -lpthread
     endif
 endif
 
 # AIX
 ifeq ($(OS_ARCH),AIX)
     LDOPTS += -blibpath:$(ABSOLUTE_LIB_DIR):/usr/lib:/lib
     ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
         LIBPR = -lnspr$(MOD_VERSION)_shr
@@ -422,29 +426,42 @@ EXTRA_LIBS = -lsocket -lnsl -lresolv -ld
 # option for ld on other platforms.
 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
 endif
 
 ifeq ($(OS_ARCH), UNIXWARE)
 export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
 endif
 
+ifeq ($(OS_ARCH),FreeBSD)
+ifeq ($(USE_PTHREADS),1)
+LDOPTS += -pthread
+endif
+LDOPTS += -Xlinker -R $(ABSOLUTE_LIB_DIR)
+endif
+
 ifeq ($(OS_ARCH),OpenBSD)
 ifeq ($(USE_PTHREADS),1)
 LDOPTS += -pthread
 endif
 endif
 
 ifeq ($(OS_ARCH),FreeBSD)
 ifeq ($(USE_PTHREADS),1)
 LDOPTS += -pthread
 endif
 LDOPTS += -Xlinker -R $(ABSOLUTE_LIB_DIR)
 endif
 
+ifeq ($(OS_ARCH),OpenBSD)
+ifeq ($(USE_PTHREADS),1)
+LDOPTS += -pthread
+endif
+endif
+
 ifeq ($(OS_ARCH),BSD_OS)
 ifneq ($(OS_RELEASE),1.1)
 EXTRA_LIBS = -ldl
 endif
 endif
 
 ifeq ($(USE_PTHREADS),1)
 LIBPTHREAD = -lpthread
@@ -518,40 +535,43 @@ ifeq ($(OS_TARGET),WIN16)
 	echo $< , >>w16link
 	echo $(W16STDIO) >>w16link
 	echo library  >>w16link
 	echo $(LIBPR),	     >>w16link
 	echo $(LIBPLC),		 >>w16link
 	echo winsock.lib     >>w16link
 	wlink @w16link.
 else
-ifeq ($(OS_TARGET),OS2)
-	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
-else
 	link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) wsock32.lib -out:$@
 endif
-endif
+else
+ifeq ($(OS_ARCH),OS2)
+	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
 else
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@
 endif
-
+endif
 endif
 
 endif # !USE_AUTOCONF
 
 export:: $(TARGETS)
 install:: export
 clean::
 	rm -f $(TARGETS)
 
 ifndef USE_AUTOCONF
-# The prpoll test calls BSD socket functions, so it needs to link
+# The following tests call BSD socket functions, so they need to link
 # with -lsocket on some platforms.
 ifeq ($(OS_ARCH),SunOS)
 ifneq ($(OS_RELEASE),4.1.3_U1)
+ifeq ($(USE_IPV6),1)
+$(OBJDIR)/gethost: $(OBJDIR)/gethost.o
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) -lsocket $(EXTRA_LIBS) -o $@
+endif
 $(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) -lsocket $(EXTRA_LIBS) -o $@
 endif
 endif
 
 ifeq ($(USE_PTHREADS), 1)
 $(OBJDIR)/attach: $(OBJDIR)/attach.o
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
@@ -573,17 +593,17 @@ endif # !USE_AUTOCONF
 # Test output goes to the file pointed to by the environment variable
 # NSPR_TEST_LOGFILE, if set, else to /dev/null
 #
 ECHO = echo
 PROGRAMS = $(notdir $(PROGS))
 ifdef NSPR_TEST_LOGFILE
 LOGFILE = $(NSPR_TEST_LOGFILE)
 else
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 LOGFILE = nul
 else
 LOGFILE = /dev/null
 endif
 endif
 
 ifeq ($(OS_TARGET),Linux)
 ECHO = /bin/echo
--- a/pr/tests/dll/Makefile.in
+++ b/pr/tests/dll/Makefile.in
@@ -44,39 +44,41 @@ include $(topsrcdir)/config/config.mk
 
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
 endif
 
+CSRCS = mygetval.c mysetval.c
+
 INCLUDES = -I$(DIST)/include
 
 OBJS = $(OBJDIR)/mygetval.$(OBJ_SUFFIX) \
 	$(OBJDIR)/mysetval.$(OBJ_SUFFIX)
 
 ifeq ($(OS_TARGET), WIN16)
 W16OBJS = $(subst $(space),$(comma)$(space),$(OBJS))
 endif
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
+ifeq ($(OS_TARGET), WIN16)
 # do nothing
 else
 DLLBASE=/BASE:0x30000000
 RES=$(OBJDIR)/my.res
 RESNAME=../../../pr/src/nspr.rc
 endif
 endif
 
-ifeq ($(OS_ARCH), WINNT)
-IMPORT_LIBRARY	= $(OBJDIR)/my.lib
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+IMPORT_LIBRARY	= $(OBJDIR)/my.$(LIB_SUFFIX)
 SHARED_LIBRARY	= $(OBJDIR)/my.dll
-ifeq ($(OS_TARGET), OS2)
+ifeq ($(OS_ARCH), OS2)
 LIBRARY		= $(OBJDIR)/my_s.lib
 # XXX $(LIBRARY) probably doesn't need to be added to TARGETS.
 TARGETS		= $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
 else
 TARGETS		= $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
 endif
 else
 ifdef MKSHLIB
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -49,17 +49,17 @@ endif
 
 DIRS =
 
 CSRCS =             \
 	httpget.c	    \
 	tail.c		    \
 	$(NULL)
 
-ifeq ($(OS_ARCH), WINNT)
+ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS)
@@ -80,16 +80,26 @@ ifeq ($(OS_TARGET), WIN16)
   LIBPLC= $(DIST)/lib/plc$(NSPR_VERSION).lib
 else
 LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
 LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
 LIBPLC= $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
 endif
 endif
 
+ifeq ($(OS_ARCH),OS2)
+  ifeq ($(MOZ_OS2_TOOLS),VACPP)
+    LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
+    LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib
+    LIBPLC= $(DIST)/lib/plc$(NSPR_VERSION).lib
+  else
+    LDOPTS += -Zomf -Zlinker /PM:VIO
+  endif
+endif
+
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
 LDOPTS += -rpath $(PWD)/$(DIST)/lib
 endif
 
@@ -216,18 +226,21 @@ ifeq ($(OS_TARGET),WIN16)
 	echo $(LIBPR),	     >>w16link
 	echo $(LIBPLC),		 >>w16link
 	echo winsock.lib     >>w16link
 	wlink @w16link.
 else
 	link $(LDOPTS) $< $(LIBPR) $(LIBPLC) wsock32.lib -out:$@
 endif
 else
+ifeq ($(OS_ARCH),OS2)
+	$(LINK) $(LDOPTS) $< $(LIBPR) $(LIBPLC) $(OS_LIBS) $(EXTRA_LIBS) -o $@
+else
 	$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@
 endif
-
+endif
 endif
 
 export:: $(TARGETS)
 install:: export
 clean::
 	rm -f $(TARGETS)