summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorcvsadm <cvsadm>2005-01-21 00:44:34 +0000
committercvsadm <cvsadm>2005-01-21 00:44:34 +0000
commitb2093e3016027d6b5cf06b3f91f30769bfc099e2 (patch)
treecf58939393a9032182c4fbc4441164a9456e82f8 /config
downloadds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.gz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.xz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.zip
Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)ldapserver7x
Diffstat (limited to 'config')
-rw-r--r--config/.cvsignore5
-rw-r--r--config/Linux2.4.mk58
-rw-r--r--config/Linux2.6.mk58
-rw-r--r--config/Makefile38
-rw-r--r--config/SunOS5.8.mk14
-rw-r--r--config/SunOS5.8_i86pc.mk14
-rw-r--r--config/SunOS5.9.mk14
-rw-r--r--config/UNIX.mk14
-rw-r--r--config/WINNT5.0.mk56
-rw-r--r--config/common.mn120
-rw-r--r--config/config.mk520
-rw-r--r--config/nfspwd.pl21
-rw-r--r--config/nsinstall.c305
-rw-r--r--config/pathsub.c206
-rw-r--r--config/pathsub.h46
-rw-r--r--config/revdepth-nt.pl19
-rw-r--r--config/revdepth.pl22
-rw-r--r--config/rules.mk707
-rw-r--r--config/webint.mk24
19 files changed, 2261 insertions, 0 deletions
diff --git a/config/.cvsignore b/config/.cvsignore
new file mode 100644
index 00000000..9a1527d0
--- /dev/null
+++ b/config/.cvsignore
@@ -0,0 +1,5 @@
+nfspwd
+nsinstall
+revdepth
+myconfig.mk
+myrules.mk
diff --git a/config/Linux2.4.mk b/config/Linux2.4.mk
new file mode 100644
index 00000000..fc0447b8
--- /dev/null
+++ b/config/Linux2.4.mk
@@ -0,0 +1,58 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Config stuff for Linux2.4
+#
+
+#include $(NSPRDEPTH)/config/UNIX.mk
+
+CC = gcc
+CCC = g++
+
+CPU_ARCH = x86
+GFX_ARCH = x
+
+RANLIB = ranlib
+
+ifdef SERVER_BUILD
+# see sun-java/config/config.mk
+STATIC_JAVA = yes
+endif
+
+NEED_XMOS = 1
+
+# fixme OS_CFLAGS = -m486 -ansi -Wall -pipe -MDupdate $(DEPENDENCIES)
+OS_CFLAGS = -m486 -ansi -Wall -pipe
+
+OS_CFLAGS += -DLINUX -DLINUX2_4 -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR -D_REENTRANT
+OS_LIBS = -L /lib -lc -ldl -lpthread
+
+ARCH = linux
+
+EN_LOCALE = C
+DE_LOCALE = de_DE.ISO8859-1
+FR_LOCALE = fr_FR.ISO8859-1
+JP_LOCALE = ja
+SJIS_LOCALE = ja_JP.SJIS
+KR_LOCALE = ko_KR.EUC
+CN_LOCALE = zh
+TW_LOCALE = zh
+I2_LOCALE = i2
+
+BUILD_UNIX_PLUGINS = 1
+
+ifeq ($(OS_RELEASE),2.4)
+OS_REL_CFLAGS += -DLINUX2_4
+MKSHLIB = $(LD) -shared
+endif
+
+XINC = /usr/X11R6/include
+INCLUDES += -I$(XINC)
+
+BSDECHO = echo
+
diff --git a/config/Linux2.6.mk b/config/Linux2.6.mk
new file mode 100644
index 00000000..fc0447b8
--- /dev/null
+++ b/config/Linux2.6.mk
@@ -0,0 +1,58 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Config stuff for Linux2.4
+#
+
+#include $(NSPRDEPTH)/config/UNIX.mk
+
+CC = gcc
+CCC = g++
+
+CPU_ARCH = x86
+GFX_ARCH = x
+
+RANLIB = ranlib
+
+ifdef SERVER_BUILD
+# see sun-java/config/config.mk
+STATIC_JAVA = yes
+endif
+
+NEED_XMOS = 1
+
+# fixme OS_CFLAGS = -m486 -ansi -Wall -pipe -MDupdate $(DEPENDENCIES)
+OS_CFLAGS = -m486 -ansi -Wall -pipe
+
+OS_CFLAGS += -DLINUX -DLINUX2_4 -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR -D_REENTRANT
+OS_LIBS = -L /lib -lc -ldl -lpthread
+
+ARCH = linux
+
+EN_LOCALE = C
+DE_LOCALE = de_DE.ISO8859-1
+FR_LOCALE = fr_FR.ISO8859-1
+JP_LOCALE = ja
+SJIS_LOCALE = ja_JP.SJIS
+KR_LOCALE = ko_KR.EUC
+CN_LOCALE = zh
+TW_LOCALE = zh
+I2_LOCALE = i2
+
+BUILD_UNIX_PLUGINS = 1
+
+ifeq ($(OS_RELEASE),2.4)
+OS_REL_CFLAGS += -DLINUX2_4
+MKSHLIB = $(LD) -shared
+endif
+
+XINC = /usr/X11R6/include
+INCLUDES += -I$(XINC)
+
+BSDECHO = echo
+
diff --git a/config/Makefile b/config/Makefile
new file mode 100644
index 00000000..a3326e44
--- /dev/null
+++ b/config/Makefile
@@ -0,0 +1,38 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#! gmake
+
+DEPTH = ..
+
+HSRCS = pathsub.h
+CSRCS = nsinstall.c pathsub.c
+
+PLSRCS = nfspwd.pl revdepth.pl
+
+ifneq ($(subst /,_,$(shell uname -s)),WINNT)
+PROGRAM = nsinstall
+OBJS = $(CSRCS:.c=.o)
+endif
+
+TARGETS = $(PROGRAM) $(PLSRCS:.pl=)
+
+# IMPORTANT: Disable NSBUILDROOT for this directory only, otherwise we have
+# a recursive rule for finding nsinstall and the perl scripts
+ifdef NSBUILDROOT
+override NSBUILDROOT :=
+endif
+
+include $(DEPTH)/config/rules.mk
+
+# Redefine MAKE_OBJDIR for just this directory
+define MAKE_OBJDIR
+if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
+endef
+
+export:: $(TARGETS)
+install:: $(TARGETS)
diff --git a/config/SunOS5.8.mk b/config/SunOS5.8.mk
new file mode 100644
index 00000000..5019c182
--- /dev/null
+++ b/config/SunOS5.8.mk
@@ -0,0 +1,14 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Config stuff for SunOS5.8
+#
+
+SOL_CFLAGS = -D_SVID_GETTOD -DSOLARIS_55_OR_GREATER
+
+include $(DEPTH)/config/SunOS5.mk
diff --git a/config/SunOS5.8_i86pc.mk b/config/SunOS5.8_i86pc.mk
new file mode 100644
index 00000000..5019c182
--- /dev/null
+++ b/config/SunOS5.8_i86pc.mk
@@ -0,0 +1,14 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Config stuff for SunOS5.8
+#
+
+SOL_CFLAGS = -D_SVID_GETTOD -DSOLARIS_55_OR_GREATER
+
+include $(DEPTH)/config/SunOS5.mk
diff --git a/config/SunOS5.9.mk b/config/SunOS5.9.mk
new file mode 100644
index 00000000..bff14749
--- /dev/null
+++ b/config/SunOS5.9.mk
@@ -0,0 +1,14 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Config stuff for SunOS5.9
+#
+
+SOL_CFLAGS = -D_SVID_GETTOD -DSOLARIS_55_OR_GREATER
+
+include $(DEPTH)/config/SunOS5.mk
diff --git a/config/UNIX.mk b/config/UNIX.mk
new file mode 100644
index 00000000..35d0c36e
--- /dev/null
+++ b/config/UNIX.mk
@@ -0,0 +1,14 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+# A small start on what nspr20/config did
+XP_DEFINE = -DXP_UNIX
+LIB_SUFFIX = a
+#
+DLL_SUFFIX = so
+AR = ar cr $@
+
diff --git a/config/WINNT5.0.mk b/config/WINNT5.0.mk
new file mode 100644
index 00000000..41c2cac6
--- /dev/null
+++ b/config/WINNT5.0.mk
@@ -0,0 +1,56 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Config stuff for WINNT 5.0
+#
+
+CC=cl
+CCC=cl
+LINK = link
+RANLIB = echo
+BSDECHO = echo
+
+OTHER_DIRT =
+GARBAGE = vc20.pdb
+
+ifdef DEBUG_RUNTIME
+RTLIBFLAGS:=-MDd
+else
+RTLIBFLAGS:=-MD
+endif
+
+PROCESSOR := $(shell uname -p)
+USE_KERNEL_THREADS=1
+_PR_USECPU=1
+ifeq ($(PROCESSOR), I386)
+CPU_ARCH = x386
+OS_CFLAGS = $(OPTIMIZER) -GT $(RTLIBFLAGS) -W3 -nologo -D_X86_ -Dx386 -D_WINDOWS -DWIN32 -DHW_THREADS
+else
+ifeq ($(PROCESSOR), MIPS)
+CPU_ARCH = MIPS
+#OS_CFLAGS = $(OPTIMIZER) $(RTLIBFLAGS) -W3 -nologo -D_MIPS_ -D_WINDOWS -DWIN32 -DHW_THREADS
+OS_CFLAGS = $(OPTIMIZER) $(RTLIBFLAGS) -W3 -nologo -D_WINDOWS -DWIN32 -DHW_THREADS
+else
+ifeq ($(PROCESSOR), ALPHA)
+CPU_ARCH = ALPHA
+OS_CFLAGS = $(OPTIMIZER) $(RTLIBFLAGS) -W3 -nologo -D_ALPHA_=1 -D_WINDOWS -DWIN32 -DHW_THREADS
+else
+CPU_ARCH = processor_is_undefined
+endif
+endif
+endif
+
+ifeq ($(SERVER_BUILD), 1)
+OS_CFLAGS += -DSERVER_BUILD
+endif
+
+OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWS -MAP -PDB:NONE
+OS_LFLAGS = -nologo -PDB:NONE -INCREMENT:NO -SUBSYSTEM:console
+OS_LIBS = kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib
+
+OS_DEFS= SERVER_BUILD=$(SERVER_BUILD) NSPR_VERSION=$(VERSION) NS_PRODUCT=$(NS_PRODUCT)
diff --git a/config/common.mn b/config/common.mn
new file mode 100644
index 00000000..daae3872
--- /dev/null
+++ b/config/common.mn
@@ -0,0 +1,120 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+######################################################################
+### Comon Manifest File
+### Cross-platform defines used on all platforms (in theory)
+######################################################################
+
+# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
+# Since the longest of these is 5 characters without the suffix,
+# be sure to not set VERSION_NUMBER to anything longer than 3
+# characters for Win16's sake.
+#
+# Also... If you change this value, there are several other places
+# you'll need to change (because they're not reached by this
+# variable):
+# sun-java/nsjava/nsjava32.def
+# sun-java/nsjava/nsjava16.def
+# sun-java/classsrc/sun/audio/AudioDevice.java
+# sun-java/classsrc/sun/awt/windows/WToolkit.java
+
+VERSION_NUMBER = 40
+
+ZIP_NAME = java_$(VERSION_NUMBER)
+JAR_NAME = java_$(VERSION_NUMBER).jar
+
+######################################################################
+### Cross-Platform Java Stuff
+######################################################################
+## java interpreter
+
+# get class files from the directory they are compiled to
+JAVA_CLASSPATH = $(JAVA_DESTPATH)
+
+JAVA_FLAGS = -classpath $(JAVA_CLASSPATH) -ms8m
+JAVA = $(JAVA_PROG) $(JAVA_FLAGS)
+
+JAVA_DEFINES = \
+ -DZIP_NAME=\"$(ZIP_NAME)\" \
+ -DJAR_NAME=\"$(JAR_NAME)\" \
+ -DJRTDLL=\"$(JRTDLL)\" \
+ -DMMDLL=\"$(MMDLL)\" \
+ -DAWTDLL=\"$(AWTDLL)\" \
+ -DJITDLL=\"$(JITDLL)\"
+
+######################################################################
+## javac
+
+# to run the compiler in the interpreter
+JAVAC_PROG = -ms8m -classpath $(JAVAC_ZIP) sun.tools.javac.Main
+JAVAC = $(JAVA_PROG) $(JAVAC_PROG) $(JAVAC_FLAGS)
+
+# std set of options passed to the compiler
+JAVAC_FLAGS = -classpath $(JAVAC_CLASSPATH) $(JAVA_OPTIMIZER) -d $(JAVA_DESTPATH)
+
+##
+## The canonical Java classpath is:
+## JAVA_DESTPATH, JAVA_SOURCEPATH, JAVA_LIBS
+##
+## appropriately delimited, in that order
+##
+JAVAC_CLASSPATH = $(JAVA_DESTPATH)$(PATH_SEPARATOR)$(JAVA_SOURCEPATH)
+
+######################################################################
+## javadoc
+
+# Rules to build java .html files from java source files
+
+JAVADOC_PROG = $(JAVA) sun.tools.javadoc.Main
+JAVADOC_FLAGS = -classpath $(JAVAC_CLASSPATH)
+JAVADOC = $(JAVADOC_PROG) $(JAVADOC_FLAGS)
+
+######################################################################
+## javah
+
+JAVAH_FLAGS = -classpath $(JAVA_CLASSPATH)
+JAVAH = $(JAVAH_PROG) $(JAVAH_FLAGS)
+
+######################################################################
+## jmc
+
+JMCSRCDIR = $(XPDIST)/_jmc
+JMC_PROG = $(JAVA) netscape.tools.jmc.Main
+JMC_CLASSPATH = $(JMCSRCDIR)$(PATH_SEPARATOR)$(JAVAC_CLASSPATH)
+JMC_FLAGS = -classpath $(JMC_CLASSPATH) -verbose
+JMC = $(JMC_PROG) $(JMC_FLAGS)
+
+######################################################################
+## zip
+
+ZIP = $(ZIP_PROG) $(ZIP_FLAGS)
+
+######################################################################
+## idl2java
+
+ORBTOOLS = $(DEPTH)/modules/iiop/tools/orbtools.zip
+ORB_CLASSPATH = $(ORBTOOLS)$(PATH_SEPARATOR)$(JAVA_CLASSPATH)
+
+IDL2JAVA_PROG = $(JAVA_PROG)
+IDL2JAVA_FLAGS = -classpath $(ORB_CLASSPATH) pomoco.tools.idl2java
+IDL2JAVA = $(IDL2JAVA_PROG) $(IDL2JAVA_FLAGS)
+
+######################################################################
+## lex and yacc
+
+JAVALEX_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) sbktech.tools.jax.driver
+JAVALEX_FLAGS =
+JAVALEX = $(JAVALEX_PROG) $(JAVALEX_FLAGS)
+
+JAVACUP_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) java_cup.Main
+JAVACUP_FLAGS =
+JAVACUP = $(JAVACUP_PROG) $(JAVACUP_FLAGS)
+
+######################################################################
+
+
diff --git a/config/config.mk b/config/config.mk
new file mode 100644
index 00000000..b962fae0
--- /dev/null
+++ b/config/config.mk
@@ -0,0 +1,520 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#! gmake
+
+include $(DEPTH)/config/common.mn
+
+#
+# Important internal static macros
+#
+OS_ARCH := $(subst /,_,$(shell uname -s))
+OS_TEST := $(shell uname -m)
+
+# Force the IRIX64 machines to use IRIX.
+ifeq ($(OS_ARCH),IRIX64)
+OS_ARCH := IRIX
+endif
+
+# Attempt to differentiate between SunOS 5.4 and x86 5.4
+ifeq ($(OS_TEST),i86pc)
+OS_RELEASE := $(shell uname -r)_$(OS_TEST)
+else
+OS_RELEASE := $(shell uname -r)
+endif
+
+ifeq ($(OS_ARCH),AIX)
+OS_RELEASE := $(shell uname -v).$(shell uname -r)
+endif
+
+# SINIX changes name to ReliantUNIX with 5.43
+ifeq ($(OS_ARCH),ReliantUNIX-N)
+OS_ARCH := ReliantUNIX
+OS_RELEASE := 5.4
+endif
+ifeq ($(OS_ARCH),SINIX-N)
+OS_ARCH := ReliantUNIX
+OS_RELEASE := 5.4
+endif
+
+# SVR5 (UnixWare[7])
+ifeq ($(OS_ARCH),UnixWare)
+# For now get the OS release for backward compatibility (UnixWare5)
+OS_RELEASE := $(shell uname -r)
+endif
+
+# Catch NCR butchering of SVR4
+ifeq ($(OS_ARCH),UNIX_SV)
+ifneq ($(findstring NCR, $(shell grep NCR /etc/bcheckrc | head -1 )),)
+OS_ARCH := NCR
+OS_RELEASE := $(shell uname -v)
+else # !NCR
+# Make UnixWare something human readable
+OS_ARCH := UNIXWARE
+# Check for UW2 using UDK, which looks like a Gemini (UnixWare[3,5,7]) build
+OS_RELEASE := $(shell $(DEPTH)/netsite/nsarch -f | sed 's/UnixWare //')
+ifeq ($(OS_RELEASE),5)
+OS_ARCH := UnixWare
+else # OS_RELEASE = 5
+# Get the OS release number, not 4.2
+OS_RELEASE := $(shell uname -v)
+ifeq ($(OS_RELEASE),2.1.2)
+OS_RELEASE := 2.1
+endif # OS_RELEASE = 2.1.2
+endif # OS_RELEASE = 5
+endif # !NCR
+endif # UNIX_SV
+
+
+ifeq ($(OS_ARCH),Linux)
+#
+# Handle FreeBSD 2.2-STABLE and Linux 2.0.30-osfmach3 and 2.2.14-5.0smp
+#
+ifeq (,$(filter-out Linux FreeBSD,$(NSOS_ARCH)))
+ OS_RELEASE := $(shell echo $(OS_RELEASE) | sed 's/-.*//')
+endif
+OS_RELEASE := $(basename $(OS_RELEASE))
+ ifeq (86,$(findstring 86,$(OS_TEST)))
+ CPU_TAG = _x86
+ else
+ CPU_TAG = _$(OS_TEST)
+ endif
+ ifeq ($(USE_LIBC),1)
+ LIBC_TAG = _libc
+ else
+ LIBC_TAG = _glibc
+ endif
+# always use pthreads
+ USE_PTHREADS = 1
+ ifeq ($(USE_PTHREADS),1)
+ IMPL_STRATEGY = _PTH
+ endif
+ ifeq ($(USE_EGCS),1)
+ COMPILER_TAG = _egcs
+ endif
+endif
+
+# Clean up SCO
+ifeq ($(OS_ARCH),SCO_SV)
+OS_ARCH := SCOOS
+ifeq (5.0,$(findstring 5.0,$(shell ls /var/opt/K/SCO/Unix)))
+OS_RELEASE := 5.0
+else
+OS_RELEASE := UNKNOWN
+endif
+endif
+
+# Furnish the extra libraries for using ld on OSF1
+ifeq ($(OS_ARCH),OSF1)
+LDEXTRA := -lcxx -lexc -lc
+#
+# Distinguish between OSF1 V4.0B and V4.0D
+#
+ifeq ($(OS_RELEASE),V4.0)
+ OS_VERSION := $(shell uname -v)
+ ifeq ($(OS_VERSION),564)
+ OS_RELEASE := V4.0B
+ endif
+ ifeq ($(OS_VERSION),878)
+ OS_RELEASE := V4.0D
+ endif
+endif
+else
+LDEXTRA :=
+endif
+
+# Relative pathname from top-of-tree to current source directory
+ifneq ($(OS_ARCH),WINNT)
+REVDEPTH := $(DEPTH)/config/revdepth
+SRCDIR := $(shell perl $(REVDEPTH).pl $(DEPTH))
+endif
+
+# define an include-at-most-once flag
+NS_CONFIG_MK = 1
+
+#
+# Default command macros; can be overridden in <arch>.mk.
+#
+AS = $(CC)
+ASFLAGS = $(CFLAGS)
+CCF = $(CC) $(CFLAGS)
+PURIFY = purify $(PURIFYOPTIONS)
+LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
+LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
+NFSPWD = $(DEPTH)/config/nfspwd
+
+ifeq ($(OS_ARCH),WINNT)
+RC = rc.exe
+XP_DEFINE = -DXP_PC
+LIB_SUFFIX = lib
+DLL_SUFFIX = dll
+AR = lib -NOLOGO -OUT:"$@"
+DLLFLAGS = $(XLFLAGS) -OUT:"$@"
+LFLAGS = $(OBJS) $(DEPLIBS) $(EXTRA_LIBS) -OUT:"$@"
+NSINSTALL = nsinstall
+INSTALL = $(NSINSTALL)
+else
+include $(DEPTH)/config/UNIX.mk
+endif
+
+ifdef BUILD_OPT
+ifeq ($(OS_ARCH),WINNT)
+OPTIMIZER = -O2
+XCFLAGS = $(LCFLAGS)
+XLFLAGS = $(LLFLAGS)
+else
+OPTIMIZER = -O
+JAVA_OPTIMIZER = -O
+DEFINES = -UDEBUG -DNDEBUG -DTRIMMED
+endif
+OBJDIR_TAG = _OPT
+else
+ifeq ($(OS_ARCH),WINNT)
+OPTIMIZER = -Od -Z7
+LDFLAGS = -DEBUG
+
+XCFLAGS = $(LCFLAGS)
+XLFLAGS = -DEBUG $(LLFLAGS)
+XBCFLAGS = -FR$*
+JAVA_OPTIMIZER = -Od -Z7
+else
+ifeq ($(ARCH), ReliantUNIX)
+OPTIMIZER = -gdwarf
+JAVA_OPTIMIZER = -gdwarf
+else
+OPTIMIZER = -g
+JAVA_OPTIMIZER = -g
+endif
+ifeq ($(OS_ARCH),OSF1)
+DEFINES = -DDEBUG_$(shell whoami) -DTRACING
+else
+DEFINES = -DDEBUG -UNDEBUG -DDEBUG_$(shell whoami) -DTRACING
+endif
+endif
+OBJDIR_TAG = _DBG
+endif
+
+LIBNT = $(DIST)/lib/libnt.$(LIB_SUFFIX)
+LIBAWT = $(DIST)/lib/libawt.$(LIB_SUFFIX)
+LIBMMEDIA = $(DIST)/lib/libmmedia.$(LIB_SUFFIX)
+LIBNSPR = $(DIST)/lib/libnspr.$(LIB_SUFFIX)
+PURELIBNSPR = $(DIST)/lib/libpurenspr.$(LIB_SUFFIX)
+
+ifeq ($(OS_ARCH),WINNT)
+LIBNSJAVA = $(DIST)/lib/jrt3221.$(LIB_SUFFIX)
+else
+LIBNSJAVA = $(DIST)/lib/nsjava32.$(LIB_SUFFIX)
+endif
+
+
+# XXX For now, we're including $(DEPTH)/include directly instead of
+# getting this stuff from dist. This stuff is old and will eventually
+# be put in the library directories where it belongs so that it can
+# get exported to dist properly.
+INCLUDES = $(LOCAL_PREINCLUDES) -I$(DEPTH)/include $(LOCAL_INCLUDES)
+
+CFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)
+# For purify
+NOMD_CFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(NOMD_OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)
+
+#
+# To build on SunOS5.8 when some SunOS5.8 components or config
+# files are missing, just pretend you're on SunOS5.6 by setting
+# NSOS_RELEASE_OVERRIDE=5.6
+#
+ifdef NSOS_RELEASE_OVERRIDE
+OS_RELEASE := $(NSOS_RELEASE_OVERRIDE)
+endif
+
+include $(DEPTH)/config/$(OS_ARCH)$(OS_RELEASE).mk
+
+OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
+
+include $(DEPTH)/config/$(OS_CONFIG).mk
+
+# now take care of default GCC (rus@5/5/97)
+
+ifdef NS_USE_GCC
+# if gcc-settings are redefined already - don't touch it
+#
+ifeq (,$(findstring gcc, $(CC)))
+CC = gcc
+CCC = g++
+CXX = g++
+# always use -fpic - some makefiles are still broken and don't distinguish
+# situation when they build shared and static libraries
+CFLAGS += -fpic -Wall -DNS_USE_GCC $(GCC_FLAGS_EXTRA)
+OS_LIBS += -L/usr/local/lib -lstdc++ -lg++ -lgcc
+endif
+endif
+###
+
+# Name of the binary code directories
+ifeq ($(OS_ARCH),WINNT)
+ifneq ($(PROCESSOR_ARCHITECTURE),x86)
+OBJDIR_NAME = $(OS_CONFIG)$(PROCESSOR_ARCHITECTURE)$(OBJDIR_TAG).OBJ
+else
+OBJDIR_NAME = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
+endif
+else # WINNT
+ifeq ($(OS_ARCH),Linux)
+OBJDIR_NAME = $(OS_CONFIG)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
+else
+ifeq ($(OS_ARCH), IRIX)
+ ifeq ($(USE_PTHREADS), 1)
+ ifeq ($(USE_N32), 1)
+ OBJDIR_NAME = $(OS_CONFIG)_n32_PTH$(OBJDIR_TAG).OBJ
+ else
+ OBJDIR_NAME = $(OS_CONFIG)_PTH$(OBJDIR_TAG).OBJ
+ endif
+ else
+ OBJDIR_NAME = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
+ endif
+else
+ OBJDIR_NAME = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
+endif # IRIX
+endif # Linux
+endif # WINNT
+
+# Figure out where the binary code lives. It either lives in the src
+# tree (NSBUILDROOT is undefined) or somewhere else.
+ifdef NSBUILDROOT
+BUILD = $(NSBUILDROOT)/$(OBJDIR_NAME)/build
+OBJDIR = $(BUILD)/$(SRCDIR)
+XPDIST = $(NSBUILDROOT)
+DIST = $(NSBUILDROOT)/$(OBJDIR_NAME)/dist
+else
+BUILD = $(OBJDIR_NAME)
+OBJDIR = $(OBJDIR_NAME)
+XPDIST = $(DEPTH)/dist
+DIST = $(DEPTH)/dist/$(OBJDIR_NAME)
+endif
+
+# all public include files go in subdirectories of PUBLIC:
+PUBLIC = $(XPDIST)/public
+
+VPATH = $(OBJDIR)
+DEPENDENCIES = $(OBJDIR)/.md
+
+# Personal makefile customizations go in these optional make include files.
+MY_CONFIG = $(DEPTH)/config/myconfig.mk
+MY_RULES = $(DEPTH)/config/myrules.mk
+
+-include $(MY_CONFIG)
+
+######################################################################
+
+# Specify that we are building a client.
+# This will instruct the cross platform libraries to
+# include all the client specific cruft.
+ifndef SERVER_BUILD
+ifndef LIVEWIRE
+DEFINES += -DMOZILLA_CLIENT -DNETSCAPE
+endif
+else
+DEFINES += -DSERVER_BUILD
+endif
+DEFINES += -DNETSCAPE
+
+# Now test variables that might have been set or overridden by $(MY_CONFIG).
+
+# if ((BUILD_EDITOR || BUILD_EDT) && !NO_EDITOR) -> -DEDITOR is defined
+ifndef NO_EDITOR
+ifdef BUILD_EDITOR
+OBJDIR_TAG := $(OBJDIR_TAG)_EDT
+DEFINES += -DEDITOR -DGOLD
+# This is the product classification not the feature classification.
+# It effects things like where are the release notes, etc..
+BUILD_GOLD = yea
+else
+# We ought to get rid of this now that BUILD_EDITOR has replaced it.
+ifdef BUILD_EDT
+OBJDIR_TAG := $(OBJDIR_TAG)_EDT
+DEFINES += -DEDITOR -DGOLD
+BUILD_EDITOR = yea
+endif
+endif
+endif
+
+# Build layers by default
+ifndef NO_LAYERS
+DEFINES += -DLAYERS
+endif
+
+# if (BUILD_EDITOR_UI && !NO_EDITOR_UI) -> -DEDITOR_UI is defined
+ifdef BUILD_EDITOR_UI
+ifndef NO_EDITOR_UI
+DEFINES += -DEDITOR_UI
+endif
+endif
+
+ifdef BUILD_DEBUG_GC
+DEFINES += -DDEBUG_GC
+endif
+
+ifdef BUILD_UNIX_PLUGINS
+# UNIX_EMBED Should not be needed. For now these two defines go
+# together until I talk with jg. --dp
+DEFINES += -DUNIX_EMBED -DX_PLUGINS
+endif
+
+ifndef NO_UNIX_LDAP
+DEFINES += -DUNIX_LDAP
+endif
+
+#
+# Platform dependent switching off of NSPR, JAVA and MOCHA
+#
+ifndef NO_NSPR
+DEFINES += -DNSPR -DNSPR20
+endif
+
+ifndef NO_JAVA
+DEFINES += -DJAVA
+endif
+
+ifeq ($(LW_JAVA), 1)
+DEFINES += -DJAVA
+endif
+
+ifndef NO_MOCHA
+DEFINES += -DMOCHA
+endif
+
+ifdef FORTEZZA
+DEFINES += -DFORTEZZA
+endif
+
+######################################################################
+
+GARBAGE = $(DEPENDENCIES) core
+
+ifneq ($(OS_ARCH),WINNT)
+NSINSTALL = $(DEPTH)/config/$(OBJDIR_NAME)/nsinstall
+
+ifeq ($(NSDISTMODE),copy)
+# copy files, but preserve source mtime
+INSTALL = $(NSINSTALL) -t
+else
+ifeq ($(NSDISTMODE),absolute_symlink)
+# install using absolute symbolic links
+INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
+else
+# install using relative symbolic links
+INSTALL = $(NSINSTALL) -R
+endif
+endif
+endif
+
+ifndef PLATFORM_HOSTS
+PLATFORM_HOSTS = \
+ atm \
+ bsdi \
+ diva \
+ gunwale \
+ openwound \
+ server2 \
+ server3 \
+ server9 \
+ zot \
+ $(NULL)
+endif
+
+######################################################################
+
+# always copy files for the sdk
+SDKINSTALL = $(NSINSTALL) -t
+
+ifndef SDK
+SDK = $(DEPTH)/dist/sdk
+endif
+
+######################################################################
+### Java Stuff
+######################################################################
+## java interpreter
+
+JAVA_PROG = java # from the ether
+
+# Let user over-ride CLASSPATH from environment
+#ifdef xCLASSPATH # bad idea
+#JAVA_CLASSPATH = $(CLASSPATH)
+#else
+# keep sun-java/classsrc until bootstrapped
+#JAVA_CLASSPATH = $(XPDIST)/classes:$(DEPTH)/sun-java/classsrc
+#endif
+
+#JAVA_FLAGS = -classpath $(JAVA_CLASSPATH) -ms8m
+#JAVA = $(JAVA_PROG) $(JAVA_FLAGS)
+
+######################################################################
+## java compiler
+# XXX - ram included from common.mn
+#JAVAC_PROG = javac # from the ether
+#JAVAC_CLASSPATH = $(JAVA_CLASSPATH):/usr/local/netscape/java/lib/javac.zip
+#JAVAC_FLAGS = -classpath $(JAVAC_CLASSPATH) $(JAVA_OPTIMIZER)
+#JAVAC = $(JAVAC_PROG) $(JAVAC_FLAGS)
+
+PATH_SEPARATOR = :
+JAVAC_ZIP = /usr/local/netscape/java/lib/javac.zip
+
+#
+# The canonical classpath for building java libraries
+# includes these two entries first, then any additional zips
+# or directories
+#
+# see "JAVAC_CLASSPATH" in common.mn
+#
+
+# where the bytecode will go
+JAVA_DESTPATH = $(XPDIST)/classes
+# where the sources for the module you are compiling are
+# default is sun-java/classsrc, override for other modules
+JAVA_SOURCEPATH = $(DEPTH)/sun-java/classsrc
+
+######################################################################
+## javadoc
+
+# Rules to build java .html files from java source files
+
+JAVADOC_PROG = $(JAVA) sun.tools.javadoc.Main
+JAVADOC_FLAGS = -classpath $(JAVAC_CLASSPATH)
+JAVADOC = $(JAVADOC_PROG) $(JAVADOC_FLAGS)
+
+######################################################################
+## javah
+
+ifndef JAVAH_IN_JAVA
+JAVAH_PROG = $(DIST)/bin/javah
+else
+JAVAH_PROG = $(JAVA) netscape.tools.jric.Main
+endif
+JAVAH_FLAGS = -classpath $(JAVA_CLASSPATH)
+JAVAH = $(JAVAH_PROG) $(JAVAH_FLAGS)
+
+######################################################################
+## jmc
+
+JMCSRCDIR = $(XPDIST)/_jmc
+JMC_PROG = $(JAVA) netscape.tools.jmc.Main
+JMC_CLASSPATH = $(JMCSRCDIR):$(JAVAC_CLASSPATH)
+JMC_FLAGS = -classpath $(JMC_CLASSPATH) -verbose
+JMC = $(JMC_PROG) $(JMC_FLAGS)
+
+######################################################################
+## zip
+
+ZIP_PROG = zip
+ZIP_FLAGS = -0rq
+ZIP = $(ZIP_PROG) $(ZIP_FLAGS)
+
+######################################################################
+JRTDLL = libjrt.$(DLL_SUFFIX)
+MMDLL = libmm32$(VERSION_NUMBER).$(DLL_SUFFIX)
+AWTDLL = libawt.$(DLL_SUFFIX)
+JITDLL = libjit
+
diff --git a/config/nfspwd.pl b/config/nfspwd.pl
new file mode 100644
index 00000000..a4d1645d
--- /dev/null
+++ b/config/nfspwd.pl
@@ -0,0 +1,21 @@
+#! /usr/local/bin/perl
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+
+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/config/nsinstall.c b/config/nsinstall.c
new file mode 100644
index 00000000..0d8a537a
--- /dev/null
+++ b/config/nsinstall.c
@@ -0,0 +1,305 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+** 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utime.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "pathsub.h"
+
+#define HAVE_LCHOWN
+
+#if defined(AIXV3) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(SNI)
+#undef HAVE_LCHOWN
+#endif
+
+#ifdef LINUX
+# include <getopt.h>
+#endif
+
+#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined (NCR) || defined(UnixWare)
+#if !defined(S_ISLNK) && defined(S_IFLNK)
+#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
+#endif
+#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, strlen(program), "");
+ exit(2);
+}
+
+static int
+mkdirs(char *path, mode_t mode)
+{
+ char *cp;
+ struct stat sb;
+
+ while (*path == '/' && path[1] == '/')
+ path++;
+ while ((cp = strrchr(path, '/')) && cp[1] == '\0')
+ *cp = '\0';
+ if (cp && cp != path) {
+ *cp = '\0';
+ if ((lstat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
+ mkdirs(path, mode) < 0) {
+ return -1;
+ }
+ *cp = '/';
+ }
+ return mkdir(path, mode);
+}
+
+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;
+ mode_t mode;
+ char *linkprefix, *owner, *group;
+ int opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc;
+ char *cp, *cwd, *todir, *toname, *name, *base, *linkname;
+ uid_t uid;
+ gid_t gid;
+ char *bp, buf[BUFSIZ];
+ struct stat sb, tosb;
+ struct utimbuf utb;
+
+ program = argv[0];
+ cwd = 0;
+ onlydir = dodir = dolink = dorelsymlink = dotimes = 0;
+ mode = 0755;
+ linkprefix = owner = group = 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)
+ cwd = getcwd(0, PATH_MAX);
+ xchdir(todir);
+ todir = getcwd(0, PATH_MAX);
+ tdlen = strlen(todir);
+ 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 = 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 = xmalloc(len + 1);
+ sprintf(linkname, "%s/%s", linkprefix, name);
+ } else if (dorelsymlink) {
+ /* Symlink the relative path from todir to source name. */
+ linkname = 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);
+ }
+ if (fchmod(tofd, mode) < 0)
+ 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;
+}
diff --git a/config/pathsub.c b/config/pathsub.c
new file mode 100644
index 00000000..6e5cfd20
--- /dev/null
+++ b/config/pathsub.c
@@ -0,0 +1,206 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+/*
+** Pathname subroutines.
+**
+** Brendan Eich, 8/29/95
+*/
+#include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "pathsub.h"
+#ifdef USE_REENTRANT_LIBC
+#include <libc_r.h>
+#endif /* USE_REENTRANT_LIBC */
+
+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
+/* 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(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/config/pathsub.h b/config/pathsub.h
new file mode 100644
index 00000000..2e7a0554
--- /dev/null
+++ b/config/pathsub.h
@@ -0,0 +1,46 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+#ifndef pathsub_h___
+#define pathsub_h___
+/*
+** Pathname subroutines.
+**
+** Brendan Eich, 8/29/95
+*/
+#include <limits.h>
+#include <sys/types.h>
+
+#if SUNOS4
+#include "../nspr/include/sunos4.h"
+#endif
+
+#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/config/revdepth-nt.pl b/config/revdepth-nt.pl
new file mode 100644
index 00000000..8b8a85f5
--- /dev/null
+++ b/config/revdepth-nt.pl
@@ -0,0 +1,19 @@
+#! /usr/local/bin/perl
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+
+require "/ns/config/fastcwd.pl";
+
+$cur = &fastcwd;
+chdir($ARGV[0]);
+$newcur = &fastcwd;
+$newcurlen = length($newcur);
+
+# Skip common separating / unless $newcur is "/"
+$cur = substr($cur, $newcurlen + ($newcurlen > 1));
+print $cur;
diff --git a/config/revdepth.pl b/config/revdepth.pl
new file mode 100644
index 00000000..b38f6f3d
--- /dev/null
+++ b/config/revdepth.pl
@@ -0,0 +1,22 @@
+#! /usr/local/bin/perl
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+
+unshift(@INC, '/usr/lib/perl');
+unshift(@INC, '/usr/local/lib/perl');
+
+require "fastcwd.pl";
+
+$cur = &fastcwd;
+chdir($ARGV[0]);
+$newcur = &fastcwd;
+$newcurlen = length($newcur);
+
+# Skip common separating / unless $newcur is "/"
+$cur = substr($cur, $newcurlen + ($newcurlen > 1));
+print $cur;
diff --git a/config/rules.mk b/config/rules.mk
new file mode 100644
index 00000000..c65f49f2
--- /dev/null
+++ b/config/rules.mk
@@ -0,0 +1,707 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+################################################################################
+# Wow this is complicated! The story is that we now have a 4 pass build process:
+#
+# Pass 1. export - Create generated headers and stubs. Publish public headers to
+# dist/<arch>/include.
+#
+# Pass 2. libs - Create libraries. Publish libraries to dist/<arch>/lib.
+#
+# Pass 3. all - Create programs.
+#
+# Pass 4. install - Publish programs to dist/<arch>/bin.
+#
+# 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, CPPSRCS -- .c and .cpp 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)
+# f)
+# JSRCS -- java source files to compile into class files
+# (if you don't specify this it will default to *.java)
+# PACKAGE -- the package to put the .class files into
+# (e.g. netscape/applet)
+# JMC_EXPORT -- java files to be exported for use by JMC_GEN
+# (this is a list of Class names)
+# g)
+# JRI_GEN -- files to run through javah to generate headers and stubs
+# (output goes into the _jri sub-dir)
+# h)
+# JMC_GEN -- files to run through jmc to generate headers and stubs
+# (output goes into the _jmc sub-dir)
+#
+################################################################################
+
+#
+# Common rules used by lots of makefiles...
+#
+ifndef NS_CONFIG_MK
+include $(DEPTH)/config/config.mk
+endif
+
+ifdef PROGRAM
+PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM))
+endif
+
+ifndef LIBRARY
+ifdef LIBRARY_NAME
+LIBRARY := lib$(LIBRARY_NAME).$(LIB_SUFFIX)
+endif
+endif
+
+ifdef LIBRARY
+LIBRARY := $(addprefix $(OBJDIR)/, $(LIBRARY))
+ifdef MKSHLIB
+SHARED_LIBRARY := $(LIBRARY:.$(LIB_SUFFIX)=$(DLL_PRESUF).$(DLL_SUFFIX))
+endif
+endif
+
+ifndef TARGETS
+TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
+endif
+
+ifndef OBJS
+OBJS = $(JRI_STUB_CFILES) $(addsuffix .o, $(JMC_GEN)) $(CSRCS:.c=.o) $(CPPSRCS:.cpp=.o) $(ASFILES:.s=.o)
+endif
+
+ifdef OBJS
+OBJS := $(addprefix $(OBJDIR)/, $(OBJS))
+endif
+
+ifdef REQUIRES
+MODULE_PREINCLUDES = $(addprefix -I$(XPDIST)/public/, $(REQUIRES))
+endif
+
+ifeq ($(OS_ARCH),WINNT)
+ifdef DLL
+DLL := $(addprefix $(OBJDIR)/, $(DLL))
+LIB := $(addprefix $(OBJDIR)/, $(LIB))
+endif
+endif
+define MAKE_OBJDIR
+if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
+endef
+
+ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
+ $(NOSUCHFILE) $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES) \
+ $(JRI_HEADER_CFILES) $(JRI_STUB_CFILES) $(JMC_STUBS) \
+ $(JMC_HEADERS) $(JMC_EXPORT_FILES) so_locations \
+ _gen _jmc _jri _stubs \
+ $(wildcard $(JAVA_DESTPATH)/$(PACKAGE)/*.class)
+
+ifdef JDIRS
+ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS))
+endif
+
+ifdef NSBUILDROOT
+JDK_GEN_DIR = $(XPDIST)/_gen
+JMC_GEN_DIR = $(XPDIST)/_jmc
+JRI_GEN_DIR = $(XPDIST)/_jri
+JDK_STUB_DIR = $(XPDIST)/_stubs
+else
+JDK_GEN_DIR = _gen
+JMC_GEN_DIR = _jmc
+JRI_GEN_DIR = _jri
+JDK_STUB_DIR = _stubs
+endif
+
+#
+# If this is an "official" build, try to build everything.
+# I.e., don't exit on errors.
+#
+ifdef BUILD_OFFICIAL
+EXIT_ON_ERROR = +e
+CLICK_STOPWATCH = date
+else
+EXIT_ON_ERROR = -e
+CLICK_STOPWATCH = true
+endif
+
+
+################################################################################
+
+ifdef ALL_PLATFORMS
+all_platforms:: $(NFSPWD)
+ @d=`$(NFSPWD)`; \
+ if test ! -d LOGS; then rm -rf LOGS; mkdir LOGS; fi; \
+ for h in $(PLATFORM_HOSTS); do \
+ echo "On $$h: $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log"; \
+ rsh $$h -n "(chdir $$d; \
+ $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log; \
+ echo DONE) &" 2>&1 > LOGS/$$h.pid & \
+ sleep 1; \
+ done
+
+$(NFSPWD):
+ cd $(@D); $(MAKE) $(@F)
+endif
+
+ifdef REQUIRES
+ifndef NO_NSPR
+INCLUDES += -I$(XPDIST)/$(OBJDIR)/include/nspr20/pr $(addprefix -I$(XPDIST)/public/, $(REQUIRES))
+else
+INCLUDES += $(addprefix -I$(XPDIST)/public/, $(REQUIRES))
+endif
+endif
+
+all:: $(TARGETS)
+ +$(LOOP_OVER_DIRS)
+
+libs:: $(LIBRARY) $(SHARED_LIBRARY)
+
+$(PROGRAM): $(OBJS)
+ @$(MAKE_OBJDIR)
+ifeq ($(OS_ARCH),WINNT)
+ $(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
+else
+ $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)
+endif
+
+$(LIBRARY): $(OBJS)
+ @$(MAKE_OBJDIR)
+ rm -f $@
+ $(AR) $(OBJS)
+ $(RANLIB) $@
+
+$(SHARED_LIBRARY): $(OBJS)
+ @$(MAKE_OBJDIR)
+ rm -f $@
+ $(MKSHLIB) -o $@ $(OBJS) $(EXTRA_SHLIBS)
+ chmod +x $@
+
+ifeq ($(OS_ARCH),WINNT)
+$(DLL): $(OBJS) $(EXTRA_LIBS)
+ @$(MAKE_OBJDIR)
+ rm -f $@
+ $(LINK_DLL) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS)
+endif
+
+.SUFFIXES: .i .pl .class .java .html
+
+.PRECIOUS: .java
+
+$(OBJDIR)/%: %.c
+ @$(MAKE_OBJDIR)
+ifeq ($(OS_ARCH),WINNT)
+ $(CC) -Fo$@ -c $(CFLAGS) $*.c
+else
+ $(CC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
+endif
+
+$(OBJDIR)/%.o: %.c
+ @$(MAKE_OBJDIR)
+ifeq ($(OS_ARCH),WINNT)
+ $(CC) -Fo$@ -c $(CFLAGS) $*.c
+else
+ $(CC) -o $@ -c $(CFLAGS) $*.c
+endif
+
+$(OBJDIR)/%.o: %.s
+ @$(MAKE_OBJDIR)
+ $(AS) -o $@ $(ASFLAGS) -c $*.s
+
+$(OBJDIR)/%.o: %.S
+ @$(MAKE_OBJDIR)
+ $(AS) -o $@ $(ASFLAGS) -c $*.S
+
+$(OBJDIR)/%: %.cpp
+ @$(MAKE_OBJDIR)
+ $(CCC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
+
+#
+# Please keep the next two rules in sync.
+#
+$(OBJDIR)/%.o: %.cc
+ @$(MAKE_OBJDIR)
+ $(CCC) -o $@ -c $(CFLAGS) $*.cc
+
+$(OBJDIR)/%.o: %.cpp
+ @$(MAKE_OBJDIR)
+ifdef STRICT_CPLUSPLUS_SUFFIX
+ echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > $(OBJDIR)/t_$*.cc
+ $(CCC) -o $@ -c $(CFLAGS) $(OBJDIR)/t_$*.cc
+ rm -f $(OBJDIR)/t_$*.cc
+else
+ifeq ($(OS_ARCH),WINNT)
+ $(CCC) -Fo$@ -c $(CFLAGS) $*.cpp
+else
+ $(CCC) -o $@ -c $(CFLAGS) $*.cpp
+endif
+endif #STRICT_CPLUSPLUS_SUFFIX
+
+%.i: %.cpp
+ $(CCC) -C -E $(CFLAGS) $< > $*.i
+
+%.i: %.c
+ $(CC) -C -E $(CFLAGS) $< > $*.i
+
+%: %.pl
+ rm -f $@; cp $*.pl $@; chmod +x $@
+
+%: %.sh
+ rm -f $@; cp $*.sh $@; chmod +x $@
+
+#
+# If this is an "official" build, try to build everything.
+# I.e., don't exit on errors.
+#
+ifdef BUILD_OFFICIAL
+EXIT_ON_ERROR = +e
+else
+EXIT_ON_ERROR = -e
+endif
+
+ifdef DIRS
+ifneq ($(OS_ARCH),WINNT)
+override MAKEFLAGS :=
+endif
+LOOP_OVER_DIRS = \
+ @for d in $(DIRS); do \
+ if test -d $$d; then \
+ set $(EXIT_ON_ERROR); \
+ echo "cd $$d; $(MAKE) $(MAKEFLAGS) $@"; \
+ cd $$d; $(MAKE) $(MAKEFLAGS) $@; cd ..; \
+ set +e; \
+ else \
+ echo "Skipping non-directory $$d..."; \
+ fi; \
+ $(CLICK_STOPWATCH); \
+done
+
+$(DIRS)::
+ @if test -d $@; then \
+ set $(EXIT_ON_ERROR); \
+ echo "cd $@; $(MAKE) $(MAKEFLAGS)"; \
+ cd $@; $(MAKE) $(MAKEFLAGS); \
+ set +e; \
+ else \
+ echo "Skipping non-directory $@..."; \
+ fi \
+ $(CLICK_STOPWATCH);
+endif # DIRS
+
+clean::
+ rm -f $(OBJS) $(NOSUCHFILE)
+ +$(LOOP_OVER_DIRS)
+
+clobber::
+ rm -f $(OBJS) $(TARGETS) $(GARBAGE) $(NOSUCHFILE)
+ +$(LOOP_OVER_DIRS)
+
+realclean clobber_all::
+ rm -rf LOGS TAGS $(wildcard *.OBJ) $(OBJS) $(TARGETS) $(GARBAGE) $(NOSUCHFILE)
+ +$(LOOP_OVER_DIRS)
+
+alltags:
+ rm -f TAGS
+ find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
+
+export::
+ +$(LOOP_OVER_DIRS)
+
+libs::
+ +$(LOOP_OVER_DIRS)
+
+install::
+ +$(LOOP_OVER_DIRS)
+
+mac::
+ +$(LOOP_OVER_DIRS)
+
+################################################################################
+### Bunch of things that extend the 'export' rule (in order):
+################################################################################
+### JSRCS -- for compiling java files
+
+ifndef PACKAGE
+PACKAGE = .
+endif
+$(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) $(JMCSRCDIR)::
+ @if test ! -d $@; then \
+ echo Creating $@; \
+ rm -rf $@; \
+ $(NSINSTALL) -D $@; \
+ fi
+
+ifneq ($(JSRCS),)
+export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
+ @list=`perl $(DEPTH)/config/outofdate.pl $(PERLARG) \
+ -d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS)`; \
+ if test "$$list"x != "x"; then \
+ echo $(JAVAC) $$list; \
+ $(JAVAC) $$list; \
+ fi
+
+all:: export
+
+clobber::
+ rm -f $(XPDIST)/classes/$(PACKAGE)/*.class
+
+endif
+
+################################################################################
+## JDIRS -- like JSRCS, except you can give a list of directories and it will
+## compile all the out-of-date java files recursively below those directories.
+
+ifdef JDIRS
+
+export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
+ @for d in $(JDIRS); do \
+ if test -d $$d; then \
+ set $(EXIT_ON_ERROR); \
+ files=`echo $$d/*.java`; \
+ list=`perl $(DEPTH)/config/outofdate.pl $(PERLARG) \
+ -d $(JAVA_DESTPATH)/$(PACKAGE) $$files`; \
+ if test "$${list}x" != "x"; then \
+ echo Building all java files in $$d; \
+ echo $(JAVAC) $$list; \
+ $(JAVAC) $$list; \
+ fi; \
+ set +e; \
+ else \
+ echo "Skipping non-directory $$d..."; \
+ fi; \
+ $(CLICK_STOPWATCH); \
+ done
+
+all:: export
+
+clobber::
+ @for d in $(JDIRS); do \
+ echo rm -rf $(XPDIST)/classes/$$d; \
+ rm -rf $(XPDIST)/classes/$$d; \
+ done
+
+endif
+
+################################################################################
+### JDK_GEN -- for generating "old style" native methods
+
+# Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory
+
+ifneq ($(JDK_GEN),)
+
+ifdef NSBUILDROOT
+JDK_GEN_DIR = $(XPDIST)/_gen
+JDK_STUB_DIR = $(XPDIST)/_stubs
+else
+JDK_GEN_DIR = _gen
+JDK_STUB_DIR = _stubs
+endif
+
+INCLUDES += -I$(JDK_GEN_DIR)
+
+JDK_PACKAGE_CLASSES = $(JDK_GEN)
+JDK_PATH_CLASSES = $(subst .,/,$(JDK_PACKAGE_CLASSES))
+JDK_PATH_CLASSES = $(subst .,/,$(JDK_PACKAGE_CLASSES))
+JDK_HEADER_CLASSFILES = $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
+JDK_STUB_CLASSFILES = $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
+JDK_HEADER_CFILES = $(patsubst %,$(JDK_GEN_DIR)/%.h,$(JDK_GEN))
+JDK_STUB_CFILES = $(patsubst %,$(JDK_STUB_DIR)/%.c,$(JDK_GEN))
+
+$(JDK_HEADER_CFILES): $(JDK_HEADER_CLASSFILES)
+$(JDK_STUB_CFILES): $(JDK_STUB_CLASSFILES)
+
+export::
+ @echo Generating/Updating JDK headers
+ $(JAVAH) -d $(JDK_GEN_DIR) $(JDK_PACKAGE_CLASSES)
+ @echo Generating/Updating JDK stubs
+ $(JAVAH) -stubs -d $(JDK_STUB_DIR) $(JDK_PACKAGE_CLASSES)
+
+mac::
+ @echo Generating/Updating JDK headers for the Mac
+ $(JAVAH) -mac -d $(DEPTH)/lib/mac/Java/_gen $(JDK_PACKAGE_CLASSES)
+ @echo Generating/Updating JDK stubs for the Mac
+ $(JAVAH) -mac -stubs -d $(DEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES)
+
+# Don't delete them if the don't compile (makes it hard to debug):
+.PRECIOUS: $(JDK_HEADERS) $(JDK_STUBS)
+
+clobber::
+ rm -rf $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES)
+
+endif
+
+################################################################################
+### JRI_GEN -- for generating JRI native methods
+
+# Generate JRI Headers and Stubs into the 'jri' directory
+
+ifneq ($(JRI_GEN),)
+
+ifdef NSBUILDROOT
+JRI_GEN_DIR = $(XPDIST)/_jri
+else
+JRI_GEN_DIR = _jri
+endif
+
+INCLUDES += -I$(JRI_GEN_DIR)
+
+JRI_PACKAGE_CLASSES = $(JRI_GEN)
+JRI_PATH_CLASSES = $(subst .,/,$(JRI_PACKAGE_CLASSES))
+
+## dependency fu
+JRI_HEADER_CLASSFILES = $(patsubst %,$(XPDIST)/classes/%.class,$(JRI_PATH_CLASSES))
+JRI_HEADER_CFILES = $(patsubst %,$(JRI_GEN_DIR)/%.h,$(JRI_GEN))
+$(JRI_HEADER_CFILES): $(JRI_HEADER_CLASSFILES)
+
+## dependency fu
+JRI_STUB_CLASSFILES = $(patsubst %,$(XPDIST)/classes/%.class,$(JRI_PATH_CLASSES))
+JRI_STUB_CFILES = $(patsubst %,$(JRI_GEN_DIR)/%.c,$(JRI_GEN))
+$(JRI_STUB_CFILES): $(JRI_STUB_CLASSFILES)
+
+export::
+ @echo Generating/Updating JRI headers
+ $(JAVAH) -jri -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
+ @echo Generating/Updating JRI stubs
+ $(JAVAH) -jri -stubs -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
+ @if test ! -d $(DEPTH)/lib/mac/Java/; then \
+ echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
+ echo "!!! This allows us to automatically update generated files for the mac."; \
+ echo "!!! If you see any modified files there, please check them in."; \
+ fi
+ @echo Generating/Updating JRI headers for the Mac
+ $(JAVAH) -jri -mac -d $(DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
+ @echo Generating/Updating JRI stubs for the Mac
+ $(JAVAH) -jri -mac -stubs -d $(DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
+
+# Don't delete them if the don't compile (makes it hard to debug):
+.PRECIOUS: $(JRI_HEADERS) $(JRI_STUBS)
+
+clobber::
+ rm -rf $(JRI_HEADER_CFILES) $(JRI_STUB_CFILES)
+
+endif
+
+################################################################################
+## JMC_EXPORT -- for declaring which java classes are to be exported for jmc
+
+ifneq ($(JMC_EXPORT),)
+
+JMC_EXPORT_PATHS = $(subst .,/,$(JMC_EXPORT))
+JMC_EXPORT_FILES = $(patsubst %,$(XPDIST)/classes/$(PACKAGE)/%.class,$(JMC_EXPORT_PATHS))
+
+# We're doing NSINSTALL -t here (copy mode) because calling INSTALL will pick up
+# your NSDISTMODE and make links relative to the current directory. This is a
+# problem because the source isn't in the current directory:
+
+export:: $(JMC_EXPORT_FILES) $(JMCSRCDIR)
+ $(NSINSTALL) -t -m 444 $(JMC_EXPORT_FILES) $(JMCSRCDIR)
+
+clobber::
+ rm -rf $(JMC_EXPORT_FILES)
+
+endif
+
+
+################################################################################
+## EXPORTS
+#
+# Copy each element of EXPORTS to $(XPDIST)/public/$(MODULE)/
+#
+
+ifneq ($(EXPORTS),)
+
+$(XPDIST)/public/$(MODULE)::
+ @if test ! -d $@; then \
+ echo Creating $@; \
+ rm -rf $@; \
+ mkdir -p $@; \
+ fi
+
+export:: $(EXPORTS) $(XPDIST)/public/$(MODULE)
+ $(NSINSTALL) -t -m 444 $(EXPORTS) $(XPDIST)/public/$(MODULE)
+
+endif
+
+################################################################################
+## JMC_GEN -- for generating java modules
+
+# Provide default export & install rules when using JMC_GEN
+ifneq ($(JMC_GEN),)
+
+ifdef NSBUILDROOT
+JMC_GEN_DIR = $(XPDIST)/_jmc
+else
+JMC_GEN_DIR = _jmc
+endif
+
+INCLUDES += -I$(JMC_GEN_DIR)
+
+JMC_HEADERS = $(patsubst %,$(JMC_GEN_DIR)/%.h,$(JMC_GEN))
+JMC_STUBS = $(patsubst %,$(JMC_GEN_DIR)/%.c,$(JMC_GEN))
+JMC_OBJS = $(patsubst %,$(OBJDIR)/%.o,$(JMC_GEN))
+
+$(JMC_GEN_DIR)/M%.h: $(JMCSRCDIR)/%.class
+ $(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)
+
+$(JMC_GEN_DIR)/M%.c: $(JMCSRCDIR)/%.class
+ $(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)
+
+$(OBJDIR)/M%.o: $(JMC_GEN_DIR)/M%.h $(JMC_GEN_DIR)/M%.c
+ @$(MAKE_OBJDIR)
+ $(CC) -o $@ -c $(CFLAGS) $(JMC_GEN_DIR)/M$*.c
+
+export:: $(JMC_HEADERS) $(JMC_STUBS)
+
+# Don't delete them if the don't compile (makes it hard to debug):
+.PRECIOUS: $(JMC_HEADERS) $(JMC_STUBS)
+
+clobber::
+ rm -rf $(JMC_HEADERS) $(JMC_STUBS)
+
+endif
+
+################################################################################
+## LIBRARY -- default rules for for building libraries
+
+ifdef LIBRARY
+libs:: $(LIBRARY)
+ $(INSTALL) -m 444 $(LIBRARY) $(DIST)/lib
+
+install:: $(LIBRARY)
+ $(INSTALL) -m 444 $(LIBRARY) $(DIST)/lib
+endif
+
+ifdef SHARED_LIBRARY
+libs:: $(SHARED_LIBRARY)
+ $(INSTALL) -m 555 $(SHARED_LIBRARY) $(DIST)/bin
+
+install:: $(SHARED_LIBRARY)
+ $(INSTALL) -m 555 $(SHARED_LIBRARY) $(DIST)/bin
+endif
+
+################################################################################
+## PROGRAM -- this is now needed because final programs are distributed
+## through dist and link with dynamic libraries
+
+ifdef PROGRAM
+libs:: $(PROGRAM)
+ $(INSTALL) -m 444 $(PROGRAM) $(DIST)/bin
+
+install:: $(PROGRAM)
+ $(INSTALL) -m 444 $(PROGRAM) $(DIST)/bin
+endif
+
+################################################################################
+
+-include $(DEPENDENCIES)
+
+ifneq ($(OS_ARCH),WINNT)
+# Can't use sed because of its 4000-char line length limit, so resort to perl
+.DEFAULT:
+ @perl -e ' \
+ open(MD, "< $(DEPENDENCIES)"); \
+ while (<MD>) { \
+ if (m@ \.*/*$< @) { \
+ $$found = 1; \
+ last; \
+ } \
+ } \
+ if ($$found) { \
+ print "Removing stale dependency $< from $(DEPENDENCIES)\n"; \
+ seek(MD, 0, 0); \
+ $$tmpname = "$(OBJDIR)/fix.md" . $$$$; \
+ open(TMD, "> " . $$tmpname); \
+ while (<MD>) { \
+ s@ \.*/*$< @ @; \
+ if (!print TMD "$$_") { \
+ unlink(($$tmpname)); \
+ exit(1); \
+ } \
+ } \
+ close(TMD); \
+ if (!rename($$tmpname, "$(DEPENDENCIES)")) { \
+ unlink(($$tmpname)); \
+ } \
+ } elsif ("$<" ne "$(DEPENDENCIES)") { \
+ print "$(MAKE): *** No rule to make target $<. Stop.\n"; \
+ exit(1); \
+ }'
+endif
+
+#############################################################################
+# X dependency system
+#############################################################################
+
+ifneq ($(OS_ARCH),WINNT)
+
+$(MKDEPENDENCIES)::
+ @$(MAKE_OBJDIR)
+ touch $(MKDEPENDENCIES)
+ $(MKDEPEND) -p$(OBJDIR_NAME)/ -o'.o' -f$(MKDEPENDENCIES) $(INCLUDES) $(CSRCS) $(CPPSRCS)
+
+$(MKDEPEND)::
+ cd $(MKDEPEND_DIR); $(MAKE)
+
+ifdef OBJS
+depend:: $(MKDEPEND) $(MKDEPENDENCIES)
+else
+depend::
+endif
+ +$(LOOP_OVER_DIRS)
+
+dependclean::
+ rm -f $(MKDEPENDENCIES)
+ +$(LOOP_OVER_DIRS)
+
+#-include $(OBJDIR)/depend.mk
+
+endif
+
+#############################################################################
+
+-include $(MY_RULES)
+
+$(MY_CONFIG):
+$(MY_RULES):
+
+# Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
+# or in $(MY_RULES)
+ifdef ETAGS
+ifneq ($(CSRCS)$(HEADERS),)
+all:: TAGS
+TAGS:: $(CSRCS) $(HEADERS)
+ $(ETAGS) $(CSRCS) $(HEADERS)
+endif
+endif
+
+################################################################################
+# Special gmake rules.
+################################################################################
+
+#
+# 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: .out .a .ln .o .c .cc .C .cpp .y .l .s .S .h .sh .i .pl .class .java .html
+
+#
+# Don't delete these files if we get killed.
+#
+.PRECIOUS: .java $(JDK_HEADERS) $(JDK_STUBS) $(JRI_HEADERS) $(JRI_STUBS) $(JMC_HEADERS) $(JMC_STUBS)
+
+#
+# Fake targets. Always run these rules, even if a file/directory with that
+# name already exists.
+#
+.PHONY: all all_platforms alltags boot clean clobber clobber_all export install libs realclean $(OBJDIR) $(DIRS)
diff --git a/config/webint.mk b/config/webint.mk
new file mode 100644
index 00000000..5269b321
--- /dev/null
+++ b/config/webint.mk
@@ -0,0 +1,24 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+ifdef WEBSERVER_LANGS
+LANG_LOOP= \
+ @for d in $(WEBSERVER_LANGS); do \
+ if test ! -d $$d; then \
+ echo Directory $$d does not exist. Creating...; \
+ mkdir -p $$d; \
+ fi; \
+ echo cd $$d; \
+ cd $$d; \
+ echo $(MAKE) -f ../Makefile $(MAKEFLAGS) INT_SUBDIR=1; \
+ $(MAKE) -f ../Makefile $(MAKEFLAGS) INT_SUBDIR=1; \
+ cd ..; \
+ done
+else
+LANG_LOOP= @echo "No foreign languages in this build"
+endif
+