More WIP, rewrite the script namespace manager to make registration of names be category driven, more nsIClassInfo fun, things are getting closer... XPCDOM_20010223_BRANCH
authorjst%netscape.com
Sat, 24 Mar 2001 01:34:46 +0000
branchXPCDOM_20010223_BRANCH
changeset 1790 bbb3fe071dde
parent 1732 f09901533cf9
push idunknown
push userunknown
push dateunknown
More WIP, rewrite the script namespace manager to make registration of names be category driven, more nsIClassInfo fun, things are getting closer...
Makefile
config/Makefile
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/windows/Makefile
pr/src/memory/Makefile
pr/src/misc/Makefile
pr/src/threads/Makefile
pr/src/threads/combined/Makefile
pr/tests/Makefile
pr/tests/dll/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #! gmake
 
 #
 # 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/
 # 
@@ -12,26 +13,41 @@
 # 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.
 #
 
-MOD_DEPTH = .
+MOD_DEPTH	= .
+topsrcdir	= .
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
 DIRS = config pr lib
 
 ifdef MOZILLA_CLIENT
 PR_CLIENT_BUILD = 1
 PR_CLIENT_BUILD_UNIX = 1
 endif
 
-include $(MOD_DEPTH)/config/rules.mk
+DIST_GARBAGE = config.cache config.log config.status
+
+all:: config.status export
+
+include $(topsrcdir)/config/rules.mk
+
+config.status:: configure
+ifeq ($(OS_ARCH),WINNT)
+	sh $(srcdir)/configure --no-create --no-recursion
+else
+	./config.status --recheck && ./config.status
+endif
 
 #
 # The -ll option of zip converts CR LF to LF.
 #
 ifeq ($(OS_ARCH),WINNT)
 ZIP_ASCII_OPT = -ll
 endif
 
@@ -39,20 +55,21 @@ ifdef PR_CLIENT_BUILD
 export::
 	rm -r -f $(DIST)/../public/nspr
 ifdef PR_CLIENT_BUILD_UNIX
 	rm -f $(libdir)/libnspr.a
 	rm -f $(bindir)/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/my_config.mk config/my_overrides.mk
+	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"; \
--- a/config/Makefile
+++ b/config/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #! gmake
 
 #
 # 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/
 # 
@@ -13,21 +14,29 @@
 # 
 # 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.
 #
 
 MOD_DEPTH	= ..
+topsrcdir	= ..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
 # Indicate that this directory builds build tools.
 INTERNAL_TOOLS	= 1
 
-include $(MOD_DEPTH)/config/config.mk
+# 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	= 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
@@ -80,17 +89,17 @@ 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 $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 PROGS	= $(OBJDIR)/now$(PROG_SUFFIX)
 
 ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
 TARGETS = $(PROGS)
 else
 PROGS	+= $(OBJDIR)/nsinstall$(PROG_SUFFIX)
 TARGETS = $(PROGS) $(PLSRCS:.pl=)
@@ -110,9 +119,8 @@ export:: $(TARGETS)
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 	$(LINK) $(EXEFLAGS) $<
 else
 	$(CC) $(XCFLAGS) $< $(XLDOPTS) $(OUTOPTION)$@
 endif
-
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,20 +13,24 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ..
+MOD_DEPTH	= ..
+topsrcdir	= ..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
 export NSPR20=1
 
-include $(MOD_DEPTH)/config/config.mk
+include $(topsrcdir)/config/config.mk
 
 DIRS = ds libc
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/lib/ds/Makefile
+++ b/lib/ds/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,41 +13,49 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../..
+MOD_DEPTH	= ../..
+topsrcdir	= ../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+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 =
 endif
 endif
+endif #!USE_AUTOCONF
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include
 
 CSRCS = \
 	plarena.c \
 	plhash.c \
 	plvrsion.c \
 	$(NULL)
 
 HEADERS = \
 	plarenas.h \
 	plarena.h \
 	plhash.h \
 	$(NULL)
 
+HEADERS := $(addprefix $(srcdir)/, $(HEADERS))
+
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
 # OS_CFLAGS = $(OS_EXE_CFLAGS)
 EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
 else
 DLLBASE=/BASE:0x30000000
 RES=$(OBJDIR)/plds.res
 RESNAME=plds.rc
@@ -59,17 +68,18 @@ endif
 
 ifdef MOZ_DEBUG
 ifdef GLOWCODE
 EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
 endif
 endif
 endif
 
-else
+ifndef USE_AUTOCONF
+
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
 
 else
 ifeq ($(OS_ARCH), AIX)
 ifeq ($(CLASSIC_NSPR),1)
 OS_LIBS += -lc
 else
@@ -89,25 +99,32 @@ endif
 # 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
 ifeq ($(OS_ARCH),SCOOS)
 EXTRA_LIBS =
 endif
+endif #!USE_AUTOCONF
+
+ifdef RESOLVE_LINK_SYMBOLS
+EXTRA_LIBS := -L$(libdir) -lnspr$(MOD_VERSION) $(OS_LIBS)
+endif
 
 LIBRARY_NAME	= plds
 LIBRARY_VERSION	= $(MOD_VERSION)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
 RELEASE_LIBS	= $(TARGETS)
 
-include $(MOD_DEPTH)/config/rules.mk
+GARBAGE += $(TINC)
+
+include $(topsrcdir)/config/rules.mk
 
 #
 # Version information generation (begin)
 #
 ECHO = echo
 TINC = $(OBJDIR)/_pl_bld.h
 PROD = $(notdir $(SHARED_LIBRARY))
 NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
@@ -128,22 +145,22 @@ endif
 	else \
 	    true; \
 	fi
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
 ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
+	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
 endif
 #
 # Version information generation (end)
 #
 
 #
 # The Client build wants the shared libraries in $(bindir),
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,20 +13,24 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../..
+MOD_DEPTH	= ../..
+topsrcdir	= ../..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
 export NSPR20=1
 
-include $(MOD_DEPTH)/config/config.mk
+include $(topsrcdir)/config/config.mk
 
 DIRS = include src
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/lib/libc/include/Makefile
+++ b/lib/libc/include/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,25 +13,29 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
-include $(MOD_DEPTH)/config/config.mk
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-HEADERS = $(wildcard *.h)
+include $(MOD_DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/config.mk
+
+HEADERS = $(wildcard $(srcdir)/*.h)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(HEADERS)
 	$(INSTALL) -m 444 $(HEADERS) $(includedir)
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)
 endif
 
 
--- a/lib/libc/src/Makefile
+++ b/lib/libc/src/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,26 +13,32 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+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 =
 endif
 endif
+endif #!USE_AUTOCONF
 
 INCLUDES = -I$(includedir)
 
 CSRCS =\
 	plvrsion.c  \
 	strlen.c  \
 	strcpy.c  \
 	strdup.c  \
@@ -67,17 +74,18 @@ endif
 
 ifdef MOZ_DEBUG
 ifdef GLOWCODE
 EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
 endif
 endif
 endif
 
-else
+ifndef USE_AUTOCONF
+
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
 
 else
 ifeq ($(OS_ARCH), AIX)
 ifeq ($(CLASSIC_NSPR),1)
 OS_LIBS += -lc
 else
@@ -97,18 +105,25 @@ endif
 # 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
 ifeq ($(OS_ARCH),SCOOS)
 EXTRA_LIBS =
 endif
+endif #!USE_AUTOCONF
 
-include $(MOD_DEPTH)/config/rules.mk
+ifdef RESOLVE_LINK_SYMBOLS
+EXTRA_LIBS := -L$(libdir) -lnspr$(MOD_VERSION) $(OS_LIBS)
+endif
+
+GARBAGE += $(TINC)
+
+include $(topsrcdir)/config/rules.mk
 
 #
 # Version information generation (begin)
 #
 ECHO = echo
 TINC = $(OBJDIR)/_pl_bld.h
 PROD = $(notdir $(SHARED_LIBRARY))
 NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
@@ -116,37 +131,35 @@ SH_DATE = $(shell date)
 SH_NOW = $(shell $(NOW))
 
 ifeq ($(OS_ARCH), WINNT)
 	SUF = i64
 else
 	SUF = LL
 endif
 
-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
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
 ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c
+	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
 endif
 #
 # Version information generation (end)
 #
 
 #
 # The Client build wants the shared libraries in $(bindir),
--- a/pr/Makefile
+++ b/pr/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,13 +13,17 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ..
+MOD_DEPTH	= ..
+topsrcdir	= ..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
 DIRS = include src
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
--- a/pr/include/Makefile
+++ b/pr/include/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,26 +13,30 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../..
+MOD_DEPTH	= ../..
+topsrcdir	= ../..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
 DIRS = md private obsolete
 
-include $(MOD_DEPTH)/config/config.mk
+include $(topsrcdir)/config/config.mk
 
-HEADERS = $(wildcard *.h)
+HEADERS = $(wildcard $(srcdir)/*.h)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(RELEASE_HEADERS)
 	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(includedir)
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL)
 endif
--- a/pr/include/md/Makefile
+++ b/pr/include/md/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,21 +13,28 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
-HEADERS = $(wildcard *.h)
+HEADERS = $(wildcard $(srcdir)/*.h)
+CONFIGS = $(wildcard $(srcdir)/*.cfg)
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
+
+ifndef USE_AUTOCONF
 
 ifeq ($(OS_ARCH),IRIX)
 ifeq ($(USE_64), 1)
 MDCPUCFG_H = _irix64.cfg
 else
 MDCPUCFG_H = _irix32.cfg
 endif
 endif
@@ -154,23 +162,26 @@ endif
 ifeq ($(OS_TARGET),NTO)
 MDCPUCFG_H = _nto.cfg
 endif
 
 ifeq ($(OS_ARCH),BeOS)
 MDCPUCFG_H = _beos.cfg
 endif
 
+endif # ! USE_AUTOCONF
+
 export:: $(MDCPUCFG_H)
-	$(INSTALL) -m 444 $(MDCPUCFG_H) $(includedir)
 ifeq ($(MOZ_BITS),16)
 	cp $(includedir)/$(MDCPUCFG_H) $(includedir)/prcpucfg.h
 	$(INSTALL) -m 444 $(MDCPUCFG_H) $(MOZ_INCL)
 	mv -f $(includedir)/$(MDCPUCFG_H) $(MOZ_INCL)/prcpucfg.h
 else
+	$(INSTALL) -m 444 $(CONFIGS) $(includedir)/md
+	$(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(includedir)
 ifneq ($(OS_ARCH),OpenVMS)
 	mv -f $(includedir)/$(MDCPUCFG_H) $(includedir)/prcpucfg.h
 else
 # mv'ing a link causes the file itself to move, not the link.
 	rm -f $(includedir)/$(MDCPUCFG_H)
 	rm -f $(includedir)/prcpucfg.h
 	ln -fs `pwd`/$(MDCPUCFG_H) $(includedir)/prcpucfg.h
 endif
--- a/pr/include/obsolete/Makefile
+++ b/pr/include/obsolete/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,24 +13,28 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
 
-HEADERS = $(wildcard *.h)
+include $(topsrcdir)/config/config.mk
+
+HEADERS = $(wildcard $(srcdir)/*.h)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/obsolete
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(RELEASE_HEADERS)
 	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(includedir)/obsolete
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL)/obsolete
 endif
--- a/pr/include/private/Makefile
+++ b/pr/include/private/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,24 +13,29 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/config.mk
 
 RELEASE_HEADERS = pprio.h pprthred.h prpriv.h
+RELEASE_HEADERS := $(addprefix $(srcdir)/, $(RELEASE_HEADERS))
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/private
 
-HEADERS = $(RELEASE_HEADERS) pprmwait.h primpl.h
+HEADERS = $(RELEASE_HEADERS) $(srcdir)/pprmwait.h $(srcdir)/primpl.h
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(RELEASE_HEADERS)
 	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(includedir)/private
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL)/private
 endif
--- a/pr/src/Makefile
+++ b/pr/src/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,19 +13,23 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../..
+MOD_DEPTH	= ../..
+topsrcdir	= ../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+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
 
@@ -35,16 +40,18 @@ endif
 ifeq ($(USE_BTHREADS), 1)
 	DIRS += bthreads
 endif
 
 ifeq ($(USE_CPLUS), 1)
 	DIRS += cplus
 endif
 
+ifndef USE_AUTOCONF
+
 #
 # Define platform-dependent OS_LIBS
 #
 
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
@@ -134,26 +141,28 @@ endif
 ifeq ($(OS_ARCH),UNIXWARE)
 OS_LIBS		= -lsocket -lc
 endif
 
 ifeq ($(OS_ARCH),NEWS-OS)
 OS_LIBS		= -lsocket -lnsl -lgen -lresolv
 endif
 
+ifdef GC_LEAK_DETECTOR
+OS_LIBS		+= -L$(libdir) -lboehm
+endif
+
+endif # USE_AUTOCONF
+
 ifeq ($(OS_ARCH),WINNT)
 ifneq ($(OS_TARGET),WIN16)
 OS_LIBS		= advapi32.lib wsock32.lib
 endif
 endif
 
-ifdef GC_LEAK_DETECTOR
-OS_LIBS		+= -L$(libdir) -lboehm
-endif
-
 #
 # Define platform-dependent OBJS
 #
 
 OBJS = \
     $(OBJDIR)/prvrsion.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prfdcach.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prmwait.$(OBJ_SUFFIX) \
@@ -256,17 +265,28 @@ DLLBASE=/BASE:0x30000000
 RES=$(OBJDIR)/nspr.res
 RESNAME=nspr.rc
 ifdef MOZ_DEBUG
 ifdef GLOWCODE
 EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
 endif
 endif
 endif
+endif # WINNT
 
+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)
 ifeq ($(OS_TARGET), WIN16)
 OBJS +=	md/windows/$(OBJDIR)/w16null.$(OBJ_SUFFIX) \
 	md/windows/$(OBJDIR)/w16proc.$(OBJ_SUFFIX)      \
 	md/windows/$(OBJDIR)/w16thred.$(OBJ_SUFFIX)      \
 	md/windows/$(OBJDIR)/w16fmem.$(OBJ_SUFFIX)      \
 	md/windows/$(OBJDIR)/w16sock.$(OBJ_SUFFIX)      \
 	md/windows/$(OBJDIR)/w16mem.$(OBJ_SUFFIX)      \
     md/windows/$(OBJDIR)/w16io.$(OBJ_SUFFIX)       \
@@ -314,59 +334,60 @@ OBJS +=	md/windows/$(OBJDIR)/ntdllmn.$(O
 	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) \
 	md/os2/$(OBJDIR)/os2rng.$(OBJ_SUFFIX)
 else
 
 ifeq ($(OS_ARCH), BeOS)
-	include md/beos/objs.mk
-	include bthreads/objs.mk
+	include $(srcdir)/md/beos/objs.mk
+	include $(srcdir)/bthreads/objs.mk
 else
 	# Unix
-	include md/unix/objs.mk
-endif
-endif
-endif
+	include $(srcdir)/md/unix/objs.mk
+endif # BeOS
+endif # OS2
+endif # WINNT
+endif # !USE_AUTOCONF
 
 LIBRARY_NAME = nspr
 LIBRARY_VERSION = $(MOD_VERSION)
 
 RELEASE_LIBS = $(TARGETS)
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
+
+EXTRA_LIBS = $(OS_LIBS)
 
 ifeq ($(BUILD_AIX_RTL_LIBC),1)
 TARGETS		+= $(AIX_RTL_LIBC)
 # XXX is this a shared library?
 endif
 
 #
 # Version information generation (begin)
 #
 ECHO = echo
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -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
 
@@ -375,48 +396,48 @@ SH_DATE = $(shell date)
 SH_NOW = $(shell $(NOW))
 
 ifeq ($(OS_ARCH), WINNT)
 	SUF = i64
 else
 	SUF = LL
 endif
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES		+= -D_NSPR_BUILD_
 
-GARBAGE     += $(TINC)
+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
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/prvrsion.$(OBJ_SUFFIX): prvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) prvrsion.c
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
 ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) prvrsion.c
+	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
-	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) prvrsion.c
+	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 endif
 endif
 #
 # Version information generation (end)
 #
 
 
 #
-# The Client build wants the shared libraries in $(bindir),
+# The Client build wants the shared libraries in $(bindir)
 # so we also install them there.
 #
 
 export:: $(TARGETS)
 	$(INSTALL) -m 444 $(TARGETS) $(libdir)
 ifdef SHARED_LIBRARY
 ifeq ($(OS_ARCH),HP-UX)
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(libdir)
@@ -433,8 +454,9 @@ ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
 endif
 
 ifeq ($(BUILD_AIX_RTL_LIBC),1)
 $(AIX_RTL_LIBC): /usr/ccs/lib/libc.a
 	rtl_enable -o $@ $<
 endif
 
+
--- a/pr/src/io/Makefile
+++ b/pr/src/io/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,19 +13,23 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
+
+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
 
@@ -49,16 +54,16 @@ ifndef USE_PTHREADS
 	    prfile.c \
 	    prio.c \
 	    prsocket.c \
 	    $(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES	+= -D_NSPR_BUILD_
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/linking/Makefile
+++ b/pr/src/linking/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,33 +13,37 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
+
+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 =           \
 	prlink.c   \
 	$(NULL)
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES += -D_NSPR_BUILD_
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/malloc/Makefile
+++ b/pr/src/malloc/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,31 +13,35 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
+
+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
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES += -D_NSPR_BUILD_
 
 CSRCS = prmalloc.c prmem.c
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/md/Makefile
+++ b/pr/src/md/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,19 +13,27 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
-include $(MOD_DEPTH)/config/config.mk
+include $(topsrcdir)/config/config.mk
+
+ifdef USE_AUTOCONF
+DIRS = $(PR_MD_ARCH_DIR)
+else
 
 ifeq ($(OS_ARCH),WINNT)
     DIRS = windows
 else
   ifeq ($(OS_ARCH),OS2)
     DIRS = os2
   else
   ifeq ($(OS_ARCH),BeOS)
@@ -36,23 +45,24 @@ else
 endif
 
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
 endif
+endif # USE_AUTOCONF
 
 CSRCS =          \
 	prosdep.c \
 	$(NULL)
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES	+= -D_NSPR_BUILD_
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/md/windows/Makefile
+++ b/pr/src/md/windows/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,19 +13,27 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../../..
+MOD_DEPTH	= ../../../..
+topsrcdir	= ../../../..
+srcdir		= .
+
+include $(MOD_DEPTH)/config/autoconf.mk
 
-include $(MOD_DEPTH)/config/config.mk
+include $(topsrcdir)/config/config.mk
+
+ifdef USE_AUTOCONF
+OS_TARGET=$(MOZ_WIN32_TARGET)
+endif
 
 ifeq ($(OS_TARGET), WIN16)
 CSRCS = \
 	w16null.c \
 	w16thred.c \
 	w16proc.c \
     w16fmem.c \
     w16sock.c \
@@ -71,16 +80,16 @@ CSRCS =          \
     w32rng.c \
     w32shm.c \
     $(NULL)
 endif
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES += -D_NSPR_BUILD_
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/memory/Makefile
+++ b/pr/src/memory/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,36 +13,42 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+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 =
 endif
 endif
+endif #!USE_AUTOCONF
 
 CSRCS = prseg.c prshm.c prshma.c
 
 ifdef GC_LEAK_DETECTOR
 CSRCS += prgcleak.c
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES += -D_NSPR_BUILD_
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
 
--- a/pr/src/misc/Makefile
+++ b/pr/src/misc/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,26 +13,32 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+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 =
 endif
 endif
+endif #!USE_AUTOCONF
 
 CSRCS = \
 	pralarm.c  \
 	pratom.c   \
 	prcountr.c \
 	prdtoa.c   \
 	prenv.c    \
 	prerr.c  \
@@ -39,49 +46,51 @@ CSRCS = \
 	prerrortable.c  \
 	prinit.c   \
 	prinrval.c \
 	pripc.c \
 	prlog2.c   \
 	prlong.c   \
 	prnetdb.c  \
 	prolock.c  \
-	prrng.c  \
+	prrng.c    \
 	prsystem.c \
 	prtime.c   \
 	prthinfo.c \
 	prtpool.c \
 	prtrace.c  \
 	$(NULL)
 
 ifndef USE_PTHREADS
 CSRCS += \
 	pripcsem.c \
 	$(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES	+= -D_NSPR_BUILD_
 
 RELEASE_BINS = compile-et.pl prerr.properties
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
+ifndef USE_AUTOCONF
 # An AIX Optimization bug causes PR_dtoa() to produce wrong result.
 # This suppresses optimization for this single compilation unit.
 ifeq ($(OS_ARCH), AIX)
 $(OBJDIR)/prdtoa.o:
 	@$(MAKE_OBJDIR)
 	$(CC) -o $@ -c $(filter-out -O, $(CFLAGS)) prdtoa.c
 endif
+endif #!USE_AUTOCONF
 
 #
 # Generate prerr.h, prerr.c, and prerr.properties from prerr.et.
 #
 build_prerr:
-	perl compile-et.pl prerr.et
+	$(PERL) $(srcdir)/compile-et.pl prerr.et
 
 export:: $(TARGETS)
 
 
--- a/pr/src/threads/Makefile
+++ b/pr/src/threads/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,36 +13,42 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/config.mk
 
 ifdef USE_PTHREADS
     DIRS =
 else
 ifdef USE_BTHREADS
     DIRS =
 else
     DIRS = combined
 endif
 endif
 
+ifndef USE_AUTOCONF
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
 endif
+endif
 
 ifdef USE_PTHREADS
 CSRCS = \
 	prcmon.c \
 	prrwlock.c   \
 	prtpd.c \
 	$(NULL)
 else
@@ -61,16 +68,16 @@ CSRCS =	\
 	prcthr.c \
 	prtpd.c \
 	$(NULL)
 endif
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES	+= -D_NSPR_BUILD_
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/threads/combined/Makefile
+++ b/pr/src/threads/combined/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,42 +13,48 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../../..
+MOD_DEPTH	= ../../../..
+topsrcdir	= ../../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+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 =
 endif
 endif
+endif #!USE_AUTOCONF
 
 ifdef USE_PTHREADS
 CSRCS =         \
 	$(NULL)
 else
 CSRCS =         \
     prucpu.c      \
 	prucv.c      \
 	prulock.c    \
 	pruthr.c     \
     prustack.c    \
 	$(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
-DEFINES     += -D_NSPR_BUILD_
+DEFINES	+= -D_NSPR_BUILD_
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/tests/Makefile
+++ b/pr/tests/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,19 +13,23 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../..
+MOD_DEPTH	= ../..
+topsrcdir	= ../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/config.mk
 
 ifeq ($(OS_TARGET), WIN16)
 OS_CFLAGS = $(OS_EXE_CFLAGS)
 W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX)
 endif
 
 ifeq ($(OS_TARGET),WIN16)
 DIRS = dll w16gui
@@ -80,17 +85,16 @@ CSRCS =             \
 	joinuu.c        \
 	layer.c		    \
 	lazyinit.c		\
 	lltest.c        \
 	lock.c          \
 	lockfile.c      \
 	logger.c		\
 	makedir.c		\
-	mbcs.c          \
 	multiacc.c		\
 	multiwait.c		\
 	many_cv.c		\
 	nameshm1.c      \
 	nbconn.c		\
 	nblayer.c		\
 	nonblock.c		\
 	ntioto.c        \
@@ -187,24 +191,26 @@ PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
 LDOPTS = -L$(libdir)
 LIBPR = -lnspr$(MOD_VERSION)
 LIBPLC = -lplc$(MOD_VERSION)
 
+ifndef USE_AUTOCONF
+
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
   LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
   LIBPLC= $(libdir)/plc$(MOD_VERSION).lib
 else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
   ifeq ($(OS_TARGET), WIN95)
     LIBPR = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
@@ -407,16 +413,29 @@ 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
@@ -426,24 +445,31 @@ endif
 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
+
 #####################################################
 #
 # The rules
 #
 #####################################################
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
+ifdef USE_AUTOCONF
+$(OBJDIR)/%$(PROG_SUFFIX): %.c
+	$(CC) $< -o $@ $(CFLAGS) $(LDOPTS) $(LIBPLC) $(LIBPR) $(OS_LIBS)
+
+else
 AIX_PRE_4_2 = 0
 ifeq ($(OS_ARCH),AIX)
 ifeq ($(OS_RELEASE),4.1)
 ifneq ($(USE_PTHREADS), 1)
 #AIX_PRE_4_2 = 1
 endif
 endif
 endif
@@ -494,20 +520,23 @@ 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)
 clean::
 	rm -f $(TARGETS)
 
+ifndef USE_AUTOCONF
 # 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
@@ -524,16 +553,18 @@ ifeq ($(USE_PTHREADS), 1)
 $(OBJDIR)/provider: $(OBJDIR)/provider.o
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
 $(OBJDIR)/socket: $(OBJDIR)/socket.o
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
 $(OBJDIR)/testfile: $(OBJDIR)/testfile.o
 	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
 endif
 
+endif # !USE_AUTOCONF
+
 #
 # Run the test programs with no arguments
 #
 # 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))
--- a/pr/tests/dll/Makefile
+++ b/pr/tests/dll/Makefile
@@ -1,8 +1,9 @@
+# Generated automatically from Makefile.in by configure.
 #
 # 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
@@ -12,19 +13,23 @@
 # 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.
 #
 
 #! gmake
 
-MOD_DEPTH = ../../..
+MOD_DEPTH	= ../../..
+topsrcdir	= ../../..
+srcdir		= .
 
-include $(MOD_DEPTH)/config/config.mk
+include $(MOD_DEPTH)/config/autoconf.mk
+
+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
 
@@ -69,17 +74,17 @@ endif
 #
 # To create a loadable module on Rhapsody, we must override
 # -dynamiclib with -bundle.
 #
 ifeq ($(OS_ARCH),Rhapsody)
 DSO_LDOPTS = -bundle
 endif
 
-include $(MOD_DEPTH)/config/rules.mk
+include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_TARGET), WIN16)
 # Note: The Win16 target: my.dll requires these macros
 # to be overridden to build the test .dll
 # default values in win16...mk are for release targets.
 #
 OS_DLL_OPTION = NOCASEEXACT
 OS_LIB_FLAGS = -irn