Bug 345080 - "Allow use of external hunspell library" [p=mh+mozilla@glandium.org (Mike Hommey) r=mscott sr=bsmedberg a1.9=schrep]
authorreed@reedloden.com
Thu, 14 Feb 2008 03:16:53 -0800
changeset 11718 1a71cbe504a326306d91bae762f60a3b29cda3c9
parent 11717 070b02f9d6017605021d34e6d26788eca0e0bb1e
child 11719 99e6172c1d7d09f26bfbcb409b0fb72779ae4abc
push idunknown
push userunknown
push dateunknown
reviewersmscott, bsmedberg
bugs345080
milestone1.9b4pre
Bug 345080 - "Allow use of external hunspell library" [p=mh+mozilla@glandium.org (Mike Hommey) r=mscott sr=bsmedberg a1.9=schrep]
config/Makefile.in
config/autoconf.mk.in
config/system-headers
configure.in
extensions/spellcheck/hunspell/src/Makefile.in
extensions/spellcheck/hunspell/src/mozHunspell.h
extensions/spellcheck/src/Makefile.in
toolkit/library/libxul-rules.mk
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -116,16 +116,17 @@ endif
 
 ifdef WRAP_SYSTEM_INCLUDES
 export::
 	if test ! -d system_wrappers; then mkdir system_wrappers; fi
 	$(PERL) $(topsrcdir)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) \
 		-DBUILD_STATIC_LIBS=$(BUILD_STATIC_LIBS) \
 		-DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \
 		-DMOZ_ENABLE_LIBXUL=$(MOZ_ENABLE_LIBXUL) \
+		-DMOZ_NATIVE_HUNSPELL=$(MOZ_NATIVE_HUNSPELL) \
 		-DMOZ_NATIVE_ZLIB=$(MOZ_NATIVE_ZLIB) \
 		-DMOZ_NATIVE_PNG=$(MOZ_NATIVE_PNG) \
 		-DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \
 		-DMOZ_NATIVE_LCMS=$(MOZ_NATIVE_LCMS) \
 		$(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
 	$(INSTALL) system_wrappers $(DIST)/include
 
 GARBAGE_DIRS += system_wrappers
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -202,16 +202,20 @@ MOZ_XUL                    = @MOZ_XUL@
 MOZ_RDF                    = @MOZ_RDF@
 
 NECKO_PROTOCOLS = @NECKO_PROTOCOLS@
 NECKO_DISK_CACHE = @NECKO_DISK_CACHE@
 NECKO_SMALL_BUFFERS = @NECKO_SMALL_BUFFERS@
 NECKO_COOKIES = @NECKO_COOKIES@
 MOZ_AUTH_EXTENSION = @MOZ_AUTH_EXTENSION@
 
+MOZ_NATIVE_HUNSPELL = @SYSTEM_HUNSPELL@
+MOZ_HUNSPELL_LIBS = @MOZ_HUNSPELL_LIBS@
+MOZ_HUNSPELL_CFLAGS = @MOZ_HUNSPELL_CFLAGS@
+
 MOZ_NATIVE_ZLIB	= @SYSTEM_ZLIB@
 MOZ_NATIVE_JPEG	= @SYSTEM_JPEG@
 MOZ_NATIVE_PNG	= @SYSTEM_PNG@
 MOZ_TREE_CAIRO = @MOZ_TREE_CAIRO@
 
 MOZ_UPDATE_XTERM = @MOZ_UPDATE_XTERM@
 MOZ_MATHML = @MOZ_MATHML@
 MOZ_PERMISSIONS = @MOZ_PERMISSIONS@
--- a/config/system-headers
+++ b/config/system-headers
@@ -963,8 +963,11 @@ lcms.h
 #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
--- a/configure.in
+++ b/configure.in
@@ -4082,16 +4082,28 @@ LIBS=$_SAVE_LIBS
 
 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
     PNG_CFLAGS="-I${PNG_DIR}/include"
     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
 fi
 
 fi # SKIP_LIBRARY_CHECKS
 
+dnl system HunSpell Support
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(system-hunspell,
+[  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
+    SYSTEM_HUNSPELL=1 )
+
+if test -n "$SYSTEM_HUNSPELL"; then
+    PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
+fi
+
+AC_SUBST(SYSTEM_HUNSPELL)
+
 dnl check whether to enable glitz
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(glitz,
 [  --enable-glitz          Enable Glitz for use with Cairo],
     MOZ_ENABLE_GLITZ=1,
     MOZ_ENABLE_GLITZ= )
 if test "$MOZ_ENABLE_GLITZ"; then
     AC_DEFINE(MOZ_ENABLE_GLITZ)
--- a/extensions/spellcheck/hunspell/src/Makefile.in
+++ b/extensions/spellcheck/hunspell/src/Makefile.in
@@ -48,30 +48,39 @@ LIBXUL_LIBRARY   = 1
 REQUIRES         = xpcom \
                    string \
                    uconv \
                    unicharutil \
                    spellchecker \
                    xulapp \
                    $(NULL)
 
-CPPSRCS          = affentry.cpp \
+CPPSRCS          = mozHunspell.cpp \
+                   $(NULL)
+
+ifndef MOZ_NATIVE_HUNSPELL
+CPPSRCS         += affentry.cpp \
                    affixmgr.cpp \
                    csutil.cpp \
                    hashmgr.cpp \
                    hunspell.cpp \
-                   mozHunspell.cpp \
                    phonet.cpp \
                    suggestmgr.cpp \
                    $(NULL)
+endif
 
 ifdef MOZ_XUL_APP
 CPPSRCS += mozHunspellDirProvider.cpp
 endif
 
 EXTRA_DSO_LDOPTS = \
                    $(LIBS_DIR) \
                    $(XPCOM_LIBS) \
                    $(NSPR_LIBS) \
                    $(MOZ_UNICHARUTIL_LIBS) \
+                   $(MOZ_HUNSPELL_LIBS) \
                    $(NULL)
 
 include $(topsrcdir)/config/rules.mk
+
+ifdef MOZ_NATIVE_HUNSPELL
+CXXFLAGS += $(MOZ_HUNSPELL_CFLAGS)
+endif
--- a/extensions/spellcheck/hunspell/src/mozHunspell.h
+++ b/extensions/spellcheck/hunspell/src/mozHunspell.h
@@ -54,17 +54,17 @@
  * 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 mozHunspell_h__
 #define mozHunspell_h__
 
-#include "hunspell.hxx"
+#include <hunspell.hxx>
 #include "mozISpellCheckingEngine.h"
 #include "mozIPersonalDictionary.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIObserver.h"
 #include "nsIUnicodeEncoder.h"
 #include "nsIUnicodeDecoder.h"
 #include "nsInterfaceHashtable.h"
--- a/extensions/spellcheck/src/Makefile.in
+++ b/extensions/spellcheck/src/Makefile.in
@@ -83,16 +83,17 @@ else
 SHARED_LIBRARY_LIBS += ../hunspell/src/$(LIB_PREFIX)hunspell_s.$(LIB_SUFFIX)
 LOCAL_INCLUDES += -I$(srcdir)/../hunspell/src
 endif
 
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
+		$(MOZ_HUNSPELL_LIBS) \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
 	-I$(topsrcdir)/xpcom/io \
 	$(NULL)
 
--- a/toolkit/library/libxul-rules.mk
+++ b/toolkit/library/libxul-rules.mk
@@ -46,16 +46,20 @@ EXTRA_DSO_LDOPTS += \
 	$(NULL)
 
 ifdef MOZ_NATIVE_ZLIB
 EXTRA_DSO_LDOPTS += $(ZLIB_LIBS)
 else
 EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
 endif
 
+ifdef MOZ_NATIVE_HUNSPELL
+EXTRA_DSO_LDOPTS += $(MOZ_HUNSPELL_LIBS)
+endif
+
 # need widget/src/windows for resource.h (included from widget.rc)
 LOCAL_INCLUDES += \
 	-I$(topsrcdir)/config \
 	-I$(topsrcdir)/widget/src/windows \
 	-I$(topsrcdir)/widget/src/build \
 	$(NULL)
 
 OS_LIBS += $(LIBICONV)