From: Peng Wu Date: Thu, 1 Jul 2010 08:17:19 +0000 (+0800) Subject: adding lua-extension flags. X-Git-Tag: 1.3.10~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e35a3aaf06ddb063c04293fc3faa5402119ea60;p=platform%2Fupstream%2Fibus-libpinyin.git adding lua-extension flags. --- diff --git a/configure.ac b/configure.ac index bea3a0f..fb3aa09 100644 --- a/configure.ac +++ b/configure.ac @@ -106,11 +106,6 @@ BOOST_FIND_HEADER([boost/signals2.hpp]) # sigc++-2.0 # ]) -# check lua -PKG_CHECK_MODULES(LUA, [ - lua -]) - # check env AC_PATH_PROG(ENV, env) AC_SUBST(ENV) @@ -170,6 +165,13 @@ AC_ARG_ENABLE(lua-extension, [enable_lua_extension=yes] ) +# check lua +PKG_CHECK_MODULES(LUA, [ + lua +], [], +[enable_lua_extension=no] +) + AM_CONDITIONAL(IBUS_BUILD_LUA_EXTENSION, [test x"$enable_lua_extension" = x"yes"]) # OUTPUT files diff --git a/src/BopomofoEngine.cc b/src/BopomofoEngine.cc index 729ad8f..71acd13 100644 --- a/src/BopomofoEngine.cc +++ b/src/BopomofoEngine.cc @@ -23,7 +23,9 @@ #include #include "RawEditor.h" #include "PunctEditor.h" +#ifdef IBUS_BUILD_LUA_EXTENSION #include "ExtEditor.h" +#endif #include "BopomofoEditor.h" #include "FallbackEditor.h" #include "Config.h" @@ -45,7 +47,11 @@ BopomofoEngine::BopomofoEngine (IBusEngine *engine) m_editors[MODE_PUNCT].reset (new PunctEditor (m_props, BopomofoConfig::instance ())); m_editors[MODE_RAW].reset (new RawEditor (m_props, BopomofoConfig::instance ())); +#ifdef IBUS_BUILD_LUA_EXTENSION m_editors[MODE_EXTENSION].reset (new ExtEditor (m_props, BopomofoConfig::instance ())); +#else + m_editors[MODE_EXTENSION].reset (new Editor (m_props, BopomofoConfig::instance ())); +#endif m_props.signalUpdateProperty ().connect (bind (&BopomofoEngine::updateProperty, this, _1)); diff --git a/src/Makefile.am b/src/Makefile.am index 5997c8d..2c2dce5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,7 +49,6 @@ ibus_engine_pinyin_c_sources = \ DoublePinyinEditor.cc \ Editor.cc \ Engine.cc \ - ExtEditor.cc \ FallbackEditor.cc \ FullPinyinEditor.cc \ HalfFullConverter.cc \ @@ -107,6 +106,11 @@ ibus_engine_pinyin_h_sources = \ Types.h \ Util.h \ $(NULL) + +if IBUS_BUILD_LUA_EXTENSION +ibus_engine_pinyin_c_sources += ExtEditor.cc +endif + ibus_engine_pinyin_SOURCES = \ $(ibus_engine_pinyin_c_sources) \ $(ibus_engine_pinyin_h_sources) \ @@ -121,15 +125,12 @@ ibus_engine_pinyin_CXXFLAGS = \ -DGETTEXT_PACKAGE=\"@GETTEXT_PACKAGE@\" \ -DPKGDATADIR=\"$(pkgdatadir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ - -I../lua/ \ $(NULL) ibus_engine_pinyin_LDADD = \ @IBUS_LIBS@ \ @SQLITE_LIBS@ \ @OPENCC_LIBS@ \ - -L../lua/ \ - -lpylua \ $(NULL) if HAVE_LIBUUID @@ -137,6 +138,21 @@ ibus_engine_pinyin_CXXFLAGS += $(LIBUUID_CFLAGS) ibus_engine_pinyin_LDADD += $(LIBUUID_LIBS) endif +if IBUS_BUILD_LUA_EXTENSION + ibus_engine_pinyin_CXXFLAGS += \ + -DIBUS_BUILD_LUA_EXTENSION \ + -I../lua/ \ + $(NULL) +endif + +if IBUS_BUILD_LUA_EXTENSION + ibus_engine_pinyin_LDADD += \ + -L../lua/ \ + -lpylua \ + $(NULL) +endif + + # if HAVE_BOOST_SIGNALS2 # # do nothing # else diff --git a/src/PinyinEngine.cc b/src/PinyinEngine.cc index 46f05a6..27bec74 100644 --- a/src/PinyinEngine.cc +++ b/src/PinyinEngine.cc @@ -23,7 +23,9 @@ #include "Config.h" #include "PunctEditor.h" #include "RawEditor.h" +#ifdef IBUS_BUILD_LUA_EXTENSION #include "ExtEditor.h" +#endif #include "FullPinyinEditor.h" #include "DoublePinyinEditor.h" #include "FallbackEditor.h" @@ -47,7 +49,11 @@ PinyinEngine::PinyinEngine (IBusEngine *engine) m_editors[MODE_PUNCT].reset (new PunctEditor (m_props, PinyinConfig::instance ())); m_editors[MODE_RAW].reset (new RawEditor (m_props, PinyinConfig::instance ())); +#ifdef IBUS_BUILD_LUA_EXTENSION m_editors[MODE_EXTENSION].reset (new ExtEditor (m_props, PinyinConfig::instance ())); +#else + m_editors[MODE_EXTENSION].reset (new Editor (m_props, PinyinConfig::instance ())); +#endif m_props.signalUpdateProperty ().connect (bind (&PinyinEngine::updateProperty, this, _1)); @@ -99,9 +105,11 @@ PinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers) case IBUS_grave: m_input_mode = MODE_PUNCT; break; +#ifdef IBUS_BUILD_LUA_EXTENSION case IBUS_i: m_input_mode = MODE_EXTENSION; break; +#endif } } else {