Submitted By:            Randy McMurchy <randy_at_linuxfromscratch_dot_org>
Date:                    2006-01-22
Initial Package Version: 1.7.12
Upstream Status:         Unknown (partially fixed in version 1.8 code)
Origin:                  Fedora CVS
Description:             Fixes the --with-system-nspr switch so that it actually
                         works and adds code to provide a working
                         --with-system-nss option. This patch allows Mozilla
                         to use system-installed NSS and NSPR libraries.


diff -Naur mozilla-orig/aclocal.m4 mozilla/aclocal.m4
--- mozilla-orig/aclocal.m4	2004-05-13 21:57:46.000000000 +0000
+++ mozilla/aclocal.m4	2006-01-22 01:41:26.000000000 +0000
@@ -8,6 +8,7 @@
 builtin(include, build/autoconf/libIDL.m4)dnl
 builtin(include, build/autoconf/libIDL-2.m4)dnl
 builtin(include, build/autoconf/nspr.m4)dnl
+builtin(include, build/autoconf/nss.m4)dnl
 builtin(include, build/autoconf/libart.m4)dnl
 builtin(include, build/autoconf/pkg.m4)dnl
 builtin(include, build/autoconf/freetype2.m4)dnl
diff -Naur mozilla-orig/build/autoconf/nss.m4 mozilla/build/autoconf/nss.m4
--- mozilla-orig/build/autoconf/nss.m4	1970-01-01 00:00:00.000000000 +0000
+++ mozilla/build/autoconf/nss.m4	2006-01-22 01:41:26.000000000 +0000
@@ -0,0 +1,67 @@
+# -*- tab-width: 4; -*-
+# Configure paths for NSS
+# Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
+# Based upon gtk.m4 (also PD) by Owen Taylor
+
+dnl AM_PATH_NSS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for NSS, and define NSS_CFLAGS and NSS_LIBS
+AC_DEFUN(AM_PATH_NSS,
+[dnl
+
+AC_ARG_WITH(nss-prefix,
+	[  --with-nss-prefix=PFX  Prefix where NSS is installed],
+	nss_config_prefix="$withval",
+	nss_config_prefix="")
+
+AC_ARG_WITH(nss-exec-prefix,
+	[  --with-nss-exec-prefix=PFX
+                          Exec prefix where NSS is installed],
+	nss_config_exec_prefix="$withval",
+	nss_config_exec_prefix="")
+
+	if test -n "$nss_config_exec_prefix"; then
+		nss_config_args="$nss_config_args --exec-prefix=$nss_config_exec_prefix"
+		if test -z "$NSS_CONFIG"; then
+			NSS_CONFIG=$nss_config_exec_prefix/bin/nss-config
+		fi
+	fi
+	if test -n "$nss_config_prefix"; then
+		nss_config_args="$nss_config_args --prefix=$nss_config_prefix"
+		if test -z "$NSS_CONFIG"; then
+			NSS_CONFIG=$nss_config_prefix/bin/nss-config
+		fi
+	fi
+
+	unset ac_cv_path_NSS_CONFIG
+	AC_PATH_PROG(NSS_CONFIG, nss-config, no)
+	min_nss_version=ifelse([$1], ,3.0.0,$1)
+	AC_MSG_CHECKING(for NSS - version >= $min_nss_version (skipping))
+
+	no_nss=""
+	if test "$NSS_CONFIG" = "no"; then
+		no_nss="yes"
+	else
+		NSS_CFLAGS=`$NSS_CONFIG $nss_config_args --cflags`
+		NSS_LIBS=`$NSS_CONFIG $nss_config_args --libs`
+
+		dnl Skip version check for now
+		nss_config_major_version=`$NSS_CONFIG $nss_config_args --version | \
+			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+		nss_config_minor_version=`$NSS_CONFIG $nss_config_args --version | \
+			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+		nss_config_micro_version=`$NSS_CONFIG $nss_config_args --version | \
+			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+	fi
+
+	if test -z "$no_nss"; then
+		AC_MSG_RESULT(yes)
+		ifelse([$2], , :, [$2])     
+	else
+		AC_MSG_RESULT(no)
+	fi
+
+
+	AC_SUBST(NSS_CFLAGS)
+	AC_SUBST(NSS_LIBS)
+
+])
diff -Naur mozilla-orig/build/unix/Makefile.in mozilla/build/unix/Makefile.in
--- mozilla-orig/build/unix/Makefile.in	2005-02-24 01:22:46.000000000 +0000
+++ mozilla/build/unix/Makefile.in	2006-01-22 01:42:24.000000000 +0000
@@ -36,9 +36,13 @@
 ifdef MOZ_NATIVE_NSPR
 FULL_NSPR_CFLAGS=$(shell $(NSPR_CONFIG) --cflags)
 FULL_NSPR_LIBS=$(shell $(NSPR_CONFIG) --libs)
+NSPR_NAME=nspr
+NSPR_VERSION=$(shell $(NSPR_CONFIG) --version)
 else
 FULL_NSPR_CFLAGS=-I$(includedir)/nspr
 FULL_NSPR_LIBS=$(subst -L$(libdir),-L$(mozappdir),$(shell $(DEPTH)/nsprpub/config/nspr-config --libs))
+NSPR_NAME=$(MOZ_APP_NAME)-nspr
+NSPR_VERSION=$(shell $(DEPTH)/nsprpub/config/nspr-config --version)
 endif
 
 ifdef MOZ_ENABLE_GTK
@@ -76,7 +80,9 @@
 	-e "s|%SUPERWIN_LIBS%|$(SUPERWIN_LIBS)|" \
 	-e "s|%DEFS%|$(_DEFS)|" \
 	-e "s|%FULL_NSPR_LIBS%|$(FULL_NSPR_LIBS)|" \
-	-e "s|%FULL_NSPR_CFLAGS%|$(FULL_NSPR_CFLAGS)|" > $@
+	-e "s|%FULL_NSPR_CFLAGS%|$(FULL_NSPR_CFLAGS)|" \
+	-e "s|%NSPR_NAME%|$(NSPR_NAME)|" \
+	-e "s|%NSPR_VERSION%|$(NSPR_VERSION)|" > $@
 
 libs:: $(MOZ_APP_NAME)-config
 	chmod 755 $<
diff -Naur mozilla-orig/build/unix/mozilla-js.pc.in mozilla/build/unix/mozilla-js.pc.in
--- mozilla-orig/build/unix/mozilla-js.pc.in	2002-10-25 02:30:37.000000000 +0000
+++ mozilla/build/unix/mozilla-js.pc.in	2006-01-22 01:42:24.000000000 +0000
@@ -6,6 +6,6 @@
 Name: JavaScript
 Description: The Mozilla JavaScript Library
 Version: %MOZILLA_VERSION%
-Requires: mozilla-nspr = %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
 Libs: -L${libdir} -lmozjs
 Cflags: -I${includedir}/js -DXP_UNIX
diff -Naur mozilla-orig/build/unix/mozilla-nspr.pc.in mozilla/build/unix/mozilla-nspr.pc.in
--- mozilla-orig/build/unix/mozilla-nspr.pc.in	2002-05-28 20:20:42.000000000 +0000
+++ mozilla/build/unix/mozilla-nspr.pc.in	2006-01-22 01:42:24.000000000 +0000
@@ -5,7 +5,7 @@
 
 Name: NSPR
 Description: The Netscape Portable Runtime
-Version: %MOZILLA_VERSION%
+Version: %NSPR_VERSION%
 Libs: %FULL_NSPR_LIBS%
 Cflags: -I${includedir}/nspr
 
diff -Naur mozilla-orig/build/unix/mozilla-nss.pc.in mozilla/build/unix/mozilla-nss.pc.in
--- mozilla-orig/build/unix/mozilla-nss.pc.in	2002-06-03 22:26:01.000000000 +0000
+++ mozilla/build/unix/mozilla-nss.pc.in	2006-01-22 01:42:24.000000000 +0000
@@ -6,6 +6,6 @@
 Name: NSS
 Description: Mozilla Network Security Services
 Version: %MOZILLA_VERSION%
-Requires: mozilla-nspr = %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
 Libs: -L${libdir} -lnss3 -lsmime3 -lssl3 -lsoftokn3
 Cflags: -I${includedir}/nss
diff -Naur mozilla-orig/build/unix/mozilla-xpcom.pc.in mozilla/build/unix/mozilla-xpcom.pc.in
--- mozilla-orig/build/unix/mozilla-xpcom.pc.in	2005-02-24 01:22:46.000000000 +0000
+++ mozilla/build/unix/mozilla-xpcom.pc.in	2006-01-22 01:42:24.000000000 +0000
@@ -7,6 +7,6 @@
 Name: XPCOM
 Description: The Mozilla Cross Platform Component Library
 Version: %MOZILLA_VERSION%
-Requires: mozilla-nspr = %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
 Libs: -L${libdir} -lxpcom
 Cflags: -I${includedir} -I${includedir}/xpcom -I${includedir}/string
diff -Naur mozilla-orig/config/autoconf.mk.in mozilla/config/autoconf.mk.in
--- mozilla-orig/config/autoconf.mk.in	2004-10-12 04:13:31.000000000 +0000
+++ mozilla/config/autoconf.mk.in	2006-01-22 01:42:24.000000000 +0000
@@ -172,6 +172,7 @@
 MOZ_INSURE_EXCLUDE_DIRS = @MOZ_INSURE_EXCLUDE_DIRS@
 
 MOZ_NATIVE_NSPR = @MOZ_NATIVE_NSPR@
+MOZ_NATIVE_NSS = @MOZ_NATIVE_NSS@
 
 CROSS_COMPILE   = @CROSS_COMPILE@
 
@@ -307,9 +308,52 @@
 PNG_REQUIRES	= png
 endif
 
+NSPR_CONFIG	= @NSPR_CONFIG@
 NSPR_CFLAGS	= @NSPR_CFLAGS@
 NSPR_LIBS	= @NSPR_LIBS@
 
+NSS_CONFIG	= @NSS_CONFIG@
+NSS_CFLAGS	= @NSS_CFLAGS@
+NSS_LIBS	= @NSS_LIBS@
+
+ifdef MOZ_NATIVE_NSS
+NSS_DEP_LIBS	= \
+	$(NULL)
+NSS_LIBS += \
+	-lcrmf \
+	$(NULL)
+else
+NSS_DEP_LIBS	= \
+	$(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
+	$(DIST)/lib/$(DLL_PREFIX)smime3$(DLL_SUFFIX) \
+	$(DIST)/lib/$(DLL_PREFIX)ssl3$(DLL_SUFFIX) \
+	$(DIST)/lib/$(DLL_PREFIX)nss3$(DLL_SUFFIX) \
+	$(DIST)/lib/$(DLL_PREFIX)softokn3$(DLL_SUFFIX) \
+	$(NULL)
+NSS_LIBS	= \
+	$(LIBS_DIR) \
+	$(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
+	-lsmime3 \
+	-lssl3 \
+	-lnss3 \
+	-lsoftokn3 \
+	$(NULL)
+endif
+
+ifneq (,$(filter OS2 WINNT, $(OS_ARCH)))
+ifndef GNU_CC
+ifndef MOZ_NATIVE_NSS
+NSS_LIBS	= \
+	$(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
+	$(DIST)/lib/$(LIB_PREFIX)smime3.$(IMPORT_LIB_SUFFIX) \
+	$(DIST)/lib/$(LIB_PREFIX)ssl3.$(IMPORT_LIB_SUFFIX) \
+	$(DIST)/lib/$(LIB_PREFIX)nss3.$(IMPORT_LIB_SUFFIX) \
+	$(DIST)/lib/$(LIB_PREFIX)softokn3.$(IMPORT_LIB_SUFFIX) \
+	$(NULL)
+endif
+endif
+endif
+
 LDAP_CFLAGS	= @LDAP_CFLAGS@
 LDAP_LIBS	= @LDAP_LIBS@
 XPCOM_GLUE_LIBS	= @XPCOM_GLUE_LIBS@
diff -Naur mozilla-orig/config/config.mk mozilla/config/config.mk
--- mozilla-orig/config/config.mk	2004-10-12 04:13:31.000000000 +0000
+++ mozilla/config/config.mk	2006-01-22 01:41:26.000000000 +0000
@@ -163,39 +163,6 @@
 FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps
 FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names
 
-# 
-# NSS libs needed for final link in static build
-# 
-
-NSS_LIBS	= \
-	$(LIBS_DIR) \
-	$(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
-	-lsmime3 \
-	-lssl3 \
-	-lnss3 \
-	-lsoftokn3 \
-	$(NULL)
-
-ifneq (,$(filter OS2 WINNT, $(OS_ARCH)))
-ifndef GNU_CC
-NSS_LIBS	= \
-	$(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
-	$(DIST)/lib/$(LIB_PREFIX)smime3.$(IMPORT_LIB_SUFFIX) \
-	$(DIST)/lib/$(LIB_PREFIX)ssl3.$(IMPORT_LIB_SUFFIX) \
-	$(DIST)/lib/$(LIB_PREFIX)nss3.$(IMPORT_LIB_SUFFIX) \
-	$(DIST)/lib/$(LIB_PREFIX)softokn3.$(IMPORT_LIB_SUFFIX) \
-	$(NULL)
-endif
-endif
-
-NSS_DEP_LIBS	= \
-	$(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
-	$(DIST)/lib/$(DLL_PREFIX)smime3$(DLL_SUFFIX) \
-	$(DIST)/lib/$(DLL_PREFIX)ssl3$(DLL_SUFFIX) \
-	$(DIST)/lib/$(DLL_PREFIX)nss3$(DLL_SUFFIX) \
-	$(DIST)/lib/$(DLL_PREFIX)softokn3$(DLL_SUFFIX) \
-	$(NULL)
-
 MOZ_UNICHARUTIL_LIBS = $(DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX)
 MOZ_REGISTRY_LIBS          = $(DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX)
 MOZ_WIDGET_SUPPORT_LIBS    = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
diff -Naur mozilla-orig/configure mozilla/configure
--- mozilla-orig/configure	2004-10-12 04:13:29.000000000 +0000
+++ mozilla/configure	2006-01-22 01:47:58.000000000 +0000
@@ -41,6 +41,14 @@
   --with-nspr-exec-prefix=PFX
                           Exec prefix where NSPR is installed"
 ac_help="$ac_help
+  --with-system-nss       Use system installed NSS"
+ac_help="$ac_help
+  --with-nss-prefix=PFX   Prefix where NSS is installed"
+ac_help="$ac_help
+  --with-nss-exec-prefix=PFX
+                          Exec prefix where NSS is installed"
+ac_help="$ac_help
+
   --with-system-jpeg[=PFX]
                           Use system libjpeg [installed at prefix PFX]"
 ac_help="$ac_help
@@ -957,6 +965,7 @@
 MOZPNG=10200
 MOZZLIB=1.0.0
 NSPR_VERSION=4
+NSS_VERSION=3
 
 GLIB_VERSION=1.2.0
 GTK_VERSION=1.2.0
@@ -10640,6 +10649,122 @@
     fi
 fi
 
+# Check whether --with-system-nss or --without-system-nss was given.
+if test "${with_system_nss+set}" = set; then
+  withval="$with_system_nss"
+  if test "$withval" = "yes"; then
+    _USE_SYSTEM_NSS=1
+  elif test "$withval" = "no"; then
+    :
+  else
+    { echo "configure: error: Option, system-nss, does not take an argument ($withval)." 1>&2; exit 1; }
+  fi
+fi
+
+
+if test -n "$_USE_SYSTEM_NSS"; then
+
+# Check whether --with-nss-prefix or --without-nss-prefix was given.
+if test "${with_nss_prefix+set}" = set; then
+  withval="$with_nss_prefix"
+  nss_config_prefix="$withval"
+else
+  nss_config_prefix=""
+fi
+
+
+# Check whether --with-nss-exec-prefix or --without-nss-exec-prefix was given.
+if test "${with_nss_exec_prefix+set}" = set; then
+  withval="$with_nss_exec_prefix"
+  nss_config_exec_prefix="$withval"
+else
+  nss_config_exec_prefix=""
+fi
+
+
+       if test -n "$nss_config_exec_prefix"; then
+               nss_config_args="$nss_config_args --exec-prefix=$nss_config_exec_prefix"
+               if test -z "$NSS_CONFIG"; then
+                       NSS_CONFIG=$nss_config_exec_prefix/bin/nss-config
+               fi
+       fi
+       if test -n "$nss_config_prefix"; then
+               nss_config_args="$nss_config_args --prefix=$nss_config_prefix"
+               if test -z "$NSS_CONFIG"; then
+                       NSS_CONFIG=$nss_config_prefix/bin/nss-config
+               fi
+       fi
+
+       unset ac_cv_path_NSS_CONFIG
+       # Extract the first word of "nss-config", so it can be a program name with args.
+set dummy nss-config; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:11363: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NSS_CONFIG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$NSS_CONFIG" in
+  /*)
+  ac_cv_path_NSS_CONFIG="$NSS_CONFIG" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  ac_cv_path_NSS_CONFIG="$NSS_CONFIG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_NSS_CONFIG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_NSS_CONFIG" && ac_cv_path_NSS_CONFIG="no"
+  ;;
+esac
+fi
+NSS_CONFIG="$ac_cv_path_NSS_CONFIG"
+if test -n "$NSS_CONFIG"; then
+  echo "$ac_t""$NSS_CONFIG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+       min_nss_version=3.0.0
+       echo $ac_n "checking for NSS - version >= $min_nss_version (skipping)""... $ac_c" 1>&6
+echo "configure:11398: checking for NSS - version >= $min_nss_version (skipping)" >&5
+
+       no_nss=""
+       if test "$NSS_CONFIG" = "no"; then
+               no_nss="yes"
+       else
+               NSS_CFLAGS=`$NSS_CONFIG $nss_config_args --cflags`
+               NSS_LIBS=`$NSS_CONFIG $nss_config_args --libs`
+
+                               nss_config_major_version=`$NSS_CONFIG $nss_config_args --version | \
+                       sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+               nss_config_minor_version=`$NSS_CONFIG $nss_config_args --version | \
+                       sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+               nss_config_micro_version=`$NSS_CONFIG $nss_config_args --version | \
+                       sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+       fi
+
+       if test -z "$no_nss"; then
+               echo "$ac_t""yes" 1>&6
+               MOZ_NATIVE_NSS=1
+       else
+               echo "$ac_t""no" 1>&6
+       fi
+
+
+
+
+
+
+fi
+
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 # Check whether --with-system-jpeg or --without-system-jpeg was given.
 if test "${with_system_jpeg+set}" = set; then
@@ -16973,6 +17098,9 @@
 s%@NSPR_CONFIG@%$NSPR_CONFIG%g
 s%@NSPR_CFLAGS@%$NSPR_CFLAGS%g
 s%@NSPR_LIBS@%$NSPR_LIBS%g
+s%@NSS_CONFIG@%$NSS_CONFIG%g
+s%@NSS_CFLAGS@%$NSS_CFLAGS%g
+s%@NSS_LIBS@%$NSS_LIBS%g
 s%@GTK_CONFIG@%$GTK_CONFIG%g
 s%@GTK_CFLAGS@%$GTK_CFLAGS%g
 s%@GTK_LIBS@%$GTK_LIBS%g
@@ -17192,6 +17320,7 @@
 s%@MOZ_PNG_CFLAGS@%$MOZ_PNG_CFLAGS%g
 s%@MOZ_PNG_LIBS@%$MOZ_PNG_LIBS%g
 s%@MOZ_NATIVE_NSPR@%$MOZ_NATIVE_NSPR%g
+s%@MOZ_NATIVE_NSS@%$MOZ_NATIVE_NSS%g
 s%@COMPILE_CFLAGS@%$COMPILE_CFLAGS%g
 s%@COMPILE_CXXFLAGS@%$COMPILE_CXXFLAGS%g
 s%@CROSS_COMPILE@%$CROSS_COMPILE%g
diff -Naur mozilla-orig/configure.in mozilla/configure.in
--- mozilla-orig/configure.in	2004-10-12 04:13:29.000000000 +0000
+++ mozilla/configure.in	2006-01-22 01:41:26.000000000 +0000
@@ -79,6 +79,7 @@
 MOZPNG=10200
 MOZZLIB=1.0.0
 NSPR_VERSION=4
+NSS_VERSION=3
 
 dnl Set the minimum version of toolkit libs used by mozilla
 dnl ========================================================
@@ -2990,6 +2991,19 @@
     fi
 fi
 
+dnl ========================================================
+dnl = If NSS was not detected in the system, 
+dnl = use the one in the source tree (mozilla/security/nss)
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-nss,
+[  --with-system-nss      Use system installed NSS],
+    _USE_SYSTEM_NSS=1 )
+
+if test -n "$_USE_SYSTEM_NSS"; then
+    AM_PATH_NSS(3.0.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
+fi
+
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 dnl system JPEG support
 dnl ========================================================
@@ -5552,6 +5566,7 @@
 AC_SUBST(NSPR_CFLAGS)
 AC_SUBST(NSPR_LIBS)
 AC_SUBST(MOZ_NATIVE_NSPR)
+AC_SUBST(MOZ_NATIVE_NSS)
 
 AC_SUBST(CFLAGS)
 AC_SUBST(CXXFLAGS)
diff -Naur mozilla-orig/directory/c-sdk/config/autoconf.mk.in mozilla/directory/c-sdk/config/autoconf.mk.in
--- mozilla-orig/directory/c-sdk/config/autoconf.mk.in	2003-03-07 20:57:13.000000000 +0000
+++ mozilla/directory/c-sdk/config/autoconf.mk.in	2006-01-22 01:44:31.000000000 +0000
@@ -45,6 +45,9 @@
 PTHREADS_USER	= @USE_USER_PTHREADS@
 CLASSIC_NSPR	= @USE_NSPR_THREADS@
 
+NSPR_CFLAGS	= @NSPR_CFLAGS@
+NSPR_LIBS	= @NSPR_LIBS@
+
 AS		= @AS@
 ASFLAGS		= @ASFLAGS@
 CC		= @CC@
diff -Naur mozilla-orig/directory/c-sdk/configure mozilla/directory/c-sdk/configure
--- mozilla-orig/directory/c-sdk/configure	2004-09-14 21:14:38.000000000 +0000
+++ mozilla/directory/c-sdk/configure	2006-01-22 01:44:31.000000000 +0000
@@ -682,6 +682,7 @@
   program_prefix=${target_alias}-
 
 
+NSPR_VERSION=4
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
@@ -718,7 +719,7 @@
 # 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:722: checking for $ac_word" >&5
+echo "configure:723: 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
@@ -903,18 +904,20 @@
 if test "${with_system_nspr+set}" = set; then
   withval="$with_system_nspr"
      if test "$withval" = "yes"; then
-            _NO_NSPR=
+            _SYSTEM_NSPR=1
 	    else
-            _NO_NSPR=1
+            _SYSTEM_NSPR=
 	    fi
+else
+  _SYSTEM_NSPR= 
 fi
 
 
 if test "$_WIN32_MSVC"; then
-    _NO_NSPR=1
+    _SYSTEM_NSPR=
 fi
 	
-if test -z "$_NO_NSPR"; then
+if test -n "$_SYSTEM_NSPR"; then
     
 # Check whether --with-nspr-prefix or --without-nspr-prefix was given.
 if test "${with_nspr_prefix+set}" = set; then
@@ -951,7 +954,7 @@
 	# Extract the first word of "nspr-config", so it can be a program name with args.
 set dummy nspr-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:955: checking for $ac_word" >&5
+echo "configure:958: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_NSPR_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -986,7 +989,7 @@
 
 	min_nspr_version=4.0.0
 	echo $ac_n "checking for NSPR - version >= $min_nspr_version (skipping)""... $ac_c" 1>&6
-echo "configure:990: checking for NSPR - version >= $min_nspr_version (skipping)" >&5
+echo "configure:993: checking for NSPR - version >= $min_nspr_version (skipping)" >&5
 
 	no_nspr=""
 	if test "$NSPR_CONFIG" = "no"; then
@@ -1018,15 +1021,13 @@
 fi
 
 if test -z "$MOZ_NATIVE_NSPR"; then
-    NSPR_CFLAGS='`$(NSDEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --cflags`'
+    NSPR_CFLAGS='-I$(DIST)/include/nspr'
+    NSPR_LIBS='-L$(DIST)/lib '"-lplds$NSPR_VERSION -lplc$NSPR_VERSION -lnspr$NSPR_VERSION"
     # explicitly set libs for Visual Age C++ for OS/2
     if test "$VACPP" = "yes"; then
         NSPR_LIBS='$(DIST)/lib/nspr'$NSPR_VERSION'.lib $(DIST)/lib/plc'$NSPR_VERSION'.lib $(DIST)/lib/plds'$NSPR_VERSION'.lib '$_PTHREAD_LDFLAGS''
     elif test "$_WIN32_MSVC"; then
             NSPR_LIBS='$(DIST)/lib/nspr'$NSPR_VERSION'.lib $(DIST)/lib/plc'$NSPR_VERSION'.lib $(DIST)/lib/plds'$NSPR_VERSION'.lib '
-            NSPR_CFLAGS='-I$(DIST)/include/nspr'
-    else
-        NSPR_LIBS='`$(NSDEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --libs`'
     fi
 fi
 
@@ -1119,7 +1120,7 @@
     # 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:1123: checking for $ac_word" >&5
+echo "configure:1124: 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
@@ -1194,13 +1195,13 @@
     _SAVE_LDFLAGS="$LDFLAGS"
 
     echo $ac_n "checking for $host compiler""... $ac_c" 1>&6
-echo "configure:1198: checking for $host compiler" >&5
+echo "configure:1199: checking for $host compiler" >&5
     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:1204: checking for $ac_word" >&5
+echo "configure:1205: 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
@@ -1246,16 +1247,16 @@
     LDFLAGS="$HOST_LDFLAGS"
 
     echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1250: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+echo "configure:1251: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
     cat > conftest.$ac_ext <<EOF
-#line 1252 "configure"
+#line 1253 "configure"
 #include "confdefs.h"
 
 int main() {
 return(0);
 ; return 0; }
 EOF
-if { (eval echo configure:1259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1260: \"$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
@@ -1275,7 +1276,7 @@
 # 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:1279: checking for $ac_word" >&5
+echo "configure:1280: 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
@@ -1309,7 +1310,7 @@
     # 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:1313: checking for $ac_word" >&5
+echo "configure:1314: 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
@@ -1339,7 +1340,7 @@
   # 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:1343: checking for $ac_word" >&5
+echo "configure:1344: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1390,7 +1391,7 @@
       # 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:1394: checking for $ac_word" >&5
+echo "configure:1395: 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
@@ -1422,7 +1423,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1426: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1427: 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.
@@ -1433,12 +1434,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1437 "configure"
+#line 1438 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1443: \"$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
@@ -1464,12 +1465,12 @@
   { 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:1468: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1469: 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:1473: checking whether we are using GNU C" >&5
+echo "configure:1474: 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
@@ -1478,7 +1479,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1482: \"$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:1483: \"$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
@@ -1497,7 +1498,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1501: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1502: 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
@@ -1533,7 +1534,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1537: checking for $ac_word" >&5
+echo "configure:1538: 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
@@ -1569,7 +1570,7 @@
 # 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:1573: checking for $ac_word" >&5
+echo "configure:1574: 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
@@ -1601,7 +1602,7 @@
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1605: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1606: 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.
@@ -1612,12 +1613,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1616 "configure"
+#line 1617 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:1621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1622: \"$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
@@ -1643,12 +1644,12 @@
   { 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:1647: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1648: 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:1652: checking whether we are using GNU C++" >&5
+echo "configure:1653: 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
@@ -1657,7 +1658,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1661: \"$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:1662: \"$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
@@ -1676,7 +1677,7 @@
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1680: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1681: 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
@@ -1717,7 +1718,7 @@
    'void exit (int);'
 do
   cat > conftest.$ac_ext <<EOF
-#line 1721 "configure"
+#line 1722 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 $ac_declaration
@@ -1725,7 +1726,7 @@
 exit (42);
 ; return 0; }
 EOF
-if { (eval echo configure:1729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1730: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -1735,14 +1736,14 @@
 fi
 rm -f conftest*
   cat > conftest.$ac_ext <<EOF
-#line 1739 "configure"
+#line 1740 "configure"
 #include "confdefs.h"
 $ac_declaration
 int main() {
 exit (42);
 ; return 0; }
 EOF
-if { (eval echo configure:1746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   break
 else
@@ -1763,7 +1764,7 @@
 # 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:1767: checking for $ac_word" >&5
+echo "configure:1768: 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
@@ -1798,7 +1799,7 @@
 # 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:1802: checking for $ac_word" >&5
+echo "configure:1803: 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
@@ -1833,7 +1834,7 @@
 # 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:1837: checking for $ac_word" >&5
+echo "configure:1838: 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
@@ -1868,7 +1869,7 @@
 # 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:1872: checking for $ac_word" >&5
+echo "configure:1873: 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
@@ -1903,7 +1904,7 @@
 # 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:1907: checking for $ac_word" >&5
+echo "configure:1908: 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
@@ -1938,7 +1939,7 @@
 # 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:1942: checking for $ac_word" >&5
+echo "configure:1943: 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
@@ -1975,7 +1976,7 @@
 # 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:1979: checking for $ac_word" >&5
+echo "configure:1980: 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
@@ -2007,7 +2008,7 @@
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2011: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:2012: 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.
@@ -2018,12 +2019,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 2022 "configure"
+#line 2023 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:2027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2028: \"$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
@@ -2049,12 +2050,12 @@
   { 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:2053: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2054: 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:2058: checking whether we are using GNU C++" >&5
+echo "configure:2059: 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
@@ -2063,7 +2064,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2067: \"$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:2068: \"$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
@@ -2082,7 +2083,7 @@
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:2086: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:2087: 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
@@ -2123,7 +2124,7 @@
    'void exit (int);'
 do
   cat > conftest.$ac_ext <<EOF
-#line 2127 "configure"
+#line 2128 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 $ac_declaration
@@ -2131,7 +2132,7 @@
 exit (42);
 ; return 0; }
 EOF
-if { (eval echo configure:2135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -2141,14 +2142,14 @@
 fi
 rm -f conftest*
   cat > conftest.$ac_ext <<EOF
-#line 2145 "configure"
+#line 2146 "configure"
 #include "confdefs.h"
 $ac_declaration
 int main() {
 exit (42);
 ; return 0; }
 EOF
-if { (eval echo configure:2152: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   break
 else
@@ -2170,7 +2171,7 @@
         # 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:2174: checking for $ac_word" >&5
+echo "configure:2175: 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
@@ -2200,7 +2201,7 @@
   # 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:2204: checking for $ac_word" >&5
+echo "configure:2205: 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
@@ -2251,7 +2252,7 @@
       # 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:2255: checking for $ac_word" >&5
+echo "configure:2256: 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
@@ -2283,7 +2284,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2287: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2288: 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.
@@ -2294,12 +2295,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 2298 "configure"
+#line 2299 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2304: \"$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
@@ -2325,12 +2326,12 @@
   { 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:2329: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2330: 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:2334: checking whether we are using GNU C" >&5
+echo "configure:2335: 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
@@ -2339,7 +2340,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2343: \"$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:2344: \"$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
@@ -2358,7 +2359,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2362: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2363: 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
@@ -2391,7 +2392,7 @@
 
     fi
     echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2395: checking how to run the C preprocessor" >&5
+echo "configure:2396: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2406,13 +2407,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2410 "configure"
+#line 2411 "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:2416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2417: \"$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
   :
@@ -2423,13 +2424,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2427 "configure"
+#line 2428 "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:2433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2434: \"$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
   :
@@ -2440,13 +2441,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2444 "configure"
+#line 2445 "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:2450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2451: \"$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
   :
@@ -2473,7 +2474,7 @@
     # 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:2477: checking for $ac_word" >&5
+echo "configure:2478: 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
@@ -2505,7 +2506,7 @@
 # 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:2509: checking for $ac_word" >&5
+echo "configure:2510: 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
@@ -2546,7 +2547,7 @@
 # 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:2550: checking for $ac_word" >&5
+echo "configure:2551: 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
@@ -2587,7 +2588,7 @@
 # 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:2591: checking for $ac_word" >&5
+echo "configure:2592: 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
@@ -2628,7 +2629,7 @@
 # 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:2632: checking for $ac_word" >&5
+echo "configure:2633: 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
@@ -2669,7 +2670,7 @@
 # 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:2673: checking for $ac_word" >&5
+echo "configure:2674: 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
@@ -2731,7 +2732,7 @@
 fi
 
 echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6
-echo "configure:2735: checking for gcc -pipe support" >&5
+echo "configure:2736: checking for gcc -pipe support" >&5
 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
     echo '#include <stdio.h>' > dummy-hello.c
     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
@@ -2746,14 +2747,14 @@
         _SAVE_CFLAGS=$CFLAGS
         CFLAGS="$CFLAGS -pipe"
         cat > conftest.$ac_ext <<EOF
-#line 2750 "configure"
+#line 2751 "configure"
 #include "confdefs.h"
  #include <stdio.h> 
 int main() {
 printf("Hello World\n");
 ; return 0; }
 EOF
-if { (eval echo configure:2757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   _res_gcc_pipe="yes"
 else
@@ -2786,7 +2787,7 @@
 # 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:2790: checking for $ac_word" >&5
+echo "configure:2791: 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
@@ -3020,17 +3021,17 @@
     DSO_LDOPTS='-brtl -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
     ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
-echo "configure:3024: checking for sys/atomic_op.h" >&5
+echo "configure:3025: checking for sys/atomic_op.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3029 "configure"
+#line 3030 "configure"
 #include "confdefs.h"
 #include <sys/atomic_op.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3188,7 +3189,7 @@
         _DEBUG_FLAGS='-gdwarf-2 -O0'
         MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
         echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
-echo "configure:3192: checking for gethostbyaddr in -lbind" >&5
+echo "configure:3193: checking for gethostbyaddr in -lbind" >&5
 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3196,7 +3197,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3200 "configure"
+#line 3201 "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
@@ -3207,7 +3208,7 @@
 gethostbyaddr()
 ; return 0; }
 EOF
-if { (eval echo configure:3211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3212: \"$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
@@ -4429,17 +4430,17 @@
 
     ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4433: checking for machine/builtins.h" >&5
+echo "configure:4434: checking for machine/builtins.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4438 "configure"
+#line 4439 "configure"
 #include "confdefs.h"
 #include <machine/builtins.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4443: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4444: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4837,12 +4838,12 @@
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4841: checking for dlopen" >&5
+echo "configure:4842: 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 4846 "configure"
+#line 4847 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
@@ -4865,7 +4866,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4870: \"$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
@@ -4884,7 +4885,7 @@
   echo "$ac_t""no" 1>&6
 
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4888: checking for dlopen in -ldl" >&5
+echo "configure:4889: 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
@@ -4892,7 +4893,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4896 "configure"
+#line 4897 "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
@@ -4903,7 +4904,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4908: \"$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
@@ -4931,13 +4932,13 @@
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:4935: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4936: 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 4941 "configure"
+#line 4942 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -4955,7 +4956,7 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 4959 "configure"
+#line 4960 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -4979,12 +4980,12 @@
 for ac_func in lchown strerror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4983: checking for $ac_func" >&5
+echo "configure:4984: 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 4988 "configure"
+#line 4989 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5007,7 +5008,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5012: \"$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
@@ -5045,7 +5046,7 @@
 
 
 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5049: checking for pthread_create in -lpthreads" >&5
+echo "configure:5050: checking for pthread_create in -lpthreads" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
@@ -5067,7 +5068,7 @@
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5071: checking for pthread_create in -lpthread" >&5
+echo "configure:5072: checking for pthread_create in -lpthread" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
@@ -5089,7 +5090,7 @@
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5093: checking for pthread_create in -lc_r" >&5
+echo "configure:5094: checking for pthread_create in -lc_r" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
@@ -5111,7 +5112,7 @@
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5115: checking for pthread_create in -lc" >&5
+echo "configure:5116: checking for pthread_create in -lc" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
@@ -5261,7 +5262,7 @@
       rm -f conftest*
    ac_cv_have_dash_pthread=no
    echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:5265: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5266: 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
@@ -5277,7 +5278,7 @@
 			    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:5281: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5282: 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
diff -Naur mozilla-orig/directory/c-sdk/configure.in mozilla/directory/c-sdk/configure.in
--- mozilla-orig/directory/c-sdk/configure.in	2004-09-14 21:14:38.000000000 +0000
+++ mozilla/directory/c-sdk/configure.in	2006-01-22 01:44:31.000000000 +0000
@@ -43,6 +43,7 @@
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
+NSPR_VERSION=4
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
@@ -213,29 +214,27 @@
 AC_ARG_WITH(system-nspr,
     [  --with-system-nspr   Use system installed NSPR],
     [   if test "$withval" = "yes"; then
-            _NO_NSPR=
+            _SYSTEM_NSPR=1
 	    else
-            _NO_NSPR=1
-	    fi])
+            _SYSTEM_NSPR=
+	    fi], _SYSTEM_NSPR= )
 
 if test "$_WIN32_MSVC"; then
-    _NO_NSPR=1
+    _SYSTEM_NSPR=
 fi
 	
-if test -z "$_NO_NSPR"; then
+if test -n "$_SYSTEM_NSPR"; then
     AM_PATH_NSPR(4.0.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
 fi
 
 if test -z "$MOZ_NATIVE_NSPR"; then
-    NSPR_CFLAGS='`$(NSDEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --cflags`'
+    NSPR_CFLAGS='-I$(DIST)/include/nspr'
+    NSPR_LIBS='-L$(DIST)/lib '"-lplds$NSPR_VERSION -lplc$NSPR_VERSION -lnspr$NSPR_VERSION"
     # explicitly set libs for Visual Age C++ for OS/2
     if test "$VACPP" = "yes"; then
         NSPR_LIBS='$(DIST)/lib/nspr'$NSPR_VERSION'.lib $(DIST)/lib/plc'$NSPR_VERSION'.lib $(DIST)/lib/plds'$NSPR_VERSION'.lib '$_PTHREAD_LDFLAGS''
     elif test "$_WIN32_MSVC"; then
             NSPR_LIBS='$(DIST)/lib/nspr'$NSPR_VERSION'.lib $(DIST)/lib/plc'$NSPR_VERSION'.lib $(DIST)/lib/plds'$NSPR_VERSION'.lib '
-            NSPR_CFLAGS='-I$(DIST)/include/nspr'
-    else
-        NSPR_LIBS='`$(NSDEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --libs`'
     fi
 fi
 
diff -Naur mozilla-orig/directory/c-sdk/ldap/include/Makefile.in mozilla/directory/c-sdk/ldap/include/Makefile.in
--- mozilla-orig/directory/c-sdk/ldap/include/Makefile.in	2002-04-24 23:03:25.000000000 +0000
+++ mozilla/directory/c-sdk/ldap/include/Makefile.in	2006-01-22 01:44:31.000000000 +0000
@@ -63,7 +63,6 @@
 
 INCLUDEDIR	= $(DIST)/public/ldap
 PRIVATEINCDIR	= $(DIST)/public/ldap-private
-NSPRINCDIR	= $(DIST)/public/ldap-nspr
 GENHEADERS	= $(addprefix $(INCLUDEDIR)/, $(GENERATED_HEADERS))
 
 GARBAGE		+= sdkver.h dirver.h $(GENHEADERS)
@@ -72,11 +71,8 @@
 
 all export::	$(INCLUDEDIR) $(GENHEADERS)
 	$(NSINSTALL) -D $(PRIVATEINCDIR)
-	$(NSINSTALL) -D $(NSPRINCDIR)
 	$(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
 	$(INSTALL) $(INSTALLFLAGS) -m 644 $(PRIVATEHEADERS) $(PRIVATEINCDIR)
-	rm -rf $(NSPRINCDIR)/*
-	cp -r $(DIST)/$(OBJDIR_NAME)/include/nspr/* $(NSPRINCDIR)
 
 $(INCLUDEDIR):	FORCE
 	$(NSINSTALL) -D $(INCLUDEDIR)
diff -Naur mozilla-orig/directory/c-sdk/ldap/libraries/libprldap/Makefile.in mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in
--- mozilla-orig/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2004-03-10 18:47:26.000000000 +0000
+++ mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2006-01-22 01:44:31.000000000 +0000
@@ -56,9 +56,9 @@
 
 GARBAGE 	+= $(LIBPRLDAP) $(DLLPRLDAP)
 
-LOCAL_INCLUDES  = -I$(PUBLIC)/nspr
+LOCAL_INCLUDES  = 
 INCLUDES	+= -I$(DISTHDIR) -I$(HDIR) -I$(INSTALLDIR)/include \
-                   -I$(DIST)/include/nspr
+		   $(NSPR_CFLAGS)
 DEFINES		+= $(DEFS)
 
 PLATFORMCFLAGS	= -DUSE_WAITPID -DNEEDPROTOS
diff -Naur mozilla-orig/security/manager/Makefile.in mozilla/security/manager/Makefile.in
--- mozilla-orig/security/manager/Makefile.in	2004-03-23 04:15:56.000000000 +0000
+++ mozilla/security/manager/Makefile.in	2006-01-22 01:41:26.000000000 +0000
@@ -30,6 +30,8 @@
 MODULE = psm
 
 PACKAGE_FILE = psm.pkg
+
+ifndef MOZ_NATIVE_NSS
 PACKAGE_VARS += \
 	NSS3_LIB \
 	SMIME3_LIB \
@@ -41,6 +43,7 @@
 	$(NULL)
 
 LOADABLE_ROOT_MODULE = $(DLL_PREFIX)nssckbi$(DLL_SUFFIX)
+endif
 
 NSS3_LIB = $(DLL_PREFIX)nss3$(DLL_SUFFIX)
 SMIME3_LIB = $(DLL_PREFIX)smime3$(DLL_SUFFIX)
@@ -123,6 +126,7 @@
 export:: .nss.cleaned
 
 .nss.cleaned: .nss.checkout
+ifndef MOZ_NATIVE_NSS
 	$(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS) clean
 	$(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) clean
 ifndef SKIP_CHK
@@ -130,9 +134,12 @@
 	$(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) clean
 endif
 	touch $@
+endif
 
 .nss.checkout:
+ifndef MOZ_NATIVE_NSS
 	touch $(srcdir)/$@
+endif
 
 dependclean export packages chrome::
 	$(MAKE) -C boot $@
@@ -142,12 +149,15 @@
 endif
 
 libs::
+ifndef MOZ_NATIVE_NSS
 	$(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS)
+endif
 ifeq ($(OS_ARCH),WINNT)
 	cd $(DIST)/lib; cp -f $(LIB_PREFIX)dbm$(MOZ_BITS).$(LIB_SUFFIX) $(LIB_PREFIX)dbm.$(LIB_SUFFIX)
 else
 	cd $(DIST)/lib; cp -f $(LIB_PREFIX)mozdbm_s.$(LIB_SUFFIX) $(LIB_PREFIX)dbm.$(LIB_SUFFIX); $(RANLIB) $(LIB_PREFIX)dbm.$(LIB_SUFFIX)
 endif
+ifndef MOZ_NATIVE_NSS
 	$(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS)
 ifndef SKIP_CHK
 	$(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS)
@@ -185,6 +195,7 @@
 	$(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_HYBRID_MODULE) $(DIST)/bin
 endif
 endif
+endif
 	$(MAKE) -C boot $@
 	$(MAKE) -C ssl $@
 ifdef MOZ_XUL
@@ -192,6 +203,7 @@
 endif
 
 install::
+ifndef MOZ_NATIVE_NSS
 	$(SYSINSTALL) -m 755 $(DIST)/lib/$(LOADABLE_ROOT_MODULE) $(DESTDIR)$(mozappdir)
 ifndef SKIP_CHK
 	$(SYSINSTALL) -m 644 $(DIST)/lib/$(SOFTOKEN3_CHK) $(DESTDIR)$(mozappdir)
@@ -206,6 +218,7 @@
 	$(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_HYBRID_CHK) $(DESTDIR)$(mozappdir)
 	$(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_HYBRID_MODULE) $(DESTDIR)$(mozappdir)
 endif
+endif
 	$(MAKE) -C boot $@
 	$(MAKE) -C ssl $@
 ifdef MOZ_XUL
@@ -218,12 +231,14 @@
 ifdef MOZ_XUL
 	$(MAKE) -C pki $@
 endif
+ifndef MOZ_NATIVE_NSS
 	$(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS) clean
 	$(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) clean
 ifndef SKIP_CHK
 	$(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) clean
 	$(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) clean
 endif
+endif
 
 echo-requires-recursive::
 	$(MAKE) -C boot $@
diff -Naur mozilla-orig/security/manager/ssl/src/Makefile.in mozilla/security/manager/ssl/src/Makefile.in
--- mozilla-orig/security/manager/ssl/src/Makefile.in	2004-01-07 13:36:51.000000000 +0000
+++ mozilla/security/manager/ssl/src/Makefile.in	2006-01-22 01:41:26.000000000 +0000
@@ -116,8 +116,13 @@
 
 # Use local includes because they are inserted before INCLUDES
 # so that Mozilla's nss.h is used, not glibc's
+ifdef MOZ_NATIVE_NSS
+LOCAL_INCLUDES += $(NSS_CFLAGS) \
+                  $(NULL)
+else
 LOCAL_INCLUDES += -I$(DIST)/public/nss \
                   $(NULL)
+endif
 
 EXTRA_DSO_LDOPTS += \
 		$(MOZ_UNICHARUTIL_LIBS) \
diff -Naur mozilla-orig/security/manager/ssl/src/nsNSSComponent.cpp mozilla/security/manager/ssl/src/nsNSSComponent.cpp
--- mozilla-orig/security/manager/ssl/src/nsNSSComponent.cpp	2004-04-22 19:48:30.000000000 +0000
+++ mozilla/security/manager/ssl/src/nsNSSComponent.cpp	2006-01-22 01:41:26.000000000 +0000
@@ -264,14 +264,6 @@
   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::dtor finished\n"));
 }
 
-#ifdef XP_MAC
-#ifdef DEBUG
-#define LOADABLE_CERTS_MODULE NS_LITERAL_CSTRING("NSSckbiDebug.shlb")
-#else
-#define LOADABLE_CERTS_MODULE NS_LITERAL_CSTRING("NSSckbi.shlb")
-#endif /*DEBUG*/ 
-#endif /*XP_MAC*/
-
 static void setOCSPOptions(nsIPref * pref);
 
 NS_IMETHODIMP
@@ -405,40 +397,40 @@
 
     const char *possible_ckbi_locations[] = {
       NS_GRE_DIR,
-      NS_XPCOM_CURRENT_PROCESS_DIR
+      NS_XPCOM_CURRENT_PROCESS_DIR,
+      0
     };
-    
+
     for (size_t il = 0; il < sizeof(possible_ckbi_locations)/sizeof(const char*); ++il) {
       nsCOMPtr<nsILocalFile> mozFile;
-      directoryService->Get( possible_ckbi_locations[il],
-                             NS_GET_IID(nsILocalFile), 
-                             getter_AddRefs(mozFile));
+      char *fullModuleName = nsnull;
+
+      if (!possible_ckbi_locations[il])
+      {
+        fullModuleName = PR_GetLibraryName(nsnull, "nssckbi");
+      }
+      else
+      {
+        directoryService->Get( possible_ckbi_locations[il],
+                               NS_GET_IID(nsILocalFile), 
+                               getter_AddRefs(mozFile));
     
-      if (!mozFile) {
-        continue;
+        if (!mozFile) {
+          continue;
+        }
+
+        nsCAutoString processDir;
+        mozFile->GetNativePath(processDir);
+        fullModuleName = PR_GetLibraryName(processDir.get(), "nssckbi");
       }
 
-      char *fullModuleName = nsnull;
-#ifdef XP_MAC
-      nsCAutoString nativePath;
-      mozFile->AppendNative(NS_LITERAL_CSTRING("Essential Files"));
-      mozFile->AppendNative(LOADABLE_CERTS_MODULE);
-      mozFile->GetNativePath(nativePath);    
-      fullModuleName = (char *) nativePath.get();
-#else
-      nsCAutoString processDir;
-      mozFile->GetNativePath(processDir);
-      fullModuleName = PR_GetLibraryName(processDir.get(), "nssckbi");
-#endif
       /* If a module exists with the same name, delete it. */
       NS_ConvertUCS2toUTF8 modNameUTF8(modName);
       int modType;
       SECMOD_DeleteModule(NS_CONST_CAST(char*, modNameUTF8.get()), &modType);
       SECStatus rv_add = 
         SECMOD_AddNewModule(NS_CONST_CAST(char*, modNameUTF8.get()), fullModuleName, 0, 0);
-#ifndef XP_MAC
-      PR_Free(fullModuleName); // allocated by NSPR
-#endif
+      PR_FreeLibraryName(fullModuleName); // allocated by NSPR
       if (SECSuccess == rv_add) {
         // found a module, no need to try other directories
         break;
