From f55ffd6d912b3edf500c9a50963c8bf5d1871d38 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Wed, 5 Mar 2008 18:52:09 +0000 Subject: [PATCH] * Add support for universalchardet * Fix #ifdef for STIDO/fstream with a proper ifdef/else * Make auto3 subdir inclusion conditional * Rename libspell_hunspell to libmisc* Please note that universalchardet is only set to work with X86 for now, I'll fi$ the rest later. Originally committed to SVN as r1907. --- Makefile.am | 18 ++++++++++- aegisub/Makefile.am | 22 +++++++++----- aegisub/text_file_reader.h | 3 +- configure.in | 30 ++++++++++++++----- universalchardet/Makefile.am | 58 ++++++++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+), 17 deletions(-) create mode 100644 universalchardet/Makefile.am diff --git a/Makefile.am b/Makefile.am index 14e1a1ff6..85c06046c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,22 @@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = aegisub auto3 automation po m4macros + +if HAVE_UNIVCHARDET +univchardet = universalchardet +endif + +if HAVE_AUTO3_LUA +auto3 = auto3 +endif + + +SUBDIRS = \ + $(univchardet) \ + $(auto3) \ + aegisub \ + automation \ + po \ + m4macros EXTRA_DIST = \ intltool-extract.in \ diff --git a/aegisub/Makefile.am b/aegisub/Makefile.am index 831708062..7d5334e59 100644 --- a/aegisub/Makefile.am +++ b/aegisub/Makefile.am @@ -61,13 +61,6 @@ aegisub_LDFLAGS += @LIBASS_LIBS@ aegisub_LDADD += libsubtitle_ass.a endif -if HAVE_HUNSPELL -noinst_LIBRARIES += libspell_hunspell.a -libspell_hunspell_a_SOURCES = spellchecker_hunspell.cpp -aegisub_LDFLAGS += @HUNSPELL_LDFLAGS@ -aegisub_LDADD += libspell_hunspell.a -endif - if HAVE_AUTO4_LUA noinst_LIBRARIES += libauto4_lua.a libauto4_lua_a_SOURCES = auto4_lua.cpp auto4_lua_assfile.cpp auto4_lua_dialog.cpp auto4_lua_scriptreader.cpp @@ -98,6 +91,21 @@ aegisub_LDADD += -L$(srcdir)/../auto3 -laegisub-auto3 endif +if HAVE_HUNSPELL +noinst_LIBRARIES += libmisc_hunspell.a +libmisc_hunspell_a_SOURCES = spellchecker_hunspell.cpp +aegisub_LDFLAGS += @HUNSPELL_LDFLAGS@ +aegisub_LDADD += libmisc_hunspell.a +endif + +if HAVE_UNIVCHARDET +noinst_LIBRARIES += libmisc_universalchardet.a +libmisc_universalchardet_a_SOURCES = charset_detect.cpp +libmisc_universalchardet_a_CPPFLAGS = -D_X86_ -DTEXT_READER_USE_STDIO +aegisub_LDADD += libmisc_universalchardet.a ../universalchardet/libuniversalchardet.a +endif + + ## These aren't built, but are listed here so 'make dist' can always find all the sources ## This should also list all Win32 specific files diff --git a/aegisub/text_file_reader.h b/aegisub/text_file_reader.h index 111b10a38..9108efdd6 100644 --- a/aegisub/text_file_reader.h +++ b/aegisub/text_file_reader.h @@ -42,9 +42,10 @@ #include #include #include -#include #ifdef TEXT_READER_USE_STDIO #include +#else +#include #endif diff --git a/configure.in b/configure.in index 6bc70ec9a..79567b827 100644 --- a/configure.in +++ b/configure.in @@ -282,12 +282,24 @@ fi if test "$with_hunspell" = "yes"; then AC_DEFINE(WITH_HUNSPELL, 1, [Enable hunspell support]) fi - AM_CONDITIONAL([HAVE_HUNSPELL], [test "$with_hunspell" != "no"]) AC_SUBST(HUNSPELL_LDFLAGS) +AC_ARG_WITH(univchardet, [ --without-univchardet build without universalchardet support], univchardet_disabled="(disabled)") +if test "$with_univchardet" != "no"; then + with_univchardet="yes" + AC_DEFINE(WITH_UNIVCHARDET, 1, [Enable universalchardet support]) +else + with_univchardet="no" +fi +AM_CONDITIONAL([HAVE_UNIVCHARDET], [test "$with_univchardet" != "no"]) + + + + + ############ # Automation @@ -509,13 +521,14 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", AC_OUTPUT([ - Makefile - auto3/Makefile - automation/Makefile - po/Makefile.in - aegisub/Makefile - aegisub/bitmaps/Makefile - aegisub/posix/Makefile +Makefile +aegisub/Makefile +aegisub/bitmaps/Makefile +aegisub/posix/Makefile +universalchardet/Makefile +auto3/Makefile +automation/Makefile +po/Makefile.in ]) @@ -576,4 +589,5 @@ Subtitle Providers: Misc Packages: hunspell: $with_hunspell $hunspell_disabled + universalchardet: $with_univchardet $univchardet_disabled ]); diff --git a/universalchardet/Makefile.am b/universalchardet/Makefile.am new file mode 100644 index 000000000..d36f098f3 --- /dev/null +++ b/universalchardet/Makefile.am @@ -0,0 +1,58 @@ +noinst_LIBRARIES = libuniversalchardet.a + +AM_CPPFLAGS = -D_X86_ + +nodist_libuniversalchardet_a_SOURCES = \ + CharDistribution.cpp \ + JpCntx.cpp \ + LangBulgarianModel.cpp \ + LangCyrillicModel.cpp \ + LangGreekModel.cpp \ + LangHebrewModel.cpp \ + LangHungarianModel.cpp \ + LangThaiModel.cpp \ + nsBig5Prober.cpp \ + nsCharSetProber.cpp \ + nsEUCJPProber.cpp \ + nsEUCKRProber.cpp \ + nsEUCTWProber.cpp \ + nsEscCharsetProber.cpp \ + nsEscSM.cpp \ + nsGB2312Prober.cpp \ + nsHebrewProber.cpp \ + nsLatin1Prober.cpp \ + nsMBCSGroupProber.cpp \ + nsMBCSSM.cpp \ + nsSBCSGroupProber.cpp \ + nsSBCharSetProber.cpp \ + nsSJISProber.cpp \ + nsUTF8Prober.cpp \ + nsUniversalDetector.cpp + +nodist_libuniversalchardet_a_SOURCES += \ + CharDistribution.h \ + JpCntx.h \ + nsBig5Prober.h \ + nsCharSetProber.h \ + nsCodingStateMachine.h \ + nsEUCJPProber.h \ + nsEUCKRProber.h \ + nsEUCTWProber.h \ + nsError.h \ + nsEscCharsetProber.h \ + nsGB2312Prober.h \ + nsHebrewProber.h \ + nsLatin1Prober.h \ + nsMBCSGroupProber.h \ + nsPkgInt.h \ + nsSBCSGroupProber.h \ + nsSBCharSetProber.h \ + nsSJISProber.h \ + nsUTF8Prober.h \ + nsUniversalDetector.h \ + nscore.h \ + prcpucfg.h \ + prmem.h \ + protypes.h \ + prtypes.h \ + xpcom-config.h