Bug 483577 Provide a way to compile mailnews with or without external api. r=KaiRo. There are existing bugs on being able to compile with the external api.
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 26 Mar 2009 10:09:45 +0000
changeset 2282 e1cff334fba52e7fc57f5f1c1019ee8bc3cbc20f
parent 2281 8da0c039c9d4c5c9aa136d110eae584e69313cf1
child 2283 1d0a297584ffa3a022c0a4649411edb88aa72179
push idunknown
push userunknown
push dateunknown
reviewersKaiRo
bugs483577
Bug 483577 Provide a way to compile mailnews with or without external api. r=KaiRo. There are existing bugs on being able to compile with the external api.
config/autoconf.mk.in
configure.in
mailnews/Makefile.in
mailnews/addrbook/build/Makefile.in
mailnews/addrbook/src/Makefile.in
mailnews/base/build/Makefile.in
mailnews/base/search/src/Makefile.in
mailnews/base/src/Makefile.in
mailnews/base/util/Makefile.in
mailnews/build/Makefile.in
mailnews/compose/build/Makefile.in
mailnews/compose/src/Makefile.in
mailnews/db/msgdb/build/Makefile.in
mailnews/db/msgdb/src/Makefile.in
mailnews/extensions/bayesian-spam-filter/build/Makefile.in
mailnews/extensions/bayesian-spam-filter/src/Makefile.in
mailnews/extensions/mailviews/build/Makefile.in
mailnews/extensions/mailviews/src/Makefile.in
mailnews/extensions/mdn/build/Makefile.in
mailnews/extensions/mdn/src/Makefile.in
mailnews/extensions/palmsync/build/Makefile.in
mailnews/extensions/palmsync/src/Makefile.in
mailnews/extensions/smime/build/Makefile.in
mailnews/extensions/smime/src/Makefile.in
mailnews/imap/build/Makefile.in
mailnews/imap/src/Makefile.in
mailnews/imap/test/Makefile.in
mailnews/import/applemail/src/Makefile.in
mailnews/import/build/Makefile.in
mailnews/import/comm4x/src/Makefile.in
mailnews/import/eudora/src/Makefile.in
mailnews/import/oexpress/Makefile.in
mailnews/import/outlook/src/Makefile.in
mailnews/import/src/Makefile.in
mailnews/import/text/src/Makefile.in
mailnews/local/build/Makefile.in
mailnews/local/src/Makefile.in
mailnews/mapi/mapiDll/Makefile.in
mailnews/mapi/mapihook/build/Makefile.in
mailnews/mapi/mapihook/src/Makefile.in
mailnews/mime/build/Makefile.in
mailnews/mime/cthandlers/calendar/Makefile.in
mailnews/mime/cthandlers/glue/Makefile.in
mailnews/mime/cthandlers/smimestub/Makefile.in
mailnews/mime/cthandlers/vcard/Makefile.in
mailnews/mime/emitters/build/Makefile.in
mailnews/mime/emitters/src/Makefile.in
mailnews/mime/src/Makefile.in
mailnews/news/build/Makefile.in
mailnews/news/src/Makefile.in
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -570,16 +570,17 @@ DLLFLAGS = @DLLFLAGS@
 endif
 endif
 
 # Codesighs tools option, enables win32 mapfiles.
 MOZ_MAPINFO	= @MOZ_MAPINFO@
 
 MOZ_THUNDERBIRD = @MOZ_THUNDERBIRD@
 MOZ_STATIC_MAIL_BUILD = @MOZ_STATIC_MAIL_BUILD@
+MOZ_INCOMPLETE_EXTERNAL_LINKAGE = @MOZ_INCOMPLETE_EXTERNAL_LINKAGE@
 MOZ_SUNBIRD	= @MOZ_SUNBIRD@
 MOZ_SUITE	= @MOZ_SUITE@
 WINCE		= @WINCE@
 WINCE_SDK      = @WINCE_SDK@
 
 MOZ_DISTRIBUTION_ID = @MOZ_DISTRIBUTION_ID@
 
 MACOS_SDK_DIR	= @MACOS_SDK_DIR@
--- a/configure.in
+++ b/configure.in
@@ -6700,16 +6700,24 @@ MOZ_ARG_ENABLE_BOOL(static-mail,
     MOZ_STATIC_MAIL_BUILD= )
 
 if test "$MOZ_STATIC_MAIL_BUILD"; then
     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
 fi
 
 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
 
+dnl 
+MOZ_ARG_ENABLE_BOOL(incomplete-external-linkage,
+[  --enable-incomplete-external-linkage Changes some comm-central code to be built with external linkage. Developer only option, incomplete broken builds will result - There are already existing bugs for this. ],
+    MOZ_INCOMPLETE_EXTERNAL_LINKAGE=1,
+    MOZ_INCOMPLETE_EXTERNAL_LINKAGE= )
+
+AC_SUBST(MOZ_INCOMPLETE_EXTERNAL_LINKAGE)
+
 dnl ========================================================
 dnl =
 dnl = Standalone module options
 dnl = 
 dnl ========================================================
 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
 
 dnl Check for GLib and libIDL.
--- a/mailnews/Makefile.in
+++ b/mailnews/Makefile.in
@@ -47,24 +47,16 @@ MODULE       = mailnews
 PARALLEL_DIRS	= base/search/src db/msgdb db/gloda news local mime compose imap addrbook import extensions
 
 ifeq ($(OS_ARCH),WINNT)
 ifndef GNU_CC
 PARALLEL_DIRS	+= mapi/mapiDLL mapi/mapihook
 endif
 endif
 
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
- EXTRA_DSO_LDOPTS += \
-   $(TK_LIBS) \
-                       -framework Cocoa \
-  $(NULL)
-endif 
-
-
 ifdef MOZ_STATIC_MAIL_BUILD
 DIRS = build
 else
 DIRS = base/build
 endif
 
 PREF_JS_EXPORTS = $(srcdir)/mailnews.js
 
--- a/mailnews/addrbook/build/Makefile.in
+++ b/mailnews/addrbook/build/Makefile.in
@@ -44,17 +44,19 @@ LOCAL_INCLUDES += -I$(srcdir)/../src
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= addrbook
 LIBRARY_NAME	= addrbook
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsAbModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  necko \
 		  pref \
 		  mime \
 		  rdf \
 		  msgbase \
@@ -84,23 +86,34 @@ SHARED_LIBRARY_LIBS = \
 	$(NULL)
 
 ifeq ($(USE_SHORT_LIBNAME),1)
 EXTRA_DSO_LIBS += msgbsutl
 else
 EXTRA_DSO_LIBS += msgbaseutil
 endif
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 	$(LIBS_DIR) \
 	$(MOZDEPTH)/rdf/util/src/internal/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \
 	$(EXTRA_DSO_LIBS) \
 	$(MOZ_UNICHARUTIL_LIBS) \
 	$(MOZ_COMPONENT_LIBS) \
 	$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 ifeq ($(OS_ARCH),Darwin)
 EXTRA_DSO_LDOPTS += \
     $(TK_LIBS) \
     -framework Cocoa \
     $(NULL)
 endif
 
--- a/mailnews/addrbook/src/Makefile.in
+++ b/mailnews/addrbook/src/Makefile.in
@@ -41,17 +41,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= addrbook
 LIBRARY_NAME	= addrbook_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  rdf \
 		  rdfutil \
 		  toolkitcomps \
 		  appcomps \
 		  dom \
--- a/mailnews/base/build/Makefile.in
+++ b/mailnews/base/build/Makefile.in
@@ -47,17 +47,19 @@ LIBRARY_NAME	= mailnews
 ifeq ($(OS_ARCH),WINNT)
 LIBRARY_NAME	= msgbase
 RESFILE		= mail.res
 endif
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgBaseModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  necko \
 		  intl \
 		  locale \
 		  rdf \
 		  content \
@@ -94,24 +96,34 @@ SHARED_LIBRARY_LIBS = \
 		$(NULL)
 
 ifeq ($(USE_SHORT_LIBNAME),1)
 EXTRA_DSO_LIBS = msgbsutl
 else
 EXTRA_DSO_LIBS = msgbaseutil
 endif
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(MOZDEPTH)/rdf/util/src/internal/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
-		$(MOZ_JS_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 LOCAL_INCLUDES += -I$(srcdir) \
 		-I$(srcdir)/../src \
 		-I$(srcdir)/../search/src \
 		-I$(srcdir)/../util \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/mailnews/base/search/src/Makefile.in
+++ b/mailnews/base/search/src/Makefile.in
@@ -41,17 +41,19 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgbase
 XPIDL_MODULE	= msgsearch
 LIBRARY_NAME	= msgsearch_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 EXPORT_DIR	= $(DIST)/bin/isp
 
 REQUIRES	= xpcom \
 		  string \
 		  msgdb \
 		  msgbaseutil \
 		  necko \
 		  mime \
--- a/mailnews/base/src/Makefile.in
+++ b/mailnews/base/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgbase
 LIBRARY_NAME	= msgbase_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 	  	  alerts \
 		  string \
 		  necko \
 		  dom \
 		  appshell \
 		  toolkitcomps \
--- a/mailnews/base/util/Makefile.in
+++ b/mailnews/base/util/Makefile.in
@@ -46,17 +46,19 @@ MODULE		= msgbaseutil
 
 ifndef MOZ_STATIC_MAIL_BUILD
 LIBRARY_NAME	= msgbaseutil
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME	= msgbsutl
 else
 LIBRARY_NAME	= msgbsutl_s
 endif
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 META_COMPONENT = mail
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  rdf \
 		  necko \
@@ -118,25 +120,35 @@ EXPORTS		= \
 		nsMsgI18N.h \
 		nsImapMoveCoalescer.h \
 		nsMsgReadStateTxn.h \
 		$(NULL)
 
 EXTRA_JS_MODULES = \
 		folderUtils.jsm \
 		iteratorUtils.jsm
-					
+
 ifndef MOZ_STATIC_MAIL_BUILD
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 	$(LIBS_DIR) \
 	$(MOZDEPTH)/rdf/util/src/internal/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \
 	$(MOZ_UNICHARUTIL_LIBS) \
 	$(MOZ_COMPONENT_LIBS) \
 	$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 else
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 endif
 
--- a/mailnews/build/Makefile.in
+++ b/mailnews/build/Makefile.in
@@ -123,23 +123,33 @@ SHARED_LIBRARY_LIBS = \
 	        ../mime/emitters/src/$(LIB_PREFIX)emitterutil_s.$(LIB_SUFFIX) \
 	        ../extensions/bayesian-spam-filter/src/$(LIB_PREFIX)bayesflt_s.$(LIB_SUFFIX) \
 	        ../extensions/mailviews/src/$(LIB_PREFIX)mailview_s.$(LIB_SUFFIX) \
                 ../extensions/mdn/src/$(LIB_PREFIX)msgmdn_s.$(LIB_SUFFIX) \
                 ../mime/cthandlers/vcard/$(LIB_PREFIX)vcard_s.$(LIB_SUFFIX) \
                 ../mime/cthandlers/glue/$(LIB_PREFIX)mimecthglue_s.$(LIB_SUFFIX) \
                 $(NULL)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(MOZDEPTH)/rdf/util/src/internal/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \
 		$(MOZDEPTH)/modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
 		$(MOZ_JS_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS += \
   $(TK_LIBS) \
                   -framework Cocoa \
   $(NULL)
 endif 
 
--- a/mailnews/compose/build/Makefile.in
+++ b/mailnews/compose/build/Makefile.in
@@ -48,17 +48,19 @@ LIBRARY_NAME	= msgcompose
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME	= msgcompo
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgComposeModule
 ifeq ($(OS_ARCH),WINNT)
 XPIDL_MODULE	= msgcompo
 endif
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  msgbaseutil \
 		  editor \
 		  necko \
 		  dom \
@@ -83,21 +85,31 @@ EXTRA_DSO_LIBS = msgbaseutil
 endif
 
 CPPSRCS		= nsMsgCompFactory.cpp
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)msgcompose_s.$(LIB_SUFFIX) \
 		$(NULL)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 ifneq (,$(filter cocoa mac, $(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS += $(TK_LIBS)
 endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/compose/src/Makefile.in
+++ b/mailnews/compose/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgcompose
 LIBRARY_NAME	= msgcompose_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  dom \
 		  layout \
 		  editor \
 		  uriloader \
 		  msgbase \
--- a/mailnews/db/msgdb/build/Makefile.in
+++ b/mailnews/db/msgdb/build/Makefile.in
@@ -43,17 +43,19 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgdb
 LIBRARY_NAME	= msgdb
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgDBModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  locale \
 		  mork \
 		  mime \
 		  msgbase \
 		  msgbaseutil \
@@ -65,16 +67,25 @@ EXTRA_DSO_LIBS = msgbsutl
 else
 EXTRA_DSO_LIBS = msgbaseutil
 endif
 
 CPPSRCS		= nsMsgDBFactory.cpp
 
 SHARED_LIBRARY_LIBS = ../src/$(LIB_PREFIX)msgdb_s.$(LIB_SUFFIX)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/db/msgdb/src/Makefile.in
+++ b/mailnews/db/msgdb/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgdb
 LIBRARY_NAME	= msgdb_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  mork \
 		  msgbase \
 		  msgbaseutil \
 		  locale \
 		  mime \
--- a/mailnews/extensions/bayesian-spam-filter/build/Makefile.in
+++ b/mailnews/extensions/bayesian-spam-filter/build/Makefile.in
@@ -44,17 +44,19 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= bayesflt
 LIBRARY_NAME	= bayesflt
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME	= bayesflt
 IS_COMPONENT	= 1
 MODULE_NAME	= nsBayesianFilterModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  msgbase \
 		  lwbrk \
 		  string \
 		  $(NULL)
 
 ifeq ($(USE_SHORT_LIBNAME),1)
@@ -66,18 +68,27 @@ endif
 CPPSRCS		= nsBayesianFilterFactory.cpp
 
 LOCAL_INCLUDES += -I$(srcdir)/../src
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)bayesflt_s.$(LIB_SUFFIX) \
 		$(NULL)
 
+ifdef MOZILLA_INTERAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
-		$(MOZ_JS_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/extensions/bayesian-spam-filter/src/Makefile.in
+++ b/mailnews/extensions/bayesian-spam-filter/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= bayesflt
 LIBRARY_NAME	= bayesflt_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  unicharutil \
 		  msgbase \
 		  necko \
 		  msgbaseutil \
 		  lwbrk \
--- a/mailnews/extensions/mailviews/build/Makefile.in
+++ b/mailnews/extensions/mailviews/build/Makefile.in
@@ -44,17 +44,19 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mailview
 LIBRARY_NAME	= mailview
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME	= mailview
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgMailViewModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  necko \
 		  msgbaseutil \
           	  msgdb \
           	  mime \
@@ -70,17 +72,25 @@ endif
 CPPSRCS		= nsMsgMailViewsFactory.cpp
 
 LOCAL_INCLUDES += -I$(srcdir)/../src
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)mailview_s.$(LIB_SUFFIX) \
 		$(NULL)
 
+ifdef MOZILLA_INTERAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
-		$(MOZ_JS_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/extensions/mailviews/src/Makefile.in
+++ b/mailnews/extensions/mailviews/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mailview
 LIBRARY_NAME	= mailview_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  necko \
           	  mime \
 		  intl \
 		  $(NULL)
--- a/mailnews/extensions/mdn/build/Makefile.in
+++ b/mailnews/extensions/mdn/build/Makefile.in
@@ -44,17 +44,19 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgmdn
 LIBRARY_NAME	= msgmdn
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME	= msgmdn
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgMdnModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  mime \
 		  msgbase \
 		  msgbaseutil \
 		  msgdb \
 		  necko \
@@ -69,17 +71,25 @@ endif
 CPPSRCS		= nsMsgMdnFactory.cpp
 
 LOCAL_INCLUDES += -I$(srcdir)/../src
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)msgmdn_s.$(LIB_SUFFIX) \
 		$(NULL)
 
+ifdef MOZILLA_INTERAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
-		$(MOZ_JS_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/extensions/mdn/src/Makefile.in
+++ b/mailnews/extensions/mdn/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgmdn
 LIBRARY_NAME	= msgmdn_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  necko \
 		  mime \
 		  pref \
 		  intl \
--- a/mailnews/extensions/palmsync/build/Makefile.in
+++ b/mailnews/extensions/palmsync/build/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= PalmSyncProxy
 LIBRARY_NAME	= $(MODULE)
 DEFFILE		= $(win_srcdir)/PalmSyncProxy.def
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 USE_STATIC_LIBS = 1
 XPI_NAME	= palmsync
 
 EXPORTS		= IPalmSync.h
 
 CSRCS		= \
 		dlldata.c \
 		IPalmSync_p.c \
--- a/mailnews/extensions/palmsync/src/Makefile.in
+++ b/mailnews/extensions/palmsync/src/Makefile.in
@@ -42,17 +42,19 @@ VPATH       = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE			= palmsync
 LIBRARY_NAME		= $(MODULE)
 # Do not set EXPORT_LIBRARY as we do not want palmsync in the static libs list
 IS_COMPONENT		= 1
 FORCE_SHARED_LIB	= 1
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API	= 1
+endif
 XPI_NAME		= palmsync
 
 REQUIRES = \
 	xpcom \
 	PalmSyncProxy \
 	embedcomponents \
 	pref \
 	string \
@@ -92,21 +94,32 @@ EXTRA_DSO_LIBS  = msgbsutl
 else
 EXTRA_DSO_LIBS  = msgbaseutil
 endif
 
 else
 SHARED_LIBRARY_LIBS = ../../../base/util/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX)
 endif
 
+ifdef MOZILLA_INTERAL_API
 EXTRA_DSO_LDOPTS= \
         ../../../addrbook/src/$(LIB_PREFIX)addrbook_s.$(LIB_SUFFIX) \
         $(EXTRA_DSO_LIBS) \
         $(XPCOM_LIBS) \
         $(MOZ_UNICHARUTIL_LIBS) \
         $(NSPR_LIBS) \
         $(NULL)
+else
+EXTRA_DSO_LDOPTS= \
+        ../../../addrbook/src/$(LIB_PREFIX)addrbook_s.$(LIB_SUFFIX) \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 OS_LIBS     += ole32.lib shell32.lib
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DUNICODE -D_UNICODE
--- a/mailnews/extensions/smime/build/Makefile.in
+++ b/mailnews/extensions/smime/build/Makefile.in
@@ -44,17 +44,19 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgsmime
 LIBRARY_NAME	= msgsmime
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME	= msgsmime
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgSMIMEModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  mime \
 		  msgcompose \
 		  pipnss \
 		  necko \
 		  intl \
@@ -77,17 +79,25 @@ LOCAL_INCLUDES += -I$(srcdir)/../src
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)msgsmime_s.$(LIB_SUFFIX) \
 		$(NULL)
 
 ifndef MOZ_STATIC_MAIL_BUILD
 SHARED_LIBRARY_LIBS + = ../../../base/util/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX)
 endif
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
-		$(MOZ_JS_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/extensions/smime/src/Makefile.in
+++ b/mailnews/extensions/smime/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgsmime
 LIBRARY_NAME	= msgsmime_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  mime \
 		  mimetype \
 		  pipnss \
 		  msgcompose \
--- a/mailnews/imap/build/Makefile.in
+++ b/mailnews/imap/build/Makefile.in
@@ -44,17 +44,19 @@ LOCAL_INCLUDES += -I$(srcdir)/../src
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgimap
 LIBRARY_NAME	= msgimap
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= IMAP_factory
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  msgbaseutil \
 		  rdf \
 		  rdfutil \
 		  necko \
@@ -75,18 +77,29 @@ EXTRA_DSO_LIBS	= msgbaseutil
 endif
 
 CPPSRCS		= nsImapFactory.cpp
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)msgimap_s.$(LIB_SUFFIX) \
 		$(NULL)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(MOZDEPTH)/rdf/util/src/internal/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/imap/src/Makefile.in
+++ b/mailnews/imap/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgimap
 LIBRARY_NAME	= msgimap_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  rdf \
 		  msgbase \
 		  msgbaseutil \
 		  rdfutil \
 		  necko \
--- a/mailnews/imap/test/Makefile.in
+++ b/mailnews/imap/test/Makefile.in
@@ -42,17 +42,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # Module name for xpcshell tests.
 MODULE         = test_imap
 
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES = 	\
 		xpcom \
 		xpcom_ds \
 		necko \
 		nkcache \
 		string \
 		msgbase \
--- a/mailnews/import/applemail/src/Makefile.in
+++ b/mailnews/import/applemail/src/Makefile.in
@@ -39,17 +39,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH			= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE				= impapplemail
 LIBRARY_NAME	= applmail_s
 
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 META_COMPONENT = mail
 REQUIRES	= \
 		xpcom \
 		string \
 		intl \
 		import \
 		necko \
--- a/mailnews/import/build/Makefile.in
+++ b/mailnews/import/build/Makefile.in
@@ -42,17 +42,19 @@ VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = import
 LIBRARY_NAME = import
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 MODULE_NAME	= nsImportServiceModule
 
 REQUIRES	= xpcom \
 		  string \
 		  uconv \
 		  intl \
 		  impComm4xMail \
@@ -121,23 +123,34 @@ EXTRA_DSO_LDOPTS += ../../base/util/$(LI
 else
 ifeq ($(USE_SHORT_LIBNAME),1)
 EXTRA_DSO_LIBS = msgbsutl
 else
 EXTRA_DSO_LIBS = msgbaseutil
 endif # ifeq
 endif # MOZ_STATIC_MAIL_BUILD
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS += \
 	$(LIBS_DIR) \
 	$(EXTRA_DSO_LIBS) \
 	$(MOZ_UNICHARUTIL_LIBS) \
 	$(MOZDEPTH)/modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
 	$(MOZ_COMPONENT_LIBS) \
 	$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS += -framework Cocoa  \
 										$(TK_LIBS) \
 										$(NULL)
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/mailnews/import/comm4x/src/Makefile.in
+++ b/mailnews/import/comm4x/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= impComm4xMail
 LIBRARY_NAME   = imp4mail_s
 
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 META_COMPONENT  = mail
 REQUIRES	= xpcom \
 		  string \
 		  intl \
 		  import \
 		  necko \
 		  msgbase \
@@ -64,13 +66,8 @@ CPPSRCS		= 	\
 			nsComm4xMail.cpp				\
 			nsComm4xProfile.cpp				\
 			$(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
-
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-EXTRA_DSO_LDOPTS += $(TK_LIBS)
-endif
-
--- a/mailnews/import/eudora/src/Makefile.in
+++ b/mailnews/import/eudora/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= impEudra
 LIBRARY_NAME   = impEudra_s
 META_COMPONENT	= mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  import \
 		  intl \
 		  necko \
 		  addrbook \
 		  pref \
--- a/mailnews/import/oexpress/Makefile.in
+++ b/mailnews/import/oexpress/Makefile.in
@@ -39,17 +39,19 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= importOE
 LIBRARY_NAME   = importOE_s
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 META_COMPONENT	= mail
 
 REQUIRES	= xpcom \
 		  string \
 		  import \
 		  addrbook \
 		  mork \
 		  intl \
--- a/mailnews/import/outlook/src/Makefile.in
+++ b/mailnews/import/outlook/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= impOutlk
 LIBRARY_NAME   = impOutlk_s
 META_COMPONENT	= mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  import \
 		  intl \
 		  necko \
 		  addrbook \
 		  mork \
--- a/mailnews/import/src/Makefile.in
+++ b/mailnews/import/src/Makefile.in
@@ -41,17 +41,19 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = import
 LIBRARY_NAME = import_s
 
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  addrbook \
 		  uconv \
 		  msgbase \
 		  intl \
 		  necko \
--- a/mailnews/import/text/src/Makefile.in
+++ b/mailnews/import/text/src/Makefile.in
@@ -42,17 +42,19 @@ VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= impText
 
 LIBRARY_NAME   = imptext_s
 
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES =	xpcom \
 		string \
 		import \
 		intl \
 		necko \
 		addrbook \
 		pref \
--- a/mailnews/local/build/Makefile.in
+++ b/mailnews/local/build/Makefile.in
@@ -44,17 +44,19 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msglocal
 LIBRARY_NAME	= localmail
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME 	= msglocal
 IS_COMPONENT	= 1
 MODULE_NAME	= local_mail_services
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 LOCAL_INCLUDES += -I$(srcdir)/../src
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  msgbaseutil \
 		  msgdb \
 		  necko \
@@ -74,22 +76,33 @@ EXTRA_DSO_LIBS = msgbaseutil
 endif
 
 CPPSRCS		= nsMsgLocalFactory.cpp
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)msglocal_s.$(LIB_SUFFIX) \
 		$(NULL)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(MOZDEPTH)/rdf/util/src/internal/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
 ifdef MOZ_MOVEMAIL
 DEFINES	+= -DHAVE_MOVEMAIL
 endif
 
--- a/mailnews/local/src/Makefile.in
+++ b/mailnews/local/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msglocal
 LIBRARY_NAME	= msglocal_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  msgbaseutil \
 		  pref \
 		  necko \
 		  msgdb \
--- a/mailnews/mapi/mapiDll/Makefile.in
+++ b/mailnews/mapi/mapiDll/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mozMapi32
 LIBRARY_NAME	= $(MODULE)
 DEFFILE		= $(win_srcdir)/Mapi32.def
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= MapiProxy \
 		  msgMapi \
 		  xpcom \
 		  string \
 		  $(NULL)
 
 CPPSRCS		= MapiDll.cpp
--- a/mailnews/mapi/mapihook/build/Makefile.in
+++ b/mailnews/mapi/mapihook/build/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= MapiProxy
 LIBRARY_NAME	= $(MODULE)
 DEFFILE		= $(win_srcdir)/MapiProxy.def
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 EXPORTS		= msgMapi.h
 
 CSRCS		= \
 		dlldata.c \
 		msgMapi_p.c \
 		msgMapi_i.c \
 		$(NULL)
--- a/mailnews/mapi/mapihook/src/Makefile.in
+++ b/mailnews/mapi/mapihook/src/Makefile.in
@@ -43,17 +43,19 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgMapi
 LIBRARY_NAME	= $(MODULE)
 MODULE_NAME	= msgMapiModule
 EXPORT_LIBRARY  = 1
 IS_COMPONENT	= 1
 META_COMPONENT	= mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
                   string \
 		  MapiProxy \
 		  appshell \
 		  appcomps \
 		  windowwatcher \
 		  dom \
@@ -93,22 +95,31 @@ EXTRA_DSO_LIBS	= msgbsutl
 else
 EXTRA_DSO_LIBS	= msgbaseutil
 endif
 
 else
 SHARED_LIBRARY_LIBS = ../../../base/util/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX)
 endif
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS= \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(XPCOM_LIBS) \
 		$(NSPR_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 OS_LIBS		+= ole32.lib
 
 SRCS_IN_OBJDIR	= 1
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES	+= -DUNICODE -D_UNICODE
--- a/mailnews/mime/build/Makefile.in
+++ b/mailnews/mime/build/Makefile.in
@@ -43,17 +43,19 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mime
 LIBRARY_NAME	= mime
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= mime_services
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 LOCAL_INCLUDES += -I$(srcdir)/../src
 
 REQUIRES	= xpcom \
 		  string \
 		  necko \
 		  msgbase \
 		  pref \
 		  uconv \
@@ -66,17 +68,27 @@ EXTRA_DSO_LIBS = msgbaseutil
 endif
 
 CPPSRCS			= nsMimeModule.cpp
 
 SHARED_LIBRARY_LIBS = \
                 ../src/$(LIB_PREFIX)mime_s.$(LIB_SUFFIX) \
                 $(NULL)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 	        $(EXTRA_DSO_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
                 $(MOZ_COMPONENT_LIBS) \
                 $(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/mime/cthandlers/calendar/Makefile.in
+++ b/mailnews/mime/cthandlers/calendar/Makefile.in
@@ -38,17 +38,19 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= calendar
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 ifndef MOZ_STATIC_MAIL_BUILD
 LIBRARY_NAME	= calendar
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsCalendarModule
 
 else
@@ -89,22 +91,32 @@ CPPSRCS += nsCalendarFactory.cpp
 ifeq ($(USE_SHORT_LIBNAME),1)
 EXTRA_DSO_LIBS = msgbsutl
 else
 EXTRA_DSO_LIBS = msgbaseutil
 endif
 
 EXTRA_DSO_LIBS += mimecthglue_s
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
 else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
+
+else
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 endif
 
 
 include $(topsrcdir)/config/rules.mk
--- a/mailnews/mime/cthandlers/glue/Makefile.in
+++ b/mailnews/mime/cthandlers/glue/Makefile.in
@@ -41,17 +41,19 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mime
 LIBRARY_NAME	= mimecthglue_s
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  pref \
 		  uconv \
 		  necko \
 		  msgbase \
 		  $(NULL)
--- a/mailnews/mime/cthandlers/smimestub/Makefile.in
+++ b/mailnews/mime/cthandlers/smimestub/Makefile.in
@@ -43,17 +43,19 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= smime
 LIBRARY_NAME	= smimestb
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsSMIMEModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  mime \
 		  msgbase \
 		  pref \
 		  necko \
 		  uconv \
@@ -67,17 +69,26 @@ endif
 
 EXTRA_DSO_LIBS	= mimecthglue_s
 
 CPPSRCS		= \
 		nsSMIMEStub.cpp \
 		nsSMIMEStubFactory.cpp \
 		$(NULL)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES = -I$(srcdir)/../glue
--- a/mailnews/mime/cthandlers/vcard/Makefile.in
+++ b/mailnews/mime/cthandlers/vcard/Makefile.in
@@ -38,17 +38,19 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= vcard
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 ifndef MOZ_STATIC_MAIL_BUILD
 LIBRARY_NAME	= vcard
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsVCardModule
 
 else
@@ -86,23 +88,34 @@ CPPSRCS += nsVCardFactory.cpp
 
 
 ifeq ($(USE_SHORT_LIBNAME),1)
 EXTRA_DSO_LIBS = msgbsutl
 else
 EXTRA_DSO_LIBS = msgbaseutil
 endif
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
 		../glue/$(LIB_PREFIX)mimecthglue_s.$(LIB_SUFFIX) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
 else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	../glue/$(LIB_PREFIX)mimecthglue_s.$(LIB_SUFFIX) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
+
+else
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 endif
 
 
 
--- a/mailnews/mime/emitters/build/Makefile.in
+++ b/mailnews/mime/emitters/build/Makefile.in
@@ -44,17 +44,19 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mimeemitter
 LIBRARY_NAME	= mimeemitter
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 SHORT_LIBNAME	= emitter
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMimeEmitterModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 LOCAL_INCLUDES += -I$(srcdir)/../src
 
 REQUIRES	= xpcom \
 		  string \
 		  mime \
 		  necko \
 		  intl \
 		  locale \
@@ -68,17 +70,27 @@ EXTRA_DSO_LIBS = msgbaseutil
 endif
 
 CPPSRCS		= nsEmitterFactory.cpp
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)emitterutil_s.$(LIB_SUFFIX) \
 		$(NULL)
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIRS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(EXTRA_DSO_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/mime/emitters/src/Makefile.in
+++ b/mailnews/mime/emitters/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mimeemitter
 LIBRARY_NAME	= emitterutil_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  mime \
 		  msgbase \
 		  msgbaseutil \
 		  pref \
 		  necko \
--- a/mailnews/mime/src/Makefile.in
+++ b/mailnews/mime/src/Makefile.in
@@ -48,17 +48,19 @@ endif
 
 ifdef BUILD_SMIME
 DEFINES		+= -DENABLE_SMIME
 endif
 
 MODULE		= mime
 LIBRARY_NAME	= mime_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  msgbaseutil \
 		  pref \
 		  js \
 		  necko \
--- a/mailnews/news/build/Makefile.in
+++ b/mailnews/news/build/Makefile.in
@@ -43,17 +43,19 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgnews
 LIBRARY_NAME	= msgnews
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgNewsModule
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  msgbaseutil \
 		  msgdb \
 		  appcomps \
 		  toolkitcomps \
@@ -76,18 +78,29 @@ LOCAL_INCLUDES += -I$(srcdir)/../src
 SHARED_LIBRARY_LIBS = ../src/$(LIB_PREFIX)msgnews_s.$(LIB_SUFFIX)
 
 ifeq ($(USE_SHORT_LIBNAME),1)
 EXTRA_DSO_LIBS += msgbsutl
 else
 EXTRA_DSO_LIBS += msgbaseutil
 endif
 
+ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(MOZDEPTH)/rdf/util/src/internal/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(NULL)
+else
+EXTRA_DSO_LDOPTS = \
+	$(LIBS_DIR) \
+	$(EXTRA_DSO_LIBS) \
+	$(XPCOM_GLUE_LDOPTS) \
+	$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+	$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
+	$(NSPR_LIBS) \
+	$(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/news/src/Makefile.in
+++ b/mailnews/news/src/Makefile.in
@@ -40,17 +40,19 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgnews
 LIBRARY_NAME	= msgnews_s
 META_COMPONENT = mail
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
+endif
 
 REQUIRES	= xpcom \
 		  string \
 		  msgbase \
 		  msgbaseutil \
 		  necko \
 		  msgdb \
 		  locale \
@@ -83,18 +85,13 @@ CPPSRCS		= \
 		nsNewsFolder.cpp \
 		nsNntpIncomingServer.cpp \
 		nsNntpMockChannel.cpp \
 		nsNewsUtils.cpp \
 		nsNewsDownloadDialogArgs.cpp \
 		nsNewsDownloader.cpp \
 		$(NULL)
 
-EXTRA_DSO_LDOPTS = \
-		$(MOZ_COMPONENT_LIBS) \
-		$(MOZ_UNICHARUTIL_LIBS) \
-		$(NULL)
-
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk