Merging in changes between XPCDOM_20010329_BASE and XPCDOM_20010420_BASE. XPCDOM_20010329_BRANCH
authorjst%netscape.com
Sun, 22 Apr 2001 12:33:44 +0000
branchXPCDOM_20010329_BRANCH
changeset 1833 25ab917cd853
parent 1794 65c323c01c40
push idunknown
push userunknown
push dateunknown
Merging in changes between XPCDOM_20010329_BASE and XPCDOM_20010420_BASE.
Makefile.in
build/autoconf/config.guess
build/autoconf/config.sub
config/HP-UX.mk
config/Makefile.in
config/autoconf.mk.in
config/config.mk
config/nspr-config.in
config/nspr.m4
config/rules.mk
configure
configure.in
gmakefile.win
lib/ds/Makefile.in
lib/libc/include/Makefile.in
lib/libc/src/Makefile.in
lib/msgc/include/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
macbuild/NSPR20PPC.mcp
pr/include/Makefile.in
pr/include/md/Makefile.in
pr/include/obsolete/Makefile.in
pr/include/private/Makefile.in
pr/src/Makefile.in
pr/src/bthreads/Makefile.in
pr/src/cplus/Makefile.in
pr/src/cplus/tests/Makefile.in
pr/src/io/Makefile.in
pr/src/linking/Makefile.in
pr/src/malloc/Makefile.in
pr/src/md/Makefile.in
pr/src/md/beos/Makefile.in
pr/src/md/mac/macsockotpt.c
pr/src/md/mac/macthr.c
pr/src/md/os2/Makefile.in
pr/src/md/unix/Makefile.in
pr/src/md/unix/objs.mk
pr/src/md/windows/Makefile.in
pr/src/memory/Makefile.in
pr/src/misc/Makefile.in
pr/src/prvrsion.c
pr/src/pthreads/Makefile.in
pr/src/threads/Makefile.in
pr/src/threads/combined/Makefile.in
pr/tests/Makefile.in
pr/tests/dll/Makefile.in
pr/tests/w16gui/Makefile.in
tools/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
@@ -49,18 +49,18 @@ endif
 ifeq ($(OS_ARCH),WINNT)
 ZIP_ASCII_OPT = -ll
 endif
 
 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)
+	rm -f $(dist_libdir)/libnspr.a
+	rm -f $(dist_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/autoconf.mk
--- a/build/autoconf/config.guess
+++ b/build/autoconf/config.guess
@@ -1,14 +1,14 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 #   Free Software Foundation, Inc.
 
-timestamp='2001-01-01'
+timestamp='2001-03-30'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,20 +28,16 @@ timestamp='2001-01-01'
 # Please send patches to <config-patches@gnu.org>.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
 # The plan is that this can be called by configure scripts if you
 # don't specify an explicit build system type.
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
 Usage: $0 [OPTION]
 
 Output the configuration name of the system \`$me' is run on.
 
@@ -88,31 +84,31 @@ done
 
 if test $# != 0; then
   echo "$me: too many arguments$help" >&2
   exit 1
 fi
 
 
 dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
 
 # CC_FOR_BUILD -- compiler used by this script.
 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
 # use `HOST_CC' if defined, but it is deprecated.
 
 case $CC_FOR_BUILD,$HOST_CC,$CC in
  ,,)    echo "int dummy(){}" > $dummy.c
 	for c in cc gcc c89 ; do
 	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
 	  if test $? = 0 ; then
 	     CC_FOR_BUILD="$c"; break
 	  fi
 	done
-	rm -f $dummy.c $dummy.o
+	rm -f $dummy.c $dummy.o $dummy.rel
 	if test x"$CC_FOR_BUILD" = x ; then
 	  CC_FOR_BUILD=no_compiler_found
 	fi
 	;;
  ,,*)   CC_FOR_BUILD=$CC ;;
  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
 esac
 
@@ -271,17 +267,17 @@ EOF
 	echo mipsel-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
 	exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit 0;;
-    SR2?01:HI-UX/MPP:*:*)
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
 	exit 0;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
 		echo pyramid-pyramid-sysv3
 	else
 		echo pyramid-pyramid-bsd
@@ -407,17 +403,17 @@ EOF
 	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
 	#endif
 	#endif
 	  exit (-1);
 	}
 EOF
 	$CC_FOR_BUILD $dummy.c -o $dummy \
 	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm $dummy.c $dummy && exit 0
+	  && rm -f $dummy.c $dummy && exit 0
 	rm -f $dummy.c $dummy
 	echo mips-mips-riscos${UNAME_RELEASE}
 	exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
 	echo powerpc-harris-powerunix
 	exit 0 ;;
     m88k:CX/UX:7*:*)
 	echo m88k-harris-cxux7
@@ -461,65 +457,60 @@ EOF
 	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
 	exit 0 ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
 	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
     i?86:AIX:*:*)
 	echo i386-ibm-aix
 	exit 0 ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit 0 ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
 		sed 's/^		//' << EOF >$dummy.c
 		#include <sys/systemcfg.h>
 
 		main()
 			{
 			if (!__power_pc())
 				exit(1);
 			puts("powerpc-ibm-aix3.2.5");
 			exit(0);
 			}
 EOF
-		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
 		rm -f $dummy.c $dummy
 		echo rs6000-ibm-aix3.2.5
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
 		echo rs6000-ibm-aix3.2.4
 	else
 		echo rs6000-ibm-aix3.2
 	fi
 	exit 0 ;;
-    *:AIX:*:4)
+    *:AIX:*:[45])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
 	fi
 	if [ -x /usr/bin/oslevel ] ; then
 		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV=4.${UNAME_RELEASE}
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
 	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
 	exit 0 ;;
-    *:AIX:*:5)
-	case "`lsattr -El proc0 -a type -F value`" in
-	    PowerPC*) IBM_ARCH=powerpc
-		      IBM_MANUF=ibm ;;
-	    Itanium)  IBM_ARCH=ia64
-		      IBM_MANUF=unknown ;;
-	    POWER*)   IBM_ARCH=power
-		      IBM_MANUF=ibm ;;
-	    *)        IBM_ARCH=powerpc
-		      IBM_MANUF=ibm ;;
-	esac
-	echo ${IBM_ARCH}-${IBM_MANUF}-aix${UNAME_VERSION}.${UNAME_RELEASE}
-	exit 0 ;;
     *:AIX:*:*)
 	echo rs6000-ibm-aix
 	exit 0 ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
 	echo romp-ibm-bsd4.4
 	exit 0 ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
@@ -624,17 +615,17 @@ EOF
 		}
 	    }
 	  else if (CPU_IS_HP_MC68K (cpu))
 	    puts ("m68k-hitachi-hiuxwe2");
 	  else puts ("unknown-hitachi-hiuxwe2");
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
 	rm -f $dummy.c $dummy
 	echo unknown-hitachi-hiuxwe2
 	exit 0 ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
 	echo hppa1.1-hp-bsd
 	exit 0 ;;
     9000/8??:4.3bsd:*:*)
 	echo hppa1.0-hp-bsd
@@ -730,20 +721,22 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
 	exit 0 ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit 0 ;;
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit 0 ;;
+#### MozillaHack 
 # Netscape's hacked uname
     xx:WINNT:* | xx:WIN95:*)
 	echo i586-pc-msvc
 	exit 0 ;;
+###  End MozillaHack
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit 0 ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
 	# UNAME_MACHINE based on the output of uname instead of i386?
 	echo i386-pc-interix
@@ -758,219 +751,181 @@ EOF
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit 0 ;;
     *:GNU:*:*)
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit 0 ;;
-    *:Linux:*:*)
-
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	ld_supported_emulations=`cd /; ld --help 2>&1 \
-			 | sed -ne '/supported emulations:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported emulations: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_emulations" in
-	  *ia64)
-		echo "${UNAME_MACHINE}-unknown-linux"
-		exit 0
-		;;
-	  i?86linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit 0
-		;;
-	  elf_i?86)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  i?86coff)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit 0
-		;;
-	  sparclinux)
-		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
-		exit 0
-		;;
-	  elf32_sparc)
-		echo "${UNAME_MACHINE}-unknown-linux-gnu"
-		exit 0
-		;;
-	  armlinux)
-		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
-		exit 0
-		;;
-	  elf32arm*)
-		echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
-		exit 0
-		;;
-	  armelf_linux*)
-		echo "${UNAME_MACHINE}-unknown-linux-gnu"
-		exit 0
-		;;
-	  m68klinux)
-		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
-		exit 0
-		;;
-	  elf32ppc | elf32ppclinux)
-		# Determine Lib Version
-		cat >$dummy.c <<EOF
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux
+	exit 0 ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    mips:Linux:*:*)
+	cat >$dummy.c <<EOF
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+int main (int argc, char *argv[]) {
+#else
+int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __MIPSEB__
+  printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+  printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+  return 0;
+}
+EOF
+	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+	rm -f $dummy.c $dummy
+	;;
+    ppc:Linux:*:*)
+	# Determine Lib Version
+	cat >$dummy.c <<EOF
 #include <features.h>
 #if defined(__GLIBC__)
 extern char __libc_version[];
 extern char __libc_release[];
 #endif
 main(argc, argv)
      int argc;
      char *argv[];
 {
 #if defined(__GLIBC__)
   printf("%s %s\n", __libc_version, __libc_release);
 #else
-  printf("unkown\n");
+  printf("unknown\n");
 #endif
   return 0;
 }
 EOF
-		LIBC=""
-		$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+	LIBC=""
+	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+	if test "$?" = 0 ; then
+		./$dummy | grep 1\.99 > /dev/null
+		if test "$?" = 0 ; then LIBC="libc1" ; fi
+	fi
+	rm -f $dummy.c $dummy
+	echo powerpc-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    alpha:Linux:*:*)
+	cat <<EOF >$dummy.s
+	  .data
+	  \$Lformat:
+		.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+	   .text
+		.globl main
+		.align 4
+		.ent main
+	    main:
+		.frame \$30,16,\$26,0
+		ldgp \$29,0(\$27)
+		.prologue 1
+		.long 0x47e03d80 # implver \$0
+		lda \$2,-1
+		.long 0x47e20c21 # amask \$2,\$1
+		lda \$16,\$Lformat
+		mov \$0,\$17
+		not \$1,\$18
+		jsr \$26,printf
+		ldgp \$29,0(\$26)
+		mov 0,\$16
+		jsr \$26,exit
+		.end main
+EOF
+	LIBC=""
+	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+	if test "$?" = 0 ; then
+		case `./$dummy` in
+		0-0)	UNAME_MACHINE="alpha" ;;
+		1-0)	UNAME_MACHINE="alphaev5" ;;
+		1-1)    UNAME_MACHINE="alphaev56" ;;
+		1-101)	UNAME_MACHINE="alphapca56" ;;
+		2-303)	UNAME_MACHINE="alphaev6" ;;
+		2-307)	UNAME_MACHINE="alphaev67" ;;
+		esac
+		objdump --private-headers $dummy | \
+		  grep ld.so.1 > /dev/null
 		if test "$?" = 0 ; then
-			./$dummy | grep 1\.99 > /dev/null
-			if test "$?" = 0 ; then
-				LIBC="libc1"
-			fi
+			LIBC="libc1"
 		fi
-		rm -f $dummy.c $dummy
-		echo powerpc-unknown-linux-gnu${LIBC}
+	fi
+	rm -f $dummy.s $dummy
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit 0 ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit 0 ;;
+    i?86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	ld_supported_emulations=`cd /; ld --help 2>&1 \
+			 | sed -ne '/supported emulations:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported emulations: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_emulations" in
+	  i?86linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
 		exit 0
 		;;
-	  shelf_linux)
-		echo "${UNAME_MACHINE}-unknown-linux-gnu"
+	  elf_i?86)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  i?86coff)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
 		exit 0
 		;;
 	esac
-
-	if test "${UNAME_MACHINE}" = "alpha" ; then
-		cat <<EOF >$dummy.s
-			.data
-		\$Lformat:
-			.byte 37,100,45,37,120,10,0	# "%d-%x\n"
-
-			.text
-			.globl main
-			.align 4
-			.ent main
-		main:
-			.frame \$30,16,\$26,0
-			ldgp \$29,0(\$27)
-			.prologue 1
-			.long 0x47e03d80 # implver \$0
-			lda \$2,-1
-			.long 0x47e20c21 # amask \$2,\$1
-			lda \$16,\$Lformat
-			mov \$0,\$17
-			not \$1,\$18
-			jsr \$26,printf
-			ldgp \$29,0(\$26)
-			mov 0,\$16
-			jsr \$26,exit
-			.end main
-EOF
-		LIBC=""
-		$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
-		if test "$?" = 0 ; then
-			case `./$dummy` in
-			0-0)
-				UNAME_MACHINE="alpha"
-				;;
-			1-0)
-				UNAME_MACHINE="alphaev5"
-				;;
-			1-1)
-				UNAME_MACHINE="alphaev56"
-				;;
-			1-101)
-				UNAME_MACHINE="alphapca56"
-				;;
-			2-303)
-				UNAME_MACHINE="alphaev6"
-				;;
-			2-307)
-				UNAME_MACHINE="alphaev67"
-				;;
-			esac
-
-			objdump --private-headers $dummy | \
-			  grep ld.so.1 > /dev/null
-			if test "$?" = 0 ; then
-				LIBC="libc1"
-			fi
-		fi
-		rm -f $dummy.s $dummy
-		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
-	elif test "${UNAME_MACHINE}" = "mips" ; then
-	  cat >$dummy.c <<EOF
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
-  printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
-  printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
-  return 0;
-}
-EOF
-	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
-	  rm -f $dummy.c $dummy
-	elif test "${UNAME_MACHINE}" = "s390"; then
-	  echo s390-ibm-linux && exit 0
-	elif test "${UNAME_MACHINE}" = "x86_64"; then
-	  echo x86_64-unknown-linux-gnu && exit 0
-	elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then
-	  # Look for CPU level
-	  case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	    PA7*)
-		echo hppa1.1-unknown-linux-gnu
-		;;
-	    PA8*)
-		echo hppa2.0-unknown-linux-gnu
-		;;
-	    *)
-		echo hppa-unknown-linux-gnu
-		;;
-	  esac
-	  exit 0
-	else
-	  # Either a pre-BFD a.out linker (linux-gnuoldld)
-	  # or one that does not give us useful --help.
-	  # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
-	  # If ld does not provide *any* "supported emulations:"
-	  # that means it is gnuoldld.
-	  test -z "$ld_supported_emulations" \
-	    && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
-	  case "${UNAME_MACHINE}" in
-	  i?86)
-	    VENDOR=pc;
-	    ;;
-	  *)
-	    VENDOR=unknown;
-	    ;;
-	  esac
-	  # Determine whether the default compiler is a.out or elf
-	  cat >$dummy.c <<EOF
+	# Either a pre-BFD a.out linker (linux-gnuoldld)
+	# or one that does not give us useful --help.
+	# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+	# If ld does not provide *any* "supported emulations:"
+	# that means it is gnuoldld.
+	test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+	case "${UNAME_MACHINE}" in
+	i?86)
+	  VENDOR=pc;
+	  ;;
+	*)
+	  VENDOR=unknown;
+	  ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	cat >$dummy.c <<EOF
 #include <features.h>
 #ifdef __cplusplus
 #include <stdio.h>  /* for printf() prototype */
 	int main (int argc, char *argv[]) {
 #else
 	int main (argc, argv) int argc; char *argv[]; {
 #endif
 #ifdef __ELF__
@@ -984,20 +939,20 @@ EOF
    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
 # endif
 #else
   printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
 #endif
   return 0;
 }
 EOF
-	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
-	  rm -f $dummy.c $dummy
-	  test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
-	fi ;;
+	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+	rm -f $dummy.c $dummy
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+	;;
 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
 # are messed up and put the nodename in both sysname and nodename.
     i?86:DYNIX/ptx:4*:*)
 	echo i386-sequent-sysv4
 	exit 0 ;;
     i?86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
@@ -1075,31 +1030,34 @@ EOF
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && echo i486-ncr-sysv4 && exit 0 ;;
-    m68*:LynxOS:2.*:*)
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit 0 ;;
-    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:* | i?86:LynxOS:4.0*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
 	echo sparc-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
-    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+    rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
 	exit 0 ;;
     RM*:ReliantUNIX-*:*:*)
 	echo mips-sni-sysv4
 	exit 0 ;;
     RM*:SINIX-*:*:*)
 	echo mips-sni-sysv4
@@ -1111,24 +1069,26 @@ EOF
 	else
 		echo ns32k-sni-sysv
 	fi
 	exit 0 ;;
     PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                            # says <Richard.M.Bartel@ccMail.Census.GOV>
         echo i586-unisys-sysv4
         exit 0 ;;
+#### MozillaHack 
     *:*OpenVMS*:*:*)
         case "${UNAME_SYSTEM}" in
             POSIX_for_OpenVMS_AXP) echo alpha-dec-openvmsposix ;;
             POSIX_for_OpenVMS_VAX) echo vax-dec-openvmsposix ;;
             OpenVMS) echo alpha-dec-openvms ;;
             *) echo unknown-dec-openvms ;;
         esac
         exit 0 ;;
+#### End MozillaHack 
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
 	echo hppa1.1-stratus-sysv4
 	exit 0 ;;
     *:*:*:FTX*)
 	# From seanf@swdc.stratus.com.
 	echo i860-stratus-sysv4
@@ -1197,23 +1157,46 @@ EOF
 	# operating systems.
 	if test "$cputype" = "386"; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
 	fi
 	echo ${UNAME_MACHINE}-unknown-plan9
 	exit 0 ;;
-    *:OS/2:*:*)
-	if test "$VACPP" = "yes"; then
+    i?86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	# echo ${UNAME_MACHINE}-pc-os2-emx
+#### MozillaHack 
+ 	if test "$VACPP" = "yes"; then
 		echo "i386-pc-os2_vacpp"
 	else
 		echo "i386-pc-os2_emx"
 	fi
-    exit 0;;
+#### End MozillaHack 
+	exit 0 ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit 0 ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit 0 ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit 0 ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
 
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
@@ -1295,32 +1278,45 @@ main ()
     if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
 	printf ("i386-sequent-ptx1\n"); exit (0);
     }
     printf ("i386-sequent-ptx\n"); exit (0);
 
 #endif
 
 #if defined (vax)
-#if !defined (ultrix)
-  printf ("vax-dec-bsd\n"); exit (0);
-#else
-  printf ("vax-dec-ultrix\n"); exit (0);
-#endif
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
 #endif
 
 #if defined (alliant) && defined (i860)
   printf ("i860-alliant-bsd\n"); exit (0);
 #endif
 
   exit (1);
 }
 EOF
 
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
 rm -f $dummy.c $dummy
 
 # Apollos put the system type in the environment.
 
 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -1346,27 +1342,28 @@ then
 	echo c4-convex-bsd
 	exit 0 ;;
     esac
 fi
 
 cat >&2 <<EOF
 $0: unable to guess system type
 
-The $version version of this script cannot recognize your system type.
-Please download the most up to date version of the config scripts:
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
 
     ftp://ftp.gnu.org/pub/gnu/config/
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
 pertinent to <config-patches@gnu.org> in order to provide the needed
 information to handle your system.
 
-config.guess version = $version
+config.guess timestamp = $timestamp
 
 uname -m = `(uname -m) 2>/dev/null || echo unknown`
 uname -r = `(uname -r) 2>/dev/null || echo unknown`
 uname -s = `(uname -s) 2>/dev/null || echo unknown`
 uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
 /bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
--- a/build/autoconf/config.sub
+++ b/build/autoconf/config.sub
@@ -1,14 +1,14 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 #   Free Software Foundation, Inc.
 
-timestamp='2001-01-01'
+timestamp='2001-03-30'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
 # can handle that machine.  It does not imply ALL GNU software can.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -64,17 +64,17 @@ Operation modes:
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
 
 Report bugs and patches to <config-patches@gnu.org>."
 
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
 help="
 Try \`$me --help' for more information."
 
@@ -112,17 +112,17 @@ case $# in
  *) echo "$me: too many arguments$help" >&2
     exit 1;;
 esac
 
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | storm-chaos*)
+  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
     then os=`echo $1 | sed 's/.*-/-/'`
     else os=; fi
@@ -221,30 +221,32 @@ case $basic_machine in
 		| 580 | i960 | h8300 \
 		| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
 		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
 		| hppa64 \
 		| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
 		| alphaev6[78] \
 		| we32k | ns16k | clipper | i370 | sh | sh[34] \
 		| powerpc | powerpcle \
-		| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
+		| 1750a | dsp16xx | pdp10 | pdp11 \
+		| mips16 | mips64 | mipsel | mips64el \
 		| mips64orion | mips64orionel | mipstx39 | mipstx39el \
 		| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
-		| mips64vr5000 | miprs64vr5000el | mcore \
+		| mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
 		| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
-		| thumb | d10v | d30v | fr30 | avr)
+		| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
+		| pj | pjl | h8500)
 		basic_machine=$basic_machine-unknown
 		;;
 	m6811 | m68hc11 | m6812 | m68hc12)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65)
 		;;
 
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
 	i[234567]86 | x86_64)
 	  basic_machine=$basic_machine-pc
 	  ;;
@@ -263,25 +265,26 @@ case $basic_machine in
 	      | xmp-* | ymp-* \
 	      | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
 	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
 	      | hppa2.0n-* | hppa64-* \
 	      | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
 	      | alphaev6[78]-* \
 	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
 	      | clipper-* | orion-* \
-	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+	      | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
 	      | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
 	      | mips64el-* | mips64orion-* | mips64orionel-* \
 	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
 	      | mipstx39-* | mipstx39el-* | mcore-* \
-	      | f30[01]-* | f700-* | s390-* | sv1-* | t3e-* \
+	      | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
+	      | [cjt]90-* \
 	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
-	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
-	      | bs2000-* | tic54x-* | c54x-* | x86_64-*)
+	      | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
+	      | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
 		basic_machine=i386-unknown
 		os=-bsd
 		;;
 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
@@ -362,18 +365,18 @@ case $basic_machine in
 	cray | ymp)
 		basic_machine=ymp-cray
 		os=-unicos
 		;;
 	cray2)
 		basic_machine=cray2-cray
 		os=-unicos
 		;;
-	[ctj]90-cray)
-		basic_machine=c90-cray
+	[cjt]90)
+		basic_machine=${basic_machine}-cray
 		os=-unicos
 		;;
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
 	cris | cris-* | etrax*)
 		basic_machine=cris-axis
 		;;
@@ -419,16 +422,20 @@ case $basic_machine in
 		;;
 	genix)
 		basic_machine=ns32k-ns
 		;;
 	gmicro)
 		basic_machine=tron-gmicro
 		os=-sysv
 		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
 	h3050r* | hiux*)
 		basic_machine=hppa1.1-hitachi
 		os=-hiuxwe2
 		;;
 	h8300hms)
 		basic_machine=h8300-hitachi
 		os=-hms
 		;;
@@ -518,32 +525,16 @@ case $basic_machine in
 	i386mach)
 		basic_machine=i386-mach
 		os=-mach
 		;;
 	i386-vsta | vsta)
 		basic_machine=i386-unknown
 		os=-vsta
 		;;
-	i386-go32 | go32)
-		basic_machine=i386-unknown
-		os=-go32
-		;;
-	i386-mingw32 | mingw32)
-		basic_machine=i386-unknown
-		os=-mingw32
-		;;
-	i386-msvc | msvc)
-		basic_machine=i386-unknown
-		os=-msvc
-		;;
-	i[34567]86-pw32 | pw32)
-		basic_machine=i586-unknown
-		os=-pw32
-		;;
 	iris | iris4d)
 		basic_machine=mips-sgi
 		case $os in
 		    -irix*)
 			;;
 		    *)
 			os=-irix4
 			;;
@@ -559,16 +550,26 @@ case $basic_machine in
 	magnum | m3230)
 		basic_machine=mips-mips
 		os=-sysv
 		;;
 	merlin)
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+#### MozillaHack 
+	i386-msvc | msvc)
+		basic_machine=i386-pc
+		os=-msvc
+		;;
+#### End MozillaHack 
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
 	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
 		basic_machine=m68k-atari
 		os=-mint
 		;;
 	mipsel*-linux*)
@@ -589,17 +590,17 @@ case $basic_machine in
 		basic_machine=mmix-knuth
 		os=-mmixware
 		;;
 	monitor)
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
 	msdos)
-		basic_machine=i386-unknown
+		basic_machine=i386-pc
 		os=-msdos
 		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
 	ncr3000)
 		basic_machine=i486-ncr
@@ -728,16 +729,20 @@ case $basic_machine in
 		basic_machine=powerpcle-unknown
 	        ;;
 	ppcle-* | powerpclittle-*)
 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ps2)
 		basic_machine=i386-ibm
 		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
 	rom68k)
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
 	rm[46]00)
 		basic_machine=mips-siemens
 		;;
 	rtpc | rtpc-*)
@@ -918,16 +923,20 @@ case $basic_machine in
 		basic_machine=romp-ibm
 		;;
 	rs6000)
 		basic_machine=rs6000-ibm
 		;;
 	vax)
 		basic_machine=vax-dec
 		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
 	pdp11)
 		basic_machine=pdp11-dec
 		;;
 	we32k)
 		basic_machine=we32k-att
 		;;
 	sh3 | sh4)
 		basic_machine=sh-unknown
@@ -949,16 +958,19 @@ case $basic_machine in
 		;;
 	pmac | pmac-mpw)
 		basic_machine=powerpc-apple
 		;;
 	c4x*)
 		basic_machine=c4x-none
 		os=-coff
 		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
 	*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
 		exit 1
 		;;
 esac
 
 # Here we canonicalize certain aliases for manufacturers.
 case $basic_machine in
@@ -990,20 +1002,22 @@ case $os in
 		os=-sysv4
 		;;
 	-unixware*)
 		os=-sysv4.2uw
 		;;
 	-gnu/linux*)
 		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
 		;;
+#### MozillaHack 
 	-os2_emx)
 		;;
 	-os2_vacpp)
 		;;
+#### End MozillaHack 
 	# First accept the basic system types.
 	# The portable systems comes first.
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
@@ -1012,18 +1026,19 @@ case $os in
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
 	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
-              | -msvc* \
-	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* | -storm-chaos*)
+	      | -msvc* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
 		case $basic_machine in
 		    x86-* | i[34567]86-*)
 			;;
 		    *)
 			os=-nto$os
@@ -1145,16 +1160,19 @@ case $basic_machine in
 		os=-riscix1.2
 		;;
 	arm*-rebel)
 		os=-linux
 		;;
 	arm*-semi)
 		os=-aout
 		;;
+	pdp10-*)
+		os=-tops20
+		;;
         pdp11-*)
 		os=-none
 		;;
 	*-dec | vax-*)
 		os=-ultrix4.2
 		;;
 	m68*-apollo)
 		os=-domain
--- a/config/HP-UX.mk
+++ b/config/HP-UX.mk
@@ -33,17 +33,18 @@ else
 	CCC			        = CC -ext
 	OS_CFLAGS           = +ESlit
 endif
 
 RANLIB			= echo
 
 CPU_ARCH		= hppa
 
-OS_CFLAGS		+= $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE
+OS_CFLAGS		+= $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE -Dhpux
+
 
 #
 # The header netdb.h on HP-UX 9 does not declare h_errno.
 # On 10.10 and 10.20, netdb.h declares h_errno only if
 # _XOPEN_SOURCE_EXTENDED is defined.  So we need to declare
 # h_errno ourselves.
 #
 ifeq ($(basename $(OS_RELEASE)),A.09)
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -24,17 +24,19 @@ VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 # Indicate that this directory builds build tools.
 INTERNAL_TOOLS	= 1
 
 # autoconf.mk must be deleted last (from the top-level directory)
 # because it is included by every makefile.
-DIST_GARBAGE	= nsprincl.mk nsprincl.sh
+DIST_GARBAGE	= nsprincl.mk nsprincl.sh nspr-config
+
+RELEASE_BINS	= nspr-config
 
 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
@@ -107,16 +109,21 @@ OUTOPTION = /Fe
 endif
 
 # Redefine MAKE_OBJDIR for just this directory
 define MAKE_OBJDIR
 if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi
 endef
 
 export:: $(TARGETS)
+	$(RM) -f $(dist_bindir)/nspr-config
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 	$(LD) $(EXEFLAGS) $<
 else
 	$(CC) $(XCFLAGS) $< $(XLDOPTS) $(OUTOPTION)$@
 endif
+
+real_install:: nspr.m4
+	$(NSINSTALL) -D $(DESTDIR)$(datadir)/aclocal
+	$(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(datadir)/aclocal
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -1,27 +1,42 @@
+# -*- Mode: Makefile -*-
 
 INCLUDED_AUTOCONF_MK = 1
 USE_AUTOCONF	= 1
 MOZILLA_CLIENT	= @MOZILLA_CLIENT@
-DIST		= @prefix@
+
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
 bindir		= @bindir@
-includedir	= @includedir@
+includedir	= @includedir@/nspr
 libdir		= @libdir@
+datadir		= @datadir@
+
+dist_prefix	= @dist_prefix@
+dist_bindir	= @dist_bindir@
+dist_includedir = @dist_includedir@/nspr
+dist_libdir	= @dist_libdir@
+
+DIST		= $(dist_prefix)
 
 OBJDIR_NAME	= @OBJDIR_NAME@
 OBJDIR		= @OBJDIR@
 OBJ_SUFFIX	= @OBJ_SUFFIX@
 LIB_SUFFIX	= @LIB_SUFFIX@
 DLL_SUFFIX	= @DLL_SUFFIX@
-MOD_VERSION	= @NSPR_VERSION@
 MOD_NAME	= @NSPR_MODNAME@
 
+MOD_MAJOR_VERSION = @MOD_MAJOR_VERSION@
+MOD_MINOR_VERSION = @MOD_MINOR_VERSION@
+MOD_REVISION_VERSION = @MOD_REVISION_VERSION@
+
+LIBNSPR		= @LIBNSPR@
+LIBPLC		= @LIBPLC@
+
 CROSS_COMPILE	= @CROSS_COMPILE@
 BUILD_OPT	= @MOZ_OPTIMIZE@
 
 USE_CPLUS	= @USE_CPLUS@
 USE_IPV6	= @USE_IPV6@
 USE_N32		= @USE_N32@
 USE_64		= @USE_64@
 GC_LEAK_DETECTOR = @GC_LEAK_DETECTOR@
--- a/config/config.mk
+++ b/config/config.mk
@@ -35,18 +35,16 @@ NSPR_CONFIG_MK	= 1
 ifndef topsrcdir
 topsrcdir=$(MOD_DEPTH)
 endif
 
 ifndef srcdir
 srcdir=.
 endif
 
-ifdef USE_AUTOCONF
-
 NFSPWD		= $(MOD_DEPTH)/config/nfspwd
 
 CFLAGS		= $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
 		  $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
 CCCFLAGS	= $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
 		  $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
 # For purify
 NOMD_CFLAGS	= $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
@@ -80,19 +78,17 @@ endif
 endif # WINNT || OS2
 
 ifdef BUILD_DEBUG_GC
 DEFINES		+= -DDEBUG_GC
 endif
 
 GARBAGE		+= $(DEPENDENCIES) core $(wildcard core.[0-9]*)
 
-ifdef USE_AUTOCONF
 DIST_GARBAGE += Makefile
-endif
 
 DEFINES += -DFORCE_PR_LOG
 
 ifeq ($(_PR_NO_CLOCK_TIMER),1)
 DEFINES += -D_PR_NO_CLOCK_TIMER
 endif
 
 ifeq ($(USE_PTHREADS), 1)
@@ -102,118 +98,16 @@ endif
 ifeq ($(PTHREADS_USER), 1)
 DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM
 endif
 
 ifeq ($(USE_IPV6),1)
 DEFINES += -D_PR_INET6
 endif
 
-else # ! USE_AUTOCONF
-
-ifndef NSPR_MY_CONFIG_MK
-NSPR_MY_CONFIG_MK = $(MOD_DEPTH)/config/my_config.mk
-endif
-
-#
-# The variable definitions in this file are used to
-# override variable values set by NSPR's build system.
-# This file, if present, is included at the end of config.mk.
-#
-# For example:
-#
-# DIST=/usr/local/nspr
-#
-ifndef NSPR_MY_OVERRIDES_MK
-NSPR_MY_OVERRIDES_MK = $(MOD_DEPTH)/config/my_overrides.mk
-endif
-
--include $(NSPR_MY_CONFIG_MK)
-
-include $(MOD_DEPTH)/config/module.df
-
-include $(MOD_DEPTH)/config/arch.mk
-
-ifndef NSDEPTH
-NSDEPTH = $(MOD_DEPTH)/..
-endif
-
-#
-# Default command macros; can be overridden in <arch>.mk.
-#
-# XXX FIXME: I removed CCF and LINKEXE.
-AS		= $(CC)
-ASFLAGS		= $(CFLAGS)
-PURIFY		= purify $(PURIFYOPTIONS)
-LINK_DLL	= $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
-NFSPWD		= $(MOD_DEPTH)/config/nfspwd
-
-CFLAGS		= $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
-		  $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
-CCCFLAGS	= $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
-		  $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
-# For purify
-NOMD_CFLAGS	= $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
-		  $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
-
-include $(MOD_DEPTH)/config/$(OS_TARGET).mk
-
-# Figure out where the binary code lives.
-BUILD		= $(OBJDIR_NAME)
-OBJDIR		= $(OBJDIR_NAME)
-DIST		= $(NSDEPTH)/dist/$(OBJDIR_NAME)
-ifeq ($(MOZ_BITS),16)
-MOZ_INCL	= $(NSDEPTH)/dist/public/win16
-MOZ_DIST	= $(NSDEPTH)/dist/WIN16D_D.OBJ
-endif
-
-# if not using autoconf, set these values accordingly
-prefix		= $(DIST)
-exec_prefix	= $(prefix)
-bindir		= $(prefix)/bin
-includedir	= $(prefix)/include
-libdir		= $(prefix)/lib
-
-VPATH		= $(OBJDIR)
-DEPENDENCIES	= $(OBJDIR)/.md
-
-ifdef BUILD_DEBUG_GC
-DEFINES		+= -DDEBUG_GC
-endif
-
-GARBAGE		+= $(DEPENDENCIES) core $(wildcard core.[0-9]*)
-
-####################################################################
-#
-# The NSPR-specific configuration
-#
-####################################################################
-
-OS_CFLAGS += -DFORCE_PR_LOG
-
-ifeq ($(_PR_NO_CLOCK_TIMER),1)
-OS_CFLAGS += -D_PR_NO_CLOCK_TIMER
-endif
-
-ifeq ($(USE_PTHREADS), 1)
-OS_CFLAGS += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
-endif
-
-ifeq ($(PTHREADS_USER), 1)
-OS_CFLAGS += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM
-endif
-
-ifeq ($(USE_IPV6),1)
-OS_CFLAGS += -D_PR_INET6
-endif
-
-ifdef GC_LEAK_DETECTOR
-OS_CFLAGS += -DGC_LEAK_DETECTOR
-endif
-
 ####################################################################
 #
 # Configuration for the release process
 #
 ####################################################################
 
 MDIST = /m/dist
 ifeq ($(OS_ARCH),WINNT)
@@ -224,11 +118,22 @@ endif
 # RELEASE_DIR is ns/dist/<module name>
 
 RELEASE_DIR = $(NSDEPTH)/dist/release/$(MOD_NAME)
 
 RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include
 RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin
 RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib
 
--include $(NSPR_MY_OVERRIDES_MK)
+#
+# The variable definitions in this file are used to
+# override variable values set by NSPR's build system.
+# This file, if present, is included at the end of config.mk.
+#
+# For example:
+#
+# DIST=/usr/local/nspr
+#
+ifndef NSPR_MY_OVERRIDES_MK
+NSPR_MY_OVERRIDES_MK = $(MOD_DEPTH)/config/my_overrides.mk
+endif
 
-endif # USE_AUTOCONF
+-include $(NSPR_MY_OVERRIDES_MK)
new file mode 100755
--- /dev/null
+++ b/config/nspr-config.in
@@ -0,0 +1,111 @@
+#!/bin/sh
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+exec_prefix_set=no
+
+major_version=@MOD_MAJOR_VERSION@
+minor_version=@MOD_MINOR_VERSION@
+revision_version=@MOD_REVISION_VERSION@
+
+usage()
+{
+	cat <<EOF
+Usage: nspr-config [OPTIONS] [LIBRARIES]
+Options:
+	[--prefix[=DIR]]
+	[--exec-prefix[=DIR]]
+	[--version]
+	[--libs]
+	[--cflags]
+Libraries:
+	nspr
+	plc
+	plds
+EOF
+	exit $1
+}
+
+if test $# -eq 0; then
+	usage 1 1>&2
+fi
+
+lib_nspr=yes
+lib_plc=yes
+lib_plds=yes
+
+while test $# -gt 0; do
+  case "$1" in
+  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  case $1 in
+    --prefix=*)
+      prefix=$optarg
+      if test $exec_prefix_set = no ; then
+        exec_prefix=$optarg
+      fi
+      ;;
+    --prefix)
+      echo_prefix=yes
+      ;;
+    --exec-prefix=*)
+      exec_prefix=$optarg
+      exec_prefix_set=yes
+      ;;
+    --exec-prefix)
+      echo_exec_prefix=yes
+      ;;
+    --version)
+      echo ${major_version}.${minor_version}.${revision_version}
+      ;;
+    --cflags)
+      echo_cflags=yes
+      ;;
+    --libs)
+      echo_libs=yes
+      ;;
+    nspr)
+      lib_nspr=yes
+      ;;
+    plc)
+      lib_plc=yes
+      ;;
+    plds)
+      lib_plds=yes
+      ;;
+    *)
+      usage 1 1>&2
+      ;;
+  esac
+  shift
+done
+
+if test "$echo_prefix" = "yes"; then
+	echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+	echo $exec_prefix
+fi
+
+if test "$echo_cflags" = "yes"; then
+      echo -I${prefix}/include/nspr
+fi
+
+if test "$echo_libs" = "yes"; then
+      libdirs=-L${exec_prefix}/lib
+      if test -n "$lib_plds"; then
+	libdirs="$libdirs -lplds${major_version}"
+      fi
+      if test -n "$lib_plc"; then
+	libdirs="$libdirs -lplc${major_version}"
+      fi
+      if test -n "$lib_nspr"; then
+	libdirs="$libdirs -lnspr${major_version}"
+      fi
+
+      echo $libdirs @LDFLAGS@ @OS_LIBS@
+fi      
+
new file mode 100644
--- /dev/null
+++ b/config/nspr.m4
@@ -0,0 +1,67 @@
+# -*- tab-width: 4; -*-
+# Configure paths for NSPR
+# Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
+# Based upon gtk.m4 (also PD) by Owen Taylor
+
+dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
+AC_DEFUN(AM_PATH_NSPR,
+[dnl
+
+AC_ARG_WITH(nspr-prefix,
+	[  --with-nspr-prefix=PFX  Prefix where NSPR is installed],
+	nspr_config_prefix="$withval",
+	nspr_config_prefix="")
+
+AC_ARG_WITH(nspr-exec-prefix,
+	[  --with-nspr-exec-prefix=PFX
+                          Exec prefix where NSPR is installed],
+	nspr_config_exec_prefix="$withval",
+	nspr_config_exec_prefix="")
+
+	if test -n "$nspr_config_exec_prefix"; then
+		nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
+		if test -z "$NSPR_CONFIG"; then
+			NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
+		fi
+	fi
+	if test -n "$nspr_config_prefix"; then
+		nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
+		if test -z "$NSPR_CONFIG"; then
+			NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
+		fi
+	fi
+
+	unset ac_cv_path_NSPR_CONFIG
+	AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
+	min_nspr_version=ifelse([$1], ,4.0.0,$1)
+	AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version (skipping))
+
+	no_nspr=""
+	if test "$NSPR_CONFIG" = "no"; then
+		no_nspr="yes"
+	else
+		NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
+		NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
+
+		dnl Skip version check for now
+		nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \
+			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+		nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \
+			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+		nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \
+			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+	fi
+
+	if test -z "$no_nspr"; then
+		AC_MSG_RESULT(yes)
+		ifelse([$2], , :, [$2])     
+	else
+		AC_MSG_RESULT(no)
+	fi
+
+
+	AC_SUBST(NSPR_CFLAGS)
+	AC_SUBST(NSPR_LIBS)
+
+])
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -84,17 +84,17 @@ endif
 
 ifdef LIBRARY_NAME
 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 
 #
 # Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
 # other platforms do not.
 #
-ifeq (,$(filter-out WIN95 WIN16 OS2,$(OS_TARGET)))
+ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
 LIBRARY		= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
 SHARED_LIBRARY	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
 IMPORT_LIBRARY	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
 else
 LIBRARY		= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
 SHARED_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
 IMPORT_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
 endif
@@ -127,35 +127,19 @@ endif
 # of assembly language source files).
 #
 
 ifndef OBJS
 OBJS		= $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
 		  $(addprefix $(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX)))
 endif
 
-ifeq ($(OS_TARGET), WIN16)
-	comma := ,
-	empty :=
-	space := $(empty) $(empty)
-	W16OBJS = $(subst $(space),$(comma)$(space),$(strip $(OBJS)))
-	W16TEMP =$(OS_LIBS) $(EXTRA_LIBS)
-    ifeq ($(strip $(W16TEMP)),)
-		W16LIBS =
-    else
-		W16LIBS = library $(subst $(space),$(comma)$(space),$(strip $(W16TEMP)))
-    endif
-	W16DEF = $(notdir $(basename $(SHARED_LIBRARY))).DEF
-endif
-
 ifeq ($(OS_ARCH), WINNT)
-ifneq ($(OS_TARGET), WIN16)
 OBJS += $(RES)
 endif
-endif
 
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 EXTRA_LIBS := $(patsubst -l%,$(DIST)/lib/%.$(LIB_SUFFIX),$(EXTRA_LIBS))
 endif
 
 ALL_TRASH		= $(TARGETS) $(OBJS) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
 			  $(NOSUCHFILE) \
 			  so_locations
@@ -196,16 +180,28 @@ clobber::
 realclean clobber_all::
 	rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH)
 	+$(LOOP_OVER_DIRS)
 
 distclean::
 	rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE)
 	+$(LOOP_OVER_DIRS)
 
+real_install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS)
+ifdef RELEASE_BINS
+	$(NSINSTALL) -t -m 0755 $(RELEASE_BINS) $(DESTDIR)$(bindir)
+endif
+ifdef RELEASE_HEADERS
+	$(NSINSTALL) -t -m 0644 $(RELEASE_HEADERS) $(DESTDIR)$(includedir)
+endif
+ifdef RELEASE_LIBS
+	$(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)
+endif
+	+$(LOOP_OVER_DIRS)
+
 release:: export
 ifdef RELEASE_BINS
 	@echo "Copying executable programs and scripts to release directory"
 	@if test -z "$(BUILD_NUMBER)"; then \
 		echo "BUILD_NUMBER must be defined"; \
 		false; \
 	else \
 		true; \
@@ -276,29 +272,20 @@ ifdef BUILD_OPT
 endif
 
 $(LIBRARY): $(OBJS)
 	@$(MAKE_OBJDIR)
 	rm -f $@
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 	$(AR) $(subst /,\\,$(OBJS)) $(AR_FLAGS)
 else
-ifdef USE_AUTOCONF
 	$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
-else
-	$(AR) $(OBJS) $(AR_EXTRA_ARGS)
-endif # USE_AUTOCONF
 endif
 	$(RANLIB) $@
 
-ifeq ($(OS_TARGET), WIN16)
-$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
-	wlib $(OS_LIB_FLAGS) $@ +$(SHARED_LIBRARY)
-endif
-
 ifeq ($(OS_TARGET), OS2)
 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
 	$(IMPLIB) $@ $(SHARED_LIBRARY).def
 endif
     
 $(SHARED_LIBRARY): $(OBJS)
 	@$(MAKE_OBJDIR)
 	rm -f $@
@@ -307,35 +294,17 @@ ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
 	nm -B -C -g $(OBJS) \
 		| awk '/ [T,D] / {print $$3}' \
 		| sed -e 's/^\.//' \
 		| sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms
 	$(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
 		-bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS)
 else	# AIX 4.1
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET), WIN16)
-	echo system windows dll initinstance >w16link
-	echo option map >>w16link
-	echo option oneautodata >>w16link
-	echo option heapsize=32K >>w16link
-	echo option $(OS_DLL_OPTION) >>w16link
-	echo debug $(DEBUGTYPE) all >>w16link
-	echo name $@ >>w16link
-	echo file >>w16link
-	echo $(W16OBJS) >>w16link
-	echo $(W16IMPORTS) >>w16link
-	echo $(W16LIBS) >>w16link
-	echo $(W16_EXPORTS) >>w16link
-	echo libfile libentry >>w16link
-	$(LINK) @w16link.
-	rm w16link
-else	# WIN16
-	$(LINK_DLL) -MAP $(DLLBASE) $(OS_LIBS) $(EXTRA_LIBS) $(OBJS)
-endif # WINNT
+	$(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS)
 else
 ifeq ($(OS_ARCH),OS2)
 # append ( >> ) doesn't seem to be working under OS/2 gmake. Run through OS/2 shell instead.	
 	@cmd /C "echo LIBRARY $(notdir $(basename $(SHARED_LIBRARY))) INITINSTANCE TERMINSTANCE >$@.def"
 	@cmd /C "echo PROTMODE >>$@.def"
 	@cmd /C "echo CODE    LOADONCALL MOVEABLE DISCARDABLE >>$@.def"
 	@cmd /C "echo DATA    PRELOAD MOVEABLE MULTIPLE NONSHARED >>$@.def"	
 	@cmd /C "echo EXPORTS >>$@.def"
@@ -345,21 +314,17 @@ else	# OS2
 ifeq ($(OS_TARGET), OpenVMS)
 	@if test ! -f $(OBJDIR)/VMSuni.opt; then \
 	    echo "Creating universal symbol option file $(OBJDIR)/VMSuni.opt";\
 	    create_opt_uni $(OBJS); \
 	fi
 	$(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OBJDIR)/VMSuni.opt
 	@echo "`translate $@`" > $(@:.$(DLL_SUFFIX)=.vms)
 else	# OpenVMS
-ifdef USE_AUTOCONF
 	$(MKSHLIB) $(OBJS) $(EXTRA_LIBS)
-else
-	$(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OS_LIBS)
-endif   # USE_AUTOCONF
 endif	# OpenVMS
 endif   # OS2
 endif	# WINNT
 endif	# AIX 4.1
 ifdef BUILD_OPT
 	$(STRIP) $@
 endif
 
@@ -389,24 +354,17 @@ endif
 endif
 
 WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
 WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
 WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
 $(OBJDIR)/%.$(OBJ_SUFFIX): %.c
 	@$(MAKE_OBJDIR)
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET), WIN16)
-#	$(MOD_DEPTH)/config/w16opt $(WCCFLAGS3)
-	echo $(WCCFLAGS3) >w16wccf
-	$(CC) -zq -fo$(OBJDIR)\\$*.$(OBJ_SUFFIX)  @w16wccf $*.c
-	rm w16wccf
-else
 	$(CC) -Fo$@ -c $(CFLAGS) $<
-endif
 else
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 	$(CC) -Fo$@ -c $(CFLAGS) $<
 else
 	$(CC) -o $@ -c $(CFLAGS) $<
 endif
 endif
 
--- a/configure
+++ b/configure
@@ -6,28 +6,35 @@
 #
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 
 # Defaults:
 ac_help=
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
-ac_default_prefix=\${MOD_DEPTH}/dist
+ac_help="$ac_help
+  --with-dist-prefix=DIST_PREFIX
+                          place build files in DIST_PREFIX [dist]"
+ac_help="$ac_help
+  --with-dist-bindir=DIR  build execuatables in DIR [DIST_PREFIX/bin]"
+ac_help="$ac_help
+  --with-dist-includedir=DIR
+                          build include files in DIR [DIST_PREFIX/include]"
+ac_help="$ac_help
+  --with-dist-libdir=DIR  build library files in DIR [DIST_PREFIX/lib]"
 ac_help="$ac_help
   --with-mozilla          Compile NSPR with Mozilla support"
 ac_help="$ac_help
-  --enable-optimize(=flag) Enable code optimizations (flag, ie. -O2) "
+  --enable-optimize(=val) Enable code optimizations (val, ie. -O2) "
 ac_help="$ac_help
   --disable-debug         Do not compile in debugging symbols"
 ac_help="$ac_help
-  --disable-shared        Do not compile into shared libraries"
-ac_help="$ac_help
   --enable-win32-target=\$t
-                               Specify win32 flavor. (WIN95 or WINNT)"
+                          Specify win32 flavor. (WIN95 or WINNT)"
 ac_help="$ac_help
   --enable-n32            Enable n32 ABI support (IRIX only)"
 ac_help="$ac_help
   --enable-64bit          Enable 64-bit support (on certain platforms)"
 ac_help="$ac_help
   --enable-mdupdate       Enable use of certain compilers' mdupdate feature"
 ac_help="$ac_help
   --with-pthreads         Use system pthreads library as thread subsystem"
@@ -35,17 +42,17 @@ ac_help="$ac_help
   --enable-user-pthreads  Build using userland pthreads"
 ac_help="$ac_help
   --enable-nspr-threads   Build using classic nspr threads"
 ac_help="$ac_help
   --with-bthreads         Use system bthreads library as thread subsystem (BeOS only)"
 ac_help="$ac_help
   --with-native-threads   Use native system threads as thread subsystem (Solaris only)"
 ac_help="$ac_help
-  --enable-cplus          Use cplus for whatever reason"
+  --enable-cplus          Enable some c++ api routines"
 ac_help="$ac_help
   --enable-ipv6           Compile ipv6 support"
 ac_help="$ac_help
   --enable-boehm          Enable the Boehm Garbage Collector"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
 # dashes changed to underlines.
@@ -598,17 +605,17 @@ esac
 
 
 # Make sure we can run config.sub.
 if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
 else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:607: checking host system type" >&5
+echo "configure:614: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
 NONE)
   case $nonopt in
   NONE)
     if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
     else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
@@ -619,17 +626,17 @@ esac
 
 host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:628: checking target system type" >&5
+echo "configure:635: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
 NONE)
   case $nonopt in
   NONE) target_alias=$host_alias ;;
   *) target_alias=$nonopt ;;
   esac ;;
@@ -637,17 +644,17 @@ esac
 
 target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
 target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:646: checking build system type" >&5
+echo "configure:653: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
 NONE)
   case $nonopt in
   NONE) build_alias=$host_alias ;;
   *) build_alias=$nonopt ;;
   esac ;;
@@ -660,23 +667,24 @@ build_os=`echo $build | sed 's/^\([^-]*\
 echo "$ac_t""$build" 1>&6
 
 test "$host_alias" != "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 
-
 cat >> confdefs.h <<\EOF
 #define USE_AUTOCONF 1
 EOF
 
 
-NSPR_VERSION=4
+MOD_MAJOR_VERSION=4
+MOD_MINOR_VERSION=0
+MOD_REVISION_VERSION=1
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -685,16 +693,18 @@ USE_MDUPDATE=
 _OPTIMIZE_FLAGS=-O
 _DEBUG_FLAGS=-g
 MOZ_DEBUG=1
 MOZ_OPTIMIZE=
 OBJDIR=.
 OBJDIR_NAME=.
 NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall'
 NOSUCHFILE=/no-such-file
+LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
+LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)'
 
 RESOLVE_LINK_SYMBOLS=
 
 CFLAGS="${CFLAGS=}"
 CXXFLAGS="${CXXFLAGS=}"
 LDFLAGS="${LDFLAGS=}"
 HOST_CFLAGS="${HOST_CFLAGS=}"
 HOST_LDFLAGS="${HOST_LDFLAGS=}"
@@ -722,16 +732,54 @@ case "$target" in
 esac
 
 if test -n "$_WIN32_MSVC"; then
     SKIP_PATH_CHECKS=1
     SKIP_COMPILER_CHECKS=1
     SKIP_LIBRARY_CHECKS=1
 fi
 
+dist_prefix='${MOD_DEPTH}/dist'
+dist_bindir='${dist_prefix}/bin'
+dist_includedir='${dist_prefix}/include'
+dist_libdir='${dist_prefix}/lib'
+
+# Check whether --with-dist-prefix or --without-dist-prefix was given.
+if test "${with_dist_prefix+set}" = set; then
+  withval="$with_dist_prefix"
+  dist_prefix=$withval
+fi
+
+
+# Check whether --with-dist-bindir or --without-dist-bindir was given.
+if test "${with_dist_bindir+set}" = set; then
+  withval="$with_dist_bindir"
+  dist_bindir=$withval
+fi
+
+
+# Check whether --with-dist-includedir or --without-dist-includedir was given.
+if test "${with_dist_includedir+set}" = set; then
+  withval="$with_dist_includedir"
+  dist_includedir=$withval
+fi
+
+
+# Check whether --with-dist-libdir or --without-dist-libdir was given.
+if test "${with_dist_libdir+set}" = set; then
+  withval="$with_dist_libdir"
+  dist_libdir=$withval
+fi
+
+
+
+
+
+
+
 # Check whether --with-mozilla or --without-mozilla was given.
 if test "${with_mozilla+set}" = set; then
   withval="$with_mozilla"
      if test "$withval" = "yes"; then
             cat >> confdefs.h <<\EOF
 #define MOZILLA_CLIENT 1
 EOF
 
@@ -766,23 +814,16 @@ fi
 if test "${enable_debug+set}" = set; then
   enableval="$enable_debug"
   	if test "$enableval" = "no"; then
     	    MOZ_DEBUG=
 	    fi
 fi
 
 
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
-  enableval="$enable_shared"
-  :
-fi
-
-
 # Check whether --enable-win32-target or --disable-win32-target was given.
 if test "${enable_win32_target+set}" = set; then
   enableval="$enable_win32_target"
   MOZ_WIN32_TARGET=`echo $enableval | tr a-z A-Z`
 else
   MOZ_WIN32_TARGET=
 fi
 
@@ -816,17 +857,17 @@ if test "${enable_mdupdate+set}" = set; 
       fi 
 fi
 
 
 if test -z "$SKIP_PATH_CHECKS"; then
     # Extract the first word of "$WHOAMI whoami", so it can be a program name with args.
 set dummy $WHOAMI whoami; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:825: checking for $ac_word" >&5
+echo "configure:866: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$WHOAMI" in
   /*)
   ac_cv_path_WHOAMI="$WHOAMI" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -881,24 +922,24 @@ if test "$target" != "$host"; then
     echo "cross compiling from $host to $target"
     cross_compiling=yes
 
     _SAVE_CC="$CC"
     _SAVE_CFLAGS="$CFLAGS"
     _SAVE_LDFLAGS="$LDFLAGS"
 
     echo $ac_n "checking for $host compiler""... $ac_c" 1>&6
-echo "configure:890: checking for $host compiler" >&5
+echo "configure:931: checking for $host compiler" >&5
     if test -z "$HOST_CC"; then
 	    for ac_prog in gcc cc /usr/ucb/cc
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:897: checking for $ac_word" >&5
+echo "configure:938: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$HOST_CC"; then
   ac_cv_prog_HOST_CC="$HOST_CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -935,26 +976,26 @@ test -n "$HOST_CC" || HOST_CC=""""
 	    HOST_LDFLAGS="$LDFLAGS"
     fi
 
     CC="$HOST_CC"
     CFLAGS="$HOST_CFLAGS"
     LDFLAGS="$HOST_LDFLAGS"
 
     echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:944: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+echo "configure:985: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
     cat > conftest.$ac_ext <<EOF
-#line 946 "configure"
+#line 987 "configure"
 #include "confdefs.h"
 
 int main() {
 return(0);
 ; return 0; }
 EOF
-if { (eval echo configure:953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   { echo "configure: error: installation or configuration problem: $host compiler $HOST_CC cannot create executables." 1>&2; exit 1; } 
 fi
@@ -965,17 +1006,17 @@ rm -f conftest*
     LDFLAGS=$_SAVE_LDFLAGS
 
     if test -z "$CC"; then
 	    for ac_prog in "${target_alias}-gcc" "${target}-gcc"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:974: checking for $ac_word" >&5
+echo "configure:1015: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1000,17 +1041,17 @@ test -n "$CC" && break
 done
 test -n "$CC" || CC="echo"
 
     fi
     unset ac_cv_prog_CC
     # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1009: checking for $ac_word" >&5
+echo "configure:1050: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1030,17 +1071,17 @@ if test -n "$CC"; then
 else
   echo "$ac_t""no" 1>&6
 fi
 
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1039: checking for $ac_word" >&5
+echo "configure:1080: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
@@ -1081,17 +1122,17 @@ else
 fi
 
   if test -z "$CC"; then
     case "`uname -s`" in
     *win32* | *WIN32*)
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1090: checking for $ac_word" >&5
+echo "configure:1131: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1113,33 +1154,33 @@ else
 fi
  ;;
     esac
   fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1122: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1163: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 1133 "configure"
+#line 1174 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cc_cross=no
   else
     ac_cv_prog_cc_cross=yes
   fi
 else
@@ -1155,31 +1196,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1164: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1205: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1169: checking whether we are using GNU C" >&5
+echo "configure:1210: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1178: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1219: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
@@ -1188,17 +1229,17 @@ if test $ac_cv_prog_gcc = yes; then
 else
   GCC=
 fi
 
 ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1197: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1238: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -1225,17 +1266,17 @@ else
 fi
 
     if test -z "$CXX"; then
 	    for ac_prog in "${target_alias}-g++" "${target}-g++"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1234: checking for $ac_word" >&5
+echo "configure:1275: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CXX"; then
   ac_cv_prog_CXX="$CXX" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1262,17 +1303,17 @@ test -n "$CXX" || CXX="echo"
 
     fi
     unset ac_cv_prog_CXX
     for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1271: checking for $ac_word" >&5
+echo "configure:1312: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CXX"; then
   ac_cv_prog_CXX="$CXX" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1294,33 +1335,33 @@ else
 fi
 
 test -n "$CXX" && break
 done
 test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1303: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1344: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cxx_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 1314 "configure"
+#line 1355 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cxx_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cxx_cross=no
   else
     ac_cv_prog_cxx_cross=yes
   fi
 else
@@ -1336,31 +1377,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
 if test $ac_cv_prog_cxx_works = no; then
   { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1345: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1386: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
 cross_compiling=$ac_cv_prog_cxx_cross
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1350: checking whether we are using GNU C++" >&5
+echo "configure:1391: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.C <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gxx" 1>&6
 
@@ -1369,17 +1410,17 @@ if test $ac_cv_prog_gxx = yes; then
 else
   GXX=
 fi
 
 ac_test_CXXFLAGS="${CXXFLAGS+set}"
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1378: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1419: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.cc
 if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -1406,17 +1447,17 @@ else
 fi
 
     if test -z "$RANLIB"; then
 	    for ac_prog in "${target_alias}-ranlib" "${target}-ranlib"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1415: checking for $ac_word" >&5
+echo "configure:1456: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1443,17 +1484,17 @@ test -n "$RANLIB" || RANLIB="echo"
 
     fi
     if test -z "$AR"; then
 	    for ac_prog in "${target_alias}-ar" "${target}-ar"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1452: checking for $ac_word" >&5
+echo "configure:1493: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$AR"; then
   ac_cv_prog_AR="$AR" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1480,17 +1521,17 @@ test -n "$AR" || AR="echo"
 
     fi
     if test -z "$AS"; then
 	    for ac_prog in "${target_alias}-as" "${target}-as"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1489: checking for $ac_word" >&5
+echo "configure:1530: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$AS"; then
   ac_cv_prog_AS="$AS" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1517,17 +1558,17 @@ test -n "$AS" || AS="echo"
 
     fi
     if test -z "$LD"; then
 	    for ac_prog in "${target_alias}-ld" "${target}-ld"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1526: checking for $ac_word" >&5
+echo "configure:1567: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$LD"; then
   ac_cv_prog_LD="$LD" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1554,17 +1595,17 @@ test -n "$LD" || LD="echo"
 
     fi
     if test -z "$STRIP"; then
 	    for ac_prog in "${target_alias}-strip" "${target}-strip"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1563: checking for $ac_word" >&5
+echo "configure:1604: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$STRIP"; then
   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1591,17 +1632,17 @@ test -n "$STRIP" || STRIP="echo"
 
     fi
     if test -z "$DLLTOOL"; then
 	    for ac_prog in "${target_alias}-dlltool" "${target}-dlltool"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1600: checking for $ac_word" >&5
+echo "configure:1641: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$DLLTOOL"; then
   ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1628,17 +1669,17 @@ test -n "$DLLTOOL" || DLLTOOL="echo"
 
     fi
     if test -z "$WINDRES"; then
 	    for ac_prog in "${target_alias}-windres" "${target}-windres"
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1637: checking for $ac_word" >&5
+echo "configure:1678: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$WINDRES"; then
   ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1666,17 +1707,17 @@ test -n "$WINDRES" || WINDRES="echo"
     fi
 
 else
     for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1675: checking for $ac_word" >&5
+echo "configure:1716: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CXX"; then
   ac_cv_prog_CXX="$CXX" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1698,33 +1739,33 @@ else
 fi
 
 test -n "$CXX" && break
 done
 test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1707: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1748: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cxx_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 1718 "configure"
+#line 1759 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cxx_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cxx_cross=no
   else
     ac_cv_prog_cxx_cross=yes
   fi
 else
@@ -1740,31 +1781,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
 if test $ac_cv_prog_cxx_works = no; then
   { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1749: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1790: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
 cross_compiling=$ac_cv_prog_cxx_cross
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1754: checking whether we are using GNU C++" >&5
+echo "configure:1795: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.C <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gxx" 1>&6
 
@@ -1773,17 +1814,17 @@ if test $ac_cv_prog_gxx = yes; then
 else
   GXX=
 fi
 
 ac_test_CXXFLAGS="${CXXFLAGS+set}"
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1782: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1823: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.cc
 if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
   ac_cv_prog_cxx_g=yes
 else
   ac_cv_prog_cxx_g=no
@@ -1810,17 +1851,17 @@ else
 fi
 
     if test "$CXX" = "cl" -a -z "$CC"; then
         CC=$CXX
     else        
         # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1819: checking for $ac_word" >&5
+echo "configure:1860: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1840,17 +1881,17 @@ if test -n "$CC"; then
 else
   echo "$ac_t""no" 1>&6
 fi
 
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1849: checking for $ac_word" >&5
+echo "configure:1890: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
@@ -1891,17 +1932,17 @@ else
 fi
 
   if test -z "$CC"; then
     case "`uname -s`" in
     *win32* | *WIN32*)
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1900: checking for $ac_word" >&5
+echo "configure:1941: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -1923,33 +1964,33 @@ else
 fi
  ;;
     esac
   fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1932: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1973: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 1943 "configure"
+#line 1984 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
     ac_cv_prog_cc_cross=no
   else
     ac_cv_prog_cc_cross=yes
   fi
 else
@@ -1965,31 +2006,31 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAG
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1974: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2015: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1979: checking whether we are using GNU C" >&5
+echo "configure:2020: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1988: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
 fi
 fi
 
 echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
@@ -1998,17 +2039,17 @@ if test $ac_cv_prog_gcc = yes; then
 else
   GCC=
 fi
 
 ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2007: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2048: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
   ac_cv_prog_cc_g=no
@@ -2033,17 +2074,17 @@ else
     CFLAGS=
   fi
 fi
 
     fi
     # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2042: checking for $ac_word" >&5
+echo "configure:2083: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
@@ -2065,17 +2106,17 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
     for ac_prog in as
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2074: checking for $ac_word" >&5
+echo "configure:2115: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$AS" in
   /*)
   ac_cv_path_AS="$AS" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2106,17 +2147,17 @@ test -n "$AS" && break
 done
 test -n "$AS" || AS="$CC"
 
     for ac_prog in ar
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2115: checking for $ac_word" >&5
+echo "configure:2156: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$AR" in
   /*)
   ac_cv_path_AR="$AR" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2147,17 +2188,17 @@ test -n "$AR" && break
 done
 test -n "$AR" || AR="echo not_ar"
 
     for ac_prog in ld link
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2156: checking for $ac_word" >&5
+echo "configure:2197: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$LD" in
   /*)
   ac_cv_path_LD="$LD" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2188,17 +2229,17 @@ test -n "$LD" && break
 done
 test -n "$LD" || LD="echo not_ld"
 
     for ac_prog in strip
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2197: checking for $ac_word" >&5
+echo "configure:2238: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$STRIP" in
   /*)
   ac_cv_path_STRIP="$STRIP" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2229,17 +2270,17 @@ test -n "$STRIP" && break
 done
 test -n "$STRIP" || STRIP="echo not_strip"
 
     for ac_prog in dlltool
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2238: checking for $ac_word" >&5
+echo "configure:2279: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$DLLTOOL" in
   /*)
   ac_cv_path_DLLTOOL="$DLLTOOL" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2270,17 +2311,17 @@ test -n "$DLLTOOL" && break
 done
 test -n "$DLLTOOL" || DLLTOOL="echo not_dlltool"
 
     for ac_prog in windres
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2279: checking for $ac_word" >&5
+echo "configure:2320: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$WINDRES" in
   /*)
   ac_cv_path_WINDRES="$WINDRES" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2336,17 +2377,17 @@ fi
 fi # SKIP_COMPILER_CHECKS
 
 if test -z "$SKIP_PATH_CHECKS"; then
     for ac_prog in perl5 perl
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2345: checking for $ac_word" >&5
+echo "configure:2386: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$PERL" in
   /*)
   ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
   ;;
   ?:/*)			 
@@ -2556,17 +2597,16 @@ EOF
 #define AIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define SYSV 1
 EOF
 
     DSO_LDOPTS='-brtl -bM:SRE -bnoentry -bexpall'
-    OS_LIBS="-lc_r $OS_LIBS"
     case "${target_os}" in
     aix3.2*)
         USE_NSPR_THREADS=1
         cat >> confdefs.h <<\EOF
 #define _PR_LOCAL_THREADS_ONLY 1
 EOF
 
         cat >> confdefs.h <<\EOF
@@ -2600,16 +2640,17 @@ EOF
         cat >> confdefs.h <<\EOF
 #define AIX4_1 1
 EOF
 
         MKSHLIB=
         DSO_LDOPTS=
         USE_PTHREADS=1
         AIX_LINK_OPTS='-bnso -berok'
+        LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)_shr'
         ;;
     aix4.3*)
         cat >> confdefs.h <<\EOF
 #define AIX_HAVE_ATOMIC_OP_H 1
 EOF
 
         cat >> confdefs.h <<\EOF
 #define AIX_TIMERS 1
@@ -2914,19 +2955,24 @@ EOF
     cat >> confdefs.h <<\EOF
 #define _HPUX_SOURCE 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define hppa 1
 EOF
 
+    cat >> confdefs.h <<\EOF
+#define hpux 1
+EOF
+
     DLL_SUFFIX=sl
     DSO_LDOPTS='-b +h $(notdir $@)'
     PR_MD_CSRCS=hpux.c
+    PR_MD_ASFILES=os_HPUX.s
     if test -n "$USE_64"; then
         MDCPUCFG_H=_hpux64.cfg
     else
         MDCPUCFG_H=_hpux32.cfg
     fi
     if test -z "$GNU_CC"; then
         CC="$CC -Ae"
         CXX="$CXX -ext"
@@ -3108,17 +3154,28 @@ EOF
     #DSO_LDOPTS='-elf -shared -all'
     STRIP="$STRIP -f"
     if test -n "$USE_64"; then
         MDCPUCFG_H=_irix64.cfg
     else
         MDCPUCFG_H=_irix32.cfg
     fi
     case "${target_os}" in
+    irix6*)
+           cat >> confdefs.h <<\EOF
+#define IRIX6 1
+EOF
+
+	   USE_PTHREADS=1
+           ;;
     irix5*)
+           cat >> confdefs.h <<\EOF
+#define IRIX5 1
+EOF
+
 	   USE_NSPR_THREADS=1
 	   ;;
     *)
 	   USE_PTHREADS=1
 	   ;;
  	esac
     if test "$GNU_CC"; then
 	    AS='$(CC) -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
@@ -3274,16 +3331,17 @@ EOF
 #define XP_PC 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define WIN32 1
 EOF
 
     PR_MD_ARCH_DIR=windows
+    RESOLVE_LINK_SYMBOLS=1
 
     if test -n "$GNU_CC"; then
         cat >> confdefs.h <<\EOF
 #define NONAMELESSUNION 1
 EOF
 
         MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@'
     else
@@ -3309,48 +3367,55 @@ EOF
             OPTIMIZER=-O2
             DLLFLAGS='-OUT:"$@"'
             OBJDIR_TAG=_OPT
 
             if test -n "$MOZ_PROFILE"; then
                 OPTIMIZER="$OPTIMIZER -Z7"
                 DLLFLAGS="$DLLFLAGS -DEBUG -DEBUGTYPE:CV"
                 LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV"
-    fi
+            fi
         else
             if test -n "$USE_DEBUG_RTL"; then
                 CFLAGS="$CFLAGS -MDd"
             else
                 CFLAGS="$CFLAGS -MD"
             fi
             OPTIMIZER="-Od -Z7"
             DLLFLAGS='-DEBUG -DEBUGTYPE:CV -OUT:"$@"'
             if test -n "$GLOWCODE"; then
                 DLLFLAGS='-DEBUG -DEBUGTYPE:both -INCLUDE:_GlowCode -OUT:"$@"'
+                DLL_LIBS='$(GLOWDIR)/glowcode.lib'
             fi
             OBJDIR_TAG=_DBG
             LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV"
             if test -n "$PROFILE"; then
                 LDFLAGS="$LDFLAGS -PROFILE -MAP"
                 DLLFLAGS="$DLLFLAGS -PROFILE -MAP"
             fi
         fi
-    fi
+        
+        if test "$OS_TARGET" = "WINNT"; then
+            CFLAGS="$CFLAGS -GT"
+            LIBNSPR='$(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+            LIBPLC='$(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+        else
+            LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+            LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+        fi
+    fi # GNU_CC
 
     if test -n "$USE_STATIC_TLS"; then
         cat >> confdefs.h <<\EOF
 #define _PR_USE_STATIC_TLS 1
 EOF
 
     fi
 
     if test "$OS_TARGET" = "WINNT"; then
-        if test -z "$GNU_CC"; then
-            CFLAGS="$CFLAGS -GT"
-        fi
         if test "$CPU_ARCH" = "x86"; then
             CFLAGS="$CFLAGS -G5"
         fi
         cat >> confdefs.h <<\EOF
 #define WINNT 1
 EOF
 
     else
@@ -3458,16 +3523,18 @@ EOF
     if test -z "$GNU_CC"; then
         CFLAGS="$CFLAGS -Hnocopyr"
         CXXFLAGS="$CXXFLAGS -Hnocopyr"
     else
         CFLAGS="$CFLAGS -fPIC -Wall -pipe"
         CXXFLAGS="$CXXFLAGS -fPIC -Wall -pipe"
         DSO_LDOPTS=-G
     fi
+    MDCPUCFG_H=_ncr.cfg
+    PR_MD_CSRCS=ncr.c
     ;;
 
 mips-nec-sysv*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3488,16 +3555,18 @@ EOF
 
     USE_NSPR_THREADS=1
     if test -z "$GNU_CC"; then
         CC='$(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000'
         CXX=g++
     fi
     OS_LIBS="$OS_LIBS -lsocket -lnsl -ldl"
     DSO_LDOPTS=-G
+    MDCPUCFG_H=_nec.cfg
+    PR_MD_CSRCS=nec.c
     ;;
 
 *-netbsd*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3522,16 +3591,18 @@ EOF
     fi
     CFLAGS="$CFLAGS -ansi -Wall -pipe"
     CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe"
     DSO_CFLAGS='-fPIC -DPIC'
     DSO_LDOPTS='-x -shared'
     if test "$LIBRUNPATH"; then
         DSO_LDOPTS="$DSO_LDOPTS -R$(LIBRUNPATH)"
     fi
+    MDCPUCFG_H=_netbsd.cfg
+    PR_MD_CSRCS=netbsd.c
     ;;
 
 mips-sony-newsos*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3557,16 +3628,18 @@ EOF
     cat >> confdefs.h <<\EOF
 #define HAVE_SVID_GETTOD 1
 EOF
 
     USE_NSPR_THREADS=1
     CFLAGS="$CFLAGS -Xa -fullwarn"
     CXXFLAGS="$CXXFLAGS -Xa -fullwarn"
     DSO_LDOPTS=-G
+    MDCPUCFG_H=_sony.cfg
+    PR_MD_CSRCS=sony.c
     ;;
 
 *-nextstep*|*-openstep*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3580,16 +3653,18 @@ EOF
     cat >> confdefs.h <<\EOF
 #define _POSIX_SOURCE 1
 EOF
 
     CFLAGS="$CFLAGS -Wall -fno-common -pipe -traditional-cpp -posix"
     CXXFLAGS="$CXXFLAGS -Wall -fno-common -pipe -traditional-cpp -posix"
     USE_NSPR_THREADS=1
     DLL_SUFFIX=dylib
+    MDCPUCFG_H=_nextstep.cfg
+    PR_MD_CSRCS=nextstep.c
     ;;
 
 
 *-nto*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
@@ -3634,16 +3709,17 @@ EOF
 EOF
 
     CFLAGS="$CFLAGS -ansi -Wall -pipe"
     CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe"
     DLL_SUFFIX=so.1.0
     DSO_CFLAGS=-fPIC
     MDCPUCFG_H=_openbsd.cfg
     PR_MD_CSRCS=openbsd.c
+    USE_NSPR_THREADS=1
     case "$OS_TEST" in
     alpha|mips|pmax)
         DSO_LDOPTS=-shared ;;
     *)
         DSO_LDOPTS=-Bshareable ;;
     esac
     ;;
 
@@ -3675,17 +3751,17 @@ EOF
     CXX=ccc
     CFLAGS="$CFLAGS -Wc,names=\(short,as\)"
     CXXFLAGS="$CXXFLAGS -Wc,names=\(short,as\)"
     MDCPUCFG_H=_openvms.cfg
     PR_MD_CSRCS=openvms.c
     MKSHLIB='vmsld $(OPTIMIZER)'
     ;;
 
-*-osf1*)
+*-osf*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define OSF1 1
 EOF
 
@@ -3713,32 +3789,36 @@ EOF
 EOF
 
         cat >> confdefs.h <<\EOF
 #define OSF1_HAVE_MACHINE_BUILTINS_H 1
 EOF
 
     fi
     DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
+    MDCPUCFG_H=_osf1.cfg
+    PR_MD_CSRCS=osf1.c
     ;;
 
 *-qnx*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define QNX 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define _PR_NEED_H_ERRNO 1
 EOF
 
     USE_NSPR_THREADS=1
+    MDCPUCFG_H=_qnx.cfg
+    PR_MD_CSRCS=qnx.c
     ;;
 
 *-rhapsody*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3763,16 +3843,18 @@ EOF
 EOF
 
         CPU_ARCH=ppc
     fi
     DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load'
     MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
     DLL_SUFFIX=dylib
     USE_PTHREADS=1
+    MDCPUCFG_H=_rhapsody.cfg
+    PR_MD_CSRCS=rhapsody.c
     ;;
 
 *-*-sco*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3795,16 +3877,18 @@ EOF
 #define _PR_NEED_H_ERRNO 1
 EOF
 
     CC='cc -b elf -KPIC'
     CXX='$(NSDEPTH)/build/hcpp CC +.cpp +w'
     USE_NSPR_THREADS=1
     CPU_ARCH=x86
     DSO_LDOPTS='-b elf -G'
+    MDCPUCFG_H=_scoos.cfg
+    PR_MD_SRCS=scoos.c
     ;;
 
 *-sinix*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3855,16 +3939,21 @@ EOF
         cat >> confdefs.h <<\EOF
 #define IP_MULTICAST 1
 EOF
 
     fi
 
     OS_LIBS="$OS_LIBS -lsocket -lnsl -lresolv -ldl -lc"
     USE_NSPR_THREADS=1
+    MDCPUCFG_H=_reliantunix.cfg
+    PR_MD_CSRCS=reliantunix.c
+    if test "${OS_ARCH}" = "mips"; then
+        PR_MD_ASFILES=os_ReliantUNIX.s
+    fi
     ;;
 
 *-sunos*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -3875,16 +3964,22 @@ EOF
     if test "$USE_MDUPDATE"; then
         CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
     fi
     CPU_ARCH=sparc
     DLL_SUFFIX=so.1.0
     DSO_LDOPTS=
     DSO_CFLAGS=-fPIC
     USE_NSPR_THREADS=1
+    if test "$OS_RELEASE" = "4.1.3_U1"; then
+        _OPTIMIZE_FLAGS=
+        OS_LIBS="$OS_LIBS -lm"
+    fi
+    MDCPUCFG_H=_sunos4.cfg
+    PR_MD_CSRCS=sunos4.c
     ;;
 
 *-solaris*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -4011,30 +4106,33 @@ EOF
     USE_NSPR_THREADS=1
     if echo $OS_RELEASE | grep -c 2.1 2>/dev/null; then
         cat >> confdefs.h <<\EOF
 #define _PR_NO_LARGE_FILES 1
 EOF
 
         CC='$(NSDEPTH)/build/hcc cc'
         CXX='$(NSDEPTH)/build/hcpp CC'
+        MDCPUCFG_H=_unixware.cfg
     else
         cat >> confdefs.h <<\EOF
 #define _LARGEFILE64_SOURCE 1
 EOF
 
         cat >> confdefs.h <<\EOF
 #define _PR_HAVE_OFF64_T 1
 EOF
 
         cat >> confdefs.h <<\EOF
 #define _PR_HAVE_SOCKADDR_LEN 1
 EOF
 
+        MDCPUCFG_H=_unixware7.cfg
     fi
+    PR_MD_CSRCS=unixware.c
     DSO_LDOPTS=-G
     CPU_ARCH=x86
     ;;
 
 *-os2*)
     cat >> confdefs.h <<\EOF
 #define XP_OS2 1
 EOF
@@ -4128,16 +4226,18 @@ EOF
         _DEBUG_FLAGS=/Ti+ 
         if test -n "$MOZ_DEBUG"; then
           DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo /DEBUG /NOE'
           EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo /DEBUG /NOE'
         else
           DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo'
           EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo'
         fi
+        LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+        LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
         ;;
     esac
 
     ;;
 
 *)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
@@ -4149,22 +4249,22 @@ esac
 
 if test "$enable_shared" = no; then
     MKSHLIB=
 fi
 
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4158: checking for dlopen" >&5
+echo "configure:4258: checking for dlopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4163 "configure"
+#line 4263 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char dlopen();
@@ -4177,17 +4277,17 @@ int main() {
 #if defined (__stub_dlopen) || defined (__stub___dlopen)
 choke me
 #else
 dlopen();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dlopen=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_dlopen=no"
 fi
@@ -4196,36 +4296,36 @@ fi
 
 if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
 else
   echo "$ac_t""no" 1>&6
 
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4205: checking for dlopen in -ldl" >&5
+echo "configure:4305: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4213 "configure"
+#line 4313 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char dlopen();
 
 int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=no"
 fi
@@ -4242,72 +4342,72 @@ fi
 
 
 fi
 
 
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:4251: checking how to run the C preprocessor" >&5
+echo "configure:4351: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     # This must be in double quotes, not single quotes, because CPP may get
   # substituted into the Makefile and "${CC-cc}" will confuse make.
   CPP="${CC-cc} -E"
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 4266 "configure"
+#line 4366 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 4283 "configure"
+#line 4383 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4289: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 4300 "configure"
+#line 4400 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
@@ -4323,23 +4423,23 @@ fi
   CPP="$ac_cv_prog_CPP"
 else
   ac_cv_prog_CPP="$CPP"
 fi
 echo "$ac_t""$CPP" 1>&6
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:4332: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4432: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 4338 "configure"
+#line 4438 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -4347,17 +4447,17 @@ else
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 4356 "configure"
+#line 4456 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -4371,22 +4471,22 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
 for ac_func in lchown strerror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4380: checking for $ac_func" >&5
+echo "configure:4480: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4385 "configure"
+#line 4485 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char $ac_func();
@@ -4399,17 +4499,17 @@ int main() {
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
 $ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=no"
 fi
@@ -4430,17 +4530,17 @@ done
 
 
 
 
 
 
 
 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:4439: checking for pthread_create in -lpthreads" >&5
+echo "configure:4539: checking for pthread_create in -lpthreads" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4452,17 +4552,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:4461: checking for pthread_create in -lpthread" >&5
+echo "configure:4561: checking for pthread_create in -lpthread" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4474,17 +4574,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:4483: checking for pthread_create in -lc_r" >&5
+echo "configure:4583: checking for pthread_create in -lc_r" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4496,17 +4596,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:4505: checking for pthread_create in -lc" >&5
+echo "configure:4605: checking for pthread_create in -lc" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4646,33 +4746,33 @@ EOF
     fi
 fi
 
 
 if test -n "$USE_PTHREADS"; then
       rm -f conftest*
    ac_cv_have_dash_pthread=no
    echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:4655: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:4755: checking whether ${CC-cc} accepts -pthread" >&5
    echo 'int main() { return 0; }' | cat > conftest.c
    ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
    if test $? -eq 0; then
 	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 	    ac_cv_have_dash_pthread=yes
 	    CFLAGS="$CFLAGS -pthread"
 	    CXXFLAGS="$CXXFLAGS -pthread"
 	fi
     fi
     rm -f conftest*
     echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6
 
 			    ac_cv_have_dash_pthreads=no
     if test "$ac_cv_have_dash_pthread" = "no"; then
 	    echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:4671: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:4771: checking whether ${CC-cc} accepts -pthreads" >&5
     	echo 'int main() { return 0; }' | cat > conftest.c
 	    ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
     	if test $? -eq 0; then
 	    	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 			    ac_cv_have_dash_pthreads=yes
 			    CFLAGS="$CFLAGS -pthreads"
 			    CXXFLAGS="$CXXFLAGS -pthreads"
 		    fi
@@ -4725,31 +4825,40 @@ else
 #define _PR_LOCAL_THREADS_ONLY 1
 EOF
 
         fi
     fi
 fi
 
 case "$target" in
-*-aix4.1*)
-    if test -z "$USE_PTHREADS"; then
-        cat >> confdefs.h <<\EOF
-#define AIX_RENAME_SELECT 1
-EOF
-
+*-aix*)
+    if test -n "$USE_NSPR_THREADS"; then
+        OS_LIBS="$OS_LIBS -lc"
+    else
+        OS_LIBS="$OS_LIBS -lc_r"
     fi
-    ;;
-*-aix4.23*)
-    if test -z "$USE_NSPR_THREADS"; then
-        cat >> confdefs.h <<\EOF
+    case "$target_os" in
+    aix4.1*)
+        if test -z "$USE_PTHREADS"; then
+            cat >> confdefs.h <<\EOF
+#define AIX_RENAME_SELECT 1
+EOF
+
+        fi
+        ;;
+    aix4.23*)
+        if test -z "$USE_NSPR_THREADS"; then
+            cat >> confdefs.h <<\EOF
 #define HAVE_POINTER_LOCALTIME_R 1
 EOF
 
-    fi
+        fi
+        ;;
+    esac
     ;;
 *-bsdi*)
     if test -n "$USE_PTHREADS"; then
         cat >> confdefs.h <<\EOF
 #define _PR_NEED_PTHREAD_INIT 1
 EOF
 
     fi
@@ -4915,22 +5024,28 @@ fi
 
 
 
 
 
 
 
 
+
+
+
+
+
 MAKEFILES="
 Makefile 
 config/Makefile
 config/autoconf.mk
 config/nsprincl.mk
 config/nsprincl.sh
+config/nspr-config
 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 
@@ -5116,16 +5231,20 @@ s%@target_alias@%$target_alias%g
 s%@target_cpu@%$target_cpu%g
 s%@target_vendor@%$target_vendor%g
 s%@target_os@%$target_os%g
 s%@build@%$build%g
 s%@build_alias@%$build_alias%g
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
+s%@dist_prefix@%$dist_prefix%g
+s%@dist_bindir@%$dist_bindir%g
+s%@dist_includedir@%$dist_includedir%g
+s%@dist_libdir@%$dist_libdir%g
 s%@WHOAMI@%$WHOAMI%g
 s%@HOST_CC@%$HOST_CC%g
 s%@CC@%$CC%g
 s%@CXX@%$CXX%g
 s%@RANLIB@%$RANLIB%g
 s%@AR@%$AR%g
 s%@AS@%$AS%g
 s%@LD@%$LD%g
@@ -5144,17 +5263,21 @@ s%@USE_IPV6@%$USE_IPV6%g
 s%@USE_N32@%$USE_N32%g
 s%@USE_64@%$USE_64%g
 s%@GC_LEAK_DETECTOR@%$GC_LEAK_DETECTOR%g
 s%@USE_PTHREADS@%$USE_PTHREADS%g
 s%@USE_BTHREADS@%$USE_BTHREADS%g
 s%@USE_USER_PTHREADS@%$USE_USER_PTHREADS%g
 s%@USE_NATIVE_THREADS@%$USE_NATIVE_THREADS%g
 s%@USE_NSPR_THREADS@%$USE_NSPR_THREADS%g
-s%@NSPR_VERSION@%$NSPR_VERSION%g
+s%@LIBNSPR@%$LIBNSPR%g
+s%@LIBPLC@%$LIBPLC%g
+s%@MOD_MAJOR_VERSION@%$MOD_MAJOR_VERSION%g
+s%@MOD_MINOR_VERSION@%$MOD_MINOR_VERSION%g
+s%@MOD_REVISION_VERSION@%$MOD_REVISION_VERSION%g
 s%@NSPR_MODNAME@%$NSPR_MODNAME%g
 s%@MDCPUCFG_H@%$MDCPUCFG_H%g
 s%@MOZ_WIN32_TARGET@%$MOZ_WIN32_TARGET%g
 s%@PR_MD_CSRCS@%$PR_MD_CSRCS%g
 s%@PR_MD_ASFILES@%$PR_MD_ASFILES%g
 s%@PR_MD_ARCH_DIR@%$PR_MD_ARCH_DIR%g
 s%@CPU_ARCH@%$CPU_ARCH%g
 s%@OBJ_SUFFIX@%$OBJ_SUFFIX%g
@@ -5283,15 +5406,15 @@ s%@top_srcdir@%$top_srcdir%g
 fi; done
 rm -f conftest.s*
 
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
 EOF
 cat >> $CONFIG_STATUS <<\EOF
-
+chmod +x config/nspr-config
 exit 0
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
--- a/configure.in
+++ b/configure.in
@@ -20,25 +20,26 @@ dnl Contributor(s):
 dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 AC_PREREQ(2.12)
 AC_INIT(config/libc_r.h)
 
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_SYSTEM
-AC_PREFIX_DEFAULT(\${MOD_DEPTH}/dist)
 
 dnl Set this define to make fixes w/o breaking anything else.
 AC_DEFINE(USE_AUTOCONF)
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
-NSPR_VERSION=4
+MOD_MAJOR_VERSION=4
+MOD_MINOR_VERSION=0
+MOD_REVISION_VERSION=1
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -47,16 +48,18 @@ USE_MDUPDATE=
 _OPTIMIZE_FLAGS=-O
 _DEBUG_FLAGS=-g
 MOZ_DEBUG=1
 MOZ_OPTIMIZE=
 OBJDIR=.
 OBJDIR_NAME=.
 NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall'
 NOSUCHFILE=/no-such-file
+LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
+LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)'
 
 dnl Link in libraries necessary to resolve all symbols for shared libs
 RESOLVE_LINK_SYMBOLS=
 
 dnl ========================================================
 dnl =
 dnl = Dont change the following lines.  Doing so breaks:
 dnl =
@@ -100,53 +103,78 @@ if test -n "$_WIN32_MSVC"; then
     SKIP_LIBRARY_CHECKS=1
 fi
 
 dnl ========================================================
 dnl =
 dnl = Check options that may affect the compiler
 dnl =
 dnl ========================================================
+dist_prefix='${MOD_DEPTH}/dist'
+dist_bindir='${dist_prefix}/bin'
+dist_includedir='${dist_prefix}/include'
+dist_libdir='${dist_prefix}/lib'
+
+AC_ARG_WITH(dist-prefix,
+    [  --with-dist-prefix=DIST_PREFIX
+                          place build files in DIST_PREFIX [dist]],
+    dist_prefix=$withval)
+
+AC_ARG_WITH(dist-bindir,
+    [  --with-dist-bindir=DIR  build execuatables in DIR [DIST_PREFIX/bin]],
+    dist_bindir=$withval)
+
+AC_ARG_WITH(dist-includedir,
+    [  --with-dist-includedir=DIR
+                          build include files in DIR [DIST_PREFIX/include]],
+    dist_includedir=$withval)
+
+AC_ARG_WITH(dist-libdir,
+    [  --with-dist-libdir=DIR  build library files in DIR [DIST_PREFIX/lib]],
+    dist_libdir=$withval)
+
+AC_SUBST(dist_prefix)
+AC_SUBST(dist_bindir)
+AC_SUBST(dist_includedir)
+AC_SUBST(dist_libdir)
+
 dnl Check if NSPR is being compiled for Mozilla
 dnl Let --with-arg override environment setting
 dnl
 AC_ARG_WITH(mozilla,
     [  --with-mozilla          Compile NSPR with Mozilla support],
     [   if test "$withval" = "yes"; then
             AC_DEFINE(MOZILLA_CLIENT)
             MOZILLA_CLIENT=1
 	    else
 	        MOZILLA_CLIENT=
 	    fi],
     [	if test -n "$MOZILLA_CLIENT"; then
 	        AC_DEFINE(MOZILLA_CLIENT)
 	    fi])
 
 AC_ARG_ENABLE(optimize,
-    [  --enable-optimize(=flag) Enable code optimizations (flag, ie. -O2) ],
+    [  --enable-optimize(=val) Enable code optimizations (val, ie. -O2) ],
     [ if test "$enableval" != "no"; then
         MOZ_OPTIMIZE=1
         if test -n "$enableval" && test "$enableval" != "yes"; then
     	    _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
             _SAVE_OPTIMIZE_FLAGS=$_OPTIMIZE_FLAGS
         fi
     fi ])
 
 AC_ARG_ENABLE(debug,
     [  --disable-debug         Do not compile in debugging symbols],
     [	if test "$enableval" = "no"; then
     	    MOZ_DEBUG=
 	    fi])
 
-AC_ARG_ENABLE(shared,
-    [  --disable-shared        Do not compile into shared libraries])
-
 AC_ARG_ENABLE(win32-target,
     [  --enable-win32-target=\$t
-                               Specify win32 flavor. (WIN95 or WINNT)],
+                          Specify win32 flavor. (WIN95 or WINNT)],
     MOZ_WIN32_TARGET=`echo $enableval | tr a-z A-Z`,
     MOZ_WIN32_TARGET=)
 
 AC_ARG_ENABLE(n32,
     [  --enable-n32            Enable n32 ABI support (IRIX only)],
     [ if test "$enableval" = "yes"; then
 	USE_N32=1
       else if test "$enableval" = "no"; then
@@ -476,17 +504,16 @@ dnl Override of system specific target o
 dnl ========================================================
 case "$target" in
 
 *-aix*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(AIX)
     AC_DEFINE(SYSV)
     DSO_LDOPTS='-brtl -bM:SRE -bnoentry -bexpall'
-    OS_LIBS="-lc_r $OS_LIBS"
     case "${target_os}" in
     aix3.2*)
         USE_NSPR_THREADS=1
         AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
         AC_DEFINE(AIX_RENAME_SELECT)
         AC_DEFINE(_PR_NO_LARGE_FILES)
         AIX_LINK_OPTS='-bnso -berok'
         PR_MD_ASFILES=os_AIX.s
@@ -496,16 +523,17 @@ case "$target" in
         AC_DEFINE(AIX_HAVE_ATOMIC_OP_H)
         AC_DEFINE(AIX_TIMERS)
         AC_DEFINE(_PR_NO_LARGE_FILES)
         AC_DEFINE(AIX4_1)
         MKSHLIB=
         DSO_LDOPTS=
         USE_PTHREADS=1
         AIX_LINK_OPTS='-bnso -berok'
+        LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)_shr'
         ;;
     aix4.3*)
         AC_DEFINE(AIX_HAVE_ATOMIC_OP_H)
         AC_DEFINE(AIX_TIMERS)
         AC_DEFINE(_PR_HAVE_OFF64_T)
         AC_DEFINE(AIX4_3)
         AC_DEFINE(HAVE_SOCKLEN_T)
         USE_IPV6=1
@@ -663,19 +691,21 @@ case "$target" in
     PR_MD_CSRCS=freebsd.c
     ;;
 
 *-hpux*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(HPUX)
     AC_DEFINE(_HPUX_SOURCE)
     AC_DEFINE(hppa)
+    AC_DEFINE(hpux)
     DLL_SUFFIX=sl
     DSO_LDOPTS='-b +h $(notdir $@)'
     PR_MD_CSRCS=hpux.c
+    PR_MD_ASFILES=os_HPUX.s
     if test -n "$USE_64"; then
         MDCPUCFG_H=_hpux64.cfg
     else
         MDCPUCFG_H=_hpux32.cfg
     fi
     if test -z "$GNU_CC"; then
         CC="$CC -Ae"
         CXX="$CXX -ext"
@@ -791,17 +821,22 @@ case "$target" in
     #DSO_LDOPTS='-elf -shared -all'
     STRIP="$STRIP -f"
     if test -n "$USE_64"; then
         MDCPUCFG_H=_irix64.cfg
     else
         MDCPUCFG_H=_irix32.cfg
     fi
     case "${target_os}" in
+    irix6*)
+           AC_DEFINE(IRIX6)
+	   USE_PTHREADS=1
+           ;;
     irix5*)
+           AC_DEFINE(IRIX5)
 	   USE_NSPR_THREADS=1
 	   ;;
     *)
 	   USE_PTHREADS=1
 	   ;;
  	esac
     if test "$GNU_CC"; then
 	    AS='$(CC) -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
@@ -909,16 +944,17 @@ case "$target" in
         ;;
     esac    
     ;;
 
 *-mingw*|*-cygwin*|*-msvc*)
     AC_DEFINE(XP_PC)
     AC_DEFINE(WIN32)
     PR_MD_ARCH_DIR=windows
+    RESOLVE_LINK_SYMBOLS=1
 
     if test -n "$GNU_CC"; then
         AC_DEFINE(NONAMELESSUNION)
         MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@'
     else
         CC=cl
         CXX=cl
         LD=link
@@ -941,45 +977,52 @@ case "$target" in
             OPTIMIZER=-O2
             DLLFLAGS='-OUT:"$@"'
             OBJDIR_TAG=_OPT
 
             if test -n "$MOZ_PROFILE"; then
                 OPTIMIZER="$OPTIMIZER -Z7"
                 DLLFLAGS="$DLLFLAGS -DEBUG -DEBUGTYPE:CV"
                 LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV"
-    fi
+            fi
         else
             if test -n "$USE_DEBUG_RTL"; then
                 CFLAGS="$CFLAGS -MDd"
             else
                 CFLAGS="$CFLAGS -MD"
             fi
             OPTIMIZER="-Od -Z7"
             DLLFLAGS='-DEBUG -DEBUGTYPE:CV -OUT:"$@"'
             if test -n "$GLOWCODE"; then
                 DLLFLAGS='-DEBUG -DEBUGTYPE:both -INCLUDE:_GlowCode -OUT:"$@"'
+                DLL_LIBS='$(GLOWDIR)/glowcode.lib'
             fi
             OBJDIR_TAG=_DBG
             LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV"
             if test -n "$PROFILE"; then
                 LDFLAGS="$LDFLAGS -PROFILE -MAP"
                 DLLFLAGS="$DLLFLAGS -PROFILE -MAP"
             fi
         fi
-    fi
+        
+        if test "$OS_TARGET" = "WINNT"; then
+            CFLAGS="$CFLAGS -GT"
+            LIBNSPR='$(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+            LIBPLC='$(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+        else
+            LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+            LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+        fi
+    fi # GNU_CC
 
     if test -n "$USE_STATIC_TLS"; then
         AC_DEFINE(_PR_USE_STATIC_TLS)
     fi
 
     if test "$OS_TARGET" = "WINNT"; then
-        if test -z "$GNU_CC"; then
-            CFLAGS="$CFLAGS -GT"
-        fi
         if test "$CPU_ARCH" = "x86"; then
             CFLAGS="$CFLAGS -G5"
         fi
         AC_DEFINE(WINNT)
     else
         AC_DEFINE(WIN95)
         AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
     fi
@@ -1048,31 +1091,35 @@ case "$target" in
     if test -z "$GNU_CC"; then
         CFLAGS="$CFLAGS -Hnocopyr"
         CXXFLAGS="$CXXFLAGS -Hnocopyr"
     else
         CFLAGS="$CFLAGS -fPIC -Wall -pipe"
         CXXFLAGS="$CXXFLAGS -fPIC -Wall -pipe"
         DSO_LDOPTS=-G
     fi
+    MDCPUCFG_H=_ncr.cfg
+    PR_MD_CSRCS=ncr.c
     ;;
 
 mips-nec-sysv*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SVR4)
     AC_DEFINE(__SVR4)
     AC_DEFINE(NEC)
     AC_DEFINE(nec_ews)
     USE_NSPR_THREADS=1
     if test -z "$GNU_CC"; then
         CC='$(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000'
         CXX=g++
     fi
     OS_LIBS="$OS_LIBS -lsocket -lnsl -ldl"
     DSO_LDOPTS=-G
+    MDCPUCFG_H=_nec.cfg
+    PR_MD_CSRCS=nec.c
     ;;
 
 *-netbsd*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(NETBSD)
     AC_DEFINE(HAVE_BSD_FLOCK)
     if test -z "$OBJECT_FMT"; then
         if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ 2>/dev/null; then
@@ -1088,41 +1135,47 @@ mips-nec-sysv*)
     fi
     CFLAGS="$CFLAGS -ansi -Wall -pipe"
     CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe"
     DSO_CFLAGS='-fPIC -DPIC'
     DSO_LDOPTS='-x -shared'
     if test "$LIBRUNPATH"; then
         DSO_LDOPTS="$DSO_LDOPTS -R$(LIBRUNPATH)"
     fi
+    MDCPUCFG_H=_netbsd.cfg
+    PR_MD_CSRCS=netbsd.c
     ;;
 
 mips-sony-newsos*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SONY)
     AC_DEFINE(SYSV)
     AC_DEFINE(SVR4)
     AC_DEFINE(__svr4)
     AC_DEFINE(__svr4__)
     AC_DEFINE(HAVE_SVID_GETTOD)
     USE_NSPR_THREADS=1
     CFLAGS="$CFLAGS -Xa -fullwarn"
     CXXFLAGS="$CXXFLAGS -Xa -fullwarn"
     DSO_LDOPTS=-G
+    MDCPUCFG_H=_sony.cfg
+    PR_MD_CSRCS=sony.c
     ;;
 
 *-nextstep*|*-openstep*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(NEXTSTEP)
     AC_DEFINE(HAVE_BSD_FLOCK)
     AC_DEFINE(_POSIX_SOURCE)
     CFLAGS="$CFLAGS -Wall -fno-common -pipe -traditional-cpp -posix"
     CXXFLAGS="$CXXFLAGS -Wall -fno-common -pipe -traditional-cpp -posix"
     USE_NSPR_THREADS=1
     DLL_SUFFIX=dylib
+    MDCPUCFG_H=_nextstep.cfg
+    PR_MD_CSRCS=nextstep.c
     ;;
 
 
 *-nto*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(NTO)
     AC_DEFINE(_QNX_SOURCE)
     AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
@@ -1146,16 +1199,17 @@ mips-sony-newsos*)
     AC_DEFINE(OPENBSD)
     AC_DEFINE(HAVE_BSD_FLOCK)
     CFLAGS="$CFLAGS -ansi -Wall -pipe"
     CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe"
     DLL_SUFFIX=so.1.0
     DSO_CFLAGS=-fPIC
     MDCPUCFG_H=_openbsd.cfg
     PR_MD_CSRCS=openbsd.c
+    USE_NSPR_THREADS=1
     case "$OS_TEST" in
     alpha|mips|pmax)
         DSO_LDOPTS=-shared ;;
     *)
         DSO_LDOPTS=-Bshareable ;;
     esac
     ;;
 
@@ -1175,17 +1229,17 @@ mips-sony-newsos*)
     CXX=ccc
     CFLAGS="$CFLAGS -Wc,names=\(short,as\)"
     CXXFLAGS="$CXXFLAGS -Wc,names=\(short,as\)"
     MDCPUCFG_H=_openvms.cfg
     PR_MD_CSRCS=openvms.c
     MKSHLIB='vmsld $(OPTIMIZER)'
     ;;
 
-*-osf1*)
+*-osf*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(OSF1)
 
     if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
         USE_NSPR_THREADS=1
     fi
 
     if test -z "$GNU_CC"; then
@@ -1198,23 +1252,27 @@ mips-sony-newsos*)
 
     if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
         AC_DEFINE(HAVE_INT_LOCALTIME_R)
     else
         AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
         AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H)
     fi
     DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
+    MDCPUCFG_H=_osf1.cfg
+    PR_MD_CSRCS=osf1.c
     ;;
 
 *-qnx*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(QNX)
     AC_DEFINE(_PR_NEED_H_ERRNO)
     USE_NSPR_THREADS=1
+    MDCPUCFG_H=_qnx.cfg
+    PR_MD_CSRCS=qnx.c
     ;;
 
 *-rhapsody*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(RHAPSODY)
     AC_DEFINE(HAVE_BSD_FLOCK)
     CFLAGS="$CFLAGS -Wmost -fno-common -pipe"    
     if echo $OS_TEST | grep -c 86 2>/dev/null; then
@@ -1224,30 +1282,34 @@ mips-sony-newsos*)
     else
         AC_DEFINE(ppc)
         CPU_ARCH=ppc
     fi
     DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load'
     MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
     DLL_SUFFIX=dylib
     USE_PTHREADS=1
+    MDCPUCFG_H=_rhapsody.cfg
+    PR_MD_CSRCS=rhapsody.c
     ;;
 
 *-*-sco*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SCO)
     AC_DEFINE(sco)
     AC_DEFINE(SYSV)
     AC_DEFINE(_SVID3)
     AC_DEFINE(_PR_NEED_H_ERRNO)
     CC='cc -b elf -KPIC'
     CXX='$(NSDEPTH)/build/hcpp CC +.cpp +w'
     USE_NSPR_THREADS=1
     CPU_ARCH=x86
     DSO_LDOPTS='-b elf -G'
+    MDCPUCFG_H=_scoos.cfg
+    PR_MD_SRCS=scoos.c
     ;;
 
 *-sinix*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SVR4)
     AC_DEFINE(SNI)
     AC_DEFINE(RELIANTUNIX)
     AC_DEFINE(sinix)
@@ -1274,30 +1336,41 @@ mips-sony-newsos*)
     DSO_LDOPTS='-G -z defs -h $(@:$(OBJDIR)/%.so=%.so)'
 
     if test "$OS_RELEASE" = "5.43"; then
         AC_DEFINE(IP_MULTICAST)
     fi
 
     OS_LIBS="$OS_LIBS -lsocket -lnsl -lresolv -ldl -lc"
     USE_NSPR_THREADS=1
+    MDCPUCFG_H=_reliantunix.cfg
+    PR_MD_CSRCS=reliantunix.c
+    if test "${OS_ARCH}" = "mips"; then
+        PR_MD_ASFILES=os_ReliantUNIX.s
+    fi
     ;;
 
 *-sunos*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SUNOS4)
     CFLAGS="$CFLAGS -Wall -Wno-format"
     if test "$USE_MDUPDATE"; then
         CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
     fi
     CPU_ARCH=sparc
     DLL_SUFFIX=so.1.0
     DSO_LDOPTS=
     DSO_CFLAGS=-fPIC
     USE_NSPR_THREADS=1
+    if test "$OS_RELEASE" = "4.1.3_U1"; then
+        _OPTIMIZE_FLAGS=
+        OS_LIBS="$OS_LIBS -lm"
+    fi
+    MDCPUCFG_H=_sunos4.cfg
+    PR_MD_CSRCS=sunos4.c
     ;;
 
 *-solaris*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SVR4)
     AC_DEFINE(SYSV)
     AC_DEFINE(__svr4)
     AC_DEFINE(__svr4__)
@@ -1373,21 +1446,24 @@ mips-sony-newsos*)
     AC_DEFINE(UNIXWARE)
     AC_DEFINE(SVR4)
     AC_DEFINE(SYSV)
     USE_NSPR_THREADS=1
     if echo $OS_RELEASE | grep -c 2.1 2>/dev/null; then
         AC_DEFINE(_PR_NO_LARGE_FILES)
         CC='$(NSDEPTH)/build/hcc cc'
         CXX='$(NSDEPTH)/build/hcpp CC'
+        MDCPUCFG_H=_unixware.cfg
     else
         AC_DEFINE(_LARGEFILE64_SOURCE)
         AC_DEFINE(_PR_HAVE_OFF64_T)
         AC_DEFINE(_PR_HAVE_SOCKADDR_LEN)
+        MDCPUCFG_H=_unixware7.cfg
     fi
+    PR_MD_CSRCS=unixware.c
     DSO_LDOPTS=-G
     CPU_ARCH=x86
     ;;
 
 *-os2*)
     AC_DEFINE(XP_OS2)
     AC_DEFINE(BSD_SELECT)
     AC_DEFINE(XP_PC)
@@ -1451,16 +1527,18 @@ mips-sony-newsos*)
         _DEBUG_FLAGS=/Ti+ 
         if test -n "$MOZ_DEBUG"; then
           DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo /DEBUG /NOE'
           EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo /DEBUG /NOE'
         else
           DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo'
           EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo'
         fi
+        LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+        LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
         ;;
     esac
 
     ;;
 
 *)
     AC_DEFINE(XP_UNIX)
     ;;
@@ -1651,17 +1729,17 @@ case "$target" in
 	    USE_PTHREADS=
 	  fi])
     ;;
 esac
 
 fi # SKIP_LIBRARY_CHECKS
 
 AC_ARG_ENABLE(cplus,
-    [  --enable-cplus          Use cplus for whatever reason],
+    [  --enable-cplus          Enable some c++ api routines],
     [ if test "$enableval" = "yes"; then
 	    USE_CPLUS=1
       fi]) 
 
 AC_ARG_ENABLE(ipv6,
     [  --enable-ipv6           Compile ipv6 support],
     [ if test "$enableval" = "yes"; then
 	    USE_IPV6=1
@@ -1742,25 +1820,34 @@ else
         if test -n "$USE_NSPR_THREADS"; then
     	    AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
         fi
     fi
 fi
 dnl Special thread exceptions
 
 case "$target" in
-*-aix4.1*)
-    if test -z "$USE_PTHREADS"; then
-        AC_DEFINE(AIX_RENAME_SELECT)
+*-aix*)
+    if test -n "$USE_NSPR_THREADS"; then
+        OS_LIBS="$OS_LIBS -lc"
+    else
+        OS_LIBS="$OS_LIBS -lc_r"
     fi
-    ;;
-*-aix4.[23]*)
-    if test -z "$USE_NSPR_THREADS"; then
-        AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
-    fi
+    case "$target_os" in
+    aix4.1*)
+        if test -z "$USE_PTHREADS"; then
+            AC_DEFINE(AIX_RENAME_SELECT)
+        fi
+        ;;
+    aix4.[23]*)
+        if test -z "$USE_NSPR_THREADS"; then
+            AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
+        fi
+        ;;
+    esac
     ;;
 *-bsdi*)
     if test -n "$USE_PTHREADS"; then
         AC_DEFINE(_PR_NEED_PTHREAD_INIT)
     fi
     ;;
 *-hpux*)
     if test "$USE_PTHREADS"; then
@@ -1851,17 +1938,22 @@ AC_SUBST(USE_64)
 AC_SUBST(GC_LEAK_DETECTOR)
 
 AC_SUBST(USE_PTHREADS)
 AC_SUBST(USE_BTHREADS)
 AC_SUBST(USE_USER_PTHREADS)
 AC_SUBST(USE_NATIVE_THREADS)
 AC_SUBST(USE_NSPR_THREADS)
 
-AC_SUBST(NSPR_VERSION)
+AC_SUBST(LIBNSPR)
+AC_SUBST(LIBPLC)
+
+AC_SUBST(MOD_MAJOR_VERSION)
+AC_SUBST(MOD_MINOR_VERSION)
+AC_SUBST(MOD_REVISION_VERSION)
 AC_SUBST(NSPR_MODNAME)
 AC_SUBST(MDCPUCFG_H)
 AC_SUBST(MOZ_WIN32_TARGET)
 AC_SUBST(PR_MD_CSRCS)
 AC_SUBST(PR_MD_ASFILES)
 AC_SUBST(PR_MD_ARCH_DIR)
 AC_SUBST(CPU_ARCH)
 
@@ -1914,16 +2006,17 @@ dnl ====================================
 dnl Generate output files.
 dnl ========================================================
 MAKEFILES="
 Makefile 
 config/Makefile
 config/autoconf.mk
 config/nsprincl.mk
 config/nsprincl.sh
+config/nspr-config
 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 
@@ -1953,9 +2046,9 @@ elif test -n "$USE_PTHREADS"; then
 elif test -n "$USE_BTHREADS"; then
     MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
 fi
 
 if test -n "$USE_CPLUS"; then
     MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
 fi
 
-AC_OUTPUT([$MAKEFILES])
+AC_OUTPUT([$MAKEFILES], [chmod +x config/nspr-config])
--- a/gmakefile.win
+++ b/gmakefile.win
@@ -1,9 +1,10 @@
 #!gmake
+# -*- Mode: Makefile -*-
 #
 # The contents of this file are subject to the Mozilla Public License
 # Version 1.1 (the "MPL"); you may not use this file except in
 # compliance with the MPL.  You may obtain a copy of the MPL at
 # http://www.mozilla.org/MPL/
 # 
 # Software distributed under the MPL is distributed on an "AS IS" basis,
 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
@@ -29,20 +30,20 @@ MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mo
 
 ifdef MOZ_DEBUG
 MOZ_OBJDIR = WIN32_D.OBJ
 else
 MOZ_OBJDIR = WIN32_O.OBJ
 endif
 
 NSPR_CONFIGURE := ../configure \
-		 --with-mozilla \
-                 --includedir=$(MOZ_DIST_FLIPPED)/include \
-                 --bindir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/bin \
-                 --libdir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/lib
+		--with-mozilla \
+		--with-dist-prefix=$(MOZ_DIST_FLIPPED) \
+		--with-dist-bindir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/bin \
+		--with-dist-libdir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/lib
 
 ifeq (,$(MOZ_DEBUG))
 NSPR_CONFIGURE := $(NSPR_CONFIGURE) --enable-optimize --disable-debug
 endif
 
 define MAKE_OBJDIR
 if test ! -d $(@D) ; then rm -rf $(@D) ; nsinstall -D $(@D) ; fi
 endef
--- a/lib/ds/Makefile.in
+++ b/lib/ds/Makefile.in
@@ -21,102 +21,47 @@ MOD_DEPTH	= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 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$(topsrcdir)/pr/include
+INCLUDES = -I$(dist_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
 OS_LIBS = user32.lib
-ifeq ($(OS_TARGET),WIN95)
-EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).lib
-else
-EXTRA_LIBS = $(libdir)/libnspr$(MOD_VERSION).lib
-endif
-
-ifdef MOZ_DEBUG
-ifdef GLOWCODE
-EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
-endif
-endif
-endif
-
-ifndef USE_AUTOCONF
-
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
+endif # WINNT
 
-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$(libdir) -lnspr$(MOD_VERSION)_shr
-else
-EXTRA_LIBS = -L$(libdir) -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
-ifeq ($(OS_ARCH),SCOOS)
-EXTRA_LIBS =
-endif
-endif #!USE_AUTOCONF
+EXTRA_LIBS = $(LIBNSPR)
 
 ifdef RESOLVE_LINK_SYMBOLS
-EXTRA_LIBS := -L$(libdir) -lnspr$(MOD_VERSION) $(OS_LIBS)
+EXTRA_LIBS += $(OS_LIBS)
 endif
 
 LIBRARY_NAME	= plds
-LIBRARY_VERSION	= $(MOD_VERSION)
+LIBRARY_VERSION	= $(MOD_MAJOR_VERSION)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
 RELEASE_LIBS	= $(TARGETS)
 
 GARBAGE += $(TINC)
 
 include $(topsrcdir)/config/rules.mk
@@ -158,33 +103,33 @@ else
 	$(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 $(dist_bindir),
 # so we also install them there.
 #
 
 export:: $(TARGETS)
-	$(INSTALL) -m 444 $(HEADERS) $(includedir)
-	$(INSTALL) -m 444 $(TARGETS) $(libdir)
+	$(INSTALL) -m 444 $(HEADERS) $(dist_includedir)
+	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
 ifdef SHARED_LIBRARY
 ifeq ($(OS_ARCH),HP-UX)
-	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(libdir)
-	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(bindir)
+	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
+	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
 else
-	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
 endif
 ifeq ($(OS_ARCH), OpenVMS)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(libdir)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir)
 endif
 endif
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
 endif
 
--- a/lib/libc/include/Makefile.in
+++ b/lib/libc/include/Makefile.in
@@ -28,14 +28,14 @@ include $(topsrcdir)/config/config.mk
 HEADERS = $(wildcard $(srcdir)/*.h)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(HEADERS)
-	$(INSTALL) -m 444 $(HEADERS) $(includedir)
+	$(INSTALL) -m 444 $(HEADERS) $(dist_includedir)
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)
 endif
 
 
--- a/lib/libc/src/Makefile.in
+++ b/lib/libc/src/Makefile.in
@@ -21,26 +21,17 @@ MOD_DEPTH	= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 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)
+INCLUDES = -I$(dist_includedir)
 
 CSRCS =\
 	plvrsion.c  \
 	strlen.c  \
 	strcpy.c  \
 	strdup.c  \
 	strcat.c  \
 	strcmp.c  \
@@ -50,75 +41,30 @@ CSRCS =\
 	strstr.c  \
 	strcstr.c \
 	base64.c \
 	plerror.c \
 	plgetopt.c \
 	$(NULL)
 
 LIBRARY_NAME	= plc
-LIBRARY_VERSION	= $(MOD_VERSION)
+LIBRARY_VERSION	= $(MOD_MAJOR_VERSION)
 
 RELEASE_LIBS = $(TARGETS)
 
 ifeq ($(OS_ARCH),WINNT)
-ifeq ($(OS_TARGET), WIN16)
-EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).lib
-else
 DLLBASE=/BASE:0x30000000
 RES=$(OBJDIR)/plc.res
 RESNAME=plc.rc
-ifeq ($(OS_TARGET),WIN95)
-EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).lib
-else
-EXTRA_LIBS = $(libdir)/libnspr$(MOD_VERSION).lib
-endif
-
-ifdef MOZ_DEBUG
-ifdef GLOWCODE
-EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
-endif
-endif
-endif
-
-ifndef USE_AUTOCONF
-
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
+endif # WINNT
 
-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$(libdir) -lnspr$(MOD_VERSION)_shr
-else
-EXTRA_LIBS = -L$(libdir) -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
-ifeq ($(OS_ARCH),SCOOS)
-EXTRA_LIBS =
-endif
-endif #!USE_AUTOCONF
+EXTRA_LIBS = $(LIBNSPR)
 
 ifdef RESOLVE_LINK_SYMBOLS
-EXTRA_LIBS := -L$(libdir) -lnspr$(MOD_VERSION) $(OS_LIBS)
+EXTRA_LIBS += $(OS_LIBS)
 endif
 
 GARBAGE += $(TINC)
 
 include $(topsrcdir)/config/rules.mk
 
 #
 # Version information generation (begin)
@@ -157,31 +103,31 @@ else
 	$(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 $(dist_bindir),
 # so we also install them there.
 #
 
 export:: $(TARGETS)
-	$(INSTALL) -m 444 $(TARGETS) $(libdir)
+	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
 ifdef SHARED_LIBRARY
 ifeq ($(OS_ARCH),HP-UX)
-	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(libdir)
-	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(bindir)
+	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
+	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
 else
-	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
 endif
 ifeq ($(OS_ARCH), OpenVMS)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(libdir)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir)
 endif
 endif
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
 endif
 
--- a/lib/msgc/include/Makefile.in
+++ b/lib/msgc/include/Makefile.in
@@ -29,13 +29,13 @@ EXPORT_HEADERS = prgc.h
 HEADERS = $(EXPORT_HEADERS) gcint.h
 
 RELEASE_HEADERS = $(EXPORT_HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(EXPORT_HEADERS)
-	$(INSTALL) -m 444 $(EXPORT_HEADERS) $(includedir)
+	$(INSTALL) -m 444 $(EXPORT_HEADERS) $(dist_includedir)
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(EXPORT_HEADERS) $(MOZ_INCL)
 endif
 
--- a/lib/msgc/src/Makefile.in
+++ b/lib/msgc/src/Makefile.in
@@ -21,105 +21,59 @@ MOD_DEPTH	= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 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
-
-INCLUDES = -I$(includedir) -I../include
+INCLUDES = -I$(dist_includedir) -I../include
 
 CSRCS = prgcapi.c prmsgc.c
 
 ifeq ($(OS_ARCH),WINNT)
-ifeq ($(OS_TARGET),WIN16)
-CSRCS += win16gc.c
-else
 CSRCS += win32gc.c
-endif
 else
 ifeq ($(OS_ARCH),OS2)
 CSRCS += os2gc.c
 else
 CSRCS += unixgc.c
 endif
 endif
 
-NSPR_VERSION = $(MOD_VERSION)
+NSPR_VERSION = $(MOD_MAJOR_VERSION)
+
+EXTRA_LIBS = $(LIBNSPR)
+
+ifdef RESOLVE_LINK_SYMBOLS
+EXTRA_LIBS += $(OS_LIBS)
+endif
 
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET), WIN16)
-EXTRA_LIBS = $(libdir)/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 = $(libdir)/libnspr$(NSPR_VERSION).lib
-
-ifdef MOZ_DEBUG
-ifdef GLOWCODE
-EXTRA_LIBS += $(GLOWDIR)/glowcode.lib
-endif
-endif
-endif
-
-else
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-EXTRA_LIBS = $(libdir)/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$(libdir) -lnspr$(NSPR_VERSION)_shr
-else
-EXTRA_LIBS = -L$(libdir) -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
-ifeq ($(OS_ARCH),SCOOS)
-EXTRA_LIBS =
-endif
+endif # WINNT
 
 LIBRARY_NAME = msgc
-LIBRARY_VERSION = $(MOD_VERSION)
+LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
 
 RELEASE_LIBS = $(TARGETS)
 
 include $(topsrcdir)/config/rules.mk
 
 #
-# The Client build wants the shared libraries in $(bindir),
+# The Client build wants the shared libraries in $(dist_bindir),
 # so we also install them there.
 #
 
 export:: $(TARGETS)
-	$(INSTALL) -m 444 $(TARGETS) $(libdir)
+	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
 ifdef SHARED_LIBRARY
-	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
 endif
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
 endif	
 
--- a/lib/msgc/tests/Makefile.in
+++ b/lib/msgc/tests/Makefile.in
@@ -42,106 +42,106 @@ PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
 
-INCLUDES = -I$(includedir)
+INCLUDES = -I$(dist_includedir)
 
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
-LDOPTS = -L$(libdir)
-NSPR_VERSION = $(MOD_VERSION)
-GC_VERSION = $(MOD_VERSION)
+LDOPTS = -L$(dist_libdir)
+NSPR_VERSION = $(MOD_MAJOR_VERSION)
+GC_VERSION = $(MOD_MAJOR_VERSION)
 LIBPR = -lnspr$(NSPR_VERSION)
 LIBPLC = -lplc$(NSPR_VERSION)
 LIBGC = -lmsgc$(GC_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(libdir)/nspr$(NSPR_VERSION).lib
-  LIBPLC = $(libdir)/plc$(NSPR_VERSION).lib
-  LIBGC= $(libdir)/msgc$(GC_VERSION).lib
+  LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
+  LIBPLC = $(dist_libdir)/plc$(NSPR_VERSION).lib
+  LIBGC= $(dist_libdir)/msgc$(GC_VERSION).lib
 else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
-  LIBPR = $(libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
-  LIBPLC = $(libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
-  LIBGC= $(libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
+  LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
+  LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
+  LIBGC= $(dist_libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
 endif
 endif
 
 ifeq ($(OS_ARCH),OS2)
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
   LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
-  LIBPR = $(libdir)/nspr$(NSPR_VERSION).lib
-  LIBPLC = $(libdir)/plc$(NSPR_VERSION).lib
-  LIBGC= $(libdir)/msgc$(GC_VERSION).lib
+  LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
+  LIBPLC = $(dist_libdir)/plc$(NSPR_VERSION).lib
+  LIBGC= $(dist_libdir)/msgc$(GC_VERSION).lib
 else
   LDOPTS += -Zomf -Zlinker /PM:VIO
 endif
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
-LDOPTS += -rpath $(PWD)/$(libdir) -rdata_shared
+LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
 
 # For 6.x machines, include this flag
 ifeq ($(basename $(OS_RELEASE)),6)
 ifeq ($(USE_N32),1)
 LDOPTS += -n32
 else
 LDOPTS += -32
 endif
 endif
 
 endif
 
 ifeq ($(OS_ARCH), OSF1)
 # I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
 # we do static linking.
 ifeq ($(OS_RELEASE), V3.2)
-  LIBPR = $(libdir)/libnspr$(NSPR_VERSION).a
-  LIBPLC = $(libdir)/libplc$(NSPR_VERSION).a
-  LIBGC = $(libdir)/libmsgc$(GC_VERSION).a
+  LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
+  LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
+  LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
   EXTRA_LIBS = -lc_r
 else
-  LDOPTS += -rpath $(PWD)/$(libdir)
+  LDOPTS += -rpath $(PWD)/$(dist_libdir)
 endif
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
-LDOPTS += -z -Wl,+s,+b,$(PWD)/$(libdir)
+LDOPTS += -z -Wl,+s,+b,$(PWD)/$(dist_libdir)
 endif
 
 # AIX
 ifeq ($(OS_ARCH),AIX)
-LDOPTS += -blibpath:$(PWD)/$(libdir):/usr/lib:/lib
+LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
 ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
 LIBPR = -lnspr$(NSPR_VERSION)_shr
 LIBPLC = -lplc$(NSPR_VERSION)_shr
 LIBGC = -lmsgc$(GC_VERSION)_shr
 else
 LDOPTS += -brtl
 EXTRA_LIBS = -ldl
 endif
 endif
 
 # Solaris
 ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
-LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(libdir)
+LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
-LDOPTS += -R $(PWD)/$(libdir)
+LDOPTS += -R $(PWD)/$(dist_libdir)
 endif
 endif
 
 ifneq ($(LOCAL_THREADS_ONLY),1)
 # SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
 # even though we already linked with these system libraries
 # when we built libnspr.so.
 ifeq ($(OS_RELEASE), 5.4)
@@ -158,64 +158,64 @@ endif
 endif # LOCAL_THREADS_ONLY
 endif # SunOS
 
 ifeq ($(OS_ARCH),NEC)
 EXTRA_LIBS = $(OS_LIBS)
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
 # option for ld on other platforms.
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), NCR)
 # XXX: We see some strange problems when we link with libnspr.so.
 # So for now we use static libraries on NCR.  The shared library
 # stuff below is commented out.
-LIBPR = $(libdir)/libnspr$(NSPR_VERSION).a
-LIBPLC = $(libdir)/libplc$(NSPR_VERSION).a
-LIBGC = $(libdir)/libmsgc$(GC_VERSION).a
+LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
+LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
+LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
 EXTRA_LIBS = -lsocket -lnsl -ldl
 
 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
 # implicitly by $(CC)) again even though we already linked with these
 # system libraries when we built libnspr.so.
 #EXTRA_LIBS = -lsocket -lnsl
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
 # option for ld on other platforms.
-#export LD_RUN_PATH = $(PWD)/$(libdir)
+#export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), Linux)
 ifeq ($(OS_RELEASE), 1.2)
 EXTRA_LIBS = -ldl
 endif
 endif
 
 ifeq ($(OS_ARCH), SCOOS)
 # SCO Unix needs to link against -lsocket again even though we
 # already linked with these system libraries when we built libnspr.so.
 EXTRA_LIBS = -lsocket
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
 # option for ld on other platforms.
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH),SINIX)
 EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
 # option for ld on other platforms.
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), UNIXWARE)
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH),BSD_OS)
 EXTRA_LIBS = -ldl
 endif
 
 ifeq ($(OS_ARCH),DGUX)
 EXTRA_LIBS = -lsocket -lnsl -ldl
@@ -246,17 +246,17 @@ ifeq ($(AIX_PRE_4_2),1)
 #
 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
 # two-step linking hack below.
 
 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 	rm -f $@ $(AIX_TMP)
-	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(libdir)/libnspr$(NSPR_VERSION).a
+	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a
 	$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
 	rm -f $(AIX_TMP)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
--- a/lib/prstreams/Makefile.in
+++ b/lib/prstreams/Makefile.in
@@ -21,17 +21,16 @@ MOD_DEPTH	= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 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.
@@ -48,55 +47,45 @@ ifeq ($(OS_ARCH), IRIX)
     ifneq ($(OS_RELEASE),5.3)
         CCC_ONLY_FLAGS += -exceptions
     endif
 endif
 
 ifeq ($(OS_ARCH), BeOS)
     CFLAGS += -frtti -fexceptions
 endif
-endif # !USE_AUTOCONF
 
-INCLUDES = -I$(includedir)
+INCLUDES = -I$(dist_includedir)
 
 HEADERS = $(wildcard $(srcdir)/*.h)
 
 CSRCS = \
 	plvrsion.c \
 	$(NULL)
 
 CXXSRCS = \
 	prstrms.cpp \
 	$(NULL)
 
 OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)) $(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
 
-ifndef USE_AUTOCONF
+LIBRARY_NAME    = prstrms
+LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
+
+RELEASE_HEADERS = $(HEADERS)
+RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
+RELEASE_LIBS    = $(TARGETS)
+
+include $(topsrcdir)/config/rules.mk
+
 ifeq ($(OS_ARCH), WINNT)
-    ifeq ($(OS_TARGET), WIN16)
-        EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).lib
-    else
-        DLLBASE=/BASE:0x30000000
+	DLLBASE=/BASE:0x30000000
         RES=$(OBJDIR)/prstrms.res
         RESNAME=prstrms.rc
-        OS_LIBS = user32.lib
-        ifeq ($(OS_TARGET), WIN95)
-            EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).lib
-        else
-            EXTRA_LIBS = $(libdir)/libnspr$(MOD_VERSION).lib
-        endif
-    endif
 else
-    ifeq ($(OS_ARCH),OS2)
-      ifeq ($(MOZ_OS2_TOOLS),VACPP)
-         EXTRA_LIBS = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
-      else
-         EXTRA_LIBS = -L$(libdir) -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
@@ -105,55 +94,46 @@ else
         ifeq ($(CLASSIC_NSPR),1)
             MKSHLIB = makeC++SharedLib -p 0
         else
             MKSHLIB = makeC++SharedLib_r -p 0
         endif
         OS_LIBS += -ldl
       endif
     endif
-    ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
-        EXTRA_LIBS = -L$(libdir) -lnspr$(MOD_VERSION)_shr
-    else
-        EXTRA_LIBS = -L$(libdir) -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
 ifeq ($(OS_ARCH),SCOOS)
     EXTRA_LIBS =
 endif
 ifeq ($(OS_ARCH),BeOS)
-    EXTRA_LIBS = -lstdc++.r4 -L$(libdir) -lnspr$(MOD_VERSION)
+    EXTRA_LIBS = -lstdc++.r4 -L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)
 endif
 
 ifeq ($(OS_ARCH), UNIXWARE)
     OS_LIBS += -lC
 endif
-endif # !USE_AUTOCONF
 
-ifdef RESOLVE_LINK_SYMBOLS
-EXTRA_LIBS := -L$(libdir) -lnspr$(MOD_VERSION)
+ifeq ($(OS_ARCH),WINNT)
+OS_LIBS	+= user32.lib
 endif
 
-LIBRARY_NAME    = prstrms
-LIBRARY_VERSION = $(MOD_VERSION)
+EXTRA_LIBS = $(LIBNSPR)
 
-RELEASE_HEADERS = $(HEADERS)
-RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
-RELEASE_LIBS    = $(TARGETS)
+ifdef RESOLVE_LINK_SYMBOLS
+EXTRA_LIBS += $(OS_LIBS)
+endif
 
-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
@@ -177,36 +157,36 @@ endif
 	@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
 
 
 $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
 ifeq ($(OS_ARCH), WINNT)
 	$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
 else
 ifeq ($(MOZ_OS2_TOOLS), VACPP)
-	$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) 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)
 #
 
 export:: $(TARGETS) $(HEADERS)
-	$(INSTALL) -m 444 $(HEADERS) $(includedir)
-	$(INSTALL) -m 444 $(TARGETS) $(libdir)
+	$(INSTALL) -m 444 $(HEADERS) $(dist_includedir)
+	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
 ifeq ($(OS_ARCH),OS2)
-	$(INSTALL) -m 444 $(TARGETS) $(bindir)
+	$(INSTALL) -m 444 $(TARGETS) $(dist_bindir)
 endif
 ifeq ($(OS_ARCH),HP-UX)
 ifdef SHARED_LIBRARY
-	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(libdir)
+	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
 endif
 endif
 ifeq ($(OS_ARCH),OpenVMS)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(libdir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_libdir)
 ifdef SHARED_LIBRARY
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(libdir)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir)
 endif
 endif
 
--- a/lib/prstreams/tests/testprstrm/Makefile.in
+++ b/lib/prstreams/tests/testprstrm/Makefile.in
@@ -41,127 +41,127 @@ PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
 
-INCLUDES = -I$(includedir)
+INCLUDES = -I$(dist_includedir)
 
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
-LDOPTS = -L$(libdir)
-LIBPR = -lnspr$(MOD_VERSION)
-LIBPRSTRMS = -lprstrms$(MOD_VERSION)
+LDOPTS = -L$(dist_libdir)
+LIBPR = -lnspr$(MOD_MAJOR_VERSION)
+LIBPRSTRMS = -lprstrms$(MOD_MAJOR_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
-  LIBPRSTRMS = $(libdir)/prstrms$(MOD_VERSION).lib
+  LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
+  LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).lib
 else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
   ifeq ($(OS_TARGET), WIN95)
-    LIBPR = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
-    LIBPRSTRMS = $(libdir)/prstrms$(MOD_VERSION).$(LIB_SUFFIX)
+    LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
+    LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   else
-    LIBPR = $(libdir)/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
-    LIBPRSTRMS = $(libdir)/libprstrms$(MOD_VERSION).$(LIB_SUFFIX)
+    LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
+    LIBPRSTRMS = $(dist_libdir)/libprstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   endif
 endif
 endif
 
 ifeq ($(OS_ARCH),OS2)
   ifeq ($(MOZ_OS2_TOOLS),VACPP)
     LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768
-    LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
-    LIBPRSTRMS = $(libdir)/prstrms$(MOD_VERSION).$(LIB_SUFFIX)
+    LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
+    LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   else
     LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
   endif
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
-LDOPTS += -rpath $(PWD)/$(libdir)
+LDOPTS += -rpath $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), OSF1)
-LDOPTS += -rpath $(PWD)/$(libdir)
+LDOPTS += -rpath $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
-LDOPTS += -Wl,+s,+b,$(PWD)/$(libdir)
+LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
 endif
 
 # AIX
 ifeq ($(OS_ARCH),AIX)
-LDOPTS += -blibpath:$(PWD)/$(libdir):/usr/lib:/lib
+LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
 ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
-LIBPR = -lnspr$(MOD_VERSION)_shr
-LIBPRSTRMS = -lprstrms$(MOD_VERSION)_shr
+LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr
+LIBPRSTRMS = -lprstrms$(MOD_MAJOR_VERSION)_shr
 else
 LDOPTS += -brtl
 EXTRA_LIBS = -ldl
 endif
 endif
 
 # Solaris
 ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
-LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(libdir)
+LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
-LDOPTS += -R $(PWD)/$(libdir)
+LDOPTS += -R $(PWD)/$(dist_libdir)
 # CC on SunOS 5.4 and 5.5.x need to link with -lthread or -lpthread
 # (or use the -mt switch) even though we already linked with these
 # system libraries when we built libnspr.so.
 ifdef USE_PTHREADS
 EXTRA_LIBS = -lpthread
 else
 EXTRA_LIBS = -lthread
 endif # USE_PTHREADS
 endif # NS_USE_GCC
 endif # 4.1.3_U1
 endif # SunOS
 
 ifeq ($(OS_ARCH), NCR)
 # XXX: We see some strange problems when we link with libnspr.so.
 # So for now we use static libraries on NCR.  The shared library
 # stuff below is commented out.
-LIBPR = $(libdir)/libnspr$(MOD_VERSION).a
-LIBPRSTRMS = $(libdir)/libprstrms$(MOD_VERSION).a
+LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
+LIBPRSTRMS = $(dist_libdir)/libprstrms$(MOD_MAJOR_VERSION).a
 EXTRA_LIBS = -lsocket -lnsl -ldl
 
 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
 # implicitly by $(CC)) again even though we already linked with these
 # system libraries when we built libnspr.so.
 #EXTRA_LIBS = -lsocket -lnsl
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
 # option for ld on other platforms.
-#export LD_RUN_PATH = $(PWD)/$(libdir)
+#export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), SCOOS)
 # SCO Unix needs to link against -lsocket again even though we
 # already linked with these system libraries when we built libnspr.so.
 EXTRA_LIBS = -lsocket
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
 # option for ld on other platforms.
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), UNIXWARE)
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 #####################################################
 #
 # The rules
 #
 #####################################################
 
@@ -184,17 +184,17 @@ ifeq ($(AIX_PRE_4_2),1)
 #
 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
 # two-step linking hack below.
 
 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 	rm -f $@ $(AIX_TMP)
-	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(libdir)/libnspr$(MOD_VERSION).a
+	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
 	$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
 	rm -f $(AIX_TMP)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
--- a/lib/tests/Makefile.in
+++ b/lib/tests/Makefile.in
@@ -48,96 +48,96 @@ PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
 
-INCLUDES = -I$(includedir)
+INCLUDES = -I$(dist_includedir)
 
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
-LDOPTS = -L$(libdir)
-LIBPR = -lnspr$(MOD_VERSION)
-LIBPLC = -lplc$(MOD_VERSION)
-LIBPLDS = -lplds$(MOD_VERSION)
+LDOPTS = -L$(dist_libdir)
+LIBPR = -lnspr$(MOD_MAJOR_VERSION)
+LIBPLC = -lplc$(MOD_MAJOR_VERSION)
+LIBPLDS = -lplds$(MOD_MAJOR_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
-  LIBPLC= $(libdir)/plc$(MOD_VERSION).lib
-  LIBPLDS= $(libdir)/plds$(MOD_VERSION).lib
+  LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
+  LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
+  LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).lib
 else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
   ifeq ($(OS_TARGET), WIN95)
-  LIBPR = $(libdir)/nspr$(MOD_VERSION).$(LIB_SUFFIX)
-  LIBPLC= $(libdir)/plc$(MOD_VERSION).$(LIB_SUFFIX)
-  LIBPLDS= $(libdir)/plds$(MOD_VERSION).$(LIB_SUFFIX)
+  LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
+  LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
+  LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   else
-  LIBPR = $(libdir)/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
-  LIBPLC= $(libdir)/libplc$(MOD_VERSION).$(LIB_SUFFIX)
-  LIBPLDS= $(libdir)/libplds$(MOD_VERSION).$(LIB_SUFFIX)
+  LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
+  LIBPLC= $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
+  LIBPLDS= $(dist_libdir)/libplds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
   endif
 endif
 endif
 
 ifeq ($(OS_ARCH),OS2)
   ifeq ($(MOZ_OS2_TOOLS),VACPP)
     LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768
-    LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
-    LIBPLC = $(libdir)/plc$(MOD_VERSION).lib
-    LIBPLDS= $(libdir)/plds$(MOD_VERSION).$(LIB_SUFFIX)	
+    LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
+    LIBPLC = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
+    LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)	
   else
     LDOPTS += -Zomf -Zlinker /PM:VIO
   endif
 endif
 
 ifneq ($(OS_ARCH), WINNT)
 PWD = $(shell pwd)
 endif
 
 ifeq ($(OS_ARCH), IRIX)
-LDOPTS += -rpath $(PWD)/$(libdir)
+LDOPTS += -rpath $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), Linux)
     ifeq ($(OS_RELEASE), 1.2)
         EXTRA_LIBS = -ldl
     else
-        LDOPTS += -Xlinker -rpath $(PWD)/$(libdir)
+        LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir)
         ifeq ($(USE_PTHREADS),1)
             EXTRA_LIBS = -lpthread
         endif
     endif
 endif
 
 ifeq ($(OS_ARCH), OSF1)
-LDOPTS += -rpath $(PWD)/$(libdir) -lpthread
+LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
-LDOPTS += -Wl,+s,+b,$(PWD)/$(libdir)
+LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
 endif
 
 # AIX
 ifeq ($(OS_ARCH),AIX)
-LDOPTS += -blibpath:$(PWD)/$(libdir):/usr/lib:/lib
-LIBPR = -lnspr$(MOD_VERSION)_shr
-LIBPLC = -lplc$(MOD_VERSION)_shr
+LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
+LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr
+LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr
 endif
 
 # Solaris
 ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
-LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(libdir)
+LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
-LDOPTS += -R $(PWD)/$(libdir)
+LDOPTS += -R $(PWD)/$(dist_libdir)
 endif
 endif
 
 # SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
 # even though we already linked with these system libraries
 # when we built libnspr.so.
 ifeq ($(OS_RELEASE), 5.4)
 EXTRA_LIBS = -lthread
@@ -155,17 +155,17 @@ endif # SunOS
 ifeq ($(OS_ARCH), NCR)
 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
 # implicitly by $(CC)) again even though we already linked with these
 # system libraries when we built libnspr.so.
 EXTRA_LIBS = -lsocket -lnsl
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
 # option for ld on other platforms.
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 #####################################################
 #
 # The rules
 #
 #####################################################
 
@@ -188,17 +188,17 @@ ifeq ($(AIX_PRE_4_2),1)
 #
 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
 # two-step linking hack below.
 
 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 	rm -f $@ $(AIX_TMP)
-	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(libdir)/libnspr$(MOD_VERSION).a
+	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
 	$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
 	rm -f $(AIX_TMP)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
index ae4f8cc857ecd0b7778d1512a33d936e60db5b12..a0a17543ac92688733d1c3145654aaba60558ccf
GIT binary patch
literal 167357
zc%1EB34k0`(SF@MySeX!kU*H+34zT)62dC5$>t!K-7MLS8^V#Dot^AXGCMQO%!UBJ
z62$`*6cD@-6j8iy0Z&B414R%O2q<`fqTq!Hc;&CJU(HO<OdoHv0~^>^P~DZ+wQpX(
zu2)sByI#F$DwPmISV9;Jg?Zt3g?Z6aLQJ@a%D!oshR8!>sw>tW$z<ZGOt>YJ+8vAL
z#E^oJFc^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?YVLso)io|MXuM?62_{wb6K`EN`AvuwUkb=ubKC
zGfzCRV84vVUQM)|_nECT3iiu9j%=B6D*rC*E!Y2FnsXTql7IX81^Z<@g|WXzmhZf)
zV86^T<ZZ1i?|h`tP7`xIL+<ip?wU|+=h4uI>ty+!BMa>`?}U#h-!+<vMa6cGA{}DL
r{g#Y}|50eCX}lhejO0J>jfHlayGXYga-Uvv--E?=j(`r_gyR1PS*Jj#
--- a/pr/include/Makefile.in
+++ b/pr/include/Makefile.in
@@ -31,12 +31,9 @@ include $(topsrcdir)/config/config.mk
 HEADERS = $(wildcard $(srcdir)/*.h)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
 
 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
+	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(dist_includedir)
--- a/pr/include/md/Makefile.in
+++ b/pr/include/md/Makefile.in
@@ -24,173 +24,32 @@ VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 HEADERS = $(wildcard $(srcdir)/*.h)
 CONFIGS = $(wildcard $(srcdir)/*.cfg)
 
 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
-
-ifeq ($(OS_ARCH),WINNT)
-ifeq ($(OS_TARGET), WIN95)
-MDCPUCFG_H = _win95.cfg
-else
-ifeq ($(OS_TARGET), WIN16)
-MDCPUCFG_H = _win16.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
+export:: $(MDCPUCFG_H)
+	$(INSTALL) -m 444 $(CONFIGS) $(dist_includedir)/md
+	$(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(dist_includedir)
+ifneq ($(OS_ARCH),OpenVMS)
+	mv -f $(dist_includedir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h
 else
-MDCPUCFG_H = _aix32.cfg
-endif
-endif
-endif
-
-ifeq ($(OS_ARCH),BSD_OS)
-MDCPUCFG_H = _bsdi.cfg
-endif
-
-ifeq ($(OS_ARCH),FreeBSD)
-MDCPUCFG_H = _freebsd.cfg
-endif
-
-ifeq ($(OS_ARCH),OpenBSD)
-MDCPUCFG_H = _openbsd.cfg
-endif
-
-ifeq ($(OS_ARCH),OpenVMS)
-MDCPUCFG_H = _openvms.cfg
-endif
-
-ifeq ($(OS_ARCH),NetBSD)
-MDCPUCFG_H = _netbsd.cfg
-endif
-
-ifeq ($(OS_ARCH),HP-UX)
-ifeq ($(USE_64), 1)
-MDCPUCFG_H = _hpux64.cfg
-else
-MDCPUCFG_H = _hpux32.cfg
-endif
-endif
-
-ifeq ($(OS_ARCH),Linux)
-MDCPUCFG_H = _linux.cfg
-endif
-
-ifeq ($(OS_ARCH),OSF1)
-MDCPUCFG_H = _osf1.cfg
+# mv'ing a link causes the file itself to move, not the link.
+	rm -f $(dist_includedir)/$(MDCPUCFG_H)
+	rm -f $(dist_includedir)/prcpucfg.h
+	ln -fs $(srcdir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h
 endif
 
-ifeq ($(OS_ARCH),SunOS)
-ifeq ($(OS_RELEASE),4.1.3_U1)
-MDCPUCFG_H = _sunos4.cfg
-else
-ifeq ($(USE_64),1)
-MDCPUCFG_H = _solaris64.cfg
-else
-MDCPUCFG_H = _solaris32.cfg
-endif
-endif
-endif
-
-ifeq ($(OS_ARCH),SINIX)
-MDCPUCFG_H = _reliantunix.cfg
-endif
-
-ifeq ($(OS_ARCH),Rhapsody)
-MDCPUCFG_H = _rhapsody.cfg
-endif
-
-ifeq ($(OS_ARCH),NEXTSTEP)
-MDCPUCFG_H = _nextstep.cfg
-endif
-
-ifeq ($(OS_ARCH),NEWS-OS)
-MDCPUCFG_H = _sony.cfg
-endif
-
-ifeq ($(OS_ARCH),NEC)
-MDCPUCFG_H = _nec.cfg
-endif
-
-ifeq ($(OS_ARCH),SCOOS)
-MDCPUCFG_H = _scoos.cfg
-endif
-
-ifeq ($(OS_ARCH),UNIXWARE)
-ifeq (,$(filter-out 2.1,$(OS_RELEASE)))
-MDCPUCFG_H = _unixware.cfg
-else
-MDCPUCFG_H = _unixware7.cfg
-endif
-endif
-
-ifeq ($(OS_ARCH),NCR)
-MDCPUCFG_H = _ncr.cfg
-endif
-
-ifeq ($(OS_ARCH),DGUX)
-MDCPUCFG_H = _dgux.cfg
-endif
-
-ifeq ($(OS_ARCH),QNX)
-MDCPUCFG_H = _qnx.cfg
-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)
-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 $(srcdir)/$(MDCPUCFG_H) $(includedir)/prcpucfg.h
-endif
-endif
+real_install::
+	$(NSINSTALL) -D $(DESTDIR)$(includedir)/md
+	cp $(srcdir)/$(MDCPUCFG_H) $(DESTDIR)$(includedir)/prcpucfg.h
+	$(NSINSTALL) -t -m 644 $(CONFIGS) $(HEADERS) $(DESTDIR)$(includedir)/md
 
 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/include/obsolete/Makefile.in
+++ b/pr/include/obsolete/Makefile.in
@@ -26,15 +26,14 @@ include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 HEADERS = $(wildcard $(srcdir)/*.h)
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/obsolete
 
+includedir := $(includedir)/obsolete
+
 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
+	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(dist_includedir)/obsolete
--- a/pr/include/private/Makefile.in
+++ b/pr/include/private/Makefile.in
@@ -27,15 +27,14 @@ 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) $(srcdir)/pprmwait.h $(srcdir)/primpl.h
 
+includedir := $(includedir)/private
+
 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
+	$(INSTALL) -m 444 $(RELEASE_HEADERS) $(dist_includedir)/private
--- a/pr/src/Makefile.in
+++ b/pr/src/Makefile.in
@@ -40,27 +40,23 @@ 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 =
-export OPTIMIZER
 OS_LIBS			= -lm
 else	# 4.1.3_U1
 ifdef USE_PTHREADS
 OS_LIBS			= -lpthread -lthread -lposix4 -lsocket -lnsl -ldl
 else
 ifdef LOCAL_THREADS_ONLY
 OS_LIBS			= -lsocket -lnsl -ldl
 else
@@ -141,27 +137,25 @@ 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
+ifeq ($(OS_ARCH),WINNT)
+OS_LIBS		= advapi32.lib wsock32.lib
 endif
 
-endif # USE_AUTOCONF
+ifdef GC_LEAK_DETECTOR
+EXTRA_LIBS	= -L$(dist_libdir) -lboehm
+endif
 
-ifeq ($(OS_ARCH),WINNT)
-ifneq ($(OS_TARGET),WIN16)
-OS_LIBS		= advapi32.lib wsock32.lib
-endif
-endif
+EXTRA_LIBS += $(OS_LIBS)
 
 #
 # Define platform-dependent OBJS
 #
 
 OBJS = \
     $(OBJDIR)/prvrsion.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prfdcach.$(OBJ_SUFFIX) \
@@ -255,143 +249,47 @@ OBJS += \
 	cplus/$(OBJDIR)/rctime.$(OBJ_SUFFIX)
 endif
 
 ifdef GC_LEAK_DETECTOR
 OBJS += memory/$(OBJDIR)/prgcleak.$(OBJ_SUFFIX)
 endif
 
 ifeq ($(OS_ARCH), WINNT)
-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
-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)       \
-    md/windows/$(OBJDIR)/w16gc.$(OBJ_SUFFIX)       \
-    md/windows/$(OBJDIR)/w16error.$(OBJ_SUFFIX)       \
-    md/windows/$(OBJDIR)/w16callb.$(OBJ_SUFFIX)       \
-	md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX)
-EXTRA_LIBS += $(MOD_DEPTH)/tools/winsock.lib
-W16_EXPORTS = EXPORT _malloc.2=_PR_MD_malloc RESIDENT, \
-	_realloc.3=_PR_MD_realloc RESIDENT, \
-	_calloc.4=_PR_MD_calloc RESIDENT, \
-	_free.5=_PR_MD_free RESIDENT, \
-	_getenv.9=_PR_MD_getenv RESIDENT, \
-	_printf.11=_PR_MD_printf RESIDENT, \
-	_strftime.13=_PR_MD_strftime RESIDENT, \
-	_sscanf.33=_PR_MD_sscanf RESIDENT, \
-    _putenv.10=_PR_MD_putenv RESIDENT, \
-    _fprintf.12=_PR_MD_fprintf RESIDENT
-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)/w32poll.$(OBJ_SUFFIX)	\
-	md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX)	\
-	md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX)	\
-	md/windows/$(OBJDIR)/w95dllmain.$(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)/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
-
-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 $(srcdir)/md/beos/objs.mk
-	include $(srcdir)/bthreads/objs.mk
-else
-	# Unix
-	include $(srcdir)/md/unix/objs.mk
-endif # BeOS
-endif # OS2
-endif # WINNT
-endif # !USE_AUTOCONF
-
 LIBRARY_NAME = nspr
-LIBRARY_VERSION = $(MOD_VERSION)
+LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
 
 RELEASE_LIBS = $(TARGETS)
 
 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$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_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)
+PROD = nspr$(MOD_MAJOR_VERSION).$(DLL_SUFFIX)
 else
 PROD = $(notdir $(SHARED_LIBRARY))
 endif
 
 NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
 SH_DATE = $(shell date)
 SH_NOW = $(shell $(NOW))
 
@@ -427,32 +325,32 @@ else
 endif
 endif
 #
 # Version information generation (end)
 #
 
 
 #
-# The Client build wants the shared libraries in $(bindir)
+# The Client build wants the shared libraries in $(dist_bindir)
 # so we also install them there.
 #
 
 export:: $(TARGETS)
-	$(INSTALL) -m 444 $(TARGETS) $(libdir)
+	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
 ifdef SHARED_LIBRARY
 ifeq ($(OS_ARCH),HP-UX)
-	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(libdir)
-	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(bindir)
+	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
+	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
 else
-	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
 endif
 ifeq ($(OS_ARCH), OpenVMS)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(libdir)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(bindir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir)
 endif
 endif
 ifeq ($(MOZ_BITS),16)
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
 	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
 endif
 
 ifeq ($(BUILD_AIX_RTL_LIBC),1)
--- a/pr/src/bthreads/Makefile.in
+++ b/pr/src/bthreads/Makefile.in
@@ -21,17 +21,17 @@ include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 include $(srcdir)/bsrcs.mk
 CSRCS += $(BTCSRCS)
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES		+= -D_NSPR_BUILD_
 
 export:: $(TARGETS)
 
 
--- a/pr/src/cplus/Makefile.in
+++ b/pr/src/cplus/Makefile.in
@@ -38,17 +38,17 @@ CXXSRCS =           \
 	rcthread.cpp	\
 	rctime.cpp      \
 	$(NULL)
 
 OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir)
+INCLUDES = -I$(dist_includedir)
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES	+= -D_NSPR_BUILD_
 
 HEADERS = $(srcdir)/*.h
 
 export:: $(TARGETS)
--- a/pr/src/cplus/tests/Makefile.in
+++ b/pr/src/cplus/tests/Makefile.in
@@ -47,26 +47,26 @@ PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS) $(OBJS)
 
-INCLUDES = -I.. -I$(includedir)
+INCLUDES = -I.. -I$(dist_includedir)
 
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
-LDOPTS = -L$(libdir)
-LIBPR = -lnspr$(MOD_VERSION)
-LIBPL = -lplc$(MOD_VERSION)
+LDOPTS = -L$(dist_libdir)
+LIBPR = -lnspr$(MOD_MAJOR_VERSION)
+LIBPL = -lplc$(MOD_MAJOR_VERSION)
 
 ifeq ($(OS_ARCH), IRIX)
-    LDOPTS += -rpath $(PWD)/$(libdir) -rdata_shared
+    LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
     # For 6.x machines, include this flag
     ifeq ($(basename $(OS_RELEASE)),6)
         ifeq ($(USE_N32),1)
             LDOPTS += -n32
         else
             LDOPTS += -32
         endif
 
@@ -77,19 +77,19 @@ ifeq ($(OS_ARCH), IRIX)
         endif
     endif
 endif
 
 # Solaris
 ifeq ($(OS_ARCH), SunOS)
     ifneq ($(OS_RELEASE), 4.1.3_U1)
         ifdef NS_USE_GCC
-            LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(libdir)
+            LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
         else
-            LDOPTS += -R $(PWD)/$(libdir)
+            LDOPTS += -R $(PWD)/$(dist_libdir)
         endif
     endif
 
     ifneq ($(LOCAL_THREADS_ONLY),1)
 # SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
 # even though we already linked with these system libraries
 # when we built libnspr.so.
         ifeq ($(OS_RELEASE), 5.4)
@@ -103,100 +103,100 @@ ifeq ($(OS_ARCH), SunOS)
                 EXTRA_LIBS = -lthread
             endif
         endif
     endif # LOCAL_THREADS_ONLY
 endif # SunOS
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
-  LIBPL = $(libdir)/plc$(MOD_VERSION).lib
+  LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
+  LIBPL = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
 else
   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
-  LIBPR = $(libdir)/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
-  LIBPL = $(libdir)/libplc$(MOD_VERSION).$(LIB_SUFFIX)
+  LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
+  LIBPL = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
 endif
 endif
 
 ifeq ($(OS_ARCH),OS2)
   ifeq ($(MOZ_OS2_TOOLS),VACPP)
     LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
-    LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
-    LIBPLC = $(libdir)/plc$(MOD_VERSION).lib
+    LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
+    LIBPLC = $(dist_libdir)/plc$(MOD_MAJOR_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)/$(libdir)
+LDOPTS += -rpath $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
-    LDOPTS += -Wl,+s,+b,$(PWD)/$(libdir)
+    LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
 endif
 
 # AIX
 ifeq ($(OS_ARCH),AIX)
-    LDOPTS += -blibpath:$(PWD)/$(libdir):/usr/lib:/lib
+    LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
     ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
-        LIBPR = -lnspr$(MOD_VERSION)_shr
-        LIBPLC = -lplc$(MOD_VERSION)_shr
+        LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr
+        LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr
     else
         LDOPTS += -brtl
         EXTRA_LIBS = -ldl
     endif
 endif
 
 ifeq ($(OS_ARCH), Linux)
     ifeq ($(OS_RELEASE), 1.2)
         EXTRA_LIBS = -ldl
     else
-        LDOPTS += -Xlinker -rpath $(PWD)/$(libdir)
+        LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir)
         ifeq ($(USE_PTHREADS),1)
             EXTRA_LIBS = -lpthread
         endif
     endif
 endif
 
 ifeq ($(OS_ARCH), NCR)
 # XXX: We see some strange problems when we link with libnspr.so.
 # So for now we use static libraries on NCR.  The shared library
 # stuff below is commented out.
-LIBPR = $(libdir)/libnspr$(MOD_VERSION).a
-LIBPL = $(libdir)/libplc$(MOD_VERSION).a
+LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
+LIBPL = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a
 EXTRA_LIBS = -lsocket -lnsl -ldl
 
 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
 # implicitly by $(CC)) again even though we already linked with these
 # system libraries when we built libnspr.so.
 #EXTRA_LIBS = -lsocket -lnsl
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
 # option for ld on other platforms.
-#export LD_RUN_PATH = $(PWD)/$(libdir)
+#export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), SCO_SV)
 # SCO Unix needs to link against -lsocket again even though we
 # already linked with these system libraries when we built libnspr.so.
 EXTRA_LIBS = -lsocket
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
 # option for ld on other platforms.
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), UNIXWARE)
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 #####################################################
 #
 # The rules
 #
 #####################################################
 
@@ -219,17 +219,17 @@ ifeq ($(AIX_PRE_4_2),1)
 #
 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
 # two-step linking hack below.
 
 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 	rm -f $@ $(AIX_TMP)
-	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(libdir)/libnspr$(MOD_VERSION).a
+	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
 	$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
 	rm -f $(AIX_TMP)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
--- a/pr/src/io/Makefile.in
+++ b/pr/src/io/Makefile.in
@@ -54,16 +54,16 @@ ifndef USE_PTHREADS
 	    prfile.c \
 	    prio.c \
 	    prsocket.c \
 	    $(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/linking/Makefile.in
+++ b/pr/src/linking/Makefile.in
@@ -34,16 +34,16 @@ endif
 endif
 
 CSRCS =           \
 	prlink.c   \
 	$(NULL)
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES += -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/malloc/Makefile.in
+++ b/pr/src/malloc/Makefile.in
@@ -30,17 +30,17 @@ include $(topsrcdir)/config/config.mk
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES += -D_NSPR_BUILD_
 
 CSRCS = prmalloc.c prmem.c
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
--- a/pr/src/md/Makefile.in
+++ b/pr/src/md/Makefile.in
@@ -21,48 +21,24 @@ MOD_DEPTH	= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 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)
-    DIRS = windows
-else
-  ifeq ($(OS_ARCH),OS2)
-    DIRS = os2
-  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
-endif
-endif # USE_AUTOCONF
 
 CSRCS =          \
 	prosdep.c \
 	$(NULL)
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/md/beos/Makefile.in
+++ b/pr/src/md/beos/Makefile.in
@@ -19,16 +19,16 @@ include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 include $(srcdir)/bsrcs.mk
 CSRCS += $(MDCSRCS)
 
 TARGETS		= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -1680,29 +1680,23 @@ static PRBool GetState(PRFileDesc *fd, P
             break;
         default:
             *writeReady = PR_FALSE;
     }
     
     return  *readReady || *writeReady || *exceptReady;
 }
 
-
-PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
+// check to see if any of the poll descriptors have data available
+// for reading or writing.
+static PRInt32 CheckPollDescs(PRPollDesc *pds, PRIntn npds)
 {
     PRInt32 ready = 0;
     PRPollDesc *pd, *epd;
-    PRThread	*thread = _PR_MD_CURRENT_THREAD();
-    PRIntervalTime timein;
     
-    if (PR_INTERVAL_NO_TIMEOUT != timeout)
-        timein = PR_IntervalNow();
-
-    do
-    {
         for (pd = pds, epd = pd + npds; pd < epd; pd++)
         {
             PRInt16  in_flags_read = 0,  in_flags_write = 0;
             PRInt16 out_flags_read = 0, out_flags_write = 0;
 
             if (NULL == pd->fd || pd->in_flags == 0) continue;
 
             if (pd->in_flags & PR_POLL_READ)
@@ -1724,20 +1718,19 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn
             else
             {
                 PRFileDesc *bottomFD;
                 PRBool readReady, writeReady, exceptReady;
 
                 pd->out_flags = 0;  /* pre-condition */
                 bottomFD = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
                 PR_ASSERT(NULL != bottomFD);
-                if ((NULL != bottomFD) && (_PR_FILEDESC_OPEN == bottomFD->secret->state))
-                {
-                    bottomFD->secret->md.poll.thread = thread;
                 	
+            if (bottomFD && (_PR_FILEDESC_OPEN == bottomFD->secret->state))
+            {
                     if (GetState(bottomFD, &readReady, &writeReady, &exceptReady))
                     {
                         if (readReady)
                         {
                             if (in_flags_read & PR_POLL_READ)
                                 pd->out_flags |= PR_POLL_READ;
                             if (in_flags_write & PR_POLL_READ)
                                 pd->out_flags |= PR_POLL_WRITE;
@@ -1751,35 +1744,87 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn
                         }
                         if (exceptReady && (pd->in_flags & PR_POLL_EXCEPT))
                         {
                             pd->out_flags |= PR_POLL_EXCEPT;
                         }
                         if (0 != pd->out_flags) ready++;
                     }
                 }
-                else
+            else    /* bad state */
                 {
                     ready += 1;  /* this will cause an abrupt return */
                     pd->out_flags = PR_POLL_NVAL;  /* bogii */
                 }
             }
         }
 
-        if (ready > 0) return ready;
+    return ready;
+}
+
+// set or clear md.poll.thread on the poll descriptors
+static void SetDescPollThread(PRPollDesc *pds, PRIntn npds, PRThread* thread)
+{
+    PRInt32     ready = 0;
+    PRPollDesc *pd, *epd;
+
+    for (pd = pds, epd = pd + npds; pd < epd; pd++)
+    {   
+        if (pd->fd)
+        { 
+            PRFileDesc *bottomFD = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
+            PR_ASSERT(NULL != bottomFD);
+            if (bottomFD && (_PR_FILEDESC_OPEN == bottomFD->secret->state))
+            {
+                bottomFD->secret->md.poll.thread = thread;
+            }
+        }        
+    }
+}
 
-        thread->io_pending       = PR_TRUE;
-        thread->io_fd            = NULL;
-        thread->md.osErrCode     = noErr;
+PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
+{
+    PRThread    *thread = _PR_MD_CURRENT_THREAD();
+    intn is;
+    PRInt32 ready;
+    OSErr   result;
+    
+    if (timeout == PR_INTERVAL_NO_WAIT) {        
+        return CheckPollDescs(pds, npds);
+    }
+    
+    _PR_INTSOFF(is);
+    PR_Lock(thread->md.asyncIOLock);
+
+    // ensure that we don't miss the firing of the notifier while checking socket status
+    // need to set up the thread
+    PrepareForAsyncCompletion(thread, 0);
+
+    SetDescPollThread(pds, npds, thread);        
+    ready = CheckPollDescs(pds, npds);
+
+    PR_Unlock(thread->md.asyncIOLock);
+    _PR_FAST_INTSON(is);
+
+    if (ready == 0) {
         WaitOnThisThread(thread, timeout);
+        result = thread->md.osErrCode;
+        if (result != noErr && result != kETIMEDOUTErr) {
+            PR_ASSERT(0);   /* debug: catch unexpected errors */
+            ready = -1;
+        } else {
+            ready = CheckPollDescs(pds, npds);
+        }
+    } else {
+        thread->io_pending = PR_FALSE;
+    }
 
-    } while ((timeout == PR_INTERVAL_NO_TIMEOUT) ||
-           (((PRIntervalTime)(PR_IntervalNow() - timein)) < timeout));
+    SetDescPollThread(pds, npds, NULL);
 
-    return 0; /* timed out */
+    return ready;
 }
 
 
 void _MD_initfiledesc(PRFileDesc *fd)
 {
 	// Allocate a PR_Lock to arbitrate miscellaneous OT calls for this endpoint between threads
 	// We presume that only one thread will be making Read calls (Recv/Accept) and that only
 	// one thread will be making Write calls (Send/Connect) on the endpoint at a time.
--- a/pr/src/md/mac/macthr.c
+++ b/pr/src/md/mac/macthr.c
@@ -270,16 +270,18 @@ void WaitOnThisThread(PRThread *thread, 
 	        status = PR_WaitCondVar(thread->md.asyncIOCVar, timeout);
 	}
 	if ((status == PR_FAILURE) && (PR_GetError() == PR_PENDING_INTERRUPT_ERROR)) {
 		thread->md.osErrCode = kEINTRErr;
 	} else if (thread->io_pending) {
 		thread->md.osErrCode = kETIMEDOUTErr;
 		PR_SetError(PR_IO_TIMEOUT_ERROR, kETIMEDOUTErr);
 	}
+
+	thread->io_pending = PR_FALSE;
 	PR_Unlock(thread->md.asyncIOLock);
 	_PR_FAST_INTSON(is);
 }
 
 
 void DoneWaitingOnThisThread(PRThread *thread)
 {
     intn is;
--- a/pr/src/md/os2/Makefile.in
+++ b/pr/src/md/os2/Makefile.in
@@ -39,17 +39,17 @@ CSRCS = \
     os2_errors.c \
     os2poll.c \
     os2rng.c \
     $(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
 
--- a/pr/src/md/unix/Makefile.in
+++ b/pr/src/md/unix/Makefile.in
@@ -19,27 +19,16 @@ MOD_DEPTH	= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 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 =          \
 	unix.c    \
 	unix_errors.c    \
 	uxproces.c \
 	uxrng.c \
 	uxshm.c \
 	uxwrap.c \
 	$(NULL)
@@ -47,296 +36,53 @@ CSRCS =          \
 ifneq ($(USE_PTHREADS),1)
 CSRCS += uxpoll.c
 endif
 
 ifeq ($(PTHREADS_USER),1)
 CSRCS += pthreads_user.c
 endif
 
-ifndef USE_AUTOCONF
-
-IRIX_CSRCS =	 \
-	irix.c	 \
-	$(NULL)
-
-SUNOS4_CSRCS =	 \
-	sunos4.c	 \
-	$(NULL)
-
-SOLARIS_CSRCS = \
-	solaris.c	\
-	$(NULL)
-
-AIX_CSRCS =	\
-	aix.c	\
-	$(NULL)
-
-FREEBSD_CSRCS = \
-	freebsd.c \
-	$(NULL)
-
-NETBSD_CSRCS = \
-	netbsd.c \
-	$(NULL)
-
-OPENBSD_CSRCS = \
-       openbsd.c \
-       $(NULL)
-
-BSDI_CSRCS = \
-	bsdi.c \
-	$(NULL)
-
-HPUX_CSRCS = \
-	hpux.c \
-	$(NULL)
-
-OPENVMS_CSRCS = \
-       openvms.c \
-       $(NULL)
-
-OSF1_CSRCS = \
-	osf1.c \
-	$(NULL)
-
-LINUX_CSRCS = \
-	linux.c \
-	$(NULL)
-
-UNIXWARE_CSRCS = \
-	unixware.c \
-	$(NULL)
-
-RELIANTUNIX_CSRCS = \
-      reliantunix.c \
-      $(NULL)
-
-RHAPSODY_CSRCS = \
-	rhapsody.c \
-	$(NULL)
-
-NEXTSTEP_CSRCS = \
-	nextstep.c \
-	$(NULL)
-
-NEC_CSRCS = \
-	nec.c \
-	$(NULL)
-
-SONY_CSRCS = \
-	sony.c \
-	$(NULL)
-
-NCR_CSRCS = \
-	ncr.c \
-	$(NULL)
-
-SCOOS_CSRCS = \
-	scoos.c \
-	$(NULL)
-
-DGUX_CSRCS = \
-	dgux.c \
-	$(NULL)
-
-QNX_CSRCS = \
-	qnx.c \
-	$(NULL)
-
-NTO_CSRCS = \
-	nto.c \
-	$(NULL)
-
-ifeq ($(OS_ARCH),IRIX)
-CSRCS += $(IRIX_CSRCS)
-endif
-
-ifeq ($(OS_ARCH),SunOS)
-ifeq ($(OS_RELEASE),4.1.3_U1)
-CSRCS += $(SUNOS4_CSRCS)
-else
-CSRCS += $(SOLARIS_CSRCS)
-endif
-endif
+CSRCS += $(PR_MD_CSRCS)
+ASFILES += $(PR_MD_ASFILES)
 
-ifeq ($(OS_ARCH),AIX)
-CSRCS += $(AIX_CSRCS)
-endif
-ifeq ($(OS_ARCH),FreeBSD)
-CSRCS += $(FREEBSD_CSRCS)
-endif
-ifeq ($(OS_ARCH),NetBSD)
-CSRCS += $(NETBSD_CSRCS)
-endif
-ifeq ($(OS_ARCH),OpenBSD)
-CSRCS += $(OPENBSD_CSRCS)
-endif
-ifeq ($(OS_ARCH),BSD_OS)
-CSRCS += $(BSDI_CSRCS)
-endif
-ifeq ($(OS_ARCH),HP-UX)
-CSRCS += $(HPUX_CSRCS)
-endif
-ifeq ($(OS_ARCH),OpenVMS)
-CSRCS += $(OPENVMS_CSRCS)
-endif
-ifeq ($(OS_ARCH),OSF1)
-CSRCS += $(OSF1_CSRCS)
-endif
-ifeq ($(OS_ARCH),Linux)
-CSRCS += $(LINUX_CSRCS)
-endif
-ifeq ($(OS_ARCH),UNIXWARE)
-CSRCS += $(UNIXWARE_CSRCS)
-endif
-ifeq ($(OS_ARCH),SINIX)
-CSRCS += $(RELIANTUNIX_CSRCS)
-endif
-ifeq ($(OS_ARCH),Rhapsody)
-CSRCS += $(RHAPSODY_CSRCS)
-endif
-ifeq ($(OS_ARCH),NEXTSTEP)
-CSRCS += $(NEXTSTEP_CSRCS)
-endif
-ifeq ($(OS_ARCH),NEC)
-CSRCS += $(NEC_CSRCS)
-endif
-ifeq ($(OS_ARCH),NEWS-OS)
-CSRCS += $(SONY_CSRCS)
-endif
-ifeq ($(OS_ARCH),NCR)
-CSRCS += $(NCR_CSRCS)
-endif
-ifeq ($(OS_ARCH),SCOOS)
-CSRCS += $(SCOOS_CSRCS)
-endif
-ifeq ($(OS_ARCH),DGUX)
-CSRCS += $(DGUX_CSRCS)
-endif
-ifeq ($(OS_ARCH),NTO)
-CSRCS += $(NTO_CSRCS)
-endif
-ifeq ($(OS_ARCH),QNX)
-ifeq ($(OS_TARGET),NTO)
-CSRCS += $(NTO_CSRCS)
-else
-CSRCS += $(QNX_CSRCS)
-endif
-endif
-
-#
-# Some Unix platforms have an assembly language file.
-# E.g., AIX 3.2, Solaris (both sparc and x86).
-#
-ifeq ($(OS_ARCH), AIX)
-    ifeq ($(OS_RELEASE), 3.2)
-	ASFILES   = os_$(OS_ARCH).s
-    endif
-endif
-
-ifeq ($(OS_ARCH),SunOS)
-    ifneq ($(OS_RELEASE),4.1.3_U1)
-    ifneq ($(LOCAL_THREADS_ONLY),1)
-        ifeq ($(CPU_ARCH),x86)
-            ASFILES = os_$(OS_ARCH)_x86.s
-        else
-            ASFILES = os_$(OS_ARCH).s
-            ifneq ($(USE_64),1)
-            ASFILES += os_$(OS_ARCH)_32.s
-            endif
-        endif
-    endif
-    endif
-endif
-
-ifeq ($(OS_ARCH),Linux)
-    ifeq ($(CPU_ARCH),x86)
-        ASFILES   = os_Linux_x86.s
-    endif
-endif
-
-ifeq ($(OS_ARCH), SINIX)
-    ifeq ($(CPU_ARCH),mips)
-        ASFILES   = os_ReliantUNIX.s
-    endif
-endif
-
-ifeq ($(OS_ARCH)$(OS_RELEASE),BSD_OS2.1)
-    ASFILES = os_BSD_386_2.s
-endif
-
-ifeq ($(OS_ARCH), IRIX)
-    ASFILES   = os_Irix.s
-endif
-
-ifeq ($(OS_ARCH), HP-UX)
-    ASFILES   = os_HPUX.s
-endif
-
-TARGETS		= $(OBJS)
-
-ifeq ($(OS_ARCH),AIX)
-ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
-ifneq ($(USE_PTHREADS), 1)
-#TARGETS		+= $(OBJDIR)/aixwrap.$(OBJ_SUFFIX)
-endif
-endif
-endif
+TARGETS = $(OBJS)
 
 ifeq ($(OS_ARCH),SunOS)
 	ifneq ($(OS_RELEASE),4.1.3_U1)
 		ifeq ($(OS_TEST),sun4u)
 			LIBRARY_NAME = $(ULTRASPARC_LIBRARY)
-			LIBRARY_VERSION = $(MOD_VERSION)
+			LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
 			ULTRASPARC_ASFILES = os_$(OS_ARCH)_ultrasparc.s
 			ULTRASPARC_ASOBJS = $(addprefix $(OBJDIR)/,$(ULTRASPARC_ASFILES:.s=.$(OBJ_SUFFIX)))
 			TARGETS		+= $(ULTRASPARC_ASOBJS) $(SHARED_LIBRARY)
 			RELEASE_LIBS = $(SHARED_LIBRARY)
 		endif
 	endif
 endif
 
-else # USE_AUTOCONF
-
-CSRCS += $(PR_MD_CSRCS)
-ASFILES += $(PR_MD_ASFILES)
-
-TARGETS = $(OBJS)
-
-endif # ! USE_AUTOCONF
-
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
-#ifeq ($(OS_ARCH),AIX)
-#ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
-#ifneq ($(USE_PTHREADS), 1)
-#	$(INSTALL) -m 444 $(OBJDIR)/aixwrap.$(OBJ_SUFFIX) $(libdir)
-#endif
-#endif
-#endif
 
-ifndef USE_AUTOCONF
 ifeq ($(OS_ARCH),SunOS)
 ifneq ($(OS_RELEASE),4.1.3_U1)
 ifeq ($(OS_TEST),sun4u)
 $(SHARED_LIBRARY): $(ULTRASPARC_ASOBJS)
 	$(LD) -G -z text -o $@ $(ULTRASPARC_ASOBJS)
-	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(libdir)
+	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_libdir)
 
 $(ULTRASPARC_ASOBJS): $(ULTRASPARC_ASFILES)
 ifeq ($(USE_64),1)
 	/usr/ccs/bin/as -o $@ -K PIC -P -D_ASM -D__STDC__=0 -xarch=v9 $<
 else
 	/usr/ccs/bin/as -o $@ -K PIC -P -D_ASM -D__STDC__=0 -xarch=v8plus $<
 endif
 
 clean::
 	rm -rf $(ULTRASPARC_ASOBJS)
 endif
 endif
 endif
-endif #!USE_AUTOCONF
--- a/pr/src/md/unix/objs.mk
+++ b/pr/src/md/unix/objs.mk
@@ -30,237 +30,14 @@ CSRCS =          \
 ifneq ($(USE_PTHREADS),1)
 CSRCS += uxpoll.c
 endif
 
 ifeq ($(PTHREADS_USER),1)
 CSRCS += pthreads_user.c
 endif
 
-ifdef USE_AUTOCONF
-
 CSRCS	+= $(PR_MD_CSRCS)
 ASFILES += $(PR_MD_ASFILES)
 
-else # ! USE_AUTOCONF
-IRIX_CSRCS =	 \
-	irix.c	 \
-	$(NULL)
-
-SUNOS4_CSRCS =	 \
-	sunos4.c	 \
-	$(NULL)
-
-SOLARIS_CSRCS = \
-	solaris.c	\
-	$(NULL)
-
-AIX_CSRCS =	\
-	aix.c	\
-	$(NULL)
-
-FREEBSD_CSRCS = \
-	freebsd.c \
-	$(NULL)
-
-NETBSD_CSRCS = \
-	netbsd.c \
-	$(NULL)
-
-OPENBSD_CSRCS = \
-	openbsd.c \
-	$(NULL)
-
-BSDI_CSRCS = \
-	bsdi.c \
-	$(NULL)
-
-HPUX_CSRCS = \
-	hpux.c \
-	$(NULL)
-
-OSF1_CSRCS = \
-	osf1.c \
-	$(NULL)
-
-OPENVMS_CSRCS = \
-	openvms.c \
-	$(NULL)
-
-LINUX_CSRCS = \
-	linux.c \
-	$(NULL)
-
-UNIXWARE_CSRCS = \
-	unixware.c \
-	$(NULL)
-
-RELIANTUNIX_CSRCS = \
-	reliantunix.c \
-	$(NULL)
-
-RHAPSODY_CSRCS = \
-	rhapsody.c \
-	$(NULL)
-
-NEXTSTEP_CSRCS = \
-	nextstep.c \
-	$(NULL)
-
-NEC_CSRCS = \
-	nec.c \
-	$(NULL)
-
-SONY_CSRCS = \
-	sony.c \
-	$(NULL)
-
-NCR_CSRCS = \
-	ncr.c \
-	$(NULL)
-
-SCOOS_CSRCS = \
-	scoos.c \
-	$(NULL)
-
-DGUX_CSRCS = \
-	dgux.c \
-	$(NULL)
-
-QNX_CSRCS = \
-	qnx.c \
-	$(NULL)
-
-NTO_CSRCS = \
-	nto.c \
-	$(NULL)
-
-ifeq ($(OS_ARCH),IRIX)
-CSRCS += $(IRIX_CSRCS)
-endif
-
-ifeq ($(OS_ARCH),SunOS)
-ifeq ($(OS_RELEASE),4.1.3_U1)
-CSRCS += $(SUNOS4_CSRCS)
-else
-CSRCS += $(SOLARIS_CSRCS)
-endif
-endif
-
-ifeq ($(OS_ARCH),AIX)
-CSRCS += $(AIX_CSRCS)
-endif
-ifeq ($(OS_ARCH),FreeBSD)
-CSRCS += $(FREEBSD_CSRCS)
-endif
-ifeq ($(OS_ARCH),NetBSD)
-CSRCS += $(NETBSD_CSRCS)
-endif
-ifeq ($(OS_ARCH),OpenBSD)
-CSRCS += $(OPENBSD_CSRCS)
-endif
-ifeq ($(OS_ARCH),BSD_OS)
-CSRCS += $(BSDI_CSRCS)
-endif
-ifeq ($(OS_ARCH),HP-UX)
-CSRCS += $(HPUX_CSRCS)
-endif
-ifeq ($(OS_ARCH),OSF1)
-CSRCS += $(OSF1_CSRCS)
-endif
-ifeq ($(OS_ARCH),OpenVMS)
-CSRCS += $(OPENVMS_CSRCS)
-endif
-ifeq ($(OS_ARCH),Linux)
-CSRCS += $(LINUX_CSRCS)
-endif
-ifeq ($(OS_ARCH),UNIXWARE)
-CSRCS += $(UNIXWARE_CSRCS)
-endif
-ifeq ($(OS_ARCH),SINIX)
-CSRCS += $(RELIANTUNIX_CSRCS)
-endif
-ifeq ($(OS_ARCH),Rhapsody)
-CSRCS += $(RHAPSODY_CSRCS)
-endif
-ifeq ($(OS_ARCH),NEXTSTEP)
-CSRCS += $(NEXTSTEP_CSRCS)
-endif
-ifeq ($(OS_ARCH),NEC)
-CSRCS += $(NEC_CSRCS)
-endif
-ifeq ($(OS_ARCH),NEWS-OS)
-CSRCS += $(SONY_CSRCS)
-endif
-ifeq ($(OS_ARCH),NCR)
-CSRCS += $(NCR_CSRCS)
-endif
-ifeq ($(OS_ARCH),SCOOS)
-CSRCS += $(SCOOS_CSRCS)
-endif
-ifeq ($(OS_ARCH),DGUX)
-CSRCS += $(DGUX_CSRCS)
-endif
-ifeq ($(OS_ARCH),NTO)
-CSRCS += $(NTO_CSRCS)
-endif
-ifeq ($(OS_ARCH),QNX)
-ifeq ($(OS_TARGET),NTO)
-CSRCS += $(NTO_CSRCS)
-else
-CSRCS += $(QNX_CSRCS)
-endif
-endif
- 
-#
-# Some Unix platforms have an assembly language file.
-# E.g., AIX 3.2, Solaris (both sparc and x86).
-#
-ifeq ($(OS_ARCH), AIX)
-    ifeq ($(OS_RELEASE), 3.2)
-	ASFILES   = os_$(OS_ARCH).s
-    endif
-endif
-
-ifeq ($(OS_ARCH),SunOS)
-    ifneq ($(OS_RELEASE),4.1.3_U1)
-    ifneq ($(LOCAL_THREADS_ONLY),1)
-        ifeq ($(CPU_ARCH),x86)
-            ASFILES = os_$(OS_ARCH)_x86.s
-        else
-            ASFILES = os_$(OS_ARCH).s
-            ifneq ($(USE_64),1)
-            ASFILES += os_$(OS_ARCH)_32.s
-            endif
-        endif
-    endif
-    endif
-endif
-
-ifeq ($(OS_ARCH),Linux)
-    ifeq ($(CPU_ARCH),x86)
-        ASFILES   = os_Linux_x86.s
-    endif
-endif
-
-ifeq ($(OS_ARCH), SINIX)
-    ifeq ($(CPU_ARCH),mips)
-        ASFILES   = os_ReliantUNIX.s
-    endif
-endif
-
-ifeq ($(OS_ARCH), HP-UX)
-    ASFILES   = os_HPUX.s
-endif
-
-ifeq ($(OS_ARCH), IRIX)
-    ASFILES   = os_Irix.s
-endif
-
-ifeq ($(OS_ARCH)$(OS_RELEASE),BSD_OS2.1)
-    ASFILES = os_BSD_386_2.s
-endif
-
-endif # !USE_AUTOCONF
-
 OBJS += $(addprefix md/unix/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)))  \
 	$(addprefix md/unix/$(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX)))
 
--- a/pr/src/md/windows/Makefile.in
+++ b/pr/src/md/windows/Makefile.in
@@ -80,16 +80,16 @@ CSRCS =          \
     w32rng.c \
     w32shm.c \
     $(NULL)
 endif
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES += -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/memory/Makefile.in
+++ b/pr/src/memory/Makefile.in
@@ -21,34 +21,25 @@ MOD_DEPTH	= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 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$(includedir)/boehm -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(dist_includedir)/.. -I$(dist_includedir)/../boehm -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES += -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
 
--- a/pr/src/misc/Makefile.in
+++ b/pr/src/misc/Makefile.in
@@ -21,25 +21,16 @@ MOD_DEPTH	= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 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  \
 	prerror.c  \
@@ -62,33 +53,31 @@ CSRCS = \
 ifndef USE_PTHREADS
 CSRCS += \
 	pripcsem.c \
 	$(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
-RELEASE_BINS = compile-et.pl prerr.properties
+#RELEASE_BINS = compile-et.pl prerr.properties
 
 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:
+$(OBJDIR)/prdtoa.o: prdtoa.c
 	@$(MAKE_OBJDIR)
-	$(CC) -o $@ -c $(filter-out -O, $(CFLAGS)) prdtoa.c
+	$(CC) -o $@ -c $(filter-out -O, $(CFLAGS)) $<
 endif
-endif #!USE_AUTOCONF
 
 #
 # Generate prerr.h, prerr.c, and prerr.properties from prerr.et.
 #
 build_prerr:
 	$(PERL) $(srcdir)/compile-et.pl prerr.et
 
 export:: $(TARGETS)
--- a/pr/src/prvrsion.c
+++ b/pr/src/prvrsion.c
@@ -17,17 +17,19 @@
  */
 
 #include "prinit.h"
 #include "prvrsion.h"
 
 /************************************************************************/
 /**************************IDENTITY AND VERSIONING***********************/
 /************************************************************************/
+#ifndef XP_MAC
 #include "_pr_bld.h"
+#endif
 #if !defined(_BUILD_TIME)
 #ifdef HAVE_LONG_LONG
 #define _BUILD_TIME 0
 #else
 #define _BUILD_TIME {0, 0}
 #endif
 #endif
 #if !defined(_BUILD_STRING)
--- a/pr/src/pthreads/Makefile.in
+++ b/pr/src/pthreads/Makefile.in
@@ -37,17 +37,17 @@ CSRCS = \
 	ptio.c \
 	ptsynch.c \
 	ptthread.c \
 	ptmisc.c \
 	$(NULL)
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
 
--- a/pr/src/threads/Makefile.in
+++ b/pr/src/threads/Makefile.in
@@ -31,25 +31,16 @@ ifdef USE_PTHREADS
 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
 ifdef USE_BTHREADS
@@ -68,16 +59,16 @@ CSRCS =	\
 	prcthr.c \
 	prtpd.c \
 	$(NULL)
 endif
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/src/threads/combined/Makefile.in
+++ b/pr/src/threads/combined/Makefile.in
@@ -45,16 +45,16 @@ CSRCS =         \
 	prulock.c    \
 	pruthr.c     \
     prustack.c    \
 	$(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)
 
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -21,26 +21,17 @@ MOD_DEPTH	= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(MOD_DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
-ifeq ($(OS_TARGET), WIN16)
-OS_CFLAGS = $(OS_EXE_CFLAGS)
-W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX)
-endif
-
-ifeq ($(OS_TARGET),WIN16)
-DIRS = dll w16gui
-else
 DIRS = dll
-endif
 
 ifeq ($(OS_TARGET),OS2)
 OS_CFLAGS = $(OS_EXE_CFLAGS)
 endif
 
 CSRCS =             \
 	accept.c		\
 	acceptread.c	\
@@ -191,67 +182,45 @@ PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS)
 
-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
+INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 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)
-    LIBPLC= $(libdir)/plc$(MOD_VERSION).$(LIB_SUFFIX)
-  else
-    LIBPR = $(libdir)/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
-    LIBPLC= $(libdir)/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  = $(libdir)/nspr$(MOD_VERSION).lib
-  LIBPLC = $(libdir)/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 = $(libdir)
+ABSOLUTE_LIB_DIR = $(dist_libdir)
 else
 # $(DIST) is a relative pathname: prepend the current directory.
 PWD = $(shell pwd)
-ABSOLUTE_LIB_DIR = $(PWD)/$(libdir)
+ABSOLUTE_LIB_DIR = $(PWD)/$(dist_libdir)
 endif
 endif
 
 ifeq ($(OS_ARCH), IRIX)
     ifeq ($(USE_CPLUS), 1)
         CC = CC
     endif
     LDOPTS += -rpath $(ABSOLUTE_LIB_DIR) -rdata_shared
@@ -273,18 +242,18 @@ endif
 
 ifeq ($(OS_ARCH), OSF1)
     ifeq ($(USE_CPLUS), 1)
         CC = cxx
     endif
 # I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
 # we do static linking.
     ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
-        LIBPR = $(libdir)/libnspr$(MOD_VERSION).a
-        LIBPLC = $(libdir)/libplc$(MOD_VERSION).a
+        LIBNSPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
+        LIBPLC = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a
         EXTRA_LIBS = -lc_r
     else
         LDOPTS += -rpath $(ABSOLUTE_LIB_DIR)
     endif
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
     LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR)
@@ -293,18 +262,18 @@ ifeq ($(OS_ARCH), HP-UX)
         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
-        LIBPLC = -lplc$(MOD_VERSION)_shr
+        LIBNSPR = -lnspr$(MOD_MAJOR_VERSION)_shr
+        LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr
     else
         LDOPTS += -brtl
         EXTRA_LIBS = -ldl
     endif
 endif
 
 # Solaris
 ifeq ($(OS_ARCH), SunOS)
@@ -362,18 +331,18 @@ ifeq ($(OS_ARCH), NEXTSTEP)
 LDOPTS += -posix
 endif
 
 ifeq ($(OS_ARCH), NEWS-OS)
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
 # option for ld on other platforms.
 #export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
-    LIBPR = $(libdir)/libnspr$(MOD_VERSION).a
-    LIBPLC = $(libdir)/libplc$(MOD_VERSION).a
+    LIBNSPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
+    LIBPLC = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a
     EXTRA_LIBS = -lsocket -lnsl -lgen -lresolv
 endif
 
 ifeq ($(OS_ARCH), Linux)
     ifeq ($(OS_RELEASE), 1.2)
         EXTRA_LIBS = -ldl
     else
         LDOPTS += -Xlinker -rpath $(ABSOLUTE_LIB_DIR)
@@ -445,31 +414,25 @@ 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 $(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
@@ -482,89 +445,67 @@ ifeq ($(AIX_PRE_4_2),1)
 #
 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
 # two-step linking hack below.
 
 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 	rm -f $@ $(AIX_TMP)
-	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(libdir)/libnspr$(MOD_VERSION).a
+	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
 	$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
 	rm -f $(AIX_TMP)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 ifeq ($(OS_ARCH), WINNT)
-ifeq ($(OS_TARGET),WIN16)
-	echo system windows >w16link
-	echo name $@  >>w16link
-	echo option map >>w16link
-#	echo option CASEEXACT >>w16link
-	echo option stack=16K >>w16link
-	echo debug $(DEBUGTYPE) all >>w16link
-	echo file >>w16link
-	echo $< , >>w16link
-	echo $(W16STDIO) >>w16link
-	echo library  >>w16link
-	echo $(LIBPR),	     >>w16link
-	echo $(LIBPLC),		 >>w16link
-	echo winsock.lib     >>w16link
-	wlink @w16link.
-else
-	link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) wsock32.lib -out:$@
-endif
+	link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) wsock32.lib -out:$@
 else
 ifeq ($(OS_ARCH),OS2)
-	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
+	$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(OS_LIBS) $(EXTRA_LIBS)
 else
-	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@
-endif
-endif
-endif
-
-endif # !USE_AUTOCONF
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@
+endif # OS/2
+endif # WINNT
+endif # AIX_PRE_4_2
 
 export:: $(TARGETS)
 clean::
 	rm -f $(TARGETS)
 
-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 $@
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@
 endif
 $(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o
-	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) -lsocket $(EXTRA_LIBS) -o $@
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -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 $@
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
 $(OBJDIR)/foreign: $(OBJDIR)/foreign.o
-	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
 $(OBJDIR)/provider: $(OBJDIR)/provider.o
-	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
 $(OBJDIR)/socket: $(OBJDIR)/socket.o
-	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
 $(OBJDIR)/testfile: $(OBJDIR)/testfile.o
-	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
+	$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(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.in
+++ b/pr/tests/dll/Makefile.in
@@ -30,17 +30,17 @@ include $(topsrcdir)/config/config.mk
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
 endif
 
 CSRCS = mygetval.c mysetval.c
 
-INCLUDES = -I$(includedir)
+INCLUDES = -I$(dist_includedir)
 
 OBJS = $(OBJDIR)/mygetval.$(OBJ_SUFFIX) \
 	$(OBJDIR)/mysetval.$(OBJ_SUFFIX)
 
 ifeq ($(OS_TARGET), WIN16)
 W16OBJS = $(subst $(space),$(comma)$(space),$(OBJS))
 endif
 
--- a/pr/tests/w16gui/Makefile.in
+++ b/pr/tests/w16gui/Makefile.in
@@ -32,19 +32,19 @@ W16STDIO = $(MOD_DEPTH)/pr/src/md/window
 
 CSRCS = poppad.c \
        popfile.c \
        popfont.c \
        popfind.c \
        popprnt0.c
           
 
-INCLUDES = -I$(includedir) 
-LIBPR = $(libdir)/nspr$(MOD_VERSION).lib
-LIBPLDS = $(libdir)/plds$(MOD_VERSION).lib
+INCLUDES = -I$(dist_includedir) 
+LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
+LIBPLDS = $(dist_libdir)/plds$(MOD_MAJOR_VERSION).lib
 TARGETS = $(OBJDIR)/poppad.exe
 OS_CFLAGS = $(OS_EXE_CFLAGS)
 
 include $(topsrcdir)/config/rules.mk
 
 
 ifeq ($(OS_TARGET),WIN16)    
 $(OBJDIR)/poppad.exe: $(OBJS)
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -43,77 +43,77 @@ PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
 
 TARGETS = $(PROGS)
 
-INCLUDES = -I$(includedir) 
+INCLUDES = -I$(dist_includedir) 
 
 NSPR_VERSION = 3
 
 # Setting the variables LDOPTS and LIBPR.  We first initialize
 # them to the default values, then adjust them for some platforms.
-LDOPTS = -L$(libdir)
+LDOPTS = -L$(dist_libdir)
 LIBPR = -lnspr$(NSPR_VERSION)
 LIBPLC = -lplc$(NSPR_VERSION)
 
 ifeq ($(OS_ARCH), WINNT)
 ifeq ($(OS_TARGET), WIN16)
-  LIBPR = $(libdir)/nspr$(NSPR_VERSION).lib
-  LIBPLC= $(libdir)/plc$(NSPR_VERSION).lib
+  LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
+  LIBPLC= $(dist_libdir)/plc$(NSPR_VERSION).lib
 else
 LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
-LIBPR = $(libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
-LIBPLC= $(libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
+LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
+LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
 endif
 endif
 
 ifeq ($(OS_ARCH),OS2)
   ifeq ($(MOZ_OS2_TOOLS),VACPP)
     LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
-    LIBPR = $(libdir)/nspr$(NSPR_VERSION).lib
-    LIBPLC= $(libdir)/plc$(NSPR_VERSION).lib
+    LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
+    LIBPLC= $(dist_libdir)/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)/$(libdir)
+LDOPTS += -rpath $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), OSF1)
-LDOPTS += -rpath $(PWD)/$(libdir) -lpthread
+LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
-LDOPTS += -Wl,+s,+b,$(PWD)/$(libdir)
+LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
 endif
 
 # AIX
 ifeq ($(OS_ARCH),AIX)
-LDOPTS += -blibpath:$(PWD)/$(libdir):/usr/lib:/lib
+LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
 LIBPR = -lnspr$(NSPR_VERSION)_shr
 LIBPLC = -lplc$(NSPR_VERSION)_shr
 endif
 
 # Solaris
 ifeq ($(OS_ARCH), SunOS)
 ifneq ($(OS_RELEASE), 4.1.3_U1)
 ifdef NS_USE_GCC
-LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(libdir)
+LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
 else
-LDOPTS += -R $(PWD)/$(libdir)
+LDOPTS += -R $(PWD)/$(dist_libdir)
 endif
 endif
 
 # SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
 # even though we already linked with these system libraries
 # when we built libnspr.so.
 ifeq ($(OS_RELEASE), 5.4)
 EXTRA_LIBS = -lthread
@@ -127,38 +127,38 @@ EXTRA_LIBS = -lthread
 endif
 endif
 endif # SunOS
 
 ifeq ($(OS_ARCH), NCR)
 # XXX: We see some strange problems when we link with libnspr.so.
 # So for now we use static libraries on NCR.  The shared library
 # stuff below is commented out.
-LIBPR = $(libdir)/libnspr$(NSPR_VERSION).a
-LIBPLC = $(libdir)/libplc$(NSPR_VERSION).a
+LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
+LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
 EXTRA_LIBS = -lsocket -lnsl -ldl
 
 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
 # implicitly by $(CC)) again even though we already linked with these
 # system libraries when we built libnspr.so.
 #EXTRA_LIBS = -lsocket -lnsl
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
 # option for ld on other platforms.
-#export LD_RUN_PATH = $(PWD)/$(libdir)
+#export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 ifeq ($(OS_ARCH), SCOOS)
 # SCO Unix needs to link against -lsocket again even though we
 # already linked with these system libraries when we built libnspr.so.
 EXTRA_LIBS = -lsocket
 # This hardcodes in the executable programs the directory to find
 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
 # option for ld on other platforms.
-export LD_RUN_PATH = $(PWD)/$(libdir)
+export LD_RUN_PATH = $(PWD)/$(dist_libdir)
 endif
 
 #####################################################
 #
 # The rules
 #
 #####################################################
 
@@ -181,17 +181,17 @@ ifeq ($(AIX_PRE_4_2),1)
 #
 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
 # two-step linking hack below.
 
 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 	rm -f $@ $(AIX_TMP)
-	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(libdir)/libnspr$(NSPR_VERSION).a
+	$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a
 	$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
 	rm -f $(AIX_TMP)
 
 else
 
 # All platforms that are not AIX pre-4.2.
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)