bug 487396 - fix some of the jemalloc windows build madness. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Mon, 20 Apr 2009 06:56:23 -0400
changeset 27523 7e579ac2ae03e5e500c5df7e0768cd91f14d4f51
parent 27522 9cac836012c9e8921ab3828c21243fa396849d05
child 27524 eb3f4369c94f5dc0bbb9df62f7fcc1074d2efb97
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs487396
milestone1.9.2a1pre
bug 487396 - fix some of the jemalloc windows build madness. r=bsmedberg
config/autoconf.mk.in
config/config.mk
config/mkdepend/Makefile.in
configure.in
js/src/config/autoconf.mk.in
js/src/config/config.mk
js/src/configure.in
memory/jemalloc/Makefile.in
memory/jemalloc/build-crt.py
memory/jemalloc/crtsp1.diff
xpcom/typelib/xpidl/Makefile.in
xpcom/typelib/xpt/src/Makefile.in
xpcom/typelib/xpt/tools/Makefile.in
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -592,22 +592,21 @@ MOZ_MILESTONE_RELEASE = @MOZ_MILESTONE_R
 # Win32 options
 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
+MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
+
+# This is for custom CRT building
 ifdef MOZ_MEMORY
-ifneq (,$(WIN32_CRT_SRC_DIR)$(WIN32_CUSTOM_CRT_DIR))
-export LIB = @MOZ_LIB@
-export PATH = @MOZ_PATH@
+ifdef WIN32_CRT_SRC_DIR
 DLLFLAGS = @DLLFLAGS@
 endif
 endif
 
 # python options.
 MOZ_PYTHON_EXTENSIONS = @MOZ_PYTHON_EXTENSIONS@
 MOZ_PYTHON = @MOZ_PYTHON@
 MOZ_PYTHON_PREFIX = @MOZ_PYTHON_PREFIX@
--- a/config/config.mk
+++ b/config/config.mk
@@ -249,16 +249,24 @@ OS_LDFLAGS += $(_DEBUG_LDFLAGS)
 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
 
+# We don't build a static CRT when building a custom CRT,
+# it appears to be broken. So don't link to jemalloc if
+# the Makefile wants static CRT linking.
+ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_)
+# Disable default CRT libs and add the right lib path for the linker
+OS_LDFLAGS += $(MOZ_MEMORY_LDFLAGS)
+endif
+
 # 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
--- a/config/mkdepend/Makefile.in
+++ b/config/mkdepend/Makefile.in
@@ -37,16 +37,18 @@
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
+USE_STATIC_LIBS = 1
+
 # undefine (as best we can, thanks gmake!) so we don't need build_number
 MOZILLA_OFFICIAL =
 BUILD_OFFICIAL   =
 MODULE		 = mkdepend
 HOST_PROGRAM	 = mkdepend$(BIN_SUFFIX)
 ifdef GNU_CC
 MODULE_OPTIMIZE_FLAGS = -O3
 else
--- a/configure.in
+++ b/configure.in
@@ -6582,67 +6582,53 @@ if test "$MOZ_MEMORY"; then
   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
+    dnl This is sort of awful. Will revisit if we add support for more versions
+    if test "$CC_VERSION" -ne "14.00.50727.762"; then
+        AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 currently.])
+    fi
+    if test -z "$WIN32_CRT_SRC_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.])
+        AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
       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"
+
+    if test ! -d "$WIN32_CRT_SRC_DIR"; then
+      AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
+    fi
+    WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
+    _objdir_win=`pwd -W`
+    WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/intel"
     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"
+    MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -DEFAULTLIB:mozcrt19"
     dnl Also pass this to NSPR/NSS
-    DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
+    DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
     export DLLFLAGS
     ;;
   *wince)
     AC_DEFINE(MOZ_MEMORY_WINCE)
     AC_DEFINE(MOZ_MEMORY_WINDOWS)
     ;;
   *)
     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
     ;;
   esac
 fi
 AC_SUBST(MOZ_MEMORY)
+AC_SUBST(MOZ_MEMORY_LDFLAGS)
 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)],
@@ -8524,17 +8510,20 @@ if test -z "$MOZ_NATIVE_NSPR"; then
     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
 fi
 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
 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=$_topsrcdir"
 if test "$MOZ_MEMORY"; then
-   ac_configure_args="$ac_configure_args --enable-jemalloc"  
+   ac_configure_args="$ac_configure_args --enable-jemalloc"
+   if test -n "$MOZ_MEMORY_LDFLAGS"; then
+     export MOZ_MEMORY_LDFLAGS
+   fi
 fi
 AC_OUTPUT_SUBDIRS(js/src)
 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
 
 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
 dnl Needs to be at the end to respect possible changes from NSPR configure
--- a/js/src/config/autoconf.mk.in
+++ b/js/src/config/autoconf.mk.in
@@ -329,18 +329,17 @@ MOZ_MILESTONE_RELEASE = @MOZ_MILESTONE_R
 
 # Win32 options
 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@
+MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
 
 # Codesighs tools option, enables win32 mapfiles.
 MOZ_MAPINFO	= @MOZ_MAPINFO@
 
 WINCE		= @WINCE@
 
 MACOS_SDK_DIR	= @MACOS_SDK_DIR@
 NEXT_ROOT	= @NEXT_ROOT@
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -249,16 +249,24 @@ OS_LDFLAGS += $(_DEBUG_LDFLAGS)
 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
 
+# We don't build a static CRT when building a custom CRT,
+# it appears to be broken. So don't link to jemalloc if
+# the Makefile wants static CRT linking.
+ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_)
+# Disable default CRT libs and add the right lib path for the linker
+OS_LDFLAGS += $(MOZ_MEMORY_LDFLAGS)
+endif
+
 # 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
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -4194,69 +4194,29 @@ if test "$MOZ_MEMORY"; then
   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
+    # the interesting bits will get passed down in MOZ_MEMORY_LDFLAGS
     ;;
   *wince)
     AC_DEFINE(MOZ_MEMORY_WINCE)
     AC_DEFINE(MOZ_MEMORY_WINDOWS)
     ;;
   *)
     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
     ;;
   esac
 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)
+AC_SUBST(MOZ_MEMORY_LDFLAGS)
 
 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= )
--- a/memory/jemalloc/Makefile.in
+++ b/memory/jemalloc/Makefile.in
@@ -49,56 +49,62 @@ MODULE		= jemalloc
 # symbols.
 VISIBILITY_FLAGS=
 
 ifeq (WINCE,$(OS_TARGET))
 DEFINES+= -DMOZCE_SHUNT_H
 endif
 
 ifeq (WINNT,$(OS_TARGET))
-# Two options for Windows, either you build the CRT from source,
-# or you use a pre-built DLL.
-ifneq (,$(WIN32_CRT_SRC_DIR))
 # Building the CRT from source
-CRT_OBJ_DIR=./$(shell basename "$(WIN32_CRT_SRC_DIR)")
-libs:: $(CRT_OBJ_DIR)/build/intel/mozcrt19.dll
-	$(INSTALL) $< $(FINAL_TARGET)
+CRT_OBJ_DIR = $(CURDIR)/crtsrc
+MOZ_CRT_DLL_NAME = mozcrt19
+MOZ_CRT_STATIC_LIBS = libcmt libcpmt
+MOZ_CRT_DLL = $(CRT_OBJ_DIR)/build/intel/$(MOZ_CRT_DLL_NAME).dll
+MOZ_CRT_IMPORT_LIB = $(CRT_OBJ_DIR)/build/intel/$(MOZ_CRT_DLL_NAME).lib
+
+# copy the CRT DLL to dist/bin,
+# copy the import lib to dist/lib
+libs:: $(MOZ_CRT_DLL) $(MOZ_CRT_IMPORT_LIB)
+	$(INSTALL) $(MOZ_CRT_DLL) $(FINAL_TARGET)
+	$(INSTALL) $(MOZ_CRT_IMPORT_LIB) $(DIST)/lib
+
+$(MOZ_CRT_IMPORT_LIB): $(MOZ_CRT_DLL)
 
 define EXTRACT_CMD
 cd $(CRT_OBJ_DIR)/intel/$(i)_lib && lib "-extract:..\\build\\intel\\$(i)_obj\\unhandld.obj" eh.lib
 
-endef
+endef # don't touch the blank line. actually, don't touch anything in this file.
 
 # patch if necessary
 $(CRT_OBJ_DIR)/jemalloc.c: $(srcdir)/crtsp1.diff
 	rm -rf $(CRT_OBJ_DIR)
-	cp -R "$(WIN32_CRT_SRC_DIR)" .
+	cp -R "$(WIN32_CRT_SRC_DIR)" $(CRT_OBJ_DIR)
 # per http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1189363&SiteID=1
 	$(foreach i,dll mt xdll xmt,$(EXTRACT_CMD))
 # truly awful
 #XXX: get ed into mozillabuild, bug 415123
 	$(PERL) $(srcdir)/apply-ed-patches.pl $(srcdir)/crtsp1.diff \
 	$(CRT_OBJ_DIR) $(srcdir)/ed.exe
 
-$(CRT_OBJ_DIR)/build/intel/mozcrt19.dll: \
+$(MOZ_CRT_DLL): \
   $(CRT_OBJ_DIR)/jemalloc.c $(srcdir)/jemalloc.c $(srcdir)/jemalloc.h \
   $(srcdir)/ql.h $(srcdir)/qr.h $(srcdir)/rb.h
 	cp $(srcdir)/jemalloc.c $(srcdir)/jemalloc.h $(srcdir)/ql.h \
 	$(srcdir)/qr.h $(srcdir)/rb.h $(CRT_OBJ_DIR)
 # this pretty much sucks, but nmake and make don't play well together
 	$(PYTHON) $(srcdir)/build-crt.py $(CRT_OBJ_DIR)
-#XXX: these don't link right for some reason
-	rm $(CRT_OBJ_DIR)/build/intel/{libcmt,libcpmt}.lib
-else
-# Using a pre-built DLL, so just install it.
-libs:: $(WIN32_CUSTOM_CRT_DIR)/mozcrt19.dll
-	$(INSTALL) $< $(FINAL_TARGET)
-endif
+# XXX: these don't link right for some reason; the problem is likely
+# that  not all the standard symbols are exported; looks like MSFT
+# never updated the sample.def files; could probably fix if someone
+# were ever bored enough. :-)
+	rm -f $(addsuffix .lib, $(addprefix $(CRT_OBJ_DIR)/build/intel/, $(MOZ_CRT_STATIC_LIBS)))
+	rm -f $(addsuffix .pdb, $(addprefix $(CRT_OBJ_DIR)/build/intel/, $(MOZ_CRT_STATIC_LIBS)))
 
-else
+else # Not Windows
 
 MODULE_OPTIMIZE_FLAGS = -O2
 ifeq ($(OS_ARCH),SunOS)
 ifndef GNU_CC
 MODULE_OPTIMIZE_FLAGS = -xO5
 endif
 endif
 
--- a/memory/jemalloc/build-crt.py
+++ b/memory/jemalloc/build-crt.py
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 
 import os, sys
 
 if 'MAKEFLAGS' in os.environ:
   del os.environ['MAKEFLAGS']
 os.chdir(sys.argv[1])
-sys.exit(os.system('nmake dll_ mt RETAIL_DLL_NAME=mozcrt19 RETAIL_LIB_NAME=msvcrt'))
+sys.exit(os.system('nmake dll_ mt'))
--- a/memory/jemalloc/crtsp1.diff
+++ b/memory/jemalloc/crtsp1.diff
@@ -125,17 +125,17 @@ LINKIMPLIB=link -lib
 302,304c
 LINKER=link -nologo
 LINKLIB=link -lib -nologo
 LINKIMPLIB=link -lib -nologo
 .
 209d
 21,22c
 RETAIL_DLL_NAME=MOZCRT19
-RETAIL_LIB_NAME=msvcrt
+RETAIL_LIB_NAME=mozcrt19
 .
 diff -re crt/src/makefile.inc crt-sp1/src/makefile.inc
 1623a
 
 $(OBJDIR)\unhandld.obj: $(PREOBJDIR)\unhandld.obj
         copy $(PREOBJDIR)\unhandld.obj $@
 .
 618d
--- a/xpcom/typelib/xpidl/Makefile.in
+++ b/xpcom/typelib/xpidl/Makefile.in
@@ -68,19 +68,17 @@ CSRCS		= \
 ifdef CROSS_COMPILE
 HOST_PROGRAM	= host_xpidl$(HOST_BIN_SUFFIX)
 HOST_CSRCS	= $(CSRCS)
 ifdef WINCE
 HOST_LDFLAGS += -ladvapi32.lib
 endif
 endif
 
-ifdef STATIC_LIBIDL
 USE_STATIC_LIBS = 1
-endif
 
 ifeq ($(OS_ARCH),Darwin)
 # The only reason to not always strip the SDK out is that the libraries
 # in / on ppc currently aren't fat, preventing the target xpidl from linking
 # on a ppc->x86 build.  The SDK, presumably 10.4u, must be included in that
 # case in order to successfully link.  Because the target xpidl isn't
 # currently built in a cross compile, though, this point is moot for the
 # time being.
--- a/xpcom/typelib/xpt/src/Makefile.in
+++ b/xpcom/typelib/xpt/src/Makefile.in
@@ -51,16 +51,17 @@ ifdef CROSS_COMPILE
 HOST_LIBRARY_NAME	= hostxpt
 endif
 
 CSRCS		= xpt_arena.c xpt_struct.c xpt_xdr.c
 HOST_CSRCS	= $(CSRCS)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
+USE_STATIC_LIBS = 1
 
 # Force use of PIC
 FORCE_USE_PIC	= 1
 
 # Don't use profile-guided optimization
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 
 include $(topsrcdir)/config/rules.mk
--- a/xpcom/typelib/xpt/tools/Makefile.in
+++ b/xpcom/typelib/xpt/tools/Makefile.in
@@ -55,16 +55,18 @@ SDK_BINARY     =                   \
 
 ifdef CROSS_COMPILE
 HOST_SIMPLE_PROGRAMS	= $(addprefix host_, $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=$(HOST_BIN_SUFFIX)))
 HOST_CSRCS		= $(CSRCS)
 endif
 
 LIBS		= $(DIST)/lib/$(LIB_PREFIX)xpt.$(LIB_SUFFIX)
 
+USE_STATIC_LIBS = 1
+
 include $(topsrcdir)/config/rules.mk
 
 # Do not link to jemalloc
 ifeq ($(OS_ARCH),SunOS)
 SOLARIS_JEMALLOC_LDFLAGS =
 endif
 
 # Compile directly against the static lib, so we can use the tools