summaryrefslogtreecommitdiff
path: root/nsprpub/config
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub/config')
-rw-r--r--nsprpub/config/Makefile.in124
-rw-r--r--nsprpub/config/autoconf.mk.in148
-rw-r--r--nsprpub/config/config.mk169
-rw-r--r--nsprpub/config/gcc_hidden.h6
-rw-r--r--nsprpub/config/libc_r.h126
-rw-r--r--nsprpub/config/make-system-wrappers.pl26
-rw-r--r--nsprpub/config/nfspwd.pl18
-rw-r--r--nsprpub/config/now.c41
-rw-r--r--nsprpub/config/nsinstall.c525
-rwxr-xr-xnsprpub/config/nspr-config.in147
-rw-r--r--nsprpub/config/nspr.m482
-rw-r--r--nsprpub/config/nspr.pc.in10
-rw-r--r--nsprpub/config/nsprincl.mk.in9
-rw-r--r--nsprpub/config/nsprincl.sh.in9
-rw-r--r--nsprpub/config/pathsub.h42
-rw-r--r--nsprpub/config/prdepend.h13
-rw-r--r--nsprpub/config/rules.mk527
-rw-r--r--nsprpub/config/system-headers172
18 files changed, 2194 insertions, 0 deletions
diff --git a/nsprpub/config/Makefile.in b/nsprpub/config/Makefile.in
new file mode 100644
index 0000000000..7062c5ca9c
--- /dev/null
+++ b/nsprpub/config/Makefile.in
@@ -0,0 +1,124 @@
+#! gmake
+#
+# 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/.
+
+MOD_DEPTH = ..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(MOD_DEPTH)/config/autoconf.mk
+
+# Indicate that this directory builds build tools.
+INTERNAL_TOOLS = 1
+
+# For sanity's sake, we compile nsinstall without the wrapped system
+# headers, so that we can use it to set up the wrapped system headers.
+VISIBILITY_FLAGS =
+
+# autoconf.mk must be deleted last (from the top-level directory)
+# because it is included by every makefile.
+DIST_GARBAGE = nsprincl.mk nsprincl.sh nspr-config nspr.pc
+
+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
+
+PLSRCS = nfspwd.pl
+endif
+
+ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH)))
+PROG_SUFFIX = .exe
+else
+PROG_SUFFIX =
+endif
+
+# Temporary workaround to disable the generation of
+# library build time because now.c uses the 'long long'
+# data type that's not available on some platforms.
+ifeq (,$(filter-out QNX SCOOS UNIXWARE,$(OS_ARCH)))
+DEFINES += -DOMIT_LIB_BUILD_TIME
+endif
+
+ifeq ($(OS_ARCH), IRIX)
+ ifeq ($(basename $(OS_RELEASE)),6)
+ ifndef NS_USE_GCC
+ ifeq ($(USE_N32),1)
+ XLDOPTS += -n32 -Wl,-woff,85
+ else
+ ifeq ($(USE_64),1)
+ XLDOPTS += -64
+ else
+ XLDOPTS += -32
+ endif
+ endif
+ endif
+ endif
+endif
+
+ifeq ($(OS_ARCH), HP-UX)
+ ifeq ($(USE_64),1)
+ XLDOPTS += +DD64
+ endif
+endif
+
+ifeq ($(OS_ARCH), OS2)
+XCFLAGS = $(OS_CFLAGS)
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
+
+ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
+TARGETS = $(PROGS)
+else
+ifeq (,$(filter-out SYMBIAN WINCE,$(OS_ARCH)))
+TARGETS = $(PROGS)
+else
+PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)
+TARGETS = $(PROGS) $(PLSRCS:.pl=)
+endif
+endif
+
+OUTOPTION = -o # end of the line
+ifeq (,$(filter-out WINNT WIN95 WINCE,$(OS_TARGET)))
+ifndef NS_USE_GCC
+OUTOPTION = -Fe
+endif
+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
+
+ifdef WRAP_SYSTEM_INCLUDES
+export::
+ if test ! -d system_wrappers; then mkdir system_wrappers; fi
+ $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers < $(srcdir)/system-headers
+ $(INSTALL) system_wrappers $(dist_includedir)
+endif
+
+$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
+ @$(MAKE_OBJDIR)
+ $(CC) $(XCFLAGS) $< $(LDFLAGS) $(XLDOPTS) $(OUTOPTION)$@
+
+install:: nspr.m4
+ $(NSINSTALL) -D $(DESTDIR)$(datadir)/aclocal
+ $(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(datadir)/aclocal
+
+install:: nspr.pc
+ $(NSINSTALL) -D $(DESTDIR)$(libdir)/pkgconfig
+ $(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(libdir)/pkgconfig
diff --git a/nsprpub/config/autoconf.mk.in b/nsprpub/config/autoconf.mk.in
new file mode 100644
index 0000000000..8c9a43aa1a
--- /dev/null
+++ b/nsprpub/config/autoconf.mk.in
@@ -0,0 +1,148 @@
+# -*- Mode: Makefile -*-
+# 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/.
+
+
+INCLUDED_AUTOCONF_MK = 1
+USE_AUTOCONF = 1
+@SHELL_OVERRIDE@
+MOZILLA_CLIENT = @MOZILLA_CLIENT@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+includedir = @includedir@
+libdir = @libdir@
+datarootdir = @datarootdir@
+datadir = @datadir@
+
+dist_prefix = @dist_prefix@
+dist_bindir = @dist_bindir@
+dist_includedir = @dist_includedir@
+dist_libdir = @dist_libdir@
+
+DIST = $(dist_prefix)
+
+RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
+OBJDIR_NAME = @OBJDIR_NAME@
+OBJDIR = @OBJDIR@
+# We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't
+# manually use it before config.mk inclusion
+OBJ_SUFFIX = $(error config/config.mk needs to be included before using OBJ_SUFFIX)
+_OBJ_SUFFIX = @OBJ_SUFFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+DLL_SUFFIX = @DLL_SUFFIX@
+ASM_SUFFIX = @ASM_SUFFIX@
+MOD_NAME = @NSPR_MODNAME@
+
+MOD_MAJOR_VERSION = @MOD_MAJOR_VERSION@
+MOD_MINOR_VERSION = @MOD_MINOR_VERSION@
+MOD_PATCH_VERSION = @MOD_PATCH_VERSION@
+
+LIBNSPR = @LIBNSPR@
+LIBPLC = @LIBPLC@
+
+CROSS_COMPILE = @CROSS_COMPILE@
+MOZ_OPTIMIZE = @MOZ_OPTIMIZE@
+MOZ_DEBUG = @MOZ_DEBUG@
+MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
+
+USE_CPLUS = @USE_CPLUS@
+USE_IPV6 = @USE_IPV6@
+USE_N32 = @USE_N32@
+USE_X32 = @USE_X32@
+USE_64 = @USE_64@
+ENABLE_STRIP = @ENABLE_STRIP@
+
+USE_PTHREADS = @USE_PTHREADS@
+USE_BTHREADS = @USE_BTHREADS@
+PTHREADS_USER = @USE_USER_PTHREADS@
+CLASSIC_NSPR = @USE_NSPR_THREADS@
+
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+CC = @CC@
+CCC = @CXX@
+NS_USE_GCC = @GNU_CC@
+GCC_USE_GNU_LD = @GCC_USE_GNU_LD@
+MSC_VER = @MSC_VER@
+AR = @AR@
+AR_FLAGS = @AR_FLAGS@
+LD = @LD@
+RANLIB = @RANLIB@
+PERL = @PERL@
+RC = @RC@
+RCFLAGS = @RCFLAGS@
+STRIP = @STRIP@
+NSINSTALL = @NSINSTALL@
+FILTER = @FILTER@
+IMPLIB = @IMPLIB@
+CYGWIN_WRAPPER = @CYGWIN_WRAPPER@
+MT = @MT@
+
+OS_CPPFLAGS = @CPPFLAGS@
+OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@ $(DSO_CFLAGS)
+OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@ $(DSO_CFLAGS)
+OS_LIBS = @OS_LIBS@
+OS_LDFLAGS = @LDFLAGS@
+OS_DLLFLAGS = @OS_DLLFLAGS@
+DLLFLAGS = @DLLFLAGS@
+EXEFLAGS = @EXEFLAGS@
+OPTIMIZER = @OPTIMIZER@
+
+PROFILE_GEN_CFLAGS = @PROFILE_GEN_CFLAGS@
+PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@
+PROFILE_USE_CFLAGS = @PROFILE_USE_CFLAGS@
+PROFILE_USE_LDFLAGS = @PROFILE_USE_LDFLAGS@
+
+MKSHLIB = @MKSHLIB@
+WRAP_LDFLAGS = @WRAP_LDFLAGS@
+DSO_CFLAGS = @DSO_CFLAGS@
+DSO_LDOPTS = @DSO_LDOPTS@
+
+RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYMBOLS@
+
+HOST_CC = @HOST_CC@
+HOST_CFLAGS = @HOST_CFLAGS@
+HOST_LDFLAGS = @HOST_LDFLAGS@
+
+DEFINES = @DEFINES@ @DEFS@
+
+MDCPUCFG_H = @MDCPUCFG_H@
+PR_MD_CSRCS = @PR_MD_CSRCS@
+PR_MD_ASFILES = @PR_MD_ASFILES@
+PR_MD_ARCH_DIR = @PR_MD_ARCH_DIR@
+CPU_ARCH = @CPU_ARCH@
+
+OS_TARGET = @OS_TARGET@
+OS_ARCH = @OS_ARCH@
+OS_RELEASE = @OS_RELEASE@
+OS_TEST = @OS_TEST@
+
+NOSUCHFILE = @NOSUCHFILE@
+AIX_LINK_OPTS = @AIX_LINK_OPTS@
+MOZ_OBJFORMAT = @MOZ_OBJFORMAT@
+ULTRASPARC_LIBRARY = @ULTRASPARC_LIBRARY@
+
+OBJECT_MODE = @OBJECT_MODE@
+ifdef OBJECT_MODE
+export OBJECT_MODE
+endif
+
+VISIBILITY_FLAGS = @VISIBILITY_FLAGS@
+WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@
+
+MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
+ifdef MACOSX_DEPLOYMENT_TARGET
+export MACOSX_DEPLOYMENT_TARGET
+endif
+
+MACOS_SDK_DIR = @MACOS_SDK_DIR@
+
+SYMBIAN_SDK_DIR = @SYMBIAN_SDK_DIR@
+
+NEXT_ROOT = @NEXT_ROOT@
+ifdef NEXT_ROOT
+export NEXT_ROOT
+endif
diff --git a/nsprpub/config/config.mk b/nsprpub/config/config.mk
new file mode 100644
index 0000000000..05db0761ab
--- /dev/null
+++ b/nsprpub/config/config.mk
@@ -0,0 +1,169 @@
+#! gmake
+#
+# 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/.
+
+# Configuration information for building in the NSPR source module
+
+# Define an include-at-most-once-flag
+NSPR_CONFIG_MK = 1
+
+#
+# The variable definitions in this file are inputs to NSPR's
+# build system. This file, if present, is included at the
+# beginning of config.mk.
+#
+# For example:
+#
+# MOZ_OPTIMIZE=1
+# USE_PTHREADS=1
+# NS_USE_GCC=
+#
+ifndef topsrcdir
+topsrcdir=$(MOD_DEPTH)
+endif
+
+ifndef srcdir
+srcdir=.
+endif
+
+NFSPWD = $(MOD_DEPTH)/config/nfspwd
+
+CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\
+ $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
+CCCFLAGS = $(VISIBILITY_FLAGS) $(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)
+NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
+ $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
+
+LDFLAGS = $(OS_LDFLAGS)
+
+# Enable profile-guided optimization
+ifndef NO_PROFILE_GUIDED_OPTIMIZE
+ifdef MOZ_PROFILE_GENERATE
+CFLAGS += $(PROFILE_GEN_CFLAGS)
+LDFLAGS += $(PROFILE_GEN_LDFLAGS)
+DLLFLAGS += $(PROFILE_GEN_LDFLAGS)
+ifeq (WINNT,$(OS_ARCH))
+AR_FLAGS += -LTCG
+endif
+endif # MOZ_PROFILE_GENERATE
+
+ifdef MOZ_PROFILE_USE
+CFLAGS += $(PROFILE_USE_CFLAGS)
+LDFLAGS += $(PROFILE_USE_LDFLAGS)
+DLLFLAGS += $(PROFILE_USE_LDFLAGS)
+ifeq (WINNT,$(OS_ARCH))
+AR_FLAGS += -LTCG
+endif
+endif # MOZ_PROFILE_USE
+endif # NO_PROFILE_GUIDED_OPTIMIZE
+
+define MAKE_OBJDIR
+if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
+endef
+
+LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS)
+
+ifeq ($(OS_ARCH),Darwin)
+PWD := $(shell pwd)
+endif
+
+ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
+INSTALL = $(NSINSTALL)
+else
+ifeq ($(NSDISTMODE),copy)
+# copy files, but preserve source mtime
+INSTALL = $(NSINSTALL) -t
+else
+ifeq ($(NSDISTMODE),absolute_symlink)
+# install using absolute symbolic links
+ifeq ($(OS_ARCH),Darwin)
+INSTALL = $(NSINSTALL) -L $(PWD)
+else
+INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
+endif
+else
+# install using relative symbolic links
+INSTALL = $(NSINSTALL) -R
+endif
+endif
+endif # (WINNT || OS2) && !CROSS_COMPILE
+
+DEPENDENCIES = $(OBJDIR)/.md
+
+ifdef BUILD_DEBUG_GC
+DEFINES += -DDEBUG_GC
+endif
+
+GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*)
+
+DIST_GARBAGE += Makefile
+
+####################################################################
+#
+# The NSPR-specific configuration
+#
+####################################################################
+
+DEFINES += -DFORCE_PR_LOG
+
+ifeq ($(_PR_NO_CLOCK_TIMER),1)
+DEFINES += -D_PR_NO_CLOCK_TIMER
+endif
+
+ifeq ($(USE_PTHREADS), 1)
+DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
+endif
+
+ifeq ($(PTHREADS_USER), 1)
+DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM
+endif
+
+ifeq ($(USE_IPV6),1)
+DEFINES += -D_PR_INET6
+endif
+
+ifeq ($(MOZ_UNICODE),1)
+DEFINES += -DMOZ_UNICODE
+endif
+
+####################################################################
+#
+# Configuration for the release process
+#
+####################################################################
+
+MDIST = /m/dist
+ifeq ($(OS_ARCH),WINNT)
+MDIST = //helium/dist
+MDIST_DOS = $(subst /,\\,$(MDIST))
+endif
+
+# RELEASE_DIR is ns/dist/<module name>
+
+RELEASE_DIR = $(MOD_DEPTH)/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
+
+# autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
+# this file
+OBJ_SUFFIX := $(_OBJ_SUFFIX)
+
+# PGO builds with GCC build objects with instrumentation in a first pass,
+# then objects optimized, without instrumentation, in a second pass. If
+# we overwrite the ojects from the first pass with those from the second,
+# we end up not getting instrumentation data for better optimization on
+# incremental builds. As a consequence, we use a different object suffix
+# for the first pass.
+ifdef MOZ_PROFILE_GENERATE
+ifdef NS_USE_GCC
+OBJ_SUFFIX := i_o
+endif
+endif
diff --git a/nsprpub/config/gcc_hidden.h b/nsprpub/config/gcc_hidden.h
new file mode 100644
index 0000000000..075e68c88b
--- /dev/null
+++ b/nsprpub/config/gcc_hidden.h
@@ -0,0 +1,6 @@
+/* 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/. */
+
+/* Begin all files as hidden visibility */
+#pragma GCC visibility push(hidden)
diff --git a/nsprpub/config/libc_r.h b/nsprpub/config/libc_r.h
new file mode 100644
index 0000000000..8f144e3558
--- /dev/null
+++ b/nsprpub/config/libc_r.h
@@ -0,0 +1,126 @@
+/* -*- 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/. */
+
+/* libc_r.h -- macros, defines, etc. to make using reentrant libc calls */
+/* a bit easier. This was initially done for AIX pthreads, */
+/* but should be usable for anyone... */
+
+/* Most of these use locally defined space instead of static library space. */
+/* Because of this, we use the _INIT_R to declare/allocate space (stack), */
+/* and the plain routines to actually do it..._WARNING_: avoid allocating */
+/* memory wherever possible. Memory allocation is fairly expensive, at */
+/* least on AIX...use arrays instead (which allocate from the stack.) */
+/* I know the names are a bit strange, but I wanted to be fairly certain */
+/* that we didn't have any namespace corruption...in general, the inits are */
+/* R_<name>_INIT_R(), and the actual calls are R_<name>_R(). */
+
+#ifndef _LIBC_R_H
+#define _LIBC_R_H
+
+/************/
+/* strtok */
+/************/
+#define R_STRTOK_INIT_R() \
+ char *r_strtok_r=NULL
+
+#define R_STRTOK_R(return,source,delim) \
+ return=strtok_r(source,delim,&r_strtok_r)
+
+#define R_STRTOK_NORET_R(source,delim) \
+ strtok_r(source,delim,&r_strtok_r)
+
+/**************/
+/* strerror */
+/**************/
+#define R_MAX_STRERROR_LEN_R 8192 /* Straight from limits.h */
+
+#define R_STRERROR_INIT_R() \
+ char r_strerror_r[R_MAX_STRERROR_LEN_R]
+
+#define R_STRERROR_R(val) \
+ strerror_r(val,r_strerror_r,R_MAX_STRERROR_LEN_R)
+
+/*****************/
+/* time things */
+/*****************/
+#define R_ASCTIME_INIT_R() \
+ char r_asctime_r[26]
+
+#define R_ASCTIME_R(val) \
+ asctime_r(val,r_asctime_r)
+
+#define R_CTIME_INIT_R() \
+ char r_ctime_r[26]
+
+#define R_CTIME_R(val) \
+ ctime_r(val,r_ctime_r)
+
+#define R_GMTIME_INIT_R() \
+ struct tm r_gmtime_r
+
+#define R_GMTIME_R(time) \
+ gmtime_r(time,&r_gmtime_r)
+
+#define R_LOCALTIME_INIT_R() \
+ struct tm r_localtime_r
+
+#define R_LOCALTIME_R(val) \
+ localtime_r(val,&r_localtime_r)
+
+/***********/
+/* crypt */
+/***********/
+#include <crypt.h>
+#define R_CRYPT_INIT_R() \
+ CRYPTD r_cryptd_r; \
+ bzero(&r_cryptd_r,sizeof(CRYPTD))
+
+#define R_CRYPT_R(pass,salt) \
+ crypt_r(pass,salt,&r_cryptd_r)
+
+/**************/
+/* pw stuff */
+/**************/
+#define R_MAX_PW_LEN_R 1024
+/* The following must be after the last declaration, but */
+/* before the first bit of code... */
+#define R_GETPWNAM_INIT_R(pw_ptr) \
+ struct passwd r_getpwnam_pw_r; \
+ char r_getpwnam_line_r[R_MAX_PW_LEN_R]; \
+ pw_ptr = &r_getpwnam_pw_r
+
+#define R_GETPWNAM_R(name) \
+ getpwnam_r(name,&r_getpwnam_pw_r,r_getpwnam_line_r,R_MAX_PW_LEN_R)
+
+/*******************/
+/* gethost stuff */
+/*******************/
+#define R_GETHOSTBYADDR_INIT_R() \
+ struct hostent r_gethostbyaddr_r; \
+ struct hostent_data r_gethostbyaddr_data_r
+
+#define R_GETHOSTBYADDR_R(addr,len,type,xptr_ent) \
+ bzero(&r_gethostbyaddr_r,sizeof(struct hostent)); \
+ bzero(&r_gethostbyaddr_data_r,sizeof(struct hostent_data)); \
+ xptr_ent = &r_gethostbyaddr_r; \
+ if (gethostbyaddr_r(addr,len,type, \
+ &r_gethostbyaddr_r,&r_gethostbyaddr_data_r) == -1) { \
+ xptr_ent = NULL; \
+ }
+
+#define R_GETHOSTBYNAME_INIT_R() \
+ struct hostent r_gethostbyname_r; \
+ struct hostent_data r_gethostbyname_data_r
+
+#define R_GETHOSTBYNAME_R(name,xptr_ent) \
+ bzero(&r_gethostbyname_r,sizeof(struct hostent)); \
+ bzero(&r_gethostbyname_data_r,sizeof(struct hostent_data)); \
+ xptr_ent = &r_gethostbyname_r; \
+ if (gethostbyname_r(name, \
+ &r_gethostbyname_r,&r_gethostbyname_data_r) == -1) { \
+ xptr_ent = NULL; \
+ }
+
+#endif /* _LIBC_R_H */
diff --git a/nsprpub/config/make-system-wrappers.pl b/nsprpub/config/make-system-wrappers.pl
new file mode 100644
index 0000000000..fa0873a78e
--- /dev/null
+++ b/nsprpub/config/make-system-wrappers.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+#
+# 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/.
+
+$output_dir = shift;
+
+while (<STDIN>) {
+ chomp;
+ if (-e "$output_dir/$_") {
+ next;
+ }
+
+ if (/(.*)\/[^\/*]/) {
+ mkdir "$output_dir/$1";
+ }
+
+ open OUT, ">$output_dir/$_";
+ print OUT "#pragma GCC system_header\n"; # suppress include_next warning
+ print OUT "#pragma GCC visibility push(default)\n";
+ print OUT "#include_next \<$_\>\n";
+ print OUT "#pragma GCC visibility pop\n";
+ close OUT;
+}
+
diff --git a/nsprpub/config/nfspwd.pl b/nsprpub/config/nfspwd.pl
new file mode 100644
index 0000000000..1e66be3568
--- /dev/null
+++ b/nsprpub/config/nfspwd.pl
@@ -0,0 +1,18 @@
+#! perl
+#
+# 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/.
+
+require "fastcwd.pl";
+
+$_ = &fastcwd;
+if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) {
+ print("$_\n");
+} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o)
+ && readlink("/u/$user") eq "/usr/people/$user") {
+ print("/u/$user/$rest\n");
+} else {
+ chop($host = `hostname`);
+ print("/h/$host$_\n");
+}
diff --git a/nsprpub/config/now.c b/nsprpub/config/now.c
new file mode 100644
index 0000000000..2893c5b7a1
--- /dev/null
+++ b/nsprpub/config/now.c
@@ -0,0 +1,41 @@
+/* -*- 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/. */
+
+#include <stdio.h>
+#include <time.h>
+
+int main(int argc, char **argv)
+{
+#if defined(OMIT_LIB_BUILD_TIME)
+ /*
+ * Some platforms don't have any 64-bit integer type
+ * such as 'long long'. Because we can't use NSPR's
+ * PR_snprintf in this program, it is difficult to
+ * print a static initializer for PRInt64 (a struct).
+ * So we print nothing. The makefiles that build the
+ * shared libraries will detect the empty output string
+ * of this program and omit the library build time
+ * in PRVersionDescription.
+ */
+#elif defined(_MSC_VER)
+ __int64 now;
+ time_t sec;
+
+ sec = time(NULL);
+ now = (1000000i64) * sec;
+ fprintf(stdout, "%I64d", now);
+#else
+ long long now;
+ time_t sec;
+
+ sec = time(NULL);
+ now = (1000000LL) * sec;
+ fprintf(stdout, "%lld", now);
+#endif
+
+ return 0;
+} /* main */
+
+/* now.c */
diff --git a/nsprpub/config/nsinstall.c b/nsprpub/config/nsinstall.c
new file mode 100644
index 0000000000..f1d2cff26d
--- /dev/null
+++ b/nsprpub/config/nsinstall.c
@@ -0,0 +1,525 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+/*
+** Netscape portable install command.
+**
+** Brendan Eich, 7/20/95
+*/
+#include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */
+#include <assert.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utime.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <errno.h>
+#include <stdarg.h>
+#ifdef USE_REENTRANT_LIBC
+#include "libc_r.h"
+#endif /* USE_REENTRANT_LIBC */
+
+#include "pathsub.h"
+
+#define HAVE_FCHMOD
+
+#if defined(BEOS)
+#undef HAVE_FCHMOD
+#endif
+
+/*
+ * Does getcwd() take NULL as the first argument and malloc
+ * the result buffer?
+ */
+#if !defined(DARWIN)
+#define GETCWD_CAN_MALLOC
+#endif
+
+#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
+#include <getopt.h>
+#endif
+
+#if defined(SCO) || defined(UNIXWARE)
+#if !defined(S_ISLNK) && defined(S_IFLNK)
+#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
+#endif
+#endif
+
+#ifdef QNX
+#define d_ino d_stat.st_ino
+#endif
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
+ " %*s [-DdltR] file [file ...] directory\n",
+ program, (int)strlen(program), "");
+ exit(2);
+}
+
+static int
+mkdirs(char *path, mode_t mode)
+{
+ char *cp;
+ struct stat sb;
+ int res;
+
+ while (*path == '/' && path[1] == '/')
+ path++;
+ for (cp = strrchr(path, '/'); cp && cp != path && cp[-1] == '/'; cp--)
+ ;
+ if (cp && cp != path) {
+ *cp = '\0';
+ if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
+ mkdirs(path, mode) < 0) {
+ return -1;
+ }
+ *cp = '/';
+ }
+ res = mkdir(path, mode);
+ if ((res != 0) && (errno == EEXIST))
+ return 0;
+ else
+ return res;
+}
+
+static uid_t
+touid(char *owner)
+{
+ struct passwd *pw;
+ uid_t uid;
+ char *cp;
+
+ pw = getpwnam(owner);
+ if (pw)
+ return pw->pw_uid;
+ uid = strtol(owner, &cp, 0);
+ if (uid == 0 && cp == owner)
+ fail("cannot find uid for %s", owner);
+ return uid;
+}
+
+static gid_t
+togid(char *group)
+{
+ struct group *gr;
+ gid_t gid;
+ char *cp;
+
+ gr = getgrnam(group);
+ if (gr)
+ return gr->gr_gid;
+ gid = strtol(group, &cp, 0);
+ if (gid == 0 && cp == group)
+ fail("cannot find gid for %s", group);
+ return gid;
+}
+
+int
+main(int argc, char **argv)
+{
+ int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc;
+ mode_t mode = 0755;
+ char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, *bp, buf[BUFSIZ];
+ uid_t uid;
+ gid_t gid;
+ struct stat sb, tosb;
+ struct utimbuf utb;
+
+ program = argv[0];
+ cwd = linkname = linkprefix = owner = group = 0;
+ onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0;
+
+ while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
+ switch (opt) {
+ case 'C':
+ cwd = optarg;
+ break;
+ case 'D':
+ onlydir = 1;
+ break;
+ case 'd':
+ dodir = 1;
+ break;
+ case 'l':
+ dolink = 1;
+ break;
+ case 'L':
+ linkprefix = optarg;
+ lplen = strlen(linkprefix);
+ dolink = 1;
+ break;
+ case 'R':
+ dolink = dorelsymlink = 1;
+ break;
+ case 'm':
+ mode = strtoul(optarg, &cp, 8);
+ if (mode == 0 && cp == optarg)
+ usage();
+ break;
+ case 'o':
+ owner = optarg;
+ break;
+ case 'g':
+ group = optarg;
+ break;
+ case 't':
+ dotimes = 1;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ if (argc < 2 - onlydir)
+ usage();
+
+ todir = argv[argc-1];
+ if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
+ mkdirs(todir, 0777) < 0) {
+ fail("cannot make directory %s", todir);
+ }
+ if (onlydir)
+ return 0;
+
+ if (!cwd) {
+#ifdef GETCWD_CAN_MALLOC
+ cwd = getcwd(0, PATH_MAX);
+#else
+ cwd = malloc(PATH_MAX + 1);
+ cwd = getcwd(cwd, PATH_MAX);
+#endif
+ }
+ xchdir(todir);
+#ifdef GETCWD_CAN_MALLOC
+ todir = getcwd(0, PATH_MAX);
+#else
+ todir = malloc(PATH_MAX + 1);
+ todir = getcwd(todir, PATH_MAX);
+#endif
+ xchdir(cwd);
+ tdlen = strlen(todir);
+
+ uid = owner ? touid(owner) : -1;
+ gid = group ? togid(group) : -1;
+
+ while (--argc > 0) {
+ name = *argv++;
+ len = strlen(name);
+ base = xbasename(name);
+ bnlen = strlen(base);
+ toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
+ sprintf(toname, "%s/%s", todir, base);
+ exists = (lstat(toname, &tosb) == 0);
+
+ if (dodir) {
+ /* -d means create a directory, always */
+ if (exists && !S_ISDIR(tosb.st_mode)) {
+ (void) unlink(toname);
+ exists = 0;
+ }
+ if (!exists && mkdir(toname, mode) < 0)
+ fail("cannot make directory %s", toname);
+ if ((owner || group) && chown(toname, uid, gid) < 0)
+ fail("cannot change owner of %s", toname);
+ } else if (dolink) {
+ if (*name == '/') {
+ /* source is absolute pathname, link to it directly */
+ linkname = 0;
+ } else {
+ if (linkprefix) {
+ /* -L implies -l and prefixes names with a $cwd arg. */
+ len += lplen + 1;
+ linkname = (char*)xmalloc(len + 1);
+ sprintf(linkname, "%s/%s", linkprefix, name);
+ } else if (dorelsymlink) {
+ /* Symlink the relative path from todir to source name. */
+ linkname = (char*)xmalloc(PATH_MAX);
+
+ if (*todir == '/') {
+ /* todir is absolute: skip over common prefix. */
+ lplen = relatepaths(todir, cwd, linkname);
+ strcpy(linkname + lplen, name);
+ } else {
+ /* todir is named by a relative path: reverse it. */
+ reversepath(todir, name, len, linkname);
+ xchdir(cwd);
+ }
+
+ len = strlen(linkname);
+ }
+ name = linkname;
+ }
+
+ /* Check for a pre-existing symlink with identical content. */
+ if (exists &&
+ (!S_ISLNK(tosb.st_mode) ||
+ readlink(toname, buf, sizeof buf) != len ||
+ strncmp(buf, name, len) != 0)) {
+ (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
+ exists = 0;
+ }
+ if (!exists && symlink(name, toname) < 0)
+ fail("cannot make symbolic link %s", toname);
+#ifdef HAVE_LCHOWN
+ if ((owner || group) && lchown(toname, uid, gid) < 0)
+ fail("cannot change owner of %s", toname);
+#endif
+
+ if (linkname) {
+ free(linkname);
+ linkname = 0;
+ }
+ } else {
+ /* Copy from name to toname, which might be the same file. */
+ fromfd = open(name, O_RDONLY);
+ if (fromfd < 0 || fstat(fromfd, &sb) < 0)
+ fail("cannot access %s", name);
+ if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
+ (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
+ tofd = open(toname, O_CREAT | O_WRONLY, 0666);
+ if (tofd < 0)
+ fail("cannot create %s", toname);
+
+ bp = buf;
+ while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
+ while ((wc = write(tofd, bp, cc)) > 0) {
+ if ((cc -= wc) == 0)
+ break;
+ bp += wc;
+ }
+ if (wc < 0)
+ fail("cannot write to %s", toname);
+ }
+ if (cc < 0)
+ fail("cannot read from %s", name);
+
+ if (ftruncate(tofd, sb.st_size) < 0)
+ fail("cannot truncate %s", toname);
+ if (dotimes) {
+ utb.actime = sb.st_atime;
+ utb.modtime = sb.st_mtime;
+ if (utime(toname, &utb) < 0)
+ fail("cannot set times of %s", toname);
+ }
+#ifdef HAVE_FCHMOD
+ if (fchmod(tofd, mode) < 0)
+#else
+ if (chmod(toname, mode) < 0)
+#endif
+ fail("cannot change mode of %s", toname);
+ if ((owner || group) && fchown(tofd, uid, gid) < 0)
+ fail("cannot change owner of %s", toname);
+
+ /* Must check for delayed (NFS) write errors on close. */
+ if (close(tofd) < 0)
+ fail("cannot write to %s", toname);
+ close(fromfd);
+ }
+
+ free(toname);
+ }
+
+ free(cwd);
+ free(todir);
+ return 0;
+}
+
+/*
+** Pathname subroutines.
+**
+** Brendan Eich, 8/29/95
+*/
+
+char *program;
+
+void
+fail(char *format, ...)
+{
+ int error;
+ va_list ap;
+
+#ifdef USE_REENTRANT_LIBC
+ R_STRERROR_INIT_R();
+#endif
+
+ error = errno;
+ fprintf(stderr, "%s: ", program);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (error)
+
+#ifdef USE_REENTRANT_LIBC
+ R_STRERROR_R(errno);
+ fprintf(stderr, ": %s", r_strerror_r);
+#else
+ fprintf(stderr, ": %s", strerror(errno));
+#endif
+
+ putc('\n', stderr);
+ exit(1);
+}
+
+char *
+getcomponent(char *path, char *name)
+{
+ if (*path == '\0')
+ return 0;
+ if (*path == '/') {
+ *name++ = '/';
+ } else {
+ do {
+ *name++ = *path++;
+ } while (*path != '/' && *path != '\0');
+ }
+ *name = '\0';
+ while (*path == '/')
+ path++;
+ return path;
+}
+
+#ifdef UNIXWARE_READDIR_BUFFER_TOO_SMALL
+/* Sigh. The static buffer in Unixware's readdir is too small. */
+struct dirent * readdir(DIR *d)
+{
+ static struct dirent *buf = NULL;
+#define MAX_PATH_LEN 1024
+
+
+ if(buf == NULL)
+ buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN)
+;
+ return(readdir_r(d, buf));
+}
+#endif
+
+char *
+ino2name(ino_t ino, char *dir)
+{
+ DIR *dp;
+ struct dirent *ep;
+ char *name;
+
+ dp = opendir("..");
+ if (!dp)
+ fail("cannot read parent directory");
+ for (;;) {
+ if (!(ep = readdir(dp)))
+ fail("cannot find current directory");
+ if (ep->d_ino == ino)
+ break;
+ }
+ name = xstrdup(ep->d_name);
+ closedir(dp);
+ return name;
+}
+
+void *
+xmalloc(size_t size)
+{
+ void *p = malloc(size);
+ if (!p)
+ fail("cannot allocate %u bytes", size);
+ return p;
+}
+
+char *
+xstrdup(char *s)
+{
+ return strcpy((char*)xmalloc(strlen(s) + 1), s);
+}
+
+char *
+xbasename(char *path)
+{
+ char *cp;
+
+ while ((cp = strrchr(path, '/')) && cp[1] == '\0')
+ *cp = '\0';
+ if (!cp) return path;
+ return cp + 1;
+}
+
+void
+xchdir(char *dir)
+{
+ if (chdir(dir) < 0)
+ fail("cannot change directory to %s", dir);
+}
+
+int
+relatepaths(char *from, char *to, char *outpath)
+{
+ char *cp, *cp2;
+ int len;
+ char buf[NAME_MAX];
+
+ assert(*from == '/' && *to == '/');
+ for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
+ if (*cp == '\0')
+ break;
+ while (cp[-1] != '/')
+ cp--, cp2--;
+ if (cp - 1 == to) {
+ /* closest common ancestor is /, so use full pathname */
+ len = strlen(strcpy(outpath, to));
+ if (outpath[len] != '/') {
+ outpath[len++] = '/';
+ outpath[len] = '\0';
+ }
+ } else {
+ len = 0;
+ while ((cp2 = getcomponent(cp2, buf)) != 0) {
+ strcpy(outpath + len, "../");
+ len += 3;
+ }
+ while ((cp = getcomponent(cp, buf)) != 0) {
+ sprintf(outpath + len, "%s/", buf);
+ len += strlen(outpath + len);
+ }
+ }
+ return len;
+}
+
+void
+reversepath(char *inpath, char *name, int len, char *outpath)
+{
+ char *cp, *cp2;
+ char buf[NAME_MAX];
+ struct stat sb;
+
+ cp = strcpy(outpath + PATH_MAX - (len + 1), name);
+ cp2 = inpath;
+ while ((cp2 = getcomponent(cp2, buf)) != 0) {
+ if (strcmp(buf, ".") == 0)
+ continue;
+ if (strcmp(buf, "..") == 0) {
+ if (stat(".", &sb) < 0)
+ fail("cannot stat current directory");
+ name = ino2name(sb.st_ino, "..");
+ len = strlen(name);
+ cp -= len + 1;
+ strcpy(cp, name);
+ cp[len] = '/';
+ free(name);
+ xchdir("..");
+ } else {
+ cp -= 3;
+ strncpy(cp, "../", 3);
+ xchdir(buf);
+ }
+ }
+ strcpy(outpath, cp);
+}
diff --git a/nsprpub/config/nspr-config.in b/nsprpub/config/nspr-config.in
new file mode 100755
index 0000000000..2cb62a0f98
--- /dev/null
+++ b/nsprpub/config/nspr-config.in
@@ -0,0 +1,147 @@
+#!/bin/sh
+# 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/.
+
+
+prefix=@prefix@
+
+major_version=@MOD_MAJOR_VERSION@
+minor_version=@MOD_MINOR_VERSION@
+patch_version=@MOD_PATCH_VERSION@
+
+usage()
+{
+ cat <<EOF
+Usage: nspr-config [OPTIONS] [LIBRARIES]
+Options:
+ [--prefix[=DIR]]
+ [--exec-prefix[=DIR]]
+ [--includedir[=DIR]]
+ [--libdir[=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
+ ;;
+ --prefix)
+ echo_prefix=yes
+ ;;
+ --exec-prefix=*)
+ exec_prefix=$optarg
+ ;;
+ --exec-prefix)
+ echo_exec_prefix=yes
+ ;;
+ --includedir=*)
+ includedir=$optarg
+ ;;
+ --includedir)
+ echo_includedir=yes
+ ;;
+ --libdir=*)
+ libdir=$optarg
+ ;;
+ --libdir)
+ echo_libdir=yes
+ ;;
+ --version)
+ echo ${major_version}.${minor_version}.${patch_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
+
+# Set variables that may be dependent upon other variables
+if test -z "$exec_prefix"; then
+ exec_prefix=@exec_prefix@
+fi
+if test -z "$includedir"; then
+ includedir=@includedir@
+fi
+if test -z "$libdir"; then
+ libdir=@libdir@
+fi
+
+if test "$echo_prefix" = "yes"; then
+ echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+ echo $exec_prefix
+fi
+
+if test "$echo_includedir" = "yes"; then
+ echo $includedir
+fi
+
+if test "$echo_libdir" = "yes"; then
+ echo $libdir
+fi
+
+if test "$echo_cflags" = "yes"; then
+ echo -I$includedir
+fi
+
+if test "$echo_libs" = "yes"; then
+ libdirs=-L$libdir
+ 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
+ os_ldflags="@LDFLAGS@"
+ for i in $os_ldflags ; do
+ if echo $i | grep \^-L >/dev/null; then
+ libdirs="$libdirs $i"
+ fi
+ done
+ echo $libdirs @OS_LIBS@
+fi
+
diff --git a/nsprpub/config/nspr.m4 b/nsprpub/config/nspr.m4
new file mode 100644
index 0000000000..d21df69783
--- /dev/null
+++ b/nsprpub/config/nspr.m4
@@ -0,0 +1,82 @@
+# -*- 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)
+
+ 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`
+
+ 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/'`
+ min_nspr_major_version=`echo $min_nspr_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ min_nspr_minor_version=`echo $min_nspr_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ min_nspr_micro_version=`echo $min_nspr_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
+ no_nspr="yes"
+ elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
+ test "$nspr_config_minor_version" -lt "$min_nspr_minor_version"; then
+ no_nspr="yes"
+ elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
+ test "$nspr_config_minor_version" -eq "$min_nspr_minor_version" &&
+ test "$nspr_config_micro_version" -lt "$min_nspr_micro_version"; then
+ no_nspr="yes"
+ fi
+ 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)
+
+])
diff --git a/nsprpub/config/nspr.pc.in b/nsprpub/config/nspr.pc.in
new file mode 100644
index 0000000000..86300a0d57
--- /dev/null
+++ b/nsprpub/config/nspr.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: NSPR
+Description: The Netscape Portable Runtime
+Version: @MOD_MAJOR_VERSION@.@MOD_MINOR_VERSION@.@MOD_PATCH_VERSION@
+Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@
+Cflags: -I@includedir@
diff --git a/nsprpub/config/nsprincl.mk.in b/nsprpub/config/nsprincl.mk.in
new file mode 100644
index 0000000000..108ed34d12
--- /dev/null
+++ b/nsprpub/config/nsprincl.mk.in
@@ -0,0 +1,9 @@
+# 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 in Makefiles to define NSPR variables
+
+NSPR_VERSION = @NSPR_VERSION@
+NSPR_LIB = -lnspr@NSPR_VERSION@
+NSPR_EXTRA_LIBS = @EXTRA_LIBS@
diff --git a/nsprpub/config/nsprincl.sh.in b/nsprpub/config/nsprincl.sh.in
new file mode 100644
index 0000000000..8e7a427359
--- /dev/null
+++ b/nsprpub/config/nsprincl.sh.in
@@ -0,0 +1,9 @@
+# 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 in shell scripts to define NSPR variables
+
+NSPR_VERSION=@NSPR_VERSION@
+NSPR_LIB=-lnspr$NSPR_VERSION
+NSPR_EXTRA_LIBS="@EXTRA_LIBS@"
diff --git a/nsprpub/config/pathsub.h b/nsprpub/config/pathsub.h
new file mode 100644
index 0000000000..98b6c11242
--- /dev/null
+++ b/nsprpub/config/pathsub.h
@@ -0,0 +1,42 @@
+/* -*- 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 pathsub_h___
+#define pathsub_h___
+/*
+** Pathname subroutines.
+**
+** Brendan Eich, 8/29/95
+*/
+#include <limits.h>
+#include <sys/types.h>
+
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+/*
+ * Just prevent stupidity
+ */
+#undef NAME_MAX
+#define NAME_MAX 256
+
+extern char *program;
+
+extern void fail(char *format, ...);
+extern char *getcomponent(char *path, char *name);
+extern char *ino2name(ino_t ino, char *dir);
+extern void *xmalloc(size_t size);
+extern char *xstrdup(char *s);
+extern char *xbasename(char *path);
+extern void xchdir(char *dir);
+
+/* Relate absolute pathnames from and to returning the result in outpath. */
+extern int relatepaths(char *from, char *to, char *outpath);
+
+/* XXX changes current working directory -- caveat emptor */
+extern void reversepath(char *inpath, char *name, int len, char *outpath);
+
+#endif /* pathsub_h___ */
diff --git a/nsprpub/config/prdepend.h b/nsprpub/config/prdepend.h
new file mode 100644
index 0000000000..6c66b37ca0
--- /dev/null
+++ b/nsprpub/config/prdepend.h
@@ -0,0 +1,13 @@
+/* -*- 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/. */
+
+/*
+ * A dummy header file that is a dependency for all the object files.
+ * Used to force a full recompilation of NSPR in Mozilla's Tinderbox
+ * depend builds. See comments in rules.mk.
+ */
+
+#error "Do not include this header file."
+
diff --git a/nsprpub/config/rules.mk b/nsprpub/config/rules.mk
new file mode 100644
index 0000000000..1c8fdc9b8e
--- /dev/null
+++ b/nsprpub/config/rules.mk
@@ -0,0 +1,527 @@
+#! gmake
+#
+# 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/.
+
+################################################################################
+# We used to have a 4 pass build process. Now we do everything in one pass.
+#
+# export - Create generated headers and stubs. Publish public headers to
+# dist/<arch>/include.
+# Create libraries. Publish libraries to dist/<arch>/lib.
+# Create programs.
+#
+# libs - obsolete. Now a synonym of "export".
+#
+# all - the default makefile target. Now a synonym of "export".
+#
+# install - Install headers, libraries, and programs on the system.
+#
+# Parameters to this makefile (set these before including):
+#
+# a)
+# TARGETS -- the target to create
+# (defaults to $LIBRARY $PROGRAM)
+# b)
+# DIRS -- subdirectories for make to recurse on
+# (the 'all' rule builds $TARGETS $DIRS)
+# c)
+# CSRCS -- .c files to compile
+# (used to define $OBJS)
+# d)
+# PROGRAM -- the target program name to create from $OBJS
+# ($OBJDIR automatically prepended to it)
+# e)
+# LIBRARY -- the target library name to create from $OBJS
+# ($OBJDIR automatically prepended to it)
+#
+################################################################################
+
+ifndef topsrcdir
+topsrcdir=$(MOD_DEPTH)
+endif
+
+ifndef srcdir
+srcdir=.
+endif
+
+ifndef NSPR_CONFIG_MK
+include $(topsrcdir)/config/config.mk
+endif
+
+ifdef USE_AUTOCONF
+ifdef CROSS_COMPILE
+ifdef INTERNAL_TOOLS
+CC=$(HOST_CC)
+CCC=$(HOST_CXX)
+CFLAGS=$(HOST_CFLAGS)
+CXXFLAGS=$(HOST_CXXFLAGS)
+LDFLAGS=$(HOST_LDFLAGS)
+endif
+endif
+endif
+
+#
+# This makefile contains rules for building the following kinds of
+# libraries:
+# - LIBRARY: a static (archival) library
+# - SHARED_LIBRARY: a shared (dynamic link) library
+# - IMPORT_LIBRARY: an import library, used only on Windows and OS/2
+#
+# The names of these libraries can be generated by simply specifying
+# LIBRARY_NAME and LIBRARY_VERSION.
+#
+
+ifdef LIBRARY_NAME
+ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
+
+#
+# Win95 and OS/2 require library names conforming to the 8.3 rule.
+# other platforms do not.
+#
+ifeq (,$(filter-out WIN95 WINCE WINMO OS2,$(OS_TARGET)))
+SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
+SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
+ifdef MSC_VER
+LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+else
+LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+endif
+else
+SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
+SHARED_LIB_PDB = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
+LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+endif
+
+else
+
+LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
+SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a
+else
+ifdef MKSHLIB
+SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
+endif
+endif
+
+endif
+endif
+
+ifndef TARGETS
+ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
+TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
+ifdef MOZ_DEBUG_SYMBOLS
+ifdef MSC_VER
+ifneq (,$(filter-out 1100 1200,$(MSC_VER)))
+TARGETS += $(SHARED_LIB_PDB)
+endif
+endif
+endif
+else
+TARGETS = $(LIBRARY) $(SHARED_LIBRARY)
+endif
+endif
+
+#
+# OBJS is the list of object files. It can be constructed by
+# specifying CSRCS (list of C source files) and ASFILES (list
+# of assembly language source files).
+#
+
+ifndef OBJS
+OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
+ $(addprefix $(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
+endif
+
+ALL_TRASH = $(TARGETS) $(OBJS) $(RES) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
+ $(NOSUCHFILE) \
+ $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
+ so_locations
+
+ifndef RELEASE_LIBS_DEST
+RELEASE_LIBS_DEST = $(RELEASE_LIB_DIR)
+endif
+
+define MAKE_IN_DIR
+ $(MAKE) -C $(dir) $@
+
+endef # do not remove the blank line!
+
+ifdef DIRS
+LOOP_OVER_DIRS = $(foreach dir,$(DIRS),$(MAKE_IN_DIR))
+endif
+
+################################################################################
+
+all:: export
+
+export::
+ +$(LOOP_OVER_DIRS)
+
+libs:: export
+
+clean::
+ rm -rf $(OBJS) $(RES) so_locations $(NOSUCHFILE) $(GARBAGE)
+ +$(LOOP_OVER_DIRS)
+
+clobber::
+ rm -rf $(OBJS) $(RES) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE)
+ +$(LOOP_OVER_DIRS)
+
+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)
+
+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)/$(include_subdir)
+endif
+ifdef RELEASE_LIBS
+ $(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)/$(lib_subdir)
+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; \
+ fi
+ @if test ! -d $(RELEASE_BIN_DIR); then \
+ rm -rf $(RELEASE_BIN_DIR); \
+ $(NSINSTALL) -D $(RELEASE_BIN_DIR);\
+ else \
+ true; \
+ fi
+ cp $(RELEASE_BINS) $(RELEASE_BIN_DIR)
+endif
+ifdef RELEASE_LIBS
+ @echo "Copying libraries to release directory"
+ @if test -z "$(BUILD_NUMBER)"; then \
+ echo "BUILD_NUMBER must be defined"; \
+ false; \
+ else \
+ true; \
+ fi
+ @if test ! -d $(RELEASE_LIBS_DEST); then \
+ rm -rf $(RELEASE_LIBS_DEST); \
+ $(NSINSTALL) -D $(RELEASE_LIBS_DEST);\
+ else \
+ true; \
+ fi
+ cp $(RELEASE_LIBS) $(RELEASE_LIBS_DEST)
+endif
+ifdef RELEASE_HEADERS
+ @echo "Copying header files to release directory"
+ @if test -z "$(BUILD_NUMBER)"; then \
+ echo "BUILD_NUMBER must be defined"; \
+ false; \
+ else \
+ true; \
+ fi
+ @if test ! -d $(RELEASE_HEADERS_DEST); then \
+ rm -rf $(RELEASE_HEADERS_DEST); \
+ $(NSINSTALL) -D $(RELEASE_HEADERS_DEST);\
+ else \
+ true; \
+ fi
+ cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST)
+endif
+ +$(LOOP_OVER_DIRS)
+
+alltags:
+ rm -f TAGS tags
+ find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
+ find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
+
+$(NFSPWD):
+ cd $(@D); $(MAKE) $(@F)
+
+$(PROGRAM): $(OBJS)
+ @$(MAKE_OBJDIR)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ifdef MOZ_PROFILE_USE
+# In the second pass, we need to merge the pgc files into the pgd file.
+# The compiler would do this for us automatically if they were in the right
+# place, but they're in dist/bin.
+ python $(topsrcdir)/build/win32/pgomerge.py \
+ $(notdir $(PROGRAM:.exe=)) $(DIST)/bin
+endif # MOZ_PROFILE_USE
+ $(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
+ifdef MT
+ @if test -f $@.manifest; then \
+ $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ rm -f $@.manifest; \
+ fi
+endif # MSVC with manifest tool
+ifdef MOZ_PROFILE_GENERATE
+# touch it a few seconds into the future to work around FAT's
+# 2-second granularity
+ touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
+endif # MOZ_PROFILE_GENERATE
+else # WINNT && !GCC
+ $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(WRAP_LDFLAGS)
+endif # WINNT && !GCC
+ifdef ENABLE_STRIP
+ $(STRIP) $@
+endif
+
+$(LIBRARY): $(OBJS)
+ @$(MAKE_OBJDIR)
+ rm -f $@
+ $(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
+ $(RANLIB) $@
+
+ifeq ($(OS_TARGET), OS2)
+$(IMPORT_LIBRARY): $(MAPFILE)
+ rm -f $@
+ $(IMPLIB) $@ $(MAPFILE)
+else
+ifeq (,$(filter-out WIN95 WINCE WINMO,$(OS_TARGET)))
+# PDBs and import libraries need to depend on the shared library to
+# order dependencies properly.
+$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
+$(SHARED_LIB_PDB): $(SHARED_LIBRARY)
+endif
+endif
+
+$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE)
+ @$(MAKE_OBJDIR)
+ rm -f $@
+ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
+ echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
+ 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 ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ifdef MOZ_PROFILE_USE
+ python $(topsrcdir)/build/win32/pgomerge.py \
+ $(notdir $(SHARED_LIBRARY:.$(DLL_SUFFIX)=)) $(DIST)/bin
+endif # MOZ_PROFILE_USE
+ $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
+ifdef MT
+ @if test -f $@.manifest; then \
+ $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
+ rm -f $@.manifest; \
+ fi
+endif # MSVC with manifest tool
+ifdef MOZ_PROFILE_GENERATE
+ touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
+endif # MOZ_PROFILE_GENERATE
+else # WINNT && !GCC
+ $(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(WRAP_LDFLAGS) $(EXTRA_LIBS)
+endif # WINNT && !GCC
+endif # AIX 4.1
+ifdef ENABLE_STRIP
+ $(STRIP) $@
+endif
+
+################################################################################
+
+ifdef MOZ_PROFILE_USE
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+# When building with PGO, we have to make sure to re-link
+# in the MOZ_PROFILE_USE phase if we linked in the
+# MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
+# file in the link rule in the GENERATE phase to indicate
+# that we need a relink.
+$(SHARED_LIBRARY): pgo.relink
+
+$(PROGRAM): pgo.relink
+
+endif # WINNT && !GCC
+endif # MOZ_PROFILE_USE
+
+ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
+ifdef NS_USE_GCC
+# Force rebuilding libraries and programs in both passes because each
+# pass uses different object files.
+$(PROGRAM) $(SHARED_LIBRARY) $(LIBRARY): FORCE
+.PHONY: FORCE
+endif
+endif
+
+################################################################################
+
+ifdef MOZ_PROFILE_GENERATE
+# Clean up profiling data during PROFILE_GENERATE phase
+export::
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ $(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);)
+else
+ifdef NS_USE_GCC
+ -$(RM) *.gcda
+endif
+endif
+endif
+
+################################################################################
+
+ifeq ($(OS_ARCH),WINNT)
+$(RES): $(RESNAME)
+ @$(MAKE_OBJDIR)
+# The resource compiler does not understand the -U option.
+ifdef NS_USE_GCC
+ $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
+else
+ $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
+endif # GCC
+ @echo $(RES) finished
+endif
+
+$(MAPFILE): $(LIBRARY_NAME).def
+ @$(MAKE_OBJDIR)
+ifeq ($(OS_ARCH),SunOS)
+ grep -v ';-' $< | \
+ sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
+endif
+ifeq ($(OS_ARCH),OS2)
+ echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@
+ echo PROTMODE >> $@
+ echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
+ echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
+ echo EXPORTS >> $@
+ grep -v ';+' $< | grep -v ';-' | \
+ sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \
+ awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}' >> $@
+ $(ADD_TO_DEF_FILE)
+endif
+
+#
+# Translate source filenames to absolute paths. This is required for
+# debuggers under Windows and OS/2 to find source files automatically.
+#
+
+ifeq (,$(filter-out AIX OS2,$(OS_ARCH)))
+NEED_ABSOLUTE_PATH = 1
+endif
+
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+NEED_ABSOLUTE_PATH = 1
+endif
+
+ifdef NEED_ABSOLUTE_PATH
+# The quotes allow absolute paths to contain spaces.
+pr_abspath = "$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))"
+endif
+
+$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
+ @$(MAKE_OBJDIR)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ $(CCC) -Fo$@ -c $(CCCFLAGS) $(call pr_abspath,$<)
+else
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
+ $(CCC) -Fo$@ -c $(CCCFLAGS) $<
+else
+ifdef NEED_ABSOLUTE_PATH
+ $(CCC) -o $@ -c $(CCCFLAGS) $(call pr_abspath,$<)
+else
+ $(CCC) -o $@ -c $(CCCFLAGS) $<
+endif
+endif
+endif
+
+WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
+WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
+WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
+$(OBJDIR)/%.$(OBJ_SUFFIX): %.c
+ @$(MAKE_OBJDIR)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ $(CC) -Fo$@ -c $(CFLAGS) $(call pr_abspath,$<)
+else
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
+ $(CC) -Fo$@ -c $(CFLAGS) $<
+else
+ifdef NEED_ABSOLUTE_PATH
+ $(CC) -o $@ -c $(CFLAGS) $(call pr_abspath,$<)
+else
+ $(CC) -o $@ -c $(CFLAGS) $<
+endif
+endif
+endif
+
+
+$(OBJDIR)/%.$(OBJ_SUFFIX): %.s
+ @$(MAKE_OBJDIR)
+ $(AS) -o $@ $(ASFLAGS) -c $<
+
+%.i: %.c
+ $(CC) -C -E $(CFLAGS) $< > $*.i
+
+%: %.pl
+ rm -f $@; cp $< $@; chmod +x $@
+
+#
+# HACK ALERT
+#
+# The only purpose of this rule is to pass Mozilla's Tinderbox depend
+# builds (http://tinderbox.mozilla.org/showbuilds.cgi). Mozilla's
+# Tinderbox builds NSPR continuously as part of the Mozilla client.
+# Because NSPR's make depend is not implemented, whenever we change
+# an NSPR header file, the depend build does not recompile the NSPR
+# files that depend on the header.
+#
+# This rule makes all the objects depend on a dummy header file.
+# Touch this dummy header file to force the depend build to recompile
+# everything.
+#
+# This rule should be removed when make depend is implemented.
+#
+
+DUMMY_DEPEND_H = $(topsrcdir)/config/prdepend.h
+
+$(filter $(OBJDIR)/%.$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%.$(OBJ_SUFFIX): $(DUMMY_DEPEND_H)
+
+# END OF HACK
+
+################################################################################
+# Special gmake rules.
+################################################################################
+
+#
+# Disallow parallel builds with MSVC < 8 since it can't open the PDB file in
+# parallel.
+#
+ifeq (,$(filter-out 1200 1300 1310,$(MSC_VER)))
+.NOTPARALLEL:
+endif
+
+#
+# Re-define the list of default suffixes, so gmake won't have to churn through
+# hundreds of built-in suffix rules for stuff we don't need.
+#
+.SUFFIXES:
+.SUFFIXES: .a .$(OBJ_SUFFIX) .c .cpp .s .h .i .pl
+
+#
+# Fake targets. Always run these rules, even if a file/directory with that
+# name already exists.
+#
+.PHONY: all alltags clean export install libs realclean release
+
+#
+# List the target pattern of an implicit rule as a dependency of the
+# special target .PRECIOUS to preserve intermediate files made by
+# implicit rules whose target patterns match that file's name.
+# (See GNU Make documentation, Edition 0.51, May 1996, Sec. 10.4,
+# p. 107.)
+#
+.PRECIOUS: $(OBJDIR)/%.$(OBJ_SUFFIX)
diff --git a/nsprpub/config/system-headers b/nsprpub/config/system-headers
new file mode 100644
index 0000000000..cf0f11498f
--- /dev/null
+++ b/nsprpub/config/system-headers
@@ -0,0 +1,172 @@
+Aliases.h
+arpa/inet.h
+assert.h
+bsd/libc.h
+bsd/syscall.h
+bstring.h
+builtin.h
+c_asm.h
+cf.h
+CFBundle.h
+CFData.h
+CFDictionary.h
+CFString.h
+CFURL.h
+CodeFragments.h
+commdlg.h
+crt_externs.h
+crypt.h
+ctype.h
+descrip.h
+Devices.h
+direct.h
+dirent.h
+dlfcn.h
+dl.h
+DriverServices.h
+dvidef.h
+errno.h
+Errors.h
+Events.h
+fcntl.h
+fibdef.h
+files.h
+Files.h
+float.h
+Folders.h
+Gestalt.h
+getopt.h
+grp.h
+ia64/sys/inline.h
+ifaddrs.h
+image.h
+ints.h
+iodef.h
+io.h
+iostream.h
+kernel/OS.h
+lib$routines.h
+limits.h
+loader.h
+locale.h
+LowMem.h
+MacErrors.h
+machine/builtins.h
+machine/clock.h
+machine/endian.h
+machine/inline.h
+mach/mach_init.h
+mach/mach_host.h
+mach-o/dyld.h
+MacTypes.h
+Math64.h
+math.h
+mbstring.h
+memory.h
+MixedMode.h
+model.h
+mswsock.h
+Multiprocessing.h
+mutex.h
+netdb.h
+net/if.h
+netinet/in.h
+netinet/in_systm.h
+netinet/tcp.h
+OpenTptInternet.h
+OpenTransport.h
+os2.h
+OS.h
+osreldate.h
+OSUtils.h
+poll.h
+PPCToolbox.h
+Processes.h
+process.h
+pthread.h
+pwd.h
+QDOffscreen.h
+Resources.h
+rld_interface.h
+rpc/types.h
+semaphore.h
+setjmp.h
+share.h
+signal.h
+ssdef.h
+starlet.h
+stat.h
+stdarg.h
+stddef.h
+stdio.h
+stdlib.h
+string.h
+stropts.h
+stsdef.h
+support/SupportDefs.h
+support/TLS.h
+synch.h
+sys/atomic_op.h
+syscall.h
+sys/cfgodm.h
+sys/file.h
+sys/filio.h
+sys/immu.h
+sys/ioctl.h
+sys/ipc.h
+sys/ldr.h
+sys/locking.h
+sys/lwp.h
+sys/mman.h
+sys/mpctl.h
+sys/param.h
+sys/pda.h
+sys/poll.h
+sys/prctl.h
+sys/priv.h
+sys/procfs.h
+sys/pstat.h
+sys/regset.h
+sys/resource.h
+sys/sched.h
+sys/select.h
+sys/sem.h
+sys/sendfile.h
+sys/shm.h
+sys/socket.h
+sys/stack.h
+sys/stat.h
+sys/statvfs.h
+sys/syscall.h
+sys/sysctl.h
+sys/sysmp.h
+sys/syssgi.h
+sys/systeminfo.h
+sys/timeb.h
+sys/time.h
+sys/times.h
+sys/types.h
+sys/ucontext.h
+sys/uio.h
+sys/utsname.h
+sys/wait.h
+task.h
+TextUtils.h
+thread.h
+time.h
+Timer.h
+types.h
+Types.h
+ucontext.h
+ucx$inetdef.h
+ulocks.h
+unistd.h
+unix.h
+unixlib.h
+utime.h
+wchar.h
+winbase.h
+win/compobj.h
+windef.h
+windows.h
+winsock.h