diff --git a/.hgignore b/.hgignore index ef7ca59fd827..5f651b21025d 100644 --- a/.hgignore +++ b/.hgignore @@ -26,3 +26,6 @@ _DBG\.OBJ/ _OPT\.OBJ/ +# SpiderMonkey configury +^js/src/configure$ +^js/src/autom4te.cache$ diff --git a/client.mk b/client.mk index 587af3aadad4..65fa99fa5c86 100644 --- a/client.mk +++ b/client.mk @@ -169,6 +169,7 @@ endif # MOZ_BUILD_PROJECTS # 'configure' scripts generated by autoconf. CONFIGURES := $(TOPSRCDIR)/configure CONFIGURES += $(TOPSRCDIR)/nsprpub/configure +CONFIGURES += $(TOPSRCDIR)/js/src/configure ####################################################################### # Rules @@ -277,6 +278,7 @@ ifdef RUN_AUTOCONF_LOCALLY EXTRA_CONFIG_DEPS := \ $(TOPSRCDIR)/aclocal.m4 \ $(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \ + $(TOPSRCDIR)/js/src/aclocal.m4 \ $(NULL) $(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS) diff --git a/js/src/config/AIX4.3.mk b/config/js/Makefile.in similarity index 57% rename from js/src/config/AIX4.3.mk rename to config/js/Makefile.in index df05d8c9256b..ff6f9b7fbc59 100644 --- a/js/src/config/AIX4.3.mk +++ b/config/js/Makefile.in @@ -1,4 +1,3 @@ -# -*- Mode: makefile -*- # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +12,8 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. This file was copied from parts of +# mozilla/config/Makefile.in # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -22,10 +21,13 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): +# Robert Ginda +# John Taylor +# Benjamin Smedberg # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,29 +39,27 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for AIX -# +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ -CC = xlC_r -CCC = xlC_r -CFLAGS += -qarch=com -qnoansialias -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV -DAIX4_3 -DHAVE_LOCALTIME_R +include $(DEPTH)/config/autoconf.mk -RANLIB = ranlib +JS_OBJDIR = $(DEPTH)/js/src +JS_CONFIG = $(DIST)/bin/js-config -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< -ARCH := aix -CPU_ARCH = rs6000 -GFX_ARCH = x -INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1 +include $(topsrcdir)/config/rules.mk -#-lpthreads -lc_r - -MKSHLIB_BIN = /usr/ibmcxx/bin/makeC++SharedLib_r -MKSHLIB = $(MKSHLIB_BIN) -p 0 -G -berok -bM:UR - -ifdef JS_THREADSAFE -XLDFLAGS += -ldl -endif +# These rules assume that we configured js with an appropriate bindir, +# libdir, and includedir, so that the 'make install' will put things +# mostly in the right places. The install-runtime-libs target takes +# care of getting the needed libraries into the 'bin' directory as +# well as the 'lib' directory. +export:: + $(MAKE) -C $(JS_OBJDIR) install + $(MAKE) -C $(JS_OBJDIR) install-runtime-libs libdir=$(DIST)/bin + $(INSTALL) $(IFLAGS2) $(JS_CONFIG) $(SDK_BIN_DIR) +check:: + $(MAKE) -C $(JS_OBJDIR) $@ diff --git a/js/src/build.mk b/config/js/build.mk similarity index 97% rename from js/src/build.mk rename to config/js/build.mk index eac24716885b..fa8fbe0867dc 100644 --- a/js/src/build.mk +++ b/config/js/build.mk @@ -36,7 +36,5 @@ # ***** END LICENSE BLOCK ***** TIERS += js - -tier_js_dirs += \ - js/src \ - $(NULL) +tier_js_staticdirs = js/src +tier_js_dirs = config/js diff --git a/configure.in b/configure.in index 7b26f4319313..013037819133 100644 --- a/configure.in +++ b/configure.in @@ -8048,8 +8048,6 @@ elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; fi AC_SUBST(MOZ_MOVEMAIL) -AC_DEFINE(JS_THREADSAFE) - if test "$MOZ_DEBUG"; then AC_DEFINE(MOZ_REFLOW_PERF) AC_DEFINE(MOZ_REFLOW_PERF_DSP) @@ -8282,5 +8280,21 @@ if test -z "$MOZ_NATIVE_NSPR"; then rm -f config/autoconf.mk.bak fi +# Run the SpiderMonkey 'configure' script. +dist=$MOZ_BUILD_ROOT/dist +ac_configure_args="$_SUBDIR_CONFIG_ARGS" +ac_configure_args="$ac_configure_args --enable-threadsafe" +ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'" +ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'" +ac_configure_args="$ac_configure_args --includedir=$dist/include" +ac_configure_args="$ac_configure_args --bindir=$dist/bin" +ac_configure_args="$ac_configure_args --libdir=$dist/lib" +ac_configure_args="$ac_configure_args --with-sync-build-files=$srcdir" +if test "$MOZ_MEMORY"; then + ac_configure_args="$ac_configure_args --enable-jemalloc" +fi +AC_OUTPUT_SUBDIRS(js/src) +ac_configure_args="$_SUBDIR_CONFIG_ARGS" + fi # COMPILE_ENVIRONMENT diff --git a/js/src/Makefile.in b/js/src/Makefile.in index b35faaf76762..a51f4498ec03 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -37,10 +37,12 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. +DEPTH = . topsrcdir = @top_srcdir@ srcdir = @srcdir@ +DIRS = config + include $(DEPTH)/config/autoconf.mk MODULE = js @@ -167,7 +169,8 @@ CSRCS += \ jsdtracef.c endif -EXPORTS = \ +INSTALLED_HEADERS = \ + js-config.h \ jsautocfg.h \ jsautokw.h \ js.msg \ @@ -221,7 +224,7 @@ EXPORTS = \ ifdef ENABLE_JIT VPATH += $(srcdir)/nanojit -EXPORTS += \ +INSTALLED_HEADERS += \ builtins.tbl \ jsbuiltins.h \ Assembler.h \ @@ -254,14 +257,14 @@ DEFINES += -DFEATURE_NANOJIT -DJS_TRACER endif ifdef HAVE_DTRACE -EXPORTS += \ +INSTALLED_HEADERS += \ jsdtracef.h \ javascript-trace.h \ $(NULL) endif ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) -EXPORTS += jscpucfg.h +INSTALLED_HEADERS += jscpucfg.h endif JS_SAFE_ARENA = 1 @@ -330,6 +333,27 @@ endif include $(topsrcdir)/config/rules.mk +ifdef MOZ_SYNC_BUILD_FILES +# Because the SpiderMonkey can be distributed and built independently +# of the Mozilla source tree, it contains its own copies of many of +# the files used by the top-level Mozilla build process, from the +# 'config' and 'build' subtrees. +# +# To make it simpler to keep the copies in sync, we follow the policy +# that the SpiderMonkey copies must always be exact copies of those in +# the containing Mozilla tree. If you've made a change in one, it +# belongs in the other as well. If the change isn't right for both +# places, then that's something to bring up with the other developers. +# +# Some files are reasonable to diverge; for example, +# js/config/autoconf.mk.in doesn't need most of the stuff in +# config/autoconf.mk.in. +check-sync-dirs = $(PYTHON) $(srcdir)/config/check-sync-dirs.py +check:: + $(check-sync-dirs) $(srcdir)/config $(MOZ_SYNC_BUILD_FILES)/config + $(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build +endif + # our build system doesn't handle subdir srcs very gracefully today export:: mkdir -p nanojit @@ -488,6 +512,8 @@ endif jsopcode.h jsopcode.cpp: jsopcode.tbl +export:: jsautocfg.h + ifeq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) jsautocfg.h: touch $@ @@ -548,6 +574,64 @@ jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.cpp Makefile.in endif endif +# Compute the linker flags that programs linking against SpiderMonkey should +# pass to get SpiderMonkey and its dependencies, beyond just the -L and -l +# for the SpiderMonkey library itself. +# - EXTRA_DSO_LDOPTS includes the NSPR -L and -l flags. +# - OS_LIBS includes libraries selected by the configure script. +# - EXTRA_LIBS includes libraries selected by this Makefile. +JS_CONFIG_LIBS=$(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) + +# The configure script invokes this rule explicitly at configure time! +# It's important that js-config be ready by the time we're done +# configuring, because we may be running other configure scripts that +# would like to run js-config themselves, before js is built. +# +# This file and rules.mk go through a certain amount of work to decide +# which libraries to build, what to name them, and what flags to pass +# when linking them (and thus what flags its own clients must pass). +# All this information needs to go into the js-config script. To +# avoid trying to re-compute all that in the configure script, we just +# have the configure script generate this Makefile, and then invoke +# this rule. +at=@ +js-config: js-config.in Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk $(topsrcdir)/config/rules.mk + rm -f js-config.tmp + sed < $< > js-config.tmp \ + -e 's|$(at)prefix$(at)|$(prefix)|' \ + -e 's|$(at)exec_prefix$(at)|$(exec_prefix)|' \ + -e 's|$(at)includedir$(at)|$(includedir)|' \ + -e 's|$(at)libdir$(at)|$(libdir)|' \ + -e 's|$(at)MOZILLA_VERSION$(at)|$(MOZILLA_VERSION)|' \ + -e 's|$(at)LIBRARY_NAME$(at)|$(LIBRARY_NAME)|' \ + -e 's|$(at)NSPR_CFLAGS$(at)|$(NSPR_CFLAGS)|' \ + -e 's|$(at)JS_CONFIG_LIBS$(at)|$(JS_CONFIG_LIBS)|' \ + -e 's|$(at)MOZ_JS_LIBS$(at)|$(MOZ_JS_LIBS)|' \ + && mv js-config.tmp $@ && chmod +x $@ + +SCRIPTS = js-config + +install:: $(INSTALLED_HEADERS) + $(SYSINSTALL) $(IFLAGS1) $^ $(includedir)/$(MODULE) + +install:: $(SCRIPTS) $(PROGRAM) + $(SYSINSTALL) $(IFLAGS2) $^ $(bindir) + +# The Mozilla top-level makefiles use install-runtime-libs directly to +# place an additional copy of the libraries in the 'dist/bin' +# directory. +install:: install-runtime-libs +install-runtime-libs:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) +ifneq (,$(LIBRARY)) + $(SYSINSTALL) $(IFLAGS1) $(LIBRARY) $(libdir) +endif +ifneq (,$(SHARED_LIBRARY)) + $(SYSINSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(libdir) +endif +ifneq (,$(IMPORT_LIBRARY)) + $(SYSINSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir) +endif + # Extra dependancies and rules for auto-generated headers host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl diff --git a/js/src/Makefile.ref b/js/src/Makefile.ref deleted file mode 100644 index 7f0f9c95aaba..000000000000 --- a/js/src/Makefile.ref +++ /dev/null @@ -1,447 +0,0 @@ -# -*- Mode: makefile -*- -# vim: ft=make -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Michael Ang -# Kevin Buhr -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# JSRef GNUmake makefile. -# -# Note: dependency rules are missing for some files (some -# .h, all .msg, etc.) Re-make clean if in doubt. -# - - -DEPTH = . - -include config.mk - -#NS_USE_NATIVE = 1 - -ifndef NANOJIT_ARCH -$(warning NANOJIT_ARCH not defined in config/$(OS_CONFIG).mk, JIT disabled) -else -ifdef DISABLE_JIT -$(warning disabling JIT per build specification) -else -ENABLE_JIT=1 -endif -endif - -ifdef ENABLE_JIT -DEFINES += -DJS_TRACER -DEFINES += -DFEATURE_NANOJIT -INCLUDES += -Inanojit -endif - -#ifndef BUILD_OPT -#DEFINES += -Ivprof -#endif - -ifdef NARCISSUS -DEFINES += -DNARCISSUS -endif - -# Look in OBJDIR to find jsautocfg.h and jsautokw.h -INCLUDES += -I. -I$(OBJDIR) - -ifdef JS_THREADSAFE -DEFINES += -DJS_THREADSAFE -INCLUDES += -I$(DIST)/include/nspr -ifdef USE_MSVC -OTHER_LIBS += $(DIST)/lib/libnspr$(NSPR_LIBSUFFIX).lib -else -OTHER_LIBS += -L$(DIST)/lib -lnspr$(NSPR_LIBSUFFIX) -endif -endif - -ifdef JS_NO_THIN_LOCKS -DEFINES += -DJS_USE_ONLY_NSPR_LOCKS -endif - -ifdef JS_HAS_FILE_OBJECT -DEFINES += -DJS_HAS_FILE_OBJECT -endif - - -# -# XCFLAGS may be set in the environment or on the gmake command line -# -#CFLAGS += -DDEBUG -DDEBUG_brendan -DJS_ARENAMETER -DJS_HASHMETER -DJS_DUMP_PROPTREE_STATS -DJS_DUMP_SCOPE_METERS -DJS_SCOPE_DEPTH_METER -DJS_BASIC_STATS -CFLAGS += $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) - -LDFLAGS = $(XLDFLAGS) -LDFLAGS += $(OS_LDFLAGS) - -ifdef MOZ_SHARK -DEFINES += -DMOZ_SHARK -CFLAGS += -F/System/Library/PrivateFrameworks -LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD -endif -ifdef MOZ_CALLGRIND -DEFINES += -DMOZ_CALLGRIND -endif -ifdef MOZ_VTUNE -DEFINES += -DMOZ_VTUNE -CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include -OTHER_LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib -endif - -ifndef NO_LIBM -LDFLAGS += -lm -endif - -# Prevent floating point errors caused by VC++ optimizations -ifeq ($(OS_ARCH),WINNT) -_MSC_VER = $(shell $(CXX) 2>&1 | sed -n 's/.*Compiler Version \([0-9]*\)\.\([0-9]*\).*/\1\2/p') -ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER))) -CFLAGS += -Op -else -CFLAGS += -fp:precise -endif -endif # WINNT - -# -# Server-related changes : -# -ifdef NES40 -DEFINES += -DNES40 -endif - -# -# Line editing support. -# Define JS_READLINE or JS_EDITLINE to enable line editing in the -# js command-line interpreter. -# -ifdef JS_READLINE -# For those platforms with the readline library installed. -DEFINES += -DEDITLINE -PROG_LIBS += -lreadline -ltermcap -else -ifdef JS_EDITLINE -# Use the editline library, built locally. -PREDIRS += editline -DEFINES += -DEDITLINE -PROG_LIBS += $(OBJDIR)/editline/libedit.a -endif -endif - -# For purify -PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \ - $(INCLUDES) $(XCFLAGS) - -# -# JS file lists -# -JS_HFILES = \ - jsarray.h \ - jsatom.h \ - jsbool.h \ - jscntxt.h \ - jsdate.h \ - jsemit.h \ - jsexn.h \ - jsfun.h \ - jsgc.h \ - jsinterp.h \ - jsiter.h \ - jslibmath.h \ - jslock.h \ - jsmath.h \ - jsnum.h \ - jsobj.h \ - json.h \ - jsopcode.h \ - jsparse.h \ - jsarena.h \ - jsclist.h \ - jsdhash.h \ - jsdtoa.h \ - jshash.h \ - jslong.h \ - jstypes.h \ - jsprvtd.h \ - jspubtd.h \ - jsregexp.h \ - jsscan.h \ - jsscope.h \ - jsscript.h \ - jsstr.h \ - jsversion.h \ - jsxdrapi.h \ - jsxml.h \ - $(NULL) - -ifdef ENABLE_JIT -JS_HFILES += \ - jstracer.h \ - nanojit/Assembler.h \ - nanojit/LIR.h \ - nanojit/Native$(NANOJIT_ARCH).h \ - nanojit/avmplus.h \ - nanojit/vm_fops.h \ - nanojit/Fragmento.h \ - nanojit/Native.h \ - nanojit/RegAlloc.h \ - nanojit/nanojit.h \ - nanojit/TraceTreeDrawer.h \ - $(NULL) -endif - -ifndef BUILD_OPT -#JS_HFILES += \ -# vprof/vprof.h \ -# $(NULL) -endif - -API_HFILES = \ - jsapi.h \ - jsdbgapi.h \ - $(NULL) - -OTHER_HFILES = \ - jsbit.h \ - jscompat.h \ - jscpucfg.h \ - jsotypes.h \ - jsstddef.h \ - prmjtime.h \ - resource.h \ - jsopcode.tbl \ - jsproto.tbl \ - js.msg \ - jsshell.msg \ - jskeyword.tbl \ - $(NULL) - -ifdef ENABLE_JIT -OTHER_HFILES += builtins.tbl -endif - -ifndef PREBUILT_CPUCFG -OTHER_HFILES += $(OBJDIR)/jsautocfg.h -endif -OTHER_HFILES += $(OBJDIR)/jsautokw.h - -HFILES = $(JS_HFILES) $(API_HFILES) $(OTHER_HFILES) - -JS_CPPFILES = \ - jsapi.cpp \ - jsarena.cpp \ - jsarray.cpp \ - jsatom.cpp \ - jsbool.cpp \ - jscntxt.cpp \ - jsdate.cpp \ - jsdbgapi.cpp \ - jsdhash.cpp \ - jsdtoa.cpp \ - jsemit.cpp \ - jsexn.cpp \ - jsfun.cpp \ - jsgc.cpp \ - jshash.cpp \ - jsinterp.cpp \ - jsinvoke.cpp \ - jsiter.cpp \ - jslock.cpp \ - jslog2.cpp \ - jslong.cpp \ - jsmath.cpp \ - jsnum.cpp \ - jsobj.cpp \ - json.cpp \ - jsopcode.cpp \ - jsparse.cpp \ - jsprf.cpp \ - jsregexp.cpp \ - jsscan.cpp \ - jsscope.cpp \ - jsscript.cpp \ - jsstr.cpp \ - jsutil.cpp \ - jsxdrapi.cpp \ - jsxml.cpp \ - prmjtime.cpp \ - $(NULL) - -ifdef ENABLE_JIT -JS_CPPFILES += \ - jsbuiltins.cpp \ - jstracer.cpp \ - nanojit/Assembler.cpp \ - nanojit/Fragmento.cpp \ - nanojit/LIR.cpp \ - nanojit/Native$(NANOJIT_ARCH).cpp \ - nanojit/RegAlloc.cpp \ - nanojit/avmplus.cpp \ - $(NULL) - -ifdef DEBUG -JS_CPPFILES += nanojit/TraceTreeDrawer.cpp -endif -endif - -ifndef BUILD_OPT -#JS_CPPFILES += \ -# vprof/vprof.cpp \ -# $(NULL) -endif - -ifdef JS_LIVECONNECT -DIRS += liveconnect -endif - -ifdef JS_HAS_FILE_OBJECT -JS_CPPFILES += jsfile.cpp -JS_HFILES += jsfile.h -endif - -LIB_CPPFILES = $(JS_CPPFILES) -LIB_ASFILES := $(wildcard *_$(OS_ARCH).s) -PROG_CPPFILES = js.cpp - -ifdef USE_MSVC -LIBRARY = $(OBJDIR)/js32.lib -SHARED_LIBRARY = $(OBJDIR)/js32.dll -PROGRAM = $(OBJDIR)/js.exe -else -LIBRARY = $(OBJDIR)/libjs.a -SHARED_LIBRARY = $(OBJDIR)/libjs.$(SO_SUFFIX) -PROGRAM = $(OBJDIR)/js -endif - -include rules.mk - -MOZ_DEPTH = ../.. -include jsconfig.mk - -nsinstall-target: - cd ../../config; $(MAKE) OBJDIR=$(OBJDIR) OBJDIR_NAME=$(OBJDIR) - -# -# Automatic header generation -# - -AUTO_HEADERS = $(OBJDIR)/jsautokw.h $(OBJDIR)/jsautooplen.h - -$(OBJDIR)/jsautokw.h: jskeyword.tbl - -$(OBJDIR)/jsautooplen.h: jsopcode.tbl - -GARBAGE += $(AUTO_HEADERS) -GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen$(HOST_BIN_SUFFIX)) - -ifdef USE_MSVC - -GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.obj) - -$(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(OPTIMIZER) $< - link.exe -out:"$(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX)" $(EXE_LINK_FLAGS) $(OBJDIR)/js$*gen.obj - $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@ -else - -GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.d) -$(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp - @$(MAKE_OBJDIR) - $(CXX) -o $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $(CFLAGS) $(OPTIMIZER) $(LDFLAGS) $< - $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@ - -endif - -# force creation of autoheaders before compiling any source that may use them -$(LIB_OBJS) : $(AUTO_HEADERS) - -# -# JS shell executable -# - -ifdef USE_MSVC -$(PROGRAM): $(PROG_OBJS) $(LIBRARY) - link.exe -out:"$@" $(EXE_LINK_FLAGS) $^ -else -$(PROGRAM): $(PROG_OBJS) $(LIBRARY) - $(CXX) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \ - $(PROG_LIBS) -endif - -$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY) - purify $(PUREFLAGS) \ - $(CXX) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \ - $(OTHER_LIBS) $(PROG_LIBS) - -ifndef PREBUILT_CPUCFG -$(filter-out jscpucfg.h $(OBJDIR)/jsautocfg.h, $(HFILES)) $(CPPFILES): $(OBJDIR)/jsautocfg.h - -$(OBJDIR)/jsautocfg.h: $(OBJDIR)/jscpucfg - rm -f $@ - $(OBJDIR)/jscpucfg > $@ - -$(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o - $(CXX) $(OS_LDFLAGS) -o $@ $(OBJDIR)/jscpucfg.o - -GARBAGE += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \ - $(OBJDIR)/jscpucfg.o $(OBJDIR)/jscpucfg.d -endif - -# Automatic make dependencies files -DEPENDENCIES = $(CPPFILES:%.cpp=$(OBJDIR)/%.d) - -# -# Hardwire dependencies for some files -# -ifdef USE_MSVC -OBJ=obj -else -OBJ=o -endif - -$(OBJDIR)/jsinvoke.$(OBJ): jsinterp.h jsinterp.cpp -$(OBJDIR)/jsinvoke.obj : jsinterp.h jsinterp.cpp - --include $(DEPENDENCIES) - -TARNAME = jsref.tar -TARFILES = files `cat files` - -SUFFIXES: .i -%.i: %.cpp - $(CXX) -C -E $(CFLAGS) $< > $*.i diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4 new file mode 100644 index 000000000000..750ed2e9be65 --- /dev/null +++ b/js/src/aclocal.m4 @@ -0,0 +1,10 @@ +dnl +dnl Local autoconf macros used with mozilla +dnl The contents of this file are under the Public Domain. +dnl + +builtin(include, build/autoconf/glib.m4)dnl +builtin(include, build/autoconf/pkg.m4)dnl +builtin(include, build/autoconf/nspr.m4)dnl +builtin(include, build/autoconf/altoptions.m4)dnl + diff --git a/js/src/build/autoconf/acoutput-fast.pl b/js/src/build/autoconf/acoutput-fast.pl new file mode 100644 index 000000000000..973dd867a3de --- /dev/null +++ b/js/src/build/autoconf/acoutput-fast.pl @@ -0,0 +1,202 @@ +#! /usr/bin/env perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1999 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# acoutput-fast.pl - Quickly create makefiles that are in a common format. +# +# Most of the makefiles in mozilla only refer to two configure variables: +# @srcdir@ +# @top_srcdir@ +# However, configure does not know any better and it runs sed on each file +# with over 150 replacement rules (slow as molasses). +# +# This script takes a list of makefiles as input. For example, +# +# echo $MAKEFILES | acoutput-fast.pl +# +# The script creates each Makefile that only references @srcdir@ and +# @top_srcdir@. For other files, it lists them in a shell command that is +# printed to stdout: +# +# CONFIG_FILES="unhandled_files..."; export CONFIG_FILES +# +# This command can be used to have config.status create the unhandled +# files. For example, +# +# eval "echo $MAKEFILES | acoutput-fast.pl" +# AC_OUTPUT($MAKEFILES) +# +# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). + +#use File::Basename; +sub dirname { + my $dir = $_[0]; + return '.' if not $dir =~ m%/%; + $dir =~ s%/[^/][^/]*$%%; + return $dir; +} + +# Create one directory. Assumes it doesn't already exist. +# Will create parent(s) if needed. +sub create_directory { + my $dir = $_[0]; + my $parent = dirname($dir); + create_directory($parent) if not -d $parent; + mkdir "$dir",0777; +} + +# Create all the directories at once. +# This can be much faster than calling mkdir() for each one. +sub create_directories { + my @makefiles = @_; + my @dirs = (); + my $ac_file; + foreach $ac_file (@makefiles) { + push @dirs, dirname($ac_file); + } + # Call mkdir with the directories sorted by subdir count (how many /'s) + if (@dirs) { + foreach $dir (@dirs) { + if (not -d $dir) { + print STDERR "Creating directory $dir\n"; + create_directory($dir); + } + } + } +} + +while($arg = shift) { + if ($arg =~ /^--srcdir=/) { + $ac_given_srcdir = (split /=/, $arg)[1]; + } + if ($arg =~ /^--cygwin-srcdir/) { + $ac_cygwin_srcdir = (split /=/, $arg)[1]; + } +} + +if (!$ac_given_srcdir) { + $ac_given_srcdir = $0; + $ac_given_srcdir =~ s|/?build/autoconf/.*$||; + $ac_given_srcdir = '.' if $ac_given_srcdir eq ''; +} + +if (!$ac_cygwin_srcdir) { + $ac_cygwin_srcdir = $ac_given_srcdir; +} + +# Read list of makefiles from the stdin or, +# from files listed on the command-line. +# +@makefiles=(); +push @makefiles, split while (); + +# Create all the directories at once. +# This can be much faster than calling mkdir() for each one. +create_directories(@makefiles); + +# Output the makefiles. +# +@unhandled=(); +foreach $ac_file (@makefiles) { + if (not $ac_file =~ /Makefile$/ or $ac_file =~ /:/) { + push @unhandled, $ac_file; + next; + } + $ac_file_in = "$ac_given_srcdir/$ac_file.in"; + $ac_dir = dirname($ac_file); + if ($ac_dir eq '.') { + $ac_dir_suffix = ''; + $ac_dots = ''; + } else { + $ac_dir_suffix = "/$ac_dir"; + $ac_dir_suffix =~ s%^/\./%/%; + $ac_dots = $ac_dir_suffix; + $ac_dots =~ s%/[^/]*%../%g; + } + if ($ac_given_srcdir eq '.') { + $srcdir = '.'; + if ($ac_dots eq '') { + $top_srcdir = '.' + } else { + $top_srcdir = $ac_dots; + $top_srcdir =~ s%/$%%; + } + } elsif ($ac_cygwin_srcdir =~ m%^/% or $ac_cygwin_srcdir =~ m%^.:/%) { + $srcdir = "$ac_cygwin_srcdir$ac_dir_suffix"; + $top_srcdir = "$ac_cygwin_srcdir"; + } else { + $srcdir = "$ac_dots$ac_cygwin_srcdir$ac_dir_suffix"; + $top_srcdir = "$ac_dots$ac_cygwin_srcdir"; + } + + if (-e $ac_file) { + next if -M _ < -M $ac_file_in; + print STDERR "updating $ac_file\n"; + } else { + print STDERR "creating $ac_file\n"; + } + + open (INFILE, "<$ac_file_in") + or ( warn "can't read $ac_file_in: No such file or directory\n" and next); + open (OUTFILE, ">$ac_file") + or ( warn "Unable to create $ac_file\n" and next); + + while () { + #if (/\@[_a-zA-Z]*\@.*\@[_a-zA-Z]*\@/) { + # warn "Two defines on a line:$ac_file:$.:$_"; + # push @unhandled, $ac_file; + # last; + #} + + s/\@srcdir\@/$srcdir/g; + s/\@top_srcdir\@/$top_srcdir/g; + + if (/\@[_a-zA-Z]*\@/) { + warn "Unknown variable:$ac_file:$.:$_"; + push @unhandled, $ac_file; + last; + } + print OUTFILE; + } + close INFILE; + close OUTFILE; +} + +# Print the shell command to be evaluated by configure. +# +print "CONFIG_FILES=\"".join(' ', @unhandled)."\"; export CONFIG_FILES\n"; + diff --git a/js/src/build/autoconf/altoptions.m4 b/js/src/build/autoconf/altoptions.m4 new file mode 100644 index 000000000000..f9db0a539e25 --- /dev/null +++ b/js/src/build/autoconf/altoptions.m4 @@ -0,0 +1,154 @@ +dnl ***** BEGIN LICENSE BLOCK ***** +dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1 +dnl +dnl The contents of this file are subject to the Mozilla Public License Version +dnl 1.1 (the "License"); you may not use this file except in compliance with +dnl the License. You may obtain a copy of the License at +dnl http://www.mozilla.org/MPL/ +dnl +dnl Software distributed under the License is distributed on an "AS IS" basis, +dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +dnl for the specific language governing rights and limitations under the +dnl License. +dnl +dnl The Original Code is mozilla.org code. +dnl +dnl The Initial Developer of the Original Code is +dnl Netscape Communications Corporation. +dnl Portions created by the Initial Developer are Copyright (C) 1999 +dnl the Initial Developer. All Rights Reserved. +dnl +dnl Contributor(s): +dnl +dnl Alternatively, the contents of this file may be used under the terms of +dnl either of the GNU General Public License Version 2 or later (the "GPL"), +dnl or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +dnl in which case the provisions of the GPL or the LGPL are applicable instead +dnl of those above. If you wish to allow use of your version of this file only +dnl under the terms of either the GPL or the LGPL, and not to allow others to +dnl use your version of this file under the terms of the MPL, indicate your +dnl decision by deleting the provisions above and replace them with the notice +dnl and other provisions required by the GPL or the LGPL. If you do not delete +dnl the provisions above, a recipient may use your version of this file under +dnl the terms of any one of the MPL, the GPL or the LGPL. +dnl +dnl ***** END LICENSE BLOCK ***** + +dnl altoptions.m4 - An alternative way of specifying command-line options. +dnl These macros are needed to support a menu-based configurator. +dnl This file also includes the macro, AM_READ_MYCONFIG, for reading +dnl the 'myconfig.m4' file. + +dnl Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). + + +dnl MOZ_ARG_ENABLE_BOOL( NAME, HELP, IF-YES [, IF-NO [, ELSE]]) +dnl MOZ_ARG_DISABLE_BOOL( NAME, HELP, IF-NO [, IF-YES [, ELSE]]) +dnl MOZ_ARG_ENABLE_STRING( NAME, HELP, IF-SET [, ELSE]) +dnl MOZ_ARG_ENABLE_BOOL_OR_STRING( NAME, HELP, IF-YES, IF-NO, IF-SET[, ELSE]]]) +dnl MOZ_ARG_WITH_BOOL( NAME, HELP, IF-YES [, IF-NO [, ELSE]) +dnl MOZ_ARG_WITHOUT_BOOL( NAME, HELP, IF-NO [, IF-YES [, ELSE]) +dnl MOZ_ARG_WITH_STRING( NAME, HELP, IF-SET [, ELSE]) +dnl MOZ_ARG_HEADER(Comment) +dnl MOZ_CHECK_PTHREADS( NAME, IF-YES [, ELSE ]) +dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file + + +dnl MOZ_TWO_STRING_TEST(NAME, VAL, STR1, IF-STR1, STR2, IF-STR2 [, ELSE]) +AC_DEFUN([MOZ_TWO_STRING_TEST], +[if test "[$2]" = "[$3]"; then + ifelse([$4], , :, [$4]) + elif test "[$2]" = "[$5]"; then + ifelse([$6], , :, [$6]) + else + ifelse([$7], , + [AC_MSG_ERROR([Option, [$1], does not take an argument ([$2]).])], + [$7]) + fi]) + +dnl MOZ_ARG_ENABLE_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE]]) +AC_DEFUN([MOZ_ARG_ENABLE_BOOL], +[AC_ARG_ENABLE([$1], [$2], + [MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4])], + [$5])]) + +dnl MOZ_ARG_DISABLE_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE]]) +AC_DEFUN([MOZ_ARG_DISABLE_BOOL], +[AC_ARG_ENABLE([$1], [$2], + [MOZ_TWO_STRING_TEST([$1], [$enableval], no, [$3], yes, [$4])], + [$5])]) + +dnl MOZ_ARG_ENABLE_STRING(NAME, HELP, IF-SET [, ELSE]) +AC_DEFUN([MOZ_ARG_ENABLE_STRING], +[AC_ARG_ENABLE([$1], [$2], [$3], [$4])]) + +dnl MOZ_ARG_ENABLE_BOOL_OR_STRING(NAME, HELP, IF-YES, IF-NO, IF-SET[, ELSE]]]) +AC_DEFUN([MOZ_ARG_ENABLE_BOOL_OR_STRING], +[ifelse([$5], , + [errprint([Option, $1, needs an "IF-SET" argument. +]) + m4exit(1)], + [AC_ARG_ENABLE([$1], [$2], + [MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4], [$5])], + [$6])])]) + +dnl MOZ_ARG_WITH_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE]) +AC_DEFUN([MOZ_ARG_WITH_BOOL], +[AC_ARG_WITH([$1], [$2], + [MOZ_TWO_STRING_TEST([$1], [$withval], yes, [$3], no, [$4])], + [$5])]) + +dnl MOZ_ARG_WITHOUT_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE]) +AC_DEFUN([MOZ_ARG_WITHOUT_BOOL], +[AC_ARG_WITH([$1], [$2], + [MOZ_TWO_STRING_TEST([$1], [$withval], no, [$3], yes, [$4])], + [$5])]) + +dnl MOZ_ARG_WITH_STRING(NAME, HELP, IF-SET [, ELSE]) +AC_DEFUN([MOZ_ARG_WITH_STRING], +[AC_ARG_WITH([$1], [$2], [$3], [$4])]) + +dnl MOZ_ARG_HEADER(Comment) +dnl This is used by webconfig to group options +define(MOZ_ARG_HEADER, [# $1]) + +dnl +dnl Apparently, some systems cannot properly check for the pthread +dnl library unless is included so we need to test +dnl using it +dnl +dnl MOZ_CHECK_PTHREADS(lib, success, failure) +AC_DEFUN([MOZ_CHECK_PTHREADS], +[ +AC_MSG_CHECKING([for pthread_create in -l$1]) +echo " + #include + #include + void *foo(void *v) { int a = 1; } + int main() { + pthread_t t; + if (!pthread_create(&t, 0, &foo, 0)) { + pthread_join(t, 0); + } + exit(0); + }" > dummy.c ; + echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5; + ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5; + _res=$? ; + rm -f dummy.c dummy${ac_exeext} ; + if test "$_res" = "0"; then + AC_MSG_RESULT([yes]) + [$2] + else + AC_MSG_RESULT([no]) + [$3] + fi +]) + +dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file +AC_DEFUN([MOZ_READ_MOZCONFIG], +[AC_REQUIRE([AC_INIT_BINSH])dnl +# Read in '.mozconfig' script to set the initial options. +# See the mozconfig2configure script for more details. +_AUTOCONF_TOOLS_DIR=`dirname [$]0`/[$1]/build/autoconf +. $_AUTOCONF_TOOLS_DIR/mozconfig2configure]) diff --git a/js/src/build/autoconf/config.guess b/js/src/build/autoconf/config.guess new file mode 100644 index 000000000000..a20b311747fe --- /dev/null +++ b/js/src/build/autoconf/config.guess @@ -0,0 +1,1481 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-10-13' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; +#### MozillaHack +# Netscape's hacked uname + xx:WINNT:* | xx:WIN95:*) + echo i586-pc-msvc + exit ;; +### End MozillaHack + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; +#### MozillaHack + *:*OpenVMS*:*:*) + case "${UNAME_SYSTEM}" in + POSIX_for_OpenVMS_AXP) echo alpha-dec-openvmsposix ;; + POSIX_for_OpenVMS_VAX) echo vax-dec-openvmsposix ;; + OpenVMS) echo alpha-dec-openvms ;; + *) echo unknown-dec-openvms ;; + esac + exit ;; +#### End MozillaHack + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/js/src/build/autoconf/config.sub b/js/src/build/autoconf/config.sub new file mode 100644 index 000000000000..2d91b11c7f30 --- /dev/null +++ b/js/src/build/autoconf/config.sub @@ -0,0 +1,1595 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-10-13' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. +#### MozillaHack +# mips*el +#### End MozillaHack + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | mips | mipsbe | mipseb | mips*el | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ms1 \ + | msp430 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m32c) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. +#### MozillaHack +# mips*el +#### End MozillaHack + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mips*el-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | ms1-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + m32c-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; +#### MozillaHack + i386-msvc | msvc) + basic_machine=i386-pc + os=-msvc + ;; +#### End MozillaHack + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. +#### MozillaHack +# msvc +#### End MozillaHack + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -msvc* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/js/src/build/autoconf/glib.m4 b/js/src/build/autoconf/glib.m4 new file mode 100644 index 000000000000..8552155095a7 --- /dev/null +++ b/js/src/build/autoconf/glib.m4 @@ -0,0 +1,200 @@ +# Configure paths for GLIB +# Owen Taylor 97-11-3 + +dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or +dnl gthread is specified in MODULES, pass to glib-config +dnl +AC_DEFUN([AM_PATH_GLIB], +[dnl +dnl Get the cflags and libraries from the glib-config script +dnl +AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)], + glib_config_prefix="$withval", glib_config_prefix="") +AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX + Exec prefix where GLIB is installed (optional)], + glib_config_exec_prefix="$withval", glib_config_exec_prefix="") +AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program], + , enable_glibtest=yes) + + if test x$glib_config_exec_prefix != x ; then + glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix" + if test x${GLIB_CONFIG+set} != xset ; then + GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config + fi + fi + if test x$glib_config_prefix != x ; then + glib_config_args="$glib_config_args --prefix=$glib_config_prefix" + if test x${GLIB_CONFIG+set} != xset ; then + GLIB_CONFIG=$glib_config_prefix/bin/glib-config + fi + fi + + for module in . $4 + do + case "$module" in + gmodule) + glib_config_args="$glib_config_args gmodule" + ;; + gthread) + glib_config_args="$glib_config_args gthread" + ;; + esac + done + + dnl Force a version check to keep upgraded versions from being overridden by the cached value. + unset ac_cv_path_GLIB_CONFIG + + AC_PATH_PROG(GLIB_CONFIG, glib-config, no) + min_glib_version=ifelse([$1], ,0.99.7,$1) + AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) + no_glib="" + if test "$GLIB_CONFIG" = "no" ; then + no_glib=yes + else + GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` + GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` + glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" +dnl +dnl Now check if the installed GLIB is sufficiently new. (Also sanity +dnl checks the results of glib-config to some extent +dnl + rm -f conf.glibtest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.glibtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If glib-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH environment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); + printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the glib-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); + printf("*** correct copy of glib-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GLIB_CONFIG" = "no" ; then + echo "*** The glib-config script installed by GLIB could not be found" + echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GLIB_CONFIG environment variable to the" + echo "*** full path to glib-config." + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB was incorrectly installed" + echo "*** or that you have moved GLIB since it was installed. In the latter case, you" + echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + rm -f conf.glibtest +]) diff --git a/js/src/build/autoconf/install-sh b/js/src/build/autoconf/install-sh new file mode 100644 index 000000000000..0ff4b6a08e80 --- /dev/null +++ b/js/src/build/autoconf/install-sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# install - install a program, script, or datafile +# This comes from X11R5; it is not part of GNU. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +instcmd="$mvprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +fi + +if [ x"$dst" = x ] +then + echo "install: no destination specified" + exit 1 +fi + + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + +if [ -d $dst ] +then + dst="$dst"/`basename $src` +fi + +# Make a temp file name in the proper directory. + +dstdir=`dirname $dst` +dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + +$doit $instcmd $src $dsttmp + +# and set any options; do chmod last to preserve setuid bits + +if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. + +$doit $rmcmd $dst +$doit $mvcmd $dsttmp $dst + + +exit 0 diff --git a/js/src/build/autoconf/make-makefile b/js/src/build/autoconf/make-makefile new file mode 100644 index 000000000000..5343f6f2a3b3 --- /dev/null +++ b/js/src/build/autoconf/make-makefile @@ -0,0 +1,315 @@ +#! /usr/bin/env perl +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1999 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# make-makefiles - Quickly create Makefiles for subdirectories. +# Also, creates any needed subdirectories. +# +# usage: make-makefiles [ -t -p -d ] [ | /Makefile ] ... + +# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). + +#$debug = 1; + +# Determine various tree path variables +# +($topsrcdir, $ptopsrcdir, $depth, @makefiles) = parse_arguments(@ARGV); + +$object_fullpath = `pwd`; +chdir $depth; +$object_root = `pwd`; +chomp $object_fullpath; +chomp $object_root; + +# $source_subdir is the path from the object root to where +# 'make-makefile' was called. For example, if make-makefile was +# called from "mozilla/gfx/src", then $source_subdir would be +# "gfx/src/". +$source_subdir = "$object_fullpath/"; +my $quoted_object_root = quotemeta($object_root); +$source_subdir =~ s|^$quoted_object_root/||; + +# Prefix makefiles with $source_subdir so that paths +# will be relative to the top of the object tree. +# +for $makefile (@makefiles) { + $makefile = "$source_subdir$makefile"; +} + +create_directories(@makefiles); + +# Find the path to the source directory based on how 'make-makefile' +# was invoked. The path is either relative to the object directory +# or an absolute path. +$given_srcdir = find_srcdir($topsrcdir, $depth); +$pgiven_srcdir = find_srcdir($ptopsrcdir, $depth); + +if ($debug) { + warn "object_fullpath = $object_fullpath\n"; + warn "object_root = $object_root\n"; + warn "source_subdir = $source_subdir\n"; + warn "makefiles = @makefiles\n"; + warn "given_srcdir = $given_srcdir\n"; +} + +@unhandled = update_makefiles($given_srcdir, $pgiven_srcdir, @makefiles); + +run_config_status(@unhandled); + +# end of Main +############################################################ + +sub dirname { + return $_[0] =~ /(.*)\/.*/ ? "$1" : '.'; +} + +# find_depth: Pull the value of DEPTH out of a Makefile (or Makefile.in) +sub find_depth { + my $depth = ''; + open(MAKEFILE, "<$_[0]") || die "Unable to open $_[0]: $!\n"; + while () { + next unless /^DEPTH\s*=\s*(\..*)/; + $depth = $1; + last; + } + close MAKEFILE; + return $depth; +} + +sub parse_arguments { + my @args = @_; + my $depth = ''; + my $topsrcdir = ''; + my $ptopsrcdir; + my @makefiles = (); + + while (1) { + if ($args[0] eq '-d') { + $depth = $args[1]; + shift @args; + shift @args; + } elsif ($args[0] eq '-t') { + $topsrcdir = $args[1]; + shift @args; + shift @args; + } elsif ($args[0] eq '-p') { + $ptopsrcdir = $args[1]; + shift @args; + shift @args; + } else { + last; + } + } + + if ($topsrcdir eq '') { + $topsrcdir = $0; # Figure out topsrcdir based on program name. + $topsrcdir =~ s|/?build/autoconf/.*$||; + } + if ($ptopsrcdir eq '') { + $ptopsrcdir = $topsrcdir; + } + if ($depth eq '') { + # Use $(DEPTH) in the Makefile or Makefile.in to determine the depth + if (-e "Makefile.in") { + $depth = find_depth("Makefile.in"); + } elsif (-e "Makefile") { + $depth = find_depth("Makefile"); + } elsif (-e "../Makefile") { + $depth = "../".find_depth("../Makefile"); + $depth =~ s/\/\.$//; + } else { + warn "Unable to determine depth (e.g. ../..) to root of objdir tree.\n"; + die "No Makefile(.in) present. Try running with '-d '\n"; + } + } + + # Build the list of makefiles to generate + # + @makefiles = (); + my $makefile; + foreach $makefile (@args) { + $makefile =~ s/\.in$//; + $makefile =~ s/\/$//; + $makefile =~ /Makefile$/ or $makefile .= "/Makefile"; + push @makefiles, "$makefile"; + } + @makefiles = "Makefile" unless @args; + + return ($topsrcdir, $ptopsrcdir, $depth, @makefiles); +} + + +# Create all the directories at once. +# This can be much faster than calling mkdir() for each one. +sub create_directories { + my @makefiles = @_; + my @dirs = (); + my $ac_file; + foreach $ac_file (@makefiles) { + push @dirs, dirname($ac_file); + } + # Call mkdir with the directories sorted by subdir count (how many /'s) + system "mkdir -p ". join(' ', map("\"$_\"", @dirs)) if @dirs; +} + +# Find the top of the source directory +# (Assuming that the executable is in $top_srcdir/build/autoconf) +sub find_srcdir { + my ($ac_given_srcdir, $depth) = @_; + + if ($debug) { + print "ac_given_srcdir = $ac_given_srcdir\n"; + print "depth = $depth\n"; + } + if ($ac_given_srcdir =~ /^\./ and $depth ne '.') { + my $quoted_depth = quotemeta($depth); + $ac_given_srcdir =~ s|^$quoted_depth/?||; + } + if ($debug) { + print "ac_given_srcdir = $ac_given_srcdir\n"; + } + $ac_given_srcdir = '.' if $ac_given_srcdir eq ''; + return $ac_given_srcdir; +} + +# Output the makefiles. +# +sub update_makefiles { + my ($ac_given_srcdir, $pac_given_srcdir, @makefiles) = @_; + my @unhandled=(); + + my $ac_file; + foreach $ac_file (@makefiles) { + my $ac_file_in = "$ac_given_srcdir/${ac_file}.in"; + my $ac_dir = dirname($ac_file); + my $ac_dots = ''; + my $ac_dir_suffix = ''; + my $srcdir = '.'; + my $top_srcdir = '.'; + + # Determine $srcdir and $top_srcdir + # + if ($ac_dir ne '.') { + $ac_dir_suffix = "/$ac_dir"; + $ac_dir_suffix =~ s%^/\./%/%; + $ac_dots = $ac_dir_suffix; + # Remove .. components from the provided dir suffix, and + # also the forward path components they were reversing. + my $backtracks = $ac_dots =~ s%\.\.(/|$)%%g; + while ($backtracks--) { + $ac_dots =~ s%/[^/]*%%; + } + $ac_dots =~ s%/[^/]*%../%g; + } + if ($ac_given_srcdir eq '.') { + if ($ac_dots ne '') { + $top_srcdir = $ac_dots; + $top_srcdir =~ s%/$%%; + } + } elsif ($pac_given_srcdir =~ m%^/% or $pac_given_srcdir =~ m%^.:/%) { + $srcdir = "$pac_given_srcdir$ac_dir_suffix"; + $top_srcdir = "$pac_given_srcdir"; + } else { + if ($debug) { + print "ac_dots = $ac_dots\n"; + print "ac_dir_suffix = $ac_dir_suffix\n"; + } + $srcdir = "$ac_dots$ac_given_srcdir$ac_dir_suffix"; + $top_srcdir = "$ac_dots$ac_given_srcdir"; + } + + if ($debug) { + print "ac_dir = $ac_dir\n"; + print "ac_file = $ac_file\n"; + print "ac_file_in = $ac_file_in\n"; + print "srcdir = $srcdir\n"; + print "top_srcdir = $top_srcdir\n"; + print "cwd = " . `pwd` . "\n"; + } + + # Copy the file and make substitutions. + # @srcdir@ -> value of $srcdir + # @top_srcdir@ -> value of $top_srcdir + # + if (-e $ac_file) { + next if -M _ < -M $ac_file_in; # Next if Makefile is up-to-date. + warn "updating $ac_file\n"; + } else { + warn "creating $ac_file\n"; + } + + open INFILE, "<$ac_file_in" or do { + warn "$0: Cannot read $ac_file_in: No such file or directory\n"; + next; + }; + open OUTFILE, ">$ac_file" or do { + warn "$0: Unable to create $ac_file\n"; + next; + }; + + while () { + #if (/\@[_a-zA-Z]*\@.*\@[_a-zA-Z]*\@/) { + # #warn "Two defines on a line:$ac_file:$.:$_"; + # push @unhandled, $ac_file; + # last; + #} + + s/\@srcdir\@/$srcdir/g; + s/\@top_srcdir\@/$top_srcdir/g; + + if (/\@[_a-zA-Z]*\@/) { + #warn "Unknown variable:$ac_file:$.:$_"; + push @unhandled, $ac_file; + last; + } + print OUTFILE; + } + close INFILE; + close OUTFILE; + } + return @unhandled; +} + +sub run_config_status { + my @unhandled = @_; + + # Run config.status with any unhandled files. + # + if (@unhandled) { + $ENV{CONFIG_FILES}= join ' ', @unhandled; + system "./config.status"; + } +} diff --git a/js/src/config/SunOS5.5.mk b/js/src/build/autoconf/match-dir.sh similarity index 57% rename from js/src/config/SunOS5.5.mk rename to js/src/build/autoconf/match-dir.sh index e26b3a3e0ec1..c579a9d3a718 100644 --- a/js/src/config/SunOS5.5.mk +++ b/js/src/build/autoconf/match-dir.sh @@ -1,4 +1,4 @@ -# -*- Mode: makefile -*- +#!/bin/sh # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +13,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -24,8 +23,8 @@ # Contributor(s): # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -38,50 +37,65 @@ # ***** END LICENSE BLOCK ***** # -# Config stuff for SunOS5.5 +# This script will match a dir with a set of dirs. # +# Usage: match-dir.sh match [dir1 dir2 ... dirn] +# +# Send comments, improvements, bugs to ramiro@netscape.com +# -AS = /usr/ccs/bin/as -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format +if [ -f Makefile ]; then + MAKEFILE="Makefile" else -CC = cc -CCC = CC -endif + if [ -f Makefile.in ]; then + MAKEFILE="Makefile.in" + else + echo + echo "There ain't no 'Makefile' or 'Makefile.in' over here: $pwd, dude." + echo + exit 1 + fi +fi -RANLIB = echo +# Use DEPTH in the Makefile.in to determine the depth +depth=`grep -w DEPTH ${MAKEFILE} | grep "\.\." | awk -F"=" '{ print $2; }'` +cwd=`pwd` -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< +# Determine the depth count +n=`echo $depth | tr '/' ' ' | wc -w` -CPU_ARCH = sparc -GFX_ARCH = x +cd $depth +objdir=`pwd` -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl +path=`echo $cwd | sed "s|^${objdir}/||"` -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 +match=$path -HAVE_PURIFY = 1 +for i in $* +do +# echo "Looking for $match in $i" -NOSUCHFILE = /solaris-rm-f-sucks + echo $i | grep -q -x $match -ifeq ($(OS_CPUARCH),sun4u) # ultra sparc? -ifeq ($(CC),gcc) # using gcc? -ifndef JS_NO_ULTRA # do we want ultra? -ifdef JS_THREADSAFE # only in thread-safe mode -DEFINES += -DULTRA_SPARC -DEFINES += -Wa,-xarch=v8plus,-DULTRA_SPARC -else -ASFLAGS += -xarch=v8plus -DULTRA_SPARC -endif -endif -endif -endif + if [ $? -eq 0 ] + then + echo "1" -MKSHLIB = $(LD) -G + exit 0 + fi -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 +# echo "Looking for $i in $match" + + echo $match | grep -q $i + + if [ $? -eq 0 ] + then + echo "1" + + exit 0 + fi +done + +echo "0" + +exit 0 diff --git a/js/src/build/autoconf/nspr.m4 b/js/src/build/autoconf/nspr.m4 new file mode 100644 index 000000000000..d21df69783e6 --- /dev/null +++ b/js/src/build/autoconf/nspr.m4 @@ -0,0 +1,82 @@ +# -*- tab-width: 4; -*- +# Configure paths for NSPR +# Public domain - Chris Seawood 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/js/src/build/autoconf/pkg.m4 b/js/src/build/autoconf/pkg.m4 new file mode 100644 index 000000000000..d84d21008892 --- /dev/null +++ b/js/src/build/autoconf/pkg.m4 @@ -0,0 +1,59 @@ +# PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +# defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +# also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], +[succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + ## Remove evil flags like -Wl,--export-dynamic + $1_LIBS="`$PKG_CONFIG --libs \"$2\" |sed s/-Wl,--export-dynamic//g`" + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + if test "$COMPILE_ENVIRONMENT"; then + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi + fi +]) + + diff --git a/js/src/build/autoconf/update-makefile.sh b/js/src/build/autoconf/update-makefile.sh new file mode 100644 index 000000000000..42f78eb3db21 --- /dev/null +++ b/js/src/build/autoconf/update-makefile.sh @@ -0,0 +1,118 @@ +#!/bin/sh +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# This script will generate a single Makefile from a Makefile.in using +# the config.status script. +# +# The config.status script is generated the first time you run +# ./configure. +# +# +# Usage: update-makefile.sh +# +# Send comments, improvements, bugs to ramiro@netscape.com +# + +update_makefile_usage() { + _progname=`expr //$0 : '.*/\(.*\)'` + cat <&1 + +Usage: $_progname [-h -u] [] + -d Subdir to update + -h Print usage +END_USAGE +} + +# Parse the command-line options +# +subdir= +while getopts d:h OPT; do + case $OPT in + d) # Make sure "subdir" has exactly one ending slash + subdir=`echo $OPTARG | sed 's/\/$//;'`"/" ;; + \?|h) update_makefile_usage + exit 1 + ;; + esac +done + + +# find_depth: Pull the value of DEPTH out of Makefile (or Makefile.in) +find_depth() { + egrep '^DEPTH[ ]*=[ ]*\.' $1 | awk -F= '{ print $2; }' +} + +# The Makefile to create +target_makefile=`pwd`"/${subdir}Makefile" + +# Use $(DEPTH) in the Makefile or Makefile.in to determine the depth +if [ -f Makefile.in ] +then + depth=`find_depth Makefile.in` +elif [ -f Makefile ] +then + depth=`find_depth Makefile` +elif [ -f ../Makefile ] +then + depth="../"`find_depth Makefile` +else + echo + echo "There ain't no 'Makefile' or 'Makefile.in' over here: $pwd" + echo + exit +fi + +# 'cd' to the root of the tree to run "config.status" there +cd $depth + +# Strip the tree root off the Makefile's path +# +root_path=`pwd` +target_makefile=`expr $target_makefile : $root_path'/\(.*\)'` + +# Make sure config.status exists +# +if [ -f config.status ] +then + CONFIG_FILES=$target_makefile ./config.status +else + echo + echo "There ain't no 'config.status' over here: $pwd" + echo +fi diff --git a/js/src/build/cygwin-wrapper b/js/src/build/cygwin-wrapper new file mode 100644 index 000000000000..679f0a11005b --- /dev/null +++ b/js/src/build/cygwin-wrapper @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Stupid wrapper to avoid win32 dospath/cygdrive issues +# Try not to spawn programs from within this file. If the stuff in here looks royally +# confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643 +# and look at the older versions of this file that are easier to read, but +# do basically the same thing +# + +prog=$1 +shift +if test -z "$prog"; then + exit 0 +fi + +# If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p +mountpoint=$CYGDRIVE_MOUNT +if test -z "$mountpoint"; then + mountpoint=`mount -p` + if test -z "$mountpoint"; then + print "Cannot determine cygwin mount points. Exiting" + exit 1 + fi +fi + +# Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p` +mountpoint=${mountpoint#*/} +mountpoint=/${mountpoint%%[!A-Za-z0-9_]*} +mountpoint=${mountpoint%/} + +args="" +up="" +if test "${prog}" = "-up"; then + up=1 + prog=${1} + shift +fi + +process=1 + +# Convert the mountpoint in parameters to Win32 filenames +# For instance: /cygdrive/c/foo -> c:/foo +for i in "${@}" +do + if test "${i}" = "-wrap"; then + process=1 + else + if test "${i}" = "-nowrap"; then + process= + else + if test -n "${process}"; then + if test -n "${up}"; then + pathname=${i#-I[a-zA-Z]:/} + if ! test "${pathname}" = "${i}"; then + no_i=${i#-I} + driveletter=${no_i%%:*} + i=-I${mountpoint}/${driveletter}/${pathname} + fi + else + eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}' + if ! test "${leader}" = "${i}"; then + eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}' + eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}' + driveletter=${no_mountpoint%%/*} + i=${leader}${driveletter}:/${pathname} + fi + fi + fi + + args="${args} ${i}" + fi + fi +done + +exec $prog $args diff --git a/js/src/config/Darwin.mk b/js/src/build/hcc similarity index 51% rename from js/src/config/Darwin.mk rename to js/src/build/hcc index 86c4b9d042dc..adadbe489265 100644 --- a/js/src/config/Darwin.mk +++ b/js/src/build/hcc @@ -1,4 +1,4 @@ -# -*- Mode: makefile -*- +#!/bin/sh # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +13,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -22,11 +21,10 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): -# Steve Zellers (zellers@apple.com) # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -39,47 +37,75 @@ # ***** END LICENSE BLOCK ***** # -# Config for Mac OS X as of PR3 -# Just ripped from Linux config +# Fix brain-damaged compilers that don't understand -o and -c together # +CC=`echo $1 | sed -e "s|'||g" -e 's|"||g'` +shift +DASH_C=0 +DASH_O=0 +DUMMY="XxxXxxX" +GET_OBJECT=0 +OBJ="${DUMMY}" +OBJECT="${DUMMY}" -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format -MMD -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN +for i in $* +do + [ "${CHECK_O}" = yes ] && { + case $i in + ./*/*.o) OBJECT="$i" + OPTS="${OPTS} -o" + DASH_O=1 + ;; + ./*.o) OBJECT="`basename $i`" + i="" + DASH_O=1 + ;; + *.o) if [ $i = `basename $i` ] + then + OBJECT="$i" + i="" + else + OPTS="${OPTS} -o" + fi + DASH_O=1 + ;; + *) OPTS="${OPTS} -o $i" + DASH_O=1 + i="" + ;; + esac + CHECK_O=no + } + case $i in + -c) DASH_C=1 + OPTS="${OPTS} -c" + ;; + -o) CHECK_O=yes + ;; + *.c) C_SRC=$i + OPTS="${OPTS} $i" +# cc always creates the .o from the .c name + OBJ=`basename $C_SRC .c`.o + ;; + *.s) S_SRC=$i + OPTS="${OPTS} $i" +# or the .o from the .s name + OBJ=`basename $S_SRC .s`.o + ;; + *.o) OBJECT=$i + OPTS="${OPTS} $i" + ;; + *) OPTS="${OPTS} $i" + ;; + esac +done -RANLIB = ranlib -MKSHLIB = $(CCC) -dynamiclib $(XMKSHLIBOPTS) -framework System +${CC} ${OPTS} || exit $? -SO_SUFFIX = dylib +# if there was no -c and -o we're done +[ $DASH_C = 1 -a $DASH_O = 1 ] || exit 0 -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -OS_CFLAGS += -DAVMPLUS_IA32 -DAVMPLUS_UNIX -NANOJIT_ARCH = i386 -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 +# if $OBJ and $OBJECT are the same we're done +[ $OBJ = $OBJECT ] && exit 0 +[ -f $OBJ ] && mv -f $OBJ $OBJECT diff --git a/js/src/build/hcpp b/js/src/build/hcpp new file mode 100644 index 000000000000..ea55fa44a1bc --- /dev/null +++ b/js/src/build/hcpp @@ -0,0 +1,155 @@ +#!/bin/sh +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Wrapper for brain-damaged compilers that don't understand -o and -c together. +# +CXX=`echo $1 | sed -e "s|'||g" -e 's|"||g'` +shift +DUMMY="XxxXxxX" +DASH_C=0 +DASH_O=0 +GET_OBJECT=0 +C_SRC="${DUMMY}" +CC_SRC="${DUMMY}" +CPP_SRC="${DUMMY}" +S_SRC="${DUMMY}" +OBJECT="${DUMMY}" +NEW_i="${DUMMY}" +PLATFORM=`uname -s` + +for i in $* +do + [ ${GET_OBJECT} -eq 1 ] && { + case $i in + ./*/*.o) OBJECT="$i" + OPTS="${OPTS} -o" + DASH_O=1 + ;; + ./*.o) OBJECT="`basename $i`" + i="" + DASH_O=1 + ;; + *.o) if [ $i = `basename $i` ] + then + i="" + else + OPTS="${OPTS} -o" + DASH_O=1 + fi + ;; + *) OPTS="${OPTS} -o $i" + DASH_O=1 + i="" + ;; + esac + GET_OBJECT=0 + } + case $i in + -c) + DASH_C=1 + OPTS="${OPTS} -c" + ;; + -o) + GET_OBJECT=1 + ;; + *.c) + C_SRC="$i" + OPTS="${OPTS} $i" +# cc always creates the .o from the .c name + OBJ=`basename ${C_SRC} .c`.o + ;; + +.*) + OPTS="${OPTS} $i" + ;; + *.cpp) + CPP_SRC="$i" + if [ "${PLATFORM}" = "SCO_SV" ]; then + OPTS="${OPTS} +.cpp $i" + elif [ "${PLATFORM}" = "IRIX" ]; then + NEW_i=`basename ${CPP_SRC} .cpp`.C + rm -f ${NEW_i} + cp $i ${NEW_i} + OPTS="${OPTS} ${NEW_i}" + else + OPTS="${OPTS} $i" + fi +# cc always creates the .o from the .cpp name + OBJ=`basename ${CPP_SRC} .cpp`.o + ;; + *.cc) + CC_SRC="$i" + OPTS="${OPTS} $i" +# cc always creates the .o from the .cc name + OBJ=`basename ${CC_SRC} .cc`.o + ;; + *.s) + S_SRC="$i" + OPTS="${OPTS} $i" +# cc always creates the .o from the .s name + OBJ=`basename ${S_SRC} .s`.o + ;; + *.o) OBJECT=$i + OPTS="${OPTS} $i" + ;; + *) OPTS="${OPTS} $i" + ;; + esac +done + +${CXX} ${OPTS} || exit $? +rm -f ${NEW_i} + +# Really only needed for NSPR now. +if [ "${PLATFORM}" = "IRIX" -a "$OBJ" != "$OBJECT" ]; then + OBJ=$OBJECT +fi + +# LAME!!! +if [ -f -O ]; then + mv -f -- -O ${OBJECT} +fi + +# if there was no -c and -o we're done +[ ${DASH_C} -eq 1 -a ${DASH_O} -eq 1 ] || exit 0 + +# if $OBJ and $OBJECT are the same we're done +[ $OBJ = $OBJECT ] && exit 0 + +[ -f $OBJ ] && mv -f $OBJ $OBJECT + diff --git a/js/src/build/unix/mddepend.pl b/js/src/build/unix/mddepend.pl new file mode 100644 index 000000000000..380e4ff532f5 --- /dev/null +++ b/js/src/build/unix/mddepend.pl @@ -0,0 +1,165 @@ +#!/usr/bin/env perl + +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is this file as it was released upon March 8, 1999. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1999 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# mddepend.pl - Reads in dependencies generated my -MD flag. Prints list +# of objects that need to be rebuilt. These can then be added to the +# PHONY target. Using this script copes with the problem of header +# files that have been removed from the build. +# +# Usage: +# mddepend.pl +# +# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). + +use strict; + +use constant DEBUG => 0; + +my $outfile = shift @ARGV; +my $silent = $ENV{MAKEFLAGS} =~ /^\w*s|\s-s/; + +my $line = ''; +my %alldeps; +# Parse dependency files +while (<>) { + s/\r?\n$//; # Handle both unix and DOS line endings + $line .= $_; + if ($line =~ /\\$/) { + chop $line; + next; + } + + my ($obj,$rest) = split /\s*:\s+/, $line, 2; + $line = ''; + next if !$obj || !$rest; + + my @deps = split /\s+/, $rest; + push @{$alldeps{$obj}}, @deps; + if (DEBUG >= 2) { + foreach my $dep (@deps) { print "add $obj $dep\n"; } + } +} + +# Test dependencies +my %modtimes; # cache +my @objs; # force rebuild on these +OBJ_LOOP: foreach my $obj (keys %alldeps) { + my $mtime = (stat $obj)[9] or next; + + my %not_in_cache; + my $deps = $alldeps{$obj}; + foreach my $dep_file (@{$deps}) { + my $dep_mtime = $modtimes{$dep_file}; + if (not defined $dep_mtime) { + print "Skipping $dep_file for $obj, will stat() later\n" if DEBUG >= 2; + $not_in_cache{$dep_file} = 1; + next; + } + + print "Found $dep_file in cache\n" if DEBUG >= 2; + + if ($dep_mtime > $mtime) { + print "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG; + } + elsif ($dep_mtime == -1) { + print "Couldn't stat $dep_file for $obj\n" if DEBUG; + } + else { + print "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2; + next; + } + + push @objs, $obj; # dependency is missing or newer + next OBJ_LOOP; # skip checking the rest of the dependencies + } + + foreach my $dep_file (keys %not_in_cache) { + print "STAT $dep_file for $obj\n" if DEBUG >= 2; + my $dep_mtime = $modtimes{$dep_file} = (stat $dep_file)[9] || -1; + + if ($dep_mtime > $mtime) { + print "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG; + } + elsif ($dep_mtime == -1) { + print "Couldn't stat $dep_file for $obj\n" if DEBUG; + } + else { + print "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2; + next; + } + + push @objs, $obj; # dependency is missing or newer + next OBJ_LOOP; # skip checking the rest of the dependencies + } + + # If we get here it means nothing needs to be done for $obj +} + +# Output objects to rebuild (if needed). +if (@objs) { + my $old_output; + my $new_output = "@objs: FORCE\n"; + + # Read in the current dependencies file. + open(OLD, "<$outfile") + and $old_output = ; + close(OLD); + + # Only write out the dependencies if they are different. + if ($new_output ne $old_output) { + open(OUT, ">$outfile") and print OUT "$new_output"; + print "Updating dependencies file, $outfile\n" unless $silent; + if (DEBUG) { + print "new: $new_output\n"; + print "was: $old_output\n" if $old_output ne ''; + } + } +} elsif (-s $outfile) { + # Remove the old dependencies because all objects are up to date. + print "Removing old dependencies file, $outfile\n" unless $silent; + + if (DEBUG) { + my $old_output; + open(OLD, "<$outfile") + and $old_output = ; + close(OLD); + print "was: $old_output\n"; + } + + unlink $outfile; +} diff --git a/js/src/build/unix/uniq.pl b/js/src/build/unix/uniq.pl new file mode 100644 index 000000000000..1b40bda1c858 --- /dev/null +++ b/js/src/build/unix/uniq.pl @@ -0,0 +1,63 @@ +#!/usr/bin/env perl + +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is this file as it was released upon December 26, 2000. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Christopher Seawood +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +use Getopt::Std; + +getopts('rs'); +$regexp = 1 if (defined($opt_r)); +$sort = 1 if (defined($opt_s)); + +undef @out; +if ($sort) { + @in = sort @ARGV; +} else { + @in = @ARGV; +} +foreach $d (@in) { + if ($regexp) { + $found = 0; + foreach $dir (@out) { + $found++, last if ($d =~ m/^$dir\// || $d eq $dir); + } + push @out, $d if (!$found); + } else { + push @out, $d if (!grep(/^$d$/, @out)); + } +} +print "@out\n" diff --git a/js/src/config.mk b/js/src/config.mk deleted file mode 100644 index 2317e5ff1406..000000000000 --- a/js/src/config.mk +++ /dev/null @@ -1,206 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998-1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -ifdef JS_DIST -DIST = $(JS_DIST) -else -DIST = $(DEPTH)/../../dist -endif - -# Set os+release dependent make variables -OS_ARCH := $(subst /,_,$(shell uname -s | sed /\ /s//_/)) - -# Attempt to differentiate between SunOS 5.4 and x86 5.4 -OS_CPUARCH := $(shell uname -m) -ifeq ($(OS_CPUARCH),i86pc) -OS_RELEASE := $(shell uname -r)_$(OS_CPUARCH) -else -ifeq ($(OS_ARCH),AIX) -OS_RELEASE := $(shell uname -v).$(shell uname -r) -else -OS_RELEASE := $(shell uname -r) -endif -endif -ifeq ($(OS_ARCH),IRIX64) -OS_ARCH := IRIX -endif - -# Handle output from win32 unames other than Netscape's version -ifeq (,$(filter-out Windows_95 Windows_98 CYGWIN_95-4.0 CYGWIN_98-4.10, $(OS_ARCH))) - OS_ARCH := WIN95 -endif -ifeq ($(OS_ARCH),WIN95) - OS_ARCH := WINNT - OS_RELEASE := 4.0 -endif -ifeq ($(OS_ARCH), Windows_NT) - OS_ARCH := WINNT - OS_MINOR_RELEASE := $(shell uname -v) - ifeq ($(OS_MINOR_RELEASE),00) - OS_MINOR_RELEASE = 0 - endif - OS_RELEASE := $(OS_RELEASE).$(OS_MINOR_RELEASE) -endif -ifeq (CYGWIN_NT,$(findstring CYGWIN_NT,$(OS_ARCH))) - OS_RELEASE := $(patsubst CYGWIN_NT-%,%,$(OS_ARCH)) - OS_ARCH := WINNT -endif -ifeq ($(OS_ARCH), CYGWIN32_NT) - OS_ARCH := WINNT -endif -ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH))) - OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH)) - OS_ARCH := WINNT -endif - -# Virtually all Linux versions are identical. -# Any distinctions are handled in linux.h -ifeq ($(OS_ARCH),Linux) -OS_CONFIG := Linux_All -else -ifeq ($(OS_ARCH),dgux) -OS_CONFIG := dgux -else -ifeq ($(OS_ARCH),Darwin) -OS_CONFIG := Darwin -else -ifeq ($(OS_ARCH),Darwin64) -OS_CONFIG := Darwin64 -else -OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE) -endif -endif -endif -endif - -ASFLAGS = -DEFINES = - -ifeq ($(OS_ARCH), WINNT) -INSTALL = nsinstall -CP = cp -else -INSTALL = $(DIST)/bin/nsinstall -CP = cp -endif - -ifdef BUILD_OPT -ifdef USE_MSVC -OPTIMIZER = -O2 -GL -INTERP_OPTIMIZER = -O2 -GL -BUILTINS_OPTIMIZER = -O2 -GL -LDFLAGS += -LTCG -else -OPTIMIZER = -Os -fstrict-aliasing -fno-exceptions -fno-rtti -Wstrict-aliasing=2 -BUILTINS_OPTIMIZER = -O9 -fstrict-aliasing -fno-exceptions -fno-rtti -INTERP_OPTIMIZER = -O3 -fstrict-aliasing -fno-exceptions -fno-rtti -endif -DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(USER) -OBJDIR_TAG = _OPT -else -ifdef USE_MSVC -OPTIMIZER = -Zi -INTERP_OPTIMIZER = -Zi -BUILTINS_OPTIMIZER = $(INTERP_OPTIMIZER) -else -OPTIMIZER = -g3 -fstrict-aliasing -fno-exceptions -fno-rtti -Wstrict-aliasing=2 -INTERP_OPTIMIZER = -g3 -fstrict-aliasing -fno-exceptions -fno-rtti -BUILTINS_OPTIMIZER = $(INTERP_OPTIMIZER) -endif -DEFINES += -DDEBUG -DDEBUG_$(USER) -OBJDIR_TAG = _DBG -endif - -SO_SUFFIX = so - -NS_USE_NATIVE = 1 - -# Java stuff -CLASSDIR = $(DEPTH)/liveconnect/classes -JAVA_CLASSES = $(patsubst %.java,%.class,$(JAVA_SRCS)) -TARGETS += $(addprefix $(CLASSDIR)/$(OBJDIR)/$(JARPATH)/, $(JAVA_CLASSES)) -JAVAC = $(JDK)/bin/javac -JAVAC_FLAGS = -classpath "$(CLASSPATH)" -d $(CLASSDIR)/$(OBJDIR) -ifeq ($(OS_ARCH), WINNT) - SEP = ; -else - SEP = : -endif -CLASSPATH = $(JDK)/lib/classes.zip$(SEP)$(CLASSDIR)/$(OBJDIR) - -include $(DEPTH)/config/$(OS_CONFIG).mk - -ifndef OBJ_SUFFIX -ifdef USE_MSVC -OBJ_SUFFIX = obj -else -OBJ_SUFFIX = o -endif -endif - -ifndef HOST_BIN_SUFFIX -ifeq ($(OS_ARCH),WINNT) -HOST_BIN_SUFFIX = .exe -else -HOST_BIN_SUFFIX = -endif -endif - -# Name of the binary code directories -ifdef OBJROOT -# prepend $(DEPTH) to the root unless it is an absolute path -OBJDIR = $(if $(filter /%,$(OBJROOT)),$(OBJROOT),$(DEPTH)/$(OBJROOT)) -else -ifeq ($(DEPTH),.) -OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).$(if $(BUILD_IDG),OBJD,OBJ) -else -OBJDIR = $(DEPTH)/$(OS_CONFIG)$(OBJDIR_TAG).$(if $(BUILD_IDG),OBJD,OBJ) -endif -endif - -VPATH = $(OBJDIR) - -LCJAR = js15lc30.jar - -# Library name -LIBDIR := lib -ifeq ($(CPU_ARCH), x86_64) -LIBDIR := lib64 -endif - diff --git a/js/src/config/AIX4.1.mk b/js/src/config/AIX4.1.mk deleted file mode 100644 index 09c7cb94cf39..000000000000 --- a/js/src/config/AIX4.1.mk +++ /dev/null @@ -1,65 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for AIX -# - -CC = xlC_r -CCC = xlC_r - -RANLIB = ranlib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< -ARCH := aix -CPU_ARCH = rs6000 -GFX_ARCH = x -INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1 - -OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV -DHAVE_LOCALTIME_R -OS_LIBS = -lbsd -lsvld -lm -#-lpthreads -lc_r - -MKSHLIB = $(LD) -bM:SRE -bh:4 -bnoentry -berok -XLDFLAGS += -lc - -ifdef JS_THREADSAFE -XLDFLAGS += -lsvld -endif diff --git a/js/src/config/Darwin1.3.mk b/js/src/config/Darwin1.3.mk deleted file mode 100755 index 05d3767a0d28..000000000000 --- a/js/src/config/Darwin1.3.mk +++ /dev/null @@ -1,81 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DRHAPSODY - -RANLIB = ranlib -MKSHLIB = libtool $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/config/Darwin1.4.mk b/js/src/config/Darwin1.4.mk deleted file mode 100755 index f7b6af8ec0a0..000000000000 --- a/js/src/config/Darwin1.4.mk +++ /dev/null @@ -1,41 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Mike McCabe -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -include $(DEPTH)/config/Darwin1.3.mk diff --git a/js/src/config/Darwin5.2.mk b/js/src/config/Darwin5.2.mk deleted file mode 100755 index 9b9b6ff0977a..000000000000 --- a/js/src/config/Darwin5.2.mk +++ /dev/null @@ -1,81 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN - -RANLIB = ranlib -MKSHLIB = libtool $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/config/Darwin5.3.mk b/js/src/config/Darwin5.3.mk deleted file mode 100644 index 9b9b6ff0977a..000000000000 --- a/js/src/config/Darwin5.3.mk +++ /dev/null @@ -1,81 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN - -RANLIB = ranlib -MKSHLIB = libtool $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/config/Darwin64.mk b/js/src/config/Darwin64.mk deleted file mode 100644 index db195b566902..000000000000 --- a/js/src/config/Darwin64.mk +++ /dev/null @@ -1,72 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -MMD -OS_LDFLAGS += -m64 -OS_CFLAGS = -m64 -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN - -RANLIB = ranlib -MKSHLIB = $(CCC) -dynamiclib $(XMKSHLIBOPTS) -framework System - -SO_SUFFIX = dylib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86_64 -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/config/HP-UXB.10.10.mk b/js/src/config/HP-UXB.10.10.mk deleted file mode 100644 index 8cd9d20671b8..000000000000 --- a/js/src/config/HP-UXB.10.10.mk +++ /dev/null @@ -1,77 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for HPUX -# - -# CC = gcc -# CCC = g++ -# CFLAGS += -Wall -Wno-format -fPIC - -CC = cc -Ae +Z -CCC = CC -Ae +a1 +eh +Z - -RANLIB = echo -MKSHLIB = $(LD) -b - -SO_SUFFIX = sl - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = hppa -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -DHAVE_LOCALTIME_R -OS_LIBS = -ldld - -ifeq ($(OS_RELEASE),B.10) -PLATFORM_FLAGS += -DHPUX10 -Dhpux10 -PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H -ifeq ($(OS_VERSION),.10) -PLATFORM_FLAGS += -DHPUX10_10 -endif -ifeq ($(OS_VERSION),.20) -PLATFORM_FLAGS += -DHPUX10_20 -endif -ifeq ($(OS_VERSION),.30) -PLATFORM_FLAGS += -DHPUX10_30 -endif -endif diff --git a/js/src/config/HP-UXB.10.20.mk b/js/src/config/HP-UXB.10.20.mk deleted file mode 100644 index 8cd9d20671b8..000000000000 --- a/js/src/config/HP-UXB.10.20.mk +++ /dev/null @@ -1,77 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for HPUX -# - -# CC = gcc -# CCC = g++ -# CFLAGS += -Wall -Wno-format -fPIC - -CC = cc -Ae +Z -CCC = CC -Ae +a1 +eh +Z - -RANLIB = echo -MKSHLIB = $(LD) -b - -SO_SUFFIX = sl - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = hppa -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -DHAVE_LOCALTIME_R -OS_LIBS = -ldld - -ifeq ($(OS_RELEASE),B.10) -PLATFORM_FLAGS += -DHPUX10 -Dhpux10 -PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H -ifeq ($(OS_VERSION),.10) -PLATFORM_FLAGS += -DHPUX10_10 -endif -ifeq ($(OS_VERSION),.20) -PLATFORM_FLAGS += -DHPUX10_20 -endif -ifeq ($(OS_VERSION),.30) -PLATFORM_FLAGS += -DHPUX10_30 -endif -endif diff --git a/js/src/config/IRIX.mk b/js/src/config/IRIX.mk deleted file mode 100644 index 88b162f22715..000000000000 --- a/js/src/config/IRIX.mk +++ /dev/null @@ -1,87 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for IRIX -# - -CPU_ARCH = mips -GFX_ARCH = x - -RANLIB = /bin/true - -#NS_USE_GCC = 1 - -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -AS = $(CC) -x assembler-with-cpp -ODD_CFLAGS = -Wall -Wno-format -ifdef BUILD_OPT -OPTIMIZER = -O6 -endif -else -ifeq ($(OS_RELEASE),6.2) -CC = cc -n32 -DIRIX6_2 -endif -ifeq ($(OS_RELEASE),6.3) -CC = cc -n32 -DIRIX6_3 -endif -ifeq ($(OS_RELEASE),6.5) -CC = cc -n32 -DIRIX6_5 -endif -CCC = CC -# LD = CC -ODD_CFLAGS = -fullwarn -xansi -ifdef BUILD_OPT -OPTIMIZER += -Olimit 4000 -endif -endif - -# For purify -HAVE_PURIFY = 1 -PURE_OS_CFLAGS = $(ODD_CFLAGS) -DXP_UNIX -DSVR4 -DSW_THREADS -DIRIX -DHAVE_LOCALTIME_R - -OS_CFLAGS = $(PURE_OS_CFLAGS) -MDupdate $(DEPENDENCIES) - -BSDECHO = echo -MKSHLIB = $(LD) -n32 -shared - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 diff --git a/js/src/config/IRIX6.5.mk b/js/src/config/IRIX6.5.mk deleted file mode 100644 index 354f1d119d91..000000000000 --- a/js/src/config/IRIX6.5.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for IRIX6.3 -# - -include $(DEPTH)/config/IRIX.mk diff --git a/js/src/config/Linux_All.mk b/js/src/config/Linux_All.mk deleted file mode 100644 index 6c289b4045b6..000000000000 --- a/js/src/config/Linux_All.mk +++ /dev/null @@ -1,105 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for all versions of Linux -# - -CC = gcc -CCC = g++ -LD = g++ -CFLAGS += -Wall -Wno-format -MMD -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R -DLINUX - -RANLIB = echo -MKSHLIB = $(LD) -shared $(XMKSHLIBOPTS) - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -# don't filter in x86-64 architecture -ifneq (x86_64,$(CPU_ARCH)) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS += -DX86_LINUX -DAVMPLUS_IA32 -DAVMPLUS_UNIX -DAVMPLUS_LINUX -NANOJIT_ARCH = i386 -endif # 86 -endif # !x86_64 - -#JIT disabled until x64 port is cleaned up -#ifeq ($(CPU_ARCH),x86_64) -#OS_CFLAGS += -DAVMPLUS_AMD64 -DAVMPLUS_64BIT -DAVMPLUS_UNIX -DAVMPLUS_LINUX -#NANOJIT_ARCH = i386 -#endif - -ifeq ($(CPU_ARCH),arm) -OS_CFLAGS += -DAVMPLUS_ARM -DAVMPLUS_UNIX -DAVMPLUS_LINUX -NANOJIT_ARCH = ARM -endif - -GFX_ARCH = x - -OS_LIBS = -lm -lc - -ASFLAGS += -x assembler-with-cpp - - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -ifeq ($(CPU_ARCH),x86_64) -# Use VA_COPY() standard macro on x86-64 -# FIXME: better use it everywhere -OS_CFLAGS += -DHAVE_VA_COPY -DVA_COPY=va_copy -endif - -ifeq ($(CPU_ARCH),x86_64) -# We need PIC code for shared libraries -# FIXME: better patch rules.mk & fdlibm/Makefile* -OS_CFLAGS += -DPIC -fPIC -endif diff --git a/js/src/config/Mac_OS10.0.mk b/js/src/config/Mac_OS10.0.mk deleted file mode 100755 index 74ba151e3b57..000000000000 --- a/js/src/config/Mac_OS10.0.mk +++ /dev/null @@ -1,82 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE --DRHAPSODY - -RANLIB = ranlib -MKSHLIB = libtool -dynamic $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/config/Makefile.in b/js/src/config/Makefile.in new file mode 100644 index 000000000000..2ee5de63f59f --- /dev/null +++ b/js/src/config/Makefile.in @@ -0,0 +1,121 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Robert Ginda +# John Taylor +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = .. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +# 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 = + +ifneq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH))) +ifneq ($(OS_ARCH), WINCE) +HOST_PROGRAM = nsinstall$(HOST_BIN_SUFFIX) +HOST_CSRCS = nsinstall.c pathsub.c +endif +endif + +PLSRCS = nfspwd.pl revdepth.pl + +TARGETS = $(HOST_PROGRAM) $(PLSRCS:.pl=) $(SIMPLE_PROGRAMS) + +ifndef CROSS_COMPILE +ifdef USE_ELF_DYNSTR_GC +TARGETS += elf-dynstr-gc +MAKE_DIRS += $(MDDEPDIR) +GARBAGE_DIRS += $(MDDEPDIR) +endif +endif + +# 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 + +ifdef GNU_CC +MODULE_OPTIMIZE_FLAGS = -O3 +endif + +ifndef COMPILER_DEPEND +ifndef MOZ_NATIVE_MAKEDEPEND +DIRS += mkdepend +endif +endif + +include $(topsrcdir)/config/config.mk + +# Do not install util programs +NO_INSTALL=1 + +include $(topsrcdir)/config/rules.mk + +export:: $(TARGETS) +ifdef HOST_PROGRAM + $(INSTALL) $(HOST_PROGRAM) $(DIST)/bin +endif + +ifdef WRAP_SYSTEM_INCLUDES +export:: + if test ! -d system_wrappers; then mkdir system_wrappers; fi + $(PERL) $(srcdir)/preprocessor.pl $(DEFINES) $(ACDEFINES) \ + -DBUILD_STATIC_LIBS=$(BUILD_STATIC_LIBS) \ + $(srcdir)/system-headers | $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers + $(INSTALL) system_wrappers $(DIST)/include + +GARBAGE_DIRS += system_wrappers +endif + +ifndef CROSS_COMPILE +ifdef USE_ELF_DYNSTR_GC +elf-dynstr-gc: elf-dynstr-gc.c Makefile Makefile.in + $(CC) $(COMPILE_CFLAGS) $(GLIB_CFLAGS) -o $@ $< $(LDFLAGS) $(GLIB_LIBS) +endif +endif + +FORCE: + +ifdef MKDEPEND_DIR +clean clobber realclean clobber_all:: + cd $(MKDEPEND_DIR); $(MAKE) $@ +endif diff --git a/js/src/config/Moz/Milestone.pm b/js/src/config/Moz/Milestone.pm new file mode 100644 index 000000000000..8dd1449cbc46 --- /dev/null +++ b/js/src/config/Moz/Milestone.pm @@ -0,0 +1,232 @@ +#!/usr/bin/perl -w +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Win32 Version System. +# +# The Initial Developer of the Original Code is Netscape Communications Corporation +# Portions created by the Initial Developer are Copyright (C) 2002 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +package Moz::Milestone; +use strict; + +use vars qw($officialMilestone + $milestone); + +local $Moz::Milestone::milestone; +local $Moz::Milestone::officialMilestone; + +# +# Usage: getOfficialMilestone($milestoneFile) +# Returns full milestone (x.x.x.x[ab12pre+]) +# +sub getOfficialMilestone($) { + my $mfile = $_[0]; + open(FILE,"$mfile") || + die ("Can't open $mfile for reading!"); + + my $num = ; + while($num =~ /^\s*#/ || $num !~ /^\d/) { + $num = ; + } + + close(FILE); + if ($num !~ /^\d/) { return; } + chomp($num); + # Remove extra ^M caused by using dos-mode line-endings + chop $num if (substr($num, -1, 1) eq "\r"); + $Moz::Milestone::officialMilestone = $num; + $Moz::Milestone::milestone = &getMilestoneNum; + return $num; +} + +# +# Usage: getMilestoneNum($num) +# Returns: milestone without a + if it exists. +# +sub getMilestoneNum { + if (defined($Moz::Milestone::milestone)) { + return $Moz::Milestone::milestone; + } + + if (defined($Moz::Milestone::officialMilestone)) { + $Moz::Milestone::milestone = $Moz::Milestone::officialMilestone; + } else { + $Moz::Milestone::milestone = $_[0]; + } + + if ($Moz::Milestone::milestone =~ /\+$/) { # for x.x.x+, strip off the + + $Moz::Milestone::milestone =~ s/\+$//; + } + + return $Moz::Milestone::milestone; +} + +# +# Usage: getMilestoneQualifier($num) +# Returns: + if it exists. +# +sub getMilestoneQualifier { + my $milestoneQualifier; + if (defined($Moz::Milestone::officialMilestone)) { + $milestoneQualifier = $Moz::Milestone::officialMilestone; + } else { + $milestoneQualifier = $_[0]; + } + + if ($milestoneQualifier =~ /\+$/) { + return "+"; + } +} + +sub getMilestoneMajor { + my $milestoneMajor; + if (defined($Moz::Milestone::milestone)) { + $milestoneMajor = $Moz::Milestone::milestone; + } else { + $milestoneMajor = $_[0]; + } + my @parts = split(/\./,$milestoneMajor); + return $parts[0]; +} + +sub getMilestoneMinor { + my $milestoneMinor; + if (defined($Moz::Milestone::milestone)) { + $milestoneMinor = $Moz::Milestone::milestone; + } else { + $milestoneMinor = $_[0]; + } + my @parts = split(/\./,$milestoneMinor); + + if ($#parts < 1 ) { return 0; } + return $parts[1]; +} + +sub getMilestoneMini { + my $milestoneMini; + if (defined($Moz::Milestone::milestone)) { + $milestoneMini = $Moz::Milestone::milestone; + } else { + $milestoneMini = $_[0]; + } + my @parts = split(/\./,$milestoneMini); + + if ($#parts < 2 ) { return 0; } + return $parts[2]; +} + +sub getMilestoneMicro { + my $milestoneMicro; + if (defined($Moz::Milestone::milestone)) { + $milestoneMicro = $Moz::Milestone::milestone; + } else { + $milestoneMicro = $_[0]; + } + my @parts = split(/\./,$milestoneMicro); + + if ($#parts < 3 ) { return 0; } + return $parts[3]; +} + +sub getMilestoneAB { + my $milestoneAB; + if (defined($Moz::Milestone::milestone)) { + $milestoneAB = $Moz::Milestone::milestone; + } else { + $milestoneAB = $_[0]; + } + + if ($milestoneAB =~ /a/) { return "alpha"; } + if ($milestoneAB =~ /b/) { return "beta"; } + return "final"; +} + +# +# build_file($template_file,$output_file) +# +sub build_file($$) { + my @FILE; + my @MILESTONE_PARTS; + my $MINI_VERSION = 0; + my $MICRO_VERSION = 0; + my $OFFICIAL = 0; + my $QUALIFIER = ""; + + if (!defined($Moz::Milestone::milestone)) { die("$0: no milestone file set!\n"); } + @MILESTONE_PARTS = split(/\./, &getMilestoneNum); + if ($#MILESTONE_PARTS >= 2) { + $MINI_VERSION = 1; + } else { + $MILESTONE_PARTS[2] = 0; + } + if ($#MILESTONE_PARTS >= 3) { + $MICRO_VERSION = 1; + } else { + $MILESTONE_PARTS[3] = 0; + } + if (! &getMilestoneQualifier) { + $OFFICIAL = 1; + } else { + $QUALIFIER = "+"; + } + + if (-e $_[0]) { + open(FILE, "$_[0]") || die("$0: Can't open $_[0] for reading!\n"); + @FILE = ; + close(FILE); + + open(FILE, ">$_[1]") || die("$0: Can't open $_[1] for writing!\n"); + + # + # There will be more of these based on what we need for files. + # + foreach(@FILE) { + s/__MOZ_MAJOR_VERSION__/$MILESTONE_PARTS[0]/g; + s/__MOZ_MINOR_VERSION__/$MILESTONE_PARTS[1]/g; + s/__MOZ_MINI_VERSION__/$MILESTONE_PARTS[2]/g; + s/__MOZ_MICRO_VERSION__/$MILESTONE_PARTS[3]/g; + if ($MINI_VERSION) { + s/__MOZ_OPTIONAL_MINI_VERSION__/.$MILESTONE_PARTS[2]/g; + } + if ($MICRO_VERSION) { + s/__MOZ_OPTIONAL_MICRO_VERSION__/.$MILESTONE_PARTS[3]/g; + } + + print FILE $_; + } + close(FILE); + } else { + die("$0: $_[0] doesn't exist for autoversioning!\n"); + } + +} + +1; diff --git a/js/src/config/OSF1V4.0.mk b/js/src/config/OSF1V4.0.mk deleted file mode 100644 index 337ca745926d..000000000000 --- a/js/src/config/OSF1V4.0.mk +++ /dev/null @@ -1,72 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for Data General DG/UX -# - -# -# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com) -# - -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -CFLAGS += -mieee -Wall -Wno-format -else -CC = cc -CCC = cxx -CFLAGS += -ieee -std -# LD = cxx -endif - -RANLIB = echo -MKSHLIB = $(LD) -shared -taso -all -expect_unresolved "*" - -# -# _DGUX_SOURCE is needed to turn on a lot of stuff in the headers if -# you're not using DG's compiler. It shouldn't hurt if you are. -# -# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in -# prtime.c -# -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT10_SOURCE -DOSF1 -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl - -NOSUCHFILE = /no-such-file diff --git a/js/src/config/OSF1V5.0.mk b/js/src/config/OSF1V5.0.mk deleted file mode 100644 index b65738c4e43c..000000000000 --- a/js/src/config/OSF1V5.0.mk +++ /dev/null @@ -1,69 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for Tru64 Unix 5.0 -# - -# -# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com) -# - -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -CFLAGS += -mieee -Wall -Wno-format -else -CC = cc -CCC = cxx -CFLAGS += -ieee -std -pthread -# LD = cxx -endif - -RANLIB = echo -MKSHLIB = $(LD) -shared -all -expect_unresolved "*" - -# -# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in -# prtime.c -# -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_POSIX4A_DRAFT10_SOURCE -DOSF1 -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl - -NOSUCHFILE = /no-such-file diff --git a/js/src/config/SunOS4.1.4.mk b/js/src/config/SunOS4.1.4.mk deleted file mode 100644 index 62f4815b4627..000000000000 --- a/js/src/config/SunOS4.1.4.mk +++ /dev/null @@ -1,101 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for SunOS4.1 -# - -CC = gcc -CCC = g++ -RANLIB = ranlib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = sparc -GFX_ARCH = x - -# A pile of -D's to build xfe on sunos -MOZ_CFLAGS = -DSTRINGS_ALIGNED -DNO_REGEX -DNO_ISDIR -DUSE_RE_COMP \ - -DNO_REGCOMP -DUSE_GETWD -DNO_MEMMOVE -DNO_ALLOCA \ - -DBOGUS_MB_MAX -DNO_CONST - -# Purify doesn't like -MDupdate -NOMD_OS_CFLAGS = -DXP_UNIX -Wall -Wno-format -DSW_THREADS -DSUNOS4 -DNEED_SYSCALL \ - $(MOZ_CFLAGS) - -OS_CFLAGS = $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES) -OS_LIBS = -ldl -lm - -MKSHLIB = $(LD) -L$(MOTIF)/lib - -HAVE_PURIFY = 1 -MOTIF = /home/motif/usr -MOTIFLIB = -L$(MOTIF)/lib -lXm -INCLUDES += -I/usr/X11R5/include -I$(MOTIF)/include - -NOSUCHFILE = /solaris-rm-f-sucks - -LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/sunos.lm - -EN_LOCALE = en_US -DE_LOCALE = de -FR_LOCALE = fr -JP_LOCALE = ja -SJIS_LOCALE = ja_JP.SJIS -KR_LOCALE = ko -CN_LOCALE = zh -TW_LOCALE = zh_TW -I2_LOCALE = i2 -IT_LOCALE = it -SV_LOCALE = sv -ES_LOCALE = es -NL_LOCALE = nl -PT_LOCALE = pt - -LOC_LIB_DIR = /usr/openwin/lib/locale - -BSDECHO = echo - -# -# These defines are for building unix plugins -# -BUILD_UNIX_PLUGINS = 1 -DSO_LDOPTS = -DSO_LDFLAGS = diff --git a/js/src/config/SunOS5.3.mk b/js/src/config/SunOS5.3.mk deleted file mode 100644 index bd615dee404f..000000000000 --- a/js/src/config/SunOS5.3.mk +++ /dev/null @@ -1,91 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for SunOS5.3 -# - -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format - -#CC = /opt/SUNWspro/SC3.0.1/bin/cc -RANLIB = echo - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = sparc -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl - -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 - -HAVE_PURIFY = 1 - -NOSUCHFILE = /solaris-rm-f-sucks - -ifndef JS_NO_ULTRA -ULTRA_OPTIONS := -xarch=v8plus -ULTRA_OPTIONSD := -DULTRA_SPARC -else -ULTRA_OPTIONS := -xarch=v8 -ULTRA_OPTIONSD := -endif - -ifeq ($(OS_CPUARCH),sun4u) -DEFINES += $(ULTRA_OPTIONSD) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD) -else -ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD) -endif -endif - -ifeq ($(OS_CPUARCH),sun4m) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,-xarch=v8 -else -ASFLAGS += -xarch=v8 -endif -endif - -MKSHLIB = $(LD) -G diff --git a/js/src/config/SunOS5.5.1.mk b/js/src/config/SunOS5.5.1.mk deleted file mode 100644 index 648f72ffa0d5..000000000000 --- a/js/src/config/SunOS5.5.1.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for SunOS5.5.1 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/config/SunOS5.6.mk b/js/src/config/SunOS5.6.mk deleted file mode 100644 index efe11528435a..000000000000 --- a/js/src/config/SunOS5.6.mk +++ /dev/null @@ -1,89 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for SunOS5.5 -# - -AS = /usr/ccs/bin/as -ifndef NS_USE_NATIVE - CC = gcc - CCC = g++ - CFLAGS += -Wall -Wno-format -else - CC = cc - CCC = CC - CFLAGS += -mt -KPIC -# LD = CC -endif - -RANLIB = echo - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = sparc -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl - -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 - -HAVE_PURIFY = 1 - -NOSUCHFILE = /solaris-rm-f-sucks - -ifeq ($(OS_CPUARCH),sun4u) # ultra sparc? -ifeq ($(CC),gcc) # using gcc? -ifndef JS_NO_ULTRA # do we want ultra? -ifdef JS_THREADSAFE # only in thread-safe mode -DEFINES += -DULTRA_SPARC -DEFINES += -Wa,-xarch=v8plus,-DULTRA_SPARC -else -ASFLAGS += -xarch=v8plus -DULTRA_SPARC -endif -endif -endif -endif - -MKSHLIB = $(LD) -G - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 diff --git a/js/src/config/SunOS5.7.mk b/js/src/config/SunOS5.7.mk deleted file mode 100644 index 2cb02f29590f..000000000000 --- a/js/src/config/SunOS5.7.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for SunOS5.7 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/config/SunOS5.8.mk b/js/src/config/SunOS5.8.mk deleted file mode 100644 index dd8a32d47b18..000000000000 --- a/js/src/config/SunOS5.8.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for SunOS5.8 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/config/SunOS5.9.mk b/js/src/config/SunOS5.9.mk deleted file mode 100644 index b01ec9c26fcd..000000000000 --- a/js/src/config/SunOS5.9.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for SunOS5.9 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/config/WINNT4.0.mk b/js/src/config/WINNT4.0.mk deleted file mode 100644 index 1d36f91b84fe..000000000000 --- a/js/src/config/WINNT4.0.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/config/WINNT5.0.mk b/js/src/config/WINNT5.0.mk deleted file mode 100644 index 7681e016d6a5..000000000000 --- a/js/src/config/WINNT5.0.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/config/WINNT5.1.mk b/js/src/config/WINNT5.1.mk deleted file mode 100644 index 7681e016d6a5..000000000000 --- a/js/src/config/WINNT5.1.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/config/WINNT5.2.mk b/js/src/config/WINNT5.2.mk deleted file mode 100644 index 5fbcbfe09f38..000000000000 --- a/js/src/config/WINNT5.2.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -DAVMPLUS_WIN32 -DAVMPLUS_IA32 -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/config/WINNT6.0.mk b/js/src/config/WINNT6.0.mk deleted file mode 100644 index 7681e016d6a5..000000000000 --- a/js/src/config/WINNT6.0.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in new file mode 100644 index 000000000000..98cef1fe3fba --- /dev/null +++ b/js/src/config/autoconf.mk.in @@ -0,0 +1,362 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is this file as it was released upon August 6, 1998. +# +# The Initial Developer of the Original Code is +# Christopher Seawood. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Benjamin Smedberg +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# A netscape style .mk file for autoconf builds + +INCLUDED_AUTOCONF_MK = 1 +USE_AUTOCONF = 1 +MOZILLA_CLIENT = 1 +target = @target@ +ac_configure_args = @ac_configure_args@ +BUILD_MODULES = @BUILD_MODULES@ +MOZILLA_VERSION = @MOZILLA_VERSION@ + +MOZ_BUILD_APP = @MOZ_BUILD_APP@ +MOZ_APP_NAME = @MOZ_APP_NAME@ +MOZ_APP_DISPLAYNAME = @MOZ_APP_DISPLAYNAME@ +MOZ_APP_VERSION = @MOZ_APP_VERSION@ + +MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +includedir = @includedir@ +libdir = @libdir@ +datadir = @datadir@ +mandir = @mandir@ + +installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) +sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION) + +DIST = $(DEPTH)/dist + +MOZ_JS_LIBS = @MOZ_JS_LIBS@ + +MOZ_SYNC_BUILD_FILES = @MOZ_SYNC_BUILD_FILES@ + +MOZ_DEBUG = @MOZ_DEBUG@ +MOZ_DEBUG_MODULES = @MOZ_DEBUG_MODULES@ +MOZ_PROFILE_MODULES = @MOZ_PROFILE_MODULES@ +MOZ_DEBUG_ENABLE_DEFS = @MOZ_DEBUG_ENABLE_DEFS@ +MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@ +MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@ +MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@ +MOZ_DBGRINFO_MODULES = @MOZ_DBGRINFO_MODULES@ +MOZ_EXTENSIONS = @MOZ_EXTENSIONS@ +MOZ_IMG_DECODERS= @MOZ_IMG_DECODERS@ +MOZ_IMG_ENCODERS= @MOZ_IMG_ENCODERS@ +MOZ_JSDEBUGGER = @MOZ_JSDEBUGGER@ +MOZ_PERF_METRICS = @MOZ_PERF_METRICS@ +MOZ_LEAKY = @MOZ_LEAKY@ +MOZ_MEMORY = @MOZ_MEMORY@ +MOZ_JPROF = @MOZ_JPROF@ +MOZ_SHARK = @MOZ_SHARK@ +MOZ_CALLGRIND = @MOZ_CALLGRIND@ +MOZ_VTUNE = @MOZ_VTUNE@ +DEHYDRA_PATH = @DEHYDRA_PATH@ + +ENABLE_EAZEL_PROFILER=@ENABLE_EAZEL_PROFILER@ +EAZEL_PROFILER_CFLAGS=@EAZEL_PROFILER_CFLAGS@ +EAZEL_PROFILER_LIBS=@EAZEL_PROFILER_LIBS@ +GC_LEAK_DETECTOR = @GC_LEAK_DETECTOR@ +NS_TRACE_MALLOC = @NS_TRACE_MALLOC@ +USE_ELF_DYNSTR_GC = @USE_ELF_DYNSTR_GC@ +INCREMENTAL_LINKER = @INCREMENTAL_LINKER@ +MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@ +BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@ +ENABLE_TESTS = @ENABLE_TESTS@ +JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@ +JS_STATIC_BUILD = @JS_STATIC_BUILD@ + +TAR=@TAR@ + +# The MOZ_UI_LOCALE var is used to build a particular locale. Do *not* +# use the var to change any binary files. Do *not* use this var unless you +# write rules for the "clean-locale" and "locale" targets. +MOZ_UI_LOCALE = @MOZ_UI_LOCALE@ + +MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS = @MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS@ +MOZ_COMPONENT_NSPR_LIBS=@MOZ_COMPONENT_NSPR_LIBS@ + +MOZ_FIX_LINK_PATHS=@MOZ_FIX_LINK_PATHS@ + +XPCOM_FROZEN_LDOPTS=@XPCOM_FROZEN_LDOPTS@ +XPCOM_LIBS=@XPCOM_LIBS@ +MOZ_TIMELINE=@MOZ_TIMELINE@ + +ENABLE_STRIP = @ENABLE_STRIP@ +PKG_SKIP_STRIP = @PKG_SKIP_STRIP@ + +MOZ_POST_DSO_LIB_COMMAND = @MOZ_POST_DSO_LIB_COMMAND@ +MOZ_POST_PROGRAM_COMMAND = @MOZ_POST_PROGRAM_COMMAND@ + +MOZ_BUILD_ROOT = @MOZ_BUILD_ROOT@ + +MOZ_INSURE = @MOZ_INSURE@ +MOZ_INSURIFYING = @MOZ_INSURIFYING@ +MOZ_INSURE_DIRS = @MOZ_INSURE_DIRS@ +MOZ_INSURE_EXCLUDE_DIRS = @MOZ_INSURE_EXCLUDE_DIRS@ + +MOZ_NATIVE_NSPR = @MOZ_NATIVE_NSPR@ + +CROSS_COMPILE = @CROSS_COMPILE@ + +WCHAR_CFLAGS = @WCHAR_CFLAGS@ + +OS_CPPFLAGS = @CPPFLAGS@ +OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@ +OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@ +OS_LDFLAGS = @LDFLAGS@ + +OS_COMPILE_CFLAGS = $(OS_CPPFLAGS) @COMPILE_CFLAGS@ +OS_COMPILE_CXXFLAGS = $(OS_CPPFLAGS) @COMPILE_CXXFLAGS@ + +OS_INCLUDES = $(NSPR_CFLAGS) +OS_LIBS = @LIBS@ +ACDEFINES = @MOZ_DEFINES@ + +WARNINGS_AS_ERRORS = @WARNINGS_AS_ERRORS@ + +MOZ_OPTIMIZE = @MOZ_OPTIMIZE@ +MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@ +MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@ +MOZ_OPTIMIZE_SIZE_TWEAK = @MOZ_OPTIMIZE_SIZE_TWEAK@ + +MOZ_RTTI_FLAGS_ON = @_MOZ_RTTI_FLAGS_ON@ + +MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE = @MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE@ +PROFILE_GEN_CFLAGS = @PROFILE_GEN_CFLAGS@ +PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@ +PROFILE_USE_CFLAGS = @PROFILE_USE_CFLAGS@ +PROFILE_USE_LDFLAGS = @PROFILE_USE_LDFLAGS@ + +WIN_TOP_SRC = @WIN_TOP_SRC@ +CYGWIN_WRAPPER = @CYGWIN_WRAPPER@ +AS_PERL = @AS_PERL@ +CYGDRIVE_MOUNT = @CYGDRIVE_MOUNT@ +AR = @AR@ +AR_FLAGS = @AR_FLAGS@ +AR_EXTRACT = @AR_EXTRACT@ +AR_LIST = @AR_LIST@ +AR_DELETE = @AR_DELETE@ +AS = @AS@ +ASFLAGS = @ASFLAGS@ +AS_DASH_C_FLAG = @AS_DASH_C_FLAG@ +LD = @LD@ +RC = @RC@ +RCFLAGS = @RCFLAGS@ +WINDRES = @WINDRES@ +USE_SHORT_LIBNAME = @USE_SHORT_LIBNAME@ +IMPLIB = @IMPLIB@ +FILTER = @FILTER@ +BIN_FLAGS = @BIN_FLAGS@ +MIDL = @MIDL@ +MIDL_FLAGS = @MIDL_FLAGS@ +_MSC_VER = @_MSC_VER@ + +DLL_PREFIX = @DLL_PREFIX@ +LIB_PREFIX = @LIB_PREFIX@ +OBJ_SUFFIX = @OBJ_SUFFIX@ +LIB_SUFFIX = @LIB_SUFFIX@ +DLL_SUFFIX = @DLL_SUFFIX@ +BIN_SUFFIX = @BIN_SUFFIX@ +ASM_SUFFIX = @ASM_SUFFIX@ +IMPORT_LIB_SUFFIX = @IMPORT_LIB_SUFFIX@ +USE_N32 = @USE_N32@ +HAVE_64BIT_OS = @HAVE_64BIT_OS@ + +# Temp hack. It is not my intention to leave this crap in here for ever. +# Im talking to fur right now to solve the problem without introducing +# NS_USE_NATIVE to the build system -ramiro. +NS_USE_NATIVE = @NS_USE_NATIVE@ + +CC = @CC@ +CXX = @CXX@ + +CC_VERSION = @CC_VERSION@ +CXX_VERSION = @CXX_VERSION@ + +GNU_AS = @GNU_AS@ +GNU_LD = @GNU_LD@ +GNU_CC = @GNU_CC@ +GNU_CXX = @GNU_CXX@ +HAVE_GCC3_ABI = @HAVE_GCC3_ABI@ +INTEL_CC = @INTEL_CC@ +INTEL_CXX = @INTEL_CXX@ + +HOST_CC = @HOST_CC@ +HOST_CXX = @HOST_CXX@ +HOST_CFLAGS = @HOST_CFLAGS@ +HOST_CXXFLAGS = @HOST_CXXFLAGS@ +HOST_OPTIMIZE_FLAGS = @HOST_OPTIMIZE_FLAGS@ +HOST_NSPR_MDCPUCFG = @HOST_NSPR_MDCPUCFG@ +HOST_AR = @HOST_AR@ +HOST_AR_FLAGS = @HOST_AR_FLAGS@ +HOST_LD = @HOST_LD@ +HOST_RANLIB = @HOST_RANLIB@ +HOST_BIN_SUFFIX = @HOST_BIN_SUFFIX@ + +HOST_OS_ARCH = @HOST_OS_ARCH@ +host_cpu = @host_cpu@ +host_vendor = @host_vendor@ +host_os = @host_os@ + +TARGET_NSPR_MDCPUCFG = @TARGET_NSPR_MDCPUCFG@ +TARGET_CPU = @TARGET_CPU@ +TARGET_VENDOR = @TARGET_VENDOR@ +TARGET_OS = @TARGET_OS@ +TARGET_MD_ARCH = @TARGET_MD_ARCH@ +TARGET_XPCOM_ABI = @TARGET_XPCOM_ABI@ + +AUTOCONF = @AUTOCONF@ +PERL = @PERL@ +PYTHON = @PYTHON@ +RANLIB = @RANLIB@ +WHOAMI = @WHOAMI@ +UNZIP = @UNZIP@ +ZIP = @ZIP@ +XARGS = @XARGS@ +STRIP = @STRIP@ +DOXYGEN = @DOXYGEN@ +MAKE = @MAKE@ +PBBUILD_BIN = @PBBUILD@ +SDP = @SDP@ +NSINSTALL_BIN = @NSINSTALL_BIN@ + +NSPR_CONFIG = @NSPR_CONFIG@ +NSPR_CFLAGS = @NSPR_CFLAGS@ +NSPR_LIBS = @NSPR_LIBS@ + +USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@ + +# MKSHLIB_FORCE_ALL is used to force the linker to include all object +# files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker +# to normal behavior. Makefile's that create shared libraries out of +# archives use these flags to force in all of the .o files in the +# archives into the shared library. +WRAP_MALLOC_LIB = @WRAP_MALLOC_LIB@ +WRAP_MALLOC_CFLAGS = @WRAP_MALLOC_CFLAGS@ +DSO_CFLAGS = @DSO_CFLAGS@ +DSO_PIC_CFLAGS = @DSO_PIC_CFLAGS@ +MKSHLIB = @MKSHLIB@ +MKCSHLIB = @MKCSHLIB@ +MKSHLIB_FORCE_ALL = @MKSHLIB_FORCE_ALL@ +MKSHLIB_UNFORCE_ALL = @MKSHLIB_UNFORCE_ALL@ +DSO_LDOPTS = @DSO_LDOPTS@ +DLL_SUFFIX = @DLL_SUFFIX@ + +NO_LD_ARCHIVE_FLAGS = @NO_LD_ARCHIVE_FLAGS@ + +MOZ_TOOLKIT_REGISTRY_CFLAGS = \ + $(TK_CFLAGS) + +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_GMODULE_LIBS = @GLIB_GMODULE_LIBS@ + +MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@ + +# Used for LD_LIBRARY_PATH +LIBS_PATH = @LIBS_PATH@ + +MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@ +COMPILER_DEPEND = @COMPILER_DEPEND@ +MDDEPDIR := @MDDEPDIR@ + +MOZ_DEMANGLE_SYMBOLS = @MOZ_DEMANGLE_SYMBOLS@ + +# XXX - these need to be cleaned up and have real checks added -cls +CM_BLDTYPE=dbg +AWT_11=1 +MOZ_BITS=32 +OS_TARGET=@OS_TARGET@ +OS_ARCH=@OS_ARCH@ +OS_RELEASE=@OS_RELEASE@ +OS_TEST=@OS_TEST@ + +TARGET_DEVICE = @TARGET_DEVICE@ + +# For AIX build +AIX_OBJMODEL = @AIX_OBJMODEL@ + +# For OS/2 build +MOZ_OS2_TOOLS = @MOZ_OS2_TOOLS@ +MOZ_OS2_USE_DECLSPEC = @MOZ_OS2_USE_DECLSPEC@ +MOZ_OS2_HIGH_MEMORY = @MOZ_OS2_HIGH_MEMORY@ + +MOZILLA_OFFICIAL = @MOZILLA_OFFICIAL@ +BUILD_OFFICIAL = @BUILD_OFFICIAL@ +MOZ_MILESTONE_RELEASE = @MOZ_MILESTONE_RELEASE@ + +# Win32 options +MOZ_PROFILE = @MOZ_PROFILE@ +MOZ_BROWSE_INFO = @MOZ_BROWSE_INFO@ +MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@ +MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ +MOZ_QUANTIFY = @MOZ_QUANTIFY@ +MSMANIFEST_TOOL = @MSMANIFEST_TOOL@ +WIN32_REDIST_DIR = @WIN32_REDIST_DIR@ +WIN32_CRT_SRC_DIR = @WIN32_CRT_SRC_DIR@ +WIN32_CUSTOM_CRT_DIR = @WIN32_CUSTOM_CRT_DIR@ +# These are for custom CRT building +ifdef MOZ_MEMORY +ifneq (,$(WIN32_CRT_SRC_DIR)$(WIN32_CUSTOM_CRT_DIR)) +export LIB = @MOZ_LIB@ +export PATH = @MOZ_PATH@ +DLLFLAGS = @DLLFLAGS@ +endif +endif + +# Codesighs tools option, enables win32 mapfiles. +MOZ_MAPINFO = @MOZ_MAPINFO@ + +WINCE = @WINCE@ + +MACOS_SDK_DIR = @MACOS_SDK_DIR@ +NEXT_ROOT = @NEXT_ROOT@ +GCC_VERSION = @GCC_VERSION@ +XCODEBUILD_VERSION= @XCODEBUILD_VERSION@ +HAS_XCODE_2_1 = @HAS_XCODE_2_1@ +UNIVERSAL_BINARY= @UNIVERSAL_BINARY@ +HAVE_DTRACE= @HAVE_DTRACE@ + +VISIBILITY_FLAGS = @VISIBILITY_FLAGS@ +WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@ + +HAVE_ARM_SIMD= @HAVE_ARM_SIMD@ diff --git a/js/src/config/check-sync-dirs.py b/js/src/config/check-sync-dirs.py new file mode 100644 index 000000000000..f8b6842faf36 --- /dev/null +++ b/js/src/config/check-sync-dirs.py @@ -0,0 +1,108 @@ +# check-sync-dirs.py --- check that one directory is an exact subset of another +# +# Usage: python check-sync-dirs.py COPY ORIGINAL +# +# Check that the files present in the directory tree COPY are exact +# copies of their counterparts in the directory tree ORIGINAL. COPY +# need not have all the files in ORIGINAL, but COPY may not have files +# absent from ORIGINAL. +# +# Each directory in COPY may have a file named +# 'check-sync-exceptions', which lists files in COPY that need not be +# the same as the corresponding file in ORIGINAL, or exist at all in +# ORIGINAL. (The 'check-sync-exceptions' file itself is always +# treated as exceptional.) Blank lines and '#' comments in the file +# are ignored. + +import sys +import os +from os.path import join +import filecmp +import textwrap +import fnmatch + +if len(sys.argv) != 3: + print >> sys.stderr, "Usage: %s COPY ORIGINAL" % sys.argv[0] + sys.exit(1) + +copy = sys.argv[1] +original = sys.argv[2] + +# Ignore detritus left lying around by editing tools. +ignored_patterns = ['*~', '.#*', '#*#', '*.orig', '*.rej'] + +# Return the contents of FILENAME, a 'check-sync-exceptions' file, as +# a dictionary whose keys are exactly the list of filenames, along +# with the basename of FILENAME itself. If FILENAME does not exist, +# return the empty dictionary. +def read_exceptions(filename): + if (os.path.exists(filename)): + f = file(filename) + exceptions={} + for line in f: + line = line.strip() + if line != '' and line[0] != '#': + exceptions[line] = None + exceptions[os.path.basename (filename)] = None + f.close() + return exceptions + else: + return {} + +# Return true if FILENAME matches any pattern in the list of filename +# patterns PATTERNS. +def fnmatch_any(filename, patterns): + for pattern in patterns: + if fnmatch.fnmatch(filename, pattern): + return True + return False + +# Check the contents of COPY/SUBDIR against ORIGINAL/SUBDIR. For each +# file that differs, apply REPORT to COPY, ORIGINAL, and the file's +# relative path. COPY and ORIGINAL should be absolute. Ignore files +# that match patterns given in the list IGNORE. +def check(copy, original, ignore, report): + os.chdir(copy) + for (dirpath, dirnames, filenames) in os.walk('.'): + exceptions = read_exceptions(join(dirpath, 'check-sync-exceptions')) + for filename in filenames: + if filename in exceptions: + continue + if fnmatch_any(filename, ignore): + continue + relative_name = join(dirpath, filename) + original_name = join(original, relative_name) + if (os.path.exists(original_name) + and filecmp.cmp(relative_name, original_name)): + continue + report(copy, original, relative_name) + + +differences_found = False + +# Print an error message for DIFFERING, which was found to differ +# between COPY and ORIGINAL. Set the global variable differences_found. +def report(copy, original, differing): + global differences_found + if not differences_found: + print >> sys.stderr, "TEST-FAIL | build file copies are not in sync" + print >> sys.stderr, "file(s) found in: %s" % (copy) + print >> sys.stderr, ("differ from their originals in: %s" + % (original)) + print >> sys.stderr, "file differs: %s" % (differing) + differences_found = True + +check(os.path.abspath(copy), + os.path.abspath(original), + ignored_patterns, + report) + +if differences_found: + msg=('''In general, the files in '%s' should always be exact copies of +originals in '%s'. A change made to one should also be made to the +other. See 'check-sync-dirs.py' for more details.''' + % (copy, original)) + print >> sys.stderr, textwrap.fill(msg, 75) + sys.exit(1) + +sys.exit(0) diff --git a/js/src/config/check-sync-exceptions b/js/src/config/check-sync-exceptions new file mode 100644 index 000000000000..7c0bc4703904 --- /dev/null +++ b/js/src/config/check-sync-exceptions @@ -0,0 +1,6 @@ +Makefile.in +autoconf.mk.in +check-sync-dirs.py + +# This is a copy of nspr's config/make-system-wrappers.pl. +make-system-wrappers.pl diff --git a/js/src/config/config.mk b/js/src/config/config.mk new file mode 100644 index 000000000000..d19ca4ae3824 --- /dev/null +++ b/js/src/config/config.mk @@ -0,0 +1,884 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Benjamin Smedberg +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# config.mk +# +# Determines the platform and builds the macros needed to load the +# appropriate platform-specific .mk file, then defines all (most?) +# of the generic macros. +# + +# Define an include-at-most-once flag +INCLUDED_CONFIG_MK = 1 + +EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this. + +ifndef topsrcdir +topsrcdir = $(DEPTH) +endif + +ifndef INCLUDED_AUTOCONF_MK +include $(DEPTH)/config/autoconf.mk +endif +ifndef INCLUDED_INSURE_MK +ifdef MOZ_INSURIFYING +include $(topsrcdir)/config/insure.mk +endif +endif + +COMMA = , + +# Sanity check some variables +CHECK_VARS := \ + XPI_NAME \ + LIBRARY_NAME \ + MODULE \ + DEPTH \ + SHORT_LIBNAME \ + XPI_PKGNAME \ + INSTALL_EXTENSION_ID \ + $(NULL) + +# checks for internal spaces or trailing spaces in the variable +# named by $x +check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x))) + +$(foreach x,$(CHECK_VARS),$(check-variable)) + +# FINAL_TARGET specifies the location into which we copy end-user-shipped +# build products (typelibs, components, chrome). +# +# It will usually be the well-loved $(DIST)/bin, today, but can also be an +# XPI-contents staging directory for ambitious and right-thinking extensions. +FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin) + +# MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in +# the jar format, make-jars leaves behind a directory structure that's not +# needed in $(FINAL_TARGET). For both, flat, and symlink, the directory +# structure contains the chrome, so leave it in $(FINAL_TARGET). +ifeq (jar,$(MOZ_CHROME_FILE_FORMAT)) +MAKE_JARS_TARGET = $(if $(XPI_NAME),$(FINAL_TARGET).stage,$(DIST)/chrome-stage) +else +MAKE_JARS_TARGET = $(FINAL_TARGET) +endif + +# +# 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. +# +VERSION_NUMBER = 50 + +ifeq ($(HOST_OS_ARCH),WINNT) +win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir)) +BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix +else +win_srcdir := $(srcdir) +BUILD_TOOLS = $(topsrcdir)/build/unix +endif + +CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config +AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf + +ifeq ($(OS_ARCH),QNX) +ifeq ($(OS_TARGET),NTO) +LD := qcc -Vgcc_ntox86 -nostdlib +else +LD := $(CC) +endif +endif +ifeq ($(OS_ARCH),BeOS) +BEOS_ADDON_WORKAROUND = 1 +endif + +# +# Strip off the excessively long version numbers on these platforms, +# but save the version to allow multiple versions of the same base +# platform to be built in the same tree. +# +ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH))) +OS_RELEASE := $(basename $(OS_RELEASE)) + +# Allow the user to ignore the OS_VERSION, which is usually irrelevant. +ifdef WANT_MOZILLA_CONFIG_OS_VERSION +OS_VERS := $(suffix $(OS_RELEASE)) +OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//') +endif + +endif + +OS_CONFIG := $(OS_ARCH)$(OS_RELEASE) + +FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs +FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps +FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names + +MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX) +MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX) + +ifdef MOZ_MEMORY +ifneq ($(OS_ARCH),WINNT) +JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME,jemalloc) $(MKSHLIB_UNFORCE_ALL) +endif +endif + +# determine debug-related options +_DEBUG_CFLAGS := +_DEBUG_LDFLAGS := + +ifndef MOZ_DEBUG + # global debugging is disabled + # check if it was explicitly enabled for this module + ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES))) + MOZ_DEBUG:=1 + endif +else + # global debugging is enabled + # check if it was explicitly disabled for this module + ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES))) + MOZ_DEBUG:= + endif +endif + +ifdef MOZ_DEBUG + _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) + XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) +else + _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS) + XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS) +endif + +# determine if -g should be passed to the compiler, based on +# the current module, and the value of MOZ_DBGRINFO_MODULES + +ifdef MOZ_DEBUG + MOZ_DBGRINFO_MODULES += ALL_MODULES + pattern := ALL_MODULES ^ALL_MODULES +else + MOZ_DBGRINFO_MODULES += ^ALL_MODULES + pattern := ALL_MODULES ^ALL_MODULES +endif + +ifdef MODULE + # our current Makefile specifies a module name - add it to our pattern + pattern += $(MODULE) ^$(MODULE) +endif + +# start by finding the first relevant module name +# (remember that the order of the module names in MOZ_DBGRINFO_MODULES +# is reversed from the order the user specified to configure - +# this allows the user to put general names at the beginning +# of the list, and to override them with explicit module names later +# in the list) + +first_match:=$(firstword $(filter $(pattern), $(MOZ_DBGRINFO_MODULES))) + +ifeq ($(first_match), $(MODULE)) + # the user specified explicitly that + # this module should be compiled with -g + _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) + _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) +else + ifeq ($(first_match), ^$(MODULE)) + # the user specified explicitly that this module + # should not be compiled with -g (nothing to do) + else + ifeq ($(first_match), ALL_MODULES) + # the user didn't mention this module explicitly, + # but wanted all modules to be compiled with -g + _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) + _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) + else + ifeq ($(first_match), ^ALL_MODULES) + # the user didn't mention this module explicitly, + # but wanted all modules to be compiled without -g (nothing to do) + endif + endif + endif +endif + + +# append debug flags +# (these might have been above when processing MOZ_DBGRINFO_MODULES) +OS_CFLAGS += $(_DEBUG_CFLAGS) +OS_CXXFLAGS += $(_DEBUG_CFLAGS) +OS_LDFLAGS += $(_DEBUG_LDFLAGS) + +# MOZ_PROFILE equivs for win32 +ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) +ifdef MOZ_DEBUG +ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE)) +OS_CFLAGS += -FR +OS_CXXFLAGS += -FR +endif +else # ! MOZ_DEBUG + +# MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files. +# Used for generating an optimized build with debugging symbols. +# Used in the Windows nightlies to generate symbols for crash reporting. +ifdef MOZ_DEBUG_SYMBOLS +OS_CXXFLAGS += -Zi -UDEBUG -DNDEBUG +OS_CFLAGS += -Zi -UDEBUG -DNDEBUG +OS_LDFLAGS += -DEBUG -OPT:REF -OPT:nowin98 +endif + +ifdef MOZ_QUANTIFY +# -FIXED:NO is needed for Quantify to work, but it increases the size +# of executables, so only use it if building for Quantify. +WIN32_EXE_LDFLAGS += -FIXED:NO + +# We need -OPT:NOICF to prevent identical methods from being merged together. +# Otherwise, Quantify doesn't know which method was actually called when it's +# showing you the profile. +OS_LDFLAGS += -OPT:NOICF +endif + +# +# Handle trace-malloc in optimized builds. +# No opt to give sane callstacks. +# +ifdef NS_TRACE_MALLOC +MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG +OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF -OPT:nowin98 +endif # NS_TRACE_MALLOC + +endif # MOZ_DEBUG +endif # WINNT && !GNU_CC + +# +# Build using PIC by default +# Do not use PIC if not building a shared lib (see exceptions below) +# + +ifndef BUILD_STATIC_LIBS +_ENABLE_PIC=1 +endif +ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC)) +_ENABLE_PIC=1 +endif + +# In Firefox, all components are linked into either libxul or the static +# meta-component, and should be compiled with PIC. +ifdef MOZ_META_COMPONENT +_ENABLE_PIC=1 +endif + +# If module is going to be merged into the nsStaticModule, +# make sure that the entry points are translated and +# the module is built static. + +ifdef IS_COMPONENT +ifdef EXPORT_LIBRARY +ifneq (,$(BUILD_STATIC_LIBS)) +ifdef MODULE_NAME +DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1 +FORCE_STATIC_LIB=1 +endif +endif +endif +endif + +# Determine if module being compiled is destined +# to be merged into libxul + +ifdef MOZ_ENABLE_LIBXUL +ifdef LIBXUL_LIBRARY +ifdef IS_COMPONENT +ifdef MODULE_NAME +DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1 +else +$(error Component makefile does not specify MODULE_NAME.) +endif +endif +FORCE_STATIC_LIB=1 +_ENABLE_PIC=1 +SHORT_LIBNAME= +endif +endif + +# If we are building this component into an extension/xulapp, it cannot be +# statically linked. In the future we may want to add a xulapp meta-component +# build option. + +ifdef XPI_NAME +_ENABLE_PIC=1 +ifdef IS_COMPONENT +EXPORT_LIBRARY= +FORCE_STATIC_LIB= +FORCE_SHARED_LIB=1 +endif +endif + +# +# Disable PIC if necessary +# + +ifndef _ENABLE_PIC +DSO_CFLAGS= +ifeq ($(OS_ARCH)_$(HAVE_GCC3_ABI),Darwin_1) +DSO_PIC_CFLAGS=-mdynamic-no-pic +else +DSO_PIC_CFLAGS= +endif +endif + +# This comes from configure +ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE +NO_PROFILE_GUIDED_OPTIMIZE = 1 +endif + +# Enable profile-based feedback +ifndef NO_PROFILE_GUIDED_OPTIMIZE +ifdef MOZ_PROFILE_GENERATE +# No sense in profiling tools +ifndef INTERNAL_TOOLS +OS_CFLAGS += $(PROFILE_GEN_CFLAGS) +OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS) +OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS) +ifeq (WINNT,$(OS_ARCH)) +AR_FLAGS += -LTCG +endif +endif # INTERNAL_TOOLS +endif # MOZ_PROFILE_GENERATE + +ifdef MOZ_PROFILE_USE +ifndef INTERNAL_TOOLS +OS_CFLAGS += $(PROFILE_USE_CFLAGS) +OS_CXXFLAGS += $(PROFILE_USE_CFLAGS) +OS_LDFLAGS += $(PROFILE_USE_LDFLAGS) +ifeq (WINNT,$(OS_ARCH)) +AR_FLAGS += -LTCG +endif +endif # INTERNAL_TOOLS +endif # MOZ_PROFILE_USE +endif # NO_PROFILE_GUIDED_OPTIMIZE + + +# Does the makefile specifies the internal XPCOM API linkage? +ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY)) +DEFINES += -DMOZILLA_INTERNAL_API +endif + +# Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're +# building libxul libraries +ifdef MOZ_ENABLE_LIBXUL +ifdef LIBXUL_LIBRARY +DEFINES += \ + -D_IMPL_NS_COM \ + -DEXPORT_XPT_API \ + -DEXPORT_XPTC_API \ + -D_IMPL_NS_COM_OBSOLETE \ + -D_IMPL_NS_GFX \ + -D_IMPL_NS_WIDGET \ + -DIMPL_XREAPI \ + -DIMPL_NS_NET \ + -DIMPL_THEBES \ + $(NULL) + +ifndef MOZ_NATIVE_ZLIB +DEFINES += -DZLIB_INTERNAL +endif +endif +endif + +# Force _all_ exported methods to be |_declspec(dllexport)| when we're +# building them into the executable. + +ifeq (,$(filter-out WINNT WINCE OS2, $(OS_ARCH))) +ifdef BUILD_STATIC_LIBS +DEFINES += \ + -D_IMPL_NS_GFX \ + -D_IMPL_NS_MSG_BASE \ + -D_IMPL_NS_WIDGET \ + $(NULL) +endif +endif + +# Flags passed to make-jars.pl + +MAKE_JARS_FLAGS = \ + -t $(topsrcdir) \ + -f $(MOZ_CHROME_FILE_FORMAT) \ + $(NULL) + +ifdef USE_EXTENSION_MANIFEST +MAKE_JARS_FLAGS += -e +endif + +ifdef BOTH_MANIFESTS +MAKE_JARS_FLAGS += --both-manifests +endif + +TAR_CREATE_FLAGS = -cvhf + +ifeq ($(OS_ARCH),BSD_OS) +TAR_CREATE_FLAGS = -cvLf +endif + +ifeq ($(OS_ARCH),OS2) +TAR_CREATE_FLAGS = -cvf +endif + +# +# Personal makefile customizations go in these optional make include files. +# +MY_CONFIG := $(DEPTH)/config/myconfig.mk +MY_RULES := $(DEPTH)/config/myrules.mk + +# +# Default command macros; can be overridden in .mk. +# +CCC = $(CXX) +NFSPWD = $(CONFIG_TOOLS)/nfspwd +PURIFY = purify $(PURIFYOPTIONS) +QUANTIFY = quantify $(QUANTIFYOPTIONS) +ifdef CROSS_COMPILE +XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX) +XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX) +else +XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX) +XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX) +endif + +# Java macros +JAVA_GEN_DIR = _javagen +JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR) +JAVA_IFACES_PKG_NAME = org/mozilla/interfaces + +REQ_INCLUDES = -I$(srcdir) -I. $(foreach d,$(REQUIRES),-I$(DIST)/include/$d) -I$(DIST)/include +ifdef LIBXUL_SDK +REQ_INCLUDES_SDK = $(foreach d,$(REQUIRES),-I$(LIBXUL_SDK)/include/$d) -I$(LIBXUL_SDK)/include +endif + +INCLUDES = $(LOCAL_INCLUDES) $(REQ_INCLUDES) $(REQ_INCLUDES_SDK) -I$(PUBLIC) $(OS_INCLUDES) + +ifndef MOZILLA_INTERNAL_API +INCLUDES += -I$(LIBXUL_DIST)/sdk/include +endif + +# The entire tree should be subject to static analysis using the XPCOM +# script. Additional scripts may be added by specific subdirectories. + +DEHYDRA_SCRIPT = $(topsrcdir)/xpcom/analysis/static-checking.js + +DEHYDRA_MODULES = \ + $(topsrcdir)/xpcom/analysis/final.js \ + $(NULL) + +TREEHYDRA_MODULES = \ + $(topsrcdir)/xpcom/analysis/outparams.js \ + $(topsrcdir)/xpcom/analysis/stack.js \ + $(topsrcdir)/xpcom/analysis/flow.js \ + $(NULL) + +DEHYDRA_ARGS = \ + --topsrcdir=$(topsrcdir) \ + --objdir=$(DEPTH) \ + --dehydra-modules=$(subst $(NULL) ,$(COMMA),$(strip $(DEHYDRA_MODULES))) \ + --treehydra-modules=$(subst $(NULL) ,$(COMMA),$(strip $(TREEHYDRA_MODULES))) \ + $(NULL) + +DEHYDRA_FLAGS = -fplugin=$(DEHYDRA_PATH) -fplugin-arg='$(DEHYDRA_SCRIPT) $(DEHYDRA_ARGS)' + +ifdef DEHYDRA_PATH +OS_CXXFLAGS += $(DEHYDRA_FLAGS) +endif + +CFLAGS = $(OS_CFLAGS) +CXXFLAGS = $(OS_CXXFLAGS) +LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS) + +# Allow each module to override the *default* optimization settings +# by setting MODULE_OPTIMIZE_FLAGS if the developer has not given +# arguments to --enable-optimize +ifdef MOZ_OPTIMIZE +ifeq (1,$(MOZ_OPTIMIZE)) +ifdef MODULE_OPTIMIZE_FLAGS +CFLAGS += $(MODULE_OPTIMIZE_FLAGS) +CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS) +else +CFLAGS += $(MOZ_OPTIMIZE_FLAGS) +CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS) +endif # MODULE_OPTIMIZE_FLAGS +else +CFLAGS += $(MOZ_OPTIMIZE_FLAGS) +CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS) +endif # MOZ_OPTIMIZE == 1 +LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS) +endif # MOZ_OPTIMIZE + +ifdef CROSS_COMPILE +HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS) +else +ifdef MOZ_OPTIMIZE +ifeq (1,$(MOZ_OPTIMIZE)) +ifdef MODULE_OPTIMIZE_FLAGS +HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS) +else +HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS) +endif # MODULE_OPTIMIZE_FLAGS +else +HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS) +endif # MOZ_OPTIMIZE == 1 +endif # MOZ_OPTIMIZE +endif # CROSS_COMPILE + + +ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) +#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded +#// DLL version of the RTL is used... +#// +#//------------------------------------------------------------------------ +ifdef USE_STATIC_LIBS +RTL_FLAGS=-MT # Statically linked multithreaded RTL +ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) +ifndef MOZ_NO_DEBUG_RTL +RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL +endif +endif # MOZ_DEBUG || NS_TRACE_MALLOC + +else # !USE_STATIC_LIBS + +RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL +ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) +ifndef MOZ_NO_DEBUG_RTL +RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL +endif +endif # MOZ_DEBUG || NS_TRACE_MALLOC +endif # USE_STATIC_LIBS +endif # WINNT && !GNU_CC + +ifeq ($(OS_ARCH),Darwin) +# Darwin doesn't cross-compile, so just set both types of flags here. +HOST_CMFLAGS += -fobjc-exceptions +HOST_CMMFLAGS += -fobjc-exceptions +OS_COMPILE_CMFLAGS += -fobjc-exceptions +OS_COMPILE_CMMFLAGS += -fobjc-exceptions +endif + +COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS) +COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS) +COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) +COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) + +ifndef CROSS_COMPILE +HOST_CFLAGS += $(RTL_FLAGS) +endif + +# +# Name of the binary code directories +# +# Override defaults + +# We need to know where to find the libraries we +# put on the link line for binaries, and should +# we link statically or dynamic? Assuming dynamic for now. + +ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC)) +ifneq (,$(filter-out WINCE,$(OS_ARCH))) +LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib +ifdef LIBXUL_SDK +LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib +endif +endif +endif + +# Default location of include files +IDL_DIR = $(DIST)/idl +ifdef MODULE +PUBLIC = $(DIST)/include/$(MODULE) +else +PUBLIC = $(DIST)/include +endif + +XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR) +ifdef LIBXUL_SDK +XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl +endif + +SDK_PUBLIC = $(DIST)/sdk/include +SDK_IDL_DIR = $(DIST)/sdk/idl +SDK_LIB_DIR = $(DIST)/sdk/lib +SDK_BIN_DIR = $(DIST)/sdk/bin + +DEPENDENCIES = .md + +MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS) + +ifdef GC_LEAK_DETECTOR +XPCOM_LIBS += -lboehm +endif + +ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES))) +DEFINES += -DXPCONNECT_STANDALONE +endif + +ifeq ($(OS_ARCH),OS2) +ELF_DYNSTR_GC = echo +else +ELF_DYNSTR_GC = : +endif + +ifndef CROSS_COMPILE +ifdef USE_ELF_DYNSTR_GC +ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS +ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc +endif +endif +endif + +ifeq ($(OS_ARCH),Darwin) +ifdef NEXT_ROOT +export NEXT_ROOT +PBBUILD = NEXT_ROOT= $(PBBUILD_BIN) +else # NEXT_ROOT +PBBUILD = $(PBBUILD_BIN) +endif # NEXT_ROOT +PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)" +ifdef MACOS_SDK_DIR +PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)" +endif # MACOS_SDK_DIR +ifdef MACOSX_DEPLOYMENT_TARGET +export MACOSX_DEPLOYMENT_TARGET +PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)" +endif # MACOSX_DEPLOYMENT_TARGET +ifdef MOZ_OPTIMIZE +ifeq (2,$(MOZ_OPTIMIZE)) +# Only override project defaults if the config specified explicit settings +PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)" +endif # MOZ_OPTIMIZE=2 +endif # MOZ_OPTIMIZE +ifeq (1,$(HAS_XCODE_2_1)) +# Xcode 2.1 puts its build products in a directory corresponding to the +# selected build style/configuration. +XCODE_PRODUCT_DIR = build/$(BUILDSTYLE) +else +XCODE_PRODUCT_DIR = build +endif # HAS_XCODE_2_1=1 +endif # OS_ARCH=Darwin + + +ifdef MOZ_NATIVE_MAKEDEPEND +MKDEPEND_DIR = +MKDEPEND = $(CYGWIN_WRAPPER) $(MOZ_NATIVE_MAKEDEPEND) +else +MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend +MKDEPEND = $(CYGWIN_WRAPPER) $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX) +endif + +# Set link flags according to whether we want a console. +ifdef MOZ_WINCONSOLE +ifeq ($(MOZ_WINCONSOLE),1) +ifeq ($(OS_ARCH),OS2) +BIN_FLAGS += -Zlinker -PM:VIO +endif +ifeq ($(OS_ARCH),WINNT) +ifdef GNU_CC +WIN32_EXE_LDFLAGS += -mconsole +else +WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE +endif +endif +else # MOZ_WINCONSOLE +ifeq ($(OS_ARCH),OS2) +BIN_FLAGS += -Zlinker -PM:PM +endif +ifeq ($(OS_ARCH),WINNT) +ifdef GNU_CC +WIN32_EXE_LDFLAGS += -mwindows +else +WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS +endif +endif +endif +endif + +# Flags needed to link against the component library +ifdef MOZ_COMPONENTLIB +MOZ_COMPONENTLIB_EXTRA_DSO_LIBS = mozcomps xpcom_compat + +# Tell the linker where NSS is, if we're building crypto +ifeq ($(OS_ARCH),Darwin) +ifeq (,$(findstring crypto,$(MOZ_META_COMPONENTS))) +MOZ_COMPONENTLIB_EXTRA_LIBS = $(foreach library, $(patsubst -l%, $(LIB_PREFIX)%$(DLL_SUFFIX), $(filter -l%, $(NSS_LIBS))), -dylib_file @executable_path/$(library):$(DIST)/bin/$(library)) +endif +endif +endif + +# If we're building a component on MSVC, we don't want to generate an +# import lib, because that import lib will collide with the name of a +# static version of the same library. +ifeq ($(GNU_LD)$(OS_ARCH),WINNT) +ifdef IS_COMPONENT +LDFLAGS += -IMPLIB:fake.lib +DELETE_AFTER_LINK = fake.lib fake.exp +endif +endif + +# +# Include any personal overrides the user might think are needed. +# +-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk +-include $(MY_CONFIG) + +###################################################################### +# Now test variables that might have been set or overridden by $(MY_CONFIG). + +DEFINES += -DOSTYPE=\"$(OS_CONFIG)\" +DEFINES += -DOSARCH=$(OS_ARCH) + +# For profiling +ifdef ENABLE_EAZEL_PROFILER +ifndef INTERNAL_TOOLS +ifneq ($(LIBRARY_NAME), xpt) +ifneq (, $(findstring $(shell $(topsrcdir)/build/unix/print-depth-path.sh | awk -F/ '{ print $$2; }'), $(MOZ_PROFILE_MODULES))) +PROFILER_CFLAGS = $(EAZEL_PROFILER_CFLAGS) -DENABLE_EAZEL_PROFILER +PROFILER_LIBS = $(EAZEL_PROFILER_LIBS) +endif +endif +endif +endif + +###################################################################### + +GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB + +ifeq ($(OS_ARCH),Darwin) +ifndef NSDISTMODE +NSDISTMODE=absolute_symlink +endif +PWD := $(shell pwd) +endif + +ifdef NSINSTALL_BIN +NSINSTALL = $(CYGWIN_WRAPPER) $(NSINSTALL_BIN) +else +ifeq (WINNT,$(CROSS_COMPILE)$(OS_ARCH)) +NSINSTALL = $(CYGWIN_WRAPPER) $(MOZ_TOOLS_DIR)/bin/nsinstall +else +ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH)) +NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall +else +NSINSTALL = $(CONFIG_TOOLS)/nsinstall +endif # OS2 +endif # WINNT +endif # NSINSTALL_BIN + + +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 # Darwin +else +# install using relative symbolic links +INSTALL = $(NSINSTALL) -R +endif # absolute_symlink +endif # copy +endif # WINNT/OS2 + +ifeq (,$(filter-out WINCE,$(OS_ARCH))) +NSINSTALL = $(CYGWIN_WRAPPER) nsinstall +INSTALL = $(CYGWIN_WRAPPER) nsinstall +endif + +# Use nsinstall in copy mode to install files on the system +SYSINSTALL = $(NSINSTALL) -t + +ifeq ($(OS_ARCH),WINNT) +ifneq (,$(CYGDRIVE_MOUNT)) +export CYGDRIVE_MOUNT +endif +endif + +# +# Localization build automation +# + +# Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode +# MOZ_UI_LOCALE directly, but use an intermediate variable that can be +# overridden by the command line. (Besides, AB_CD is prettier). +AB_CD = $(MOZ_UI_LOCALE) + +ifndef L10NBASEDIR +L10NBASEDIR = $(error L10NBASEDIR not defined by configure) +endif + +EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1))) + +ifdef relativesrcdir +LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir)) +endif + +ifdef LOCALE_SRCDIR +# if LOCALE_MERGEDIR is set, use mergedir first, then the localization, +# and finally en-US +ifdef LOCALE_MERGEDIR +MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir)) +endif +MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR) +ifdef LOCALE_MERGEDIR +MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US +endif +endif + +ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH))) +RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh +endif + +# +# Java macros +# + +# Make sure any compiled classes work with at least JVM 1.4 +JAVAC_FLAGS += -source 1.4 + +ifdef MOZ_DEBUG +JAVAC_FLAGS += -g +endif diff --git a/js/src/config/dgux.mk b/js/src/config/dgux.mk deleted file mode 100644 index 3b5967e3d1fc..000000000000 --- a/js/src/config/dgux.mk +++ /dev/null @@ -1,64 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# Config stuff for Data General DG/UX -# - -# -# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com) -# - -AS = as -CC = gcc -CCC = g++ - -RANLIB = echo - -# -# _DGUX_SOURCE is needed to turn on a lot of stuff in the headers if -# you're not using DG's compiler. It shouldn't hurt if you are. -# -# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in -# prtime.c -# -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT10_SOURCE -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl - -NOSUCHFILE = /no-such-file diff --git a/js/src/config/elf-dynstr-gc.c b/js/src/config/elf-dynstr-gc.c new file mode 100644 index 000000000000..0702772dce65 --- /dev/null +++ b/js/src/config/elf-dynstr-gc.c @@ -0,0 +1,1245 @@ +/* elf_gc_dynst + * + * This is a program that removes unreferenced strings from the .dynstr + * section in ELF shared objects. It also shrinks the .dynstr section and + * relocates all symbols after it. + * + * This program was written and copyrighted by: + * Alexander Larsson + * + * + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +Elf32_Ehdr *elf_header = NULL; +#define FILE_OFFSET(offset) ((unsigned char *)(elf_header) + (offset)) + +struct dynamic_symbol { + Elf32_Word old_index; + Elf32_Word new_index; + char *string; +}; + +GHashTable *used_dynamic_symbols = NULL; +/* Data is dynamic_symbols, hashes on old_index */ +Elf32_Word hole_index; +Elf32_Word hole_end; +Elf32_Word hole_len; + +Elf32_Addr hole_addr_start; +Elf32_Addr hole_addr_remap_start; +Elf32_Addr hole_addr_remap_end; + +int need_byteswap; + +unsigned char machine_type; + +Elf32_Word +read_word(Elf32_Word w) +{ + if (need_byteswap) + w = GUINT32_SWAP_LE_BE(w); + return w; +} + +Elf32_Sword +read_sword(Elf32_Sword w) +{ + if (need_byteswap) + w = (Elf32_Sword)GUINT32_SWAP_LE_BE((guint32)w); + return w; +} + +void +write_word(Elf32_Word *ptr, Elf32_Word w) +{ + if (need_byteswap) + w = GUINT32_SWAP_LE_BE(w); + *ptr = w; +} + +Elf32_Half +read_half(Elf32_Half h) +{ + if (need_byteswap) + h = GUINT16_SWAP_LE_BE(h); + return h; +} + +void +write_half(Elf32_Half *ptr, Elf32_Half h) +{ + if (need_byteswap) + h = GUINT16_SWAP_LE_BE(h); + *ptr = h; +} + +void +setup_byteswapping(unsigned char ei_data) +{ + need_byteswap = 0; +#if G_BYTE_ORDER == G_BIG_ENDIAN + if (ei_data == ELFDATA2LSB) + need_byteswap = 1; +#endif +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + if (ei_data == ELFDATA2MSB) + need_byteswap = 1; +#endif +} + + +Elf32_Shdr * +elf_find_section_num(int section_index) +{ + Elf32_Shdr *section; + Elf32_Word sectionsize; + + section = (Elf32_Shdr *)FILE_OFFSET(read_word(elf_header->e_shoff)); + sectionsize = read_half(elf_header->e_shentsize); + + section = (Elf32_Shdr *)((char *)section + sectionsize*section_index); + + return section; +} + +Elf32_Shdr * +elf_find_section_named(char *name) +{ + Elf32_Shdr *section; + Elf32_Shdr *strtab_section; + Elf32_Word sectionsize; + int numsections; + char *strtab; + int i = 0; + + section = (Elf32_Shdr *)FILE_OFFSET(read_word(elf_header->e_shoff)); + + strtab_section = elf_find_section_num(read_half(elf_header->e_shstrndx)); + + strtab = (char *)FILE_OFFSET(read_word(strtab_section->sh_offset)); + + sectionsize = read_half(elf_header->e_shentsize); + numsections = read_half(elf_header->e_shnum); + + for (i=0;ish_name)], name) == 0) { + return section; + } + section = (Elf32_Shdr *)((char *)section + sectionsize); + } + return NULL; +} + + +Elf32_Shdr * +elf_find_section(Elf32_Word sh_type) +{ + Elf32_Shdr *section; + Elf32_Word sectionsize; + int numsections; + int i = 0; + + section = (Elf32_Shdr *)FILE_OFFSET(read_word(elf_header->e_shoff)); + sectionsize = read_half(elf_header->e_shentsize); + numsections = read_half(elf_header->e_shnum); + + for (i=0;ish_type) == sh_type) { + return section; + } + section = (Elf32_Shdr *)((char *)section + sectionsize); + } + return NULL; +} + +Elf32_Shdr * +elf_find_next_higher_section(Elf32_Word offset) +{ + Elf32_Shdr *section; + Elf32_Shdr *higher; + Elf32_Word sectionsize; + int numsections; + int i = 0; + + section = (Elf32_Shdr *)FILE_OFFSET(read_word(elf_header->e_shoff)); + sectionsize = read_half(elf_header->e_shentsize); + numsections = read_half(elf_header->e_shnum); + + higher = NULL; + + for (i=0;ish_offset) >= offset) { + if (higher == NULL) { + higher = section; + } else if (read_word(section->sh_offset) < read_word(higher->sh_offset)) { + higher = section; + } + } + + section = (Elf32_Shdr *)((char *)section + sectionsize); + } + + return higher; +} + +Elf32_Word +vma_to_offset(Elf32_Addr addr) +{ + Elf32_Shdr *section; + Elf32_Shdr *higher; + Elf32_Word sectionsize; + int numsections; + int i = 0; + + section = (Elf32_Shdr *)FILE_OFFSET(read_word(elf_header->e_shoff)); + sectionsize = read_half(elf_header->e_shentsize); + numsections = read_half(elf_header->e_shnum); + + higher = NULL; + + for (i=0;i= read_word(section->sh_addr)) && + (addr < read_word(section->sh_addr) + read_word(section->sh_size)) ) { + return read_word(section->sh_offset) + (addr - read_word(section->sh_addr)); + } + + section = (Elf32_Shdr *)((char *)section + sectionsize); + } + + fprintf(stderr, "Warning, unable to convert address %d (0x%x) to file offset\n", + addr, addr); + return 0; +} + + +void +find_segment_addr_min_max(Elf32_Word file_offset, + Elf32_Addr *start, Elf32_Addr *end) +{ + Elf32_Phdr *segment; + Elf32_Word segmentsize; + int numsegments; + int i = 0; + + segment = (Elf32_Phdr *)FILE_OFFSET(read_word(elf_header->e_phoff)); + segmentsize = read_half(elf_header->e_phentsize); + numsegments = read_half(elf_header->e_phnum); + + for (i=0;i= read_word(segment->p_offset)) && + (file_offset < read_word(segment->p_offset) + read_word(segment->p_filesz))) { + *start = read_word(segment->p_vaddr); + *end = read_word(segment->p_vaddr) + read_word(segment->p_memsz); + return; + } + + segment = (Elf32_Phdr *)((char *)segment + segmentsize); + } + fprintf(stderr, "Error: Couldn't find segment in find_segment_addr_min_max()\n"); +} + +void * +dynamic_find_tag(Elf32_Shdr *dynamic, Elf32_Sword d_tag) +{ + int i; + Elf32_Dyn *element; + + element = (Elf32_Dyn *)FILE_OFFSET(read_word(dynamic->sh_offset)); + for (i=0; read_sword(element[i].d_tag) != DT_NULL; i++) { + if (read_sword(element[i].d_tag) == d_tag) { + return FILE_OFFSET(read_word(element[i].d_un.d_ptr)); + } + } + + return NULL; +} + +Elf32_Word +fixup_offset(Elf32_Word offset) +{ + if (offset >= hole_index) { + return offset - hole_len; + } + return offset; +} + +Elf32_Word +fixup_size(Elf32_Word offset, Elf32_Word size) +{ + /* Note: Doesn't handle the cases where the hole and the size intersect + partially. */ + + if ( (hole_index >= offset) && + (hole_index < offset + size)){ + return size - hole_len; + } + + return size; +} + +Elf32_Addr +fixup_addr(Elf32_Addr addr) +{ + if (addr == 0) + return 0; + + /* + if ( (addr < hole_addr_remap_start) || + (addr >= hole_addr_remap_end)) + return addr; + */ + + if (addr >= hole_addr_start) { + return addr - hole_len; + } + return addr; +} + +Elf32_Word +fixup_addr_size(Elf32_Addr addr, Elf32_Word size) +{ + /* Note: Doesn't handle the cases where the hole and the size intersect + partially. */ + /* + if ( (addr < hole_addr_remap_start) || + (addr >= hole_addr_remap_end)) + return size; + */ + if ( (hole_addr_start >= addr) && + (hole_addr_start < addr + size)){ + return size - hole_len; + } + + return size; +} + +void +possibly_add_string(int name_idx, const char *name) +{ + struct dynamic_symbol *dynamic_symbol; + if (name_idx != 0) { + dynamic_symbol = g_hash_table_lookup(used_dynamic_symbols, (gpointer) name_idx); + + if (dynamic_symbol == NULL) { + + dynamic_symbol = g_new(struct dynamic_symbol, 1); + + dynamic_symbol->old_index = name_idx; + dynamic_symbol->new_index = 0; + dynamic_symbol->string = g_strdup(name); + + g_hash_table_insert(used_dynamic_symbols, (gpointer)name_idx, dynamic_symbol); + /*printf("added dynamic string: %s (%d)\n", dynamic_symbol->string, name_idx);*/ + } + } +} + +Elf32_Word +fixup_string(Elf32_Word old_idx) +{ + struct dynamic_symbol *dynamic_symbol; + + if (old_idx == 0) + return 0; + + dynamic_symbol = g_hash_table_lookup(used_dynamic_symbols, (gpointer) old_idx); + + if (dynamic_symbol == NULL) { + fprintf(stderr, "AAAAAAAAAAAARGH!? Unknown string found in fixup (index: %d)!\n", old_idx); + return 0; + } + + return dynamic_symbol->new_index; +} + + + +void +add_strings_from_dynsym(Elf32_Shdr *dynsym, char *strtab) +{ + Elf32_Sym *symbol; + Elf32_Sym *symbol_end; + Elf32_Word entry_size; + + + symbol = (Elf32_Sym *)FILE_OFFSET(read_word(dynsym->sh_offset)); + symbol_end = (Elf32_Sym *)FILE_OFFSET(read_word(dynsym->sh_offset) + read_word(dynsym->sh_size)); + entry_size = read_word(dynsym->sh_entsize); + + while (symbol < symbol_end) { + int name_idx; + struct dynamic_symbol *dynamic_symbol; + + name_idx = read_word(symbol->st_name); + possibly_add_string(name_idx, &strtab[name_idx]); + + + symbol = (Elf32_Sym *)((char *)symbol + entry_size); + } +} + + +void +fixup_strings_in_dynsym(Elf32_Shdr *dynsym) +{ + Elf32_Sym *symbol; + Elf32_Sym *symbol_end; + Elf32_Word entry_size; + + + symbol = (Elf32_Sym *)FILE_OFFSET(read_word(dynsym->sh_offset)); + symbol_end = (Elf32_Sym *)FILE_OFFSET(read_word(dynsym->sh_offset) + read_word(dynsym->sh_size)); + entry_size = read_word(dynsym->sh_entsize); + + while (symbol < symbol_end) { + struct dynamic_symbol *dynamic_symbol; + + write_word(&symbol->st_name, + fixup_string(read_word(symbol->st_name))); + + symbol = (Elf32_Sym *)((char *)symbol + entry_size); + } +} + + +void +add_strings_from_dynamic(Elf32_Shdr *dynamic, char *strtab) +{ + int i; + int name_idx; + Elf32_Dyn *element; + Elf32_Word entry_size; + + entry_size = read_word(dynamic->sh_entsize); + + + element = (Elf32_Dyn *)FILE_OFFSET(read_word(dynamic->sh_offset)); + while (read_sword(element->d_tag) != DT_NULL) { + + switch(read_sword(element->d_tag)) { + case DT_NEEDED: + case DT_SONAME: + case DT_RPATH: + name_idx = read_word(element->d_un.d_val); + /*if (name_idx) printf("d_tag: %d\n", element->d_tag);*/ + possibly_add_string(name_idx, &strtab[name_idx]); + break; + default: + ; + /*printf("unhandled d_tag: %d (0x%x)\n", element->d_tag, element->d_tag);*/ + } + + element = (Elf32_Dyn *)((char *)element + entry_size); + } + +} + +void +fixup_strings_in_dynamic(Elf32_Shdr *dynamic) +{ + int i; + int name_idx; + Elf32_Dyn *element; + Elf32_Word entry_size; + + entry_size = read_word(dynamic->sh_entsize); + + element = (Elf32_Dyn *)FILE_OFFSET(read_word(dynamic->sh_offset)); + while (read_sword(element->d_tag) != DT_NULL) { + + switch(read_sword(element->d_tag)) { + case DT_NEEDED: + case DT_SONAME: + case DT_RPATH: + write_word(&element->d_un.d_val, + fixup_string(read_word(element->d_un.d_val))); + break; + default: + ; + /*printf("unhandled d_tag: %d (0x%x)\n", element->d_tag, element->d_tag);*/ + } + + element = (Elf32_Dyn *)((char *)element + entry_size); + } + +} + + +void +add_strings_from_ver_d(Elf32_Shdr *ver_d, char *strtab) +{ + Elf32_Verdaux *veraux; + Elf32_Verdef *verdef; + int num_aux; + int name_idx; + int i; + int cont; + + verdef = (Elf32_Verdef *)FILE_OFFSET(read_word(ver_d->sh_offset)); + + do { + num_aux = read_half(verdef->vd_cnt); + veraux = (Elf32_Verdaux *)((char *)verdef + read_word(verdef->vd_aux)); + for (i=0; ivda_name); + possibly_add_string(name_idx, &strtab[name_idx]); + veraux = (Elf32_Verdaux *)((char *)veraux + read_word(veraux->vda_next)); + } + + cont = read_word(verdef->vd_next) != 0; + verdef = (Elf32_Verdef *)((char *)verdef + read_word(verdef->vd_next)); + } while (cont); + +} + +void +fixup_strings_in_ver_d(Elf32_Shdr *ver_d) +{ + Elf32_Verdaux *veraux; + Elf32_Verdef *verdef; + int num_aux; + int name_idx; + int i; + int cont; + + verdef = (Elf32_Verdef *)FILE_OFFSET(read_word(ver_d->sh_offset)); + + do { + num_aux = read_half(verdef->vd_cnt); + veraux = (Elf32_Verdaux *)((char *)verdef + read_word(verdef->vd_aux)); + for (i=0; ivda_name, + fixup_string(read_word(veraux->vda_name))); + veraux = (Elf32_Verdaux *)((char *)veraux + read_word(veraux->vda_next)); + } + + cont = read_word(verdef->vd_next) != 0; + verdef = (Elf32_Verdef *)((char *)verdef + read_word(verdef->vd_next)); + } while (cont); + +} + +void +add_strings_from_ver_r(Elf32_Shdr *ver_r, char *strtab) +{ + Elf32_Vernaux *veraux; + Elf32_Verneed *verneed; + int num_aux; + int name_idx; + int i; + int cont; + + verneed = (Elf32_Verneed *)FILE_OFFSET(read_word(ver_r->sh_offset)); + + do { + name_idx = read_word(verneed->vn_file); + possibly_add_string(name_idx, &strtab[name_idx]); + num_aux = read_half(verneed->vn_cnt); + veraux = (Elf32_Vernaux *)((char *)verneed + read_word(verneed->vn_aux)); + for (i=0; ivna_name); + possibly_add_string(name_idx, &strtab[name_idx]); + veraux = (Elf32_Vernaux *)((char *)veraux + read_word(veraux->vna_next)); + } + + cont = read_word(verneed->vn_next) != 0; + verneed = (Elf32_Verneed *)((char *)verneed + read_word(verneed->vn_next)); + } while (cont); +} + +void +fixup_strings_in_ver_r(Elf32_Shdr *ver_r) +{ + Elf32_Vernaux *veraux; + Elf32_Verneed *verneed; + int num_aux; + int name_idx; + int i; + int cont; + + verneed = (Elf32_Verneed *)FILE_OFFSET(read_word(ver_r->sh_offset)); + + do { + write_word(&verneed->vn_file, + fixup_string(read_word(verneed->vn_file))); + num_aux = read_half(verneed->vn_cnt); + veraux = (Elf32_Vernaux *)((char *)verneed + read_word(verneed->vn_aux)); + for (i=0; ivna_name, + fixup_string(read_word(veraux->vna_name))); + veraux = (Elf32_Vernaux *)((char *)veraux + read_word(veraux->vna_next)); + } + + cont = read_word(verneed->vn_next) != 0; + verneed = (Elf32_Verneed *)((char *)verneed + read_word(verneed->vn_next)); + } while (cont); +} + +gboolean sum_size(gpointer key, + struct dynamic_symbol *sym, + int *size) +{ + *size += strlen(sym->string) + 1; + return 1; +} + +struct index_n_dynstr { + int index; + unsigned char *dynstr; +}; + +gboolean output_string(gpointer key, + struct dynamic_symbol *sym, + struct index_n_dynstr *x) +{ + sym->new_index = x->index; + memcpy(x->dynstr + x->index, sym->string, strlen(sym->string) + 1); + x->index += strlen(sym->string) + 1; + return 1; +} + + +unsigned char * +generate_new_dynstr(Elf32_Word *size_out) +{ + int size; + unsigned char *new_dynstr; + struct index_n_dynstr x; + + size = 1; /* first a zero */ + g_hash_table_foreach (used_dynamic_symbols, + (GHFunc)sum_size, + &size); + + + new_dynstr = g_malloc(size); + + new_dynstr[0] = 0; + x.index = 1; + x.dynstr = new_dynstr; + g_hash_table_foreach (used_dynamic_symbols, + (GHFunc)output_string, + &x); + + *size_out = size; + return new_dynstr; +} + +void +remap_sections(void) +{ + Elf32_Shdr *section; + Elf32_Word sectionsize; + int numsections; + int i = 0; + + section = (Elf32_Shdr *)FILE_OFFSET(read_word(elf_header->e_shoff)); + sectionsize = read_half(elf_header->e_shentsize); + numsections = read_half(elf_header->e_shnum); + + for (i=0;ish_size, + fixup_size(read_word(section->sh_offset), + read_word(section->sh_size))); + write_word(§ion->sh_offset, + fixup_offset(read_word(section->sh_offset))); + write_word(§ion->sh_addr, + fixup_addr(read_word(section->sh_addr))); + + section = (Elf32_Shdr *)((char *)section + sectionsize); + } +} + + +void +remap_segments(void) +{ + Elf32_Phdr *segment; + Elf32_Word segmentsize; + Elf32_Word p_align; + int numsegments; + int i = 0; + + segment = (Elf32_Phdr *)FILE_OFFSET(read_word(elf_header->e_phoff)); + segmentsize = read_half(elf_header->e_phentsize); + numsegments = read_half(elf_header->e_phnum); + + for (i=0;ip_filesz, + fixup_size(read_word(segment->p_offset), + read_word(segment->p_filesz))); + write_word(&segment->p_offset, + fixup_offset(read_word(segment->p_offset))); + + write_word(&segment->p_memsz, + fixup_addr_size(read_word(segment->p_vaddr), + read_word(segment->p_memsz))); + write_word(&segment->p_vaddr, + fixup_addr(read_word(segment->p_vaddr))); + write_word(&segment->p_paddr, + read_word(segment->p_vaddr)); + + /* Consistancy checking: */ + p_align = read_word(segment->p_align); + if (p_align > 1) { + if ((read_word(segment->p_vaddr) - read_word(segment->p_offset))%p_align != 0) { + fprintf(stderr, "Warning, creating non-aligned segment addr: %x offset: %x allign: %x\n", + read_word(segment->p_vaddr), read_word(segment->p_offset), p_align); + } + } + + segment = (Elf32_Phdr *)((char *)segment + segmentsize); + } +} + +void +remap_elf_header(void) +{ + write_word(&elf_header->e_phoff, + fixup_offset(read_word(elf_header->e_phoff))); + write_word(&elf_header->e_shoff, + fixup_offset(read_word(elf_header->e_shoff))); + + write_word(&elf_header->e_entry, + fixup_addr(read_word(elf_header->e_entry))); +} + +void +remap_symtab(Elf32_Shdr *symtab) +{ + Elf32_Sym *symbol; + Elf32_Sym *symbol_end; + Elf32_Word entry_size; + + symbol = (Elf32_Sym *)FILE_OFFSET(read_word(symtab->sh_offset)); + symbol_end = (Elf32_Sym *)FILE_OFFSET(read_word(symtab->sh_offset) + + read_word(symtab->sh_size)); + entry_size = read_word(symtab->sh_entsize); + + while (symbol < symbol_end) { + write_word(&symbol->st_value, + fixup_addr(read_word(symbol->st_value))); + symbol = (Elf32_Sym *)((char *)symbol + entry_size); + } +} + + +/* Ugly global variables: */ +Elf32_Addr got_data_start = 0; +Elf32_Addr got_data_end = 0; + + +void +remap_rel_section(Elf32_Rel *rel, Elf32_Word size, Elf32_Word entry_size) +{ + Elf32_Rel *rel_end; + Elf32_Word offset; + Elf32_Addr *addr; + Elf32_Word type; + + rel_end = (Elf32_Rel *)((char *)rel + size); + + while (rel < rel_end) { + type = ELF32_R_TYPE(read_word(rel->r_info)); + switch (machine_type) { + case EM_386: + if ((type == R_386_RELATIVE) || (type == R_386_JMP_SLOT)) { + /* We need to relocate the data this is pointing to too. */ + offset = vma_to_offset(read_word(rel->r_offset)); + + addr = (Elf32_Addr *)FILE_OFFSET(offset); + write_word(addr, + fixup_addr(read_word(*addr))); + } + write_word(&rel->r_offset, + fixup_addr(read_word(rel->r_offset))); + break; + case EM_PPC: + /* The PPC always uses RELA relocations */ + break; + } + + + rel = (Elf32_Rel *)((char *)rel + entry_size); + } +} + +void +remap_rela_section(Elf32_Rela *rela, Elf32_Word size, Elf32_Word entry_size) +{ + Elf32_Rela *rela_end; + Elf32_Addr *addr; + Elf32_Word offset; + Elf32_Word type; + Elf32_Word bitmask; + + rela_end = (Elf32_Rela *)((char *)rela + size); + + while (rela < rela_end) { + type = ELF32_R_TYPE(read_word(rela->r_info)); + switch (machine_type) { + case EM_386: + if ((type == R_386_RELATIVE) || (type == R_386_JMP_SLOT)) { + /* We need to relocate the data this is pointing to too. */ + offset = vma_to_offset(read_word(rela->r_offset)); + + addr = (Elf32_Addr *)FILE_OFFSET(offset); + write_word(addr, + fixup_addr(read_word(*addr))); + } + write_word(&rela->r_offset, + fixup_addr(read_word(rela->r_offset))); + break; + case EM_PPC: +/* Some systems do not have PowerPC relocations defined */ +#ifdef R_PPC_NONE + switch (type) { + case R_PPC_RELATIVE: + write_word((Elf32_Word *)&rela->r_addend, + fixup_addr(read_word(rela->r_addend))); + /* Fall through for 32bit offset fixup */ + case R_PPC_ADDR32: + case R_PPC_GLOB_DAT: + case R_PPC_JMP_SLOT: + write_word(&rela->r_offset, + fixup_addr(read_word(rela->r_offset))); + break; + case R_PPC_NONE: + break; + default: + fprintf(stderr, "Warning, unhandled PPC relocation type %d\n", type); + } +#endif + break; + } + + rela = (Elf32_Rela *)((char *)rela + entry_size); + } +} + +void +remap_i386_got(void) +{ + Elf32_Shdr *got_section; + Elf32_Addr *got; + Elf32_Addr *got_end; + Elf32_Word entry_size; + + got_section = elf_find_section_named(".got"); + if (got_section == NULL) { + fprintf(stderr, "Warning, no .got section\n"); + return; + } + + got_data_start = read_word(got_section->sh_offset); + got_data_end = got_data_start + read_word(got_section->sh_size); + + got = (Elf32_Addr *)FILE_OFFSET(got_data_start); + got_end = (Elf32_Addr *)FILE_OFFSET(got_data_end); + entry_size = read_word(got_section->sh_entsize); + + write_word(got, + fixup_addr(read_word(*got))); /* Pointer to .dynamic */ +} + +void +remap_ppc_got(void) +{ + Elf32_Shdr *got_section; + Elf32_Addr *got; + Elf32_Addr *got_end; + Elf32_Word entry_size; + + got_section = elf_find_section_named(".got"); + if (got_section == NULL) { + fprintf(stderr, "Warning, no .got section\n"); + return; + } + + got_data_start = read_word(got_section->sh_offset); + got_data_end = got_data_start + read_word(got_section->sh_size); + + got = (Elf32_Addr *)FILE_OFFSET(got_data_start); + got_end = (Elf32_Addr *)FILE_OFFSET(got_data_end); + entry_size = read_word(got_section->sh_entsize); + + /* Skip reserved part. + * Note that this should really be found by finding the + * _GLOBAL_OFFSET_TABLE symbol, as it could (according to + * the spec) point to the middle of the got. + */ + got = (Elf32_Addr *)((char *)got + entry_size); /* Skip blrl instruction */ + write_word(got, + fixup_addr(read_word(*got))); /* Pointer to .dynamic */ +} + + +Elf32_Word +get_dynamic_val(Elf32_Shdr *dynamic, Elf32_Sword tag) +{ + Elf32_Dyn *element; + Elf32_Word entry_size; + + entry_size = read_word(dynamic->sh_entsize); + + element = (Elf32_Dyn *)FILE_OFFSET(read_word(dynamic->sh_offset)); + while (read_sword(element->d_tag) != DT_NULL) { + if (read_sword(element->d_tag) == tag) { + return read_word(element->d_un.d_val); + } + element = (Elf32_Dyn *)((char *)element + entry_size); + } + return 0; +} + +void +remap_dynamic(Elf32_Shdr *dynamic, Elf32_Word new_dynstr_size) +{ + Elf32_Dyn *element; + Elf32_Word entry_size; + Elf32_Word rel_size; + Elf32_Word rel_entry_size; + Elf32_Rel *rel; + Elf32_Rela *rela; + int jmprel_overlaps; + Elf32_Word rel_start, rel_end, jmprel_start, jmprel_end; + + entry_size = read_word(dynamic->sh_entsize); + + /* Find out if REL/RELA and JMPREL overlaps: */ + if (get_dynamic_val(dynamic, DT_PLTREL) == DT_REL) { + rel_start = get_dynamic_val(dynamic, DT_REL); + rel_end = rel_start + get_dynamic_val(dynamic, DT_RELSZ); + } else { + rel_start = get_dynamic_val(dynamic, DT_RELA); + rel_end = rel_start + get_dynamic_val(dynamic, DT_RELASZ); + } + jmprel_start = get_dynamic_val(dynamic, DT_JMPREL); + + jmprel_overlaps = 0; + if ((jmprel_start >= rel_start) && (jmprel_start < rel_end)) + jmprel_overlaps = 1; + + element = (Elf32_Dyn *)FILE_OFFSET(read_word(dynamic->sh_offset)); + while (read_sword(element->d_tag) != DT_NULL) { + switch(read_sword(element->d_tag)) { + case DT_STRSZ: + write_word(&element->d_un.d_val, new_dynstr_size); + break; + case DT_PLTGOT: + case DT_HASH: + case DT_STRTAB: + case DT_INIT: + case DT_FINI: + case DT_VERDEF: + case DT_VERNEED: + case DT_VERSYM: + write_word(&element->d_un.d_ptr, + fixup_addr(read_word(element->d_un.d_ptr))); + break; + case DT_JMPREL: + rel_size = get_dynamic_val(dynamic, DT_PLTRELSZ); + if (!jmprel_overlaps) { + if (get_dynamic_val(dynamic, DT_PLTREL) == DT_REL) { + rel_entry_size = get_dynamic_val(dynamic, DT_RELENT); + rel = (Elf32_Rel *)FILE_OFFSET(vma_to_offset(read_word(element->d_un.d_ptr))); + remap_rel_section(rel, rel_size, rel_entry_size); + } else { + rel_entry_size = get_dynamic_val(dynamic, DT_RELAENT); + rela = (Elf32_Rela *)FILE_OFFSET(vma_to_offset(read_word(element->d_un.d_ptr))); + remap_rela_section(rela, rel_size, rel_entry_size); + } + } + write_word(&element->d_un.d_ptr, + fixup_addr(read_word(element->d_un.d_ptr))); + break; + case DT_REL: + rel_size = get_dynamic_val(dynamic, DT_RELSZ); + rel_entry_size = get_dynamic_val(dynamic, DT_RELENT); + rel = (Elf32_Rel *)FILE_OFFSET(vma_to_offset(read_word(element->d_un.d_ptr))); + remap_rel_section(rel, rel_size, rel_entry_size); + + write_word(&element->d_un.d_ptr, + fixup_addr(read_word(element->d_un.d_ptr))); + break; + case DT_RELA: + rel_size = get_dynamic_val(dynamic, DT_RELASZ); + rel_entry_size = get_dynamic_val(dynamic, DT_RELAENT); + rela = (Elf32_Rela *)FILE_OFFSET(vma_to_offset(read_word(element->d_un.d_ptr))); + remap_rela_section(rela, rel_size, rel_entry_size); + + write_word(&element->d_un.d_ptr, + fixup_addr(read_word(element->d_un.d_ptr))); + break; + default: + /*printf("unhandled d_tag: %d (0x%x)\n", read_sword(element->d_tag), read_sword(element->d_tag));*/ + break; + } + + element = (Elf32_Dyn *)((char *)element + entry_size); + } +} + +void +align_hole(Elf32_Word *start, Elf32_Word *end) +{ + Elf32_Word len; + Elf32_Word align; + Elf32_Shdr *section; + Elf32_Word sectionsize; + int numsections; + int i = 0; + int unaligned; + + len = *end - *start; + align = 0; + + sectionsize = read_half(elf_header->e_shentsize); + numsections = read_half(elf_header->e_shnum); + do { + section = (Elf32_Shdr *)FILE_OFFSET(read_word(elf_header->e_shoff)); + unaligned = 0; + + for (i=0;ish_addralign) > 1) && + ( (read_word(section->sh_offset) - len + align)%read_word(section->sh_addralign) != 0) ) { + unaligned = 1; + } + + section = (Elf32_Shdr *)((char *)section + sectionsize); + } + + if (unaligned) { + align++; + } + + } while (unaligned); + + *start += align; +} + +int +main(int argc, char *argv[]) +{ + int fd; + unsigned char *mapping; + Elf32_Word size; + struct stat statbuf; + Elf32_Shdr *dynamic; + Elf32_Shdr *dynsym; + Elf32_Shdr *symtab; + Elf32_Shdr *dynstr; + Elf32_Shdr *hash; + Elf32_Shdr *higher_section; + Elf32_Word dynstr_index; + Elf32_Shdr *ver_r; + Elf32_Shdr *ver_d; + char *dynstr_data; + unsigned char *new_dynstr; + Elf32_Word old_dynstr_size; + Elf32_Word new_dynstr_size; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + fd = open(argv[1], O_RDWR); + if (fd == -1) { + fprintf(stderr, "Cannot open file %s\n", argv[1]); + return 1; + } + + if (fstat(fd, &statbuf) == -1) { + fprintf(stderr, "Cannot stat file %s\n", argv[1]); + return 1; + } + + size = statbuf.st_size; + + mapping = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + + if (mapping == (unsigned char *)-1) { + fprintf(stderr, "Cannot mmap file %s\n", argv[1]); + return 1; + } + + used_dynamic_symbols = g_hash_table_new(g_direct_hash, g_direct_equal); + + elf_header = (Elf32_Ehdr *)mapping; + + if (strncmp((void *)elf_header, ELFMAG, SELFMAG)!=0) { + fprintf(stderr, "Not an ELF file\n"); + return 1; + } + + if (elf_header->e_ident[EI_VERSION] != EV_CURRENT) { + fprintf(stderr, "Wrong ELF file version\n"); + return 1; + } + + if (elf_header->e_ident[EI_CLASS] != ELFCLASS32) { + fprintf(stderr, "Only 32bit ELF files supported\n"); + return 1; + } + + setup_byteswapping(elf_header->e_ident[EI_DATA]); + + machine_type = read_half(elf_header->e_machine); + if ( (machine_type != EM_386) && + (machine_type != EM_PPC) ) { + fprintf(stderr, "Unsupported architecture. Supported are: x86, ppc\n"); + return 1; + } + + if (read_half(elf_header->e_type) != ET_DYN) { + fprintf(stderr, "Not an ELF shared object\n"); + return 1; + } + + dynamic = elf_find_section(SHT_DYNAMIC); + dynsym = elf_find_section(SHT_DYNSYM); + symtab = elf_find_section(SHT_SYMTAB); + dynstr_index = read_word(dynsym->sh_link); + dynstr = elf_find_section_num(dynstr_index); + dynstr_data = (char *)FILE_OFFSET(read_word(dynstr->sh_offset)); + old_dynstr_size = read_word(dynstr->sh_size); + ver_d = elf_find_section(SHT_GNU_verdef); + ver_r = elf_find_section(SHT_GNU_verneed); + hash = elf_find_section(SHT_HASH); + + /* Generate hash table with all used strings: */ + + add_strings_from_dynsym(dynsym, dynstr_data); + add_strings_from_dynamic(dynamic, dynstr_data); + if (ver_d && (read_word(ver_d->sh_link) == dynstr_index)) + add_strings_from_ver_d(ver_d, dynstr_data); + if (ver_r && (read_word(ver_r->sh_link) == dynstr_index)) + add_strings_from_ver_r(ver_r, dynstr_data); + + /* Generate new dynstr section from the used strings hashtable: */ + + new_dynstr = generate_new_dynstr(&new_dynstr_size); + /* + printf("New dynstr size: %d\n", new_dynstr_size); + printf("Old dynstr size: %d\n", old_dynstr_size); + */ + + if (new_dynstr_size >= old_dynstr_size) { + fprintf(stderr, "Couldn't GC any strings, exiting.\n"); + return 0; + } + + /* Fixup all references: */ + fixup_strings_in_dynsym(dynsym); + fixup_strings_in_dynamic(dynamic); + if (ver_d && (read_word(ver_d->sh_link) == dynstr_index)) + fixup_strings_in_ver_d(ver_d); + if (ver_r && (read_word(ver_r->sh_link) == dynstr_index)) + fixup_strings_in_ver_r(ver_r); + + /* Copy over the new dynstr: */ + memcpy(dynstr_data, new_dynstr, new_dynstr_size); + memset(dynstr_data + new_dynstr_size, ' ', old_dynstr_size-new_dynstr_size); + + /* Compact the dynstr section and the file: */ + + /* 1. Set up the data for the fixup_offset() function: */ + hole_index = read_word(dynstr->sh_offset) + new_dynstr_size; + higher_section = elf_find_next_higher_section(hole_index); + hole_end = read_word(higher_section->sh_offset); + + align_hole(&hole_index, &hole_end); + hole_len = hole_end - hole_index; + + hole_addr_start = hole_index; /* TODO: Fix this to something better */ + + find_segment_addr_min_max(read_word(dynstr->sh_offset), + &hole_addr_remap_start, &hole_addr_remap_end); + + /* + printf("Hole remap: 0x%lx - 0x%lx\n", hole_addr_remap_start, hole_addr_remap_end); + + printf("hole: %lu - %lu (%lu bytes)\n", hole_index, hole_end, hole_len); + printf("hole: 0x%lx - 0x%lx (0x%lx bytes)\n", hole_index, hole_end, hole_len); + */ + + /* 2. Change all section and segment sizes and offsets: */ + remap_symtab(dynsym); + if (symtab) + remap_symtab(symtab); + + if (machine_type == EM_386) + remap_i386_got(); + if (machine_type == EM_PPC) + remap_ppc_got(); + + remap_dynamic(dynamic, new_dynstr_size); + remap_sections(); /* After this line the section headers are wrong */ + remap_segments(); + remap_elf_header(); + + /* 3. Do the real compacting. */ + + memmove(mapping + hole_index, + mapping + hole_index + hole_len, + size - (hole_index + hole_len)); + + munmap(mapping, size); + + ftruncate(fd, size - hole_len); + close(fd); + + return 0; +} + + + diff --git a/js/src/config/AIX4.2.mk b/js/src/config/fastcwd.pl similarity index 65% rename from js/src/config/AIX4.2.mk rename to js/src/config/fastcwd.pl index 1e3f1f183d1d..c327ccfdf2b1 100644 --- a/js/src/config/AIX4.2.mk +++ b/js/src/config/fastcwd.pl @@ -1,4 +1,4 @@ -# -*- Mode: makefile -*- +#!perl5 # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +13,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -24,8 +23,8 @@ # Contributor(s): # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,28 +36,31 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for AIX -# +sub fastcwd { + local($odev, $oino, $cdev, $cino, $tdev, $tino); + local(@path, $path); + local(*DIR); -CC = xlC_r -CCC = xlC_r -CFLAGS += -qarch=com -qnoansialias -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV -DHAVE_LOCALTIME_R - -RANLIB = ranlib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< -ARCH := aix -CPU_ARCH = rs6000 -GFX_ARCH = x -INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1 - -#-lpthreads -lc_r - -MKSHLIB = /usr/lpp/xlC/bin/makeC++SharedLib_r -p 0 -G -berok - -ifdef JS_THREADSAFE -XLDFLAGS += -ldl -endif + ($cdev, $cino) = stat('.'); + for (;;) { + ($odev, $oino) = ($cdev, $cino); + chdir('..'); + ($cdev, $cino) = stat('.'); + last if $odev == $cdev && $oino == $cino; + opendir(DIR, '.'); + for (;;) { + $_ = readdir(DIR); + next if $_ eq '.'; + next if $_ eq '..'; + last unless $_; + ($tdev, $tino) = lstat($_); + last unless $tdev != $odev || $tino != $oino; + } + closedir(DIR); + unshift(@path, $_); + } + chdir($path = '/' . join('/', @path)); + $path; +} +1; diff --git a/js/src/config/gcc_hidden.h b/js/src/config/gcc_hidden.h new file mode 100644 index 000000000000..58140c15723e --- /dev/null +++ b/js/src/config/gcc_hidden.h @@ -0,0 +1,2 @@ +/* Begin all files as hidden visibility */ +#pragma GCC visibility push(hidden) diff --git a/js/src/config/IRIX6.2.mk b/js/src/config/insure.mk similarity index 71% rename from js/src/config/IRIX6.2.mk rename to js/src/config/insure.mk index 354f1d119d91..fc796ebf7afc 100644 --- a/js/src/config/IRIX6.2.mk +++ b/js/src/config/insure.mk @@ -1,4 +1,3 @@ -# -*- Mode: makefile -*- # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +12,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -24,8 +22,8 @@ # Contributor(s): # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,8 +35,19 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for IRIX6.3 -# +INCLUDED_INSURE_MK = 1 -include $(DEPTH)/config/IRIX.mk +INSURE_MATCH_SCRIPT=$(topsrcdir)/build/autoconf/match-dir.sh + +INSURE_EXCLUDE=$(shell $(INSURE_MATCH_SCRIPT) $(MOZ_INSURE_EXCLUDE_DIRS)) + +INSURE_INCLUDE=$(shell $(INSURE_MATCH_SCRIPT) $(MOZ_INSURE_DIRS)) + +ifeq ($(INSURE_EXCLUDE),0) + +ifeq ($(INSURE_INCLUDE),1) +CC := $(MOZ_INSURE) +CXX := $(MOZ_INSURE) +endif # INSURE_INCLUDE == 1 + +endif # INSURE_EXCLUDE == 0 diff --git a/js/src/config/SunOS5.10.mk b/js/src/config/make-system-wrappers.pl similarity index 64% rename from js/src/config/SunOS5.10.mk rename to js/src/config/make-system-wrappers.pl index dc0b0a091898..31c9af4a5557 100644 --- a/js/src/config/SunOS5.10.mk +++ b/js/src/config/make-system-wrappers.pl @@ -1,4 +1,4 @@ -# -*- Mode: makefile -*- +#!/usr/bin/perl # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,19 +13,19 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 +# IBM Corporation. +# Portions created by the Initial Developer are Copyright (C) 2004 # the Initial Developer. All Rights Reserved. # # Contributor(s): +# Brian Ryner # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,14 +37,23 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for SunOS5.10, using vendor gcc and NSPR -# +$output_dir = shift; -include $(DEPTH)/config/SunOS5.5.mk +while () { + chomp; + if (-e "$output_dir/$_") { + next; + } -INCLUDES += -I/usr/sfw/include/mozilla/nspr -OTHER_LIBS += -L/usr/sfw/lib/mozilla -R/usr/sfw/lib/mozilla + if (/(.*)\/[^\/*]/) { + mkdir "$output_dir/$1"; + } -CC=gcc + 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/js/src/config/milestone.pl b/js/src/config/milestone.pl new file mode 100644 index 000000000000..e3cee2aed861 --- /dev/null +++ b/js/src/config/milestone.pl @@ -0,0 +1,112 @@ +#!/usr/bin/perl -w +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Win32 Version System. +# +# The Initial Developer of the Original Code is Netscape Communications Corporation +# Portions created by the Initial Developer are Copyright (C) 2002 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +use Getopt::Long; + +use strict; +use vars qw( + $OBJDIR + $SRCDIR + $TOPSRCDIR + $SCRIPTDIR + @TEMPLATE_FILE + $MILESTONE_FILE + $MILESTONE + $MILESTONE_NUM + @MILESTONE_PARTS + $MINI_VERSION + $MICRO_VERSION + $opt_debug + $opt_template + $opt_help + ); + +$SCRIPTDIR = $0; +$SCRIPTDIR =~ s/[^\/]*$//; +push(@INC,$SCRIPTDIR); + +require "Moz/Milestone.pm"; + +&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template'); + +if (defined($opt_help)) { + &usage(); + exit; +} + +if (defined($opt_template)) { + @TEMPLATE_FILE = @ARGV; + if ($opt_debug) { + print("TEMPLATE_FILE = --@TEMPLATE_FILE--\n"); + } +} + +if (!defined($SRCDIR)) { $SRCDIR = '.'; } +if (!defined($OBJDIR)) { $OBJDIR = '.'; } + +$MILESTONE_FILE = "$TOPSRCDIR/config/milestone.txt"; +@MILESTONE_PARTS = (0, 0, 0, 0); + +# +# Grab milestone (top line of $MILESTONE_FILE that starts with a digit) +# +my $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE); + +if (defined(@TEMPLATE_FILE)) { + my $TFILE; + + foreach $TFILE (@TEMPLATE_FILE) { + my $BUILT_FILE = "$OBJDIR/$TFILE"; + $TFILE = "$SRCDIR/$TFILE.tmpl"; + + if (-e $TFILE) { + + Moz::Milestone::build_file($TFILE,$BUILT_FILE); + + } else { + warn("$0: No such file $TFILE!\n"); + } + } +} else { + print "$milestone\n"; +} + +sub usage() { + print <s_value = NULL; + } + return (sp); +} + +pperror(tag, x0,x1,x2,x3,x4) + int tag,x0,x1,x2,x3,x4; +{ + warning("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line); + warning(x0,x1,x2,x3,x4); +} + + +yyerror(s) + register char *s; +{ + fatalerr("Fatal error: %s\n", s); +} +#else /* not CPP */ + +#include "ifparser.h" +struct _parse_data { + struct filepointer *filep; + struct inclist *inc; + char *filename; + const char *line; +}; + +static const char * +my_if_errors (IfParser *ip, const char *cp, const char *expecting) +{ + struct _parse_data *pd = (struct _parse_data *) ip->data; + int lineno = pd->filep->f_line; + char *filename = pd->filename; + char prefix[300]; + int prefixlen; + int i; + + sprintf (prefix, "\"%s\":%d", filename, lineno); + prefixlen = strlen(prefix); + fprintf (stderr, "%s: %s", prefix, pd->line); + i = cp - pd->line; + if (i > 0 && pd->line[i-1] != '\n') { + putc ('\n', stderr); + } + for (i += prefixlen + 3; i > 0; i--) { + putc (' ', stderr); + } + fprintf (stderr, "^--- expecting %s\n", expecting); + return NULL; +} + + +#define MAXNAMELEN 256 + +static struct symtab ** +lookup_variable (IfParser *ip, const char *var, int len) +{ + char tmpbuf[MAXNAMELEN + 1]; + struct _parse_data *pd = (struct _parse_data *) ip->data; + + if (len > MAXNAMELEN) + return 0; + + strncpy (tmpbuf, var, len); + tmpbuf[len] = '\0'; + return isdefined (tmpbuf, pd->inc, NULL); +} + + +static int +my_eval_defined (IfParser *ip, const char *var, int len) +{ + if (lookup_variable (ip, var, len)) + return 1; + else + return 0; +} + +#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_') + +static long +my_eval_variable (IfParser *ip, const char *var, int len) +{ + long val; + struct symtab **s; + + s = lookup_variable (ip, var, len); + if (!s) + return 0; + do { + var = (*s)->s_value; + if (!isvarfirstletter(*var) || !strcmp((*s)->s_name, var)) + break; + s = lookup_variable (ip, var, strlen(var)); + } while (s); + + var = ParseIfExpression(ip, var, &val); + if (var && *var) debug(4, ("extraneous: '%s'\n", var)); + return val; +} + +int +cppsetup(char *filename, + char *line, + struct filepointer *filep, + struct inclist *inc) +{ + IfParser ip; + struct _parse_data pd; + long val = 0; + + pd.filep = filep; + pd.inc = inc; + pd.line = line; + pd.filename = filename; + ip.funcs.handle_error = my_if_errors; + ip.funcs.eval_defined = my_eval_defined; + ip.funcs.eval_variable = my_eval_variable; + ip.data = (char *) &pd; + + (void) ParseIfExpression (&ip, line, &val); + if (val) + return IF; + else + return IFFALSE; +} +#endif /* CPP */ + diff --git a/js/src/config/mkdepend/def.h b/js/src/config/mkdepend/def.h new file mode 100644 index 000000000000..d6e5f89492b7 --- /dev/null +++ b/js/src/config/mkdepend/def.h @@ -0,0 +1,184 @@ +/* $Xorg: def.h,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group. + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/def.h,v 3.14 2003/01/17 17:09:49 tsi Exp $ */ + +#ifndef NO_X11 +#include +#include +#endif +#include +#include +#include +#include +#if 0 +#ifndef X_NOT_POSIX +#ifndef _POSIX_SOURCE +#define _POSIX_SOURCE +#endif +#endif +#endif +#include +#include +#include + +#define MAXDEFINES 512 +#define MAXFILES 1024 +#define MAXINCFILES 256 /* "-include" files */ +#define MAXDIRS 1024 +#define SYMTABINC 10 /* must be > 1 for define() to work right */ +#define TRUE 1 +#define FALSE 0 + +/* the following must match the directives table in main.c */ +#define IF 0 +#define IFDEF 1 +#define IFNDEF 2 +#define ELSE 3 +#define ENDIF 4 +#define DEFINE 5 +#define UNDEF 6 +#define INCLUDE 7 +#define LINE 8 +#define PRAGMA 9 +#define ERROR 10 +#define IDENT 11 +#define SCCS 12 +#define ELIF 13 +#define EJECT 14 +#define WARNING 15 +#define INCLUDENEXT 16 +#define IFFALSE 17 /* pseudo value --- never matched */ +#define ELIFFALSE 18 /* pseudo value --- never matched */ +#define INCLUDEDOT 19 /* pseudo value --- never matched */ +#define IFGUESSFALSE 20 /* pseudo value --- never matched */ +#define ELIFGUESSFALSE 21 /* pseudo value --- never matched */ +#define INCLUDENEXTDOT 22 /* pseudo value --- never matched */ + +#ifdef DEBUG +extern int _debugmask; +/* + * debug levels are: + * + * 0 show ifn*(def)*,endif + * 1 trace defined/!defined + * 2 show #include + * 3 show #include SYMBOL + * 4-6 unused + */ +#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; } +#else +#define debug(level,arg) /**/ +#endif /* DEBUG */ + +typedef unsigned char boolean; + +struct symtab { + char *s_name; + char *s_value; +}; + +/* possible i_flag */ +#define DEFCHECKED (1<<0) /* whether defines have been checked */ +#define NOTIFIED (1<<1) /* whether we have revealed includes */ +#define MARKED (1<<2) /* whether it's in the makefile */ +#define SEARCHED (1<<3) /* whether we have read this */ +#define FINISHED (1<<4) /* whether we are done reading this */ +#define INCLUDED_SYM (1<<5) /* whether #include SYMBOL was found + Can't use i_list if TRUE */ +struct inclist { + char *i_incstring; /* string from #include line */ + char *i_file; /* path name of the include file */ + struct inclist **i_list; /* list of files it itself includes */ + int i_listlen; /* length of i_list */ + struct symtab **i_defs; /* symbol table for this file and its + children when merged */ + int i_ndefs; /* current # defines */ + boolean *i_merged; /* whether we have merged child + defines */ + unsigned char i_flags; +}; + +struct filepointer { + char *f_name; + char *f_p; + char *f_base; + char *f_end; + long f_len; + long f_line; + long cmdinc_count; + char **cmdinc_list; + long cmdinc_line; +}; + +#include +#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */ +char *malloc(), *realloc(); +#endif /* macII */ + +char *copy(char *str); +int match(char *str, char **list); +char *base_name(char *file); +char *getnextline(struct filepointer *fp); +struct symtab **slookup(char *symbol, struct inclist *file); +struct symtab **isdefined(char *symbol, struct inclist *file, + struct inclist **srcfile); +struct symtab **fdefined(char *symbol, struct inclist *file, + struct inclist **srcfile); +struct filepointer *getfile(char *file); +void included_by(struct inclist *ip, + struct inclist *newfile); +struct inclist *newinclude(char *newfile, char *incstring); +void inc_clean (void); +struct inclist *inc_path(char *file, char *include, int type); + +void freefile(struct filepointer *fp); + +void define2(char *name, char *val, struct inclist *file); +void define(char *def, struct inclist *file); +void undefine(char *symbol, struct inclist *file); +int find_includes(struct filepointer *filep, + struct inclist *file, + struct inclist *file_red, + int recursion, boolean failOK); + +void recursive_pr_include(struct inclist *head, + char *file, char *base); +void add_include(struct filepointer *filep, + struct inclist *file, + struct inclist *file_red, + char *include, int type, + boolean failOK); + +int cppsetup(char *filename, + char *line, + struct filepointer *filep, + struct inclist *inc); + + +extern void fatalerr(char *, ...); +extern void warning(char *, ...); +extern void warning1(char *, ...); diff --git a/js/src/config/mkdepend/ifparser.c b/js/src/config/mkdepend/ifparser.c new file mode 100644 index 000000000000..d8d9e76bcbc2 --- /dev/null +++ b/js/src/config/mkdepend/ifparser.c @@ -0,0 +1,549 @@ +/* + * $Xorg: ifparser.c,v 1.3 2000/08/17 19:41:50 cpqbld Exp $ + * + * Copyright 1992 Network Computing Devices, Inc. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Network Computing Devices may not be + * used in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Network Computing Devices makes + * no representations about the suitability of this software for any purpose. + * It is provided ``as is'' without express or implied warranty. + * + * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton + * Network Computing Devices, Inc. + * + * Simple if statement processor + * + * This module can be used to evaluate string representations of C language + * if constructs. It accepts the following grammar: + * + * EXPRESSION := VALUE + * | VALUE BINOP EXPRESSION + * | VALUE '?' EXPRESSION ':' EXPRESSION + * + * VALUE := '(' EXPRESSION ')' + * | '!' VALUE + * | '-' VALUE + * | '+' VALUE + * | '~' VALUE + * | 'defined' '(' variable ')' + * | 'defined' variable + * | # variable '(' variable-list ')' + * | variable + * | number + * + * BINOP := '*' | '/' | '%' + * | '+' | '-' + * | '<<' | '>>' + * | '<' | '>' | '<=' | '>=' + * | '==' | '!=' + * | '&' | '^' | '|' + * | '&&' | '||' + * + * The normal C order of precedence is supported. + * + * + * External Entry Points: + * + * ParseIfExpression parse a string for #if + */ +/* $XFree86: xc/config/makedepend/ifparser.c,v 3.11 2002/09/23 01:48:08 tsi Exp $ */ + +#include "ifparser.h" +#include +#include +#include + +/**************************************************************************** + Internal Macros and Utilities for Parser + ****************************************************************************/ + +#define DO(val) if (!(val)) return NULL +#define CALLFUNC(ggg,fff) (*((ggg)->funcs.fff)) +#define SKIPSPACE(ccc) while (isspace(*ccc)) ccc++ +#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_') + + +static const char * +parse_variable (IfParser *g, const char *cp, const char **varp) +{ + SKIPSPACE (cp); + + if (!isvarfirstletter (*cp)) + return CALLFUNC(g, handle_error) (g, cp, "variable name"); + + *varp = cp; + /* EMPTY */ + for (cp++; isalnum(*cp) || *cp == '_'; cp++) ; + return cp; +} + + +static const char * +parse_number (IfParser *g, const char *cp, long *valp) +{ + long base = 10; + SKIPSPACE (cp); + + if (!isdigit(*cp)) + return CALLFUNC(g, handle_error) (g, cp, "number"); + + *valp = 0; + + if (*cp == '0') { + cp++; + if ((*cp == 'x') || (*cp == 'X')) { + base = 16; + cp++; + } else { + base = 8; + } + } + + /* Ignore overflows and assume ASCII, what source is usually written in */ + while (1) { + int increment = -1; + if (base == 8) { + if ((*cp >= '0') && (*cp <= '7')) + increment = *cp++ - '0'; + } else if (base == 16) { + if ((*cp >= '0') && (*cp <= '9')) + increment = *cp++ - '0'; + else if ((*cp >= 'A') && (*cp <= 'F')) + increment = *cp++ - ('A' - 10); + else if ((*cp >= 'a') && (*cp <= 'f')) + increment = *cp++ - ('a' - 10); + } else { /* Decimal */ + if ((*cp >= '0') && (*cp <= '9')) + increment = *cp++ - '0'; + } + if (increment < 0) + break; + *valp = (*valp * base) + increment; + } + + /* Skip trailing qualifiers */ + while (*cp == 'U' || *cp == 'u' || *cp == 'L' || *cp == 'l') cp++; + return cp; +} + +static const char * +parse_character (IfParser *g, const char *cp, long *valp) +{ + char val; + + SKIPSPACE (cp); + if (*cp == '\\') + switch (cp[1]) { + case 'n': val = '\n'; break; + case 't': val = '\t'; break; + case 'v': val = '\v'; break; + case 'b': val = '\b'; break; + case 'r': val = '\r'; break; + case 'f': val = '\f'; break; + case 'a': val = '\a'; break; + case '\\': val = '\\'; break; + case '?': val = '\?'; break; + case '\'': val = '\''; break; + case '\"': val = '\"'; break; + case 'x': val = (char) strtol (cp + 2, NULL, 16); break; + default: val = (char) strtol (cp + 1, NULL, 8); break; + } + else + val = *cp; + while (*cp != '\'') cp++; + *valp = (long) val; + return cp; +} + +static const char * +parse_value (IfParser *g, const char *cp, long *valp) +{ + const char *var, *varend; + + *valp = 0; + + SKIPSPACE (cp); + if (!*cp) + return cp; + + switch (*cp) { + case '(': + DO (cp = ParseIfExpression (g, cp + 1, valp)); + SKIPSPACE (cp); + if (*cp != ')') + return CALLFUNC(g, handle_error) (g, cp, ")"); + + return cp + 1; /* skip the right paren */ + + case '!': + DO (cp = parse_value (g, cp + 1, valp)); + *valp = !(*valp); + return cp; + + case '-': + DO (cp = parse_value (g, cp + 1, valp)); + *valp = -(*valp); + return cp; + + case '+': + DO (cp = parse_value (g, cp + 1, valp)); + return cp; + + case '~': + DO (cp = parse_value (g, cp + 1, valp)); + *valp = ~(*valp); + return cp; + + case '#': + DO (cp = parse_variable (g, cp + 1, &var)); + SKIPSPACE (cp); + if (*cp != '(') + return CALLFUNC(g, handle_error) (g, cp, "("); + do { + DO (cp = parse_variable (g, cp + 1, &var)); + SKIPSPACE (cp); + } while (*cp && *cp != ')'); + if (*cp != ')') + return CALLFUNC(g, handle_error) (g, cp, ")"); + *valp = 1; /* XXX */ + return cp + 1; + + case '\'': + DO (cp = parse_character (g, cp + 1, valp)); + if (*cp != '\'') + return CALLFUNC(g, handle_error) (g, cp, "'"); + return cp + 1; + + case 'd': + if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) { + int paren = 0; + int len; + + cp += 7; + SKIPSPACE (cp); + if (*cp == '(') { + paren = 1; + cp++; + } + DO (cp = parse_variable (g, cp, &var)); + len = cp - var; + SKIPSPACE (cp); + if (paren && *cp != ')') + return CALLFUNC(g, handle_error) (g, cp, ")"); + *valp = (*(g->funcs.eval_defined)) (g, var, len); + return cp + paren; /* skip the right paren */ + } + /* fall out */ + } + + if (isdigit(*cp)) { + DO (cp = parse_number (g, cp, valp)); + } else if (!isvarfirstletter(*cp)) + return CALLFUNC(g, handle_error) (g, cp, "variable or number"); + else { + DO (cp = parse_variable (g, cp, &var)); + varend = cp; + SKIPSPACE(cp); + if (*cp != '(') { + *valp = (*(g->funcs.eval_variable)) (g, var, varend - var); + } else { + do { + long dummy; + DO (cp = ParseIfExpression (g, cp + 1, &dummy)); + SKIPSPACE(cp); + if (*cp == ')') + break; + if (*cp != ',') + return CALLFUNC(g, handle_error) (g, cp, ","); + } while (1); + + *valp = 1; /* XXX */ + cp++; + } + } + + return cp; +} + + + +static const char * +parse_product (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_value (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '*': + DO (cp = parse_product (g, cp + 1, &rightval)); + *valp = (*valp * rightval); + break; + + case '/': + DO (cp = parse_product (g, cp + 1, &rightval)); + *valp = (*valp / rightval); + break; + + case '%': + DO (cp = parse_product (g, cp + 1, &rightval)); + *valp = (*valp % rightval); + break; + } + return cp; +} + + +static const char * +parse_sum (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_product (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '+': + DO (cp = parse_sum (g, cp + 1, &rightval)); + *valp = (*valp + rightval); + break; + + case '-': + DO (cp = parse_sum (g, cp + 1, &rightval)); + *valp = (*valp - rightval); + break; + } + return cp; +} + + +static const char * +parse_shift (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_sum (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '<': + if (cp[1] == '<') { + DO (cp = parse_shift (g, cp + 2, &rightval)); + *valp = (*valp << rightval); + } + break; + + case '>': + if (cp[1] == '>') { + DO (cp = parse_shift (g, cp + 2, &rightval)); + *valp = (*valp >> rightval); + } + break; + } + return cp; +} + + +static const char * +parse_inequality (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_shift (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '<': + if (cp[1] == '=') { + DO (cp = parse_inequality (g, cp + 2, &rightval)); + *valp = (*valp <= rightval); + } else { + DO (cp = parse_inequality (g, cp + 1, &rightval)); + *valp = (*valp < rightval); + } + break; + + case '>': + if (cp[1] == '=') { + DO (cp = parse_inequality (g, cp + 2, &rightval)); + *valp = (*valp >= rightval); + } else { + DO (cp = parse_inequality (g, cp + 1, &rightval)); + *valp = (*valp > rightval); + } + break; + } + return cp; +} + + +static const char * +parse_equality (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_inequality (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '=': + if (cp[1] == '=') + cp++; + DO (cp = parse_equality (g, cp + 1, &rightval)); + *valp = (*valp == rightval); + break; + + case '!': + if (cp[1] != '=') + break; + DO (cp = parse_equality (g, cp + 2, &rightval)); + *valp = (*valp != rightval); + break; + } + return cp; +} + + +static const char * +parse_band (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_equality (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '&': + if (cp[1] != '&') { + DO (cp = parse_band (g, cp + 1, &rightval)); + *valp = (*valp & rightval); + } + break; + } + return cp; +} + + +static const char * +parse_bxor (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_band (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '^': + DO (cp = parse_bxor (g, cp + 1, &rightval)); + *valp = (*valp ^ rightval); + break; + } + return cp; +} + + +static const char * +parse_bor (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_bxor (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '|': + if (cp[1] != '|') { + DO (cp = parse_bor (g, cp + 1, &rightval)); + *valp = (*valp | rightval); + } + break; + } + return cp; +} + + +static const char * +parse_land (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_bor (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '&': + if (cp[1] != '&') + return CALLFUNC(g, handle_error) (g, cp, "&&"); + DO (cp = parse_land (g, cp + 2, &rightval)); + *valp = (*valp && rightval); + break; + } + return cp; +} + + +static const char * +parse_lor (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_land (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '|': + if (cp[1] != '|') + return CALLFUNC(g, handle_error) (g, cp, "||"); + DO (cp = parse_lor (g, cp + 2, &rightval)); + *valp = (*valp || rightval); + break; + } + return cp; +} + + +static const char * +parse_cond(IfParser *g, const char *cp, long *valp) +{ + long trueval, falseval; + + DO (cp = parse_lor (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '?': + DO (cp = parse_cond (g, cp + 1, &trueval)); + SKIPSPACE (cp); + if (*cp != ':') + return CALLFUNC(g, handle_error) (g, cp, ":"); + DO (cp = parse_cond (g, cp + 1, &falseval)); + *valp = (*valp ? trueval : falseval); + break; + } + return cp; +} + + +/**************************************************************************** + External Entry Points + ****************************************************************************/ + +const char * +ParseIfExpression (IfParser *g, const char *cp, long *valp) +{ + return parse_cond (g, cp, valp); +} diff --git a/js/src/config/mkdepend/ifparser.h b/js/src/config/mkdepend/ifparser.h new file mode 100644 index 000000000000..89d2a2fb2c46 --- /dev/null +++ b/js/src/config/mkdepend/ifparser.h @@ -0,0 +1,83 @@ +/* + * $Xorg: ifparser.h,v 1.3 2000/08/17 19:41:51 cpqbld Exp $ + * + * Copyright 1992 Network Computing Devices, Inc. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Network Computing Devices may not be + * used in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Network Computing Devices makes + * no representations about the suitability of this software for any purpose. + * It is provided ``as is'' without express or implied warranty. + * + * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton + * Network Computing Devices, Inc. + * + * Simple if statement processor + * + * This module can be used to evaluate string representations of C language + * if constructs. It accepts the following grammar: + * + * EXPRESSION := VALUE + * | VALUE BINOP EXPRESSION + * | VALUE '?' EXPRESSION ':' EXPRESSION + * + * VALUE := '(' EXPRESSION ')' + * | '!' VALUE + * | '-' VALUE + * | '~' VALUE + * | 'defined' '(' variable ')' + * | variable + * | number + * + * BINOP := '*' | '/' | '%' + * | '+' | '-' + * | '<<' | '>>' + * | '<' | '>' | '<=' | '>=' + * | '==' | '!=' + * | '&' | '^' | '|' + * | '&&' | '||' + * + * The normal C order of precedence is supported. + * + * + * External Entry Points: + * + * ParseIfExpression parse a string for #if + */ + +/* $XFree86: xc/config/makedepend/ifparser.h,v 3.5 2001/07/25 15:04:40 dawes Exp $ */ + +#include + +typedef int Bool; +#define False 0 +#define True 1 + +typedef struct _if_parser { + struct { /* functions */ + const char *(*handle_error) (struct _if_parser *, const char *, + const char *); + long (*eval_variable) (struct _if_parser *, const char *, int); + int (*eval_defined) (struct _if_parser *, const char *, int); + } funcs; + char *data; +} IfParser; + +const char *ParseIfExpression ( + IfParser *, + const char *, + long * +); + diff --git a/js/src/config/mkdepend/imakemdep.h b/js/src/config/mkdepend/imakemdep.h new file mode 100644 index 000000000000..5c5835153842 --- /dev/null +++ b/js/src/config/mkdepend/imakemdep.h @@ -0,0 +1,733 @@ + +/* $XConsortium: imakemdep.h,v 1.83 95/04/07 19:47:46 kaleb Exp $ */ +/* $XFree86: xc/config/imake/imakemdep.h,v 3.12 1995/07/08 10:22:17 dawes Exp $ */ +/* + +Copyright (c) 1993, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + + +/* + * This file contains machine-dependent constants for the imake utility. + * When porting imake, read each of the steps below and add in any necessary + * definitions. In general you should *not* edit ccimake.c or imake.c! + */ + +#ifdef CCIMAKE +/* + * Step 1: imake_ccflags + * Define any special flags that will be needed to get imake.c to compile. + * These will be passed to the compile along with the contents of the + * make variable BOOTSTRAPCFLAGS. + */ +#ifdef hpux +#ifdef hp9000s800 +#define imake_ccflags "-DSYSV" +#else +#define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV" +#endif +#endif + +#if defined(macII) || defined(_AUX_SOURCE) +#define imake_ccflags "-DmacII -DSYSV" +#endif + +#ifdef stellar +#define imake_ccflags "-DSYSV" +#endif + +#if defined(USL) || defined(Oki) || defined(NCR) +#define imake_ccflags "-Xc -DSVR4" +#endif + +#ifdef sony +#if defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV) +#define imake_ccflags "-DSVR4" +#else +#include +#if NEWSOS < 41 +#define imake_ccflags "-Dbsd43 -DNOSTDHDRS" +#else +#if NEWSOS < 42 +#define imake_ccflags "-Dbsd43" +#endif +#endif +#endif +#endif + +#ifdef _CRAY +#define imake_ccflags "-DSYSV -DUSG" +#endif + +#if defined(_IBMR2) || defined(aix) +#define imake_ccflags "-Daix -DSYSV" +#endif + +#ifdef Mips +# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) +# define imake_ccflags "-DBSD43" +# else +# define imake_ccflags "-DSYSV" +# endif +#endif + +#ifdef is68k +#define imake_ccflags "-Dluna -Duniosb" +#endif + +#ifdef SYSV386 +# ifdef SVR4 +# define imake_ccflags "-Xc -DSVR4" +# else +# define imake_ccflags "-DSYSV" +# endif +#endif + +#ifdef SVR4 +# ifdef i386 +# define imake_ccflags "-Xc -DSVR4" +# endif +#endif + +#ifdef SYSV +# ifdef i386 +# define imake_ccflags "-DSYSV" +# endif +#endif + +#ifdef __convex__ +#define imake_ccflags "-fn -tm c1" +#endif + +#ifdef apollo +#define imake_ccflags "-DX_NOT_POSIX" +#endif + +#ifdef WIN32 +#define imake_ccflags "-nologo -batch -D__STDC__" +#endif + +#ifdef __uxp__ +#define imake_ccflags "-DSVR4 -DANSICPP" +#endif + +#ifdef __sxg__ +#define imake_ccflags "-DSYSV -DUSG -DNOSTDHDRS" +#endif + +#ifdef sequent +#define imake_ccflags "-DX_NOT_STDC_ENV -DX_NOT_POSIX" +#endif + +#ifdef _SEQUENT_ +#define imake_ccflags "-DSYSV -DUSG" +#endif + +#if defined(SX) || defined(PC_UX) +#define imake_ccflags "-DSYSV" +#endif + +#ifdef nec_ews_svr2 +#define imake_ccflags "-DUSG" +#endif + +#if defined(nec_ews_svr4) || defined(_nec_ews_svr4) || defined(_nec_up) || defined(_nec_ft) +#define imake_ccflags "-DSVR4" +#endif + +#ifdef MACH +#define imake_ccflags "-DNOSTDHDRS" +#endif + +/* this is for OS/2 under EMX. This won't work with DOS */ +#if defined(__EMX__) +#define imake_ccflags "-DBSD43" +#endif + +#else /* not CCIMAKE */ +#ifndef MAKEDEPEND +/* + * Step 2: dup2 + * If your OS doesn't have a dup2() system call to duplicate one file + * descriptor onto another, define such a mechanism here (if you don't + * already fall under the existing category(ies). + */ +#if defined(SYSV) && !defined(_CRAY) && !defined(Mips) && !defined(_SEQUENT_) +#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : (close(fd2), \ + fcntl(fd1, F_DUPFD, fd2))) +#endif + + +/* + * Step 3: FIXUP_CPP_WHITESPACE + * If your cpp collapses tabs macro expansions into a single space and + * replaces escaped newlines with a space, define this symbol. This will + * cause imake to attempt to patch up the generated Makefile by looking + * for lines that have colons in them (this is why the rules file escapes + * all colons). One way to tell if you need this is to see whether or not + * your Makefiles have no tabs in them and lots of @@ strings. + */ +#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || (defined(AMOEBA) && defined(CROSS_COMPILE)) +#define FIXUP_CPP_WHITESPACE +#endif +#ifdef WIN32 +#define REMOVE_CPP_LEADSPACE +#define INLINE_SYNTAX +#define MAGIC_MAKE_VARS +#endif +#ifdef __minix_vmd +#define FIXUP_CPP_WHITESPACE +#endif + +/* + * Step 4: USE_CC_E, DEFAULT_CC, DEFAULT_CPP + * If you want to use cc -E instead of cpp, define USE_CC_E. + * If use cc -E but want a different compiler, define DEFAULT_CC. + * If the cpp you need is not in /lib/cpp, define DEFAULT_CPP. + */ +#ifdef hpux +#define USE_CC_E +#endif +#ifdef WIN32 +#define USE_CC_E +#define DEFAULT_CC "cl" +#endif +#ifdef apollo +#define DEFAULT_CPP "/usr/lib/cpp" +#endif +#if defined(_IBMR2) && !defined(DEFAULT_CPP) +#define DEFAULT_CPP "/usr/lpp/X11/Xamples/util/cpp/cpp" +#endif +#if defined(sun) && defined(SVR4) +#define DEFAULT_CPP "/usr/ccs/lib/cpp" +#endif +#ifdef __bsdi__ +#define DEFAULT_CPP "/usr/bin/cpp" +#endif +#ifdef __uxp__ +#define DEFAULT_CPP "/usr/ccs/lib/cpp" +#endif +#ifdef __sxg__ +#define DEFAULT_CPP "/usr/lib/cpp" +#endif +#ifdef _CRAY +#define DEFAULT_CPP "/lib/pcpp" +#endif +#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#define DEFAULT_CPP "/usr/libexec/cpp" +#endif +#ifdef MACH +#define USE_CC_E +#endif +#ifdef __minix_vmd +#define DEFAULT_CPP "/usr/lib/cpp" +#endif +#if defined(__EMX__) +/* expects cpp in PATH */ +#define DEFAULT_CPP "cpp" +#endif + +/* + * Step 5: cpp_argv + * The following table contains the flags that should be passed + * whenever a Makefile is being generated. If your preprocessor + * doesn't predefine any unique symbols, choose one and add it to the + * end of this table. Then, do the following: + * + * a. Use this symbol in Imake.tmpl when setting MacroFile. + * b. Put this symbol in the definition of BootstrapCFlags in your + * .cf file. + * c. When doing a make World, always add "BOOTSTRAPCFLAGS=-Dsymbol" + * to the end of the command line. + * + * Note that you may define more than one symbol (useful for platforms + * that support multiple operating systems). + */ + +#define ARGUMENTS 50 /* number of arguments in various arrays */ +char *cpp_argv[ARGUMENTS] = { + "cc", /* replaced by the actual program to exec */ + "-I.", /* add current directory to include path */ +#ifdef unix + "-Uunix", /* remove unix symbol so that filename unix.c okay */ +#endif +#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(MACH) +# ifdef __i386__ + "-D__i386__", +# endif +# ifdef __x86_64__ + "-D__x86_64__", +# endif +# ifdef __GNUC__ + "-traditional", +# endif +#endif +#ifdef M4330 + "-DM4330", /* Tektronix */ +#endif +#ifdef M4310 + "-DM4310", /* Tektronix */ +#endif +#if defined(macII) || defined(_AUX_SOURCE) + "-DmacII", /* Apple A/UX */ +#endif +#ifdef USL + "-DUSL", /* USL */ +#endif +#ifdef sony + "-Dsony", /* Sony */ +#if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) && NEWSOS < 42 + "-Dbsd43", +#endif +#endif +#ifdef _IBMR2 + "-D_IBMR2", /* IBM RS-6000 (we ensured that aix is defined above */ +#ifndef aix +#define aix /* allow BOOTSTRAPCFLAGS="-D_IBMR2" */ +#endif +#endif /* _IBMR2 */ +#ifdef aix + "-Daix", /* AIX instead of AOS */ +#ifndef ibm +#define ibm /* allow BOOTSTRAPCFLAGS="-Daix" */ +#endif +#endif /* aix */ +#ifdef ibm + "-Dibm", /* IBM PS/2 and RT under both AOS and AIX */ +#endif +#ifdef luna + "-Dluna", /* OMRON luna 68K and 88K */ +#ifdef luna1 + "-Dluna1", +#endif +#ifdef luna88k /* need not on UniOS-Mach Vers. 1.13 */ + "-traditional", /* for some older version */ +#endif /* instead of "-DXCOMM=\\#" */ +#ifdef uniosb + "-Duniosb", +#endif +#ifdef uniosu + "-Duniosu", +#endif +#endif /* luna */ +#ifdef _CRAY /* Cray */ + "-Ucray", +#endif +#ifdef Mips + "-DMips", /* Define and use Mips for Mips Co. OS/mach. */ +# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) + "-DBSD43", /* Mips RISCOS supports two environments */ +# else + "-DSYSV", /* System V environment is the default */ +# endif +#endif /* Mips */ +#ifdef MOTOROLA + "-DMOTOROLA", /* Motorola Delta Systems */ +# ifdef SYSV + "-DSYSV", +# endif +# ifdef SVR4 + "-DSVR4", +# endif +#endif /* MOTOROLA */ +#ifdef i386 + "-Di386", +# ifdef SVR4 + "-DSVR4", +# endif +# ifdef SYSV + "-DSYSV", +# ifdef ISC + "-DISC", +# ifdef ISC40 + "-DISC40", /* ISC 4.0 */ +# else +# ifdef ISC202 + "-DISC202", /* ISC 2.0.2 */ +# else +# ifdef ISC30 + "-DISC30", /* ISC 3.0 */ +# else + "-DISC22", /* ISC 2.2.1 */ +# endif +# endif +# endif +# endif +# ifdef SCO + "-DSCO", +# ifdef SCO324 + "-DSCO324", +# endif +# endif +# endif +# ifdef ESIX + "-DESIX", +# endif +# ifdef ATT + "-DATT", +# endif +# ifdef DELL + "-DDELL", +# endif +#endif +#ifdef SYSV386 /* System V/386 folks, obsolete */ + "-Di386", +# ifdef SVR4 + "-DSVR4", +# endif +# ifdef ISC + "-DISC", +# ifdef ISC40 + "-DISC40", /* ISC 4.0 */ +# else +# ifdef ISC202 + "-DISC202", /* ISC 2.0.2 */ +# else +# ifdef ISC30 + "-DISC30", /* ISC 3.0 */ +# else + "-DISC22", /* ISC 2.2.1 */ +# endif +# endif +# endif +# endif +# ifdef SCO + "-DSCO", +# ifdef SCO324 + "-DSCO324", +# endif +# endif +# ifdef ESIX + "-DESIX", +# endif +# ifdef ATT + "-DATT", +# endif +# ifdef DELL + "-DDELL", +# endif +#endif +#ifdef __osf__ + "-D__osf__", +# ifdef __mips__ + "-D__mips__", +# endif +# ifdef __alpha + "-D__alpha", +# endif +# ifdef __i386__ + "-D__i386__", +# endif +# ifdef __GNUC__ + "-traditional", +# endif +#endif +#ifdef Oki + "-DOki", +#endif +#ifdef sun +#ifdef SVR4 + "-DSVR4", +#endif +#endif +#ifdef WIN32 + "-DWIN32", + "-nologo", + "-batch", + "-D__STDC__", +#endif +#ifdef NCR + "-DNCR", /* NCR */ +#endif +#ifdef linux + "-traditional", + "-Dlinux", +#endif +#ifdef __uxp__ + "-D__uxp__", +#endif +#ifdef __sxg__ + "-D__sxg__", +#endif +#ifdef nec_ews_svr2 + "-Dnec_ews_svr2", +#endif +#ifdef AMOEBA + "-DAMOEBA", +# ifdef CROSS_COMPILE + "-DCROSS_COMPILE", +# ifdef CROSS_i80386 + "-Di80386", +# endif +# ifdef CROSS_sparc + "-Dsparc", +# endif +# ifdef CROSS_mc68000 + "-Dmc68000", +# endif +# else +# ifdef i80386 + "-Di80386", +# endif +# ifdef sparc + "-Dsparc", +# endif +# ifdef mc68000 + "-Dmc68000", +# endif +# endif +#endif +#ifdef __minix_vmd + "-Dminix", +#endif + +#if defined(__EMX__) + "-traditional", + "-Demxos2", +#endif + +}; +#else /* else MAKEDEPEND */ +/* + * Step 6: predefs + * If your compiler and/or preprocessor define any specific symbols, add + * them to the the following table. The definition of struct symtab is + * in util/makedepend/def.h. + */ +struct symtab predefs[] = { +#ifdef apollo + {"apollo", "1"}, +#endif +#ifdef ibm032 + {"ibm032", "1"}, +#endif +#ifdef ibm + {"ibm", "1"}, +#endif +#ifdef aix + {"aix", "1"}, +#endif +#ifdef sun + {"sun", "1"}, +#endif +#ifdef sun2 + {"sun2", "1"}, +#endif +#ifdef sun3 + {"sun3", "1"}, +#endif +#ifdef sun4 + {"sun4", "1"}, +#endif +#ifdef sparc + {"sparc", "1"}, +#endif +#ifdef __sparc__ + {"__sparc__", "1"}, +#endif +#ifdef hpux + {"hpux", "1"}, +#endif +#ifdef __hpux + {"__hpux", "1"}, +#endif +#ifdef __hp9000s800 + {"__hp9000s800", "1"}, +#endif +#ifdef __hp9000s700 + {"__hp9000s700", "1"}, +#endif +#ifdef vax + {"vax", "1"}, +#endif +#ifdef VMS + {"VMS", "1"}, +#endif +#ifdef cray + {"cray", "1"}, +#endif +#ifdef CRAY + {"CRAY", "1"}, +#endif +#ifdef _CRAY + {"_CRAY", "1"}, +#endif +#ifdef att + {"att", "1"}, +#endif +#ifdef mips + {"mips", "1"}, +#endif +#ifdef __mips__ + {"__mips__", "1"}, +#endif +#ifdef ultrix + {"ultrix", "1"}, +#endif +#ifdef stellar + {"stellar", "1"}, +#endif +#ifdef mc68000 + {"mc68000", "1"}, +#endif +#ifdef mc68020 + {"mc68020", "1"}, +#endif +#ifdef __GNUC__ + {"__GNUC__", "1"}, +#endif +#if __STDC__ + {"__STDC__", "1"}, +#endif +#ifdef __HIGHC__ + {"__HIGHC__", "1"}, +#endif +#ifdef CMU + {"CMU", "1"}, +#endif +#ifdef luna + {"luna", "1"}, +#ifdef luna1 + {"luna1", "1"}, +#endif +#ifdef luna2 + {"luna2", "1"}, +#endif +#ifdef luna88k + {"luna88k", "1"}, +#endif +#ifdef uniosb + {"uniosb", "1"}, +#endif +#ifdef uniosu + {"uniosu", "1"}, +#endif +#endif +#ifdef ieeep754 + {"ieeep754", "1"}, +#endif +#ifdef is68k + {"is68k", "1"}, +#endif +#ifdef m68k + {"m68k", "1"}, +#endif +#ifdef m88k + {"m88k", "1"}, +#endif +#ifdef __m88k__ + {"__m88k__", "1"}, +#endif +#ifdef bsd43 + {"bsd43", "1"}, +#endif +#ifdef hcx + {"hcx", "1"}, +#endif +#ifdef sony + {"sony", "1"}, +#ifdef SYSTYPE_SYSV + {"SYSTYPE_SYSV", "1"}, +#endif +#ifdef _SYSTYPE_SYSV + {"_SYSTYPE_SYSV", "1"}, +#endif +#endif +#ifdef __OSF__ + {"__OSF__", "1"}, +#endif +#ifdef __osf__ + {"__osf__", "1"}, +#endif +#ifdef __alpha + {"__alpha", "1"}, +#endif +#ifdef __DECC + {"__DECC", "1"}, +#endif +#ifdef __decc + {"__decc", "1"}, +#endif +#ifdef __uxp__ + {"__uxp__", "1"}, +#endif +#ifdef __sxg__ + {"__sxg__", "1"}, +#endif +#ifdef _SEQUENT_ + {"_SEQUENT_", "1"}, + {"__STDC__", "1"}, +#endif +#ifdef __bsdi__ + {"__bsdi__", "1"}, +#endif +#ifdef nec_ews_svr2 + {"nec_ews_svr2", "1"}, +#endif +#ifdef nec_ews_svr4 + {"nec_ews_svr4", "1"}, +#endif +#ifdef _nec_ews_svr4 + {"_nec_ews_svr4", "1"}, +#endif +#ifdef _nec_up + {"_nec_up", "1"}, +#endif +#ifdef SX + {"SX", "1"}, +#endif +#ifdef nec + {"nec", "1"}, +#endif +#ifdef _nec_ft + {"_nec_ft", "1"}, +#endif +#ifdef PC_UX + {"PC_UX", "1"}, +#endif +#ifdef sgi + {"sgi", "1"}, +#endif +#ifdef __sgi + {"__sgi", "1"}, +#endif +#ifdef __FreeBSD__ + {"__FreeBSD__", "1"}, +#endif +#ifdef __NetBSD__ + {"__NetBSD__", "1"}, +#endif +#ifdef __OpenBSD__ + {"__OpenBSD__", "1"}, +#endif +#ifdef __EMX__ + {"__EMX__", "1"}, +#endif + /* add any additional symbols before this line */ + {NULL, NULL} +}; + +#endif /* MAKEDEPEND */ +#endif /* CCIMAKE */ diff --git a/js/src/config/mkdepend/include.c b/js/src/config/mkdepend/include.c new file mode 100644 index 000000000000..3b89f2630665 --- /dev/null +++ b/js/src/config/mkdepend/include.c @@ -0,0 +1,337 @@ +/* $Xorg: include.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/include.c,v 3.7 2001/12/14 19:53:20 dawes Exp $ */ + + +#include "def.h" + +#ifdef _MSC_VER +#include +static int +does_file_exist(char *file) +{ + WIN32_FILE_ATTRIBUTE_DATA data; + BOOL b = GetFileAttributesExA(file, GetFileExInfoStandard, &data); + if (!b) + return 0; + return (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0; +} +#else +static int +does_file_exist(char *file) +{ + struct stat sb; + return stat(file, &sb) == 0 && !S_ISDIR(sb.st_mode); +} +#endif + +extern struct inclist inclist[ MAXFILES ], + *inclistp, *inclistnext; +extern char *includedirs[ ], + **includedirsnext; +extern char *notdotdot[ ]; +extern boolean show_where_not; +extern boolean warn_multiple; + +static boolean +isdot(char *p) +{ + if(p && *p++ == '.' && *p++ == '\0') + return(TRUE); + return(FALSE); +} + +static boolean +isdotdot(char *p) +{ + if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0') + return(TRUE); + return(FALSE); +} + +static boolean +issymbolic(char *dir, char *component) +{ +#ifdef S_IFLNK + struct stat st; + char buf[ BUFSIZ ], **pp; + + sprintf(buf, "%s%s%s", dir, *dir ? "/" : "", component); + for (pp=notdotdot; *pp; pp++) + if (strcmp(*pp, buf) == 0) + return (TRUE); + if (lstat(buf, &st) == 0 + && (st.st_mode & S_IFMT) == S_IFLNK) { + *pp++ = copy(buf); + if (pp >= ¬dotdot[ MAXDIRS ]) + fatalerr("out of .. dirs, increase MAXDIRS\n"); + return(TRUE); + } +#endif + return(FALSE); +} + +/* + * Occasionally, pathnames are created that look like .../x/../y + * Any of the 'x/..' sequences within the name can be eliminated. + * (but only if 'x' is not a symbolic link!!) + */ +static void +remove_dotdot(char *path) +{ + register char *end, *from, *to, **cp; + char *components[ MAXFILES ], + newpath[ BUFSIZ ]; + boolean component_copied; + + /* + * slice path up into components. + */ + to = newpath; + if (*path == '/') + *to++ = '/'; + *to = '\0'; + cp = components; + for (from=end=path; *end; end++) + if (*end == '/') { + while (*end == '/') + *end++ = '\0'; + if (*from) + *cp++ = from; + from = end; + } + *cp++ = from; + *cp = NULL; + + /* + * Recursively remove all 'x/..' component pairs. + */ + cp = components; + while(*cp) { + if (!isdot(*cp) && !isdotdot(*cp) && isdotdot(*(cp+1)) + && !issymbolic(newpath, *cp)) + { + char **fp = cp + 2; + char **tp = cp; + + do + *tp++ = *fp; /* move all the pointers down */ + while (*fp++); + if (cp != components) + cp--; /* go back and check for nested ".." */ + } else { + cp++; + } + } + /* + * Concatenate the remaining path elements. + */ + cp = components; + component_copied = FALSE; + while(*cp) { + if (component_copied) + *to++ = '/'; + component_copied = TRUE; + for (from = *cp; *from; ) + *to++ = *from++; + *to = '\0'; + cp++; + } + *to++ = '\0'; + + /* + * copy the reconstituted path back to our pointer. + */ + strcpy(path, newpath); +} + +/* + * Add an include file to the list of those included by 'file'. + */ +struct inclist * +newinclude(char *newfile, char *incstring) +{ + register struct inclist *ip; + + /* + * First, put this file on the global list of include files. + */ + ip = inclistp++; + if (inclistp == inclist + MAXFILES - 1) + fatalerr("out of space: increase MAXFILES\n"); + ip->i_file = copy(newfile); + + if (incstring == NULL) + ip->i_incstring = ip->i_file; + else + ip->i_incstring = copy(incstring); + + inclistnext = inclistp; + return(ip); +} + +void +included_by(struct inclist *ip, struct inclist *newfile) +{ + register int i; + + if (ip == NULL) + return; + /* + * Put this include file (newfile) on the list of files included + * by 'file'. If 'file' is NULL, then it is not an include + * file itself (i.e. was probably mentioned on the command line). + * If it is already on the list, don't stick it on again. + */ + if (ip->i_list == NULL) { + ip->i_list = (struct inclist **) + malloc(sizeof(struct inclist *) * ++ip->i_listlen); + ip->i_merged = (boolean *) + malloc(sizeof(boolean) * ip->i_listlen); + } else { + for (i=0; ii_listlen; i++) + if (ip->i_list[ i ] == newfile) { + i = strlen(newfile->i_file); + if (!(ip->i_flags & INCLUDED_SYM) && + !(i > 2 && + newfile->i_file[i-1] == 'c' && + newfile->i_file[i-2] == '.')) + { + /* only bitch if ip has */ + /* no #include SYMBOL lines */ + /* and is not a .c file */ + if (warn_multiple) + { + warning("%s includes %s more than once!\n", + ip->i_file, newfile->i_file); + warning1("Already have\n"); + for (i=0; ii_listlen; i++) + warning1("\t%s\n", ip->i_list[i]->i_file); + } + } + return; + } + ip->i_list = (struct inclist **) realloc(ip->i_list, + sizeof(struct inclist *) * ++ip->i_listlen); + ip->i_merged = (boolean *) + realloc(ip->i_merged, sizeof(boolean) * ip->i_listlen); + } + ip->i_list[ ip->i_listlen-1 ] = newfile; + ip->i_merged[ ip->i_listlen-1 ] = FALSE; +} + +void +inc_clean (void) +{ + register struct inclist *ip; + + for (ip = inclist; ip < inclistp; ip++) { + ip->i_flags &= ~MARKED; + } +} + +struct inclist * +inc_path(char *file, char *include, int type) +{ + static char path[ BUFSIZ ]; + register char **pp, *p; + register struct inclist *ip; + + /* + * Check all previously found include files for a path that + * has already been expanded. + */ + if ((type == INCLUDE) || (type == INCLUDEDOT)) + inclistnext = inclist; + ip = inclistnext; + + for (; ip->i_file; ip++) { + if ((strcmp(ip->i_incstring, include) == 0) && + !(ip->i_flags & INCLUDED_SYM)) { + inclistnext = ip + 1; + return ip; + } + } + + if (inclistnext == inclist) { + /* + * If the path was surrounded by "" or is an absolute path, + * then check the exact path provided. + */ + if ((type == INCLUDEDOT) || + (type == INCLUDENEXTDOT) || + (*include == '/')) { + if (does_file_exist(include)) + return newinclude(include, include); + if (show_where_not) + warning1("\tnot in %s\n", include); + } + + /* + * If the path was surrounded by "" see if this include file is + * in the directory of the file being parsed. + */ + if ((type == INCLUDEDOT) || (type == INCLUDENEXTDOT)) { + for (p=file+strlen(file); p>file; p--) + if (*p == '/') + break; + if (p == file) { + strcpy(path, include); + } else { + strncpy(path, file, (p-file) + 1); + path[ (p-file) + 1 ] = '\0'; + strcpy(path + (p-file) + 1, include); + } + remove_dotdot(path); + if (does_file_exist(path)) + return newinclude(path, include); + if (show_where_not) + warning1("\tnot in %s\n", path); + } + } + + /* + * Check the include directories specified. Standard include dirs + * should be at the end. + */ + if ((type == INCLUDE) || (type == INCLUDEDOT)) + includedirsnext = includedirs; + pp = includedirsnext; + + for (; *pp; pp++) { + sprintf(path, "%s/%s", *pp, include); + remove_dotdot(path); + if (does_file_exist(path)) { + includedirsnext = pp + 1; + return newinclude(path, include); + } + if (show_where_not) + warning1("\tnot in %s\n", path); + } + + return NULL; +} diff --git a/js/src/config/mkdepend/main.c b/js/src/config/mkdepend/main.c new file mode 100644 index 000000000000..a86866f735a8 --- /dev/null +++ b/js/src/config/mkdepend/main.c @@ -0,0 +1,860 @@ +/* $Xorg: main.c,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/main.c,v 3.32 2003/03/26 20:43:48 tsi Exp $ */ + +#include "def.h" +#ifdef hpux +#define sigvec sigvector +#endif /* hpux */ + +#ifdef X_POSIX_C_SOURCE +#define _POSIX_C_SOURCE X_POSIX_C_SOURCE +#include +#undef _POSIX_C_SOURCE +#else +#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) +#include +#else +#define _POSIX_SOURCE +#include +#undef _POSIX_SOURCE +#endif +#endif + +#include + +#ifdef MINIX +#define USE_CHMOD 1 +#endif + +#ifdef DEBUG +int _debugmask; +#endif + +/* #define DEBUG_DUMP */ +#ifdef DEBUG_DUMP +#define DBG_PRINT(file, fmt, args) fprintf(file, fmt, args) +#else +#define DBG_PRINT(file, fmt, args) /* empty */ +#endif + +#define DASH_INC_PRE "#include \"" +#define DASH_INC_POST "\"" + +char *ProgramName; + +char *directives[] = { + "if", + "ifdef", + "ifndef", + "else", + "endif", + "define", + "undef", + "include", + "line", + "pragma", + "error", + "ident", + "sccs", + "elif", + "eject", + "warning", + "include_next", + NULL +}; + +#define MAKEDEPEND +#include "imakemdep.h" /* from config sources */ +#undef MAKEDEPEND + +struct inclist inclist[ MAXFILES ], + *inclistp = inclist, + *inclistnext = inclist, + maininclist; + +static char *filelist[ MAXFILES ]; +char *includedirs[ MAXDIRS + 1 ], + **includedirsnext = includedirs; +char *notdotdot[ MAXDIRS ]; +static int cmdinc_count = 0; +static char *cmdinc_list[ 2 * MAXINCFILES ]; +char *objprefix = ""; +char *objsuffix = OBJSUFFIX; +static char *startat = "# DO NOT DELETE"; +int width = 78; +static boolean append = FALSE; +boolean printed = FALSE; +boolean verbose = FALSE; +boolean show_where_not = FALSE; +/* Warn on multiple includes of same file */ +boolean warn_multiple = FALSE; + +static void setfile_cmdinc(struct filepointer *filep, long count, char **list); +static void redirect(char *line, char *makefile); + +static +#ifdef SIGNALRETURNSINT +int +#else +void +#endif +catch (int sig) +{ + fflush (stdout); + fatalerr ("got signal %d\n", sig); +} + +#if defined(USG) || (defined(i386) && defined(SYSV)) || defined(WIN32) || defined(__UNIXOS2__) || defined(Lynx_22) || defined(__CYGWIN__) +#define USGISH +#endif + +#ifndef USGISH +#ifdef X_NOT_POSIX +#define sigaction sigvec +#define sa_handler sv_handler +#define sa_mask sv_mask +#define sa_flags sv_flags +#endif +struct sigaction sig_act; +#endif /* USGISH */ + +int +main(int argc, char *argv[]) +{ + char **fp = filelist; + char **incp = includedirs; + char *p; + struct inclist *ip; + char *makefile = NULL; + struct filepointer *filecontent; + struct symtab *psymp = predefs; + char *endmarker = NULL; + char *defincdir = NULL; + char **undeflist = NULL; + int numundefs = 0, i; + register char offset; + + ProgramName = argv[0]; + + while (psymp->s_name) + { + define2(psymp->s_name, psymp->s_value, &maininclist); + psymp++; + } + if (argc == 2 && argv[1][0] == '@') { + struct stat ast; + int afd; + char *args; + char **nargv; + int nargc; + char quotechar = '\0'; + + nargc = 1; + if ((afd = open(argv[1]+1, O_RDONLY)) < 0) + fatalerr("cannot open \"%s\"\n", argv[1]+1); + fstat(afd, &ast); + args = (char *)malloc(ast.st_size + 1); + if ((ast.st_size = read(afd, args, ast.st_size)) < 0) + fatalerr("failed to read %s\n", argv[1]+1); + args[ast.st_size] = '\0'; + close(afd); + for (p = args; *p; p++) { + if (quotechar) { + if (quotechar == '\\' || + (*p == quotechar && p[-1] != '\\')) + quotechar = '\0'; + continue; + } + switch (*p) { + case '\\': + case '"': + case '\'': + quotechar = *p; + break; + case ' ': + case '\n': + *p = '\0'; + if (p > args && p[-1]) + nargc++; + break; + } + } + if (p[-1]) + nargc++; + nargv = (char **)malloc(nargc * sizeof(char *)); + nargv[0] = argv[0]; + argc = 1; + for (p = args; argc < nargc; p += strlen(p) + 1) + if (*p) nargv[argc++] = p; + argv = nargv; + } + for(argc--, argv++; argc; argc--, argv++) { + /* if looking for endmarker then check before parsing */ + if (endmarker && strcmp (endmarker, *argv) == 0) { + endmarker = NULL; + continue; + } + if (**argv != '-') { + /* treat +thing as an option for C++ */ + if (endmarker && **argv == '+') + continue; + *fp++ = argv[0]; + continue; + } + switch(argv[0][1]) { + case '-': + endmarker = &argv[0][2]; + if (endmarker[0] == '\0') endmarker = "--"; + break; + case 'D': + offset = 2; + if (argv[0][2] == '\0') { + argv++; + argc--; + offset = 0; + } + /* offset +1 here since first def letter + * cannot be `=` + */ + for (p = argv[0] + offset + 1; *p; p++) + if (*p == '=') { + *p = ' '; + break; + } + define(argv[0] + offset, &maininclist); + break; + case 'I': + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = argv[0]+2; + if (**(incp-1) == '\0') { + *(incp-1) = *(++argv); + argc--; + } + break; + case 'U': + /* Undef's override all -D's so save them up */ + numundefs++; + if (numundefs == 1) + undeflist = malloc(sizeof(char *)); + else + undeflist = realloc(undeflist, + numundefs * sizeof(char *)); + offset = 2; + if (argv[0][2] == '\0') { + argv++; + argc--; + offset = 0; + } + undeflist[numundefs - 1] = argv[0] + offset; + break; + case 'Y': + defincdir = argv[0]+2; + break; + /* do not use if endmarker processing */ + case 'a': + if (endmarker) break; + append = TRUE; + break; + case 'w': + if (endmarker) break; + if (argv[0][2] == '\0') { + argv++; + argc--; + width = atoi(argv[0]); + } else + width = atoi(argv[0]+2); + break; + case 'o': + if (endmarker) break; + if (argv[0][2] == '\0') { + argv++; + argc--; + objsuffix = argv[0]; + } else + objsuffix = argv[0]+2; + break; + case 'p': + if (endmarker) break; + if (argv[0][2] == '\0') { + argv++; + argc--; + objprefix = argv[0]; + } else + objprefix = argv[0]+2; + break; + case 'v': + if (endmarker) break; + verbose = TRUE; +#ifdef DEBUG + if (argv[0][2]) + _debugmask = atoi(argv[0]+2); +#endif + break; + case 's': + if (endmarker) break; + startat = argv[0]+2; + if (*startat == '\0') { + startat = *(++argv); + argc--; + } + if (*startat != '#') + fatalerr("-s flag's value should start %s\n", + "with '#'."); + break; + case 'f': + if (endmarker) break; + makefile = argv[0]+2; + if (*makefile == '\0') { + makefile = *(++argv); + argc--; + } + break; + + case 'm': + warn_multiple = TRUE; + break; + + /* Ignore -O, -g so we can just pass ${CFLAGS} to + makedepend + */ + case 'O': + case 'g': + break; + case 'i': + if (strcmp(&argv[0][1],"include") == 0) { + char *buf; + if (argc<2) + fatalerr("option -include is a " + "missing its parameter\n"); + if (cmdinc_count >= MAXINCFILES) + fatalerr("Too many -include flags.\n"); + argc--; + argv++; + buf = malloc(strlen(DASH_INC_PRE) + + strlen(argv[0]) + + strlen(DASH_INC_POST) + 1); + if(!buf) + fatalerr("out of memory at " + "-include string\n"); + cmdinc_list[2 * cmdinc_count + 0] = argv[0]; + cmdinc_list[2 * cmdinc_count + 1] = buf; + cmdinc_count++; + break; + } + /* intentional fall through */ + default: + if (endmarker) break; + /* fatalerr("unknown opt = %s\n", argv[0]); */ + warning("ignoring option %s\n", argv[0]); + } + } + /* Now do the undefs from the command line */ + for (i = 0; i < numundefs; i++) + undefine(undeflist[i], &maininclist); + if (numundefs > 0) + free(undeflist); + + if (!defincdir) { +#ifdef PREINCDIR + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = PREINCDIR; +#endif +#ifdef __UNIXOS2__ + { + char *emxinc = getenv("C_INCLUDE_PATH"); + /* can have more than one component */ + if (emxinc) { + char *beg, *end; + beg= (char*)strdup(emxinc); + for (;;) { + end = (char*)strchr(beg,';'); + if (end) *end = 0; + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many include dirs\n"); + *incp++ = beg; + if (!end) break; + beg = end+1; + } + } + } +#else /* !__UNIXOS2__, does not use INCLUDEDIR at all */ + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = INCLUDEDIR; +#endif + +#ifdef EXTRAINCDIR + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = EXTRAINCDIR; +#endif + +#ifdef POSTINCDIR + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = POSTINCDIR; +#endif + } else if (*defincdir) { + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = defincdir; + } + + redirect(startat, makefile); + + /* + * catch signals. + */ +#ifdef USGISH +/* should really reset SIGINT to SIG_IGN if it was. */ +#ifdef SIGHUP + signal (SIGHUP, catch); +#endif + signal (SIGINT, catch); +#ifdef SIGQUIT + signal (SIGQUIT, catch); +#endif + signal (SIGILL, catch); +#ifdef SIGBUS + signal (SIGBUS, catch); +#endif + signal (SIGSEGV, catch); +#ifdef SIGSYS + signal (SIGSYS, catch); +#endif +#else + sig_act.sa_handler = catch; +#if defined(_POSIX_SOURCE) || !defined(X_NOT_POSIX) + sigemptyset(&sig_act.sa_mask); + sigaddset(&sig_act.sa_mask, SIGINT); + sigaddset(&sig_act.sa_mask, SIGQUIT); +#ifdef SIGBUS + sigaddset(&sig_act.sa_mask, SIGBUS); +#endif + sigaddset(&sig_act.sa_mask, SIGILL); + sigaddset(&sig_act.sa_mask, SIGSEGV); + sigaddset(&sig_act.sa_mask, SIGHUP); + sigaddset(&sig_act.sa_mask, SIGPIPE); +#ifdef SIGSYS + sigaddset(&sig_act.sa_mask, SIGSYS); +#endif +#else + sig_act.sa_mask = ((1<<(SIGINT -1)) + |(1<<(SIGQUIT-1)) +#ifdef SIGBUS + |(1<<(SIGBUS-1)) +#endif + |(1<<(SIGILL-1)) + |(1<<(SIGSEGV-1)) + |(1<<(SIGHUP-1)) + |(1<<(SIGPIPE-1)) +#ifdef SIGSYS + |(1<<(SIGSYS-1)) +#endif + ); +#endif /* _POSIX_SOURCE */ + sig_act.sa_flags = 0; + sigaction(SIGHUP, &sig_act, (struct sigaction *)0); + sigaction(SIGINT, &sig_act, (struct sigaction *)0); + sigaction(SIGQUIT, &sig_act, (struct sigaction *)0); + sigaction(SIGILL, &sig_act, (struct sigaction *)0); +#ifdef SIGBUS + sigaction(SIGBUS, &sig_act, (struct sigaction *)0); +#endif + sigaction(SIGSEGV, &sig_act, (struct sigaction *)0); +#ifdef SIGSYS + sigaction(SIGSYS, &sig_act, (struct sigaction *)0); +#endif +#endif /* USGISH */ + + /* + * now peruse through the list of files. + */ + for(fp=filelist; *fp; fp++) { + DBG_PRINT(stderr,"file: %s\n",*fp); + filecontent = getfile(*fp); + setfile_cmdinc(filecontent, cmdinc_count, cmdinc_list); + ip = newinclude(*fp, (char *)NULL); + + find_includes(filecontent, ip, ip, 0, FALSE); + freefile(filecontent); + recursive_pr_include(ip, ip->i_file, base_name(*fp)); + inc_clean(); + } + if (printed) + printf("\n"); + return 0; +} + +#ifdef __UNIXOS2__ +/* + * eliminate \r chars from file + */ +static int +elim_cr(char *buf, int sz) +{ + int i,wp; + for (i= wp = 0; if_name = file; + if ((fd = open(file, O_RDONLY)) < 0) { + warning("cannot open \"%s\"\n", file); + content->f_p = content->f_base = content->f_end = (char *)malloc(1); + *content->f_p = '\0'; + return(content); + } + fstat(fd, &st); + content->f_base = (char *)malloc(st.st_size+1); + if (content->f_base == NULL) + fatalerr("cannot allocate mem\n"); + if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0) + fatalerr("failed to read %s\n", file); +#ifdef __UNIXOS2__ + st.st_size = elim_cr(content->f_base,st.st_size); +#endif + close(fd); + content->f_len = st.st_size+1; + content->f_p = content->f_base; + content->f_end = content->f_base + st.st_size; + *content->f_end = '\0'; + content->f_line = 0; + content->cmdinc_count = 0; + content->cmdinc_list = NULL; + content->cmdinc_line = 0; + return(content); +} + +void +setfile_cmdinc(struct filepointer* filep, long count, char** list) +{ + filep->cmdinc_count = count; + filep->cmdinc_list = list; + filep->cmdinc_line = 0; +} + +void +freefile(struct filepointer *fp) +{ + free(fp->f_base); + free(fp); +} + +char *copy(char *str) +{ + char *p = (char *)malloc(strlen(str) + 1); + + strcpy(p, str); + return(p); +} + +int +match(char *str, char **list) +{ + int i; + + for (i=0; *list; i++, list++) + if (strcmp(str, *list) == 0) + return(i); + return(-1); +} + +/* + * Get the next line. We only return lines beginning with '#' since that + * is all this program is ever interested in. + */ +char *getnextline(struct filepointer *filep) +{ + char *p, /* walking pointer */ + *eof, /* end of file pointer */ + *bol; /* beginning of line pointer */ + int lineno; /* line number */ + boolean whitespace = FALSE; + + /* + * Fake the "-include" line files in form of #include to the + * start of each file. + */ + if (filep->cmdinc_line < filep->cmdinc_count) { + char *inc = filep->cmdinc_list[2 * filep->cmdinc_line + 0]; + char *buf = filep->cmdinc_list[2 * filep->cmdinc_line + 1]; + filep->cmdinc_line++; + sprintf(buf,"%s%s%s",DASH_INC_PRE,inc,DASH_INC_POST); + DBG_PRINT(stderr,"%s\n",buf); + return(buf); + } + + p = filep->f_p; + eof = filep->f_end; + if (p >= eof) + return((char *)NULL); + lineno = filep->f_line; + + for (bol = p--; ++p < eof; ) { + if ((bol == p) && ((*p == ' ') || (*p == '\t'))) + { + /* Consume leading white-spaces for this line */ + while (((p+1) < eof) && ((*p == ' ') || (*p == '\t'))) + { + p++; + bol++; + } + whitespace = TRUE; + } + + if (*p == '/' && (p+1) < eof && *(p+1) == '*') { + /* Consume C comments */ + *(p++) = ' '; + *(p++) = ' '; + while (p < eof && *p) { + if (*p == '*' && (p+1) < eof && *(p+1) == '/') { + *(p++) = ' '; + *(p++) = ' '; + break; + } + if (*p == '\n') + lineno++; + *(p++) = ' '; + } + --p; + } + else if (*p == '/' && (p+1) < eof && *(p+1) == '/') { + /* Consume C++ comments */ + *(p++) = ' '; + *(p++) = ' '; + while (p < eof && *p) { + if (*p == '\\' && (p+1) < eof && + *(p+1) == '\n') { + *(p++) = ' '; + lineno++; + } + else if (*p == '?' && (p+3) < eof && + *(p+1) == '?' && + *(p+2) == '/' && + *(p+3) == '\n') { + *(p++) = ' '; + *(p++) = ' '; + *(p++) = ' '; + lineno++; + } + else if (*p == '\n') + break; /* to process end of line */ + *(p++) = ' '; + } + --p; + } + else if (*p == '\\' && (p+1) < eof && *(p+1) == '\n') { + /* Consume backslash line terminations */ + *(p++) = ' '; + *p = ' '; + lineno++; + } + else if (*p == '?' && (p+3) < eof && + *(p+1) == '?' && *(p+2) == '/' && *(p+3) == '\n') { + /* Consume trigraph'ed backslash line terminations */ + *(p++) = ' '; + *(p++) = ' '; + *(p++) = ' '; + *p = ' '; + lineno++; + } + else if (*p == '\n') { + lineno++; + if (*bol == '#') { + char *cp; + + *(p++) = '\0'; + /* punt lines with just # (yacc generated) */ + for (cp = bol+1; + *cp && (*cp == ' ' || *cp == '\t'); cp++); + if (*cp) goto done; + --p; + } + bol = p+1; + whitespace = FALSE; + } + } + if (*bol != '#') + bol = NULL; +done: + if (bol && whitespace) { + warning("%s: non-portable whitespace encountered at line %d\n", + filep->f_name, lineno); + } + filep->f_p = p; + filep->f_line = lineno; +#ifdef DEBUG_DUMP + if (bol) + DBG_PRINT(stderr,"%s\n",bol); +#endif + return(bol); +} + +/* + * Strip the file name down to what we want to see in the Makefile. + * It will have objprefix and objsuffix around it. + */ +char *base_name(char *file) +{ + char *p; + + file = copy(file); + for(p=file+strlen(file); p>file && *p != '.'; p--) ; + + if (*p == '.') + *p = '\0'; + return(file); +} + +#if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__UNIXOS2__) && !defined(clipper) && !defined(__clipper__) +int rename (char *from, char *to) +{ + (void) unlink (to); + if (link (from, to) == 0) { + unlink (from); + return 0; + } else { + return -1; + } +} +#endif /* USGISH */ + +void +redirect(char *line, char *makefile) +{ + struct stat st; + FILE *fdin, *fdout; + char backup[ BUFSIZ ], + buf[ BUFSIZ ]; + boolean found = FALSE; + int len; + + /* + * if makefile is "-" then let it pour onto stdout. + */ + if (makefile && *makefile == '-' && *(makefile+1) == '\0') { + puts(line); + return; + } + + /* + * use a default makefile is not specified. + */ + if (!makefile) { + if (stat("Makefile", &st) == 0) + makefile = "Makefile"; + else if (stat("makefile", &st) == 0) + makefile = "makefile"; + else + fatalerr("[mM]akefile is not present\n"); + } + else + stat(makefile, &st); + if ((fdin = fopen(makefile, "r")) == NULL) + fatalerr("cannot open \"%s\"\n", makefile); + sprintf(backup, "%s.bak", makefile); + unlink(backup); +#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__) + fclose(fdin); +#endif + if (rename(makefile, backup) < 0) + fatalerr("cannot rename %s to %s\n", makefile, backup); +#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__) + if ((fdin = fopen(backup, "r")) == NULL) + fatalerr("cannot open \"%s\"\n", backup); +#endif + if ((fdout = freopen(makefile, "w", stdout)) == NULL) + fatalerr("cannot open \"%s\"\n", backup); + len = strlen(line); + while (!found && fgets(buf, BUFSIZ, fdin)) { + if (*buf == '#' && strncmp(line, buf, len) == 0) + found = TRUE; + fputs(buf, fdout); + } + if (!found) { + if (verbose) + warning("Adding new delimiting line \"%s\" and dependencies...\n", + line); + puts(line); /* same as fputs(fdout); but with newline */ + } else if (append) { + while (fgets(buf, BUFSIZ, fdin)) { + fputs(buf, fdout); + } + } + fflush(fdout); +#if defined(USGISH) || defined(_SEQUENT_) || defined(USE_CHMOD) + chmod(makefile, st.st_mode); +#else + fchmod(fileno(fdout), st.st_mode); +#endif /* USGISH */ +} + +void +fatalerr(char *msg, ...) +{ + va_list args; + fprintf(stderr, "%s: error: ", ProgramName); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); + exit (1); +} + +void +warning(char *msg, ...) +{ + va_list args; + fprintf(stderr, "%s: warning: ", ProgramName); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); +} + +void +warning1(char *msg, ...) +{ + va_list args; + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); +} diff --git a/js/src/config/mkdepend/mkdepend.man b/js/src/config/mkdepend/mkdepend.man new file mode 100644 index 000000000000..595c87ed2e19 --- /dev/null +++ b/js/src/config/mkdepend/mkdepend.man @@ -0,0 +1,382 @@ +.\" $Xorg: mkdepend.man,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $ +.\" Copyright (c) 1993, 1994, 1998 The Open Group +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and its +.\" documentation for any purpose is hereby granted without fee, provided that +.\" the above copyright notice appear in all copies and that both that +.\" copyright notice and this permission notice appear in supporting +.\" documentation. +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of The Open Group shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from The +.\" Open Group. +.\" +.\" $XFree86: xc/config/makedepend/mkdepend.man,v 1.7 2002/12/14 02:39:45 dawes Exp $ +.\" +.TH MAKEDEPEND 1 __xorgversion__ +.UC 4 +.SH NAME +makedepend \- create dependencies in makefiles +.SH SYNOPSIS +.B makedepend +[ +.BI \-D name\fB=\fPdef +] [ +.BI \-D name +] [ +.BI \-I includedir +] [ +.BI \-Y includedir +] [ +.B \-a +] [ +.BI \-f makefile +] [ +.BI \-include \ file +] [ +.BI \-o objsuffix +] [ +.BI \-p objprefix +] [ +.BI \-s string +] [ +.BI \-w width +] [ +.B \-v +] [ +.B \-m +] [ +\-\^\- +.I otheroptions +\-\^\- +] +.I sourcefile +\&.\|.\|. +.br +.SH DESCRIPTION +The +.B makedepend +program reads each +.I sourcefile +in sequence and parses it like a C-preprocessor, +processing all +.I #include, +.I #define, +.I #undef, +.I #ifdef, +.I #ifndef, +.I #endif, +.I #if, +.I #elif +and +.I #else +directives so that it can correctly tell which +.I #include, +directives would be used in a compilation. +Any +.I #include, +directives can reference files having other +.I #include +directives, and parsing will occur in these files as well. +.PP +Every file that a +.I sourcefile +includes, +directly or indirectly, +is what +.B makedepend +calls a \fIdependency.\fP +These dependencies are then written to a +.I makefile +in such a way that +.B make(1) +will know which object files must be recompiled when a dependency has changed. +.PP +By default, +.B makedepend +places its output in the file named +.I makefile +if it exists, otherwise +.I Makefile. +An alternate makefile may be specified with the +.B \-f +option. +It first searches the makefile for +the line +.sp +\& # DO NOT DELETE THIS LINE \-\^\- make depend depends on it. +.sp +or one provided with the +.B \-s +option, +as a delimiter for the dependency output. +If it finds it, it will delete everything +following this to the end of the makefile +and put the output after this line. +If it doesn't find it, the program +will append the string to the end of the makefile +and place the output following that. +For each +.I sourcefile +appearing on the command line, +.B makedepend +puts lines in the makefile of the form +.sp + sourcefile.o:\0dfile .\|.\|. +.sp +Where \fIsourcefile.o\fP is the name from the command +line with its suffix replaced with ``.o'', +and \fIdfile\fP is a dependency discovered in a +.I #include +directive while parsing +.I sourcefile +or one of the files it included. +.SH EXAMPLE +Normally, +.B makedepend +will be used in a makefile target so that typing ``make depend'' will +bring the dependencies up to date for the makefile. +For example, +.nf + SRCS\0=\0file1.c\0file2.c\0.\|.\|. + CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz + depend: + makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS) +.fi +.SH OPTIONS +The program +will ignore any option that it does not understand so that you may use +the same arguments that you would for +.B cc(1). +.TP 5 +.B \-D\fIname\fP=\fIdef\fP \fRor\fP \-D\fIname\fP +Define. +This places a definition for +.I name +in +.B makedepend's +symbol table. +Without +.I =def\| +the symbol becomes defined as ``1''. +.TP 5 +.B \-I\fIincludedir\fP +Include directory. +This option tells +.B makedepend +to prepend +.I includedir +to its list of directories to search when it encounters +a +.I #include +directive. +By default, +.B makedepend +only searches the standard include directories (usually /usr/include +and possibly a compiler-dependent directory). +.TP 5 +.B \-Y\fIincludedir\fP +Replace all of the standard include directories with the single specified +include directory; you can omit the +.I includedir +to simply prevent searching the standard include directories. +.TP 5 +.B \-a +Append the dependencies to the end of the file instead of replacing them. +.TP 5 +.B \-f\fImakefile\fP +Filename. +This allows you to specify an alternate makefile in which +.B makedepend +can place its output. +Specifying ``\-'' as the file name (i.e., \fB\-f\-\fP) sends the +output to standard output instead of modifying an existing file. +.TP 5 +.B \-include \fIfile\fP +Process file as input, and include all the resulting output +before processing the regular input file. This has the same +affect as if the specified file is an include statement that +appears before the very first line of the regular input file. +.TP 5 +.B \-o\fIobjsuffix\fP +Object file suffix. +Some systems may have object files whose suffix is something other +than ``.o''. +This option allows you to specify another suffix, such as +``.b'' with +.I \-o.b +or ``:obj'' +with +.I \-o:obj +and so forth. +.TP 5 +.B \-p\fIobjprefix\fP +Object file prefix. +The prefix is prepended to the name of the object file. This is +usually used to designate a different directory for the object file. +The default is the empty string. +.TP 5 +.B \-s\fIstring\fP +Starting string delimiter. +This option permits you to specify +a different string for +.B makedepend +to look for in the makefile. +.TP 5 +.B \-w\fIwidth\fP +Line width. +Normally, +.B makedepend +will ensure that every output line that it writes will be no wider than +78 characters for the sake of readability. +This option enables you to change this width. +.TP 5 +.B \-v +Verbose operation. +This option causes +.B makedepend +to emit the list of files included by each input file. +.TP 5 +.B \-m +Warn about multiple inclusion. +This option causes +.B makedepend +to produce a warning if any input file includes another file more than +once. In previous versions of +.B makedepend +this was the default behavior; the default has been changed to better +match the behavior of the C compiler, which does not consider multiple +inclusion to be an error. This option is provided for backward +compatibility, and to aid in debugging problems related to multiple +inclusion. +.TP 5 +.B "\-\^\- \fIoptions\fP \-\^\-" +If +.B makedepend +encounters a double hyphen (\-\^\-) in the argument list, +then any unrecognized argument following it +will be silently ignored; a second double hyphen terminates this +special treatment. +In this way, +.B makedepend +can be made to safely ignore esoteric compiler arguments that might +normally be found in a CFLAGS +.B make +macro (see the +.B EXAMPLE +section above). +All options that +.B makedepend +recognizes and appear between the pair of double hyphens +are processed normally. +.SH ALGORITHM +The approach used in this program enables it to run an order of magnitude +faster than any other ``dependency generator'' I have ever seen. +Central to this performance are two assumptions: +that all files compiled by a single +makefile will be compiled with roughly the same +.I \-I +and +.I \-D +options; +and that most files in a single directory will include largely the +same files. +.PP +Given these assumptions, +.B makedepend +expects to be called once for each makefile, with +all source files that are maintained by the +makefile appearing on the command line. +It parses each source and include +file exactly once, maintaining an internal symbol table +for each. +Thus, the first file on the command line will take an amount of time +proportional to the amount of time that a normal C preprocessor takes. +But on subsequent files, if it encounters an include file +that it has already parsed, it does not parse it again. +.PP +For example, +imagine you are compiling two files, +.I file1.c +and +.I file2.c, +they each include the header file +.I header.h, +and the file +.I header.h +in turn includes the files +.I def1.h +and +.I def2.h. +When you run the command +.sp + makedepend\0file1.c\0file2.c +.sp +.B makedepend +will parse +.I file1.c +and consequently, +.I header.h +and then +.I def1.h +and +.I def2.h. +It then decides that the dependencies for this file are +.sp + file1.o:\0header.h\0def1.h\0def2.h +.sp +But when the program parses +.I file2.c +and discovers that it, too, includes +.I header.h, +it does not parse the file, +but simply adds +.I header.h, +.I def1.h +and +.I def2.h +to the list of dependencies for +.I file2.o. +.SH "SEE ALSO" +cc(1), make(1) +.SH BUGS +.B makedepend +parses, but does not currently evaluate, the SVR4 #predicate(token-list) +preprocessor expression; such expressions are simply assumed to be true. +This may cause the wrong +.I #include +directives to be evaluated. +.PP +Imagine you are parsing two files, +say +.I file1.c +and +.I file2.c, +each includes the file +.I def.h. +The list of files that +.I def.h +includes might truly be different when +.I def.h +is included by +.I file1.c +than when it is included by +.I file2.c. +But once +.B makedepend +arrives at a list of dependencies for a file, +it is cast in concrete. +.SH AUTHOR +Todd Brunhoff, Tektronix, Inc. and MIT Project Athena diff --git a/js/src/config/mkdepend/parse.c b/js/src/config/mkdepend/parse.c new file mode 100644 index 000000000000..968d2c4eabec --- /dev/null +++ b/js/src/config/mkdepend/parse.c @@ -0,0 +1,686 @@ +/* $Xorg: parse.c,v 1.6 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/parse.c,v 1.12 2002/02/26 05:09:10 tsi Exp $ */ + +#include "def.h" + +extern char *directives[]; +extern struct inclist inclist[ MAXFILES ], + *inclistnext, + maininclist; +extern char *includedirs[ ], + **includedirsnext; + +static int deftype (char *line, struct filepointer *filep, + struct inclist *file_red, struct inclist *file, + int parse_it); +static int zero_value(char *filename, char *exp, struct filepointer *filep, + struct inclist *file_red); +static int merge2defines(struct inclist *file1, struct inclist *file2); + +static int +gobble(struct filepointer *filep, struct inclist *file, + struct inclist *file_red) +{ + char *line; + int type; + + while ((line = getnextline(filep))) { + switch(type = deftype(line, filep, file_red, file, FALSE)) { + case IF: + case IFFALSE: + case IFGUESSFALSE: + case IFDEF: + case IFNDEF: + type = gobble(filep, file, file_red); + while ((type == ELIF) || (type == ELIFFALSE) || + (type == ELIFGUESSFALSE)) + type = gobble(filep, file, file_red); + if (type == ELSE) + (void)gobble(filep, file, file_red); + break; + case ELSE: + case ENDIF: + debug(0,("%s, line %d: #%s\n", + file->i_file, filep->f_line, + directives[type])); + return(type); + case DEFINE: + case UNDEF: + case INCLUDE: + case INCLUDEDOT: + case PRAGMA: + case ERROR: + case IDENT: + case SCCS: + case EJECT: + case WARNING: + case INCLUDENEXT: + case INCLUDENEXTDOT: + break; + case ELIF: + case ELIFFALSE: + case ELIFGUESSFALSE: + return(type); + case -1: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: unknown directive == \"%s\"\n", + filep->f_line, line); + break; + } + } + return(-1); +} + +/* + * Decide what type of # directive this line is. + */ +static int +deftype (char *line, struct filepointer *filep, + struct inclist *file_red, struct inclist *file, int parse_it) +{ + register char *p; + char *directive, savechar, *q; + register int ret; + + /* + * Parse the directive... + */ + directive=line+1; + while (*directive == ' ' || *directive == '\t') + directive++; + + p = directive; + while ((*p == '_') || (*p >= 'a' && *p <= 'z')) + p++; + savechar = *p; + *p = '\0'; + ret = match(directive, directives); + *p = savechar; + + /* If we don't recognize this compiler directive or we happen to just + * be gobbling up text while waiting for an #endif or #elif or #else + * in the case of an #elif we must check the zero_value and return an + * ELIF or an ELIFFALSE. + */ + + if (ret == ELIF && !parse_it) + { + while (*p == ' ' || *p == '\t') + p++; + /* + * parse an expression. + */ + debug(0,("%s, line %d: #elif %s ", + file->i_file, filep->f_line, p)); + ret = zero_value(file->i_file, p, filep, file_red); + if (ret != IF) + { + debug(0,("false...\n")); + if (ret == IFFALSE) + return(ELIFFALSE); + else + return(ELIFGUESSFALSE); + } + else + { + debug(0,("true...\n")); + return(ELIF); + } + } + + if (ret < 0 || ! parse_it) + return(ret); + + /* + * now decide how to parse the directive, and do it. + */ + while (*p == ' ' || *p == '\t') + p++; + q = p + strlen(p); + do { + q--; + } while (*q == ' ' || *q == '\t'); + q[1] = '\0'; + switch (ret) { + case IF: + /* + * parse an expression. + */ + ret = zero_value(file->i_file, p, filep, file_red); + debug(0,("%s, line %d: %s #if %s\n", + file->i_file, filep->f_line, ret?"false":"true", p)); + break; + case IFDEF: + case IFNDEF: + debug(0,("%s, line %d: #%s %s\n", + file->i_file, filep->f_line, directives[ret], p)); + case UNDEF: + /* + * separate the name of a single symbol. + */ + while (isalnum(*p) || *p == '_') + *line++ = *p++; + *line = '\0'; + break; + case INCLUDE: + case INCLUDENEXT: + debug(2,("%s, line %d: #include%s %s\n", + file->i_file, filep->f_line, + (ret == INCLUDE) ? "" : "_next", p)); + + /* Support ANSI macro substitution */ + while (1) { + struct symtab **sym; + + if (!*p || *p == '"' || *p == '<') + break; + + sym = isdefined(p, file_red, NULL); + if (!sym) + break; + + p = (*sym)->s_value; + debug(3,("%s : #includes SYMBOL %s = %s\n", + file->i_incstring, + (*sym) -> s_name, + (*sym) -> s_value)); + /* mark file as having included a 'soft include' */ + file->i_flags |= INCLUDED_SYM; + } + + /* + * Separate the name of the include file. + */ + while (*p && *p != '"' && *p != '<') + p++; + if (! *p) + return(-2); + if (*p++ == '"') { + if (ret == INCLUDE) + ret = INCLUDEDOT; + else + ret = INCLUDENEXTDOT; + while (*p && *p != '"') + *line++ = *p++; + } else + while (*p && *p != '>') + *line++ = *p++; + *line = '\0'; + break; + case DEFINE: + /* + * copy the definition back to the beginning of the line. + */ + strcpy (line, p); + break; + case ELSE: + case ENDIF: + case ELIF: + case PRAGMA: + case ERROR: + case IDENT: + case SCCS: + case EJECT: + case WARNING: + debug(0,("%s, line %d: #%s\n", + file->i_file, filep->f_line, directives[ret])); + /* + * nothing to do. + */ + break; + } + return(ret); +} + +struct symtab ** +fdefined(char *symbol, struct inclist *file, struct inclist **srcfile) +{ + struct inclist **ip; + struct symtab **val; + int i; + static int recurse_lvl = 0; + + if (file->i_flags & DEFCHECKED) + return(NULL); + debug(2,("Looking for %s in %s\n", symbol, file->i_file)); + file->i_flags |= DEFCHECKED; + if ((val = slookup(symbol, file))) + debug(1,("%s defined in %s as %s\n", + symbol, file->i_file, (*val)->s_value)); + if (val == NULL && file->i_list) + { + for (ip = file->i_list, i=0; i < file->i_listlen; i++, ip++) + if (file->i_merged[i]==FALSE) { + val = fdefined(symbol, *ip, srcfile); + file->i_merged[i]=merge2defines(file,*ip); + if (val!=NULL) break; + } + } + else if (val != NULL && srcfile != NULL) *srcfile = file; + recurse_lvl--; + file->i_flags &= ~DEFCHECKED; + + return(val); +} + +struct symtab ** +isdefined(char *symbol, struct inclist *file, struct inclist **srcfile) +{ + struct symtab **val; + + if ((val = slookup(symbol, &maininclist))) { + debug(1,("%s defined on command line\n", symbol)); + if (srcfile != NULL) *srcfile = &maininclist; + return(val); + } + if ((val = fdefined(symbol, file, srcfile))) + return(val); + debug(1,("%s not defined in %s\n", symbol, file->i_file)); + return(NULL); +} + +/* + * Return type based on if the #if expression evaluates to 0 + */ +static int +zero_value(char *filename, + char *exp, + struct filepointer *filep, + struct inclist *file_red) +{ + if (cppsetup(filename, exp, filep, file_red)) + return(IFFALSE); + else + return(IF); +} + +void +define2(char *name, char *val, struct inclist *file) +{ + int first, last, below; + register struct symtab **sp = NULL, **dest; + struct symtab *stab; + + /* Make space if it's needed */ + if (file->i_defs == NULL) + { + file->i_defs = (struct symtab **) + malloc(sizeof (struct symtab*) * SYMTABINC); + file->i_ndefs = 0; + } + else if (!(file->i_ndefs % SYMTABINC)) + file->i_defs = (struct symtab **) + realloc(file->i_defs, + sizeof(struct symtab*)*(file->i_ndefs+SYMTABINC)); + + if (file->i_defs == NULL) + fatalerr("malloc()/realloc() failure in insert_defn()\n"); + + below = first = 0; + last = file->i_ndefs - 1; + while (last >= first) + { + /* Fast inline binary search */ + register char *s1; + register char *s2; + register int middle = (first + last) / 2; + + /* Fast inline strchr() */ + s1 = name; + s2 = file->i_defs[middle]->s_name; + while (*s1++ == *s2++) + if (s2[-1] == '\0') break; + + /* If exact match, set sp and break */ + if (*--s1 == *--s2) + { + sp = file->i_defs + middle; + break; + } + + /* If name > i_defs[middle] ... */ + if (*s1 > *s2) + { + below = first; + first = middle + 1; + } + /* else ... */ + else + { + below = last = middle - 1; + } + } + + /* Search is done. If we found an exact match to the symbol name, + just replace its s_value */ + if (sp != NULL) + { + debug(1,("redefining %s from %s to %s in file %s\n", + name, (*sp)->s_value, val, file->i_file)); + free((*sp)->s_value); + (*sp)->s_value = copy(val); + return; + } + + sp = file->i_defs + file->i_ndefs++; + dest = file->i_defs + below + 1; + while (sp > dest) + { + *sp = sp[-1]; + sp--; + } + stab = (struct symtab *) malloc(sizeof (struct symtab)); + if (stab == NULL) + fatalerr("malloc()/realloc() failure in insert_defn()\n"); + + debug(1,("defining %s to %s in file %s\n", name, val, file->i_file)); + stab->s_name = copy(name); + stab->s_value = copy(val); + *sp = stab; +} + +void +define(char *def, struct inclist *file) +{ + char *val; + + /* Separate symbol name and its value */ + val = def; + while (isalnum(*val) || *val == '_') + val++; + if (*val) + *val++ = '\0'; + while (*val == ' ' || *val == '\t') + val++; + + if (!*val) + val = "1"; + define2(def, val, file); +} + +struct symtab ** +slookup(char *symbol, struct inclist *file) +{ + register int first = 0; + register int last = file->i_ndefs - 1; + + if (file) while (last >= first) + { + /* Fast inline binary search */ + register char *s1; + register char *s2; + register int middle = (first + last) / 2; + + /* Fast inline strchr() */ + s1 = symbol; + s2 = file->i_defs[middle]->s_name; + while (*s1++ == *s2++) + if (s2[-1] == '\0') break; + + /* If exact match, we're done */ + if (*--s1 == *--s2) + { + return file->i_defs + middle; + } + + /* If symbol > i_defs[middle] ... */ + if (*s1 > *s2) + { + first = middle + 1; + } + /* else ... */ + else + { + last = middle - 1; + } + } + return(NULL); +} + +static int +merge2defines(struct inclist *file1, struct inclist *file2) +{ + int i; + + if ((file1==NULL) || (file2==NULL) || + !(file2->i_flags & FINISHED)) + return 0; + + for (i=0; i < file2->i_listlen; i++) + if (file2->i_merged[i]==FALSE) + return 0; + + { + int first1 = 0; + int last1 = file1->i_ndefs - 1; + + int first2 = 0; + int last2 = file2->i_ndefs - 1; + + int first=0; + struct symtab** i_defs = NULL; + int deflen=file1->i_ndefs+file2->i_ndefs; + + debug(2,("merging %s into %s\n", + file2->i_file, file1->i_file)); + + if (deflen>0) + { + /* make sure deflen % SYMTABINC == 0 is still true */ + deflen += (SYMTABINC - deflen % SYMTABINC) % SYMTABINC; + i_defs=(struct symtab**) + malloc(deflen*sizeof(struct symtab*)); + if (i_defs==NULL) return 0; + } + + while ((last1 >= first1) && (last2 >= first2)) + { + char *s1=file1->i_defs[first1]->s_name; + char *s2=file2->i_defs[first2]->s_name; + + if (strcmp(s1,s2) < 0) + i_defs[first++]=file1->i_defs[first1++]; + else if (strcmp(s1,s2) > 0) + i_defs[first++]=file2->i_defs[first2++]; + else /* equal */ + { + i_defs[first++]=file2->i_defs[first2++]; + first1++; + } + } + while (last1 >= first1) + { + i_defs[first++]=file1->i_defs[first1++]; + } + while (last2 >= first2) + { + i_defs[first++]=file2->i_defs[first2++]; + } + + if (file1->i_defs) free(file1->i_defs); + file1->i_defs=i_defs; + file1->i_ndefs=first; + + return 1; + } +} + +void +undefine(char *symbol, struct inclist *file) +{ + register struct symtab **ptr; + struct inclist *srcfile; + while ((ptr = isdefined(symbol, file, &srcfile)) != NULL) + { + srcfile->i_ndefs--; + for (; ptr < srcfile->i_defs + srcfile->i_ndefs; ptr++) + *ptr = ptr[1]; + } +} + +int +find_includes(struct filepointer *filep, struct inclist *file, + struct inclist *file_red, int recursion, boolean failOK) +{ + struct inclist *inclistp; + char **includedirsp; + register char *line; + register int type; + boolean recfailOK; + + while ((line = getnextline(filep))) { + switch(type = deftype(line, filep, file_red, file, TRUE)) { + case IF: + doif: + type = find_includes(filep, file, + file_red, recursion+1, failOK); + while ((type == ELIF) || (type == ELIFFALSE) || + (type == ELIFGUESSFALSE)) + type = gobble(filep, file, file_red); + if (type == ELSE) + gobble(filep, file, file_red); + break; + case IFFALSE: + case IFGUESSFALSE: + doiffalse: + if (type == IFGUESSFALSE || type == ELIFGUESSFALSE) + recfailOK = TRUE; + else + recfailOK = failOK; + type = gobble(filep, file, file_red); + if (type == ELSE) + find_includes(filep, file, + file_red, recursion+1, recfailOK); + else + if (type == ELIF) + goto doif; + else + if ((type == ELIFFALSE) || (type == ELIFGUESSFALSE)) + goto doiffalse; + break; + case IFDEF: + case IFNDEF: + if ((type == IFDEF && isdefined(line, file_red, NULL)) + || (type == IFNDEF && !isdefined(line, file_red, NULL))) { + debug(1,(type == IFNDEF ? + "line %d: %s !def'd in %s via %s%s\n" : "", + filep->f_line, line, + file->i_file, file_red->i_file, ": doit")); + type = find_includes(filep, file, + file_red, recursion+1, failOK); + while (type == ELIF || type == ELIFFALSE || type == ELIFGUESSFALSE) + type = gobble(filep, file, file_red); + if (type == ELSE) + gobble(filep, file, file_red); + } + else { + debug(1,(type == IFDEF ? + "line %d: %s !def'd in %s via %s%s\n" : "", + filep->f_line, line, + file->i_file, file_red->i_file, ": gobble")); + type = gobble(filep, file, file_red); + if (type == ELSE) + find_includes(filep, file, + file_red, recursion+1, failOK); + else if (type == ELIF) + goto doif; + else if (type == ELIFFALSE || type == ELIFGUESSFALSE) + goto doiffalse; + } + break; + case ELSE: + case ELIFFALSE: + case ELIFGUESSFALSE: + case ELIF: + if (!recursion) + gobble(filep, file, file_red); + case ENDIF: + if (recursion) + return(type); + case DEFINE: + define(line, file); + break; + case UNDEF: + if (!*line) { + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: incomplete undef == \"%s\"\n", + filep->f_line, line); + break; + } + undefine(line, file_red); + break; + case INCLUDE: + case INCLUDEDOT: + case INCLUDENEXT: + case INCLUDENEXTDOT: + inclistp = inclistnext; + includedirsp = includedirsnext; + debug(2,("%s, reading %s, includes %s\n", + file_red->i_file, file->i_file, line)); + add_include(filep, file, file_red, line, type, failOK); + inclistnext = inclistp; + includedirsnext = includedirsp; + break; + case ERROR: + case WARNING: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: %s\n", + filep->f_line, line); + break; + + case PRAGMA: + case IDENT: + case SCCS: + case EJECT: + break; + case -1: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: unknown directive == \"%s\"\n", + filep->f_line, line); + break; + case -2: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: incomplete include == \"%s\"\n", + filep->f_line, line); + break; + } + } + file->i_flags |= FINISHED; + debug(2,("finished with %s\n", file->i_file)); + return(-1); +} diff --git a/js/src/config/mkdepend/pr.c b/js/src/config/mkdepend/pr.c new file mode 100644 index 000000000000..e864793b8f3d --- /dev/null +++ b/js/src/config/mkdepend/pr.c @@ -0,0 +1,124 @@ +/* $Xorg: pr.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/pr.c,v 1.5 2001/12/14 19:53:21 dawes Exp $ */ + +#include "def.h" + +extern struct inclist inclist[ MAXFILES ], + *inclistp; +extern char *objprefix; +extern char *objsuffix; +extern int width; +extern boolean printed; +extern boolean verbose; +extern boolean show_where_not; + +void +add_include(struct filepointer *filep, struct inclist *file, + struct inclist *file_red, char *include, int type, + boolean failOK) +{ + register struct inclist *newfile; + register struct filepointer *content; + + /* + * First decide what the pathname of this include file really is. + */ + newfile = inc_path(file->i_file, include, type); + if (newfile == NULL) { + if (failOK) + return; + if (file != file_red) + warning("%s (reading %s, line %d): ", + file_red->i_file, file->i_file, filep->f_line); + else + warning("%s, line %d: ", file->i_file, filep->f_line); + warning1("cannot find include file \"%s\"\n", include); + show_where_not = TRUE; + newfile = inc_path(file->i_file, include, type); + show_where_not = FALSE; + } + + if (newfile) { + included_by(file, newfile); + if (!(newfile->i_flags & SEARCHED)) { + newfile->i_flags |= SEARCHED; + content = getfile(newfile->i_file); + find_includes(content, newfile, file_red, 0, failOK); + freefile(content); + } + } +} + +static void +pr(struct inclist *ip, char *file, char *base) +{ + static char *lastfile; + static int current_len; + register int len, i; + char buf[ BUFSIZ ]; + + printed = TRUE; + len = strlen(ip->i_file)+1; + if (current_len + len > width || file != lastfile) { + lastfile = file; + sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix, + ip->i_file); + len = current_len = strlen(buf); + } + else { + buf[0] = ' '; + strcpy(buf+1, ip->i_file); + current_len += len; + } + fwrite(buf, len, 1, stdout); + + /* + * If verbose is set, then print out what this file includes. + */ + if (! verbose || ip->i_list == NULL || ip->i_flags & NOTIFIED) + return; + ip->i_flags |= NOTIFIED; + lastfile = NULL; + printf("\n# %s includes:", ip->i_file); + for (i=0; ii_listlen; i++) + printf("\n#\t%s", ip->i_list[ i ]->i_incstring); +} + +void +recursive_pr_include(struct inclist *head, char *file, char *base) +{ + int i; + + if (head->i_flags & MARKED) + return; + head->i_flags |= MARKED; + if (head->i_file != file) + pr(head, file, base); + for (i=0; ii_listlen; i++) + recursive_pr_include(head->i_list[ i ], file, base); +} diff --git a/js/src/config/IRIX6.1.mk b/js/src/config/nfspwd.pl similarity index 74% rename from js/src/config/IRIX6.1.mk rename to js/src/config/nfspwd.pl index 354f1d119d91..2f0e4fb80472 100644 --- a/js/src/config/IRIX6.1.mk +++ b/js/src/config/nfspwd.pl @@ -1,4 +1,4 @@ -# -*- Mode: makefile -*- +#! perl # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +13,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -24,8 +23,8 @@ # Contributor(s): # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,8 +36,15 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for IRIX6.3 -# +require "fastcwd.pl"; -include $(DEPTH)/config/IRIX.mk +$_ = &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/js/src/config/nsinstall.c b/js/src/config/nsinstall.c new file mode 100644 index 000000000000..b6ca0e3694e3 --- /dev/null +++ b/js/src/config/nsinstall.c @@ -0,0 +1,481 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +/* +** Netscape portable install command. +** +** Brendan Eich, 7/20/95 +*/ +#include /* OSF/1 requires this before grp.h, so put it first */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pathsub.h" + +#ifdef HAVE_GETOPT_H +#include +#endif + +#ifdef SUNOS4 +#include "sunos4.h" +#endif + +#ifdef NEXTSTEP +#include +#endif + +#ifdef __QNX__ +#include +#endif + +#ifdef NEED_S_ISLNK +#if !defined(S_ISLNK) && defined(S_IFLNK) +#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) +#endif +#endif + +#ifndef _DIRECTORY_SEPARATOR +#define _DIRECTORY_SEPARATOR "/" +#endif /* _DIRECTORY_SEPARATOR */ + +#ifdef NEED_FCHMOD_PROTO +extern int fchmod(int fildes, mode_t mode); +#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; + int l; + + /* strip trailing "/." */ + l = strlen(path); + if(l > 1 && path[l - 1] == '.' && path[l - 2] == '/') + path[l - 2] = 0; + + while (*path == '/' && path[1] == '/') + path++; + for (cp = strrchr(path, '/'); cp && cp != path && *(cp - 1) == '/'; cp--); + if (cp && cp != path) { + *cp = '\0'; + if ((lstat(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; +} + +static void +copyfile( char *name, char *toname, mode_t mode, char *group, char *owner, + int dotimes, uid_t uid, gid_t gid ) +{ + int fromfd, tofd = -1, cc, wc, exists; + char buf[BUFSIZ], *bp; + struct stat sb, tosb; + struct utimbuf utb; + + exists = (lstat(toname, &tosb) == 0); + + fromfd = open(name, O_RDONLY); + if (fromfd < 0 || fstat(fromfd, &sb) < 0) + fail("cannot access %s", name); + if (exists) { + if (S_ISREG(tosb.st_mode)) { + /* See if we can open it. This is more reliable than 'access'. */ + tofd = open(toname, O_CREAT | O_WRONLY, 0666); + } + if (tofd < 0) { + (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname); + } + } + if (tofd < 0) { + 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, (unsigned int)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 !defined(VMS) + 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); +#endif + 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); +#if defined(VMS) + if (chmod(toname, (mode & (S_IREAD | S_IWRITE))) < 0) + fail("cannot change mode of %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); + } +#endif +} + +static void +copydir( char *from, char *to, mode_t mode, char *group, char *owner, + int dotimes, uid_t uid, gid_t gid) +{ + int i; + DIR *dir; + struct dirent *ep; + struct stat sb; + char *base, *destdir, *direntry, *destentry; + + base = xbasename(from); + + /* create destination directory */ + destdir = xmalloc((unsigned int)(strlen(to) + 1 + strlen(base) + 1)); + sprintf(destdir, "%s%s%s", to, _DIRECTORY_SEPARATOR, base); + if (mkdirs(destdir, mode) != 0) { + fail("cannot make directory %s\n", destdir); + return; + } + + dir = opendir(from); + + direntry = xmalloc((unsigned int)PATH_MAX); + destentry = xmalloc((unsigned int)PATH_MAX); + + while ((ep = readdir(dir))) + { + if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) + continue; + + sprintf(direntry, "%s/%s", from, ep->d_name); + sprintf(destentry, "%s%s%s", destdir, _DIRECTORY_SEPARATOR, ep->d_name); + + if (stat(direntry, &sb) == 0 && S_ISDIR(sb.st_mode)) + copydir( direntry, destdir, mode, group, owner, dotimes, uid, gid ); + else + copyfile( direntry, destentry, mode, group, owner, dotimes, uid, gid ); + } + + free(direntry); + free(destentry); + closedir(dir); +} + +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, fromsb; + 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) { +#ifndef NEEDS_GETCWD +#ifndef GETCWD_CANT_MALLOC + cwd = getcwd(0, PATH_MAX); +#else + cwd = malloc(PATH_MAX + 1); + cwd = getcwd(cwd, PATH_MAX); +#endif +#else + cwd = malloc(PATH_MAX + 1); + cwd = getwd(cwd); +#endif + } + + xchdir(todir); +#ifndef NEEDS_GETCWD +#ifndef GETCWD_CANT_MALLOC + todir = getcwd(0, PATH_MAX); +#else + todir = malloc(PATH_MAX + 1); + todir = getcwd(todir, PATH_MAX); +#endif +#else + todir = malloc(PATH_MAX + 1); + todir = getwd(todir); +#endif + tdlen = strlen(todir); + xchdir(cwd); + tdlen = strlen(todir); + + uid = owner ? touid(owner) : (uid_t)(-1); + gid = group ? togid(group) : (gid_t)(-1); + + while (--argc > 0) { + name = *argv++; + len = strlen(name); + base = xbasename(name); + bnlen = strlen(base); + toname = xmalloc((unsigned int)(tdlen + 1 + bnlen + 1)); + sprintf(toname, "%s%s%s", todir, _DIRECTORY_SEPARATOR, 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 (access(name, R_OK) != 0) { + fail("cannot access %s", name); + } + 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((unsigned int)(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, (unsigned int)len) != 0)) || + ((stat(name, &fromsb) == 0) && + (fromsb.st_mtime > tosb.st_mtime))) { + (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. */ + if( stat(name, &sb) == 0 && S_IFDIR & sb.st_mode ) + { + /* then is directory: must explicitly create destination dir */ + /* and manually copy files over */ + copydir( name, todir, mode, group, owner, dotimes, uid, gid ); + } + else + { + copyfile(name, toname, mode, group, owner, dotimes, uid, gid); + } + } + + free(toname); + } + + free(cwd); + free(todir); + return 0; +} diff --git a/js/src/config/nsinstall.py b/js/src/config/nsinstall.py new file mode 100644 index 000000000000..fd4e2531d605 --- /dev/null +++ b/js/src/config/nsinstall.py @@ -0,0 +1,139 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Mozilla. +# +# The Initial Developer of the Original Code is +# the Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2007 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Axel Hecht +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# This is a partial python port of nsinstall. +# It's intended to be used when there's no natively compile nsinstall +# available, and doesn't intend to be fully equivalent. +# Its major use is for l10n repackaging on systems that don't have +# a full build environment set up. +# The basic limitation is, it doesn't even try to link and ignores +# all related options. + +from optparse import OptionParser +import os +import os.path +import sys +import shutil + +usage = "usage: %prog [options] arg1 [arg2 ...] target-directory" +p = OptionParser(usage=usage) + +p.add_option('-D', action="store_true", + help="Create a single directory only") +p.add_option('-t', action="store_true", + help="Preserve time stamp") +p.add_option('-m', action="store", + help="Set mode", metavar="mode") +p.add_option('-d', action="store_true", + help="Create directories in target") +p.add_option('-R', action="store_true", + help="Use relative symbolic links (ignored)") +p.add_option('-l', action="store_true", + help="Create link (ignored)") +p.add_option('-L', action="store", metavar="linkprefix", + help="Link prefix (ignored)") + +# The remaining arguments are not used in our tree, thus they're not +# implented. +def BadArg(option, opt, value, parser): + parser.error('option not supported: %s' % opt) + +p.add_option('-C', action="callback", metavar="CWD", + callback=BadArg, + help="NOT SUPPORTED") +p.add_option('-o', action="callback", callback=BadArg, + help="Set owner (NOT SUPPORTED)", metavar="owner") +p.add_option('-g', action="callback", callback=BadArg, + help="Set group (NOT SUPPORTED)", metavar="group") + +(options, args) = p.parse_args() + +if options.m: + # mode is specified + try: + options.m = int(options.m, 8) + except: + sys.stderr.write('nsinstall: ' + options.m + ' is not a valid mode\n') + sys.exit(1) + +# just create one directory? +if options.D: + if len(args) != 1: + sys.exit(1) + if os.path.exists(args[0]): + if not os.path.isdir(args[0]): + sys.stderr.write('nsinstall: ' + args[0] + ' is not a directory\n') + sys.exit(1) + if options.m: + os.chmod(args[0], options.m) + sys.exit() + if options.m: + os.makedirs(args[0], options.m) + else: + os.makedirs(args[0]) + sys.exit() + +# nsinstall arg1 [...] directory +if len(args) < 2: + p.error('not enough arguments') + +# set up handler +if options.d: + # we're supposed to create directories + def handleTarget(srcpath, targetpath): + # target directory was already created, just use mkdir + os.mkdir(dest) +else: + # we're supposed to copy files + def handleTarget(srcpath, targetpath): + if options.t: + shutil.copy2(srcpath, targetpath) + else: + shutil.copy(srcpath, targetpath) + +# the last argument is the target directory +target = args.pop() +# ensure target directory +if not os.path.isdir(target): + os.makedirs(target) + +for f in args: + dest = os.path.join(target, + os.path.basename(os.path.normpath(f))) + handleTarget(f, dest) + if options.m: + os.chmod(dest, options.m) diff --git a/js/src/config/pathsub.c b/js/src/config/pathsub.c new file mode 100644 index 000000000000..8384e5fb9828 --- /dev/null +++ b/js/src/config/pathsub.c @@ -0,0 +1,247 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +/* +** Pathname subroutines. +** +** Brendan Eich, 8/29/95 +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pathsub.h" + +#ifdef USE_REENTRANT_LIBC +#include +#endif + +#ifdef SUNOS4 +#include "sunos4.h" +#endif + +#ifndef D_INO +#define D_INO d_ino +#endif + +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 LAME_READDIR +#include +/* +** The static buffer in Unixware's readdir is too small. +*/ +struct dirent *readdir(DIR *d) +{ + static struct dirent *buf = NULL; + + if(buf == NULL) + buf = (struct dirent *) malloc(sizeof(struct dirent) + MAXPATHLEN); + 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/js/src/config/pathsub.h b/js/src/config/pathsub.h new file mode 100644 index 000000000000..ab1a7fee2bfc --- /dev/null +++ b/js/src/config/pathsub.h @@ -0,0 +1,74 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef pathsub_h___ +#define pathsub_h___ +/* +** Pathname subroutines. +** +** Brendan Eich, 8/29/95 +*/ +#include +#include + +#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/js/src/config/preprocessor.pl b/js/src/config/preprocessor.pl new file mode 100644 index 000000000000..3da6654dd72d --- /dev/null +++ b/js/src/config/preprocessor.pl @@ -0,0 +1,671 @@ +#!/usr/bin/perl -w +# -*- Mode: perl; tab-width: 4; indent-tabs-mode: nil; -*- +# +# Preprocessor +# Version 1.1 +# +# Copyright (c) 2002, 2003, 2004 by Ian Hickson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Thanks to bryner and bsmedberg for suggestions. +# Thanks to jon rekai for a patch to not require File::Spec 0.8. + +use strict; + +# takes as arguments the files to process +# defaults to stdin +# output to stdout + +my $stack = new stack; +my $marker = '#'; + +# command line arguments +my @includes; +while ($_ = $ARGV[0], defined($_) && /^-./) { + shift; + last if /^--$/os; + if (/^-D(.*)$/os) { + for ($1) { + if (/^([\w\.]+)=(.*)$/os) { + $stack->define($1, $2); + } elsif (/^([\w\.]+)$/os) { + $stack->define($1, 1); + } else { + die "$0: invalid argument to -D: $_\n"; + } + } + } elsif (/^-F(.*)$/os) { + for ($1) { + if (/^(\w+)$/os) { + $stack->filter($1, 1); + } else { + die "$0: invalid argument to -F: $_\n"; + } + } + } elsif (/^-I(.*)$/os) { + push(@includes, $1); + } elsif (/^-E$/os) { + foreach (keys %ENV) { + # define all variables that have valid names + $stack->define($_, $ENV{$_}) unless m/\W/; + } + } elsif (/^-d$/os) { + $stack->{'dependencies'} = 1; + } elsif (/^--line-endings=crlf$/os) { + $stack->{'lineEndings'} = "\x0D\x0A"; + } elsif (/^--line-endings=cr$/os) { + $stack->{'lineEndings'} = "\x0D"; + } elsif (/^--line-endings=lf$/os) { + $stack->{'lineEndings'} = "\x0A"; + } elsif (/^--line-endings=(.+)$/os) { + die "$0: unrecognised line ending: $1\n"; + } elsif (/^--marker=(.)$/os) { + $marker = $1; + } else { + die "$0: invalid argument: $_\n"; + } +} +unshift(@ARGV, '-') unless @ARGV; +unshift(@ARGV, @includes); + +# do the work +foreach (@ARGV) { include($stack, $_); } +exit(0); + +######################################################################## + +package main; +use File::Spec; +use File::Spec::Unix; # on all platforms, because the #include syntax is unix-based + +# Note: Ideally we would use File::Spec 0.8. When this becomes +# possible, add "0.8" to the first "use" line above, then replace +# occurrences of "::_0_8::" with "->" below. And remove the code for +# File::Spec 0.8 much lower down the file. + +sub include { + my($stack, $filename) = @_; + my $directory = $stack->{'variables'}->{'DIRECTORY'}; + if ($filename ne '-') { + $filename = File::Spec::_0_8::rel2abs($filename, $directory); + # splitpath expects forward-slash paths on windows, so we have to + # change the slashes if using Activestate Perl. + $filename =~ s?\\?/?g if "$^O" eq "MSWin32"; + my($volume, $path) = File::Spec::_0_8::splitpath($filename); + $directory = File::Spec::_0_8::catpath($volume, $path, ''); + } + local $stack->{'variables'}->{'DIRECTORY'} = $directory; + local $stack->{'variables'}->{'FILE'} = $filename; + local $stack->{'variables'}->{'LINE'} = 0; + local *FILE; + open(FILE, $filename) or die "Couldn't open $filename: $!\n"; + my $lineout = 0; + while () { + # on cygwin, line endings are screwed up, so normalise them. + s/[\x0D\x0A]+$/\n/os if ($^O eq 'msys' || $^O eq 'cygwin' || "$^O" eq "MSWin32"); + $stack->newline; + if (/^\Q$marker\E([a-z]+)\n?$/os) { # argumentless processing instruction + process($stack, $1); + } elsif (/^\Q$marker\E([a-z]+)\s(.*?)\n?$/os) { # processing instruction with arguments + process($stack, $1, $2); + } elsif (/^\Q$marker\E/os) { # comment + # ignore it + } elsif ($stack->enabled) { + next if $stack->{'dependencies'}; + + # set the current line number in JavaScript if necessary + my $linein = $stack->{'variables'}->{'LINE'}; + if (++$lineout != $linein) { + if ($filename =~ /\.js(|\.in)$/o) { + $stack->print("//\@line $linein \"$filename\"\n") + } + $lineout = $linein; + } + + # print it, including any newlines + $stack->print(filtered($stack, $_)); + } + } + close(FILE); +} + +sub process { + my($stack, $instruction, @arguments) = @_; + my $method = 'preprocessor'->can($instruction); + if (not defined($method)) { + fatal($stack, 'unknown instruction', $instruction); + } + eval { &$method($stack, @arguments) }; + if ($@) { + fatal($stack, "error evaluating $instruction:", $@); + } +} + +sub filtered { + my($stack, $text) = @_; + foreach my $filter (sort keys %{$stack->{'filters'}}) { + next unless $stack->{'filters'}->{$filter}; + my $method = 'filter'->can($filter); + if (not defined($method)) { + fatal($stack, 'unknown filter', $filter); + } + $text = eval { &$method($stack, $text) }; + if ($@) { + fatal($stack, "error using $filter:", $@); + } + } + return $text; +} + +sub fatal { + my $stack = shift; + my $filename = $stack->{'variables'}->{'FILE'}; + local $" = ' '; + print STDERR "$0:$filename:$.: @_\n"; + exit(1); +} + + +######################################################################## + +package stack; + +# condition evaluated just prior to this context was false +use constant COND_FALSE => 0; + +# condition evaluated just prior to this context was true +use constant COND_TRUE => 1; + +# some prior condition at this level already evaluated to true (or a +# parent condition evaluated to false or must be ignored), so we're +# ignoring all remaining conditions at current level (and nested +# conditions, too) +use constant COND_COMPLETED => 2; + +sub new { + return bless { + 'variables' => { + # %ENV, + 'LINE' => 0, # the line number in the source file + 'DIRECTORY' => '', # current directory + 'FILE' => '', # source filename + '1' => 1, # for convenience (the constant '1' is thus true) + }, + 'filters' => { + # filters + }, + 'values' => [], # the value of the last condition evaluated at the nth level + 'lastConditionState' => [], # whether the condition in the nth-level context was true, false, or not applicable + 'conditionState' => COND_TRUE, + 'dependencies' => 0, # whether we are showing dependencies + 'lineEndings' => "\n", # default to platform conventions + }; +} + +sub newline { + my $self = shift; + $self->{'variables'}->{'LINE'}++; +} + +sub define { + my $self = shift; + my($variable, $value) = @_; + die "not a valid variable name: '$variable'\n" if $variable =~ m/[^\w\.]/; + $self->{'variables'}->{$variable} = $value; +} + +sub defined { + my $self = shift; + my($variable) = @_; + die "not a valid variable name: '$variable'\n" if $variable =~ m/[^\w\.]/; + return defined($self->{'variables'}->{$variable}); +} + +sub undefine { + my $self = shift; + my($variable) = @_; + die "not a valid variable name: '$variable'\n" if $variable =~ m/[^\w\.]/; + delete($self->{'variables'}->{$variable}); +} + +sub get { + my $self = shift; + my($variable, $required) = @_; + die "not a valid variable name: '$variable'\n" if $variable =~ m/[^\w\.]/; + my $value = $self->{'variables'}->{$variable}; + if (defined($value)) { + return $value; + } else { + die "variable '$variable' is not defined\n" if $required; + return ''; + } +} + +sub replace { + my $self = shift; + my ($value) = @_; + + ${$self->{'values'}}[-1] = $value; + $self->{'conditionState'} = $self->{'conditionState'} != COND_FALSE + ? COND_COMPLETED + : $value ? COND_TRUE : COND_FALSE; +} + +sub push { + my $self = shift; + my($value) = @_; + + push(@{$self->{'values'}}, $value); + my $lastCondition = $self->{'conditionState'}; + push(@{$self->{'lastConditionState'}}, $lastCondition); + $self->{'conditionState'} = $lastCondition != COND_TRUE + ? COND_COMPLETED + : $value ? COND_TRUE : COND_FALSE; +} + +sub pop { + my $self = shift; + $self->{'conditionState'} = pop(@{$self->{'lastConditionState'}}); + return pop(@{$self->{'values'}}); +} + +sub enabled { + my $self = shift; + return $self->{'conditionState'} == COND_TRUE; +} + +sub disabled { + my $self = shift; + return $self->{'conditionState'} != COND_TRUE; +} + +sub filter { + my $self = shift; + my($filter, $value) = @_; + die "not a valid filter name: '$filter'\n" if $filter =~ m/\W/; + $self->{'filters'}->{$filter} = $value; +} + +sub expand { + my $self = shift; + my($line) = @_; + $line =~ s/__(\w+)__/$self->get($1)/gose; + return $line; +} + +sub print { + my $self = shift; + return if $self->{'dependencies'}; + foreach my $line (@_) { + if (chomp $line) { + CORE::print("$line$self->{'lineEndings'}"); + } else { + CORE::print($line); + } + } +} + +sub visit { + my $self = shift; + my($filename) = @_; + my $directory = $stack->{'variables'}->{'DIRECTORY'}; + $filename = File::Spec::_0_8::abs2rel(File::Spec::_0_8::rel2abs($filename, $directory)); + CORE::print("$filename\n"); +} + +######################################################################## + +package preprocessor; + +sub define { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + my $argument = shift; + for ($argument) { + /^(\w+)\s(.*)$/os && do { + return $stack->define($1, $2); + }; + /^(\w+)$/os && do { + return $stack->define($1, 1); + }; + die "invalid argument: '$_'\n"; + } +} + +sub undef { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + $stack->undefine(@_); +} + +sub ifdef { + my $stack = shift; + my $variable = shift; + my $replace = defined(shift); + die "argument expected\n" unless defined($variable); + if ($replace) { + $stack->replace($stack->defined($variable)); + } else { + $stack->push($stack->defined($variable)); + } +} + +sub ifndef { + my $stack = shift; + my $variable = shift; + my $replace = defined(shift); + die "argument expected\n" unless defined($variable); + if ($replace) { + $stack->replace(not $stack->defined($variable)); + } else { + $stack->push(not $stack->defined($variable)); + } +} + +sub if { + my $stack = shift; + die "argument expected\n" unless @_; + my $argument = shift; + my $replace = defined(shift); + for ($argument) { + /^(\w+)==(.*)$/os && do { + # equality + if ($replace) { + return $stack->replace($stack->get($1) eq $2); + } else { + return $stack->push($stack->get($1) eq $2); + } + }; + /^(\w+)!=(.*)$/os && do { + # inequality + if ($replace) { + return $stack->replace($stack->get($1) ne $2); + } else { + return $stack->push($stack->get($1) ne $2); + } + }; + /^(\w+)$/os && do { + # true value + if ($replace) { + return $stack->replace($stack->get($1)); + } else { + return $stack->push($stack->get($1)); + } + }; + /^!(\w+)$/os && do { + # false value + if ($replace) { + return $stack->replace(not $stack->get($1)); + } else { + return $stack->push(not $stack->get($1)); + } + }; + die "invalid argument: '$_'\n"; + } +} + +sub else { + my $stack = shift; + die "argument unexpected\n" if @_; + $stack->replace(1); +} + +sub elif { + my $stack = shift; + die "argument expected\n" unless @_; + &if($stack, @_, 1); +} + +sub elifdef { + my $stack = shift; + die "argument expected\n" unless @_; + &ifdef($stack, @_, 1); +} + +sub elifndef { + my $stack = shift; + die "argument expected\n" unless @_; + &ifndef($stack, @_, 1); +} + +sub endif { + my $stack = shift; + die "argument unexpected\n" if @_; + $stack->pop; +} + +sub error { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + my $line = $stack->expand(@_); + die "$line\n"; +} + +sub expand { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + my $line = $stack->expand(@_); + $stack->print("$line\n"); +} + +sub literal { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + my $line = shift; + $stack->print("$line\n"); +} + +sub include { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + my $filename = File::Spec::_0_8::catpath(File::Spec::_0_8::splitpath(@_)); + if ($stack->{'dependencies'}) { + $stack->visit($filename); + } else { + main::include($stack, $filename); + } +} + +sub includesubst { + my ($stack, $filename) = @_; + return if $stack->disabled; + die "argument expected\n" unless $filename; + $filename =~ s/@(\w+)@/$stack->get($1, 1)/gose; + $filename = File::Spec::_0_8::catpath(File::Spec::_0_8::splitpath($filename)); + if ($stack->{'dependencies'}) { + $stack->visit($filename); + } else { + main::include($stack, $filename); + } +} + +sub filter { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + foreach (split(/\s/os, shift)) { + $stack->filter($_, 1); + } +} + +sub unfilter { + my $stack = shift; + return if $stack->disabled; + die "argument expected\n" unless @_; + foreach (split(/\s/os, shift)) { + $stack->filter($_, 0); + } +} + + +######################################################################## + +package filter; + +sub emptyLines { + my($stack, $text) = @_; + $text = "" if $text eq "\n"; + return $text; +} + +sub spaces { + my($stack, $text) = @_; + $text =~ s/ +/ /gos; # middle spaces + $text =~ s/^ //gos; # start spaces + $text =~ s/ (\n?)$/$1/gos; # end spaces + return $text; +} + +sub slashslash { + my($stack, $text) = @_; + $text =~ s|//.*?(\n?)$|$1|gos; + return $text; +} + +sub substitution { + my($stack, $text) = @_; + $text =~ s/@(\w+)@/$stack->get($1, 1)/gose; + return $text; +} + +sub attemptSubstitution { + my($stack, $text) = @_; + $text =~ s/@(\w+)@/$stack->get($1, 0)/gose; + return $text; +} + +######################################################################## + +######################################################################## +# This code is from File::Spec::Unix 0.8. +# It is not considered a part of the preprocessor.pl source file +# This code is licensed under the same license as File::Spec itself. + +package File::Spec::_0_8; + +use Cwd; + +sub rel2abs { + my ($path, $base) = @_; + if ( ! File::Spec->file_name_is_absolute( $path ) ) { + if ( !defined( $base ) || $base eq '' ) { + $base = cwd() ; + } elsif ( ! File::Spec->file_name_is_absolute( $base ) ) { + $base = rel2abs( $base ); + } else { + $base = File::Spec->canonpath( $base ); + } + $path = File::Spec->catdir( $base, $path ); + } + return File::Spec->canonpath( $path ); +} + +sub splitdir { + return split m|/|, $_[1], -1; # Preserve trailing fields +} + +sub splitpath { + my ($path, $nofile) = @_; + + my ($volume,$directory,$file) = ('','',''); + + if ( $nofile ) { + $directory = $path; + } + else { + $path =~ m|^ ( (?: .* / (?: \.\.?\Z(?!\n) )? )? ) ([^/]*) |xs; + $directory = $1; + $file = $2; + } + + return ($volume,$directory,$file); +} + +sub catpath { + my ($volume,$directory,$file) = @_; + + if ( $directory ne '' && + $file ne '' && + substr( $directory, -1 ) ne '/' && + substr( $file, 0, 1 ) ne '/' + ) { + $directory .= "/$file" ; + } + else { + $directory .= $file ; + } + + return $directory ; +} + +sub abs2rel { + my($path,$base) = @_; + + # Clean up $path + if ( ! File::Spec->file_name_is_absolute( $path ) ) { + $path = rel2abs( $path ) ; + } + else { + $path = File::Spec->canonpath( $path ) ; + } + + # Figure out the effective $base and clean it up. + if ( !defined( $base ) || $base eq '' ) { + $base = cwd(); + } + elsif ( ! File::Spec->file_name_is_absolute( $base ) ) { + $base = rel2abs( $base ) ; + } + else { + $base = File::Spec->canonpath( $base ) ; + } + + # Now, remove all leading components that are the same + my @pathchunks = File::Spec::_0_8::splitdir( $path); + my @basechunks = File::Spec::_0_8::splitdir( $base); + + while (@pathchunks && @basechunks && $pathchunks[0] eq $basechunks[0]) { + shift @pathchunks ; + shift @basechunks ; + } + + $path = CORE::join( '/', @pathchunks ); + $base = CORE::join( '/', @basechunks ); + + # $base now contains the directories the resulting relative path + # must ascend out of before it can descend to $path_directory. So, + # replace all names with $parentDir + $base =~ s|[^/]+|..|g ; + + # Glue the two together, using a separator if necessary, and preventing an + # empty result. + if ( $path ne '' && $base ne '' ) { + $path = "$base/$path" ; + } else { + $path = "$base$path" ; + } + + return File::Spec->canonpath( $path ) ; +} + +# End code from File::Spec::Unix 0.8. +######################################################################## diff --git a/js/src/config/IRIX5.3.mk b/js/src/config/revdepth-nt.pl similarity index 77% rename from js/src/config/IRIX5.3.mk rename to js/src/config/revdepth-nt.pl index f38cc94874bb..88532689f466 100644 --- a/js/src/config/IRIX5.3.mk +++ b/js/src/config/revdepth-nt.pl @@ -1,4 +1,4 @@ -# -*- Mode: makefile -*- +#! perl # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +13,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -24,8 +23,8 @@ # Contributor(s): # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,8 +36,13 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for IRIX5.3 -# +require "/ns/config/fastcwd.pl"; -include $(DEPTH)/config/IRIX.mk +$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/js/src/config/IRIX6.3.mk b/js/src/config/revdepth.pl similarity index 74% rename from js/src/config/IRIX6.3.mk rename to js/src/config/revdepth.pl index 354f1d119d91..3ec4272c0ccb 100644 --- a/js/src/config/IRIX6.3.mk +++ b/js/src/config/revdepth.pl @@ -1,4 +1,4 @@ -# -*- Mode: makefile -*- +#! perl # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -13,8 +13,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. @@ -24,8 +23,8 @@ # Contributor(s): # # Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,8 +36,16 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for IRIX6.3 -# +unshift(@INC, '/usr/lib/perl'); +unshift(@INC, '/usr/local/lib/perl'); -include $(DEPTH)/config/IRIX.mk +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/js/src/config/rules.mk b/js/src/config/rules.mk new file mode 100644 index 000000000000..96aa71e3d376 --- /dev/null +++ b/js/src/config/rules.mk @@ -0,0 +1,2207 @@ +# vim:set ts=8 sw=8 sts=8 noet: +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Chase Phillips +# Benjamin Smedberg +# Jeff Walden +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +ifndef topsrcdir +topsrcdir = $(DEPTH) +endif + +ifndef MOZILLA_DIR +MOZILLA_DIR = $(topsrcdir) +endif + +ifndef INCLUDED_CONFIG_MK +include $(topsrcdir)/config/config.mk +endif + +ifndef INCLUDED_VERSION_MK +include $(topsrcdir)/config/version.mk +endif + +REPORT_BUILD = @echo $(notdir $<) + +ifeq ($(OS_ARCH),OS2) +EXEC = +else +EXEC = exec +endif + +# ELOG prints out failed command when building silently (gmake -s). +ifneq (,$(findstring -s,$(MAKEFLAGS))) + ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh +else + ELOG := +endif + +ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) +ifndef GNU_CC +_LIBNAME_RELATIVE_PATHS=1 +endif +endif + +ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) +PWD := $(shell pwd) +_VPATH_SRCS = $(if $(filter /%,$<),$<,$(PWD)/$<) +else +_VPATH_SRCS = $< +endif + +# Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed +VPATH += $(DIST)/lib +ifdef LIBXUL_SDK +VPATH += $(LIBXUL_SDK)/lib +endif + +# EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo) +# expands to foo.lib on platforms with import libs and -lfoo otherwise + +# EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir) +# expands to dir/foo.lib on platforms with import libs and +# -Ldir -lfoo otherwise + +# EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo) +# expands to $(DIST)/lib/foo.lib on platforms with import libs and +# -lfoo otherwise + +ifdef _LIBNAME_RELATIVE_PATHS +EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX)) +EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX)) +EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX)) +else +EXPAND_LIBNAME = $(addprefix -l,$(1)) +EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1)) +EXPAND_MOZLIBNAME = $(addprefix -l,$(1)) +endif + +ifdef EXTRA_DSO_LIBS +EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS)) +endif + +# +# Library rules +# +# If BUILD_STATIC_LIBS or FORCE_STATIC_LIB is set, build a static library. +# Otherwise, build a shared library. +# + +ifndef LIBRARY +ifdef LIBRARY_NAME +ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) +ifdef SHORT_LIBNAME +LIBRARY_NAME := $(SHORT_LIBNAME) +endif +endif +LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX) +endif +endif + +ifndef HOST_LIBRARY +ifdef HOST_LIBRARY_NAME +HOST_LIBRARY := $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX) +endif +endif + +ifdef LIBRARY +ifneq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS)) +ifdef MKSHLIB + +ifdef LIB_IS_C_ONLY +MKSHLIB = $(MKCSHLIB) +endif + +ifdef MAKE_FRAMEWORK +SHARED_LIBRARY := $(LIBRARY_NAME) +else +SHARED_LIBRARY := $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX) +endif + +ifeq ($(OS_ARCH),OS2) +DEF_FILE := $(SHARED_LIBRARY:.dll=.def) +endif + +ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) +IMPORT_LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(IMPORT_LIB_SUFFIX) +endif + +ifdef MOZ_ENABLE_LIBXUL +EMBED_MANIFEST_AT=2 +endif + +endif # MKSHLIB +endif # FORCE_SHARED_LIB && !BUILD_STATIC_LIBS +endif # LIBRARY + +ifeq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB)) +LIBRARY := $(NULL) +endif + +ifeq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS)) +SHARED_LIBRARY := $(NULL) +DEF_FILE := $(NULL) +IMPORT_LIBRARY := $(NULL) +endif + +ifdef FORCE_STATIC_LIB +ifndef FORCE_SHARED_LIB +SHARED_LIBRARY := $(NULL) +DEF_FILE := $(NULL) +IMPORT_LIBRARY := $(NULL) +endif +endif + +ifdef FORCE_SHARED_LIB +ifndef FORCE_STATIC_LIB +LIBRARY := $(NULL) +endif +endif + +ifdef JAVA_LIBRARY_NAME +JAVA_LIBRARY := $(JAVA_LIBRARY_NAME).jar +endif + +ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) +ifndef GNU_CC + +# Previously when possible we wrote to $LIBRARY_NAME.pdb. This broke parallel +# make builds on Windows. Now we just write to a pdb file per compiled file. +# See bug 286179 for +# details. -- chase@mozilla.org +# +# Changes to the PDBFILE naming scheme should also be reflected in HOST_PDBFILE +# +ifdef LIBRARY_NAME +PDBFILE=$(LIBRARY_NAME).pdb +ifdef MOZ_DEBUG +CODFILE=$(LIBRARY_NAME).cod +endif +else +PDBFILE=$(basename $(@F)).pdb +ifdef MOZ_DEBUG +CODFILE=$(basename $(@F)).cod +endif +endif # LIBRARY_NAME + +ifdef MOZ_MAPINFO +ifdef LIBRARY_NAME +MAPFILE=$(LIBRARY_NAME).map +else +MAPFILE=$(basename $(@F)).map +endif # LIBRARY_NAME +endif # MOZ_MAPINFO + +ifdef DEFFILE +OS_LDFLAGS += -DEF:$(DEFFILE) +EXTRA_DEPS += $(DEFFILE) +endif + +ifdef MAPFILE +OS_LDFLAGS += -MAP:$(MAPFILE) +#CFLAGS += -Fm$(MAPFILE) +#CXXFLAGS += -Fm$(MAPFILE) +endif + +#ifdef CODFILE +#CFLAGS += -Fa$(CODFILE) -FAsc +#CFLAGS += -Fa$(CODFILE) -FAsc +#endif + +endif # !GNU_CC + +ifdef ENABLE_CXX_EXCEPTIONS +ifdef GNU_CC +CXXFLAGS += -fexceptions +else +ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER))) +CXXFLAGS += -GX +else +CXXFLAGS += -EHsc +endif # _MSC_VER +endif # GNU_CC +endif # ENABLE_CXX_EXCEPTIONS +endif # WINNT + +ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH))) +HOST_PDBFILE=$(basename $(@F)).pdb +endif + +ifndef TARGETS +TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY) +endif + +ifndef OBJS +_OBJS = \ + $(JRI_STUB_CFILES) \ + $(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \ + $(CSRCS:.c=.$(OBJ_SUFFIX)) \ + $(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \ + $(CMSRCS:.m=.$(OBJ_SUFFIX)) \ + $(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \ + $(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)) +OBJS = $(strip $(_OBJS)) +endif + +ifndef HOST_OBJS +_HOST_OBJS = \ + $(addprefix host_,$(HOST_CSRCS:.c=.$(OBJ_SUFFIX))) \ + $(addprefix host_,$(patsubst %.cc,%.$(OBJ_SUFFIX),$(HOST_CPPSRCS:.cpp=.$(OBJ_SUFFIX)))) \ + $(addprefix host_,$(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))) \ + $(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX))) +HOST_OBJS = $(strip $(_HOST_OBJS)) +endif + +LIBOBJS := $(addprefix \", $(OBJS)) +LIBOBJS := $(addsuffix \", $(LIBOBJS)) + +ifndef MOZ_AUTO_DEPS +ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)) +MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp)) +ifndef NO_GEN_XPT +MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt)) \ + $(addprefix $(MDDEPDIR)/,$(SDK_XPIDLSRCS:.idl=.xpt)) +endif +endif +endif + +ALL_TRASH = \ + $(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \ + $(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \ + $(OBJS:.$(OBJ_SUFFIX)=.i) \ + $(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\ + $(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \ + $(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \ + $(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \ + $(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \ + $(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \ + $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \ + $(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp) +ALL_TRASH_DIRS = \ + $(GARBAGE_DIRS) /no-such-file + +ifdef QTDIR +GARBAGE += $(MOCSRCS) +endif + +ifdef SIMPLE_PROGRAMS +GARBAGE += $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX)) +endif + +ifdef HOST_SIMPLE_PROGRAMS +GARBAGE += $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX)) +endif + +# +# the Solaris WorkShop template repository cache. it occasionally can get +# out of sync, so targets like clobber should kill it. +# +ifeq ($(OS_ARCH),SunOS) +ifeq ($(GNU_CXX),) +GARBAGE_DIRS += SunWS_cache +endif +endif + +ifeq ($(OS_ARCH),OpenVMS) +GARBAGE += $(wildcard *.*_defines) +ifdef SHARED_LIBRARY +VMS_SYMVEC_FILE = $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt) +ifdef MOZ_DEBUG +VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_dbg_symvec.opt)) +else +VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt)) +endif +VMS_SYMVEC_FILE_COMP = $(topsrcdir)/build/unix/vms/component_symvec.opt +GARBAGE += $(VMS_SYMVEC_FILE) +ifdef IS_COMPONENT +DSO_LDOPTS := $(filter-out -auto_symvec,$(DSO_LDOPTS)) $(VMS_SYMVEC_FILE) +endif +endif +endif + +XPIDL_GEN_DIR = _xpidlgen + +ifdef MOZ_UPDATE_XTERM +# Its good not to have a newline at the end of the titlebar string because it +# makes the make -s output easier to read. Echo -n does not work on all +# platforms, but we can trick sed into doing it. +UPDATE_TITLE = sed -e "s!Y!$@ in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(dir)!" $(MOZILLA_DIR)/config/xterm.str; +endif + +LOOP_OVER_DIRS = \ + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true + +LOOP_OVER_STATIC_DIRS = \ + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(STATIC_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true + +LOOP_OVER_TOOL_DIRS = \ + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true + +# +# Now we can differentiate between objects used to build a library, and +# objects used to build an executable in the same directory. +# +ifndef PROGOBJS +PROGOBJS = $(OBJS) +endif + +ifndef HOST_PROGOBJS +HOST_PROGOBJS = $(HOST_OBJS) +endif + +# MAKE_DIRS: List of directories to build while looping over directories. +ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)) +MAKE_DIRS += $(MDDEPDIR) +GARBAGE_DIRS += $(MDDEPDIR) +endif + +# +# Tags: emacs (etags), vi (ctags) +# TAG_PROGRAM := ctags -L - +# +TAG_PROGRAM = xargs etags -a + +# +# Turn on C++ linking if we have any .cpp or .mm files +# (moved this from config.mk so that config.mk can be included +# before the CPPSRCS are defined) +# +ifneq ($(CPPSRCS)$(CMMSRCS),) +CPP_PROG_LINK = 1 +endif + +# +# Make sure to wrap static libs inside linker specific flags to turn on & off +# inclusion of all symbols inside the static libs +# +ifndef NO_LD_ARCHIVE_FLAGS +ifdef SHARED_LIBRARY_LIBS +EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS) +endif +endif + +# +# This will strip out symbols that the component should not be +# exporting from the .dynsym section. +# +ifdef IS_COMPONENT +EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS) +endif # IS_COMPONENT + +# +# Enforce the requirement that MODULE_NAME must be set +# for components in static builds +# +ifdef IS_COMPONENT +ifdef EXPORT_LIBRARY +ifndef FORCE_SHARED_LIB +ifndef MODULE_NAME +$(error MODULE_NAME is required for components which may be used in static builds) +endif +endif +endif +endif + +# +# MacOS X specific stuff +# + +ifeq ($(OS_ARCH),Darwin) +ifdef SHARED_LIBRARY +ifdef IS_COMPONENT +EXTRA_DSO_LDOPTS += -bundle +else +EXTRA_DSO_LDOPTS += -dynamiclib -install_name @executable_path/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module +endif +endif +endif + +# +# On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be +# fatal symbol name clashes between components. +# +ifeq ($(OS_ARCH),NetBSD) +ifeq ($(DLL_SUFFIX),.so.1.0) +ifdef IS_COMPONENT +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic +endif +endif +endif + +ifeq ($(OS_ARCH),FreeBSD) +ifdef IS_COMPONENT +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic +endif +endif + +ifeq ($(OS_ARCH),NetBSD) +ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips,$(OS_TEST))) +ifeq ($(MODULE),layout) +OS_CFLAGS += -Wa,-xgot +OS_CXXFLAGS += -Wa,-xgot +endif +endif +endif + +ifeq ($(OS_ARCH),Linux) +ifneq (,$(filter mips mipsel,$(OS_TEST))) +ifeq ($(MODULE),layout) +OS_CFLAGS += -Wa,-xgot +OS_CXXFLAGS += -Wa,-xgot +endif +endif +endif + +# +# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag +# which uses internal symbols first +# +ifeq ($(OS_ARCH),HP-UX) +ifdef IS_COMPONENT +ifeq ($(GNU_CC)$(GNU_CXX),) +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic +ifneq ($(HAS_EXTRAEXPORTS),1) +MKSHLIB += -Wl,+eNSGetModule -Wl,+eerrno +MKCSHLIB += +eNSGetModule +eerrno +ifneq ($(OS_TEST),ia64) +MKSHLIB += -Wl,+e_shlInit +MKCSHLIB += +e_shlInit +endif # !ia64 +endif # !HAS_EXTRAEXPORTS +endif # non-gnu compilers +endif # IS_COMPONENT +endif # HP-UX + +ifeq ($(OS_ARCH),AIX) +ifdef IS_COMPONENT +ifneq ($(HAS_EXTRAEXPORTS),1) +MKSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall +MKCSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall +endif # HAS_EXTRAEXPORTS +endif # IS_COMPONENT +endif # AIX + +# +# OSF1: add -B symbolic flag for components +# +ifeq ($(OS_ARCH),OSF1) +ifdef IS_COMPONENT +ifeq ($(GNU_CC)$(GNU_CXX),) +EXTRA_DSO_LDOPTS += -B symbolic +endif +endif +endif + +# +# Linux: add -Bsymbolic flag for components +# +ifeq ($(OS_ARCH),Linux) +ifdef IS_COMPONENT +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic +endif +endif + +# +# MINGW32 +# +ifeq ($(OS_ARCH),WINNT) +ifdef GNU_CC +ifndef IS_COMPONENT +DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) +endif +endif +endif + +ifeq ($(USE_TVFS),1) +IFLAGS1 = -rb +IFLAGS2 = -rb +else +IFLAGS1 = -m 644 +IFLAGS2 = -m 755 +endif + +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) +OUTOPTION = -Fo# eol +else +OUTOPTION = -o # eol +endif # WINNT && !GNU_CC +ifneq (,$(filter WINCE,$(OS_ARCH))) +OUTOPTION = -Fo# eol +endif + +ifeq ($(OS_TARGET), WINCE) +OUTOPTION = -Fo# eol +HOST_OUTOPTION = -Fo# eol +else + +ifeq (,$(CROSS_COMPILE)) +HOST_OUTOPTION = $(OUTOPTION) +else +HOST_OUTOPTION = -o # eol +endif + +endif +################################################################################ + +# SUBMAKEFILES: List of Makefiles for next level down. +# This is used to update or create the Makefiles before invoking them. +SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS)) + +# The root makefile doesn't want to do a plain export/libs, because +# of the tiers and because of libxul. Suppress the default rules in favor +# of something else. Makefiles which use this var *must* provide a sensible +# default rule before including rules.mk +ifndef SUPPRESS_DEFAULT_RULES +ifdef TIERS + +DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs)) +STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs)) + +default all alldep:: + $(EXIT_ON_ERROR) \ + $(foreach tier,$(TIERS),$(MAKE) tier_$(tier); ) true + +else + +default all:: + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(STATIC_DIRS),$(MAKE) -C $(dir); ) true + $(MAKE) export + $(MAKE) libs + $(MAKE) tools + +# Do depend as well +alldep:: + $(MAKE) export + $(MAKE) depend + $(MAKE) libs + $(MAKE) tools + +endif # TIERS +endif # SUPPRESS_DEFAULT_RULES + +ifeq ($(filter s,$(MAKEFLAGS)),) +ECHO := echo +QUIET := +else +ECHO := true +QUIET := -q +endif + +MAKE_TIER_SUBMAKEFILES = +$(if $(tier_$*_dirs),$(MAKE) $(addsuffix /Makefile,$(tier_$*_dirs))) + +export_tier_%: + @$(ECHO) "$@" + @$(MAKE_TIER_SUBMAKEFILES) + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) export; ) true + +libs_tier_%: + @$(ECHO) "$@" + @$(MAKE_TIER_SUBMAKEFILES) + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) libs; ) true + +tools_tier_%: + @$(ECHO) "$@" + @$(MAKE_TIER_SUBMAKEFILES) + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) tools; ) true + +$(foreach tier,$(TIERS),tier_$(tier)):: + @$(ECHO) "$@: $($@_staticdirs) $($@_dirs)" + @$(EXIT_ON_ERROR) \ + $(foreach dir,$($@_staticdirs),$(MAKE) -C $(dir); ) true + $(MAKE) export_$@ + $(MAKE) libs_$@ + +# Do everything from scratch +everything:: + $(MAKE) clean + $(MAKE) alldep + +# Add dummy depend target for tinderboxes +depend:: + +ifdef ALL_PLATFORMS +all_platforms:: $(NFSPWD) + @d=`$(NFSPWD)`; \ + if test ! -d LOGS; then rm -rf LOGS; mkdir LOGS; else true; 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 + +# Target to only regenerate makefiles +makefiles: $(SUBMAKEFILES) +ifneq (,$(DIRS)$(TOOL_DIRS)) + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) +endif + +export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),$(PUBLIC)) $(if $(SDK_HEADERS)$(SDK_XPIDLSRCS),$(SDK_PUBLIC)) $(if $(XPIDLSRCS),$(IDL_DIR)) $(if $(SDK_XPIDLSRCS),$(SDK_IDL_DIR)) + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) + +tools:: $(SUBMAKEFILES) $(MAKE_DIRS) + +$(LOOP_OVER_DIRS) +ifdef TOOL_DIRS + @$(EXIT_ON_ERROR) \ + $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; ) true +endif + +# +# Rule to create list of libraries for final link +# +export:: +ifdef LIBRARY_NAME +ifdef EXPORT_LIBRARY +ifdef IS_COMPONENT +ifdef BUILD_STATIC_LIBS + @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME) +ifdef MODULE_NAME + @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME) +endif +endif +else + $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME) +endif # IS_COMPONENT +endif # EXPORT_LIBRARY +endif # LIBRARY_NAME + +# Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries +LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS)) +HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS)) +DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS)) + +############################################## +libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY) +ifndef NO_DIST_INSTALL +ifdef LIBRARY +ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build +ifdef IS_COMPONENT + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components +else + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib +endif +endif # EXPORT_LIBRARY +ifdef DIST_INSTALL +ifdef IS_COMPONENT + $(error Shipping static component libs makes no sense.) +else + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib +endif +endif # DIST_INSTALL +endif # LIBRARY +ifdef SHARED_LIBRARY +ifdef IS_COMPONENT + $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components + $(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY) +ifdef BEOS_ADDON_WORKAROUND + ( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) ) +endif +else # ! IS_COMPONENT +ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) + $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib +else + $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib +endif + $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET) +ifdef BEOS_ADDON_WORKAROUND + ( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) ) +endif +endif # IS_COMPONENT +endif # SHARED_LIBRARY +ifdef PROGRAM + $(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET) +endif +ifdef SIMPLE_PROGRAMS + $(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET) +endif +ifdef HOST_PROGRAM + $(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin +endif +ifdef HOST_SIMPLE_PROGRAMS + $(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin +endif +ifdef HOST_LIBRARY + $(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib +endif +ifdef JAVA_LIBRARY +ifdef IS_COMPONENT + $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components +else + $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET) +endif +endif # JAVA_LIBRARY +endif # !NO_DIST_INSTALL + +$(LOOP_OVER_DIRS) + +############################################## + +ifndef NO_PROFILE_GUIDED_OPTIMIZE +ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE)) +ifeq ($(OS_ARCH)_$(GNU_CC)$(INTERNAL_TOOLS), WINNT_) +# Force re-linking when building with PGO, since +# the MSVC linker does all the work. We force re-link +# in both stages so you can do depend builds with PGO. +ifdef SHARED_LIBRARY +$(SHARED_LIBRARY): FORCE +BINARY_BASENAME = $(SHARED_LIBRARY:$(DLL_SUFFIX)=) +endif +ifdef PROGRAM +$(PROGRAM): FORCE +BINARY_BASENAME = $(PROGRAM:$(BIN_SUFFIX)=) +endif + +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. +ifdef BINARY_BASENAME +export:: + $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \ + $(BINARY_BASENAME) $(DIST)/bin +endif +endif # MOZ_PROFILE_USE +endif # WINNT_ +endif # MOZ_PROFILE_GENERATE || MOZ_PROFILE_USE +endif # NO_PROFILE_GUIDED_OPTIMIZE + +############################################## + +checkout: + $(MAKE) -C $(topsrcdir) -f client.mk checkout + +run_viewer: $(FINAL_TARGET)/viewer + cd $(FINAL_TARGET); \ + MOZILLA_FIVE_HOME=`pwd` \ + LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \ + viewer + +clean clobber realclean clobber_all:: $(SUBMAKEFILES) + -rm -f $(ALL_TRASH) + -rm -rf $(ALL_TRASH_DIRS) + +-$(LOOP_OVER_DIRS) + +-$(LOOP_OVER_STATIC_DIRS) + +-$(LOOP_OVER_TOOL_DIRS) + +distclean:: $(SUBMAKEFILES) + +-$(LOOP_OVER_DIRS) + +-$(LOOP_OVER_STATIC_DIRS) + +-$(LOOP_OVER_TOOL_DIRS) + -rm -rf $(ALL_TRASH_DIRS) + -rm -f $(ALL_TRASH) \ + Makefile .HSancillary \ + $(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \ + $(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \ + $(wildcard *.$(IMPORT_LIB_SUFFIX)) +ifeq ($(OS_ARCH),OS2) + -rm -f $(PROGRAM:.exe=.map) +endif + +alltags: + rm -f TAGS + find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM) + +# +# PROGRAM = Foo +# creates OBJS, links with LIBS to create Foo +# +$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) Makefile Makefile.in +ifeq (WINCE,$(OS_ARCH)) + $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) +else +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) + $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) +ifdef MSMANIFEST_TOOL + @if test -f $@.manifest; then \ + if test -f "$(srcdir)/$@.manifest"; then \ + mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \ + else \ + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ + fi; \ + rm -f $@.manifest; \ + fi +endif # MSVC with manifest tool +else +ifeq ($(CPP_PROG_LINK),1) + $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE) +else # ! CPP_PROG_LINK + $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) +endif # CPP_PROG_LINK +endif # WINNT && !GNU_CC +endif # WINCE + +ifdef ENABLE_STRIP + $(STRIP) $@ +endif +ifdef MOZ_POST_PROGRAM_COMMAND + $(MOZ_POST_PROGRAM_COMMAND) $@ +endif +ifeq ($(OS_ARCH),BeOS) +ifdef BEOS_PROGRAM_RESOURCE + xres -o $@ $(BEOS_PROGRAM_RESOURCE) + mimeset $@ +endif +endif # BeOS + +$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) Makefile Makefile.in +ifeq (WINCE,$(OS_ARCH)) + $(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) +else +ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH)) + $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) +ifdef MSMANIFEST_TOOL + @if test -f $@.manifest; then \ + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ + rm -f $@.manifest; \ + fi +endif # MSVC with manifest tool +else +ifeq ($(CPP_PROG_LINK),1) + $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) +else + $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) +endif # CPP_PROG_LINK +endif +endif + +# +# This is an attempt to support generation of multiple binaries +# in one directory, it assumes everything to compile Foo is in +# Foo.o (from either Foo.c or Foo.cpp). +# +# SIMPLE_PROGRAMS = Foo Bar +# creates Foo.o Bar.o, links with LIBS to create Foo, Bar. +# +$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in +ifeq (WINCE,$(OS_ARCH)) + $(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) +else +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) + $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) +ifdef MSMANIFEST_TOOL + @if test -f $@.manifest; then \ + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ + rm -f $@.manifest; \ + fi +endif # MSVC with manifest tool +else +ifeq ($(CPP_PROG_LINK),1) + $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS) +else + $(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS) +endif # CPP_PROG_LINK +endif # WINNT && !GNU_CC +endif # WINCE + +ifdef ENABLE_STRIP + $(STRIP) $@ +endif +ifdef MOZ_POST_PROGRAM_COMMAND + $(MOZ_POST_PROGRAM_COMMAND) $@ +endif + +$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) Makefile Makefile.in +ifeq (WINCE,$(OS_ARCH)) + $(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS) +else +ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC)) + $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) +else +ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX)) + $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS) +else + $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS) +endif +endif +endif + +# +# Purify target. Solaris/sparc only to start. +# Purify does not recognize "egcs" or "c++" so we go with +# "gcc" and "g++" for now. +# +pure: $(PROGRAM) +ifeq ($(CPP_PROG_LINK),1) + $(PURIFY) $(CCC) -o $^.pure $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) +else + $(PURIFY) $(CC) -o $^.pure $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) +endif +ifndef NO_DIST_INSTALL + $(INSTALL) $(IFLAGS2) $^.pure $(FINAL_TARGET) +endif + +quantify: $(PROGRAM) +ifeq ($(CPP_PROG_LINK),1) + $(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) +else + $(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) +endif +ifndef NO_DIST_INSTALL + $(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET) +endif + +# +# This allows us to create static versions of the shared libraries +# that are built using other static libraries. Confused...? +# +ifdef SHARED_LIBRARY_LIBS +ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH))) +ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB)) +LOBJS += $(SHARED_LIBRARY_LIBS) +endif +else +ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH))) +CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)' +CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF +else +CLEANUP2 := true +endif +SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) +endif +endif +ifdef MOZILLA_PROBE_LIBS +PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) +endif +ifdef DTRACE_PROBE_OBJ +EXTRA_DEPS += $(DTRACE_PROBE_OBJ) +endif + +$(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) Makefile Makefile.in + rm -f $@ +ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH))) +ifdef SHARED_LIBRARY_LIBS + @rm -f $(SUB_LOBJS) + @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done +endif +endif + $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS) + $(RANLIB) $@ + @rm -f foodummyfilefoo $(SUB_LOBJS) + +ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH))) +$(IMPORT_LIBRARY): $(SHARED_LIBRARY) +endif + +ifeq ($(OS_ARCH),OS2) +$(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS) + rm -f $@ + echo LIBRARY $(LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@ + echo PROTMODE >> $@ + echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@ + echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@ + echo EXPORTS >> $@ +ifeq ($(IS_COMPONENT),1) +ifeq ($(HAS_EXTRAEXPORTS),1) +ifndef MOZ_OS2_USE_DECLSPEC + $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@ +endif +else + echo _NSGetModule >> $@ +endif +else +ifndef MOZ_OS2_USE_DECLSPEC + $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@ +endif +endif + $(ADD_TO_DEF_FILE) + +ifdef MOZ_OS2_USE_DECLSPEC +$(IMPORT_LIBRARY): $(SHARED_LIBRARY) +else +$(IMPORT_LIBRARY): $(DEF_FILE) +endif + rm -f $@ + $(IMPLIB) $@ $^ + $(RANLIB) $@ +endif # OS/2 + +$(HOST_LIBRARY): $(HOST_OBJS) Makefile + rm -f $@ + $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS) + $(HOST_RANLIB) $@ + +ifdef NO_LD_ARCHIVE_FLAGS +SUB_SHLOBJS = $(SUB_LOBJS) +endif + +ifdef HAVE_DTRACE +ifndef XP_MACOSX +ifdef DTRACE_PROBE_OBJ +ifndef DTRACE_LIB_DEPENDENT +$(DTRACE_PROBE_OBJ): $(OBJS) + dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS) +endif +endif +endif +endif + +# On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files, +# so instead of deleting .o files after repacking them into a dylib, we make +# symlinks back to the originals. The symlinks are a no-op for stabs debugging, +# so no need to conditionalize on OS version or debugging format. + +$(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) Makefile Makefile.in +ifndef INCREMENTAL_LINKER + rm -f $@ +endif +ifeq ($(OS_ARCH),OpenVMS) + @if test ! -f $(VMS_SYMVEC_FILE); then \ + if test -f $(VMS_SYMVEC_FILE_MODULE); then \ + echo Creating specific component options file $(VMS_SYMVEC_FILE); \ + cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \ + fi; \ + fi +ifdef IS_COMPONENT + @if test ! -f $(VMS_SYMVEC_FILE); then \ + echo Creating generic component options file $(VMS_SYMVEC_FILE); \ + cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \ + fi +endif +endif # OpenVMS +ifdef NO_LD_ARCHIVE_FLAGS +ifdef SHARED_LIBRARY_LIBS + @rm -f $(SUB_SHLOBJS) + @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done +ifeq ($(OS_ARCH),Darwin) + @echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS) + @for lib in $(SHARED_LIBRARY_LIBS); do \ + libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \ + ofiles=`$(AR_LIST) $${lib}`; \ + for ofile in $$ofiles; do \ + if [ -f $$libdir/$$ofile ]; then \ + rm -f $$ofile; \ + ln -s $$libdir/$$ofile $$ofile; \ + fi; \ + done; \ + done +endif +endif # SHARED_LIBRARY_LIBS +endif # NO_LD_ARCHIVE_FLAGS +ifdef DTRACE_LIB_DEPENDENT + @rm -f $(PROBE_LOBJS) + @for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done +ifndef XP_MACOSX + dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) +endif + @for lib in $(MOZILLA_PROBE_LIBS); do \ + ofiles=`$(AR_LIST) $${lib}`; \ + $(AR_DELETE) $${lib} $$ofiles; \ + done + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) + @rm -f $(PROBE_LOBJS) + @rm -f $(DTRACE_PROBE_OBJ) + @for lib in $(MOZILLA_PROBE_LIBS); do \ + if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \ + done + @rm -f $(MOZILLA_PROBE_LIBS) + +else # ! DTRACE_LIB_DEPENDENT + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) +endif # DTRACE_LIB_DEPENDENT + +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) +ifdef MSMANIFEST_TOOL +ifdef EMBED_MANIFEST_AT + @if test -f $@.manifest; then \ + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \ + rm -f $@.manifest; \ + fi +endif # EMBED_MANIFEST_AT +endif # MSVC with manifest tool +endif # WINNT && !GCC +ifeq ($(OS_ARCH),Darwin) +else # non-Darwin + @rm -f $(SUB_SHLOBJS) +endif # Darwin + @rm -f foodummyfilefoo $(DELETE_AFTER_LINK) + chmod +x $@ +ifdef ENABLE_STRIP + $(STRIP) $@ +endif +ifdef MOZ_POST_DSO_LIB_COMMAND + $(MOZ_POST_DSO_LIB_COMMAND) $@ +endif + +ifdef MOZ_AUTO_DEPS +ifdef COMPILER_DEPEND +ifeq (__SunOS,$(GNU_CC)_$(GNU_CXX)_$(OS_ARCH)) +_MDDEPFILE = $(MDDEPDIR)/$(@F).pp + +define MAKE_DEPS_AUTO_CC +if test -d $(@D); then \ + echo "Building deps for $< using Sun Studio cc"; \ + $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \ +fi +endef +define MAKE_DEPS_AUTO_CXX +if test -d $(@D); then \ + echo "Building deps for $< using Sun Studio CC"; \ + $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \ +fi +endef +endif # Sun Studio on Solaris +else # COMPILER_DEPEND +# +# Generate dependencies on the fly +# +_MDDEPFILE = $(MDDEPDIR)/$(@F).pp + +define MAKE_DEPS_AUTO +if test -d $(@D); then \ + echo "Building deps for $<"; \ + $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \ +fi +endef + +MAKE_DEPS_AUTO_CC = $(MAKE_DEPS_AUTO) +MAKE_DEPS_AUTO_CXX = $(MAKE_DEPS_AUTO) + +endif # COMPILER_DEPEND + +endif # MOZ_AUTO_DEPS + +ifdef MOZ_MEMORY +ifeq ($(OS_ARCH),SunOS) +SOLARIS_JEMALLOC_LDFLAGS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib) +endif +endif + +# Rules for building native targets must come first because of the host_ prefix +host_%.$(OBJ_SUFFIX): %.c Makefile Makefile.in + $(REPORT_BUILD) + $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS) + +host_%.$(OBJ_SUFFIX): %.cpp Makefile Makefile.in + $(REPORT_BUILD) + $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS) + +host_%.$(OBJ_SUFFIX): %.cc Makefile Makefile.in + $(REPORT_BUILD) + $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS) + +host_%.$(OBJ_SUFFIX): %.m Makefile Makefile.in + $(REPORT_BUILD) + $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS) + +host_%.$(OBJ_SUFFIX): %.mm Makefile Makefile.in + $(REPORT_BUILD) + $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS) + +%: %.c Makefile Makefile.in + $(REPORT_BUILD) + @$(MAKE_DEPS_AUTO_CC) + $(ELOG) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTOPTION)$@ $(_VPATH_SRCS) + +%.$(OBJ_SUFFIX): %.c Makefile Makefile.in + $(REPORT_BUILD) + @$(MAKE_DEPS_AUTO_CC) + $(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS) + +moc_%.cpp: %.h Makefile Makefile.in + $(MOC) $< $(OUTOPTION)$@ + +ifdef ASFILES +# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept +# a '-c' flag. +%.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) Makefile Makefile.in + $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS) +endif + +%.$(OBJ_SUFFIX): %.S Makefile Makefile.in + $(AS) -o $@ $(ASFLAGS) -c $< + +%: %.cpp Makefile Makefile.in + @$(MAKE_DEPS_AUTO_CXX) + $(CCC) $(OUTOPTION)$@ $(CXXFLAGS) $(_VPATH_SRCS) $(LDFLAGS) + +# +# Please keep the next two rules in sync. +# +%.$(OBJ_SUFFIX): %.cc Makefile Makefile.in + $(REPORT_BUILD) + @$(MAKE_DEPS_AUTO_CXX) + $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) + +%.$(OBJ_SUFFIX): %.cpp Makefile Makefile.in + $(REPORT_BUILD) + @$(MAKE_DEPS_AUTO_CXX) +ifdef STRICT_CPLUSPLUS_SUFFIX + echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc + $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc + rm -f t_$*.cc +else + $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) +endif #STRICT_CPLUSPLUS_SUFFIX + +$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm Makefile Makefile.in + $(REPORT_BUILD) + @$(MAKE_DEPS_AUTO_CXX) + $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) + +$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m Makefile Makefile.in + $(REPORT_BUILD) + @$(MAKE_DEPS_AUTO_CC) + $(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS) + +%.s: %.cpp + $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) + +%.s: %.cc + $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) + +%.s: %.c + $(CC) -S $(COMPILE_CFLAGS) $(_VPATH_SRCS) + +%.i: %.cpp + $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i + +%.i: %.cc + $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i + +%.i: %.c + $(CC) -C -E $(COMPILE_CFLAGS) $(_VPATH_SRCS) > $*.i + +%.i: %.mm + $(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) > $*.i + +%.res: %.rc + @echo Creating Resource file: $@ +ifeq ($(OS_ARCH),OS2) + $(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@ +else +ifdef GNU_CC + $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS) +else + $(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS) +endif +endif + +# need 3 separate lines for OS/2 +%: %.pl + rm -f $@ + cp $< $@ + chmod +x $@ + +%: %.sh + rm -f $@; cp $< $@; chmod +x $@ + +# Cancel these implicit rules +# +%: %,v + +%: RCS/%,v + +%: s.% + +%: SCCS/s.% + +############################################################################### +# Java rules +############################################################################### +ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) +SEP := ; +else +SEP := : +endif + +EMPTY := +SPACE := $(EMPTY) $(EMPTY) + +# Cygwin and MSYS have their own special path form, but javac expects the source +# and class paths to be in the DOS form (i.e. e:/builds/...). This function +# does the appropriate conversion on Windows, but is a noop on other systems. +ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH))) +ifdef CYGWIN_WRAPPER +normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p))) +else +# assume MSYS +# We use 'pwd -W' to get DOS form of the path. However, since the given path +# could be a file or a non-existent path, we cannot call 'pwd -W' directly +# on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W' +# on it, then merge with the rest of the path. +root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|") +non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|") +normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(shell cd $(call root-path,$(1)) && pwd -W)$(call non-root-path,$(1)),$(1))) +endif +else +normalizepath = $(1) +endif + +_srcdir = $(call normalizepath,$(srcdir)) +ifdef JAVA_SOURCEPATH +SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH)))) +_JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)" +else +_JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)" +endif + +ifdef JAVA_CLASSPATH +CP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_CLASSPATH)))) +_JAVA_CLASSPATH = ".$(SEP)$(CP)" +else +_JAVA_CLASSPATH = . +endif + +_JAVA_DIR = _java +$(_JAVA_DIR):: + $(NSINSTALL) -D $@ + +$(_JAVA_DIR)/%.class: %.java Makefile Makefile.in $(_JAVA_DIR) + $(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \ + -sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS) + +$(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) Makefile Makefile.in + $(JAR) cf $@ -C $(_JAVA_DIR) . + +GARBAGE_DIRS += $(_JAVA_DIR) + +############################################################################### +# Update Makefiles +############################################################################### + +# In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're +# processing them with AS perl. See bug 232003 +ifdef AS_PERL +CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap +endif + +# Note: Passing depth to make-makefile is optional. +# It saves the script some work, though. +Makefile: Makefile.in + @$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) + +ifdef SUBMAKEFILES +# VPATH does not work on some machines in this case, so add $(srcdir) +$(SUBMAKEFILES): % : $(srcdir)/%.in + $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@ +endif + +ifdef AUTOUPDATE_CONFIGURE +$(topsrcdir)/configure: $(topsrcdir)/configure.in + (cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck) +endif + +############################################################################### +# Bunch of things that extend the 'export' rule (in order): +############################################################################### + +################################################################################ +# Copy each element of EXPORTS to $(PUBLIC) + +ifneq ($(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),) +$(SDK_PUBLIC) $(PUBLIC):: + @if test ! -d $@; then $(ECHO) Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi +endif + +ifdef MOZ_JAVAXPCOM +ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),) +$(JAVA_DIST_DIR):: + $(NSINSTALL) -D $@ +endif +endif + +ifneq ($(XPI_NAME),) +export:: + @if test ! -d $(FINAL_TARGET); then echo Creating $(FINAL_TARGET); rm -fr $(FINAL_TARGET); $(NSINSTALL) -D $(FINAL_TARGET); else true; fi +endif + +ifndef NO_DIST_INSTALL +ifneq ($(EXPORTS),) +export:: $(EXPORTS) $(PUBLIC) + $(INSTALL) $(IFLAGS1) $^ +endif + +ifneq ($(SDK_HEADERS),) +export:: $(SDK_HEADERS) $(SDK_PUBLIC) + $(INSTALL) $(IFLAGS1) $^ + +export:: $(SDK_HEADERS) $(PUBLIC) + $(INSTALL) $(IFLAGS1) $^ +endif +endif # NO_DIST_INSTALL + +################################################################################ +# Copy each element of PREF_JS_EXPORTS + +ifdef GRE_MODULE +PREF_DIR = greprefs +else +ifneq (,$(XPI_NAME)$(LIBXUL_SDK)) +PREF_DIR = defaults/preferences +else +PREF_DIR = defaults/pref +endif +endif + +ifneq ($(PREF_JS_EXPORTS),) +# on win32, pref files need CRLF line endings... see bug 206029 +ifeq (WINNT,$(OS_ARCH)) +PREF_PPFLAGS = --line-endings=crlf +endif + +ifndef NO_DIST_INSTALL +libs:: $(PREF_JS_EXPORTS) + if test ! -d $(FINAL_TARGET)/$(PREF_DIR); then $(NSINSTALL) -D $(FINAL_TARGET)/$(PREF_DIR); fi + $(EXIT_ON_ERROR) \ + for i in $(PREF_JS_EXPORTS); do \ + dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \ + $(RM) -f $$dest; \ + $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \ + done +endif +endif + +################################################################################ +# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig + +ifneq ($(AUTOCFG_JS_EXPORTS),) +$(FINAL_TARGET)/defaults/autoconfig:: + @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi + +ifndef NO_DIST_INSTALL +export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig + $(INSTALL) $(IFLAGS1) $^ +endif + +endif +################################################################################ +# Export the elements of $(XPIDLSRCS) & $(SDK_XPIDLSRCS), +# generating .h and .xpt files and moving them to the appropriate places. + +ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),) + +export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) + +ifndef XPIDL_MODULE +XPIDL_MODULE = $(MODULE) +endif + +ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt +export:: FORCE + @echo + @echo "*** Error processing XPIDLSRCS:" + @echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS," + @echo "so we have a module name to use when creating MODULE.xpt." + @echo; sleep 2; false +endif + +$(SDK_IDL_DIR) $(IDL_DIR):: + @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi + +# generate .h files from into $(XPIDL_GEN_DIR), then export to $(PUBLIC); +# warn against overriding existing .h file. +$(XPIDL_GEN_DIR)/.done: + @if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi + @touch $@ + +# don't depend on $(XPIDL_GEN_DIR), because the modification date changes +# with any addition to the directory, regenerating all .h files -> everything. + +$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done + $(REPORT_BUILD) + $(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS) + @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \ + then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi + +ifndef NO_GEN_XPT +# generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link +# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components. +$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done + $(REPORT_BUILD) + $(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS) + +# no need to link together if XPIDLSRCS contains only XPIDL_MODULE +ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS))) +$(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS)) Makefile.in Makefile $(XPIDL_LINK) + $(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS)) +endif # XPIDL_MODULE.xpt != XPIDLSRCS + +libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt +ifndef NO_DIST_INSTALL + $(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components +endif + +endif # NO_GEN_XPT + +GARBAGE_DIRS += $(XPIDL_GEN_DIR) + +endif # XPIDLSRCS || SDK_XPIDLSRCS + +ifneq ($(XPIDLSRCS),) +# export .idl files to $(IDL_DIR) +ifndef NO_DIST_INSTALL +export:: $(XPIDLSRCS) $(IDL_DIR) + $(INSTALL) $(IFLAGS1) $^ + +export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(PUBLIC) + $(INSTALL) $(IFLAGS1) $^ +endif # NO_DIST_INSTALL + +endif # XPIDLSRCS + + + +# +# General rules for exporting idl files. +# +# WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build. +# Bug to fix idl dependency problems w/o this extra build pass is +# http://bugzilla.mozilla.org/show_bug.cgi?id=145777 +# +$(IDL_DIR):: + @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi + +export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS) + +ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),) +ifndef NO_DIST_INSTALL +export-idl:: $(XPIDLSRCS) $(SDK_XPIDLSRCS) $(IDL_DIR) + $(INSTALL) $(IFLAGS1) $^ +endif +endif + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) + + + + +ifneq ($(SDK_XPIDLSRCS),) +# export .idl files to $(IDL_DIR) & $(SDK_IDL_DIR) +ifndef NO_DIST_INSTALL +export:: $(SDK_XPIDLSRCS) $(IDL_DIR) + $(INSTALL) $(IFLAGS1) $^ + +export:: $(SDK_XPIDLSRCS) $(SDK_IDL_DIR) + $(INSTALL) $(IFLAGS1) $^ + +export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(PUBLIC) + $(INSTALL) $(IFLAGS1) $^ + +export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(SDK_PUBLIC) + $(INSTALL) $(IFLAGS1) $^ +endif + +endif # SDK_XPIDLSRCS + + + +ifdef MOZ_JAVAXPCOM +ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),) + +JAVA_XPIDLSRCS = $(XPIDLSRCS) $(SDK_XPIDLSRCS) + +# A single IDL file can contain multiple interfaces, which result in multiple +# Java interface files. So use hidden dependency files. +JAVADEPFILES = $(addprefix $(JAVA_GEN_DIR)/.,$(JAVA_XPIDLSRCS:.idl=.java.pp)) + +$(JAVA_GEN_DIR): + $(NSINSTALL) -D $@ +GARBAGE_DIRS += $(JAVA_GEN_DIR) + +# generate .java files into _javagen/[package name dirs] +_JAVA_GEN_DIR = $(JAVA_GEN_DIR)/$(JAVA_IFACES_PKG_NAME) +$(_JAVA_GEN_DIR): + $(NSINSTALL) -D $@ + +$(JAVA_GEN_DIR)/.%.java.pp: %.idl $(XPIDL_COMPILE) $(_JAVA_GEN_DIR) + $(REPORT_BUILD) + $(ELOG) $(XPIDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) -o $(_JAVA_GEN_DIR)/$* $(_VPATH_SRCS) + @touch $@ + +# "Install" generated Java interfaces. We segregate them based on the XPI_NAME. +# If XPI_NAME is not set, install into the "default" directory. +ifneq ($(XPI_NAME),) +JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/$(XPI_NAME) +else +JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/default +endif + +$(JAVA_INSTALL_DIR): + $(NSINSTALL) -D $@ + +export:: $(JAVA_DIST_DIR) $(JAVADEPFILES) $(JAVA_INSTALL_DIR) + (cd $(JAVA_GEN_DIR) && tar $(TAR_CREATE_FLAGS) - .) | (cd $(JAVA_INSTALL_DIR) && tar -xf -) + +endif # XPIDLSRCS || SDK_XPIDLSRCS +endif # MOZ_JAVAXPCOM + +################################################################################ +# Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components +ifdef EXTRA_COMPONENTS +libs:: $(EXTRA_COMPONENTS) +ifndef NO_DIST_INSTALL + $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/components +endif + +endif + +ifdef EXTRA_PP_COMPONENTS +libs:: $(EXTRA_PP_COMPONENTS) +ifndef NO_DIST_INSTALL + $(EXIT_ON_ERROR) \ + $(NSINSTALL) -D $(FINAL_TARGET)/components; \ + for i in $^; do \ + dest=$(FINAL_TARGET)/components/`basename $$i`; \ + $(RM) -f $$dest; \ + $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \ + done +endif + +endif + +################################################################################ +# Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules +ifdef EXTRA_JS_MODULES +libs:: $(EXTRA_JS_MODULES) +ifndef NO_DIST_INSTALL + $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/modules +endif + +endif + +ifdef EXTRA_PP_JS_MODULES +libs:: $(EXTRA_PP_JS_MODULES) +ifndef NO_DIST_INSTALL + $(EXIT_ON_ERROR) \ + $(NSINSTALL) -D $(FINAL_TARGET)/modules; \ + for i in $^; do \ + dest=$(FINAL_TARGET)/modules/`basename $$i`; \ + $(RM) -f $$dest; \ + $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \ + done +endif + +endif + +################################################################################ +# SDK + +ifneq (,$(SDK_LIBRARY)) +$(SDK_LIB_DIR):: + @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi + +ifndef NO_DIST_INSTALL +libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR) + $(INSTALL) $(IFLAGS2) $^ +endif + +endif # SDK_LIBRARY + +ifneq (,$(SDK_BINARY)) +$(SDK_BIN_DIR):: + @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi + +ifndef NO_DIST_INSTALL +libs:: $(SDK_BINARY) $(SDK_BIN_DIR) + $(INSTALL) $(IFLAGS2) $^ +endif + +endif # SDK_BINARY + +################################################################################ +# CHROME PACKAGING + +JAR_MANIFEST := $(srcdir)/jar.mn + +chrome:: + $(MAKE) realchrome + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) + +libs realchrome:: $(CHROME_DEPS) +ifndef NO_DIST_INSTALL + @$(EXIT_ON_ERROR) \ + if test -f $(JAR_MANIFEST); then \ + if test ! -d $(FINAL_TARGET)/chrome; then $(NSINSTALL) -D $(FINAL_TARGET)/chrome; fi; \ + $(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \ + $(QUIET) -j $(FINAL_TARGET)/chrome \ + $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \ + $(JAR_MANIFEST); \ + fi +endif + +ifneq ($(DIST_FILES),) +libs:: $(DIST_FILES) + @$(EXIT_ON_ERROR) \ + for f in $(DIST_FILES); do \ + dest=$(FINAL_TARGET)/`basename $$f`; \ + $(RM) -f $$dest; \ + $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \ + $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \ + $(srcdir)/$$f > $$dest; \ + done +endif + +ifneq ($(DIST_CHROME_FILES),) +libs:: $(DIST_CHROME_FILES) + @$(EXIT_ON_ERROR) \ + for f in $(DIST_CHROME_FILES); do \ + dest=$(FINAL_TARGET)/chrome/`basename $$f`; \ + $(RM) -f $$dest; \ + $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \ + $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \ + $(srcdir)/$$f > $$dest; \ + done +endif + +ifneq ($(XPI_PKGNAME),) +libs realchrome:: +ifdef STRIP_XPI +ifndef MOZ_DEBUG + @echo "Stripping $(XPI_PKGNAME) package directory..." + @echo $(FINAL_TARGET) + @cd $(FINAL_TARGET) && find . ! -type d \ + ! -name "*.js" \ + ! -name "*.xpt" \ + ! -name "*.gif" \ + ! -name "*.jpg" \ + ! -name "*.png" \ + ! -name "*.xpm" \ + ! -name "*.txt" \ + ! -name "*.rdf" \ + ! -name "*.sh" \ + ! -name "*.properties" \ + ! -name "*.dtd" \ + ! -name "*.html" \ + ! -name "*.xul" \ + ! -name "*.css" \ + ! -name "*.xml" \ + ! -name "*.jar" \ + ! -name "*.dat" \ + ! -name "*.tbl" \ + ! -name "*.src" \ + ! -name "*.reg" \ + $(PLATFORM_EXCLUDE_LIST) \ + -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \; +endif +endif + @echo "Packaging $(XPI_PKGNAME).xpi..." + cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi * +endif + +ifdef INSTALL_EXTENSION_ID +ifndef XPI_NAME +$(error XPI_NAME must be set for INSTALL_EXTENSION_ID) +endif + +libs:: + $(RM) -rf "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)" + $(NSINSTALL) -D "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)" + cd $(FINAL_TARGET) && tar $(TAR_CREATE_FLAGS) - . | (cd "../../bin/extensions/$(INSTALL_EXTENSION_ID)" && tar -xf -) + +endif + +ifneq (,$(filter flat symlink,$(MOZ_CHROME_FILE_FORMAT))) +_JAR_REGCHROME_DISABLE_JAR=1 +else +_JAR_REGCHROME_DISABLE_JAR=0 +endif + +REGCHROME = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \ + $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \ + $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(FINAL_TARGET)/chrome/installed-chrome.txt \ + $(_JAR_REGCHROME_DISABLE_JAR) + +REGCHROME_INSTALL = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \ + $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \ + $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \ + $(_JAR_REGCHROME_DISABLE_JAR) + + +################################################################################ +# Testing frameworks support +################################################################################ + +ifdef ENABLE_TESTS + +ifdef XPCSHELL_TESTS +ifndef MODULE +$(error Must define MODULE when defining XPCSHELL_TESTS.) +endif + +# Test file installation +libs:: + @$(EXIT_ON_ERROR) \ + for testdir in $(XPCSHELL_TESTS); do \ + $(INSTALL) \ + $(srcdir)/$$testdir/*.js \ + $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \ + done + +# Path formats on Windows are hard. We require a topsrcdir formatted so that +# it may be passed to nsILocalFile.initWithPath (in other words, an absolute +# path of the form X:\path\to\topsrcdir), which we store in NATIVE_TOPSRCDIR. +# We require a forward-slashed path to topsrcdir so that it may be combined +# with a relative forward-slashed path for loading scripts, both dynamically +# and statically for head/test/tail JS files. Of course, on non-Windows none +# of this matters, and things will work correctly because everything's +# forward-slashed, everywhere, always. +ifdef CYGWIN_WRAPPER +NATIVE_TOPSRCDIR := `cygpath -wa $(topsrcdir)` +FWDSLASH_TOPSRCDIR := `cygpath -ma $(topsrcdir)` +else +FWDSLASH_TOPSRCDIR := $(topsrcdir) +ifeq ($(HOST_OS_ARCH),WINNT) +NATIVE_TOPSRCDIR := $(subst /,\\,$(WIN_TOP_SRC)) +else +NATIVE_TOPSRCDIR := $(topsrcdir) +endif +endif # CYGWIN_WRAPPER + +# Test execution +check:: + @$(EXIT_ON_ERROR) \ + for testdir in $(XPCSHELL_TESTS); do \ + $(RUN_TEST_PROGRAM) \ + $(topsrcdir)/tools/test-harness/xpcshell-simple/test_all.sh \ + $(DIST)/bin/xpcshell \ + $(FWDSLASH_TOPSRCDIR) \ + $(NATIVE_TOPSRCDIR) \ + $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \ + done + +# Test execution +check-interactive:: + @$(EXIT_ON_ERROR) \ + $(RUN_TEST_PROGRAM) \ + $(topsrcdir)/tools/test-harness/xpcshell-simple/test_one.sh \ + $(DIST)/bin/xpcshell \ + $(FWDSLASH_TOPSRCDIR) \ + $(NATIVE_TOPSRCDIR) \ + $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \ + $(SOLO_FILE) 1; + +# Test execution +check-one:: + @$(EXIT_ON_ERROR) \ + $(RUN_TEST_PROGRAM) \ + $(topsrcdir)/tools/test-harness/xpcshell-simple/test_one.sh \ + $(DIST)/bin/xpcshell \ + $(FWDSLASH_TOPSRCDIR) \ + $(NATIVE_TOPSRCDIR) \ + $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \ + $(SOLO_FILE) 0; + +endif # XPCSHELL_TESTS + +endif # ENABLE_TESTS + + +############################################################################# +# Dependency system +############################################################################# +ifdef COMPILER_DEPEND +depend:: + @echo "$(MAKE): No need to run depend target.\ + Using compiler-based depend." 1>&2 +ifeq ($(GNU_CC)$(GNU_CXX),) +# Non-GNU compilers + @echo "`echo '$(MAKE):'|sed 's/./ /g'`"\ + '(Compiler-based depend was turned on by "--enable-md".)' 1>&2 +else +# GNU compilers + @space="`echo '$(MAKE): '|sed 's/./ /g'`";\ + echo "$$space"'Since you are using a GNU compiler,\ + it is on by default.' 1>&2; \ + echo "$$space"'To turn it off, pass --disable-md to configure.' 1>&2 +endif + +else # ! COMPILER_DEPEND + +ifndef MOZ_AUTO_DEPS + +define MAKE_DEPS_NOAUTO + $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $@ +endef + +$(MDDEPDIR)/%.pp: %.c + $(REPORT_BUILD) + @$(MAKE_DEPS_NOAUTO) + +$(MDDEPDIR)/%.pp: %.cpp + $(REPORT_BUILD) + @$(MAKE_DEPS_NOAUTO) + +$(MDDEPDIR)/%.pp: %.s + $(REPORT_BUILD) + @$(MAKE_DEPS_NOAUTO) + +ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)) +depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES) +else +depend:: $(SUBMAKEFILES) +endif + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) + +dependclean:: $(SUBMAKEFILES) + rm -f $(MDDEPFILES) + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) + +endif # MOZ_AUTO_DEPS + +endif # COMPILER_DEPEND + + +############################################################################# +# MDDEPDIR is the subdirectory where all the dependency files are placed. +# This uses a make rule (instead of a macro) to support parallel +# builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two +# processes could simultaneously try to create the same directory. +# +$(MDDEPDIR): + @if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi + +ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS))) +ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)) +MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp)) + +ifneq (,$(MDDEPEND_FILES)) +ifdef PERL +# The script mddepend.pl checks the dependencies and writes to stdout +# one rule to force out-of-date objects. For example, +# foo.o boo.o: FORCE +# The script has an advantage over including the *.pp files directly +# because it handles the case when header files are removed from the build. +# 'make' would complain that there is no way to build missing headers. +ifeq (,$(MAKE_RESTARTS)) +$(MDDEPDIR)/.all.pp: FORCE + @$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES) +endif +-include $(MDDEPDIR)/.all.pp +else +include $(MDDEPEND_FILES) +endif +endif + +endif +endif +############################################################################# + +-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk +-include $(MY_RULES) + +# +# This speeds up gmake's processing if these files don't exist. +# +$(MY_CONFIG) $(MY_RULES): + @touch $@ + +# +# Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG) +# or in $(MY_RULES) +# +ifdef ETAGS +ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),) +all:: TAGS +TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS) + $(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS) +endif +endif + +################################################################################ +# Special gmake rules. +################################################################################ + + +# +# Disallow parallel builds with MSVC < 8 +# +ifneq (,$(filter 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: + +# +# Fake targets. Always run these rules, even if a file/directory with that +# name already exists. +# +.PHONY: all all_platforms alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_viewer run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE check check-interactive check-one + +# Used as a dependency to force targets to rebuild +FORCE: + +# Delete target if error occurs when building target +.DELETE_ON_ERROR: + +# Properly set LIBPATTERNS for the platform +.LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX) + +tags: TAGS + +TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h) + -etags $(CSRCS) $(CPPSRCS) $(wildcard *.h) + +$(LOOP_OVER_DIRS) + +echo-variable-%: + @echo $($*) + +echo-tiers: + @echo $(TIERS) + +echo-dirs: + @echo $(DIRS) + +echo-module: + @echo $(MODULE) + +echo-requires: + @echo $(REQUIRES) + +echo-requires-recursive:: +ifdef _REPORT_ALL_DIRS + @echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES) +else + @$(if $(REQUIRES),echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES)) +endif + +$(LOOP_OVER_DIRS) + +echo-depth-path: + @$(topsrcdir)/build/unix/print-depth-path.sh + +echo-module-name: + @$(topsrcdir)/build/package/rpm/print-module-name.sh + +echo-module-filelist: + @$(topsrcdir)/build/package/rpm/print-module-filelist.sh + +showtargs: +ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS))) + @echo -------------------------------------------------------------------------------- + @echo "PROGRAM = $(PROGRAM)" + @echo "SIMPLE_PROGRAMS = $(SIMPLE_PROGRAMS)" + @echo "LIBRARY = $(LIBRARY)" + @echo "SHARED_LIBRARY = $(SHARED_LIBRARY)" + @echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)" + @echo "LIBS = $(LIBS)" + @echo "DEF_FILE = $(DEF_FILE)" + @echo "IMPORT_LIBRARY = $(IMPORT_LIBRARY)" + @echo "STATIC_LIBS = $(STATIC_LIBS)" + @echo "SHARED_LIBS = $(SHARED_LIBS)" + @echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)" + @echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)" + @echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)" + @echo -------------------------------------------------------------------------------- +endif + +$(LOOP_OVER_DIRS) + +showbuild: + @echo "MOZ_BUILD_ROOT = $(MOZ_BUILD_ROOT)" + @echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)" + @echo "CC = $(CC)" + @echo "CXX = $(CXX)" + @echo "CCC = $(CCC)" + @echo "CPP = $(CPP)" + @echo "LD = $(LD)" + @echo "AR = $(AR)" + @echo "IMPLIB = $(IMPLIB)" + @echo "FILTER = $(FILTER)" + @echo "MKSHLIB = $(MKSHLIB)" + @echo "MKCSHLIB = $(MKCSHLIB)" + @echo "RC = $(RC)" + @echo "CFLAGS = $(CFLAGS)" + @echo "OS_CFLAGS = $(OS_CFLAGS)" + @echo "COMPILE_CFLAGS = $(COMPILE_CFLAGS)" + @echo "CXXFLAGS = $(CXXFLAGS)" + @echo "OS_CXXFLAGS = $(OS_CXXFLAGS)" + @echo "COMPILE_CXXFLAGS = $(COMPILE_CXXFLAGS)" + @echo "COMPILE_CMFLAGS = $(COMPILE_CMFLAGS)" + @echo "COMPILE_CMMFLAGS = $(COMPILE_CMMFLAGS)" + @echo "LDFLAGS = $(LDFLAGS)" + @echo "OS_LDFLAGS = $(OS_LDFLAGS)" + @echo "DSO_LDOPTS = $(DSO_LDOPTS)" + @echo "OS_INCLUDES = $(OS_INCLUDES)" + @echo "OS_LIBS = $(OS_LIBS)" + @echo "EXTRA_LIBS = $(EXTRA_LIBS)" + @echo "BIN_FLAGS = $(BIN_FLAGS)" + @echo "INCLUDES = $(INCLUDES)" + @echo "DEFINES = $(DEFINES)" + @echo "ACDEFINES = $(ACDEFINES)" + @echo "BIN_SUFFIX = $(BIN_SUFFIX)" + @echo "LIB_SUFFIX = $(LIB_SUFFIX)" + @echo "DLL_SUFFIX = $(DLL_SUFFIX)" + @echo "IMPORT_LIB_SUFFIX = $(IMPORT_LIB_SUFFIX)" + @echo "INSTALL = $(INSTALL)" + +showhost: + @echo "HOST_CC = $(HOST_CC)" + @echo "HOST_CXX = $(HOST_CXX)" + @echo "HOST_CFLAGS = $(HOST_CFLAGS)" + @echo "HOST_LDFLAGS = $(HOST_LDFLAGS)" + @echo "HOST_LIBS = $(HOST_LIBS)" + @echo "HOST_EXTRA_LIBS = $(HOST_EXTRA_LIBS)" + @echo "HOST_EXTRA_DEPS = $(HOST_EXTRA_DEPS)" + @echo "HOST_PROGRAM = $(HOST_PROGRAM)" + @echo "HOST_OBJS = $(HOST_OBJS)" + @echo "HOST_PROGOBJS = $(HOST_PROGOBJS)" + @echo "HOST_LIBRARY = $(HOST_LIBRARY)" + +showbuildmods:: + @echo "Build Modules = $(BUILD_MODULES)" + @echo "Module dirs = $(BUILD_MODULE_DIRS)" + +zipmakes: +ifneq (,$(filter $(PROGRAM) $(SIMPLE_PROGRAMS) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS))) + zip $(DEPTH)/makefiles $(subst $(topsrcdir),$(MOZ_SRC)/mozilla,$(srcdir)/Makefile.in) +endif + +$(LOOP_OVER_DIRS) + +documentation: + @cd $(DEPTH) + $(DOXYGEN) $(DEPTH)/config/doxygen.cfg + +check:: $(SUBMAKEFILES) $(MAKE_DIRS) + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) diff --git a/js/src/config/system-headers b/js/src/config/system-headers new file mode 100644 index 000000000000..9d61c0e16216 --- /dev/null +++ b/js/src/config/system-headers @@ -0,0 +1,1038 @@ +A4Stuff.h +activscp.h +AEDataModel.h +AEObjects.h +AEPackObject.h +AERegistry.h +AEUtils.h +afxcmn.h +afxcoll.h +afxcview.h +afxdisp.h +afxdtctl.h +afxext.h +afxmt.h +afxpriv.h +afxtempl.h +afxwin.h +algorithm +Aliases.h +all.h +alloca.h +alloc.h +alsa/asoundlib.h +alsa/pcm.h +alsa/mixer.h +ansi_parms.h +a.out.h +app/Cursor.h +Appearance.h +AppFileInfo.h +AppKit.h +AppleEvents.h +Application.h +app/Message.h +app/MessageRunner.h +arpa/inet.h +arpa/nameser.h +asm/sigcontext.h +asm/signal.h +ASRegistry.h +assert.h +atk/atk.h +atlbase.h +atlcom.h +atlconv.h +atlctl.cpp +atlctl.h +ATLCTL.H +atlhost.h +atlimpl.cpp +atlwin.cpp +ATSTypes.h +ATSUnicode.h +Balloons.h +base/pblock.h +base/PCR_Base.h +base/session.h +basetyps.h +be/app/Application.h +Beep.h +be/kernel/image.h +be/kernel/OS.h +bfd.h +Bitmap.h +bsd/libc.h +bsd/syscall.h +bstring.h +builtin.h +Button.h +byteswap.h +#if MOZ_ENABLE_LIBXUL!=1 +#define WRAP_CAIRO_HEADERS +#endif +#if MOZ_TREE_CAIRO!=1 +#define WRAP_CAIRO_HEADERS +#endif +#ifdef WRAP_CAIRO_HEADERS +cairo.h +cairo-atsui.h +cairo-beos.h +cairo-ft.h +cairo-glitz.h +cairo-os2.h +cairo-pdf.h +cairo-ps.h +cairo-quartz.h +cairo-win32.h +cairo-xlib.h +cairo-xlib-xrender.h +cairo-directfb.h +cairo-qpainter.h +#endif +dfiff.h +fusion/reactor.h +fusion/property.h +fusion/conf.h +fusion/build.h +fusion/hash.h +fusion/shm/shm.h +fusion/shm/shm_internal.h +fusion/shm/pool.h +fusion/ref.h +fusion/fusion_internal.h +fusion/lock.h +fusion/types.h +fusion/vector.h +fusion/call.h +fusion/shmalloc.h +fusion/protocol.h +fusion/fusion.h +fusion/arena.h +fusion/object.h +directfbgl.h +directfb_version.h +directfb.h +directfb_util.h +directfb_keynames.h +dgiff.h +direct/util.h +direct/memcpy.h +direct/interface.h +direct/conf.h +direct/tree.h +direct/signals.h +direct/build.h +direct/interface_implementation.h +direct/utf8.h +direct/serial.h +direct/hash.h +direct/direct.h +direct/clock.h +direct/types.h +direct/mem.h +direct/thread.h +direct/debug.h +direct/stream.h +direct/messages.h +direct/trace.h +direct/modules.h +direct/log.h +direct/system.h +direct/list.h +dfb_types.h +directfb_strings.h +directfb_keyboard.h +callconv.h +Carbon/Carbon.h +CarbonEvents.h +Carbon.h +cassert +c_asm.h +cctype +cderr.h +cerrno +cert.h +CFBase.h +CFBundle.h +CFData.h +CFDictionary.h +cf.h +CFNumber.h +CFPlugIn.h +CFPreferences.h +CFString.h +CFURL.h +CGAffineTransform.h +CheckBox.h +climits +Clipboard.h +cmplrs/stsupport.h +Cocoa/Cocoa.h +CodeFragments.h +comdef.h +commctrl.h +COMMCTRL.H +commdlg.h +compat.h +condapi.h +ConditionalMacros.h +config.h +conio.h +console.h +ControlDefinitions.h +Controls.h +CoreFoundation/CoreFoundation.h +CoreServices/CoreServices.h +CPalmRec.cpp +Cpalmrec.h +CPCatgry.cpp +CPDbBMgr.h +CPString.cpp +CPString.h +crtdbg.h +crt_externs.h +crypt.h +cstdio +cstdlib +cstring +ctime +ctype.h +curl/curl.h +curl/easy.h +curl/types.h +curses.h +cxxabi.h +DateTimeUtils.h +dbus/dbus.h +dbus/dbus-glib.h +dbus/dbus-glib-lowlevel.h +ddeml.h +Debug.h +dem.h +descrip.h +Devices.h +Dialogs.h +direct.h +dirent.h +DiskInit.h +dlfcn.h +dlgs.h +dl.h +docobj.h +dos/dosextens.h +dos.h +Drag.h +DriverServices.h +DriverSynchronization.h +DropInPanel.h +dvidef.h +elf.h +endian.h +Entry.h +errno.h +Errors.h +Events.h +exdisp.h +ExDisp.h +exe386.h +execinfo.h +extras.h +fabdef.h +fcntl.h +features.h +fibdef.h +File.h +filehdr.h +files.h +Files.h +FindDirectory.h +Finder.h +FinderRegistry.h +FixMath.h +float.h +Folders.h +fontconfig/fontconfig.h +fontconfig/fcfreetype.h +Font.h +Fonts.h +fp.h +fpieee.h +frame/log.h +frame/req.h +freetype/freetype.h +freetype/ftcache.h +freetype/ftglyph.h +freetype/ftsynth.h +freetype/ftoutln.h +freetype/ttnameid.h +freetype/tttables.h +freetype/t1tables.h +fribidi/fribidi.h +FSp_fopen.h +fstream.h +ft2build.h +gconf/gconf-client.h +Gdiplus.h +gdk/gdkevents.h +gdk/gdk.h +gdk/gdkkeysyms.h +gdk/gdkpango.h +gdk/gdkprivate.h +gdk/gdkscreen.h +gdk/gdkregion.h +gdk/gdkwindow.h +gdk/gdkx.h +gdk/gdkdirectfb.h +gdk-pixbuf/gdk-pixbuf.h +Gestalt.h +getopt.h +glibconfig.h +glib.h +glib-object.h +gmodule.h +gnome.h +gnu/libc-version.h +grp.h +gssapi_generic.h +gssapi/gssapi_generic.h +gssapi/gssapi.h +gssapi.h +gtk/gtkbindings.h +gtk/gtkbutton.h +gtk/gtkclipboard.h +gtk/gtkcontainer.h +gtk/gtkdialog.h +gtk/gtkentry.h +gtk/gtkfixed.h +gtk/gtk.h +gtk/gtkiconfactory.h +gtk/gtkimage.h +gtk/gtkimmulticontext.h +gtk/gtkinvisible.h +gtk/gtkmain.h +gtk/gtkmessagedialog.h +gtk/gtkobject.h +gtk/gtkprinter.h +gtk/gtkprintjob.h +gtk/gtkprintunixdialog.h +gtk/gtkprivate.h +gtk/gtkselection.h +gtk/gtksignal.h +gtk/gtksocket.h +gtk/gtkstock.h +gtk/gtkstyle.h +gtk/gtktextview.h +gtk/gtkvscrollbar.h +gtk/gtkwidget.h +gtk/gtkwindow.h +gtk/gtkversion.h +HIToolbox/HIToolbox.h +hlink.h +htiface.h +ia64/sys/inline.h +Icons.h +iconv.h +IDL.h +ieeefp.h +ifaddrs.h +image.h +imagehlp.h +imm.h +initguid.h +InterfaceDefs.h +InternetConfig.h +IntlResources.h +ints.h +intshcut.h +inttypes.h +iodef.h +io.h +IOKit/IOKitLib.h +IOKit/IOMessage.h +IOKit/pwr_mgt/IOPMLib.h +iomanip +iostream +iostream.h +jar.h +JavaControl.h +JavaEmbedding/JavaControl.h +JavaVM/jni.h +JManager.h +JNIEnvTests.h +jni.h +#if MOZ_NATIVE_JPEG==1 +jpeglib.h +#endif +JVMManagerTests.h +Kerberos/Kerberos.h +kernel/image.h +kernel/OS.h +key.h +keyt.h +keythi.h +LAction.h +langinfo.h +LApplication.h +LArray.h +LArrayIterator.h +LAttachable.h +LAttachment.h +LaunchServices.h +lber.h +LBroadcaster.h +LButton.h +lcache.h +LCaption.h +LCheckBox.h +LCicnButton.h +LClipboard.h +LCommander.h +LComparator.h +LControl.h +ldap.h +ldaplog.h +ldappr.h +ldap_ssl.h +LDataStream.h +ldfcn.h +LDialogBox.h +ldif.h +LDocApplication.h +LDocument.h +LDragAndDrop.h +LDragTask.h +LEditField.h +LEditText.h +LEventDispatcher.h +LFile.h +LFileStream.h +LFileTypeList.h +LFocusBox.h +LGrafPortView.h +LHandleStream.h +libc_r.h +libelf.h +libelf/libelf.h +libgen.h +libgnome/gnome-url.h +libgnome/libgnome.h +libgnomeui/gnome-icon-lookup.h +libgnomeui/gnome-icon-theme.h +libgnomeui/gnome-ui-init.h +libgnomevfs/gnome-vfs-application-registry.h +libgnomevfs/gnome-vfs-file-info.h +libgnomevfs/gnome-vfs.h +libgnomevfs/gnome-vfs-init.h +libgnomevfs/gnome-vfs-mime.h +libgnomevfs/gnome-vfs-mime-handlers.h +libgnomevfs/gnome-vfs-mime-info.h +libgnomevfs/gnome-vfs-mime-utils.h +libgnomevfs/gnome-vfs-ops.h +libgnomevfs/gnome-vfs-standard-callbacks.h +libIDL/IDL.h +lib$routines.h +limits +limits.h +link.h +linux/kernel.h +linux/limits.h +linux/rtc.h +linux/version.h +list +List.h +Lists.h +LiveConnectManagerTests.h +LListBox.h +LListener.h +LMenuBar.h +LMenu.h +LModelDirector.h +LModelObject.h +LModelProperty.h +loader.h +locale +locale.h +LOffscreenView.h +logkeys.h +logstrng.h +Looper.h +LowMem.h +LPane.h +LPeriodical.h +LPicture.h +LPlaceHolder.h +LPrintout.h +LProgressBar.h +LPushButton.h +LRadioGroup.h +LRadioGroupView.h +LRunArray.h +LScroller.h +LSharable.h +LSingleDoc.h +LStaticText.h +LStdControl.h +LStream.h +LString.h +LTabGroup.h +LTabGroupView.h +LTableArrayStorage.h +LTableMonoGeometry.h +LTableSingleSelector.h +LTableView.h +LTextEditView.h +LTextTableView.h +LUndoer.h +LVariableArray.h +LView.h +LWindow.h +m68881.h +MacErrors.h +MacHeadersCarbon.h +machine/ansi.h +machine/builtins.h +machine/clock.h +machine/endian.h +machine/frame.h +machine/inline.h +machine/limits.h +machine/signal.h +machine/trap.h +mach/mach_host.h +mach/mach_init.h +mach/mach_interface.h +mach/mach_port.h +mach-o/dyld.h +MacLocales.h +MacMemory.h +MacTCP.h +MacTypes.h +MacWindows.h +malloc.h +map +mapicode.h +mapidefs.h +mapiguid.h +mapi.h +mapitags.h +mapiutil.h +mapix.h +Math64.h +math.h +mbstring.h +mem.h +memory +memory.h +Memory.h +MenuBar.h +Menu.h +Menus.h +Message.h +Mime.h +MixedMode.h +mlang.h +mmsystem.h +model.h +Movies.h +mpw/errno.h +mshtmhst.h +mshtml.h +mswsock.h +Multiprocessing.h +mutex.h +Navigation.h +ncompat.h +ncurses.h +netCore.h +netdb.h +net/if.h +netinet/in.h +netinet/in_systm.h +netinet/tcp.h +new +newexe.h +new.h +nl_types.h +NodeInfo.h +nss.h +nssilock.h +objbase.h +objidl.h +Objsafe.h +ojiapitests.h +ole2.h +oleidl.h +OpenTptInternet.h +OpenTransport.h +os2.h +OS.h +osreldate.h +OSUtils.h +Packages.h +Palettes.h +PALM_CMN.H +pango-engine.h +pango-glyph.h +pango-modules.h +pango/pangocairo.h +pango/pangofc-decoder.h +pango/pangofc-font.h +pango/pangofc-fontmap.h +pango/pango-break.h +pango/pango-fontmap.h +pango/pango.h +pango/pangoxft.h +pango/pangox.h +pango/pango-utils.h +pango-types.h +pascal.h +Patches.h +Path.h +pcfs/pc_dir.h +Pgenerr.h +PGenErr.h +Ph.h +photon/Pg.h +photon/PhProto.h +photon/PhRender.h +photon/PpProto.h +photon/PtProgress.h +photon/PtServer.h +photon/PtWebClient.h +photon/PxImage.h +pk11func.h +pk11pub.h +pkcs11t.h +PLStringFuncs.h +PMApplication.h +pmddim.h +poll.h +Polygon.h +portable.h +Power.h +PP_ClassHeaders.cp +PP_Constants.h +PPCToolbox.h +PP_DebugHeaders.cp +PP_KeyCodes.h +PP_Macros.h +PP_Messages.h +PP_Prefix.h +PP_Resources.h +PP_Types.h +Printing.h +Print/PMPrintingDialogExtensions.h +private/qucomextra_p.h +Processes.h +process.h +Process.h +proto/dos.h +proto/exec.h +psap.h +Pt.h +pthread.h +pwd.h +Python.h +QDOffscreen.h +Quickdraw.h +QuickDraw.h +QuickTimeComponents.h +quipu/attr.h +rasdlg.h +raserror.h +ras.h +regex.h +Region.h +resolv.h +Resources.h +Retrace.h +rld_interface.h +rmsdef.h +Roster.h +rpc.h +rpcproxy.h +rpc/types.h +sane/sane.h +sane/sanei.h +sane/saneopts.h +Scrap.h +Screen.h +Script.h +ScrollBar.h +seccomon.h +sec.h +secmod.h +secmodt.h +secrng.h +security.h +secutil.h +semaphore.h +servprov.h +setjmp.h +SFNTLayoutTypes.h +SFNTTypes.h +share.h +shellapi.h +shlguid.h +shlobj.h +sigcontext.h +signal.h +SimpleGameSound.h +SIOUX.h +size_t.h +someincludefile.h +Sound.h +sqlite3.h +ssdef.h +sslerr.h +ssl.h +sslproto.h +sstream +stack +StandardFile.h +starlet.h +stat.h +statreg.cpp +statreg.h +stdarg.h +stdbool.h +stddef.h +stdint.h +stdio.h +stdlib.h +storage/FindDirectory.h +StorageKit.h +string +StringCompare.h +string.h +String.h +strings.h +Strings.h +StringView.h +stropts.h +strstrea.h +structs.h +stsdef.h +SupportDefs.h +support/String.h +support/SupportDefs.h +support/TLS.h +svrcore.h +symconst.h +sym.h +synch.h +syncmgr.h +sys/atomic_op.h +sys/bitypes.h +sys/byteorder.h +syscall.h +sys/cdefs.h +sys/cfgodm.h +sys/elf.h +sys/endian.h +sys/errno.h +sys/fault.h +sys/fcntl.h +sys/file.h +sys/filio.h +sys/frame.h +sys/immu.h +sys/inttypes.h +sys/ioccom.h +sys/ioctl.h +sys/ipc.h +sys/ldr.h +sys/link.h +sys/locking.h +syslog.h +sys/lwp.h +sys/machine.h +sys/mman.h +sys/mmu.h +sys/mount.h +sys/mpctl.h +sys/param.h +sys/pda.h +sys/poll.h +sys/ppc.h +sys/prctl.h +sys/priv.h +sys/procfs.h +sys/pstat.h +sys/ptrace.h +sys/queue.h +sys/reg.h +sys/regset.h +sys/resource.h +sys/sched.h +sys/select.h +sys/sem.h +sys/sendfile.h +sys/shm.h +sys/siginfo.h +sys/signal.h +sys/socket.h +sys/sockio.h +sys/sparc/frame.h +sys/stack.h +sys/statfs.h +sys/stat.h +sys/statvfs.h +sys/syscall.h +sys/sysctl.h +sys/sysinfo.h +sys/sysmp.h +sys/syssgi.h +sys/systeminfo.h +sys/timeb.h +sys/time.h +sys/times.h +sys/ttycom.h +sys/types.h +sys/ucontext.h +sys/uio.h +sys/un.h +sys/unistd.h +sys/utsname.h +sys/vfs.h +sys/wait.h +tables.h +TArray.h +TArrayIterator.h +task.h +tchar.h +TCHAR.H +termios.h +TextCommon.h +TextEdit.h +TextEncodingConverter.h +TextServices.h +TextUtils.h +TextView.h +th/PCR_Th.h +thread.h +ThreadManagerTests.h +Threads.h +time.h +Timer.h +tlhelp32.h +ToolUtils.h +trace.h +Traps.h +typeinfo +types.h +Types.h +UAppleEventsMgr.h +UAttachments.h +ucontext.h +uconv.h +UCursor.h +ucx$inetdef.h +UDebugging.h +UDesktop.h +UDrawingState.h +UDrawingUtils.h +UEnvironment.h +UEventMgr.h +UException.h +UExtractFromAEDesc.h +UGWorld.h +UKeyFilters.h +ulocks.h +ulserrno.h +UMemoryMgr.h +UModalDialogs.h +UNavServicesDialogs.h +UnicodeBlockObjects.h +UnicodeConverter.h +UnicodeUtilities.h +unidef.h +unikbd.h +unistd.h +unix.h +unixio.h +unixlib.h +unknwn.h +UPrinting.h +UQuickTime.h +UReanimator.h +URegions.h +URegistrar.h +UResourceMgr.h +urlhist.h +urlmon.h +UScrap.h +UScreenPort.h +UTCUtils.h +UTETextAction.h +UTEViewTextAction.h +UTextEdit.h +UTextTraits.h +utility +utime.h +UWindows.h +values.h +varargs.h +vcclr.h +vector +View.h +Volume.h +wab.h +wait.h +wchar.h +winbase.h +win/compobj.h +windef.h +Window.h +windows.h +Windows.h +windowsx.h +Wininet.h +winnls.h +winperf.h +winreg.h +Winreg.h +winsock2.h +winsock.h +winspool.h +winsvc.h +winuser.h +winver.h +wmem.h +workbench/startup.h +wtypes.h +wx/image.h +wx/listctrl.h +wx/log.h +wx/toolbar.h +wx/wx.h +wx/xrc/xmlres.h +X11/cursorfont.h +X11/extensions/Print.h +X11/extensions/shape.h +X11/extensions/XIElib.h +X11/extensions/XShm.h +X11/extensions/Xrender.h +X11/Intrinsic.h +X11/keysymdef.h +X11/keysym.h +X11/Shell.h +X11/StringDefs.h +X11/Xatom.h +X11/Xft/Xft.h +X11/Xfuncproto.h +X11/X.h +X11/XKBlib.h +X11/Xlib.h +X11/Xlibint.h +X11/Xlocale.h +X11/Xos.h +X11/Xutil.h +xpt_struct.h +xpt_xdr.h +zmouse.h +sslt.h +smime.h +cms.h +sechash.h +secoidt.h +certdb.h +secerr.h +nssb64.h +secasn1.h +secder.h +certt.h +ocsp.h +keyhi.h +cryptohi.h +crmf.h +pk11pqg.h +cmmf.h +base64.h +secdert.h +secitem.h +secmime.h +nssckbi.h +pkcs12.h +p12plcy.h +pk11sdr.h +nspr.h +pratom.h +prbit.h +prclist.h +prcmon.h +prcountr.h +prcvar.h +prdtoa.h +prenv.h +prerr.h +prerror.h +prinet.h +prinit.h +prinrval.h +prio.h +pripcsem.h +prlink.h +prlock.h +prlog.h +prlong.h +prmem.h +prmon.h +prmwait.h +prnetdb.h +prolock.h +prpdce.h +prprf.h +prproces.h +prrng.h +prrwlock.h +prshm.h +prshma.h +prsystem.h +prthread.h +prtime.h +prtpool.h +prtrace.h +prtypes.h +prvrsion.h +plbase64.h +plerror.h +plgetopt.h +plresolv.h +plstr.h +plarenas.h +plarena.h +plhash.h +#if MOZ_NATIVE_PNG==1 +png.h +#endif +#if MOZ_NATIVE_ZLIB==1 +zlib.h +#endif +#if MOZ_ENABLE_LIBXUL!=1 +#if BUILD_STATIC_LIBS!=1 +#define WRAP_LCMS_HEADERS +#endif +#endif +#if MOZ_NATIVE_LCMS==1 +#define WRAP_LCMS_HEADERS +#endif +#ifdef WRAP_LCMS_HEADERS +icc34.h +lcms.h +#endif +#ifdef MOZ_ENABLE_STARTUP_NOTIFICATION +libsn/sn.h +libsn/sn-common.h +libsn/sn-launchee.h +libsn/sn-launcher.h +libsn/sn-monitor.h +libsn/sn-util.h +#endif +#if MOZ_NATIVE_HUNSPELL==1 +hunspell.hxx +#endif +#if MOZ_NATIVE_BZ2==1 +bzlib.h +#endif diff --git a/js/src/config/SunOS5.4.mk b/js/src/config/version.mk similarity index 52% rename from js/src/config/SunOS5.4.mk rename to js/src/config/version.mk index de019247a2d7..3993b3f9ec76 100644 --- a/js/src/config/SunOS5.4.mk +++ b/js/src/config/version.mk @@ -1,5 +1,3 @@ -# -*- Mode: makefile -*- -# # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # @@ -13,12 +11,10 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. +# The Original Code is the Win32 Version System. # -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 +# The Initial Developer of the Original Code is Netscape Communications Corporation +# Portions created by the Initial Developer are Copyright (C) 2002 # the Initial Developer. All Rights Reserved. # # Contributor(s): @@ -37,56 +33,53 @@ # # ***** END LICENSE BLOCK ***** -# -# Config stuff for SunOS5.4 -# +ifndef INCLUDED_VERSION_MK +INCLUDED_VERSION_MK=1 -ifdef NS_USE_NATIVE -CC = cc -CCC = CC +# Windows gmake build: +# Build default .rc file if $(RESFILE) isn't defined. +# TODO: +# PBI : Private build info. Not used currently. +# Guessing the best way would be to set an env var. +# BINARY : Binary name. Not used currently. +ifeq ($(MOZ_WIDGET_TOOLKIT),windows) +ifndef RESFILE +RCFILE=./module.rc +RESFILE=./module.res +_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(topsrcdir) -BITS $(MOZ_BITS) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) +ifneq ($(BUILD_OFFICIAL)_$(MOZILLA_OFFICIAL),_) +_RC_STRING += -OFFICIAL 1 +endif +ifdef MOZ_DEBUG +_RC_STRING += -DEBUG 1 +endif +ifdef MODULE +_RC_STRING += -MODNAME $(MODULE) +endif +ifdef PROGRAM +_RC_STRING += -BINARY $(PROGRAM) else -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format -endif - -RANLIB = echo - -CPU_ARCH = sparc -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D__svr4 -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl - -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 - -HAVE_PURIFY = 1 - -NOSUCHFILE = /solaris-rm-f-sucks - -ifndef JS_NO_ULTRA -ULTRA_OPTIONS := -xarch=v8plus -ULTRA_OPTIONSD := -DULTRA_SPARC +ifdef _PROGRAM +_RC_STRING += -BINARY $(_PROGRAM) else -ULTRA_OPTIONS := -xarch=v8 -ULTRA_OPTIONSD := +ifdef SHARED_LIBRARY +_RC_STRING += -BINARY $(SHARED_LIBRARY) +endif +endif +endif +ifdef RCINCLUDE +_RC_STRING += -RCINCLUDE $(srcdir)/$(RCINCLUDE) endif -ifeq ($(OS_CPUARCH),sun4u) -DEFINES += $(ULTRA_OPTIONSD) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD) -else -ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD) -endif -endif +GARBAGE += $(RESFILE) $(RCFILE) -ifeq ($(OS_CPUARCH),sun4m) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,-xarch=v8 -else -ASFLAGS += -xarch=v8 -endif -endif +#dummy target so $(RCFILE) doesn't become the default =P +all:: -MKSHLIB = $(LD) -G +$(RCFILE): $(RCINCLUDE) $(topsrcdir)/config/version_win.pl + $(PERL) $(topsrcdir)/config/version_win.pl $(_RC_STRING) + +endif # RESFILE +endif # Windows + +endif diff --git a/js/src/config/version_win.pl b/js/src/config/version_win.pl new file mode 100644 index 000000000000..094530e1b20f --- /dev/null +++ b/js/src/config/version_win.pl @@ -0,0 +1,423 @@ +#!/usr/bin/perl -w + +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Win32 Version System. +# +# The Initial Developer of the Original Code is Brian Bober +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +#use diagnostics; +require strict; +my $dir = $0; +$dir =~ s/[^\/]*$//; +push(@INC, "$dir"); +require "Moz/Milestone.pm"; +use Getopt::Long; +use Getopt::Std; +use POSIX; + +# Calculate the number of days since Jan. 1, 2000 from a buildid string +sub daysFromBuildID +{ + my ($buildid,) = @_; + + my ($y, $m, $d, $h) = ($buildid =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/); + $d || die("Unrecognized buildid string."); + + my $secondstodays = 60 * 60 * 24; + return (POSIX::mktime(00, 00, 00, $d, $m, $y - 1900) - + POSIX::mktime(00, 00, 00, 01, 01, 100)) / $secondstodays; +} + +#Creates version resource file + +#Paramaters are passed on the command line: + +#Example: -MODNAME nsToolkitCompsModule -DEBUG=1 + +# DEBUG - Mozilla's global debug variable - tells if its debug version +# OFFICIAL - tells Mozilla is building a milestone or nightly +# MSTONE - tells which milestone is being built; +# OBJDIR - Holds the object directory; +# MODNAME - tells what the name of the module is like nsBMPModule +# DEPTH - Holds the path to the root obj dir +# TOPSRCDIR - Holds the path to the root mozilla dir +# SRCDIR - Holds module.ver and source +# BINARY - Holds the name of the binary file +# DISPNAME - Holds the display name of the built application +# BITS - 16 or 32 bit +# RCINCLUDE - Holds the name of the RC File to include or "" +# QUIET - Turns off output + +#Description and Comment come from module.ver +#Bug 23560 +#http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/rc_7x2d.asp + +#Get next .ver file entry +sub getNextEntry +{ + while () + { + my $mline = $_; + ($mline) = split(/#/,$mline); + my ($entry, $value)=split(/=/,$mline,2); + if (defined($entry)) + { + if (defined($value)) + { + $entry =~ s/^\s*(.*?)\s*$/$1/; + $value =~ s/^\s*(.*?)\s*$/$1/; + return ($entry,$value); + } + } + } + return undef; +} + +my ($quiet,$objdir,$debug,$official,$milestone,$buildid,$module,$binary,$depth,$rcinclude,$bits,$srcdir,$fileversion,$productversion); + +GetOptions( "QUIET" => \$quiet, + "DEBUG=s" => \$debug, + "OFFICIAL=s" => \$official, + "MSTONE=s" => \$milestone, + "MODNAME=s" => \$module, + "BINARY=s" => \$binary, + "DISPNAME=s" => \$displayname, + "SRCDIR=s" => \$srcdir, + "TOPSRCDIR=s" => \$topsrcdir, + "DEPTH=s" => \$depth, + "RCINCLUDE=s" => \$rcinclude, + "OBJDIR=s" => \$objdir, + "BITS=s" => \$bits); +if (!defined($debug)) {$debug="";} +if (!defined($official)) {$official="";} +if (!defined($milestone)) {$milestone="";} +if (!defined($module)) {$module="";} +if (!defined($binary)) {$binary="";} +if (!defined($displayname)) {$displayname="Mozilla";} +if (!defined($depth)) {$depth=".";} +if (!defined($rcinclude)) {$rcinclude="";} +if (!defined($objdir)) {$objdir=".";} +if (!defined($srcdir)) {$srcdir=".";} +if (!defined($topsrcdir)) {$topsrcdir=".";} +if (!defined($bits)) {$bits="";} +my $mfversion = "Personal"; +my $mpversion = "Personal"; +my @fileflags = ("0"); +my $comment=""; +my $description=""; +if (!defined($module)) +{ + $module = $binary; + ($module) = split(/\./,$module); +} + +my $fileos = "VOS__WINDOWS32"; +if ($bits eq "16") { $fileos="VOS__WINDOWS16"; } + +my $bufferstr=" "; + +my $MILESTONE_FILE = "$topsrcdir/config/milestone.txt"; +my $BUILDID_FILE = "$depth/config/buildid"; + +#Read module.ver file +#Version file overrides for WIN32: +#WIN32_MODULE_COMMENT +#WIN32_MODULE_DESCRIPTION +#WIN32_MODULE_FILEVERSION +#WIN32_MODULE_COMPANYNAME +#WIN32_MODULE_FILEVERSION_STRING +#WIN32_MODULE_NAME +#WIN32_MODULE_COPYRIGHT +#WIN32_MODULE_TRADEMARKS +#WIN32_MODULE_ORIGINAL_FILENAME +#WIN32_MODULE_PRODUCTNAME +#WIN32_MODULE_PRODUCTVERSION +#WIN32_MODULE_PRODUCTVERSION_STRING + +#Override values obtained from the .ver file +my $override_comment; +my $override_description; +my $override_fileversion; +my $override_company; +my $override_mfversion; +my $override_module; +my $override_copyright; +my $override_trademarks; +my $override_filename; +my $override_productname; +my $override_productversion; +my $override_mpversion; +if (open(VERFILE, "<$srcdir/module.ver")) +{ + + my ($a,$b) = getNextEntry(); + while (defined($a)) + { + if ($a eq "WIN32_MODULE_COMMENT") { $override_comment = $b; } + if ($a eq "WIN32_MODULE_DESCRIPTION") { $override_description = $b; } + if ($a eq "WIN32_MODULE_FILEVERSION") { $override_fileversion = $b; } + if ($a eq "WIN32_MODULE_COMPANYNAME") { $override_company = $b; } + if ($a eq "WIN32_MODULE_FILEVERSION_STRING") { $override_mfversion = $b; } + if ($a eq "WIN32_MODULE_NAME") { $override_module = $b; } + if ($a eq "WIN32_MODULE_COPYRIGHT") { $override_copyright = $b; } + if ($a eq "WIN32_MODULE_TRADEMARKS") { $override_trademarks = $b; } + if ($a eq "WIN32_MODULE_ORIGINAL_FILENAME") { $override_filename = $b; } + if ($a eq "WIN32_MODULE_PRODUCTNAME") { $override_productname = $b; } + if ($a eq "WIN32_MODULE_PRODUCTVERSION") { $override_productversion = $b; } + if ($a eq "WIN32_MODULE_PRODUCTVERSION_STRING") { $override_mpversion = $b; } + ($a,$b) = getNextEntry(); + } + close(VERFILE) +} +else +{ + if (!$quiet || $quiet ne "1") { print "$bufferstr" . "WARNING: No module.ver file included ($module, $binary). Default values used\n"; } +} +#Get rid of trailing and leading whitespace +$debug =~ s/^\s*(.*)\s*$/$1/; +$comment =~ s/^\s*(.*)\s*$/$1/; +$official =~ s/^\s*(.*)\s*$/$1/; +$milestone =~ s/^\s*(.*)\s*$/$1/; +$description =~ s/^\s*(.*)\s*$/$1/; +$module =~ s/^\s*(.*)\s*$/$1/; +$depth =~ s/^\s*(.*)\s*$/$1/; +$binary =~ s/^\s*(.*)\s*$/$1/; +$displayname =~ s/^\s*(.*)\s*$/$1/; + +open(BUILDID, "<", $BUILDID_FILE) || die("Couldn't open buildid file: $BUILDID_FILE"); +$buildid = ; +$buildid =~ s/\s*$//; +close BUILDID; + +my $daycount = daysFromBuildID($buildid); + +if ($milestone eq "") { + $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE); +} + +$mfversion = $mpversion = $milestone; + +if ($debug eq "1") +{ + push @fileflags, "VS_FF_DEBUG"; + $mpversion .= " Debug"; + $mfversion .= " Debug"; +} + +if ($official ne "1") { + push @fileflags, "VS_FF_PRIVATEBUILD"; +} + +if ($milestone =~ /[a-z]/) { + push @fileflags, "VS_FF_PRERELEASE"; +} + +my @mstone = split(/\./,$milestone); +$mstone[1] =~s/\D.*$//; +if (!$mstone[2]) { + $mstone[2] = "0"; +} +else { + $mstone[2] =~s/\D.*$//; +} +$fileversion = $productversion="$mstone[0],$mstone[1],$mstone[2],$daycount"; + +my $copyright = "License: MPL 1.1/GPL 2.0/LGPL 2.1"; +my $company = "Mozilla Foundation"; +my $trademarks = "Mozilla"; +my $productname = $displayname; + + +if (defined($override_comment)){$override_comment =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $comment=$override_comment;} +if (defined($override_description)){$override_description =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $description=$override_description;} +if (defined($override_fileversion)){$fileversion=$override_fileversion;} +if (defined($override_mfversion)){$mfversion=$override_mfversion;} +if (defined($override_company)){$company=$override_company;} +if (defined($override_module)){$override_module =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $module=$override_module;} +if (defined($override_copyright)){$override_copyright =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $copyright=$override_copyright;} +if (defined($override_trademarks)){$override_trademarks =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $trademarks=$override_trademarks;} +if (defined($override_filename)){$binary=$override_filename;} +if (defined($override_productname)){$override_productname =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $productname=$override_productname;} +if (defined($override_productversion)){$productversion=$override_productversion;} +if (defined($override_mpversion)){$mpversion=$override_mpversion;} + + +#Override section + +open(RCFILE, ">$objdir/module.rc") || die("Can't edit module.rc - It must be locked.\n"); +print RCFILE qq{ +// ***** BEGIN LICENSE BLOCK ***** +// Version: MPL 1.1/GPL 2.0/LGPL 2.1 +// +// The contents of this file are subject to the Mozilla Public License Version +// 1.1 (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the +// License. +// +// The Original Code is the Win32 Version System. +// +// The Initial Developer of the Original Code is Brian Bober +// Portions created by the Initial Developer are Copyright (C) 2001 +// the Initial Developer. All Rights Reserved. +// +// Contributor(s): +// +// Alternatively, the contents of this file may be used under the terms of +// either the GNU General Public License Version 2 or later (the "GPL"), or +// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +// in which case the provisions of the GPL or the LGPL are applicable instead +// of those above. If you wish to allow use of your version of this file only +// under the terms of either the GPL or the LGPL, and not to allow others to +// use your version of this file under the terms of the MPL, indicate your +// decision by deleting the provisions above and replace them with the notice +// and other provisions required by the GPL or the LGPL. If you do not delete +// the provisions above, a recipient may use your version of this file under +// the terms of any one of the MPL, the GPL or the LGPL. +// +// ***** END LICENSE BLOCK ***** + +#include + +// Note: if you contain versioning information in an included +// RC script, it will be discarded +// Use module.ver to explicitly set these values + +// Do not edit this file. Changes won't affect the build. + +}; + +my $versionlevel=0; +my $insideversion=0; +if (open(RCINCLUDE, "<$rcinclude")) +{ + print RCFILE "// From included resource $rcinclude\n"; +# my $mstring=""; + while () + { + $_ =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; + print RCFILE $_; +# my $instr=$_; +# chomp($instr); +# $mstring .= "$instr\;"; + } + close(RCINCLUDE); +# $mstring =~ s/\/\*.*\*\///g; +# my @mlines = split(/\;/,$mstring); +# for(@mlines) +# { +# my ($nocomment)=split(/\/\//,$_); +# if (defined($nocomment) && $nocomment ne "") +# { +# my ($firststring,$secondstring) = split(/\s+/,$nocomment); +# if (!defined($firststring)) {$firststring="";} +# if (!defined($secondstring)) {$secondstring="";} +# if ($secondstring eq "VERSIONINFO") +# { +#if (!$quiet || $quiet ne "1") { +# print "$bufferstr" . "WARNING: Included RC file ($rcinclude, $module, $binary)\n"; +# print "$bufferstr" . "WARNING: contains versioning information that will be discarded\n"; +# print "$bufferstr" . "WARNING: Remove it and use relevant overrides (in module.ver)\n"; +#} +# $versionlevel = 0; +# $insideversion = 1; +# } +# if ($firststring eq "BEGIN") { $versionlevel++; } +# if ($secondstring eq "END") +# { +# $versionlevel--; +# if ($insideversion==1 && $versionlevel==0) {$versionlevel=0;} +# } +# my $includecheck = $firststring . $secondstring; +# $includecheck =~ s/<|>/"/g; +# $includecheck = lc($includecheck); +# if ($includecheck ne "#include\"winver.h\"") +# { +# if ($insideversion == 0 && $versionlevel == 0) +# { +# print RCFILE "$nocomment\n"; +# } +# } +# } +# } + +} + +my $fileflags = join(' | ', @fileflags); + +print RCFILE qq{ + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION $fileversion + PRODUCTVERSION $productversion + FILEFLAGSMASK 0x3fL + FILEFLAGS $fileflags + FILEOS $fileos + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", "$comment" + VALUE "LegalCopyright", "$copyright" + VALUE "CompanyName", "$company" + VALUE "FileDescription", "$description" + VALUE "FileVersion", "$mfversion" + VALUE "ProductVersion", "$mpversion" + VALUE "InternalName", "$module" + VALUE "LegalTrademarks", "$trademarks" + VALUE "OriginalFilename", "$binary" + VALUE "ProductName", "$productname" + VALUE "BuildID", "$buildid" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + +}; +close(RCFILE); diff --git a/js/src/configure.in b/js/src/configure.in new file mode 100644 index 000000000000..6fb426eeb27f --- /dev/null +++ b/js/src/configure.in @@ -0,0 +1,5225 @@ +dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*- +dnl vi: set tabstop=4 shiftwidth=4 expandtab: +dnl ***** BEGIN LICENSE BLOCK ***** +dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1 +dnl +dnl The contents of this file are subject to the Mozilla Public License Version +dnl 1.1 (the "License"); you may not use this file except in compliance with +dnl the License. You may obtain a copy of the License at +dnl http://www.mozilla.org/MPL/ +dnl +dnl Software distributed under the License is distributed on an "AS IS" basis, +dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +dnl for the specific language governing rights and limitations under the +dnl License. +dnl +dnl The Original Code is this file as it was released upon August 6, 1998. +dnl +dnl The Initial Developer of the Original Code is +dnl Christopher Seawood. +dnl Portions created by the Initial Developer are Copyright (C) 1998-2001 +dnl the Initial Developer. All Rights Reserved. +dnl +dnl Contributor(s): +dnl Jamie Zawinski +dnl gettimeofday args check +dnl Christopher Blizzard +dnl gnomefe update & enable-pthreads +dnl Ramiro Estrugo +dnl X11 makedepend support +dnl Insure support. +dnl Henry Sobotka +dnl OS/2 support +dnl Dan Mosedale +dnl LDAP support +dnl Seth Spitzer +dnl xpctools support +dnl Benjamin Smedberg +dnl Howard Chu +dnl MSYS support +dnl Mark Mentovai : +dnl Mac OS X 10.4 support +dnl Giorgio Maone +dnl MSVC l10n compatible version check +dnl Ben Turner +dnl +dnl Alternatively, the contents of this file may be used under the terms of +dnl either the GNU General Public License Version 2 or later (the "GPL"), or +dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +dnl in which case the provisions of the GPL or the LGPL are applicable instead +dnl of those above. If you wish to allow use of your version of this file only +dnl under the terms of either the GPL or the LGPL, and not to allow others to +dnl use your version of this file under the terms of the MPL, indicate your +dnl decision by deleting the provisions above and replace them with the notice +dnl and other provisions required by the GPL or the LGPL. If you do not delete +dnl the provisions above, a recipient may use your version of this file under +dnl the terms of any one of the MPL, the GPL or the LGPL. +dnl +dnl ***** END LICENSE BLOCK ***** + +dnl Process this file with autoconf to produce a configure script. +dnl ======================================================== + +AC_PREREQ(2.13) +AC_INIT(jsapi.h) +AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf) +AC_CONFIG_HEADER(js-config.h) +AC_CANONICAL_SYSTEM +TARGET_CPU="${target_cpu}" +TARGET_VENDOR="${target_vendor}" +TARGET_OS="${target_os}" + +dnl ======================================================== +dnl = +dnl = Don't change the following two lines. Doing so breaks: +dnl = +dnl = CFLAGS="-foo" ./configure +dnl = +dnl ======================================================== +CFLAGS="${CFLAGS=}" +CPPFLAGS="${CPPFLAGS=}" +CXXFLAGS="${CXXFLAGS=}" +LDFLAGS="${LDFLAGS=}" +HOST_CFLAGS="${HOST_CFLAGS=}" +HOST_CXXFLAGS="${HOST_CXXFLAGS=}" +HOST_LDFLAGS="${HOST_LDFLAGS=}" + +dnl ======================================================== +dnl = Preserve certain environment flags passed to configure +dnl = We want sub projects to receive the same flags +dnl = untainted by this configure script +dnl ======================================================== +_SUBDIR_CC="$CC" +_SUBDIR_CXX="$CXX" +_SUBDIR_CFLAGS="$CFLAGS" +_SUBDIR_CPPFLAGS="$CPPFLAGS" +_SUBDIR_CXXFLAGS="$CXXFLAGS" +_SUBDIR_LDFLAGS="$LDFLAGS" +_SUBDIR_HOST_CC="$HOST_CC" +_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS" +_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS" +_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS" +_SUBDIR_CONFIG_ARGS="$ac_configure_args" + +dnl Set the version number of the libs included with mozilla +dnl ======================================================== +NSPR_VERSION=4 + +dnl Set the minimum version of toolkit libs used by mozilla +dnl ======================================================== +GLIB_VERSION=1.2.0 +PERL_VERSION=5.006 +MAKE_VERSION=3.78 +WINDRES_VERSION=2.14.90 +W32API_VERSION=3.8 + +MSMANIFEST_TOOL= + +dnl Set various checks +dnl ======================================================== +MISSING_X= +AC_PROG_AWK + +dnl Initialize the Pthread test variables early so they can be +dnl overridden by each platform. +dnl ======================================================== +USE_PTHREADS= +_PTHREAD_LDFLAGS="" + +dnl Do not allow a separate objdir build if a srcdir build exists. +dnl ============================================================== +_topsrcdir=`cd \`dirname $0\`; pwd` +_objdir=`pwd` + +if test "$_topsrcdir" != "$_objdir" +then + # Check for a couple representative files in the source tree + _conflict_files= + for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do + if test -f $file; then + _conflict_files="$_conflict_files $file" + fi + done + if test "$_conflict_files"; then + echo "***" + echo "* Your source tree contains these files:" + for file in $_conflict_files; do + echo "* $file" + done + cat 1>&2 <<-EOF + * This indicates that you previously built in the source tree. + * A source tree build can confuse the separate objdir build. + * + * To clean up the source tree: + * 1. cd $_topsrcdir + * 2. gmake distclean + *** + EOF + exit 1 + break + fi +fi +MOZ_BUILD_ROOT=`pwd` + +dnl Default to MSVC for win32 +dnl ============================================================== +if test -z "$CROSS_COMPILE"; then +case "$target" in +*-cygwin*|*-mingw*|*-msvc*|*-mks*) + MAKE_VERSION=3.79 + if test -z "$CC"; then CC=cl; fi + if test -z "$CXX"; then CXX=cl; fi + if test -z "$CPP"; then CPP="cl -E -nologo"; fi + if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi + if test -z "$LD"; then LD=link; fi + if test -z "$AS"; then AS=ml; fi + if test -z "$MIDL"; then MIDL=midl; fi + ;; +esac +fi + +COMPILE_ENVIRONMENT=1 +MOZ_ARG_ENABLE_BOOL(compile-environment, +[ --disable-compile-environment + Disable compiler/library checks.], + COMPILE_ENVIRONMENT=1, + COMPILE_ENVIRONMENT= ) + +dnl ======================================================== +dnl Checks for compilers. +dnl ======================================================== +dnl Set CROSS_COMPILE in the environment when running configure +dnl to use the cross-compile setup for now +dnl ======================================================== + +if test "$COMPILE_ENVIRONMENT"; then + +dnl Do some special WinCE toolchain stuff +case "$target" in +*wince) + echo ----------------------------------------------------------------------------- + echo Building Windows CE Shunt Library and Tool Chain + echo ----------------------------------------------------------------------------- + + ac_exeext=.exe + + echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h + echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h + make -C $srcdir/build/wince/tools + echo ----------------------------------------------------------------------------- + ;; +esac + +if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then + echo "cross compiling from $host to $target" + cross_compiling=yes + + _SAVE_CC="$CC" + _SAVE_CFLAGS="$CFLAGS" + _SAVE_LDFLAGS="$LDFLAGS" + + AC_MSG_CHECKING([for host c compiler]) + AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "") + if test -z "$HOST_CC"; then + AC_MSG_ERROR([no acceptable c compiler found in \$PATH]) + fi + AC_MSG_RESULT([$HOST_CC]) + AC_MSG_CHECKING([for host c++ compiler]) + AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "") + if test -z "$HOST_CXX"; then + AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH]) + fi + AC_MSG_RESULT([$HOST_CXX]) + + if test -z "$HOST_CFLAGS"; then + HOST_CFLAGS="$CFLAGS" + fi + if test -z "$HOST_CXXFLAGS"; then + HOST_CXXFLAGS="$CXXFLAGS" + fi + if test -z "$HOST_LDFLAGS"; then + HOST_LDFLAGS="$LDFLAGS" + fi + AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :) + AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :) + CC="$HOST_CC" + CFLAGS="$HOST_CFLAGS" + LDFLAGS="$HOST_LDFLAGS" + + AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works]) + AC_TRY_COMPILE([], [return(0);], + [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])], + AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) ) + + CC="$HOST_CXX" + CFLAGS="$HOST_CXXFLAGS" + + AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works]) + AC_TRY_COMPILE([], [return(0);], + [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])], + AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) ) + + CC=$_SAVE_CC + CFLAGS=$_SAVE_CFLAGS + LDFLAGS=$_SAVE_LDFLAGS + + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + dnl The Darwin cross compiler doesn't necessarily point itself at a + dnl root that has libraries for the proper architecture, it defaults + dnl to the system root. The libraries in the system root on current + dnl versions of PPC OS X 10.4 aren't fat, so these target compiler + dnl checks will fail. Fake a working SDK in that case. + _SAVE_CFLAGS=$CFLAGS + _SAVE_CXXFLAGS=$CXXLAGS + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS" + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS" + ;; + esac + + AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :) + unset ac_cv_prog_CC + AC_PROG_CC + AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :) + unset ac_cv_prog_CXX + AC_PROG_CXX + + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + dnl Revert the changes made above. From this point on, the target + dnl compiler will never be used without applying the SDK to CFLAGS + dnl (see --with-macos-sdk below). + CFLAGS=$_SAVE_CFLAGS + CXXFLAGS=$_SAVE_CXXFLAGS + ;; + esac + + AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :) + AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :) + AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :) + AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :) + AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :) + AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :) + AC_DEFINE(CROSS_COMPILE) +else + AC_PROG_CC + AC_PROG_CXX + AC_PROG_RANLIB + AC_PATH_PROGS(AS, $AS as, $CC) + AC_CHECK_PROGS(AR, ar, :) + AC_CHECK_PROGS(LD, ld, :) + AC_CHECK_PROGS(STRIP, strip, :) + AC_CHECK_PROGS(WINDRES, windres, :) + if test -z "$HOST_CC"; then + HOST_CC="$CC" + fi + if test -z "$HOST_CFLAGS"; then + HOST_CFLAGS="$CFLAGS" + fi + if test -z "$HOST_CXX"; then + HOST_CXX="$CXX" + fi + if test -z "$HOST_CXXFLAGS"; then + HOST_CXXFLAGS="$CXXFLAGS" + fi + if test -z "$HOST_LDFLAGS"; then + HOST_LDFLAGS="$LDFLAGS" + fi + if test -z "$HOST_RANLIB"; then + HOST_RANLIB="$RANLIB" + fi + if test -z "$HOST_AR"; then + HOST_AR="$AR" + fi +fi + +GNU_AS= +GNU_LD= +GNU_CC= +GNU_CXX= +CC_VERSION='N/A' +CXX_VERSION='N/A' +if test "$GCC" = "yes"; then + GNU_CC=1 + CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'` +fi +if test "$GXX" = "yes"; then + GNU_CXX=1 + CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'` +fi +if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then + GNU_AS=1 +fi +if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then + GNU_LD=1 +fi +if test "$GNU_CC"; then + if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then + GCC_USE_GNU_LD=1 + fi +fi + +INTEL_CC= +INTEL_CXX= +if test "$GCC" = yes; then + if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then + INTEL_CC=1 + fi +fi + +if test "$GXX" = yes; then + if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then + INTEL_CXX=1 + fi +fi + +dnl Special win32 checks +dnl ======================================================== +case "$target" in +*-wince) + WINVER=500 + ;; +*) + if test -n "$GNU_CC"; then + WINVER=501 + else + WINVER=500 + fi + ;; +esac + +MOZ_ARG_WITH_STRING(windows-version, +[ --with-windows-version=WINVER + Minimum Windows version (WINVER) to support + 400: Windows 95 + 500: Windows 2000 + 501: Windows XP], + WINVER=$withval) + +case "$WINVER" in +400|500|501) + ;; + +*) + AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]); + ;; + +esac + +case "$target" in +*-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince) + if test "$GCC" != "yes"; then + # Check to see if we are really running in a msvc environemnt + _WIN32_MSVC=1 + AC_CHECK_PROGS(MIDL, midl) + + # Make sure compilers are valid + CFLAGS="$CFLAGS -TC -nologo" + CXXFLAGS="$CXXFLAGS -TP -nologo" + AC_LANG_SAVE + AC_LANG_C + AC_TRY_COMPILE([#include ], + [ printf("Hello World\n"); ],, + AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) ) + + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([#include ], + [ unsigned *test = new unsigned(42); ],, + AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) ) + AC_LANG_RESTORE + + changequote(,) + _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p' + changequote([,]) + + # Determine compiler version + CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'` + _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'` + _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'` + _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'` + _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION} + + CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'` + + if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then + AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.]) + fi + if test "$_CC_MAJOR_VERSION" = "12"; then + _CC_SUITE=6 + elif test "$_CC_MAJOR_VERSION" = "13"; then + _CC_SUITE=7 + elif test "$_CC_MAJOR_VERSION" = "14"; then + _CC_SUITE=8 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" + dnl -DYNAMICBASE is only supported on VC8SP1 or newer, + dnl so be very specific here! + dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762 + if test $_CC_RELEASE -gt 50727; then + _USE_DYNAMICBASE=1 + elif test $_CC_BUILD -ge 762; then + _USE_DYNAMICBASE=1 + fi + AC_DEFINE(_CRT_SECURE_NO_DEPRECATE) + AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE) + elif test "$_CC_MAJOR_VERSION" = "15"; then + _CC_SUITE=9 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" + LDFLAGS="$LDFLAGS -MANIFESTUAC:NO" + _USE_DYNAMICBASE=1 + AC_DEFINE(_CRT_SECURE_NO_WARNINGS) + AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS) + else + AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.]) + fi + + _MOZ_RTTI_FLAGS_ON='-GR' + _MOZ_RTTI_FLAGS_OFF='-GR-' + _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc' + _MOZ_EXCEPTIONS_FLAGS_OFF='' + + if test -n "$WIN32_REDIST_DIR"; then + WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd` + fi + + # bug #249782 + # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else) + if test "$_CC_SUITE" -ge "8"; then + changequote(,) + _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p' + changequote([,]) + + MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'` + if test -n "$MSMT_TOOL"; then + MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"` + if test -z "$MSMANIFEST_TOOL_VERSION"; then + AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.]) + fi + MSMANIFEST_TOOL=1 + unset MSMT_TOOL + else + AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.]) + fi + fi + + # Check linker version + _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'` + if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then + AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.]) + fi + INCREMENTAL_LINKER=1 + + # Check midl version + _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'` + _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'` + _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'` + # Add flags if necessary + AC_MSG_CHECKING([for midl flags]) + if test \( "$_MIDL_MAJOR_VERSION" -gt "6" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" -gt "0" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" -gt "359" \); then + # Starting with MIDL version 6.0.359, the MIDL compiler + # generates /Oicf /robust stubs by default, which is not + # compatible with versions of Windows older than Win2k. + # This switches us back to the old behaviour. When we drop + # support for Windows older than Win2k, we should remove + # this. + MIDL_FLAGS="${MIDL_FLAGS} -no_robust" + AC_MSG_RESULT([need -no_robust]) + else + MIDL_FLAGS="${MIDL_FLAGS}" + AC_MSG_RESULT([none needed]) + fi + + unset _MSVC_VER_FILTER + + else + # Check w32api version + _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'` + _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'` + AC_MSG_CHECKING([for w32api version >= $W32API_VERSION]) + AC_TRY_COMPILE([#include ], + #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \ + (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \ + __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION) + #error "test failed." + #endif + , [ res=yes ], [ res=no ]) + AC_MSG_RESULT([$res]) + if test "$res" != "yes"; then + AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.]) + fi + # Check windres version + AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION]) + _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'` + AC_MSG_RESULT([$_WINDRES_VERSION]) + _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'` + _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'` + _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'` + WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'` + WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'` + WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'` + if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \ + "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \ + "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \ + "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \ + "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \ + "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION" + then + AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.]) + fi + fi # !GNU_CC + + AC_DEFINE_UNQUOTED(WINVER,0x$WINVER) + AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER) + # Require OS features provided by IE 5.0 + AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500) + ;; +esac + +dnl Test breaks icc on OS/2 && MSVC +if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then + AC_PROG_CC_C_O + if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then + USING_HCC=1 + _OLDCC=$CC + _OLDCXX=$CXX + CC="${srcdir}/build/hcc '$CC'" + CXX="${srcdir}/build/hcpp '$CXX'" + fi +fi + +AC_PROG_CPP +AC_PROG_CXXCPP + +if test -n "$_WIN32_MSVC"; then + SKIP_PATH_CHECKS=1 + SKIP_COMPILER_CHECKS=1 + SKIP_LIBRARY_CHECKS=1 +fi + +fi # COMPILE_ENVIRONMENT + +AC_SUBST(MIDL_FLAGS) +AC_SUBST(_MSC_VER) + +AC_SUBST(GNU_AS) +AC_SUBST(GNU_LD) +AC_SUBST(GNU_CC) +AC_SUBST(GNU_CXX) +AC_SUBST(INTEL_CC) +AC_SUBST(INTEL_CXX) + +dnl ======================================================== +dnl Checks for programs. +dnl ======================================================== +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PATH_PROGS(PERL, $PERL perl5 perl ) +if test -z "$PERL" || test "$PERL" = ":"; then + AC_MSG_ERROR([perl not found in \$PATH]) +fi + +if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then +AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION]) +_perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5` +_perl_res=$? +AC_MSG_RESULT([$_perl_version]) + +if test "$_perl_res" != 0; then + AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.]) +fi +fi + +AC_MSG_CHECKING([for full perl installation]) +_perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5` +_perl_res=$? +if test "$_perl_res" != 0; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.]) +else + AC_MSG_RESULT([yes]) +fi + +AC_PATH_PROGS(PYTHON, $PYTHON python) +if test -z "$PYTHON"; then + AC_MSG_ERROR([python was not found in \$PATH]) +fi +echo PYTHON="$PYTHON" + +AC_PATH_PROGS(NSINSTALL_BIN, nsinstall ) +if test -z "$COMPILE_ENVIRONMENT"; then +if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then + NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py' +fi +fi +AC_SUBST(NSINSTALL_BIN) + +AC_PATH_PROG(DOXYGEN, doxygen, :) +AC_PATH_PROG(WHOAMI, whoami, :) +AC_PATH_PROG(AUTOCONF, autoconf, :) +AC_PATH_PROG(UNZIP, unzip, :) +AC_PATH_PROGS(ZIP, zip) +if test -z "$ZIP" || test "$ZIP" = ":"; then + AC_MSG_ERROR([zip not found in \$PATH]) +fi +AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend) +AC_PATH_PROG(XARGS, xargs) +if test -z "$XARGS" || test "$XARGS" = ":"; then + AC_MSG_ERROR([xargs not found in \$PATH .]) +fi + +if test "$COMPILE_ENVIRONMENT"; then + +dnl ======================================================== +dnl = Mac OS X toolchain support +dnl ======================================================== + +case "$target_os" in +darwin*) + dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0. + dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for + dnl the environment and includedir purposes (when using an SDK, below), + dnl but remember the full version number for the libdir (SDK). + changequote(,) + GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'` + GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'` + changequote([,]) + if test "$GCC_VERSION_FULL" = "4.0.0" ; then + dnl Bug 280479, but this keeps popping up in bug 292530 too because + dnl 4.0.0/4061 is the default compiler in Tiger. + changequote(,) + GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'` + changequote([,]) + if test "$GCC_BUILD" = "4061" ; then + AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061. +This compiler was supplied with Xcode 2.0, and contains bugs that prevent it +from building Mozilla. Upgrade to Xcode 2.1 or later.]) + fi + fi + + dnl xcodebuild needs GCC_VERSION defined in the environment, since it + dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use + dnl /usr/bin/g(cc|++)-$GCC_VERSION. + AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild) + + case "$PBBUILD" in + *xcodebuild*) + changequote(,) + XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'` + changequote([,]) + if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then + HAS_XCODE_2_1=1; + fi + ;; + esac + + dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8), + dnl it has moved into /usr/bin. + AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools]) + ;; +esac + +AC_SUBST(GCC_VERSION) +AC_SUBST(XCODEBUILD_VERSION) +AC_SUBST(HAS_XCODE_2_1) + +dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk +dnl that a universal binary is being produced. +AC_SUBST(UNIVERSAL_BINARY) + +dnl ======================================================== +dnl Check for MacOS deployment target version +dnl ======================================================== + +MOZ_ARG_ENABLE_STRING(macos-target, + [ --enable-macos-target=VER (default=10.4) + Set the minimum MacOS version needed at runtime], + [_MACOSX_DEPLOYMENT_TARGET=$enableval]) + +case "$target" in +*-darwin*) + if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then + dnl Use the specified value + export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET + AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET) + elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then + dnl No value specified on the command line or in the environment, + dnl use the lesser of the application's minimum or the architecture's + dnl minimum. + export MACOSX_DEPLOYMENT_TARGET=10.4 + fi + ;; +esac + +AC_SUBST(MACOSX_DEPLOYMENT_TARGET) + +dnl ======================================================== +dnl = Mac OS X SDK support +dnl ======================================================== +MACOS_SDK_DIR= +NEXT_ROOT= +MOZ_ARG_WITH_STRING(macos-sdk, +[ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)], + MACOS_SDK_DIR=$withval) + +dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use. +dnl NEXT_ROOT will be set and exported only if it's needed. +AC_SUBST(MACOS_SDK_DIR) +AC_SUBST(NEXT_ROOT) + +if test "$MACOS_SDK_DIR"; then + dnl Sync this section with the ones in NSPR and NSS. + dnl Changes to the cross environment here need to be accounted for in + dnl the libIDL checks (below) and xpidl build. + + if test ! -d "$MACOS_SDK_DIR"; then + AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must +specify a valid SDK. SDKs are installed when the optional cross-development +tools are selected during the Xcode/Developer Tools installation.]) + fi + + GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'` + if test "$GCC_VERSION_MAJOR" -lt "4" ; then + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks" + if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then + SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks" + fi + SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward" + + CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}" + + dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER. + CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" + CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}" + + dnl ld support for -syslibroot is compiler-agnostic, but only available + dnl on Tiger. Although it's possible to switch on the build host's + dnl OS release to use ld -syslibroot when available, ld -syslibroot will + dnl cause warnings as long as NEXT_ROOT is set. NEXT_ROOT should be + dnl set because both the compiler and linker use it. + LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS" + export NEXT_ROOT=$MACOS_SDK_DIR + + if test -n "$CROSS_COMPILE" ; then + dnl NEXT_ROOT will be in the environment, but it shouldn't be set for + dnl the build host. HOST_CXX is presently unused. + HOST_CC="NEXT_ROOT= $HOST_CC" + HOST_CXX="NEXT_ROOT= $HOST_CXX" + fi + else + dnl gcc >= 4.0 uses different paths than above, but knows how to find + dnl them itself. + CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}" + CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}" + + dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER. + CPP="$CPP -isysroot ${MACOS_SDK_DIR}" + CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}" + + if test "$GCC_VERSION_FULL" = "4.0.0" ; then + dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld + dnl that supports -syslibroot. Don't set NEXT_ROOT because it will + dnl be ignored and cause warnings when -syslibroot is specified. + dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on + dnl the -isysroot it receives, so this is only needed with 4.0.0. + LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}" + fi + fi + + AC_LANG_SAVE + AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination]) + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([#include + int main() { return 0; }], + result=yes, + result=no) + AC_LANG_RESTORE + AC_MSG_RESULT($result) + + if test "$result" = "no" ; then + AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.]) + fi +fi + +fi # COMPILE_ENVIRONMENT + +dnl Be sure the make we use is GNU make. +dnl on win32, gmake.exe is the generally the wrong version +case "$host_os" in +cygwin*|mingw*|mks*|msvc*) + AC_PATH_PROGS(MAKE, $MAKE make gmake, :) + ;; +*) + AC_PATH_PROGS(MAKE, $MAKE gmake make, :) + ;; +esac +_make_try=`$MAKE --version 2>/dev/null | grep GNU` +if test ! "$_make_try" +then + echo + echo "*** $MAKE is not GNU Make. You will not be able to build Mozilla without GNU Make." + echo + exit 1 +fi +dnl Now exit if version if < MAKE_VERSION +rm -f dummy.mk +echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk +_make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null` +rm -f dummy.mk +_MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'` +_MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'` +MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'` +MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'` +if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \ + test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \ + "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then + AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.]) +fi +AC_SUBST(MAKE) + +if test "$COMPILE_ENVIRONMENT"; then + +AC_PATH_XTRA + +dnl Check in X11 include directory too. +if test "$no_x" != "yes"; then + CPPFLAGS="$CPPFLAGS $X_CFLAGS" +fi + +XCFLAGS="$X_CFLAGS" + +fi # COMPILE_ENVIRONMENT + +dnl ======================================================== +dnl set the defaults first +dnl ======================================================== +AS_BIN=$AS +AR_FLAGS='cr $@' +AR_LIST='$(AR) t' +AR_EXTRACT='$(AR) x' +AR_DELETE='$(AR) d' +AS='$(CC)' +AS_DASH_C_FLAG='-c' +DLL_PREFIX=lib +LIB_PREFIX=lib +DLL_SUFFIX=.so +OBJ_SUFFIX=o +LIB_SUFFIX=a +ASM_SUFFIX=s +IMPORT_LIB_SUFFIX= +TARGET_MD_ARCH=unix +DIRENT_INO=d_ino +CYGWIN_WRAPPER= +WIN_TOP_SRC= +MOZ_USER_DIR=".mozilla" +HOST_AR='$(AR)' +HOST_AR_FLAGS='$(AR_FLAGS)' + +MOZ_JS_LIBS='-L$(libdir) -lmozjs' +MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib' + +MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)' +MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat' + +USE_DEPENDENT_LIBS=1 + +_PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2 +MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)' + +MOZ_ENABLE_POSTSCRIPT=1 + +if test -n "$CROSS_COMPILE"; then + OS_TARGET="${target_os}" + OS_ARCH=`echo $target_os | sed -e 's|/|_|g'` + OS_RELEASE= + case "${target_os}" in + linux*) OS_ARCH=Linux OS_TARGET=Linux ;; + kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;; + solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;; + mingw*) OS_ARCH=WINNT ;; + wince*) OS_ARCH=WINCE ;; + darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;; + esac +else + OS_TARGET=`uname -s` + OS_ARCH=`uname -s | sed -e 's|/|_|g'` + OS_RELEASE=`uname -r` +fi + +# Before this used `uname -m` when not cross compiling +# but that breaks when you have a 64 bit kernel with a 32 bit userland. +OS_TEST="${target_cpu}" + +_COMPILER_PREFIX= + +HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'` + +####################################################################### +# Master "Core Components" macros for getting the OS target # +####################################################################### + +# +# Note: OS_TARGET should be specified on the command line for gmake. +# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built. +# The difference between the Win95 target and the WinNT target is that +# the WinNT target uses Windows NT specific features not available +# in Windows 95. The Win95 target will run on Windows NT, but (supposedly) +# at lesser performance (the Win95 target uses threads; the WinNT target +# uses fibers). +# +# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no +# cross-compilation. +# + +# +# The following hack allows one to build on a WIN95 machine (as if +# s/he were cross-compiling on a WINNT host for a WIN95 target). +# It also accomodates for MKS's uname.exe. If you never intend +# to do development on a WIN95 machine, you don't need this hack. +# +case "$OS_ARCH" in +WIN95) + OS_ARCH=WINNT + OS_TARGET=WIN95 + ;; +Windows_95) + OS_ARCH=Windows_NT + OS_TARGET=WIN95 + ;; +Windows_98) + OS_ARCH=Windows_NT + OS_TARGET=WIN95 + ;; +CYGWIN_9*|CYGWIN_ME*) + OS_ARCH='CYGWIN_NT-4.0' + OS_TARGET=WIN95 + ;; +esac + +# +# Define and override various archtecture-specific variables, including +# HOST_OS_ARCH +# OS_ARCH +# OS_TEST +# OS_TARGET +# OS_RELEASE +# OS_MINOR_RELEASE +# + +case "$HOST_OS_ARCH" in +cygwin*|mingw*|mks*|msvc*) + HOST_OS_ARCH=WINNT + ;; +linux*) + HOST_OS_ARCH=Linux + ;; +solaris*) + HOST_OS_ARCH=SunOS + ;; +BSD_386) + HOST_OS_ARCH=BSD + ;; +dgux) + HOST_OS_ARCH=DGUX + ;; +IRIX64) + HOST_OS_ARCH=IRIX + ;; +UNIX_SV) + if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then + HOST_OS_ARCH=NCR + else + HOST_OS_ARCH=UNIXWARE + fi + ;; +ncr) + HOST_OS_ARCH=NCR + ;; +UNIX_SYSTEM_V) + HOST_OS_ARCH=NEC + ;; +OSF1) + ;; +*OpenVMS*) + HOST_OS_ARCH=OpenVMS + ;; +OS_2) + HOST_OS_ARCH=OS2 + ;; +QNX) + ;; +SCO_SV) + HOST_OS_ARCH=SCOOS + ;; +SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M) + HOST_OS_ARCH=SINIX + ;; +UnixWare) + HOST_OS_ARCH=UNIXWARE + ;; +esac + +case "$OS_ARCH" in +WINNT) + OS_TEST=`uname -p` + ;; +Windows_NT) +# +# If uname -s returns "Windows_NT", we assume that we are using +# the uname.exe in MKS toolkit. +# +# The -r option of MKS uname only returns the major version number. +# So we need to use its -v option to get the minor version number. +# Moreover, it doesn't have the -p option, so we need to use uname -m. +# + OS_ARCH=WINNT + OS_TARGET=WINNT + OS_MINOR_RELEASE=`uname -v` + if test "$OS_MINOR_RELEASE" = "00"; then + OS_MINOR_RELEASE=0 + fi + OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}" + ;; +CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*) +# +# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using +# the uname.exe in the Cygwin tools. +# Prior to the Beta 20 release, Cygwin was called GNU-Win32. +# If uname -s returns "CYGWIN32/NT", we assume that we are using +# the uname.exe in the GNU-Win32 tools. +# If uname -s returns MINGW32_NT-5.1, we assume that we are using +# the uname.exe in the MSYS tools. +# + OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'` + OS_ARCH=WINNT + OS_TARGET=WINNT + ;; +AIX) + OS_RELEASE=`uname -v`.`uname -r` + OS_TEST=${target_cpu} + ;; +BSD_386) + OS_ARCH=BSD + ;; +dgux) + OS_ARCH=DGUX + ;; +IRIX64) + OS_ARCH=IRIX + ;; +UNIX_SV) + if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then + OS_ARCH=NCR + else + OS_ARCH=UNIXWARE + OS_RELEASE=`uname -v` + fi + ;; +ncr) + OS_ARCH=NCR + ;; +UNIX_SYSTEM_V) + OS_ARCH=NEC + ;; +OSF1) + case `uname -v` in + 148) + OS_RELEASE=V3.2C + ;; + 564) + OS_RELEASE=V4.0B + ;; + 878) + OS_RELEASE=V4.0D + ;; + esac + ;; +*OpenVMS*) + OS_ARCH=OpenVMS + OS_RELEASE=`uname -v` + OS_TEST=`uname -p` + ;; +OS_2) + OS_ARCH=OS2 + OS_TARGET=OS2 + OS_RELEASE=`uname -v` + ;; +QNX) + if test "$OS_TARGET" != "NTO"; then + changequote(,) + OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'` + changequote([,]) + fi + OS_TEST=x86 + ;; +SCO_SV) + OS_ARCH=SCOOS + OS_RELEASE=5.0 + ;; +SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M) + OS_ARCH=SINIX + OS_TEST=`uname -p` + ;; +UnixWare) + OS_ARCH=UNIXWARE + OS_RELEASE=`uname -v` + ;; +WINCE) + OS_ARCH=WINCE + OS_TARGET=WINCE + ;; +Darwin) + case "${target_cpu}" in + powerpc*) + OS_TEST=ppc + ;; + i*86*) + OS_TEST=i386 + ;; + *) + if test -z "$CROSS_COMPILE" ; then + OS_TEST=`uname -p` + fi + ;; + esac + ;; +esac + +if test "$OS_ARCH" = "NCR"; then + changequote(,) + OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'` + changequote([,]) +fi + +# Only set CPU_ARCH if we recognize the value of OS_TEST + +case "$OS_TEST" in +*86 | i86pc) + CPU_ARCH=x86 + ;; + +powerpc* | ppc | rs6000) + CPU_ARCH=ppc + ;; + +Alpha | alpha | ALPHA) + CPU_ARCH=Alpha + ;; + +hppa* | parisc) + CPU_ARCH=hppa + ;; + +sun4u | sparc*) + CPU_ARCH=sparc + ;; + +x86_64 | ia64) + CPU_ARCH="$OS_TEST" + ;; +esac + +if test -z "$OS_TARGET"; then + OS_TARGET=$OS_ARCH +fi +if test "$OS_TARGET" = "WIN95"; then + OS_RELEASE="4.0" +fi +OS_CONFIG="${OS_TARGET}${OS_RELEASE}" + +dnl ======================================================== +dnl GNU specific defaults +dnl ======================================================== +if test "$GNU_CC"; then + # FIXME: Let us build with strict aliasing. bug 414641. + CFLAGS="$CFLAGS -fno-strict-aliasing" + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@' + DSO_LDOPTS='-shared' + if test "$GCC_USE_GNU_LD"; then + # Don't allow undefined symbols in libraries + DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs" + fi + WARNINGS_AS_ERRORS='-Werror' + DSO_CFLAGS='' + DSO_PIC_CFLAGS='-fPIC' + ASFLAGS="$ASFLAGS -fPIC" + _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti + _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti + _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions' + _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions' + + # Turn on GNU specific features + # -Wall - turn on all warnings + # -pedantic - make compiler warn about non-ANSI stuff, and + # be a little bit stricter + # Warnings slamm took out for now (these were giving more noise than help): + # -Wbad-function-cast - warns when casting a function to a new return type + # -Wshadow - removed because it generates more noise than help --pete + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith" + if test -z "$INTEL_CC"; then + # Don't use -Wcast-align with ICC + case "$CPU_ARCH" in + # And don't use it on hppa, ia64, sparc, since it's noisy there + hppa | ia64 | sparc) + ;; + *) + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align" + ;; + esac + fi + + dnl Turn pedantic on but disable the warnings for long long + _PEDANTIC=1 + + if test -z "$INTEL_CC"; then + _IGNORE_LONG_LONG_WARNINGS=1 + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W" + else + _IGNORE_LONG_LONG_WARNINGS= + fi + + + _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT' + _USE_CPP_INCLUDE_FLAG=1 +else + MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' + MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' + + DSO_LDOPTS='-shared' + if test "$GNU_LD"; then + # Don't allow undefined symbols in libraries + DSO_LDOPTS="$DSO_LDOPTS -z defs" + fi + + DSO_CFLAGS='' + DSO_PIC_CFLAGS='-KPIC' + _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' +fi + +if test "$GNU_CXX"; then + # FIXME: Let us build with strict aliasing. bug 414641. + CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" + # Turn on GNU specific features + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor" + if test -z "$INTEL_CC"; then + # Don't use -Wcast-align with ICC + case "$CPU_ARCH" in + # And don't use it on hppa, ia64, sparc, since it's noisy there + hppa | ia64 | sparc) + ;; + *) + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align" + ;; + esac + fi + + _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h' + _USE_CPP_INCLUDE_FLAG=1 + + AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof, + ac_has_wno_invalid_offsetof, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + _SAVE_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof" + AC_TRY_COMPILE([], + [return(0);], + ac_has_wno_invalid_offsetof="yes", + ac_has_wno_invalid_offsetof="no") + CXXFLAGS="$_SAVE_CXXFLAGS" + AC_LANG_RESTORE + ]) + if test "$ac_has_wno_invalid_offsetof" = "yes"; then + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof" + fi +else + _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)' +fi + +dnl gcc can come with its own linker so it is better to use the pass-thru calls +dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object +dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to +dnl normal behavior. +dnl ======================================================== +MKSHLIB_FORCE_ALL= +MKSHLIB_UNFORCE_ALL= + +if test "$COMPILE_ENVIRONMENT"; then +if test "$GNU_CC"; then + AC_MSG_CHECKING(whether ld has archive extraction flags) + AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce, + [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS + ac_cv_mkshlib_force_and_unforce="no" + exec 3<&0 </dev/null`" = 0; then + _pwd=`pwd` + CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper" + fi + if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then + AS_PERL=1 + PERL="${CYGWIN_WRAPPER} $PERL" + fi + + if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then + PYTHON="${CYGWIN_WRAPPER} $PYTHON" + fi + ;; + esac + ;; + +*-darwin*) + HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11" + HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' + HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" + MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin' + LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc' + ;; + +*-linux*|*-kfreebsd*-gnu) + HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" + HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"' + HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" + ;; + +*os2*) + HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf" + HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"' + HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" + HOST_BIN_SUFFIX=.exe + MOZ_FIX_LINK_PATHS= + ;; + +*-osf*) + HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" + HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"' + HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" + ;; + +*) + HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" + HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" + ;; +esac + +dnl ======================================================== +dnl System overrides of the defaults for target +dnl ======================================================== + +case "$target" in +*-aix*) + AC_DEFINE(AIX) + if test ! "$GNU_CC"; then + if test ! "$HAVE_64BIT_OS"; then + # Compiling with Visual Age C++ object model compat is the + # default. To compile with object model ibm, add + # AIX_OBJMODEL=ibm to .mozconfig. + if test "$AIX_OBJMODEL" = "ibm"; then + CXXFLAGS="$CXXFLAGS -qobjmodel=ibm" + else + AIX_OBJMODEL=compat + fi + else + AIX_OBJMODEL=compat + fi + AC_SUBST(AIX_OBJMODEL) + DSO_LDOPTS='-qmkshrobj=1' + DSO_CFLAGS='-qflag=w:w' + DSO_PIC_CFLAGS= + LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib" + AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.]) + MOZ_FIX_LINK_PATHS= + MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@' + MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + if test "$COMPILE_ENVIRONMENT"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3]) + AC_TRY_COMPILE([], + [#if (__IBMCPP__ < 600) + #error "Bad compiler" + #endif], + _BAD_COMPILER=,_BAD_COMPILER=1) + if test -n "$_BAD_COMPILER"; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.]) + else + AC_MSG_RESULT([yes]) + fi + AC_LANG_RESTORE + TARGET_COMPILER_ABI="ibmc" + CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'` + CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'` + fi + fi + case "${target_os}" in + aix4.1*) + DLL_SUFFIX='_shr.a' + ;; + esac + if test "$COMPILE_ENVIRONMENT"; then + AC_CHECK_HEADERS(sys/inttypes.h) + fi + AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) + ;; + +*-beos*) + no_x=yes + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@' + _PLATFORM_DEFAULT_TOOLKIT="cairo-beos" + DSO_LDOPTS='-nostart' + TK_LIBS='-lbe -lroot' + LIBS="$LIBS -lbe" + if test "$COMPILE_ENVIRONMENT"; then + AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind") + AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta") + fi + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar" + _MOZ_USE_RTTI=1 + USE_DEPENDENT_LIBS= + MOZ_USER_DIR="Mozilla" + ;; + +*-bsdi*) + dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2) + _PEDANTIC= + _IGNORE_LONG_LONG_WARNINGS= + case $OS_RELEASE in + 4.*|5.*) + STRIP="$STRIP -d" + ;; + *) + DSO_CFLAGS='' + DSO_LDOPTS='-r' + _WARNINGS_CFLAGS="-Wall" + _WARNINGS_CXXFLAGS="-Wall" + # The test above doesn't work properly, at least on 3.1. + MKSHLIB_FORCE_ALL='' + MKSHLIB_UNFORCE_ALL='' + ;; + esac + ;; + +*-darwin*) + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + MOZ_OPTIMIZE_FLAGS="-O2" + _PEDANTIC= + CFLAGS="$CFLAGS -fpascal-strings -fno-common" + CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common" + DLL_SUFFIX=".dylib" + DSO_LDOPTS='' + STRIP="$STRIP -x -S" + _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa' + MOZ_ENABLE_POSTSCRIPT= + TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' + LDFLAGS="$LDFLAGS -framework Cocoa" + # The ExceptionHandling framework is needed for Objective-C exception + # logging code in nsObjCExceptions.h. Currently we only use that in debug + # builds. + MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling" + # set MACOSX to generate lib/mac/MoreFiles/Makefile + MACOSX=1 + + dnl DTrace and -dead_strip don't interact well. See bug 403132. + dnl =================================================================== + if test "x$enable_dtrace" = "xyes"; then + echo "Skipping -dead_strip because DTrace is enabled. See bug 403132." + else + dnl check for the presence of the -dead_strip linker flag + AC_MSG_CHECKING([for -dead_strip option to ld]) + _SAVE_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-dead_strip" + AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=) + if test -n "$_HAVE_DEAD_STRIP" ; then + AC_MSG_RESULT([yes]) + MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip" + else + AC_MSG_RESULT([no]) + fi + + LDFLAGS=$_SAVE_LDFLAGS + fi + ;; + +*-freebsd*) + if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then + DLL_SUFFIX=".so.1.0" + DSO_LDOPTS="-shared" + fi + if test ! "$GNU_CC"; then + DSO_LDOPTS="-Bshareable $DSO_LDOPTS" + fi +# Can't have force w/o an unforce. +# # Hack for FreeBSD 2.2 +# if test -z "$MKSHLIB_FORCE_ALL"; then +# MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive' +# MKSHLIB_UNFORCE_ALL='' +# fi + ;; + +*-hpux*) + DLL_SUFFIX=".sl" + if test ! "$GNU_CC"; then + DSO_LDOPTS='-b -Wl,+s' + DSO_CFLAGS="" + DSO_PIC_CFLAGS="+Z" + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@' + MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@' + CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on" + else + DSO_LDOPTS='-b -E +s' + MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@' + MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@' + fi + MOZ_POST_PROGRAM_COMMAND='chatr +s enable' + AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) + ;; + +*-irix5*) + AC_DEFINE(IRIX) + DSO_LDOPTS='-elf -shared' + + if test "$GNU_CC"; then + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + MKSHLIB_FORCE_ALL='-Wl,-all' + MKSHLIB_UNFORCE_ALL='-Wl,-none' + CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS" + else + MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@' + MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@' + MKSHLIB_FORCE_ALL='-all' + MKSHLIB_UNFORCE_ALL='-none' + fi + ;; + +*-irix6*) + AC_DEFINE(IRIX) + dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* + dnl compile and link using -n32 + USE_N32=1 + TARGET_COMPILER_ABI=n32 + DSO_LDOPTS='-elf -shared' + MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF" + _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON" + if test "$GNU_CC"; then + MKSHLIB_FORCE_ALL='-Wl,-all' + MKSHLIB_UNFORCE_ALL='-Wl,-none' + _WARNINGS_CFLAGS="-Wall" + _WARNINGS_CXXFLAGS="-Wall" + CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS" + else + MKSHLIB_FORCE_ALL='-all' + MKSHLIB_UNFORCE_ALL='-none' + AR_LIST="$AR t" + AR_EXTRACT="$AR x" + AR_DELETE="$AR d" + AR='$(CXX) -ar' + AR_FLAGS='-o $@' + CFLAGS="$CFLAGS -woff 3262 -G 4" + CXXFLAGS="$CXXFLAGS -woff 3262 -G 4" + if test -n "$USE_N32"; then + ASFLAGS="$ASFLAGS -n32" + CFLAGS="$CFLAGS -n32" + CXXFLAGS="$CXXFLAGS -n32" + LDFLAGS="$LDFLAGS -n32" + fi + AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) + AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.]) + MOZ_FIX_LINK_PATHS= + fi + if test -z "$GNU_CXX"; then + MIPSPRO_CXX=1 + fi + ;; + +*-*linux*) + if test "$GNU_CC"; then + GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'` + case $GCC_VERSION in + 4.1.*|4.2.*) + # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results. + MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50" + esac + fi + + TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' + MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK" + MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, + # and that combo is not yet good at + # debugging inlined functions (even + # when using DWARF2 as the debugging + # format) + + + case "${target_cpu}" in + alpha*) + CFLAGS="$CFLAGS -mieee" + CXXFLAGS="$CXXFLAGS -mieee" + ;; + i*86) + USE_ELF_DYNSTR_GC=1 + MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1 + ;; + mips*) + MOZ_DEBUG_FLAGS="-g" # We want inlining + ;; + esac + ;; + +*-wince*) + + MOZ_TOOLS_DIR=`echo $MOZ_TOOLS` + AR_LIST="$AR -list" + AR_EXTRACT="$AR -extract" + AR_DELETE="$AR d" + AR_FLAGS='-OUT:"$@"' + + if test -z "$AS_BIN"; then + AS="$AS_BIN" + fi + DSO_CFLAGS= + DSO_PIC_CFLAGS= + DLL_SUFFIX=.dll + BIN_SUFFIX='.exe' + if test -z "$RC"; then + RC=rc.exe + fi + # certain versions of cygwin's makedepend barf on the + # #include vs -I./dist/include/string issue so don't use it + SYSTEM_MAKEDEPEND= + + HOST_CC=cl + HOST_CXX=cl + HOST_LD=link + HOST_AR='lib -OUT:$@' + HOST_RANLIB='echo ranlib' + HOST_CFLAGS="$HOST_CFLAGS -D_X86_" + + + WARNINGS_AS_ERRORS='-WX' + MOZ_OPTIMIZE_FLAGS='-O1' + AR_FLAGS='-NOLOGO -OUT:"$@"' + ASM_SUFFIX=asm + CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)" + CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)" + DLL_PREFIX= + DOXYGEN=: + DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE + DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib' + GARBAGE= + IMPORT_LIB_SUFFIX=lib + LIBS="$LIBS" + LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib' + LIB_PREFIX= + LIB_SUFFIX=lib + MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)' + MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)' + MKSHLIB_FORCE_ALL= + MKSHLIB_UNFORCE_ALL= + MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)' + MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)' + MOZ_DEBUG_FLAGS='-Zi' + MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV' + MOZ_FIX_LINK_PATHS= + MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib' + MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib' + OBJ_SUFFIX=obj + RANLIB='echo not_ranlib' + STRIP='echo not_strip' + TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"' + UNZIP=unzip + XARGS=xargs + XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib' + ZIP=zip + + AC_DEFINE(HAVE_SNPRINTF) + AC_DEFINE(_WINDOWS) + AC_DEFINE(_WIN32) + AC_DEFINE(WIN32) + AC_DEFINE(XP_WIN) + AC_DEFINE(XP_WIN32) + AC_DEFINE(HW_THREADS) + AC_DEFINE(STDC_HEADERS) + AC_DEFINE(NEW_H, ) + AC_DEFINE(WIN32_LEAN_AND_MEAN) + + TARGET_MD_ARCH=win32 + _PLATFORM_DEFAULT_TOOLKIT='windows' + BIN_SUFFIX='.exe' + USE_SHORT_LIBNAME=1 + MOZ_ENABLE_POSTSCRIPT= + MOZ_USER_DIR="Mozilla" +;; + + +*-mingw*|*-cygwin*|*-msvc*|*-mks*) + DSO_CFLAGS= + DSO_PIC_CFLAGS= + DLL_SUFFIX=.dll + RC=rc.exe + # certain versions of cygwin's makedepend barf on the + # #include vs -I./dist/include/string issue so don't use it + SYSTEM_MAKEDEPEND= + if test -n "$GNU_CC"; then + CC="$CC -mno-cygwin" + CXX="$CXX -mno-cygwin" + CPP="$CPP -mno-cygwin" + CFLAGS="$CFLAGS -mms-bitfields" + CXXFLAGS="$CXXFLAGS -mms-bitfields" + DSO_LDOPTS='-shared' + MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@' + MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + RC='$(WINDRES)' + # Use temp file for windres (bug 213281) + RCFLAGS='-O coff --use-temp-file' + # mingw doesn't require kernel32, user32, and advapi32 explicitly + LIBS="$LIBS -lgdi32 -lwinmm -lwsock32" + MOZ_JS_LIBS='-L$(libdir) -ljs$(MOZ_BITS)$(VERSION_NUMBER)' + MOZ_FIX_LINK_PATHS= + DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core' + XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom' + DLL_PREFIX= + IMPORT_LIB_SUFFIX=dll.a + else + TARGET_COMPILER_ABI=msvc + HOST_CC='$(CC)' + HOST_CXX='$(CXX)' + HOST_LD='$(LD)' + AR='lib -NOLOGO -OUT:"$@"' + AR_FLAGS= + RANLIB='echo not_ranlib' + STRIP='echo not_strip' + XARGS=xargs + ZIP=zip + UNZIP=unzip + DOXYGEN=: + GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb' + OBJ_SUFFIX=obj + LIB_SUFFIX=lib + DLL_PREFIX= + LIB_PREFIX= + IMPORT_LIB_SUFFIX=lib + MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)' + MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)' + MKSHLIB_FORCE_ALL= + MKSHLIB_UNFORCE_ALL= + DSO_LDOPTS=-SUBSYSTEM:WINDOWS + CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)" + CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)" + LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib" + MOZ_DEBUG_FLAGS='-Zi' + MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV' + WARNINGS_AS_ERRORS='-WX' + MOZ_OPTIMIZE_FLAGS='-O1' + MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib' + MOZ_FIX_LINK_PATHS= + DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib' + XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib' + LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib' + MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)' + MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib' + if test $_MSC_VER -ge 1400; then + LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH" + dnl For profile-guided optimization + PROFILE_GEN_CFLAGS="-GL" + PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT" + dnl XXX: PGO builds can fail with warnings treated as errors, + dnl specifically "no profile data available" appears to be + dnl treated as an error sometimes. This might be a consequence + dnl of using WARNINGS_AS_ERRORS in some modules, combined + dnl with the linker doing most of the work in the whole-program + dnl optimization/PGO case. I think it's probably a compiler bug, + dnl but we work around it here. + PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952" + dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul. + dnl Probably also a compiler bug, but what can you do? + PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE" + if test -n "$_USE_DYNAMICBASE"; then + LDFLAGS="$LDFLAGS -DYNAMICBASE" + fi + fi + fi + AC_DEFINE(HAVE_SNPRINTF) + AC_DEFINE(_WINDOWS) + AC_DEFINE(_WIN32) + AC_DEFINE(WIN32) + AC_DEFINE(XP_WIN) + AC_DEFINE(XP_WIN32) + AC_DEFINE(HW_THREADS) + AC_DEFINE(STDC_HEADERS) + AC_DEFINE(NEW_H, ) + AC_DEFINE(WIN32_LEAN_AND_MEAN) + TARGET_MD_ARCH=win32 + _PLATFORM_DEFAULT_TOOLKIT='cairo-windows' + BIN_SUFFIX='.exe' + USE_SHORT_LIBNAME=1 + MOZ_ENABLE_POSTSCRIPT= + MOZ_USER_DIR="Mozilla" + + dnl Hardcode to win95 for now - cls + TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"' + + dnl set NO_X11 defines here as the general check is skipped on win32 + no_x=yes + AC_DEFINE(NO_X11) + + dnl MinGW/MSYS doesn't provide or need cygpath + case "$host" in + *-mingw*) + CYGPATH_W=echo + CYGPATH_S=cat + MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W` + ;; + *-cygwin*|*-msvc*|*-mks*) + CYGPATH_W="cygpath -a -w" + CYGPATH_S="sed -e s|\\\\|/|g" + MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S` + ;; + esac + case "$host" in + *-mingw*|*-cygwin*|*-msvc*|*-mks*) + + if test -z "$MOZ_TOOLS"; then + AC_MSG_ERROR([MOZ_TOOLS is not set]) + fi + + MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd` + if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then + AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS]) + fi + if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then + AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.]) + fi + MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S` + + if test -n "$GLIB_PREFIX"; then + _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd` + if test "$?" = "0"; then + if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then + AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.]) + fi + _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S` + else + AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.]) + fi + else + _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR + fi + if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then + AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .]) + fi + GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include" + if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then + GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib" + elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then + GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib" + else + AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib]) + fi + ;; + + *) # else cross-compiling + if test -n "$GLIB_PREFIX"; then + GLIB_CFLAGS="-I${GLIB_PREFIX}/include" + if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then + GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib" + elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then + GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib" + else + AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib]) + fi + fi + ;; + esac + + + case "$host_os" in + cygwin*|msvc*|mks*) + AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites]) + ;; + + *) + AC_CHECK_HEADERS(mmintrin.h oleacc.idl) + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_CHECK_HEADERS(atlbase.h wpcapi.h) + AC_LANG_RESTORE + ;; + esac + + case "$target" in + i*86-*) + AC_DEFINE(_X86_) + ;; + alpha-*) + AC_DEFINE(_ALPHA_) + ;; + mips-*) + AC_DEFINE(_MIPS_) + ;; + *) + AC_DEFINE(_CPU_ARCH_NOT_DEFINED) + ;; + esac + ;; + +*-netbsd*) + DSO_CFLAGS='' + CFLAGS="$CFLAGS -Dunix" + CXXFLAGS="$CXXFLAGS -Dunix" + if $CC -E - -dM /dev/null; then + DLL_SUFFIX=".so" + DSO_PIC_CFLAGS='-fPIC -DPIC' + DSO_LDOPTS='-shared' + BIN_FLAGS='-Wl,--export-dynamic' + else + DSO_PIC_CFLAGS='-fPIC -DPIC' + DLL_SUFFIX=".so.1.0" + DSO_LDOPTS='-shared' + fi + # This will fail on a.out systems prior to 1.5.1_ALPHA. + MKSHLIB_FORCE_ALL='-Wl,--whole-archive' + MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive' + if test "$LIBRUNPATH"; then + DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS" + fi + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@' + ;; + +*-nto*) + AC_DEFINE(NTO) + AC_DEFINE(_QNX_SOURCE) + AC_DEFINE(_i386) + OS_TARGET=NTO + WARNINGS_AS_ERRORS='' + MOZ_OPTIMIZE_FLAGS="-O" + MOZ_DEBUG_FLAGS="-gstabs" + USE_PTHREADS=1 + _PEDANTIC= + LIBS="$LIBS -lsocket -lstdc++" + _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506' + _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506' + if test "$with_x" != "yes" + then + _PLATFORM_DEFAULT_TOOLKIT="photon" + TK_CFLAGS='-I/usr/include/photon' + TK_LIBS='-lph' + fi + case "${target_cpu}" in + ppc*) + AC_DEFINE(HAVE_VA_LIST_AS_ARRAY) + ;; + esac + case "${host_cpu}" in + i*86) + USE_ELF_DYNSTR_GC=1 + ;; + esac + ;; + +*-openbsd*) + DLL_SUFFIX=".so.1.0" + DSO_CFLAGS='' + DSO_PIC_CFLAGS='-fPIC' + DSO_LDOPTS='-shared -fPIC' + if test "$LIBRUNPATH"; then + DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS" + fi + ;; + +*-openvms*) + AC_DEFINE(NO_PW_GECOS) + AC_DEFINE(NO_UDSOCK) + AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER) + USE_PTHREADS=1 + MKSHLIB_FORCE_ALL='-all' + MKSHLIB_UNFORCE_ALL='-none' + AS='as' + AS_DASH_C_FLAG='-Wc/names=as_is' + AR_FLAGS='c $@' + DSO_LDOPTS='-shared -auto_symvec' + DSO_PIC_CFLAGS= + MOZ_DEBUG_LDFLAGS='-g' + COMPAQ_CXX=1 + CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'` + CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'` + ;; + + +*-os2*) + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' + AC_DEFINE(OS2) + AC_DEFINE(XP_OS2) + AC_DEFINE(OS2EMX_PLAIN_CHAR) + AC_DEFINE(TCPV40HDRS) + USE_SHORT_LIBNAME=1 + DLL_PREFIX= + LIB_PREFIX= + LIB_SUFFIX=lib + BIN_SUFFIX=".exe" + DLL_SUFFIX=".dll" + IMPORT_LIB_SUFFIX=lib + DSO_PIC_CFLAGS= + AR=emxomfar + AR_FLAGS='r $@' + CFLAGS="$CFLAGS -Zomf" + CXXFLAGS="$CXXFLAGS -Zomf" + DSO_LDOPTS='-Zdll' + BIN_FLAGS='-Zlinker /ST:0x100000' + IMPLIB='emximp -o' + FILTER='emxexp -o' + LDFLAGS='-Zmap' + WARNINGS_AS_ERRORS='-Werror' + MOZ_DEBUG_FLAGS="-g -fno-inline" + MOZ_OPTIMIZE_FLAGS="-O2" + MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA" + MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib' + DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib' + LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib' + TARGET_MD_ARCH=os2 + _PLATFORM_DEFAULT_TOOLKIT="cairo-os2" + MOZ_ENABLE_POSTSCRIPT= + RC=rc.exe + RCFLAGS='-n' + MOZ_USER_DIR="Mozilla" + + if test "$MOZTOOLS"; then + MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'` + else + AC_MSG_ERROR([MOZTOOLS is not set]) + fi + if test -n "$MOZ_OS2_HIGH_MEMORY"; then + DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem" + LDFLAGS="$LDFLAGS -Zhigh-mem" + MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem" + AC_DEFINE(MOZ_OS2_HIGH_MEMORY) + fi + + # GCC for OS/2 currently predefines these, but we don't want them + _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__" + _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__" + + AC_CACHE_CHECK(for __declspec(dllexport), + ac_os2_declspec, + [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}], + [return 0;], + ac_os2_declspec="yes", + ac_os2_declspec="no")]) + if test "$ac_os2_declspec" = "yes"; then + FILTER='true' + MOZ_OS2_USE_DECLSPEC='1' + fi + ;; + +alpha*-*-osf*) + if test "$GNU_CC"; then + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@' + + else + MOZ_DEBUG_FLAGS='-g' + ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g' + CFLAGS="$CFLAGS -ieee" + CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository' + DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations' + DSO_CFLAGS= + DSO_PIC_CFLAGS= + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@' + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@' + MKSHLIB_FORCE_ALL='-all' + MKSHLIB_UNFORCE_ALL='-none' + dnl Might fix the libxpcom.so breakage on this platform as well.... + AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES) + AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) + fi + if test -z "$GNU_CXX"; then + COMPAQ_CXX=1 + fi + AC_DEFINE(NEED_USLEEP_PROTOTYPE) + ;; + +*-qnx*) + DIRENT_INO=d_stat.st_ino + dnl Solves the problems the QNX compiler has with nsCOMPtr.h. + AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES) + AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) + dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test + AC_DEFINE(STDC_HEADERS) + if test "$no_x" = "yes"; then + _PLATFORM_DEFAULT_TOOLKIT='photon' + TK_CFLAGS='-I/usr/nto/include/photon' + TK_LIBS='-lphoton -lphrender' + fi + ;; + +*-sco*) + AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES) + AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) + CXXFLAGS="$CXXFLAGS -I/usr/include/CC" + if test ! "$GNU_CC"; then + DSO_LDOPTS='-G' + fi + ;; + +dnl the qsort routine under solaris is faulty +*-solaris*) + AC_DEFINE(SOLARIS) + TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"' + SYSTEM_MAKEDEPEND= + # $ORIGIN/.. is for shared libraries under components/ to locate shared + # libraries one level up (e.g. libnspr4.so) + LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'" + LIBS="-lCrun -lCstd $LIBS" + if test -z "$GNU_CC"; then + NS_USE_NATIVE=1 + MOZ_FIX_LINK_PATHS= + AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) + + if test "$CPU_ARCH" != "sparc"; then + CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all" + CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath" + else + # Do not use -xbuiltin on SPARC to get around a bug of compiler + CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none" + CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath" + fi + + LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS" + if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then + _SAVE_LDFLAGS=$LDFLAGS + LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" + AC_TRY_LINK([#include ], + [printf("Hello World\n");], + , + [LDFLAGS=$_SAVE_LDFLAGS]) + fi + WARNINGS_AS_ERRORS='-Werror' + MOZ_OPTIMIZE_FLAGS="-xO4" + MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@' + MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@' + MKSHLIB_FORCE_ALL='-z allextract' + MKSHLIB_UNFORCE_ALL='-z defaultextract' + DSO_LDOPTS='-G -z muldefs' + AR_LIST="$AR t" + AR_EXTRACT="$AR x" + AR_DELETE="$AR d" + AR='$(CXX) -xar' + AR_FLAGS='-o $@' + AS='/usr/ccs/bin/as' + ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0" + AS_DASH_C_FLAG='' + TARGET_COMPILER_ABI="sunc" + CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'` + CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'` + AC_MSG_CHECKING([for Forte compiler version >= WS6U2]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([], + [#if (__SUNPRO_CC < 0x530) + #error "Denied" + #endif], + _BAD_COMPILER=,_BAD_COMPILER=1) + if test -n "$_BAD_COMPILER"; then + _res="no" + AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .]) + else + _res="yes" + fi + AC_MSG_RESULT([$_res]) + AC_LANG_RESTORE + else + ASFLAGS="$ASFLAGS -fPIC" + DSO_LDOPTS='-G' + _WARNINGS_CFLAGS='' + _WARNINGS_CXXFLAGS='' + if test "$OS_RELEASE" = "5.3"; then + AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES) + fi + fi + if test "$OS_RELEASE" = "5.5.1"; then + AC_DEFINE(NEED_USLEEP_PROTOTYPE) + fi + ;; + +*-sunos*) + DSO_LDOPTS='-Bdynamic' + MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@' + MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@' + AC_DEFINE(SUNOS4) + AC_DEFINE(SPRINTF_RETURNS_STRING) + case "$(target_os)" in + sunos4.1*) + DLL_SUFFIX='.so.1.0' + ;; + esac + ;; + +*-sysv4.2uw7*) + NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt" + ;; + +*-os2*) + HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"' + ;; + +esac + +dnl Only one oddball right now (QNX), but this gives us flexibility +dnl if any other platforms need to override this in the future. +AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO) + +dnl ======================================================== +dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined +dnl by now will not have any way to link most binaries (tests +dnl as well as viewer, apprunner, etc.), because some symbols +dnl will be left out of the "composite" .so's by ld as unneeded. +dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms, +dnl they can link in the static libs that provide the missing +dnl symbols. +dnl ======================================================== +NO_LD_ARCHIVE_FLAGS= +if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then + NO_LD_ARCHIVE_FLAGS=1 +fi +case "$target" in +*-os2*) + NO_LD_ARCHIVE_FLAGS= + ;; +*-aix4.3*|*-aix5*) + NO_LD_ARCHIVE_FLAGS= + ;; +*-openvms*) + NO_LD_ARCHIVE_FLAGS= + ;; +*-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince) + if test -z "$GNU_CC"; then + NO_LD_ARCHIVE_FLAGS= + fi + ;; +esac +AC_SUBST(NO_LD_ARCHIVE_FLAGS) + +dnl +dnl Indicate that platform requires special thread safe +dnl locking when starting up the OJI JVM +dnl (see mozilla/modules/oji/src/nsJVMManager.cpp) +dnl ======================================================== +case "$target" in + *-hpux*) + AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP) + ;; +esac + +dnl ======================================================== +dnl = Flags to strip unused symbols from .so components +dnl ======================================================== +case "$target" in + *-linux*|*-kfreebsd*-gnu) + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' + ;; + *-solaris*) + if test -z "$GNU_CC"; then + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile' + else + if test -z "$GCC_USE_GNU_LD"; then + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile' + else + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' + fi + fi + ;; + *-nto*) + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' + ;; + *-darwin*) + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list' + ;; + *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince) + if test -n "$GNU_CC"; then + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' + fi + ;; +esac + +if test -z "$COMPILE_ENVIRONMENT"; then + SKIP_COMPILER_CHECKS=1 + SKIP_LIBRARY_CHECKS=1 +fi + +if test -z "$SKIP_COMPILER_CHECKS"; then +dnl Checks for typedefs, structures, and compiler characteristics. +dnl ======================================================== +AC_LANG_C +AC_HEADER_STDC +AC_C_CONST +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_STRUCT_ST_BLKSIZE +AC_MSG_CHECKING(for siginfo_t) +AC_CACHE_VAL(ac_cv_siginfo_t, + [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L + #include ], + [siginfo_t* info;], + [ac_cv_siginfo_t=true], + [ac_cv_siginfo_t=false])]) +if test "$ac_cv_siginfo_t" = true ; then + AC_DEFINE(HAVE_SIGINFO_T) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t. +dnl ======================================================== +AC_MSG_CHECKING(for int16_t) +AC_CACHE_VAL(ac_cv_int16_t, + [AC_TRY_COMPILE([#include + #include ], + [int16_t foo = 0;], + [ac_cv_int16_t=true], + [ac_cv_int16_t=false])]) +if test "$ac_cv_int16_t" = true ; then + AC_DEFINE(HAVE_INT16_T) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_MSG_CHECKING(for int32_t) +AC_CACHE_VAL(ac_cv_int32_t, + [AC_TRY_COMPILE([#include + #include ], + [int32_t foo = 0;], + [ac_cv_int32_t=true], + [ac_cv_int32_t=false])]) +if test "$ac_cv_int32_t" = true ; then + AC_DEFINE(HAVE_INT32_T) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_MSG_CHECKING(for int64_t) +AC_CACHE_VAL(ac_cv_int64_t, + [AC_TRY_COMPILE([#include + #include ], + [int64_t foo = 0;], + [ac_cv_int64_t=true], + [ac_cv_int64_t=false])]) +if test "$ac_cv_int64_t" = true ; then + AC_DEFINE(HAVE_INT64_T) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_MSG_CHECKING(for int64) +AC_CACHE_VAL(ac_cv_int64, + [AC_TRY_COMPILE([#include + #include ], + [int64 foo = 0;], + [ac_cv_int64=true], + [ac_cv_int64=false])]) +if test "$ac_cv_int64" = true ; then + AC_DEFINE(HAVE_INT64) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_MSG_CHECKING(for uint) +AC_CACHE_VAL(ac_cv_uint, + [AC_TRY_COMPILE([#include + #include ], + [uint foo = 0;], + [ac_cv_uint=true], + [ac_cv_uint=false])]) +if test "$ac_cv_uint" = true ; then + AC_DEFINE(HAVE_UINT) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_MSG_CHECKING(for uint_t) +AC_CACHE_VAL(ac_cv_uint_t, + [AC_TRY_COMPILE([#include + #include ], + [uint_t foo = 0;], + [ac_cv_uint_t=true], + [ac_cv_uint_t=false])]) +if test "$ac_cv_uint_t" = true ; then + AC_DEFINE(HAVE_UINT_T) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_MSG_CHECKING(for uint16_t) +AC_CACHE_VAL(ac_cv_uint16_t, + [AC_TRY_COMPILE([#include + #include ], + [uint16_t foo = 0;], + [ac_cv_uint16_t=true], + [ac_cv_uint16_t=false])]) +if test "$ac_cv_uint16_t" = true ; then + AC_DEFINE(HAVE_UINT16_T) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU, +dnl are defined when compiling C++ but not C. Since the result of this +dnl test is used only in C++, do it in C++. +AC_LANG_CPLUSPLUS + +AC_MSG_CHECKING(for uname.domainname) +AC_CACHE_VAL(ac_cv_have_uname_domainname_field, + [AC_TRY_COMPILE([#include ], + [ struct utsname *res; char *domain; + (void)uname(res); if (res != 0) { domain = res->domainname; } ], + [ac_cv_have_uname_domainname_field=true], + [ac_cv_have_uname_domainname_field=false])]) + +if test "$ac_cv_have_uname_domainname_field" = "true"; then + AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(for uname.__domainname) +AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field, + [AC_TRY_COMPILE([#include ], + [ struct utsname *res; char *domain; + (void)uname(res); if (res != 0) { domain = res->__domainname; } ], + [ac_cv_have_uname_us_domainname_field=true], + [ac_cv_have_uname_us_domainname_field=false])]) + +if test "$ac_cv_have_uname_us_domainname_field" = "true"; then + AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_LANG_C + +dnl Check for usable wchar_t (2 bytes, unsigned) +dnl (we really don't need the unsignedness check anymore) +dnl ======================================================== + +AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned), + ac_cv_have_usable_wchar_v2, + [AC_TRY_COMPILE([#include + $configure_static_assert_macros], + [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2); + CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)], + ac_cv_have_usable_wchar_v2="yes", + ac_cv_have_usable_wchar_v2="no")]) +if test "$ac_cv_have_usable_wchar_v2" = "yes"; then + AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T) + HAVE_CPP_2BYTE_WCHAR_T=1 +else +dnl This is really gcc-only +dnl Do this test using CXX only since some versions of gcc +dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions +dnl only have short-wchar support for c++. +dnl Note that we assume that mac & win32 have short wchar (see nscore.h) + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + _SAVE_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -fshort-wchar" + + AC_CACHE_CHECK(for compiler -fshort-wchar option, + ac_cv_have_usable_wchar_option_v2, + [AC_TRY_LINK([#include + $configure_static_assert_macros], + [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2); + CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)], + ac_cv_have_usable_wchar_option_v2="yes", + ac_cv_have_usable_wchar_option_v2="no")]) + + if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then + AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T) + HAVE_CPP_2BYTE_WCHAR_T=1 + WCHAR_CFLAGS="-fshort-wchar" + else + CXXFLAGS=$_SAVE_CXXFLAGS + fi + AC_LANG_RESTORE +fi + +dnl Check for .hidden assembler directive and visibility attribute. +dnl Borrowed from glibc configure.in +dnl =============================================================== +if test "$GNU_CC"; then + AC_CACHE_CHECK(for visibility(hidden) attribute, + ac_cv_visibility_hidden, + [cat > conftest.c </dev/null 2>&1; then + if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then + ac_cv_visibility_hidden=yes + fi + fi + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_hidden" = "yes"; then + AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE) + + AC_CACHE_CHECK(for visibility(default) attribute, + ac_cv_visibility_default, + [cat > conftest.c </dev/null 2>&1; then + if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then + ac_cv_visibility_default=yes + fi + fi + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_default" = "yes"; then + AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE) + + AC_CACHE_CHECK(for visibility pragma support, + ac_cv_visibility_pragma, + [cat > conftest.c </dev/null 2>&1; then + if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then + if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then + ac_cv_visibility_pragma=yes + fi + fi + fi + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_pragma" = "yes"; then + AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), + ac_cv_have_visibility_class_bug, + [cat > conftest.c < /dev/null 2>&1 ; then + ac_cv_have_visibility_class_bug=yes + else + if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then + ac_cv_have_visibility_class_bug=yes + fi + fi + rm -rf conftest.{c,S} + ]) + + AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), + ac_cv_have_visibility_builtin_bug, + [cat > conftest.c < +#pragma GCC visibility pop + +__attribute__ ((visibility ("default"))) void Func() { + char c[[100]]; + memset(c, 0, sizeof(c)); +} +EOF + ac_cv_have_visibility_builtin_bug=no + if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then + ac_cv_have_visibility_builtin_bug=yes + else + if test `grep -c "@PLT" conftest.S` = 0; then + ac_cv_visibility_builtin_bug=yes + fi + fi + rm -f conftest.{c,S} + ]) + if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ + "$ac_cv_have_visibility_class_bug" = "no"; then + VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' + WRAP_SYSTEM_INCLUDES=1 + else + VISIBILITY_FLAGS='-fvisibility=hidden' + fi # have visibility pragma bug + fi # have visibility pragma + fi # have visibility(default) attribute + fi # have visibility(hidden) attribute +fi # GNU_CC + +# visibility hidden flag for Sun Studio on Solaris +if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then +VISIBILITY_FLAGS='-xldscope=hidden' +fi # Sun Studio on Solaris + +AC_SUBST(WRAP_SYSTEM_INCLUDES) +AC_SUBST(VISIBILITY_FLAGS) + +dnl Checks for header files. +dnl ======================================================== +AC_HEADER_DIRENT +case "$target_os" in +freebsd*) +# for stuff like -lXshm + CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}" + ;; +esac +AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h) +AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h) +AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h) +AC_CHECK_HEADERS(malloc.h) +AC_CHECK_HEADERS(X11/XKBlib.h) + +dnl These are all the places some variant of statfs can be hiding. +AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h) + +dnl Try for MMX support +dnl NB - later gcc versions require -mmmx for this header to be successfully +dnl included (or another option which implies it, such as -march=pentium-mmx) +AC_CHECK_HEADERS(mmintrin.h) + +AC_MSG_CHECKING(for ARM SIMD support) +AC_TRY_COMPILE([], + [asm("uqadd8 r1, r1, r2");], + result="yes", result="no") +AC_MSG_RESULT("$result") +if test "$result" = "yes"; then + AC_DEFINE(HAVE_ARM_SIMD) + HAVE_ARM_SIMD=1 +fi +AC_SUBST(HAVE_ARM_SIMD) + +dnl Check whether the compiler supports the new-style C++ standard +dnl library headers (i.e. ) or needs the old "new.h" +AC_LANG_CPLUSPLUS +NEW_H=new.h +AC_CHECK_HEADER(new, [NEW_H=new]) +AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>) +AC_LANG_C + +AC_ARG_ENABLE(dtrace, + [ --enable-dtrace build with dtrace support if available (default=no)], + [enable_dtrace="yes"],) +if test "x$enable_dtrace" = "xyes"; then + AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1) + if test -n "$HAVE_DTRACE"; then + AC_DEFINE(INCLUDE_MOZILLA_DTRACE) + else + AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]); + fi +fi +AC_SUBST(HAVE_DTRACE) + +case $target in +*-aix4.3*|*-aix5*) + ;; +*) + AC_CHECK_HEADERS(sys/cdefs.h) + ;; +esac + +dnl Checks for libraries. +dnl ======================================================== +case $target in +*-hpux11.*) + ;; +*) + AC_CHECK_LIB(c_r, gethostbyname_r) + ;; +esac + +dnl We don't want to link with libdl even if it's present on OS X, since +dnl it's not used and not part of the default installation. +dnl The same goes for BeOS. +dnl We don't want to link against libm or libpthread on Darwin since +dnl they both are just symlinks to libSystem and explicitly linking +dnl against libSystem causes issues when debugging (see bug 299601). +case $target in +*-darwin*) + ;; +*-beos*) + ;; +*) + AC_CHECK_LIB(m, atan) + AC_CHECK_LIB(dl, dlopen, + AC_CHECK_HEADER(dlfcn.h, + LIBS="-ldl $LIBS" + AC_DEFINE(HAVE_LIBDL))) + ;; +esac + +_SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -D_GNU_SOURCE" +AC_CHECK_FUNCS(dladdr) +CFLAGS="$_SAVE_CFLAGS" + +if test ! "$GNU_CXX"; then + + case $target in + *-aix*) + AC_CHECK_LIB(C_r, demangle) + ;; + *) + AC_CHECK_LIB(C, demangle) + ;; + esac +fi +AC_CHECK_LIB(socket, socket) + +dnl ======================================================== +dnl = pthread support +dnl = Start by checking whether the system support pthreads +dnl ======================================================== +case "$target_os" in +darwin*) + USE_PTHREADS=1 + ;; +*) + MOZ_CHECK_PTHREADS(pthreads, + USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads", + MOZ_CHECK_PTHREADS(pthread, + USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", + MOZ_CHECK_PTHREADS(c_r, + USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", + MOZ_CHECK_PTHREADS(c, + USE_PTHREADS=1 + ) + ) + ) + ) + ;; +esac + +dnl ======================================================== +dnl Check the command line for --with-pthreads +dnl ======================================================== +MOZ_ARG_WITH_BOOL(pthreads, +[ --with-pthreads Force use of system pthread library with NSPR ], +[ if test "$USE_PTHREADS"x = x; then + AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]); +fi], + USE_PTHREADS= + _PTHREAD_LDFLAGS= +) + +dnl ======================================================== +dnl Do the platform specific pthread hackery +dnl ======================================================== +if test "$USE_PTHREADS"x != x +then + dnl + dnl See if -pthread is supported. + dnl + rm -f conftest* + ac_cv_have_dash_pthread=no + AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread) + echo 'int main() { return 0; }' | cat > conftest.c + ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 + if test $? -eq 0; then + if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then + ac_cv_have_dash_pthread=yes + case "$target_os" in + freebsd*) +# Freebsd doesn't use -pthread for compiles, it uses them for linking + ;; + *) + CFLAGS="$CFLAGS -pthread" + CXXFLAGS="$CXXFLAGS -pthread" + ;; + esac + fi + fi + rm -f conftest* + AC_MSG_RESULT($ac_cv_have_dash_pthread) + + dnl + dnl See if -pthreads is supported. + dnl + ac_cv_have_dash_pthreads=no + if test "$ac_cv_have_dash_pthread" = "no"; then + AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads) + echo 'int main() { return 0; }' | cat > conftest.c + ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 + if test $? -eq 0; then + if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then + ac_cv_have_dash_pthreads=yes + CFLAGS="$CFLAGS -pthreads" + CXXFLAGS="$CXXFLAGS -pthreads" + fi + fi + rm -f conftest* + AC_MSG_RESULT($ac_cv_have_dash_pthreads) + fi + + case "$target" in + *-*-freebsd*) + AC_DEFINE(_REENTRANT) + AC_DEFINE(_THREAD_SAFE) + dnl -pthread links in -lc_r, so don't specify it explicitly. + if test "$ac_cv_have_dash_pthread" = "yes"; then + _PTHREAD_LDFLAGS="-pthread" + else + _PTHREAD_LDFLAGS="-lc_r" + fi + ;; + + *-*-openbsd*|*-*-bsdi*) + AC_DEFINE(_REENTRANT) + AC_DEFINE(_THREAD_SAFE) + dnl -pthread links in -lc_r, so don't specify it explicitly. + if test "$ac_cv_have_dash_pthread" = "yes"; then + _PTHREAD_LDFLAGS="-pthread" + fi + ;; + + *-*-linux*|*-*-kfreebsd*-gnu) + AC_DEFINE(_REENTRANT) + ;; + + *-*-nto*) + AC_DEFINE(_REENTRANT) + ;; + + *-aix4.3*|*-aix5*) + AC_DEFINE(_REENTRANT) + ;; + + *-hpux11.*) + AC_DEFINE(_REENTRANT) + ;; + + alpha*-*-osf*) + AC_DEFINE(_REENTRANT) + ;; + + *-*-solaris*) + AC_DEFINE(_REENTRANT) + if test ! "$GNU_CC"; then + CFLAGS="$CFLAGS -mt" + CXXFLAGS="$CXXFLAGS -mt" + fi + ;; + esac + LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}" +fi + +dnl ======================================================== +dnl See if mmap sees writes +dnl For cross compiling, just define it as no, which is a safe default +dnl ======================================================== +AC_MSG_CHECKING(whether mmap() sees write()s) + +changequote(,) +mmap_test_prog=' + #include + #include + #include + #include + #include + #include + + char fname[] = "conftest.file"; + char zbuff[1024]; /* Fractional page is probably worst case */ + + int main() { + char *map; + int fd; + int i; + unlink(fname); + fd = open(fname, O_RDWR | O_CREAT, 0660); + if(fd<0) return 1; + unlink(fname); + write(fd, zbuff, sizeof(zbuff)); + lseek(fd, 0, SEEK_SET); + map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0); + if(map==(char*)-1) return 2; + for(i=0; fname[i]; i++) { + int rc = write(fd, &fname[i], 1); + if(map[i]!=fname[i]) return 4; + } + return 0; + } +' +changequote([,]) + +AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes") + +AC_MSG_RESULT("$result") + +if test "$result" = "no"; then + AC_DEFINE(MMAP_MISSES_WRITES) +fi + + +dnl Checks for library functions. +dnl ======================================================== +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MEMCMP +AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64) +AC_CHECK_FUNCS(flockfile getpagesize) + +dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher +if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then + AC_CHECK_FUNCS(localtime_r strtok_r) +fi + +dnl check for wcrtomb/mbrtowc +dnl ======================================================================= +if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_CACHE_CHECK(for wcrtomb, + ac_cv_have_wcrtomb, + [AC_TRY_LINK([#include ], + [mbstate_t ps={0};wcrtomb(0,'f',&ps);], + ac_cv_have_wcrtomb="yes", + ac_cv_have_wcrtomb="no")]) +if test "$ac_cv_have_wcrtomb" = "yes"; then + AC_DEFINE(HAVE_WCRTOMB) +fi +AC_CACHE_CHECK(for mbrtowc, + ac_cv_have_mbrtowc, + [AC_TRY_LINK([#include ], + [mbstate_t ps={0};mbrtowc(0,0,0,&ps);], + ac_cv_have_mbrtowc="yes", + ac_cv_have_mbrtowc="no")]) +if test "$ac_cv_have_mbrtowc" = "yes"; then + AC_DEFINE(HAVE_MBRTOWC) +fi +AC_LANG_RESTORE +fi + +AC_CACHE_CHECK( + [for res_ninit()], + ac_cv_func_res_ninit, + [AC_TRY_LINK([ + #ifdef linux + #define _BSD_SOURCE 1 + #endif + #include + ], + [int foo = res_ninit(&_res);], + [ac_cv_func_res_ninit=yes], + [ac_cv_func_res_ninit=no]) + ]) + +if test "$ac_cv_func_res_ninit" = "yes"; then + AC_DEFINE(HAVE_RES_NINIT) +dnl must add the link line we do something as foolish as this... dougt +dnl else +dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT), +dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT))) +fi + +AC_LANG_CPLUSPLUS +AC_CACHE_CHECK( + [for gnu_get_libc_version()], + ac_cv_func_gnu_get_libc_version, + [AC_TRY_LINK([ + #ifdef HAVE_GNU_LIBC_VERSION_H + #include + #endif + ], + [const char *glibc_version = gnu_get_libc_version();], + [ac_cv_func_gnu_get_libc_version=yes], + [ac_cv_func_gnu_get_libc_version=no] + )] + ) + +if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then + AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION) +fi + +case $target_os in + os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*) + ;; + *) + +AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"], + AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"], + AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"]))) +_SAVE_LIBS=$LIBS +LIBS="$LIBS $_ICONV_LIBS" +AC_CACHE_CHECK( + [for iconv()], + ac_cv_func_iconv, + [AC_TRY_LINK([ + #include + #include + ], + [ + iconv_t h = iconv_open("", ""); + iconv(h, NULL, NULL, NULL, NULL); + iconv_close(h); + ], + [ac_cv_func_iconv=yes], + [ac_cv_func_iconv=no] + )] + ) +if test "$ac_cv_func_iconv" = "yes"; then + AC_DEFINE(HAVE_ICONV) + DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS" + LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS" + LIBICONV="$_ICONV_LIBS" + AC_CACHE_CHECK( + [for iconv() with const input], + ac_cv_func_const_iconv, + [AC_TRY_COMPILE([ + #include + #include + ], + [ + const char *input = "testing"; + iconv_t h = iconv_open("", ""); + iconv(h, &input, NULL, NULL, NULL); + iconv_close(h); + ], + [ac_cv_func_const_iconv=yes], + [ac_cv_func_const_iconv=no] + )] + ) + if test "$ac_cv_func_const_iconv" = "yes"; then + AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT) + fi +fi +LIBS=$_SAVE_LIBS + + ;; +esac + +AC_LANG_C + +dnl ********************** +dnl *** va_copy checks *** +dnl ********************** +dnl we currently check for all three va_copy possibilities, so we get +dnl all results in config.log for bug reports. +AC_MSG_CHECKING(for an implementation of va_copy()) +AC_CACHE_VAL(ac_cv_va_copy,[ + AC_TRY_RUN([ + #include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + va_copy (args2, args1); + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { f (0, 42); return 0; }], + ac_cv_va_copy=yes, + ac_cv_va_copy=no, + ac_cv_va_copy=no + ) +]) +AC_MSG_RESULT($ac_cv_va_copy) +AC_MSG_CHECKING(for an implementation of __va_copy()) +AC_CACHE_VAL(ac_cv___va_copy,[ + AC_TRY_RUN([ + #include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + __va_copy (args2, args1); + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { f (0, 42); return 0; }], + ac_cv___va_copy=yes, + ac_cv___va_copy=no, + ac_cv___va_copy=no + ) +]) +AC_MSG_RESULT($ac_cv___va_copy) +AC_MSG_CHECKING(whether va_lists can be copied by value) +AC_CACHE_VAL(ac_cv_va_val_copy,[ + AC_TRY_RUN([ + #include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + args2 = args1; + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { f (0, 42); return 0; }], + ac_cv_va_val_copy=yes, + ac_cv_va_val_copy=no, + ac_cv_va_val_copy=yes + ) +]) +if test "x$ac_cv_va_copy" = "xyes"; then + AC_DEFINE(VA_COPY, va_copy) + AC_DEFINE(HAVE_VA_COPY) +elif test "x$ac_cv___va_copy" = "xyes"; then + AC_DEFINE(VA_COPY, __va_copy) + AC_DEFINE(HAVE_VA_COPY) +fi + +if test "x$ac_cv_va_val_copy" = "xno"; then + AC_DEFINE(HAVE_VA_LIST_AS_ARRAY) +fi +AC_MSG_RESULT($ac_cv_va_val_copy) + +dnl Check for dll-challenged libc's. +dnl This check is apparently only needed for Linux. +case "$target" in + *-linux*) + dnl =================================================================== + _curdir=`pwd` + export _curdir + rm -rf conftest* _conftest + mkdir _conftest + cat >> conftest.C <<\EOF +#include +#include +#include +#ifdef _dl_loaded +void __dump_link_map(void) { + struct link_map *map = _dl_loaded; + while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;} +} +int main() { + dlopen("./conftest1.so",RTLD_LAZY); + dlopen("./../_conftest/conftest1.so",RTLD_LAZY); + dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY); + dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY); + __dump_link_map(); +} +#else +/* _dl_loaded isn't defined, so this should be either a libc5 (glibc1) system, or a glibc2 system that doesn't have the multiple load bug (i.e., RH6.0).*/ +int main() { printf("./conftest1.so\n"); } +#endif +EOF + + $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C + + cat >> conftest1.C <<\EOF +#include +void foo(void) {printf("foo in dll called\n");} +EOF + ${CXX-g++} -fPIC -c -g conftest1.C + ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o + ${CXX-g++} -g conftest.C -o conftest -ldl + cp -f conftest1.so conftest _conftest + cd _conftest + if test `./conftest | grep conftest1.so | wc -l` -gt 1 + then + echo + echo "*** Your libc has a bug that can result in loading the same dynamic" + echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32" + echo "*** or later. However, if you choose not to upgrade, the only effect" + echo "*** will be excessive memory usage at runtime." + echo + fi + cd ${_curdir} + rm -rf conftest* _conftest + dnl =================================================================== + ;; +esac + +dnl =================================================================== +dnl ======================================================== +dnl By default, turn rtti and exceptions off on g++/egcs +dnl ======================================================== +if test "$GNU_CXX"; then + + AC_MSG_CHECKING(for C++ exceptions flag) + + dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8 + AC_CACHE_VAL(ac_cv_cxx_exceptions_flags, + [echo "int main() { return 0; }" | cat > conftest.C + + ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1 + + if egrep "warning.*renamed" conftest.out >/dev/null; then + ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions + else + ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions + fi + + rm -f conftest*]) + + AC_MSG_RESULT($ac_cv_cxx_exceptions_flags) + _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags + _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'` +fi + +dnl ======================================================== +dnl Put your C++ language/feature checks below +dnl ======================================================== +AC_LANG_CPLUSPLUS + +HAVE_GCC3_ABI= +if test "$GNU_CC"; then + AC_CACHE_CHECK(for gcc 3.0 ABI, + ac_cv_gcc_three_abi, + [AC_TRY_COMPILE([], + [ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + return 0; +#else +#error Not gcc3. +#endif + ], + ac_cv_gcc_three_abi="yes", + ac_cv_gcc_three_abi="no")]) + if test "$ac_cv_gcc_three_abi" = "yes"; then + TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}" + HAVE_GCC3_ABI=1 + else + TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}" + fi +fi +AC_SUBST(HAVE_GCC3_ABI) + + +AC_CACHE_CHECK(for C++ \"explicit\" keyword, + ac_cv_cpp_explicit, + [AC_TRY_COMPILE(class X { + public: explicit X(int i) : i_(i) {} + private: int i_; + };, + X x(3);, + ac_cv_cpp_explicit=yes, + ac_cv_cpp_explicit=no)]) +if test "$ac_cv_cpp_explicit" = yes ; then + AC_DEFINE(HAVE_CPP_EXPLICIT) +fi + +AC_CACHE_CHECK(for C++ \"typename\" keyword, + ac_cv_cpp_typename, + [AC_TRY_COMPILE(class param { + public: + typedef unsigned long num_type; + }; + + template class tplt { + public: + typedef typename T::num_type t_num_type; + t_num_type foo(typename T::num_type num) { + return num; + } + };, + tplt A; + A.foo(0);, + ac_cv_cpp_typename=yes, + ac_cv_cpp_typename=no)]) +if test "$ac_cv_cpp_typename" = yes ; then + AC_DEFINE(HAVE_CPP_TYPENAME) +fi + +dnl Check for support of modern template specialization syntax +dnl Test code and requirement from scc@netscape.com. +dnl Autoconf cut-and-paste job by waterson@netscape.com +AC_CACHE_CHECK(for modern C++ template specialization syntax support, + ac_cv_cpp_modern_specialize_template_syntax, + [AC_TRY_COMPILE(template struct X { int a; }; + class Y {}; + template <> struct X { double a; };, + X int_x; + X y_x;, + ac_cv_cpp_modern_specialize_template_syntax=yes, + ac_cv_cpp_modern_specialize_template_syntax=no)]) +if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then + AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX) +fi + + +dnl Some compilers support only full specialization, and some don't. +AC_CACHE_CHECK(whether partial template specialization works, + ac_cv_cpp_partial_specialization, + [AC_TRY_COMPILE(template class Foo {}; + template class Foo {};, + return 0;, + ac_cv_cpp_partial_specialization=yes, + ac_cv_cpp_partial_specialization=no)]) +if test "$ac_cv_cpp_partial_specialization" = yes ; then + AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION) +fi + +dnl Some compilers have limited support for operators with templates; +dnl specifically, it is necessary to define derived operators when a base +dnl class's operator declaration should suffice. +AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates, + ac_cv_need_derived_template_operators, + [AC_TRY_COMPILE([template class Base { }; + template + Base operator+(const Base& lhs, const Base& rhs) { return lhs; } + template class Derived : public Base { };], + [Derived a, b; + Base c = a + b; + return 0;], + ac_cv_need_derived_template_operators=no, + ac_cv_need_derived_template_operators=yes)]) +if test "$ac_cv_need_derived_template_operators" = yes ; then + AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS) +fi + + +dnl Some compilers have trouble detecting that a template class +dnl that derives from another template is actually an instance +dnl of the base class. This test checks for that. +AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class, + ac_cv_need_cpp_template_cast_to_base, + [AC_TRY_COMPILE([template class Base { }; + template class Derived : public Base { }; + template int foo(const Base&) { return 0; }], + [Derived bar; return foo(bar);], + ac_cv_need_cpp_template_cast_to_base=no, + ac_cv_need_cpp_template_cast_to_base=yes)]) +if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then + AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE) +fi + +dnl Some compilers have trouble resolving the ambiguity between two +dnl functions whose arguments differ only by cv-qualifications. +AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates, + ac_cv_can_resolve_const_ambiguity, + [AC_TRY_COMPILE([ + template class ptrClass { + public: T* ptr; + }; + + template T* a(ptrClass *arg) { + return arg->ptr; + } + + template + const T* a(const ptrClass *arg) { + return arg->ptr; + } + ], + [ ptrClass i; + a(&i); ], + ac_cv_can_resolve_const_ambiguity=yes, + ac_cv_can_resolve_const_ambiguity=no)]) +if test "$ac_cv_can_resolve_const_ambiguity" = no ; then + AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY) +fi + +dnl +dnl We don't do exceptions on unix. The only reason this used to be here +dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses +dnl exceptions. But, we turn exceptions off by default and this test breaks. +dnl So im commenting this out until someone writes some artificial +dnl intelligence to detect not only if the compiler has exceptions, but if +dnl they are enabled as well. +dnl +dnl AC_CACHE_CHECK(for C++ \"exceptions\", +dnl ac_cv_cpp_exceptions, +dnl [AC_TRY_COMPILE(class X { public: X() {} }; +dnl static void F() { throw X(); }, +dnl try { F(); } catch(X & e) { }, +dnl ac_cv_cpp_exceptions=yes, +dnl ac_cv_cpp_exceptions=no)]) +dnl if test $ac_cv_cpp_exceptions = yes ; then +dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS) +dnl fi + +dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3 +dnl supports it well enough to allow us to use it to change access, but not +dnl to resolve ambiguity. The next two tests determine how well the |using| +dnl keyword is supported. +dnl +dnl Check to see if we can change access with |using|. Test both a +dnl legal and an illegal example. +AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access, + ac_cv_cpp_access_changing_using2, + [AC_TRY_COMPILE( + class A { protected: int foo() { return 0; } }; + class B : public A { public: using A::foo; };, + B b; return b.foo();, + [AC_TRY_COMPILE( + class A { public: int foo() { return 1; } }; + class B : public A { private: using A::foo; };, + B b; return b.foo();, + ac_cv_cpp_access_changing_using2=no, + ac_cv_cpp_access_changing_using2=yes)], + ac_cv_cpp_access_changing_using2=no)]) +if test "$ac_cv_cpp_access_changing_using2" = yes ; then + AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING) +fi + +dnl Check to see if we can resolve ambiguity with |using|. +AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity, + ac_cv_cpp_ambiguity_resolving_using, + [AC_TRY_COMPILE(class X { + public: int go(const X&) {return 3;} + int jo(const X&) {return 3;} + }; + class Y : public X { + public: int go(int) {return 2;} + int jo(int) {return 2;} + using X::jo; + private: using X::go; + };, + X x; Y y; y.jo(x);, + ac_cv_cpp_ambiguity_resolving_using=yes, + ac_cv_cpp_ambiguity_resolving_using=no)]) +if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then + AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING) +fi + +dnl Check to see if the |std| namespace is supported. If so, we'll want +dnl to qualify any standard library calls with "std::" to ensure that +dnl those functions can be resolved. +AC_CACHE_CHECK(for \"std::\" namespace, + ac_cv_cpp_namespace_std, + [AC_TRY_COMPILE([#include ], + [return std::min(0, 1);], + ac_cv_cpp_namespace_std=yes, + ac_cv_cpp_namespace_std=no)]) +if test "$ac_cv_cpp_namespace_std" = yes ; then + AC_DEFINE(HAVE_CPP_NAMESPACE_STD) +fi + +dnl Older compilers are overly ambitious with respect to using the standard +dnl template library's |operator!=()| when |operator==()| is defined. In +dnl which case, defining |operator!=()| in addition to |operator==()| causes +dnl ambiguity at compile-time. This test checks for that case. +AC_CACHE_CHECK(whether standard template operator!=() is ambiguous, + ac_cv_cpp_unambiguous_std_notequal, + [AC_TRY_COMPILE([#include + struct T1 {}; + int operator==(const T1&, const T1&) { return 0; } + int operator!=(const T1&, const T1&) { return 0; }], + [T1 a,b; return a != b;], + ac_cv_cpp_unambiguous_std_notequal=unambiguous, + ac_cv_cpp_unambiguous_std_notequal=ambiguous)]) +if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then + AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL) +fi + + +AC_CACHE_CHECK(for C++ reinterpret_cast, + ac_cv_cpp_reinterpret_cast, + [AC_TRY_COMPILE(struct X { int i; }; + struct Y { int i; };, + X x; X*const z = &x;Y*y = reinterpret_cast(z);, + ac_cv_cpp_reinterpret_cast=yes, + ac_cv_cpp_reinterpret_cast=no)]) +if test "$ac_cv_cpp_reinterpret_cast" = yes ; then + AC_DEFINE(HAVE_CPP_NEW_CASTS) +fi + +dnl See if a dynamic_cast to void* gives the most derived object. +AC_CACHE_CHECK(for C++ dynamic_cast to void*, + ac_cv_cpp_dynamic_cast_void_ptr, + [AC_TRY_RUN([class X { int i; public: virtual ~X() { } }; + class Y { int j; public: virtual ~Y() { } }; + class Z : public X, public Y { int k; }; + + int main() { + Z mdo; + X *subx = (X*)&mdo; + Y *suby = (Y*)&mdo; + return !((((void*)&mdo != (void*)subx) && + ((void*)&mdo == dynamic_cast(subx))) || + (((void*)&mdo != (void*)suby) && + ((void*)&mdo == dynamic_cast(suby)))); + }], + ac_cv_cpp_dynamic_cast_void_ptr=yes, + ac_cv_cpp_dynamic_cast_void_ptr=no, + ac_cv_cpp_dynamic_cast_void_ptr=no)]) +if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then + AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR) +fi + + +dnl note that this one is reversed - if the test fails, then +dnl we require implementations of unused virtual methods. Which +dnl really blows because it means we'll have useless vtable +dnl bloat. +AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods, + ac_cv_cpp_unused_required, + [AC_TRY_LINK(class X {private: virtual void never_called();};, + X x;, + ac_cv_cpp_unused_required=no, + ac_cv_cpp_unused_required=yes)]) +if test "$ac_cv_cpp_unused_required" = yes ; then + AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS) +fi + + +dnl Some compilers have trouble comparing a constant reference to a templatized +dnl class to zero, and require an explicit operator==() to be defined that takes +dnl an int. This test separates the strong from the weak. + +AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(), + ac_cv_trouble_comparing_to_zero, + [AC_TRY_COMPILE([#include + template class Foo {}; + class T2; + template int operator==(const T2*, const T&) { return 0; } + template int operator!=(const T2*, const T&) { return 0; }], + [Foo f; return (0 != f);], + ac_cv_trouble_comparing_to_zero=no, + ac_cv_trouble_comparing_to_zero=yes)]) +if test "$ac_cv_trouble_comparing_to_zero" = yes ; then + AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO) +fi + + + +dnl End of C++ language/feature checks +AC_LANG_C + +dnl ======================================================== +dnl = Internationalization checks +dnl ======================================================== +dnl +dnl Internationalization and Locale support is different +dnl on various UNIX platforms. Checks for specific i18n +dnl features go here. + +dnl check for LC_MESSAGES +AC_CACHE_CHECK(for LC_MESSAGES, + ac_cv_i18n_lc_messages, + [AC_TRY_COMPILE([#include ], + [int category = LC_MESSAGES;], + ac_cv_i18n_lc_messages=yes, + ac_cv_i18n_lc_messages=no)]) +if test "$ac_cv_i18n_lc_messages" = yes; then + AC_DEFINE(HAVE_I18N_LC_MESSAGES) +fi + +fi # SKIP_COMPILER_CHECKS + +TARGET_XPCOM_ABI= +if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then + TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}" +fi + +dnl Mozilla specific options +dnl ======================================================== +dnl The macros used for command line options +dnl are defined in build/autoconf/altoptions.m4. + + +dnl ======================================================== +dnl = +dnl = Check for external package dependencies +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(External Packages) + +dnl ======================================================== +dnl = Find the right NSPR to use. +dnl ======================================================== +MOZ_ARG_WITH_BOOL(system-nspr, +[ --with-system-nspr Use an NSPR that is already built and installed. + Use the 'nspr-config' script in the current path, + or look for the script in the directories given with + --with-nspr-exec-prefix or --with-nspr-prefix.], + _USE_SYSTEM_NSPR=1 ) + +MOZ_ARG_WITH_STRING(nspr-cflags, +[ --with-nspr-cflags=FLAGS Pass FLAGS to CC when building code that uses NSPR. + Use this when there's no accurate nspr-config + script available. This is the case when building + SpiderMonkey as part of the Mozilla tree: the + top-level configure script computes NSPR flags + that accomodate the quirks of that environment.], + NSPR_CFLAGS=$withval) +MOZ_ARG_WITH_STRING(nspr-libs, +[ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR. + See --with-nspr-cflags for more details.], + NSPR_LIBS=$withval) +AC_SUBST(NSPR_CFLAGS) +AC_SUBST(NSPR_LIBS) + +dnl Pass either --with-system-nspr or (--with-nspr-cflags and +dnl --with-nspr-libs), but not both. +if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" || test "$NSPR_LIBS"); then + AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive. +See 'configure --help'.]) +fi + +if test -n "$_USE_SYSTEM_NSPR"; then + MOZ_NATIVE_NSPR= + AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1]) + if test -z "$MOZ_NATIVE_NSPR"; then + AC_MSG_ERROR([--with-system-nspr given, but configure could not find a suitable NSPR. +Pass --with-nspr-exec-prefix, --with-nspr-prefix, or --with-nspr-cflags/libs. +See 'configure --help'.]) + fi +fi + +if test -n "$MOZ_NATIVE_NSPR"; then + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $NSPR_CFLAGS" + AC_TRY_COMPILE([#include "prlog.h"], + [#ifndef PR_STATIC_ASSERT + #error PR_STATIC_ASSERT not defined + #endif], + [MOZ_NATIVE_NSPR=1], + AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT])) + CFLAGS=$_SAVE_CFLAGS +fi + +dnl ======================================================== +dnl Use ARM userspace kernel helpers; tell NSPR to enable +dnl their usage and use them in spidermonkey. +dnl ======================================================== +MOZ_ARG_WITH_BOOL(arm-kuser, +[ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)], + USE_ARM_KUSER=1, + USE_ARM_KUSER=) +if test -n "$USE_ARM_KUSER"; then + AC_DEFINE(USE_ARM_KUSER) +fi + +dnl ======================================================== +dnl = +dnl = Application +dnl = +dnl ======================================================== + +MOZ_ARG_HEADER(Application) + +BUILD_STATIC_LIBS= +ENABLE_TESTS=1 +MOZ_DBGRINFO_MODULES= +JS_STATIC_BUILD= + +dnl ======================================================== +dnl = +dnl = Components & Features +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Components and Features) + +dnl ======================================================== +dnl = Localization +dnl ======================================================== +MOZ_ARG_ENABLE_STRING(ui-locale, +[ --enable-ui-locale=ab-CD + Select the user interface locale (default: en-US)], + MOZ_UI_LOCALE=$enableval ) +AC_SUBST(MOZ_UI_LOCALE) + +dnl ======================================================== +dnl build the tests by default +dnl ======================================================== +MOZ_ARG_DISABLE_BOOL(tests, +[ --disable-tests Do not build test libraries & programs], + ENABLE_TESTS=, + ENABLE_TESTS=1 ) + +dnl ======================================================== +dnl = +dnl = Module specific options +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Individual module options) + +dnl ======================================================== +dnl = Enable Ultrasparc specific optimizations for JS +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(js-ultrasparc, +[ --enable-js-ultrasparc Use UltraSPARC optimizations in JS], + JS_ULTRASPARC_OPTS=1, + JS_ULTRASPARC_OPTS= ) + +dnl only enable option for ultrasparcs +if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \ + "$OS_TEST" != "sun4u"; then + JS_ULTRASPARC_OPTS= +fi +AC_SUBST(JS_ULTRASPARC_OPTS) + +dnl ======================================================== +dnl = +dnl = Debugging Options +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Debugging and Optimizations) + +dnl ======================================================== +dnl = Disable building with debug info. +dnl = Debugging is OFF by default +dnl ======================================================== +if test -z "$MOZ_DEBUG_FLAGS" +then + case "$target" in + *-irix*) + if test "$GNU_CC"; then + GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'` + case "$GCC_VERSION" in + 2.95.*) + MOZ_DEBUG_FLAGS="" + ;; + *) + MOZ_DEBUG_FLAGS="-g" + ;; + esac + else + MOZ_DEBUG_FLAGS="-g" + fi + ;; + *) + MOZ_DEBUG_FLAGS="-g" + ;; + esac +fi + +MOZ_ARG_ENABLE_STRING(debug, +[ --enable-debug[=DBG] Enable building with developer debug info + (Using compiler flags DBG)], +[ if test "$enableval" != "no"; then + MOZ_DEBUG=1 + if test -n "$enableval" && test "$enableval" != "yes"; then + MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + fi + else + MOZ_DEBUG= + fi ], + MOZ_DEBUG=) + +MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG" + case "${target_os}" in + beos*) + MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}" + ;; + msvc*|mks*|cygwin*|mingw*|os2*|wince*) + MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`" + ;; + *) + MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`" + ;; + esac +MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING" + +MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED" + +if test -n "$MOZ_DEBUG"; then + AC_MSG_CHECKING([for valid debug flags]) + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS" + AC_TRY_COMPILE([#include ], + [printf("Hello World\n");], + _results=yes, + _results=no) + AC_MSG_RESULT([$_results]) + if test "$_results" = "no"; then + AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS]) + fi + CFLAGS=$_SAVE_CFLAGS +fi + +dnl ======================================================== +dnl = Enable code optimization. ON by default. +dnl ======================================================== +if test -z "$MOZ_OPTIMIZE_FLAGS"; then + MOZ_OPTIMIZE_FLAGS="-O" +fi + +MOZ_ARG_ENABLE_STRING(optimize, +[ --disable-optimize Disable compiler optimization + --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]], +[ if test "$enableval" != "no"; then + MOZ_OPTIMIZE=1 + if test -n "$enableval" && test "$enableval" != "yes"; then + MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'` + MOZ_OPTIMIZE=2 + fi +else + MOZ_OPTIMIZE= +fi ], MOZ_OPTIMIZE=1) + +if test "$COMPILE_ENVIRONMENT"; then +if test -n "$MOZ_OPTIMIZE"; then + AC_MSG_CHECKING([for valid optimization flags]) + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS" + AC_TRY_COMPILE([#include ], + [printf("Hello World\n");], + _results=yes, + _results=no) + AC_MSG_RESULT([$_results]) + if test "$_results" = "no"; then + AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS]) + fi + CFLAGS=$_SAVE_CFLAGS +fi +fi # COMPILE_ENVIRONMENT + +AC_SUBST(MOZ_OPTIMIZE) +AC_SUBST(MOZ_OPTIMIZE_FLAGS) +AC_SUBST(MOZ_OPTIMIZE_LDFLAGS) +AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK) + +dnl ======================================================== +dnl = Enable/disable debug for specific modules only +dnl = module names beginning with ^ will be disabled +dnl ======================================================== +MOZ_ARG_ENABLE_STRING(debug-modules, +[ --enable-debug-modules Enable/disable debug info for specific modules], +[ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] ) + +dnl ======================================================== +dnl = Enable/disable generation of debugger info for specific modules only +dnl = the special module name ALL_MODULES can be used to denote all modules +dnl = module names beginning with ^ will be disabled +dnl ======================================================== +MOZ_ARG_ENABLE_STRING(debugger-info-modules, +[ --enable-debugger-info-modules + Enable/disable debugger info for specific modules], +[ for i in `echo $enableval | sed 's/,/ /g'`; do + dnl note that the list of module names is reversed as it is copied + dnl this is important, as it will allow config.mk to interpret stuff like + dnl "^ALL_MODULES xpcom" properly + if test "$i" = "no"; then + i="^ALL_MODULES" + fi + if test "$i" = "yes"; then + i="ALL_MODULES" + fi + MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES"; + done ]) + +dnl ======================================================== +dnl Enable garbage collector +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(boehm, +[ --enable-boehm Enable the Boehm Garbage Collector], + GC_LEAK_DETECTOR=1, + GC_LEAK_DETECTOR= ) +if test -n "$GC_LEAK_DETECTOR"; then + AC_DEFINE(GC_LEAK_DETECTOR) +fi + +dnl ======================================================== +dnl = Enable trace malloc +dnl ======================================================== +NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC} +MOZ_ARG_ENABLE_BOOL(trace-malloc, +[ --enable-trace-malloc Enable malloc tracing], + NS_TRACE_MALLOC=1, + NS_TRACE_MALLOC= ) +if test "$NS_TRACE_MALLOC"; then + # Please, Mr. Linker Man, don't take away our symbol names + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS= + USE_ELF_DYNSTR_GC= + AC_DEFINE(NS_TRACE_MALLOC) +fi +AC_SUBST(NS_TRACE_MALLOC) + +dnl ======================================================== +dnl = Enable jemalloc +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(jemalloc, +[ --enable-jemalloc Replace memory allocator with jemalloc], + MOZ_MEMORY=1, + MOZ_MEMORY=) + +if test "$NS_TRACE_MALLOC"; then + MOZ_MEMORY= +fi + +if test "$MOZ_MEMORY"; then + + dnl Don't try to run compiler tests on Windows + if test "$OS_ARCH" = "WINNT"; then + if test -z "$HAVE_64BIT_OS"; then + AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2) + else + AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3) + fi + else + AC_CHECK_SIZEOF([int *], [4]) + case "${ac_cv_sizeof_int_p}" in + 4) + AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2) + ;; + 8) + AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3) + ;; + *) + AC_MSG_ERROR([Unexpected pointer size]) + ;; + esac + fi + + AC_DEFINE(MOZ_MEMORY) + if test "x$MOZ_DEBUG" = "x1"; then + AC_DEFINE(MOZ_MEMORY_DEBUG) + fi + dnl The generic feature tests that determine how to compute ncpus are long and + dnl complicated. Therefore, simply define special cpp variables for the + dnl platforms we have special knowledge of. + case "${target_os}" in + darwin*) + AC_DEFINE(MOZ_MEMORY_DARWIN) + ;; + *freebsd*) + AC_DEFINE(MOZ_MEMORY_BSD) + ;; + *linux*) + AC_DEFINE(MOZ_MEMORY_LINUX) + ;; + netbsd*) + AC_DEFINE(MOZ_MEMORY_BSD) + ;; + solaris*) + AC_DEFINE(MOZ_MEMORY_SOLARIS) + ;; + msvc*|mks*|cygwin*|mingw*) + AC_DEFINE(MOZ_MEMORY_WINDOWS) + dnl XXX: should test for vc8sp1 here, otherwise patching the crt src + dnl will fail miserably + if test "$_CC_SUITE" -lt "8"; then + AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better]) + fi + if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then + if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then + AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.]) + else + WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src" + fi + fi + if test -z "$WIN32_CRT_SRC_DIR"; then + # pre-built dll + WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd` + _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR" + else + # CRT source directory + WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd` + _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"` + _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel" + fi + dnl need win32 paths in LIB, hence this python abuse. extra brackets + dnl are to avoid m4 + _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`] + MOZ_LIB="$_WIN_CRT_PATH;$LIB" + dnl Needs to be in PATH too, since our tools will wind up linked against it. + dnl This needs to be unix style. + MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH" + dnl Statically link the C++ stdlib. We only use this for Breakpad anyway. + AC_DEFINE(_STATIC_CPPLIB) + dnl Don't generate a manifest, since we're linking to a custom CRT. + LDFLAGS="$LDFLAGS -MANIFEST:NO" + dnl Also pass this to NSPR/NSS + DLLFLAGS="$DLLFLAGS -MANIFEST:NO" + export DLLFLAGS + ;; + *) + AC_MSG_ERROR([--enable-jemalloc not supported on ${target}]) + ;; + esac + + AC_ARG_WITH([valgrind], + [ --with-valgrind Enable valgrind integration hooks], + [enable_valgrind="yes"], [enable_valgrind="no"]) + AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"]) + if test "x$enable_valgrind" = "xyes" ; then + AC_DEFINE(MOZ_VALGRIND) + fi +fi +AC_SUBST(MOZ_MEMORY) +AC_SUBST(WIN32_CRT_SRC_DIR) +AC_SUBST(WIN32_CUSTOM_CRT_DIR) +AC_SUBST(MOZ_LIB) +AC_SUBST(MOZ_PATH) +dnl Need to set this for make because NSS doesn't have configure +AC_SUBST(DLLFLAGS) + +dnl ======================================================== +dnl = Use malloc wrapper lib +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(wrap-malloc, +[ --enable-wrap-malloc Wrap malloc calls (gnu linker only)], + _WRAP_MALLOC=1, + _WRAP_MALLOC= ) + +if test -n "$_WRAP_MALLOC"; then + if test "$GNU_CC"; then + WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc" + MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@' + fi +fi + +dnl ======================================================== +dnl = Location of malloc wrapper lib +dnl ======================================================== +MOZ_ARG_WITH_STRING(wrap-malloc, +[ --with-wrap-malloc=DIR Location of malloc wrapper library], + WRAP_MALLOC_LIB=$withval) + +dnl ======================================================== +dnl = Use Electric Fence +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(efence, +[ --enable-efence Link with Electric Fence], + _ENABLE_EFENCE=1, + _ENABLE_EFENCE= ) +if test -n "$_ENABLE_EFENCE"; then + AC_CHECK_LIB(efence,malloc) +fi + +dnl ======================================================== +dnl jprof +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(jprof, +[ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)], + MOZ_JPROF=1, + MOZ_JPROF= ) +if test -n "$MOZ_JPROF"; then + AC_DEFINE(MOZ_JPROF) +fi + +dnl ======================================================== +dnl shark +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(shark, +[ --enable-shark Enable shark remote profiling (needs CHUD framework)], + MOZ_SHARK=1, + MOZ_SHARK= ) +if test -n "$MOZ_SHARK"; then + AC_DEFINE(MOZ_SHARK) +fi + +dnl ======================================================== +dnl callgrind +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(callgrind, +[ --enable-callgrind Enable callgrind profiling], + MOZ_CALLGRIND=1, + MOZ_CALLGRIND= ) +if test -n "$MOZ_CALLGRIND"; then + AC_DEFINE(MOZ_CALLGRIND) +fi + +dnl ======================================================== +dnl vtune +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(vtune, +[ --enable-vtune Enable vtune profiling], + MOZ_VTUNE=1, + MOZ_VTUNE= ) +if test -n "$MOZ_VTUNE"; then + AC_DEFINE(MOZ_VTUNE) +fi + +dnl ======================================================== +dnl = Enable static checking using gcc-dehydra +dnl ======================================================== + +MOZ_ARG_WITH_STRING(static-checking, +[ --with-static-checking=path/to/gcc_dehydra.so + Enable static checking of code using GCC-dehydra], + DEHYDRA_PATH=$withval, + DEHYDRA_PATH= ) + +if test -n "$DEHYDRA_PATH"; then + if ! test -f "$DEHYDRA_PATH"; then + AC_MSG_ERROR([The dehydra plugin is not at the specified path.]) + fi + AC_DEFINE(NS_STATIC_CHECKING) +fi +AC_SUBST(DEHYDRA_PATH) + +dnl ======================================================== +dnl = Enable stripping of libs & executables +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(strip, +[ --enable-strip Enable stripping of libs & executables ], + ENABLE_STRIP=1, + ENABLE_STRIP= ) + +dnl ======================================================== +dnl = Enable stripping of libs & executables when packaging +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(install-strip, +[ --enable-install-strip Enable stripping of libs & executables when packaging ], + PKG_SKIP_STRIP= , + PKG_SKIP_STRIP=1) + +dnl ======================================================== +dnl = --enable-elf-dynstr-gc +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc, +[ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)], + USE_ELF_DYNSTR_GC=1, + USE_ELF_DYNSTR_GC= ) + +dnl ======================================================== +dnl = --enable-old-abi-compat-wrappers +dnl ======================================================== +dnl on x86 linux, the current builds of some popular plugins (notably +dnl flashplayer and real) expect a few builtin symbols from libgcc +dnl which were available in some older versions of gcc. However, +dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if +dnl we want those plugin to work with a gcc-3.1 built binary, we need +dnl to provide these symbols. MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults +dnl to true on x86 linux, and false everywhere else. +dnl + +MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers, +[ --enable-old-abi-compat-wrappers + Support old GCC ABI symbols to ease the pain + of the linux compiler change], + MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1, + MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= ) +if test "$COMPILE_ENVIRONMENT"; then +if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual) + AC_LANG_RESTORE + AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS) +fi +fi # COMPILE_ENVIRONMENT + +dnl ======================================================== +dnl = +dnl = Profiling and Instrumenting +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Profiling and Instrumenting) + +dnl ======================================================== +dnl = Enable timeline service, which provides lightweight +dnl = instrumentation of mozilla for performance measurement. +dnl = Timeline is off by default. +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(timeline, +[ --enable-timeline Enable timeline services ], + MOZ_TIMELINE=1, + MOZ_TIMELINE= ) +if test -n "$MOZ_TIMELINE"; then + AC_DEFINE(MOZ_TIMELINE) +fi + +dnl ======================================================== +dnl = Add support for Eazel profiler +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(eazel-profiler-support, +[ --enable-eazel-profiler-support + Enable Corel/Eazel profiler support], + ENABLE_EAZEL_PROFILER=1, + ENABLE_EAZEL_PROFILER= ) +if test -n "$ENABLE_EAZEL_PROFILER"; then + AC_DEFINE(ENABLE_EAZEL_PROFILER) + USE_ELF_DYNSTR_GC= + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS= + EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + EAZEL_PROFILER_LIBS="-lprofiler -lpthread" +fi + +MOZ_ARG_ENABLE_STRING(profile-modules, +[ --enable-profile-modules + Enable/disable profiling for specific modules], +[ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] ) + +MOZ_ARG_ENABLE_BOOL(insure, +[ --enable-insure Enable insure++ instrumentation (linux only)], + _ENABLE_INSURE=1, + _ENABLE_INSURE= ) +if test -n "$_ENABLE_INSURE"; then + MOZ_INSURE="insure" + MOZ_INSURIFYING=1 + MOZ_INSURE_DIRS="." + MOZ_INSURE_EXCLUDE_DIRS="config" +fi + +MOZ_ARG_WITH_STRING(insure-dirs, +[ --with-insure-dirs=DIRS + Dirs to instrument with insure ], + MOZ_INSURE_DIRS=$withval ) + +MOZ_ARG_WITH_STRING(insure-exclude-dirs, +[ --with-insure-exclude-dirs=DIRS + Dirs to not instrument with insure ], + MOZ_INSURE_EXCLUDE_DIRS="config $withval" ) + +dnl ======================================================== +dnl = Support for Quantify (Windows) +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(quantify, +[ --enable-quantify Enable Quantify support (Windows only) ], + MOZ_QUANTIFY=1, + MOZ_QUANTIFY= ) + +dnl ======================================================== +dnl = Support for demangling undefined symbols +dnl ======================================================== +if test -z "$SKIP_LIBRARY_CHECKS"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=) + AC_LANG_RESTORE +fi + +# Demangle only for debug or trace-malloc builds +MOZ_DEMANGLE_SYMBOLS= +if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then + MOZ_DEMANGLE_SYMBOLS=1 + AC_DEFINE(MOZ_DEMANGLE_SYMBOLS) +fi +AC_SUBST(MOZ_DEMANGLE_SYMBOLS) + +dnl ======================================================== +dnl = Support for gcc stack unwinding (from gcc 3.3) +dnl ======================================================== +if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then + AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace)) +fi + +dnl ======================================================== +dnl = +dnl = Misc. Options +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Misc. Options) + +dnl ======================================================== +dnl update xterm title +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(xterm-updates, +[ --enable-xterm-updates Update XTERM titles with current command.], + MOZ_UPDATE_XTERM=1, + MOZ_UPDATE_XTERM= ) + +if test -z "$SKIP_COMPILER_CHECKS"; then +dnl ======================================================== +dnl = +dnl = Compiler Options +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Compiler Options) + +dnl ======================================================== +dnl Check for gcc -pipe support +dnl ======================================================== +AC_MSG_CHECKING([for gcc -pipe support]) +if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then + echo '#include ' > dummy-hello.c + echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c + ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5 + cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5 + if test $? = 0; then + _res_as_stdin="yes" + else + _res_as_stdin="no" + fi + if test "$_res_as_stdin" = "yes"; then + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -pipe" + AC_TRY_COMPILE( [ #include ], + [printf("Hello World\n");], + [_res_gcc_pipe="yes"], + [_res_gcc_pipe="no"] ) + CFLAGS=$_SAVE_CFLAGS + fi + if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then + _res="yes"; + CFLAGS="$CFLAGS -pipe" + CXXFLAGS="$CXXFLAGS -pipe" + else + _res="no" + fi + rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out + AC_MSG_RESULT([$_res]) +else + AC_MSG_RESULT([no]) +fi + +dnl pass -Wno-long-long to the compiler +MOZ_ARG_ENABLE_BOOL(long-long-warning, +[ --enable-long-long-warning + Warn about use of non-ANSI long long type], + _IGNORE_LONG_LONG_WARNINGS=, + _IGNORE_LONG_LONG_WARNINGS=1) + +if test "$_IGNORE_LONG_LONG_WARNINGS"; then + _SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long" + AC_MSG_CHECKING([whether compiler supports -Wno-long-long]) + AC_TRY_COMPILE([], [return(0);], + [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long" + result="yes" ], result="no") + AC_MSG_RESULT([$result]) + CFLAGS="$_SAVE_CFLAGS" +fi + +dnl ======================================================== +dnl Profile guided optimization +dnl ======================================================== +dnl Test for profiling options +dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities +dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use + +dnl Provide a switch to disable PGO even when called via profiledbuild. +MOZ_ARG_DISABLE_BOOL(profile-guided-optimization, +[ --disable-profile-guided-optimization + Don't build with PGO even if called via make profiledbuild], +MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1, +MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=) + +AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE) + +_SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fprofile-generate" + +AC_MSG_CHECKING([whether C compiler supports -fprofile-generate]) +AC_TRY_COMPILE([], [return 0;], + [ PROFILE_GEN_CFLAGS="-fprofile-generate" + result="yes" ], result="no") +AC_MSG_RESULT([$result]) + +if test $result = "yes"; then + PROFILE_GEN_LDFLAGS="-fprofile-generate" + PROFILE_USE_CFLAGS="-fprofile-use" + PROFILE_USE_LDFLAGS="-fprofile-use" +else + CFLAGS="$_SAVE_CFLAGS -fprofile-arcs" + AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs]) + AC_TRY_COMPILE([], [return 0;], + [ PROFILE_GEN_CFLAGS="-fprofile-arcs" + result="yes" ], result="no") + AC_MSG_RESULT([$result]) + if test $result = "yes"; then + PROFILE_USE_CFLAGS="-fbranch-probabilities" + fi + # don't really care, this is an old GCC + PROFILE_GEN_LDFLAGS= + PROFILE_USE_LDFLAGS= +fi + +CFLAGS="$_SAVE_CFLAGS" + +if test -n "$INTEL_CC"; then + PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ." + PROFILE_GEN_LDFLAGS= + PROFILE_USE_CFLAGS="-prof-use -prof-dir ." + PROFILE_USE_LDFLAGS= +fi + +dnl Sun Studio on Solaris +if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then + PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application" + PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application" + if test "$CPU_ARCH" != "sparc"; then + PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application" + PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application" + else + PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application" + PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application" + fi +fi + +AC_SUBST(PROFILE_GEN_CFLAGS) +AC_SUBST(PROFILE_GEN_LDFLAGS) +AC_SUBST(PROFILE_USE_CFLAGS) +AC_SUBST(PROFILE_USE_LDFLAGS) + +AC_LANG_CPLUSPLUS + +dnl ======================================================== +dnl Test for -pedantic bustage +dnl ======================================================== +MOZ_ARG_DISABLE_BOOL(pedantic, +[ --disable-pedantic Issue all warnings demanded by strict ANSI C ], +_PEDANTIC= ) +if test "$_PEDANTIC"; then + _SAVE_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic" + AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug]) + AC_TRY_COMPILE([$configure_static_assert_macros], + [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)], + result="no", result="yes" ) + AC_MSG_RESULT([$result]) + CXXFLAGS="$_SAVE_CXXFLAGS" + + case "$result" in + no) + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic" + ;; + yes) + AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ]) + ;; + esac +fi + +dnl ======================================================== +dnl Test for correct temporary object destruction order +dnl ======================================================== +dnl We want to make sure the compiler follows the C++ spec here as +dnl xpcom and the string classes depend on it (bug 235381). +AC_MSG_CHECKING([for correct temporary object destruction order]) +AC_TRY_RUN([ class A { + public: A(int& x) : mValue(x) {} + ~A() { mValue--; } + operator char**() { return 0; } + private: int& mValue; + }; + void func(char **arg) {} + int m=2; + void test() { + func(A(m)); + if (m==1) m = 0; + } + int main() { + test(); + return(m); + } + ], + result="yes", result="no", result="maybe") +AC_MSG_RESULT([$result]) + +if test "$result" = "no"; then + AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.]) +fi + +dnl ======================================================== +dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't +dnl provide non-const forms of the operator== for comparing nsCOMPtrs to +dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.) +dnl ======================================================== +_SAVE_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}" +AC_CACHE_CHECK(for correct overload resolution with const and templates, + ac_nscap_nonconst_opeq_bug, + [AC_TRY_COMPILE([ + template + class Pointer + { + public: + T* myPtr; + }; + + template + int operator==(const Pointer& rhs, U* lhs) + { + return rhs.myPtr == lhs; + } + + template + int operator==(const Pointer& rhs, const U* lhs) + { + return rhs.myPtr == lhs; + } + ], + [ + Pointer foo; + const int* bar; + return foo == bar; + ], + ac_nscap_nonconst_opeq_bug="no", + ac_nscap_nonconst_opeq_bug="yes")]) +CXXFLAGS="$_SAVE_CXXFLAGS" + +if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then + AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ) +fi +fi # SKIP_COMPILER_CHECKS + +dnl ======================================================== +dnl C++ rtti +dnl Should be smarter and check that the compiler does indeed have rtti +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(cpp-rtti, +[ --enable-cpp-rtti Enable C++ RTTI ], +[ _MOZ_USE_RTTI=1 ], +[ _MOZ_USE_RTTI= ]) + +if test "$_MOZ_USE_RTTI"; then + _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON +else + _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF +fi + +AC_SUBST(_MOZ_RTTI_FLAGS_ON) + +dnl ======================================================== +dnl C++ exceptions (g++/egcs only - for now) +dnl Should be smarter and check that the compiler does indeed have exceptions +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(cpp-exceptions, +[ --enable-cpp-exceptions Enable C++ exceptions ], +[ _MOZ_CPP_EXCEPTIONS=1 ], +[ _MOZ_CPP_EXCEPTIONS= ]) + +if test "$_MOZ_CPP_EXCEPTIONS"; then + _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON +else + _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF +fi + +# Irix & OSF native compilers do not like exception declarations +# when exceptions are disabled +if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then + AC_DEFINE(CPP_THROW_NEW, []) +else + AC_DEFINE(CPP_THROW_NEW, [throw()]) +fi +AC_LANG_C + +dnl ======================================================== +dnl = +dnl = Build depencency options +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Build dependencies) + +dnl ======================================================== +dnl = Do not auto generate dependency info +dnl ======================================================== +MOZ_AUTO_DEPS=1 +MOZ_ARG_DISABLE_BOOL(auto-deps, +[ --disable-auto-deps Do not automatically generate dependency info], + MOZ_AUTO_DEPS=, + MOZ_AUTO_DEPS=1) + +if test -n "$MOZ_AUTO_DEPS"; then +dnl ======================================================== +dnl = Use mkdepend instead of $CC -MD for dependency generation +dnl ======================================================== +_cpp_md_flag= +MOZ_ARG_DISABLE_BOOL(md, +[ --disable-md Do not use compiler-based dependencies ], + [_cpp_md_flag=], + [_cpp_md_flag=1], + [dnl Default is to turn on -MD if using GNU-compatible compilers + if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then + _cpp_md_flag=1 + fi + dnl Default is to use -xM if using Sun Studio on Solaris + if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then + _cpp_md_flag=1 + fi]) +if test "$_cpp_md_flag"; then + COMPILER_DEPEND=1 + if test "$OS_ARCH" = "OpenVMS"; then + _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))' + else + _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)' + fi + dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk + if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then + _DEPEND_CFLAGS= + fi +else + COMPILER_DEPEND= + _USE_CPP_INCLUDE_FLAG= + _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' + _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' +fi +fi # MOZ_AUTO_DEPS +MDDEPDIR='.deps' +AC_SUBST(MOZ_AUTO_DEPS) +AC_SUBST(COMPILER_DEPEND) +AC_SUBST(MDDEPDIR) + + +dnl ======================================================== +dnl = +dnl = Static Build Options +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Static build options) + +MOZ_ARG_ENABLE_BOOL(static, +[ --enable-static Enable building of internal static libs], + BUILD_STATIC_LIBS=1, + BUILD_STATIC_LIBS=) + +dnl ======================================================== +dnl = Force JS to be a static lib +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(js-static-build, +[ --enable-js-static-build Force js to be a static lib], + JS_STATIC_BUILD=1, + JS_STATIC_BUILD= ) + +AC_SUBST(JS_STATIC_BUILD) + +if test -n "$JS_STATIC_BUILD"; then + AC_DEFINE(EXPORT_JS_API) + +if test -z "$BUILD_STATIC_LIBS"; then + AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static]) +fi + +fi + +dnl ======================================================== +dnl = +dnl = Standalone module options +dnl = +dnl ======================================================== +MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla)) + +if test -z "$SKIP_PATH_CHECKS"; then +if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then + PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0) +fi +fi + +if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then + GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs` +fi + +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) +AC_SUBST(GLIB_GMODULE_LIBS) + +dnl ======================================================== +if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then + MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS= +fi + +MOZ_ARG_WITH_STRING(sync-build-files, +[ --with-sync-build-files=DIR + Check that files in 'config' and 'build' match + their originals in 'DIR/config' and 'DIR/build'. + This helps keep the SpiderMonkey build machinery + in sync with Mozilla's, on which it is based.], +[MOZ_SYNC_BUILD_FILES=$withval ] ) +AC_SUBST(MOZ_SYNC_BUILD_FILES) + +dnl ======================================================== +dnl = +dnl = Maintainer debug option (no --enable equivalent) +dnl = +dnl ======================================================== + +AC_SUBST(AR) +AC_SUBST(AR_FLAGS) +AC_SUBST(AR_LIST) +AC_SUBST(AR_EXTRACT) +AC_SUBST(AR_DELETE) +AC_SUBST(AS) +AC_SUBST(ASFLAGS) +AC_SUBST(AS_DASH_C_FLAG) +AC_SUBST(LD) +AC_SUBST(RC) +AC_SUBST(RCFLAGS) +AC_SUBST(WINDRES) +AC_SUBST(USE_SHORT_LIBNAME) +AC_SUBST(IMPLIB) +AC_SUBST(FILTER) +AC_SUBST(BIN_FLAGS) +AC_SUBST(NS_USE_NATIVE) +AC_SUBST(MOZ_JS_LIBS) +AC_SUBST(MOZ_PSM) +AC_SUBST(MOZ_DEBUG) +AC_SUBST(MOZ_DEBUG_MODULES) +AC_SUBST(MOZ_PROFILE_MODULES) +AC_SUBST(MOZ_DEBUG_ENABLE_DEFS) +AC_SUBST(MOZ_DEBUG_DISABLE_DEFS) +AC_SUBST(MOZ_DEBUG_FLAGS) +AC_SUBST(MOZ_DEBUG_LDFLAGS) +AC_SUBST(WARNINGS_AS_ERRORS) +AC_SUBST(MOZ_DBGRINFO_MODULES) +AC_SUBST(ENABLE_EAZEL_PROFILER) +AC_SUBST(EAZEL_PROFILER_CFLAGS) +AC_SUBST(EAZEL_PROFILER_LIBS) +AC_SUBST(MOZ_PERF_METRICS) +AC_SUBST(GC_LEAK_DETECTOR) +AC_SUBST(MOZ_LEAKY) +AC_SUBST(MOZ_JPROF) +AC_SUBST(MOZ_SHARK) +AC_SUBST(MOZ_CALLGRIND) +AC_SUBST(MOZ_VTUNE) +AC_SUBST(MOZ_XPCTOOLS) +AC_SUBST(MOZ_JSLOADER) +AC_SUBST(MOZ_INSURE) +AC_SUBST(MOZ_INSURE_DIRS) +AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS) +AC_SUBST(MOZ_QUANTIFY) +AC_SUBST(MOZ_INSURIFYING) +AC_SUBST(LIBICONV) + +AC_SUBST(BUILD_STATIC_LIBS) +AC_SUBST(ENABLE_TESTS) + +AC_SUBST(ENABLE_STRIP) +AC_SUBST(PKG_SKIP_STRIP) +AC_SUBST(USE_ELF_DYNSTR_GC) +AC_SUBST(INCREMENTAL_LINKER) +AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS) +AC_SUBST(MOZ_COMPONENT_NSPR_LIBS) + +AC_SUBST(MOZ_FIX_LINK_PATHS) + +AC_SUBST(USE_DEPENDENT_LIBS) + +AC_SUBST(MOZ_BUILD_ROOT) +AC_SUBST(MOZ_OS2_TOOLS) +AC_SUBST(MOZ_OS2_USE_DECLSPEC) + +AC_SUBST(MOZ_POST_DSO_LIB_COMMAND) +AC_SUBST(MOZ_POST_PROGRAM_COMMAND) +AC_SUBST(MOZ_TIMELINE) +AC_SUBST(WINCE) +AC_SUBST(TARGET_DEVICE) + +AC_SUBST(MOZ_APP_NAME) +AC_SUBST(MOZ_APP_DISPLAYNAME) +AC_SUBST(MOZ_APP_VERSION) + +AC_SUBST(MOZ_PKG_SPECIAL) + +AC_SUBST(MOZILLA_OFFICIAL) +AC_SUBST(BUILD_OFFICIAL) +AC_SUBST(MOZ_MILESTONE_RELEASE) + +dnl win32 options +AC_SUBST(MOZ_PROFILE) +AC_SUBST(MOZ_DEBUG_SYMBOLS) +AC_SUBST(MOZ_MAPINFO) +AC_SUBST(MOZ_BROWSE_INFO) +AC_SUBST(MOZ_TOOLS_DIR) +AC_SUBST(CYGWIN_WRAPPER) +AC_SUBST(AS_PERL) +AC_SUBST(WIN32_REDIST_DIR) +AC_SUBST(PYTHON) + +dnl Echo the CFLAGS to remove extra whitespace. +CFLAGS=`echo \ + $_WARNINGS_CFLAGS \ + $CFLAGS` + +CXXFLAGS=`echo \ + $_MOZ_RTTI_FLAGS \ + $_MOZ_EXCEPTIONS_FLAGS \ + $_WARNINGS_CXXFLAGS \ + $CXXFLAGS` + +COMPILE_CFLAGS=`echo \ + $_DEFINES_CFLAGS \ + $_DEPEND_CFLAGS \ + $COMPILE_CFLAGS` + +COMPILE_CXXFLAGS=`echo \ + $_DEFINES_CXXFLAGS \ + $_DEPEND_CFLAGS \ + $COMPILE_CXXFLAGS` + +AC_SUBST(SYSTEM_MAKEDEPEND) + +AC_SUBST(NSPR_CFLAGS) +AC_SUBST(NSPR_LIBS) +AC_SUBST(MOZ_NATIVE_NSPR) + +AC_SUBST(CFLAGS) +AC_SUBST(CXXFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(COMPILE_CFLAGS) +AC_SUBST(COMPILE_CXXFLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(LIBS) +AC_SUBST(CROSS_COMPILE) +AC_SUBST(WCHAR_CFLAGS) + +AC_SUBST(HOST_CC) +AC_SUBST(HOST_CXX) +AC_SUBST(HOST_CFLAGS) +AC_SUBST(HOST_CXXFLAGS) +AC_SUBST(HOST_OPTIMIZE_FLAGS) +AC_SUBST(HOST_AR) +AC_SUBST(HOST_AR_FLAGS) +AC_SUBST(HOST_LD) +AC_SUBST(HOST_RANLIB) +AC_SUBST(HOST_NSPR_MDCPUCFG) +AC_SUBST(HOST_BIN_SUFFIX) +AC_SUBST(HOST_OS_ARCH) + +AC_SUBST(TARGET_CPU) +AC_SUBST(TARGET_VENDOR) +AC_SUBST(TARGET_OS) +AC_SUBST(TARGET_NSPR_MDCPUCFG) +AC_SUBST(TARGET_MD_ARCH) +AC_SUBST(TARGET_XPCOM_ABI) +AC_SUBST(OS_TARGET) +AC_SUBST(OS_ARCH) +AC_SUBST(OS_RELEASE) +AC_SUBST(OS_TEST) + +AC_SUBST(WRAP_MALLOC_CFLAGS) +AC_SUBST(WRAP_MALLOC_LIB) +AC_SUBST(MKSHLIB) +AC_SUBST(MKCSHLIB) +AC_SUBST(MKSHLIB_FORCE_ALL) +AC_SUBST(MKSHLIB_UNFORCE_ALL) +AC_SUBST(DSO_CFLAGS) +AC_SUBST(DSO_PIC_CFLAGS) +AC_SUBST(DSO_LDOPTS) +AC_SUBST(LIB_PREFIX) +AC_SUBST(DLL_PREFIX) +AC_SUBST(DLL_SUFFIX) +AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX") +AC_SUBST(LIB_SUFFIX) +AC_SUBST(OBJ_SUFFIX) +AC_SUBST(BIN_SUFFIX) +AC_SUBST(ASM_SUFFIX) +AC_SUBST(IMPORT_LIB_SUFFIX) +AC_SUBST(USE_N32) +AC_SUBST(CC_VERSION) +AC_SUBST(CXX_VERSION) +AC_SUBST(MSMANIFEST_TOOL) + +if test "$USING_HCC"; then + CC='${topsrcdir}/build/hcc' + CC="$CC '$_OLDCC'" + CXX='${topsrcdir}/build/hcpp' + CXX="$CXX '$_OLDCXX'" + AC_SUBST(CC) + AC_SUBST(CXX) +fi + +dnl Check for missing components +if test "$COMPILE_ENVIRONMENT"; then +if test "$MOZ_X11"; then + dnl ==================================================== + dnl = Check if X headers exist + dnl ==================================================== + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $XCFLAGS" + AC_TRY_COMPILE([ + #include + #include + #include + #include + ], + [ + Display *dpy = 0; + if ((dpy = XOpenDisplay(NULL)) == NULL) { + fprintf(stderr, ": can't open %s\n", XDisplayName(NULL)); + exit(1); + } + ], [], + [ AC_MSG_ERROR([Could not compile basic X program.]) ]) + CFLAGS="$_SAVE_CFLAGS" + + if test ! -z "$MISSING_X"; then + AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]); + fi + +fi # MOZ_X11 +fi # COMPILE_ENVIRONMENT + +dnl Set various defines and substitutions +dnl ======================================================== + +if test "$OS_ARCH" = "BeOS"; then + AC_DEFINE(XP_BEOS) + MOZ_MOVEMAIL=1 +elif test "$OS_ARCH" = "Darwin"; then + AC_DEFINE(XP_UNIX) + AC_DEFINE(UNIX_ASYNC_DNS) + MOZ_MOVEMAIL=1 +elif test "$OS_ARCH" = "OpenVMS"; then + AC_DEFINE(XP_UNIX) +elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then + AC_DEFINE(XP_UNIX) + AC_DEFINE(UNIX_ASYNC_DNS) + MOZ_MOVEMAIL=1 +fi +AC_SUBST(MOZ_MOVEMAIL) + +AC_ARG_ENABLE(threadsafe, + [ --enable-threadsafe Enable support for multiple threads.], + [AC_DEFINE(JS_THREADSAFE)],) + +if test "$MOZ_DEBUG"; then + AC_DEFINE(MOZ_REFLOW_PERF) + AC_DEFINE(MOZ_REFLOW_PERF_DSP) +fi + +if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then + AC_DEFINE(MOZ_ACCESSIBILITY_ATK) + ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk` + ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'` + ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'` + ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'` + AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION) + AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION) + AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION) +fi + +# Used for LD_LIBRARY_PATH of run_viewer target +LIBS_PATH= +for lib_arg in $NSPR_LIBS $TK_LIBS; do + case $lib_arg in + -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;; + * ) ;; + esac +done +AC_SUBST(LIBS_PATH) + +dnl ======================================================== +dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW +dnl ======================================================== +case "$host_os" in +mingw*) + WIN_TOP_SRC=`cd $srcdir; pwd -W` + ;; +cygwin*|msvc*|mks*) + HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC" + HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX" + CC="\$(CYGWIN_WRAPPER) $CC" + CXX="\$(CYGWIN_WRAPPER) $CXX" + CPP="\$(CYGWIN_WRAPPER) $CPP" + LD="\$(CYGWIN_WRAPPER) $LD" + AS="\$(CYGWIN_WRAPPER) $AS" + RC="\$(CYGWIN_WRAPPER) $RC" + MIDL="\$(CYGWIN_WRAPPER) $MIDL" + CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'` + WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'` + ;; +esac + +AC_SUBST(CYGDRIVE_MOUNT) +AC_SUBST(WIN_TOP_SRC) + +AC_SUBST(MOZILLA_VERSION) + +AC_SUBST(ac_configure_args) + +dnl Spit out some output +dnl ======================================================== + +# Save the defines header file before autoconf removes it. +# (Do not add AC_DEFINE calls after this line.) + _CONFIG_TMP=confdefs-tmp.h + _CONFIG_DEFS_H=mozilla-config.h + + cat > $_CONFIG_TMP <<\EOF +/* List of defines generated by configure. Included with preprocessor flag, + * -include, to avoid long list of -D defines on the compile command-line. + * Do not edit. + */ + +#ifndef _MOZILLA_CONFIG_H_ +#define _MOZILLA_CONFIG_H_ +EOF + +_EGREP_PATTERN='^#define (' +if test -n "$_NON_GLOBAL_ACDEFINES"; then + for f in $_NON_GLOBAL_ACDEFINES; do + _EGREP_PATTERN="${_EGREP_PATTERN}$f|" + done +fi +_EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)" + + sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP + + cat >> $_CONFIG_TMP <<\EOF + +#endif /* _MOZILLA_CONFIG_H_ */ + +EOF + + # Only write mozilla-config.h when something changes (or it doesn't exist) + if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then + rm $_CONFIG_TMP + else + AC_MSG_RESULT("creating $_CONFIG_DEFS_H") + mv -f $_CONFIG_TMP $_CONFIG_DEFS_H + + echo ==== $_CONFIG_DEFS_H ================================= + cat $_CONFIG_DEFS_H + fi + +dnl Probably shouldn't call this manually but we always want the output of DEFS +rm -f confdefs.h.save +mv confdefs.h confdefs.h.save +egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h +AC_OUTPUT_MAKE_DEFS() +MOZ_DEFINES=$DEFS +AC_SUBST(MOZ_DEFINES) +rm -f confdefs.h +mv confdefs.h.save confdefs.h + +MAKEFILES=" + Makefile + config/Makefile + config/autoconf.mk + config/mkdepend/Makefile +" + +dnl +dnl Run a perl script to quickly create the makefiles. +dnl If it succeeds, it outputs a shell command to set CONFIG_FILES +dnl for the files it cannot handle correctly. This way, config.status +dnl will handle these files. +dnl If it fails, nothing is set and config.status will run as usual. +dnl +dnl This does not change the $MAKEFILES variable. +dnl +dnl OpenVMS gets a line overflow on the long eval command, so use a temp file. +dnl +if test -z "${AS_PERL}"; then +echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh +else +echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh +fi +. ./conftest.sh +rm conftest.sh + +echo $MAKEFILES > unallmakefiles + +AC_OUTPUT($MAKEFILES) + +# Produce the js-config script at configure time; see the comments for +# 'js-config' in Makefile.in. +AC_MSG_RESULT(invoking make to create js-config script) +$MAKE js-config diff --git a/js/src/js-config.h.in b/js/src/js-config.h.in new file mode 100644 index 000000000000..600253eb888d --- /dev/null +++ b/js/src/js-config.h.in @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=78: + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef js_config_h___ +#define js_config_h___ + +/* Definitions set at build time that affect SpiderMonkey's public API. + This header file is generated by the SpiderMonkey configure script, + and installed along with jsapi.h. */ + +/* Define to 1 if SpiderMonkey should support multi-threaded clients. */ +#undef JS_THREADSAFE + +/* Define to 1 if SpiderMonkey should support the ability to perform + entirely too much GC. */ +#undef JS_GC_ZEAL + +#endif /* js_config_h___ */ diff --git a/js/src/js-config.in b/js/src/js-config.in new file mode 100644 index 000000000000..59b47198a51c --- /dev/null +++ b/js/src/js-config.in @@ -0,0 +1,111 @@ +#!/bin/sh + +prefix='@prefix@' +mozilla_version='@MOZILLA_VERSION@' +LIBRARY_NAME='@LIBRARY_NAME@' +NSPR_CFLAGS='@NSPR_CFLAGS@' +JS_CONFIG_LIBS='@JS_CONFIG_LIBS@' +MOZ_JS_LIBS='@MOZ_JS_LIBS@' + +usage() +{ + cat <&2 +fi + +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 "$mozilla_version" + ;; + --cflags) + echo_cflags=yes + ;; + --libs) + echo_libs=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/js $NSPR_CFLAGS" +fi + +if test "$echo_libs" = "yes"; then + echo "$MOZ_JS_LIBS $JS_CONFIG_LIBS" +fi diff --git a/js/src/jsapi.h b/js/src/jsapi.h index edc7d2a4f559..a929ac62cfa4 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -45,6 +45,7 @@ */ #include #include +#include "js-config.h" #include "jspubtd.h" #include "jsutil.h" diff --git a/js/src/jsbuiltins.h b/js/src/jsbuiltins.h index 44c28522b052..d52e05c4f77b 100644 --- a/js/src/jsbuiltins.h +++ b/js/src/jsbuiltins.h @@ -42,7 +42,7 @@ #ifdef JS_TRACER -#include "nanojit.h" +#include "nanojit/nanojit.h" enum JSTNErrType { INFALLIBLE, FAIL_NULL, FAIL_NEG, FAIL_VOID, FAIL_JSVAL }; enum { JSTN_ERRTYPE_MASK = 7, JSTN_MORE = 8 }; diff --git a/js/src/jsconfig.mk b/js/src/jsconfig.mk deleted file mode 100644 index 1aeb75fd6ad3..000000000000 --- a/js/src/jsconfig.mk +++ /dev/null @@ -1,181 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998-1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -ifndef OBJDIR - ifdef OBJDIR_NAME - OBJDIR = $(OBJDIR_NAME) - endif -endif - -NSPR_VERSION = v4.0 -NSPR_LIBSUFFIX = 4 - -NSPR_LOCAL = $(MOZ_DEPTH)/dist/$(OBJDIR)/nspr -NSPR_DIST = $(MOZ_DEPTH)/dist/$(OBJDIR) -NSPR_OBJDIR = $(OBJDIR) -ifeq ($(OS_ARCH), SunOS) - NSPR_OBJDIR := $(subst _sparc,,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_ARCH), Linux) - LINUX_REL := $(shell uname -r) - ifneq (,$(findstring 2.0,$(LINUX_REL))) - NSPR_OBJDIR := $(subst _All,2.0_x86_glibc_PTH,$(NSPR_OBJDIR)) - else - NSPR_OBJDIR := $(subst _All,2.2_x86_glibc_PTH,$(NSPR_OBJDIR)) - endif -endif -ifeq ($(OS_ARCH), AIX) - NSPR_OBJDIR := $(subst 4.1,4.2,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_CONFIG), IRIX6.2) - NSPR_OBJDIR := $(subst 6.2,6.2_n32_PTH,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_CONFIG), IRIX6.5) - NSPR_OBJDIR := $(subst 6.5,6.5_n32_PTH,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_ARCH), WINNT) - ifeq ($(OBJDIR), WIN32_D.OBJ) - NSPR_OBJDIR = WINNT4.0_DBG.OBJ - endif - ifeq ($(OBJDIR), WIN32_O.OBJ) - NSPR_OBJDIR = WINNT4.0_OPT.OBJ - endif -endif -NSPR_SHARED = /share/builds/components/nspr20/$(NSPR_VERSION)/$(NSPR_OBJDIR) -ifeq ($(OS_ARCH), WINNT) - NSPR_SHARED = nspr20/$(NSPR_VERSION)/$(NSPR_OBJDIR) -endif -NSPR_VERSIONFILE = $(NSPR_LOCAL)/Version -NSPR_CURVERSION := $(shell cat $(NSPR_VERSIONFILE) 2>/dev/null) - -get_nspr: - @echo "Grabbing NSPR component..." -ifeq ($(NSPR_VERSION), $(NSPR_CURVERSION)) - @echo "No need, NSPR is up to date in this tree (ver=$(NSPR_VERSION))." -else - mkdir -p $(NSPR_LOCAL) - mkdir -p $(NSPR_DIST) - ifneq ($(OS_ARCH), WINNT) - cp $(NSPR_SHARED)/*.jar $(NSPR_LOCAL) - else - sh $(MOZ_DEPTH)/../reltools/compftp.sh $(NSPR_SHARED) $(NSPR_LOCAL) *.jar - endif - unzip -o $(NSPR_LOCAL)/mdbinary.jar -d $(NSPR_DIST) - mkdir -p $(NSPR_DIST)/include - unzip -o $(NSPR_LOCAL)/mdheader.jar -d $(NSPR_DIST)/include - rm -rf $(NSPR_DIST)/META-INF - rm -rf $(NSPR_DIST)/include/META-INF - echo $(NSPR_VERSION) > $(NSPR_VERSIONFILE) -endif - -SHIP_DIST = $(MOZ_DEPTH)/dist/$(OBJDIR) -SHIP_DIR = $(SHIP_DIST)/SHIP - -SHIP_LIBS = libjs.$(SO_SUFFIX) libjs.a -ifdef JS_LIVECONNECT - SHIP_LIBS += libjsj.$(SO_SUFFIX) libjsj.a -endif -ifeq ($(OS_ARCH), WINNT) - SHIP_LIBS = js32.dll js32.lib - ifdef JS_LIVECONNECT - SHIP_LIBS += jsj.dll jsj.lib - endif -endif -SHIP_LIBS += $(LCJAR) -SHIP_LIBS := $(addprefix $(SHIP_DIST)/lib/, $(SHIP_LIBS)) - -SHIP_INCS = js*.h prmjtime.h resource.h *.msg *.tbl -ifdef JS_LIVECONNECT - SHIP_INCS += netscape*.h nsC*.h nsI*.h -endif -SHIP_INCS := $(addprefix $(SHIP_DIST)/include/, $(SHIP_INCS)) - -SHIP_BINS = js -ifdef JS_LIVECONNECT - SHIP_BINS += lcshell -endif -ifeq ($(OS_ARCH), WINNT) - SHIP_BINS := $(addsuffix .exe, $(SHIP_BINS)) -endif -SHIP_BINS := $(addprefix $(SHIP_DIST)/bin/, $(SHIP_BINS)) - -ifdef BUILD_OPT - JSREFJAR = jsref_opt.jar -else -ifdef BUILD_IDG - JSREFJAR = jsref_idg.jar -else - JSREFJAR = jsref_dbg.jar -endif -endif - -ship: - mkdir -p $(SHIP_DIR)/$(LIBDIR) - mkdir -p $(SHIP_DIR)/include - mkdir -p $(SHIP_DIR)/bin - cp $(SHIP_LIBS) $(SHIP_DIR)/$(LIBDIR) - cp $(SHIP_INCS) $(SHIP_DIR)/include - cp $(SHIP_BINS) $(SHIP_DIR)/bin - cd $(SHIP_DIR); \ - zip -r $(JSREFJAR) bin lib include -ifdef BUILD_SHIP - cp $(SHIP_DIR)/$(JSREFJAR) $(BUILD_SHIP) -endif - -CWD = $(shell pwd) -shipSource: $(SHIP_DIR)/jsref_src.lst .FORCE - mkdir -p $(SHIP_DIR) - cd $(MOZ_DEPTH)/.. ; \ - zip $(CWD)/$(SHIP_DIR)/jsref_src.jar -@ < $(CWD)/$(SHIP_DIR)/jsref_src.lst -ifdef BUILD_SHIP - cp $(SHIP_DIR)/jsref_src.jar $(BUILD_SHIP) -endif - -JSREFSRCDIRS := $(shell cat $(DEPTH)/SpiderMonkey.rsp) -$(SHIP_DIR)/jsref_src.lst: .FORCE - mkdir -p $(SHIP_DIR) - rm -f $@ - touch $@ - for d in $(JSREFSRCDIRS); do \ - cd $(MOZ_DEPTH)/..; \ - ls -1 -d $$d | grep -v CVS | grep -v \.OBJ >> $(CWD)/$@; \ - cd $(CWD); \ - done - -.FORCE: diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index 09660134bd1b..2582b6b15e14 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -51,7 +51,7 @@ #include #endif -#include "nanojit.h" +#include "nanojit/nanojit.h" #include "jsarray.h" // higher-level library and API headers #include "jsbool.h" #include "jscntxt.h" diff --git a/js/src/rules.mk b/js/src/rules.mk deleted file mode 100644 index 90ed311b9ce5..000000000000 --- a/js/src/rules.mk +++ /dev/null @@ -1,206 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998-1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Michael Ang -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# -# JSRef GNUmake makefile rules -# - -ifdef USE_MSVC -LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.obj)) -PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.obj)) -else -LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.o)) -LIB_OBJS += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o)) -PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.o)) -endif - -CPPFILES = $(LIB_CPPFILES) $(PROG_CPPFILES) -OBJS = $(LIB_OBJS) $(PROG_OBJS) - -ifdef USE_MSVC -# TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet -TARGETS += $(SHARED_LIBRARY) $(PROGRAM) # it is now -else -TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) -endif - -all: - +$(LOOP_OVER_PREDIRS) -ifneq "$(strip $(TARGETS))" "" - $(MAKE) -f Makefile.ref $(TARGETS) -endif - +$(LOOP_OVER_DIRS) - -$(OBJDIR)/%: %.cpp - @$(MAKE_OBJDIR) - $(CXX) -o $@ $(CFLAGS) $(OPTIMIZER) $*.cpp $(LDFLAGS) - -# This rule must come before the rule with no dep on header -$(OBJDIR)/%.o: %.cpp %.h - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $*.cpp - -$(OBJDIR)/jsinterp.o: jsinterp.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp - -$(OBJDIR)/jsbuiltins.o: jsbuiltins.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp - -$(OBJDIR)/%.o: %.cpp - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $*.cpp - -$(OBJDIR)/%.o: %.s - @$(MAKE_OBJDIR) - $(AS) -o $@ $(ASFLAGS) $*.s - -# This rule must come before rule with no dep on header -$(OBJDIR)/%.obj: %.cpp %.h - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $*.cpp - -$(OBJDIR)/jsinterp.obj: jsinterp.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp - -$(OBJDIR)/jsbuiltins.obj: jsbuiltins.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp - -$(OBJDIR)/%.obj: %.cpp - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $*.cpp - -$(OBJDIR)/js.obj: js.cpp - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(OPTIMIZER) $< - -ifeq ($(OS_ARCH),OS2) -$(LIBRARY): $(LIB_OBJS) - $(AR) $@ $? $(AR_OS2_SUFFIX) - $(RANLIB) $@ -else -ifdef USE_MSVC -$(SHARED_LIBRARY): $(LIB_OBJS) - link.exe $(LIB_LINK_FLAGS) /base:0x61000000 $(OTHER_LIBS) \ - /out:"$@" /pdb:none\ - /implib:"$(OBJDIR)/$(@F:.dll=.lib)" $^ -else -$(LIBRARY): $(LIB_OBJS) - $(AR) rv $@ $? - $(RANLIB) $@ - -$(SHARED_LIBRARY): $(LIB_OBJS) - $(MKSHLIB) -o $@ $(LIB_OBJS) $(LDFLAGS) $(OTHER_LIBS) -endif -endif - -# Java stuff -$(CLASSDIR)/$(OBJDIR)/$(JARPATH)/%.class: %.java - mkdir -p $(@D) - $(JAVAC) $(JAVAC_FLAGS) $< - -define MAKE_OBJDIR -if test ! -d $(@D); then rm -rf $(@D); mkdir -p $(@D); fi -endef - -ifdef DIRS -LOOP_OVER_DIRS = \ - @for d in $(DIRS); do \ - if test -d $$d; then \ - set -e; \ - echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \ - cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \ - set +e; \ - else \ - echo "Skipping non-directory $$d..."; \ - fi; \ - done -endif - -ifdef PREDIRS -LOOP_OVER_PREDIRS = \ - @for d in $(PREDIRS); do \ - if test -d $$d; then \ - set -e; \ - echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \ - cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \ - set +e; \ - else \ - echo "Skipping non-directory $$d..."; \ - fi; \ - done -endif - -export: - +$(LOOP_OVER_PREDIRS) - mkdir -p $(DIST)/include $(DIST)/$(LIBDIR) $(DIST)/bin -ifneq "$(strip $(HFILES))" "" - $(CP) $(HFILES) $(DIST)/include -endif -ifneq "$(strip $(LIBRARY))" "" - $(CP) $(LIBRARY) $(DIST)/$(LIBDIR) -endif -ifneq "$(strip $(JARS))" "" - $(CP) $(JARS) $(DIST)/$(LIBDIR) -endif -ifneq "$(strip $(SHARED_LIBRARY))" "" - $(CP) $(SHARED_LIBRARY) $(DIST)/$(LIBDIR) -endif -ifneq "$(strip $(PROGRAM))" "" - $(CP) $(PROGRAM) $(DIST)/bin -endif - +$(LOOP_OVER_DIRS) - -clean: - +$(LOOP_OVER_PREDIRS) - rm -rf $(OBJS) $(GARBAGE) - -clobber: - +$(LOOP_OVER_PREDIRS) - rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES) $(GARBAGE) - if test -d $(OBJDIR); then rmdir $(OBJDIR); fi - -tar: - tar cvf $(TARNAME) $(TARFILES) - gzip $(TARNAME) - diff --git a/nsprpub/configure b/nsprpub/configure index 65000d7401a8..3d28c860ca47 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -6016,7 +6016,7 @@ s%\[%\\&%g s%\]%\\&%g s%\$%$$%g EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '` +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` rm -f conftest.defs diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index c7986180c08d..1dc8d3ae4b04 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -225,6 +225,7 @@ NO_PKG_FILES += \ core \ bsdecho \ gtscc \ + js-config \ jscpucfg \ nsinstall \ viewer \ diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh index 3568ddc17a31..90f37c04c1a4 100644 --- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -166,10 +166,6 @@ MAKEFILES_intl=" intl/strres/tests/Makefile " -MAKEFILES_js=" - js/src/Makefile -" - MAKEFILES_liveconnect=" js/src/liveconnect/Makefile js/src/liveconnect/classes/Makefile @@ -774,7 +770,6 @@ add_makefiles " $MAKEFILES_gfx $MAKEFILES_htmlparser $MAKEFILES_intl - $MAKEFILES_js $MAKEFILES_liveconnect $MAKEFILES_xpconnect $MAKEFILES_jsdebugger diff --git a/toolkit/toolkit-tiers.mk b/toolkit/toolkit-tiers.mk index b67db2f3a0b2..c8dc7aeb0f97 100644 --- a/toolkit/toolkit-tiers.mk +++ b/toolkit/toolkit-tiers.mk @@ -40,7 +40,7 @@ $(error toolkit-tiers.mk is not compatible with --enable-libxul-sdk=) endif include $(topsrcdir)/config/nspr/build.mk -include $(topsrcdir)/js/src/build.mk +include $(topsrcdir)/config/js/build.mk include $(topsrcdir)/xpcom/build.mk include $(topsrcdir)/netwerk/build.mk