bug 1230117 - Stop using NSPR's configure. r?glandium draft
authorTed Mielczarek <ted@mielczarek.org>
Thu, 21 Jan 2016 06:04:11 -0500
changeset 323767 e9258ef59051467488016a4ac8458588188d322e
parent 323763 fc04a1b489a4a2a1bfa0294b63e9128f58798bdd
child 323768 7b38c288bca9a41b9b2731c15b5afda0fea2a27b
push id9793
push usertmielczarek@mozilla.com
push dateThu, 21 Jan 2016 11:14:03 +0000
reviewersglandium
bugs1230117
milestone46.0a1
bug 1230117 - Stop using NSPR's configure. r?glandium
build/autoconf/nspr-build.m4
config/external/nspr/Makefile.in
config/external/nspr/_pl_bld.h
config/external/nspr/_pr_bld.h
config/external/nspr/ds/moz.build
config/external/nspr/libc/moz.build
config/external/nspr/moz.build
config/external/nspr/pr/moz.build
config/external/nspr/prcpucfg.h
config/external/nss/moz.build
configure.in
js/src/configure.in
--- a/build/autoconf/nspr-build.m4
+++ b/build/autoconf/nspr-build.m4
@@ -28,17 +28,17 @@ MOZ_ARG_WITH_STRING(nspr-cflags,
     NSPR_CFLAGS=$withval)
 MOZ_ARG_WITH_STRING(nspr-libs,
 [  --with-nspr-libs=LIBS   Pass LIBS to LD when linking code that uses NSPR.
                           See --with-nspr-cflags for more details.],
     NSPR_LIBS=$withval)
 
 ifdef([CONFIGURING_JS],[
     MOZ_ARG_ENABLE_BOOL(nspr-build,
-[  --enable-nspr-build     Configure and build NSPR from source tree],
+[  --enable-nspr-build     Build NSPR from source tree],
         MOZ_BUILD_NSPR=1,
         MOZ_BUILD_NSPR=)
 ])
 
 if test -z "$BUILDING_JS" || test -n "$JS_STANDALONE"; then
   _IS_OUTER_CONFIGURE=1
 fi
 
@@ -182,77 +182,8 @@ if test -n "$MOZ_NATIVE_NSPR"; then
                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
     CFLAGS=$_SAVE_CFLAGS
 fi
 AC_SUBST(NSPR_PKGCONF_CHECK)
 
 fi # _IS_OUTER_CONFIGURE
 
 ])
-
-AC_DEFUN([MOZ_SUBCONFIGURE_NSPR], [
-
-if test -z "$MOZ_NATIVE_NSPR"; then
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
-    if test -n "$MOZ_USING_CCACHE"; then
-        # Avoid double prepending ccache by omitting --with-ccache in building NSPR.
-        ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-ccache[[^ ]]*//'`"
-    fi
-
-    if test -z "$MOZ_DEBUG"; then
-        ac_configure_args="$ac_configure_args --disable-debug"
-    else
-        ac_configure_args="$ac_configure_args --enable-debug"
-        if test -n "$MOZ_NO_DEBUG_RTL"; then
-            ac_configure_args="$ac_configure_args --disable-debug-rtl"
-        fi
-    fi
-    if test "$MOZ_OPTIMIZE" = "1"; then
-        ac_configure_args="$ac_configure_args --enable-optimize"
-    elif test -z "$MOZ_OPTIMIZE"; then
-        ac_configure_args="$ac_configure_args --disable-optimize"
-    fi
-    if test -n "$HAVE_64BIT_BUILD"; then
-        ac_configure_args="$ac_configure_args --enable-64bit"
-    fi
-    if test -n "$USE_ARM_KUSER"; then
-        ac_configure_args="$ac_configure_args --with-arm-kuser"
-    fi
-    # A configure script generated by autoconf 2.68 does not allow the cached
-    # values of "precious" variables such as CFLAGS and LDFLAGS to differ from
-    # the values passed to the configure script. Since we modify CFLAGS and
-    # LDFLAGS before passing them to NSPR's configure script, we cannot share
-    # config.cache with NSPR. As a result, we cannot pass AS, CC, CXX, etc. to
-    # NSPR via a shared config.cache file and must pass them to NSPR on the
-    # configure command line.
-    for var in AS CC CXX CPP LD AR RANLIB STRIP; do
-        ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
-    done
-    # A configure script generated by autoconf 2.68 warns if --host is
-    # specified but --build isn't. So we always pass --build to NSPR's
-    # configure script.
-    ac_configure_args="$ac_configure_args --build=$build"
-    ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
-
-    # Save these, so we can mess with them for the subconfigure ..
-    _SAVE_CFLAGS="$CFLAGS"
-    _SAVE_CPPFLAGS="$CPPFLAGS"
-    _SAVE_LDFLAGS="$LDFLAGS"
-
-    if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
-      # dladdr is supported by the new linker, even when the system linker doesn't
-      # support it. Trick nspr into using dladdr when it's not supported.
-      export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
-    fi
-    export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
-    export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS $MOZ_FOLD_LIBS_FLAGS"
-
-    AC_OUTPUT_SUBDIRS(nsprpub)
-
-    # .. and restore them
-    CFLAGS="$_SAVE_CFLAGS"
-    CPPFLAGS="$_SAVE_CPPFLAGS"
-    LDFLAGS="$_SAVE_LDFLAGS"
-
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
-fi
-
-])
deleted file mode 100644
--- a/config/external/nspr/Makefile.in
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-include $(topsrcdir)/config/rules.mk
-
-ifdef MOZ_BUILD_NSPR
-
-# Copy NSPR to the SDK
-
-ifdef MOZ_FOLD_LIBS
-# Trick the nspr build system into not building shared libraries.
-# bug #851869.
-EXTRA_MAKE_FLAGS := SHARED_LIBRARY= IMPORT_LIBRARY= SHARED_LIB_PDB=
-
-# Work around libVersionPoint conflict between all three libraries.
-# See bug #838566.
-EXTRA_MAKE_FLAGS += XP_DEFINE=-DlibVersionPoint='libVersionPoint$$(LIBRARY_NAME)'
-else
-# nspr's make export compiles and links everything, but linking can't happen
-# during export on platforms where nspr is linked against mozcrt/mozglue.
-export:: EXTRA_MAKE_FLAGS += SHARED_LIBRARY= IMPORT_LIBRARY= SHARED_LIB_PDB=
-endif
-
-MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
-
-# The NSPR build system uses build-time generated dates for public API
-# exposed data structures. Use the buildid as forced date, to avoid
-# having to deal with what changing NSPR itself might mean.
-
-# SH_DATE is a date with the format "%Y-%m-%d %T"
-EXTRA_MAKE_FLAGS += SH_DATE="$(shell $(PYTHON) -c 'd = "$(MOZ_BUILDID)"; print d[0:4]+"-"+d[4:6]+"-"+d[6:8]+" "+d[8:10]+":"+d[10:12]+":"+d[12:14]')"
-
-# SH_NOW is a date as a unix timestamp in µseconds
-EXTRA_MAKE_FLAGS += SH_NOW="$(shell $(PYTHON) -c 'import time, calendar; print calendar.timegm(time.strptime("$(MOZ_BUILDID)", "%Y%m%d%H%M%S"))')000000"
-
-clean distclean export::
-	$(MAKE) -C $(DEPTH)/nsprpub $@ $(EXTRA_MAKE_FLAGS)
-
-target::
-# nspr's libs and install rule re-export headers, and that can race with other
-# compilations, so use a separate directory here. The headers are exported
-# during export anyways.
-	$(MAKE) -C $(DEPTH)/nsprpub libs $(EXTRA_MAKE_FLAGS) dist_includedir=$(ABS_DIST)/nspr-include
-	$(MAKE) -C $(DEPTH)/nsprpub install prefix=$(ABS_DIST)/sdk exec_prefix=$(ABS_DIST)/sdk bindir=$(ABS_DIST)/sdk/dummy includedir=$(ABS_DIST)/nspr-include libdir=$(ABS_DIST)/sdk/lib datadir=$(ABS_DIST)/sdk/dummy DESTDIR= $(EXTRA_MAKE_FLAGS)
-	$(INSTALL) $(DEPTH)/nsprpub/config/nspr-config $(DIST)/sdk/bin
-	$(RM) -rf $(DIST)/sdk/dummy
-ifneq (,$(filter WINNT,$(OS_ARCH))) # {
-	$(RM) -f $(DIST)/sdk/lib/$(DLL_PREFIX)nspr4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plc4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plds4$(DLL_SUFFIX)
-	$(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4_s.$(LIB_SUFFIX)
-else # } {
-	$(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4.$(LIB_SUFFIX)
-endif # }
-
-endif
new file mode 100644
--- /dev/null
+++ b/config/external/nspr/_pl_bld.h
@@ -0,0 +1,6 @@
+/*
+ * This file was previously generated at build time to set some preprocessor
+ * macros for use by plvrsion.c, but that file will set the values to (empty)
+ * defaults if they're not set, so this is just a stub to avoid having to
+ * generate another header file at build time.
+ */
new file mode 100644
--- /dev/null
+++ b/config/external/nspr/_pr_bld.h
@@ -0,0 +1,6 @@
+/*
+ * This file was previously generated at build time to set some preprocessor
+ * macros for use by prvrsion.c, but that file will set the values to (empty)
+ * defaults if they're not set, so this is just a stub to avoid having to
+ * generate another header file at build time.
+ */
new file mode 100644
--- /dev/null
+++ b/config/external/nspr/ds/moz.build
@@ -0,0 +1,34 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if CONFIG['MOZ_FOLD_LIBS']:
+    Library('plds4')
+else:
+    SharedLibrary('plds4')
+    SOURCES += ['/nsprpub/lib/ds/plvrsion.c']
+    USE_LIBS += ['nspr4']
+
+# We allow warnings for third-party code that can be updated from upstream.
+# TODO: fix NSPR warnings and remove this
+ALLOW_COMPILER_WARNINGS = True
+
+DEFINES['_NSPR_BUILD_'] = True
+
+LOCAL_INCLUDES += [
+    '/config/external/nspr',
+    '/nsprpub/pr/include',
+]
+
+EXPORTS.nspr += [
+    '/nsprpub/lib/ds/plarena.h',
+    '/nsprpub/lib/ds/plarenas.h',
+    '/nsprpub/lib/ds/plhash.h',
+]
+
+SOURCES += [
+    '/nsprpub/lib/ds/plarena.c',
+    '/nsprpub/lib/ds/plhash.c',
+]
new file mode 100644
--- /dev/null
+++ b/config/external/nspr/libc/moz.build
@@ -0,0 +1,45 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if CONFIG['MOZ_FOLD_LIBS']:
+    Library('plc4')
+else:
+    SharedLibrary('plc4')
+    SOURCES += ['/nsprpub/lib/libc/src/plvrsion.c']
+    USE_LIBS += ['nspr4']
+
+# We allow warnings for third-party code that can be updated from upstream.
+# TODO: fix NSPR warnings and remove this
+ALLOW_COMPILER_WARNINGS = True
+
+DEFINES['_NSPR_BUILD_'] = True
+
+LOCAL_INCLUDES += [
+    '/config/external/nspr',
+]
+
+EXPORTS.nspr += [
+    '/nsprpub/lib/libc/include/plbase64.h',
+    '/nsprpub/lib/libc/include/plerror.h',
+    '/nsprpub/lib/libc/include/plgetopt.h',
+    '/nsprpub/lib/libc/include/plstr.h',
+]
+
+SOURCES += [
+    '/nsprpub/lib/libc/src/base64.c',
+    '/nsprpub/lib/libc/src/plerror.c',
+    '/nsprpub/lib/libc/src/plgetopt.c',
+    '/nsprpub/lib/libc/src/strcase.c',
+    '/nsprpub/lib/libc/src/strcat.c',
+    '/nsprpub/lib/libc/src/strchr.c',
+    '/nsprpub/lib/libc/src/strcmp.c',
+    '/nsprpub/lib/libc/src/strcpy.c',
+    '/nsprpub/lib/libc/src/strdup.c',
+    '/nsprpub/lib/libc/src/strlen.c',
+    '/nsprpub/lib/libc/src/strpbrk.c',
+    '/nsprpub/lib/libc/src/strstr.c',
+    '/nsprpub/lib/libc/src/strtok.c',
+]
--- a/config/external/nspr/moz.build
+++ b/config/external/nspr/moz.build
@@ -1,21 +1,28 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 Library('nspr')
 
-if CONFIG['MOZ_FOLD_LIBS']:
-    # When folding libraries, nspr is actually in the nss library.
-    USE_LIBS += [
-        'nss',
+if CONFIG['MOZ_BUILD_NSPR']:
+    DIRS += [
+        'pr',
+        'ds',
+        'libc',
     ]
-elif CONFIG['MOZ_BUILD_NSPR']:
-    USE_LIBS += [
-        '/nsprpub/lib/ds/plds4',
-        '/nsprpub/lib/libc/src/plc4',
-        '/nsprpub/pr/src/nspr4',
-    ]
+    if CONFIG['MOZ_FOLD_LIBS']:
+        # When folding libraries, nspr is actually in the nss library.
+        USE_LIBS += [
+            'nss',
+        ]
+    else:
+        USE_LIBS += [
+            'nspr4',
+            'plc4',
+            'plds4',
+        ]
+    EXPORTS.nspr += ['prcpucfg.h']
 else:
     OS_LIBS += CONFIG['NSPR_LIBS']
new file mode 100644
--- /dev/null
+++ b/config/external/nspr/pr/moz.build
@@ -0,0 +1,221 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if CONFIG['MOZ_FOLD_LIBS']:
+    Library('nspr4')
+else:
+    SharedLibrary('nspr4')
+
+# We allow warnings for third-party code that can be updated from upstream.
+# TODO: fix NSPR warnings and remove this
+ALLOW_COMPILER_WARNINGS = True
+
+DEFINES['_NSPR_BUILD_'] = True
+if CONFIG['OS_ARCH'] == 'Linux':
+    OS_LIBS += CONFIG['REALTIME_LIBS']
+    DEFINES.update(
+        LINUX=True,
+        HAVE_FCNTL_FILE_LOCKING=True,
+        _GNU_SOURCE=True,
+    )
+    SOURCES += ['/nsprpub/pr/src/md/unix/linux.c']
+    if CONFIG['CPU_ARCH'] == 'x86_64':
+        SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_x86_64.s']
+    elif CONFIG['CPU_ARCH'] == 'x86':
+        DEFINES['i386'] = True
+        SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_x86.s']
+    elif CONFIG['CPU_ARCH'] == 'ppc':
+        SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_ppc.s']
+elif CONFIG['OS_TARGET'] == 'Darwin':
+    DEFINES.update(
+        DARWIN=True,
+        HAVE_BSD_FLOCK=True,
+        HAVE_SOCKLEN_T=True,
+    )
+    SOURCES += [
+        '/nsprpub/pr/src/md/unix/darwin.c',
+        '/nsprpub/pr/src/md/unix/os_Darwin.s',
+    ]
+    if not CONFIG['MOZ_IOS']:
+        DEFINES['HAVE_CRT_EXTERNS_H'] = True
+elif CONFIG['OS_TARGET'] == 'WINNT':
+    OS_LIBS += [
+        'advapi32',
+        'ws2_32',
+        'mswsock',
+        'winmm',
+    ]
+    DEFINES.update(
+        XP_PC=True,
+        WIN32=True,
+        # For historical reasons we use the WIN95 NSPR target instead of
+        # WINNT.
+        WIN95=True,
+        WINNT=False,
+        _PR_GLOBAL_THREADS_ONLY=True,
+    )
+    if CONFIG['CPU_ARCH'] == 'x86_64':
+        DEFINES['_AMD64_'] = True
+    else:
+        DEFINES['_X86_'] = True
+else:
+    error('Not a supported OS_TARGET for NSPR in moz.build: "%s". Use --with-system-nspr' % CONFIG['OS_TARGET'])
+
+
+LOCAL_INCLUDES += [
+    '/config/external/nspr',
+    '/nsprpub/pr/include',
+    '/nsprpub/pr/include/private',
+]
+
+SOURCES += [
+    '/nsprpub/pr/src/io/prfdcach.c',
+    '/nsprpub/pr/src/io/priometh.c',
+    '/nsprpub/pr/src/io/pripv6.c',
+    '/nsprpub/pr/src/io/prlayer.c',
+    '/nsprpub/pr/src/io/prlog.c',
+    '/nsprpub/pr/src/io/prmapopt.c',
+    '/nsprpub/pr/src/io/prmmap.c',
+    '/nsprpub/pr/src/io/prmwait.c',
+    '/nsprpub/pr/src/io/prpolevt.c',
+    '/nsprpub/pr/src/io/prprf.c',
+    '/nsprpub/pr/src/io/prscanf.c',
+    '/nsprpub/pr/src/io/prstdio.c',
+    '/nsprpub/pr/src/linking/prlink.c',
+    '/nsprpub/pr/src/malloc/prmalloc.c',
+    '/nsprpub/pr/src/malloc/prmem.c',
+    '/nsprpub/pr/src/md/prosdep.c',
+    '/nsprpub/pr/src/memory/prseg.c',
+    '/nsprpub/pr/src/memory/prshm.c',
+    '/nsprpub/pr/src/memory/prshma.c',
+    '/nsprpub/pr/src/misc/pralarm.c',
+    '/nsprpub/pr/src/misc/pratom.c',
+    '/nsprpub/pr/src/misc/praton.c',
+    '/nsprpub/pr/src/misc/prcountr.c',
+    '/nsprpub/pr/src/misc/prdtoa.c',
+    '/nsprpub/pr/src/misc/prenv.c',
+    '/nsprpub/pr/src/misc/prerr.c',
+    '/nsprpub/pr/src/misc/prerror.c',
+    '/nsprpub/pr/src/misc/prerrortable.c',
+    '/nsprpub/pr/src/misc/prinit.c',
+    '/nsprpub/pr/src/misc/prinrval.c',
+    '/nsprpub/pr/src/misc/pripc.c',
+    '/nsprpub/pr/src/misc/prlog2.c',
+    '/nsprpub/pr/src/misc/prlong.c',
+    '/nsprpub/pr/src/misc/prnetdb.c',
+    '/nsprpub/pr/src/misc/prolock.c',
+    '/nsprpub/pr/src/misc/prrng.c',
+    '/nsprpub/pr/src/misc/prsystem.c',
+    '/nsprpub/pr/src/misc/prthinfo.c',
+    '/nsprpub/pr/src/misc/prtime.c',
+    '/nsprpub/pr/src/misc/prtpool.c',
+    '/nsprpub/pr/src/misc/prtrace.c',
+    '/nsprpub/pr/src/threads/prcmon.c',
+    '/nsprpub/pr/src/threads/prrwlock.c',
+    '/nsprpub/pr/src/threads/prtpd.c',
+]
+
+if CONFIG['OS_TARGET'] != 'WINNT':
+    DEFINES['_PR_PTHREADS'] = True
+    SOURCES += [
+        '/nsprpub/pr/src/md/unix/unix.c',
+        '/nsprpub/pr/src/md/unix/unix_errors.c',
+        '/nsprpub/pr/src/md/unix/uxproces.c',
+        '/nsprpub/pr/src/md/unix/uxrng.c',
+        '/nsprpub/pr/src/md/unix/uxshm.c',
+        '/nsprpub/pr/src/md/unix/uxwrap.c',
+        '/nsprpub/pr/src/pthreads/ptio.c',
+        '/nsprpub/pr/src/pthreads/ptmisc.c',
+        '/nsprpub/pr/src/pthreads/ptsynch.c',
+        '/nsprpub/pr/src/pthreads/ptthread.c',
+    ]
+else:
+    SOURCES += [
+        '/nsprpub/pr/src/io/prdir.c',
+        '/nsprpub/pr/src/io/prfile.c',
+        '/nsprpub/pr/src/io/prio.c',
+        '/nsprpub/pr/src/io/prsocket.c',
+        '/nsprpub/pr/src/md/windows/ntgc.c',
+        '/nsprpub/pr/src/md/windows/ntinrval.c',
+        '/nsprpub/pr/src/md/windows/ntmisc.c',
+        '/nsprpub/pr/src/md/windows/ntsec.c',
+        '/nsprpub/pr/src/md/windows/ntsem.c',
+        '/nsprpub/pr/src/md/windows/w32ipcsem.c',
+        '/nsprpub/pr/src/md/windows/w32poll.c',
+        '/nsprpub/pr/src/md/windows/w32rng.c',
+        '/nsprpub/pr/src/md/windows/w32shm.c',
+        '/nsprpub/pr/src/md/windows/w95cv.c',
+        '/nsprpub/pr/src/md/windows/w95dllmain.c',
+        '/nsprpub/pr/src/md/windows/w95io.c',
+        '/nsprpub/pr/src/md/windows/w95sock.c',
+        '/nsprpub/pr/src/md/windows/w95thred.c',
+        '/nsprpub/pr/src/md/windows/win32_errors.c',
+        '/nsprpub/pr/src/misc/pripcsem.c',
+        '/nsprpub/pr/src/threads/combined/prucpu.c',
+        '/nsprpub/pr/src/threads/combined/prucv.c',
+        '/nsprpub/pr/src/threads/combined/prulock.c',
+        '/nsprpub/pr/src/threads/combined/prustack.c',
+        '/nsprpub/pr/src/threads/combined/pruthr.c',
+        '/nsprpub/pr/src/threads/prcthr.c',
+        '/nsprpub/pr/src/threads/prdump.c',
+        '/nsprpub/pr/src/threads/prmon.c',
+        '/nsprpub/pr/src/threads/prsem.c',
+    ]
+
+EXPORTS.nspr += [
+    '/nsprpub/pr/include/nspr.h',
+    '/nsprpub/pr/include/pratom.h',
+    '/nsprpub/pr/include/prbit.h',
+    '/nsprpub/pr/include/prclist.h',
+    '/nsprpub/pr/include/prcmon.h',
+    '/nsprpub/pr/include/prcountr.h',
+    '/nsprpub/pr/include/prcvar.h',
+    '/nsprpub/pr/include/prdtoa.h',
+    '/nsprpub/pr/include/prenv.h',
+    '/nsprpub/pr/include/prerr.h',
+    '/nsprpub/pr/include/prerror.h',
+    '/nsprpub/pr/include/prinet.h',
+    '/nsprpub/pr/include/prinit.h',
+    '/nsprpub/pr/include/prinrval.h',
+    '/nsprpub/pr/include/prio.h',
+    '/nsprpub/pr/include/pripcsem.h',
+    '/nsprpub/pr/include/prlink.h',
+    '/nsprpub/pr/include/prlock.h',
+    '/nsprpub/pr/include/prlog.h',
+    '/nsprpub/pr/include/prlong.h',
+    '/nsprpub/pr/include/prmem.h',
+    '/nsprpub/pr/include/prmon.h',
+    '/nsprpub/pr/include/prmwait.h',
+    '/nsprpub/pr/include/prnetdb.h',
+    '/nsprpub/pr/include/prolock.h',
+    '/nsprpub/pr/include/prpdce.h',
+    '/nsprpub/pr/include/prprf.h',
+    '/nsprpub/pr/include/prproces.h',
+    '/nsprpub/pr/include/prrng.h',
+    '/nsprpub/pr/include/prrwlock.h',
+    '/nsprpub/pr/include/prshm.h',
+    '/nsprpub/pr/include/prshma.h',
+    '/nsprpub/pr/include/prsystem.h',
+    '/nsprpub/pr/include/prthread.h',
+    '/nsprpub/pr/include/prtime.h',
+    '/nsprpub/pr/include/prtpool.h',
+    '/nsprpub/pr/include/prtrace.h',
+    '/nsprpub/pr/include/prtypes.h',
+    '/nsprpub/pr/include/prvrsion.h',
+    '/nsprpub/pr/include/prwin16.h',
+]
+
+EXPORTS.nspr.md += [
+    '/nsprpub/pr/include/md/_darwin.cfg',
+    '/nsprpub/pr/include/md/_linux.cfg',
+    '/nsprpub/pr/include/md/_win95.cfg',
+]
+
+EXPORTS.nspr.private += [
+    '/nsprpub/pr/include/private/pprio.h',
+    '/nsprpub/pr/include/private/pprthred.h',
+    '/nsprpub/pr/include/private/prpriv.h',
+]
new file mode 100644
--- /dev/null
+++ b/config/external/nspr/prcpucfg.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef NSPR_PRCPUCFG_H_
+#define NSPR_PRCPUCFG_H_
+
+/*
+ * Need to support conditionals that are defined in both the top-level build
+ * system as well as NSS' build system for now.
+ */
+#if defined(XP_DARWIN) || defined(DARWIN)
+#include "md/_darwin.cfg"
+#elif defined(XP_WIN) || defined(_WINDOWS)
+#include "md/_win95.cfg"
+#elif defined(__linux__)
+#include "md/_linux.cfg"
+#else
+#error "Unsupported platform!"
+#endif
+
+#endif /* NSPR_PRCPUCFG_H_ */
--- a/config/external/nss/moz.build
+++ b/config/external/nss/moz.build
@@ -11,27 +11,20 @@ if CONFIG['MOZ_NATIVE_NSS']:
     OS_LIBS += CONFIG['NSS_LIBS']
 elif CONFIG['MOZ_FOLD_LIBS']:
     GeckoSharedLibrary('nss', linkage=None)
     # TODO: The library name can be changed when bug 845217 is fixed.
     SHARED_LIBRARY_NAME = 'nss3'
 
     SDK_LIBRARY = True
 
-    # Normally, there should be /something/ to ensure nspr is built
-    # before this directory, but since nspr is built during "export",
-    # it actually doesn't matter.
-    if CONFIG['OS_TARGET'] == 'WINNT':
-        suffix = '_s'
-    else:
-        suffix = ''
     USE_LIBS += [
-        'static:/nsprpub/lib/ds/plds4%s' % suffix,
-        'static:/nsprpub/lib/libc/src/plc4%s' % suffix,
-        'static:/nsprpub/pr/src/nspr4%s' % suffix,
+        'nspr4',
+        'plc4',
+        'plds4',
     ]
 
     OS_LIBS += CONFIG['REALTIME_LIBS']
 
     SYMBOLS_FILE = 'nss.symbols'
 else:
     Library('nss')
     USE_LIBS += [
--- a/configure.in
+++ b/configure.in
@@ -2967,17 +2967,17 @@ then
     MOZ_CHECK_HEADERS(pthread.h)
 fi
 
 
 dnl Checks for library functions.
 dnl ========================================================
 AC_PROG_GCC_TRADITIONAL
 AC_FUNC_MEMCMP
-AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo)
+AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
 
 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
                ac_cv_clock_monotonic,
                [for libs in "" -lrt; do
                     _SAVE_LIBS="$LIBS"
                     LIBS="$LIBS $libs"
                     AC_TRY_LINK([#include <time.h>],
@@ -9158,18 +9158,16 @@ if test -n "$_subconfigure_subdir"; then
   ac_configure_args="$_save_ac_configure_args"
   srcdir="$_save_srcdir"
 fi
 
 if test "$COMPILE_ENVIRONMENT"; then
 
 export WRAP_LDFLAGS
 
-MOZ_SUBCONFIGURE_NSPR()
-
 dnl ========================================================
 dnl = Setup a nice relatively clean build environment for
 dnl = sub-configures.
 dnl ========================================================
 CC="$_SUBDIR_CC"
 CXX="$_SUBDIR_CXX"
 CFLAGS="$_SUBDIR_CFLAGS"
 CPPFLAGS="$_SUBDIR_CPPFLAGS"
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3837,19 +3837,16 @@ if test -n "$GNU_CC"; then
 JS_CONFIG_MOZ_JS_LIBS='-L${libdir} -l${JS_LIBRARY_NAME}'
 else
 JS_CONFIG_MOZ_JS_LIBS='${libdir}/${JS_LIBRARY_NAME}.lib'
 fi
 AC_SUBST(JS_LIBRARY_NAME)
 AC_SUBST(JS_CONFIG_MOZ_JS_LIBS)
 AC_SUBST(JS_CONFIG_LIBS)
 
-if test -n "$MOZ_BUILD_NSPR"; then
-    MOZ_SUBCONFIGURE_NSPR()
-fi
 MOZ_SUBCONFIGURE_FFI()
 MOZ_SUBCONFIGURE_JEMALLOC()
 
 # Avoid using obsolete NSPR features
 AC_DEFINE(NO_NSPR_10_SUPPORT)
 
 dnl Spit out some output
 dnl ========================================================