From 177bc7075054f1d93208cc1e9ce09ffa73209996 Mon Sep 17 00:00:00 2001
From: wagerlabs <joelr1@gmail.com>
Date: Tue, 22 Dec 2009 03:55:57 -0800
Subject: [PATCH] static build, dynamic xpcom

---
 browser/app/Makefile.in                          |   27 ++++++++++++++++++++-
 browser/confvars.sh                              |   10 ++++++-
 browser/installer/Makefile.in                    |    2 +-
 browser/installer/package-manifest.in            |    1 +
 config/config.mk                                 |    3 +-
 configure.in                                     |   17 +++++++++++--
 db/sqlite3/src/Makefile.in                       |    5 ++++
 extensions/gnomevfs/Makefile.in                  |    9 ++++++-
 js/jsd/Makefile.in                               |    4 +-
 js/src/Makefile.in                               |    1 +
 js/src/configure.in                              |   14 +++++++++++
 js/src/dtoa.c                                    |    2 +-
 modules/libpr0n/decoders/icon/Makefile.in        |   10 +++++++-
 modules/libpr0n/decoders/icon/gtk/Makefile.in    |    4 +++
 modules/plugin/Makefile.in                       |    4 +++
 toolkit/components/alerts/src/mac/Makefile.in    |    6 ++++-
 toolkit/system/dbus/Makefile.in                  |    9 +++++-
 toolkit/system/dbus/nsNetworkManagerListener.cpp |    2 +-
 toolkit/system/gnome/Makefile.in                 |    5 ++++
 widget/src/cocoa/nsAppShell.mm                   |    2 +
 xpcom/build/Makefile.in                          |    9 ++++---
 xpcom/string/src/Makefile.in                     |    1 -
 xpcom/stub/Makefile.in                           |   14 ++++++++---
 xpinstall/src/Makefile.in                        |    2 +-
 24 files changed, 135 insertions(+), 28 deletions(-)

diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in
index 347a0f3..9da2a0e 100644
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -103,6 +103,9 @@ else
 STATIC_COMPONENTS_LINKER_PATH = -L$(DEPTH)/staticlib
 endif
 LIBS += $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+LIBS += -framework SystemConfiguration -framework OpenGL
+endif
 else
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 LIBS += $(DIST)/bin/XUL
@@ -119,14 +122,18 @@ ifdef MOZ_ENABLE_LIBXUL
 APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
 else
 MOZILLA_INTERNAL_API = 1
-APP_XPCOM_LIBS = $(XPCOM_LIBS)
+#APP_XPCOM_LIBS = $(XPCOM_LIBS)
+ifdef BUILD_STATIC_LIBS
+APP_XPCOM_LIBS = $(DIST)/lib/libxpcom_core.a
+else
+APP_XPCOM_LIBS = -lxpcom_core
+endif
 endif
 
 LIBS += \
 	$(STATIC_COMPONENTS_LINKER_PATH) \
 	$(EXTRA_DSO_LIBS) \
 	$(MOZ_JS_LIBS) \
-	$(APP_XPCOM_LIBS) \
 	$(NSPR_LIBS) \
 	$(TK_LIBS) \
 	$(NULL)
@@ -136,6 +143,10 @@ ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
 LIBS += $(XLDFLAGS) $(XLIBS) $(ZLIB_LIBS)
 endif
 
+ifneq (,$(MOZ_ENABLE_DBUS))
+LIBS += -ldbus-1 -ldbus-glib-1
+endif
+
 ifdef MOZ_JPROF
 LIBS += -ljprof
 endif
@@ -219,6 +230,12 @@ endif
 RCFLAGS += -DFIREFOX_ICO=\"$(DIST)/branding/firefox-os2.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document-os2.ico\"
 endif
 
+ifdef BUILD_STATIC_LIBS
+STATIC_EXTRA_LIBS += $(APP_XPCOM_LIBS)
+else
+LIBS += $(APP_XPCOM_LIBS)
+endif
+
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\"
@@ -253,6 +270,12 @@ LDFLAGS += /HEAP:0x40000
 endif
 endif
 
+ifdef BUILD_STATIC_LIBS
+ifeq ($(OS_ARCH),Linux)
+LDFLAGS += -rdynamic
+endif
+endif
+
 $(PROGRAM): $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
 
 ifneq (,$(filter-out OS2 WINNT WINCE,$(OS_ARCH)))
diff --git a/browser/confvars.sh b/browser/confvars.sh
index 56f2986..4aa06e3 100755
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -40,8 +40,14 @@ MOZ_APP_NAME=firefox
 MOZ_UPDATER=1
 MOZ_PHOENIX=1
 
-MOZ_ENABLE_LIBXUL=1
-MOZ_STATIC_BUILD_UNSUPPORTED=1
+# Static build bits
+MOZ_OPTIMIZE=1
+MOZ_ENABLE_LIBXUL=
+BUILD_STATIC_LIBS=1
+ENABLE_TESTS=
+MOZ_IPC=
+#MOZ_STATIC_BUILD_UNSUPPORTED=1
+#
 MOZ_PLACES=1
 # always enabled for form history
 MOZ_MORKREADER=1
diff --git a/browser/installer/Makefile.in b/browser/installer/Makefile.in
index 4898815..49fd892 100644
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -59,7 +59,7 @@ include $(topsrcdir)/config/rules.mk
 
 MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
 
-ifdef MOZ_ENABLE_LIBXUL
+ifneq (_, $(MOZ_ENABLE_LIBXUL)_$(BUILD_STATIC_LIBS))
 MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
 else
 define message
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
index e228d42..4099ace 100644
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -44,6 +44,7 @@
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
+@BINPATH@/@DLL_PREFIX@xpcom_core@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 #ifdef XP_MACOSX
 @BINPATH@/XUL
diff --git a/config/config.mk b/config/config.mk
index 1499cc4..1eed3e1 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -621,7 +621,8 @@ SDK_BIN_DIR = $(DIST)/sdk/bin
 
 DEPENDENCIES	= .md
 
-MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
+#MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
+MOZ_COMPONENT_LIBS=-lxpcomglue_s -lxpcom $(MOZ_COMPONENT_NSPR_LIBS)
 
 ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
 DEFINES +=  -DXPCONNECT_STANDALONE
diff --git a/configure.in b/configure.in
index ac6a93f..9cce669 100644
--- a/configure.in
+++ b/configure.in
@@ -7337,14 +7337,25 @@ MOZ_ARG_ENABLE_BOOL(static,
     BUILD_STATIC_LIBS=1,
     BUILD_STATIC_LIBS=)
 
+if test -n "$BUILD_STATIC_LIBS"; then
+MOZ_JS_LIBS='-L$(libdir) -ljs_static'
+# XXX Is there a better way to skip -dead_strip?
+MOZ_OPTIMIZE_LDFLAGS=
+fi
+
+dnl Disable libxul in debug builds, but not for xulrunner.
+if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
+   MOZ_ENABLE_LIBXUL=
+fi
+
 MOZ_ARG_ENABLE_BOOL(libxul,
 [  --enable-libxul         Enable building of libxul],
     MOZ_ENABLE_LIBXUL=1,
     MOZ_ENABLE_LIBXUL=)
 
-if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
-	AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
-fi
+#if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
+#	AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
+#fi
 
 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
 	AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
diff --git a/db/sqlite3/src/Makefile.in b/db/sqlite3/src/Makefile.in
index ab01962..1bcf80a 100644
--- a/db/sqlite3/src/Makefile.in
+++ b/db/sqlite3/src/Makefile.in
@@ -47,7 +47,12 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE           = sqlite3
 LIBRARY_NAME     = mozsqlite3
+ifdef BUILD_STATIC_LIBS
+FORCE_STATIC_LIB = 1
+DIST_INSTALL = 1
+else
 FORCE_SHARED_LIB = 1
+endif
 VISIBILITY_FLAGS =
 LIB_IS_C_ONLY    = 1
 
diff --git a/extensions/gnomevfs/Makefile.in b/extensions/gnomevfs/Makefile.in
index a71abe5..92e4318 100644
--- a/extensions/gnomevfs/Makefile.in
+++ b/extensions/gnomevfs/Makefile.in
@@ -63,6 +63,13 @@ EXTRA_DSO_LDOPTS = \
 # make sure this component is never statically linked into the main
 # application.  this is necessary since we don't want to force users
 # to install gnome-vfs2 in order to use the rest of mozilla ;-)
-FORCE_SHARED_LIB= 1
+
+# XXX This will have to wait until we have a separate XPCOM again, until then...
+ifneq (_, $(BUILD_STATIC_LIBS))
+FORCE_STATIC_LIB = 1
+USE_STATIC_LIBS = 1
+else
+FORCE_SHARED_LIB = 1
+endif
 
 include $(topsrcdir)/config/rules.mk
diff --git a/js/jsd/Makefile.in b/js/jsd/Makefile.in
index 79bcee3..157538d 100644
--- a/js/jsd/Makefile.in
+++ b/js/jsd/Makefile.in
@@ -47,7 +47,7 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= jsdebug
 LIBRARY_NAME	= jsd
-FORCE_SHARED_LIB= 1
+FORCE_STATIC_LIB = 1
 ifeq ($(OS_ARCH)$(MOZ_ENABLE_LIBXUL),WINNT)
 LIBRARY_NAME	= jsd$(MOZ_BITS)$(VERSION_NUMBER)
 endif
@@ -87,7 +87,7 @@ CPPSRCS	 = jsd_xpc.cpp
 IS_COMPONENT = 1
 LIBXUL_LIBRARY = 1
 
-ifdef MOZ_ENABLE_LIBXUL
+ifneq (_, $(MOZ_ENABLE_LIBXUL)_$(BUILD_STATIC_LIBS))
 FORCE_SHARED_LIB=
 MODULE_NAME = JavaScript_Debugger
 EXPORT_LIBRARY = 1
diff --git a/js/src/Makefile.in b/js/src/Makefile.in
index 311258a..427a52a 100644
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -74,6 +74,7 @@ MODULE		    = js
 LIBRARY_NAME	    = mozjs
 STATIC_LIBRARY_NAME = js_static
 GRE_MODULE	    = 1
+DIST_INSTALL = 1
 
 LIBS		= $(NSPR_LIBS) 
 
diff --git a/js/src/configure.in b/js/src/configure.in
index 96bd3b5..45216ba 100644
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3915,6 +3915,16 @@ BUILD_STATIC_LIBS=
 ENABLE_TESTS=1
 MOZ_DBGRINFO_MODULES=
 
+# Allow the application to influence configure with a confvars.sh script.
+
+AC_MSG_CHECKING([if app-specific confvars.sh exists])
+if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
+  AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
+  . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
+else
+  AC_MSG_RESULT([no])
+fi
+
 dnl ========================================================
 dnl =
 dnl = Components & Features
@@ -4791,6 +4801,10 @@ MOZ_ARG_ENABLE_BOOL(static,
     BUILD_STATIC_LIBS=1,
     BUILD_STATIC_LIBS=)
 
+if test -n "$BUILD_STATIC_LIBS"; then
+MOZ_JS_LIBS='-L$(libdir) -ljs_static'
+fi
+
 dnl ========================================================
 dnl = Link js shell to system readline
 dnl ========================================================
diff --git a/js/src/dtoa.c b/js/src/dtoa.c
index 1fdd397..d7cb992 100644
--- a/js/src/dtoa.c
+++ b/js/src/dtoa.c
@@ -2592,7 +2592,7 @@ nrv_alloc(CONST char *s, char **rve, int n)
  * when MULTIPLE_THREADS is not defined.
  */
 
- void
+static void
 #ifdef KR_headers
 freedtoa(s) char *s;
 #else
diff --git a/modules/libpr0n/decoders/icon/Makefile.in b/modules/libpr0n/decoders/icon/Makefile.in
index 2cb4a48..6fc680e 100644
--- a/modules/libpr0n/decoders/icon/Makefile.in
+++ b/modules/libpr0n/decoders/icon/Makefile.in
@@ -56,6 +56,14 @@ LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
 endif
 
+ifdef BUILD_STATIC_LIBS
+USE_STATIC_LIBS = 1
+FORCE_STATIC_LIB = 1
+FORCE_SHARED_LIB = 
+EXPORT_LIBRARY = 1
+MOZILLA_INTERNAL_API = 1
+endif
+
 ifneq (,$(filter qt,$(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS = $(MOZ_QT_LIBS)
 PLATFORM = qt
@@ -101,7 +109,7 @@ XPIDLSRCS	= nsIIconURI.idl
 
 SHARED_LIBRARY_LIBS = $(PLATFORM)/$(LIB_PREFIX)imgicon$(PLATFORM)_s.$(LIB_SUFFIX)
 
-ifdef LIBXUL_LIBRARY
+ifneq (_, $(LIBXUL_LIBRARY)_$(BUILD_STATIC_LIBS))
 EXTRA_DSO_LDOPTS += \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
diff --git a/modules/libpr0n/decoders/icon/gtk/Makefile.in b/modules/libpr0n/decoders/icon/gtk/Makefile.in
index e6a0448..16baf9a 100644
--- a/modules/libpr0n/decoders/icon/gtk/Makefile.in
+++ b/modules/libpr0n/decoders/icon/gtk/Makefile.in
@@ -54,6 +54,10 @@ else
 LOCAL_INCLUDES += $(MOZ_GTK2_CFLAGS)
 endif
 
+ifdef BUILD_STATIC_LIBS
+MOZILLA_INTERNAL_API = 1
+endif
+
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 # This library is used by other shared libs in a static build
diff --git a/modules/plugin/Makefile.in b/modules/plugin/Makefile.in
index aef5287..9d7dbc7 100644
--- a/modules/plugin/Makefile.in
+++ b/modules/plugin/Makefile.in
@@ -46,6 +46,10 @@ MODULE		= plugin
 
 DIRS		= base/public 
 
+ifneq (_, $(BUILD_STATIC_LIBS))
+MOZ_PLUGINS = 
+endif
+
 ifdef MOZ_PLUGINS
 DIRS		+= base/src 
 
diff --git a/toolkit/components/alerts/src/mac/Makefile.in b/toolkit/components/alerts/src/mac/Makefile.in
index fb524dc..9bf6238 100644
--- a/toolkit/components/alerts/src/mac/Makefile.in
+++ b/toolkit/components/alerts/src/mac/Makefile.in
@@ -44,8 +44,12 @@ include $(DEPTH)/config/autoconf.mk
 MODULE = alerts
 LIBRARY_NAME = alerts_s
 IS_COMPONENT = 1
+ifdef BUILD_STATIC_LIBS
+#EXPORT_LIBRARY = 1
+FORCE_STATIC_LIB = 1
+else
 FORCE_SHARED_LIB = 1
-
+endif
 
 CMMSRCS = \
   nsAlertsService.mm \
diff --git a/toolkit/system/dbus/Makefile.in b/toolkit/system/dbus/Makefile.in
index 332558d..c1ed6b8 100644
--- a/toolkit/system/dbus/Makefile.in
+++ b/toolkit/system/dbus/Makefile.in
@@ -44,10 +44,15 @@ include $(DEPTH)/config/autoconf.mk
 MODULE = dbus
 LIBRARY_NAME = dbusservice
 GRE_MODULE = 1
-#EXPORT_LIBRARY = 1
 IS_COMPONENT = 1
+ifneq (, $(BUILD_STATIC_LIBS))
+EXPORT_LIBRARY = 1
+FORCE_STATIC_LIB = 1
+MODULE_NAME = nsDBusModule 
+MOZILLA_INTERNAL_API = 1
+else
 FORCE_SHARED_LIB = 1
-
+endif
 
 EXTRA_DSO_LDOPTS = \
 	$(XPCOM_GLUE_LDOPTS) \
diff --git a/toolkit/system/dbus/nsNetworkManagerListener.cpp b/toolkit/system/dbus/nsNetworkManagerListener.cpp
index 42e2d8e..d843e89 100644
--- a/toolkit/system/dbus/nsNetworkManagerListener.cpp
+++ b/toolkit/system/dbus/nsNetworkManagerListener.cpp
@@ -44,7 +44,7 @@
 #include "nsNetCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIObserverService.h"
-#include "nsStringAPI.h"
+#include "nsStringGlue.h"
 #include "nsIPrefBranch2.h"
 #include "nsIPrefService.h"
 
diff --git a/toolkit/system/gnome/Makefile.in b/toolkit/system/gnome/Makefile.in
index ace0647..d246374 100644
--- a/toolkit/system/gnome/Makefile.in
+++ b/toolkit/system/gnome/Makefile.in
@@ -44,7 +44,12 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mozgnome
 LIBRARY_NAME	= mozgnome
+ifneq (_, $(BUILD_STATIC_LIBS))
+FORCE_STATIC_LIB = 1
+USE_STATIC_LIBS = 1
+else
 FORCE_SHARED_LIB = 1
+endif
 IS_COMPONENT	= 1
 
 
diff --git a/widget/src/cocoa/nsAppShell.mm b/widget/src/cocoa/nsAppShell.mm
index 2e84227..518ca05 100644
--- a/widget/src/cocoa/nsAppShell.mm
+++ b/widget/src/cocoa/nsAppShell.mm
@@ -426,6 +426,7 @@ nsAppShell::Init()
   NS_InstallPluginKeyEventsHandler();
 #endif
 
+#ifndef __LP64__
   gCocoaAppModalWindowList = new nsCocoaAppModalWindowList;
   if (!gAppShellMethodsSwizzled) {
     nsToolkit::SwizzleMethods([NSApplication class], @selector(beginModalSessionForWindow:),
@@ -445,6 +446,7 @@ nsAppShell::Init()
     }
     gAppShellMethodsSwizzled = PR_TRUE;
   }
+#endif
 
   [localPool release];
 
diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in
index 511b89c..24b16ee 100644
--- a/xpcom/build/Makefile.in
+++ b/xpcom/build/Makefile.in
@@ -51,9 +51,8 @@ LIBRARY_NAME	= xpcom_core
 SHORT_LIBNAME	= xpcomcor
 LIBXUL_LIBRARY = 1
 
-# This is only a static library in libxul builds
-ifdef MOZ_ENABLE_LIBXUL
-EXPORT_LIBRARY = 1
+ifneq (_, $(MOZ_ENABLE_LIBXUL)_$(BUILD_STATIC_LIBS))
+DIST_INSTALL = 1
 endif
 
 GRE_MODULE	= 1
@@ -132,7 +131,9 @@ EXPORTS_mozilla = \
 # Force use of PIC
 FORCE_USE_PIC	= 1 
 
-ifndef MOZ_ENABLE_LIBXUL
+ifneq (_, $(MOZ_ENABLE_LIBXUL)_$(BUILD_STATIC_LIBS))
+FORCE_STATIC_LIB = 1
+else
 FORCE_SHARED_LIB = 1
 endif
 
diff --git a/xpcom/string/src/Makefile.in b/xpcom/string/src/Makefile.in
index e7f03b8..e6e0fbf 100644
--- a/xpcom/string/src/Makefile.in
+++ b/xpcom/string/src/Makefile.in
@@ -49,7 +49,6 @@ MODULE		= string
 LIBRARY_NAME	= string_s
 MOZILLA_INTERNAL_API = 1
 
-
 CPPSRCS		=				\
 		nsDependentString.cpp		\
 		nsDependentSubstring.cpp	\
diff --git a/xpcom/stub/Makefile.in b/xpcom/stub/Makefile.in
index f4f9ee8..422afd5 100644
--- a/xpcom/stub/Makefile.in
+++ b/xpcom/stub/Makefile.in
@@ -54,7 +54,6 @@ NSDISTMODE = copy
 GRE_MODULE	= 1
 MOZILLA_INTERNAL_API = 1
 
-
 LOCAL_INCLUDES	= -I$(srcdir)/../build
 
 CPPSRCS		= nsXPComStub.cpp
@@ -69,9 +68,12 @@ endif
 
 # Force use of PIC
 FORCE_USE_PIC	= 1 
-
 FORCE_SHARED_LIB = 1
 
+ifneq (_, $(BUILD_STATIC_LIBS))
+USE_STATIC_LIBS = 1
+endif
+
 EXTRA_DSO_LDOPTS = $(LIBS_DIR)
 
 DEPENDENT_LIBS_LIST += \
@@ -105,8 +107,12 @@ else #!MOZ_ENABLE_LIBXUL
 ifeq ($(OS_TARGET),OS2)
 EXTRA_DSO_LIBS = xpcomcor
 DEPENDENT_LIBS_LIST += xpcomcor.dll
-else
-EXTRA_DSO_LIBS = xpcom_core
+else ifeq ($(OS_TARGET),Darwin)
+EXTRA_DSO_LDOPTS += -undefined dynamic_lookup 
+else ifeq ($(OS_TARGET),Linux)
+DSO_LDOPTS = -shared
+endif
+ifneq ($(OS_TARGET),OS2)
 DEPENDENT_LIBS_LIST += $(LIB_PREFIX)xpcom_core$(DLL_SUFFIX)
 endif
 
diff --git a/xpinstall/src/Makefile.in b/xpinstall/src/Makefile.in
index d590d09..b3e7195 100644
--- a/xpinstall/src/Makefile.in
+++ b/xpinstall/src/Makefile.in
@@ -49,7 +49,7 @@ include $(DEPTH)/config/autoconf.mk
 MODULE		= xpinstall
 LIBRARY_NAME	= xpinstall
 
-ifndef MOZ_ENABLE_LIBXUL
+ifeq (_, $(MOZ_ENABLE_LIBXUL)_$(BUILD_STATIC_LIBS))
 # Make this a true dynamic component even in static builds because
 # this component is shared by installer
 FORCE_SHARED_LIB	= 1
-- 
1.6.3.3

