diff --git a/honoka/configure.ac b/honoka/configure.ac index 143f7dd..9e00c1e 100644 --- a/honoka/configure.ac +++ b/honoka/configure.ac @@ -69,6 +69,16 @@ AC_CHECK_LIB(crypt, crypt) +AC_ARG_ENABLE(wnn, +[ --enable-wnn Turn on WnnConversion], +[case "${enableval}" in + yes) wnn=true ;; + no) wnn=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-wnn) ;; +esac],[wnn=true]) +AM_CONDITIONAL(WNNCONVERSION, [test "x$wnn" = "xtrue"]) + +if test "x$wnn" = "xtrue"; then AC_CHECK_LIB(wnn7, jl_yosoku_init,, [AC_MSG_RESULT(libwnn7 not found.)]) if echo $LIBS | grep -v "wnn7" > /dev/null; then AC_CHECK_LIB(wnn, jl_yosoku_init,, [AC_MSG_RESULT(libwnn for Wnn7 not found.)]) @@ -85,16 +95,43 @@ if echo $LIBS | grep "wnn.*" > /dev/null; then AC_DEFINE([HAVE_LIBWNN6],1,[]) else - AC_MSG_ERROR(Wnn6 or Wnn7 library not found.) + AC_MSG_RESULT(Wnn6 or Wnn7 library not found.) + WNNCONVERSION="false" fi fi +if echo $LIBS | grep "wnn.*" > /dev/null; then + AC_DEFINE([HAVE_LIBWNN],1,[]) +fi +fi +AC_SUBST(WNNCONVERSION) +AC_ARG_ENABLE(anthy, +[ --enable-anthy Turn on AnthyConversion], +[case "${enableval}" in + yes) anthy=true ;; + no) anthy=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-anthy) ;; +esac],[anthy=true]) +AM_CONDITIONAL(ANTHYCONVERSION, [test "x$anthy" = "xtrue"]) + +if test "x$anthy" = "xtrue"; then AC_CHECK_HEADER([anthy/anthy.h], [ LIBS="$LIBS -lanthy -lanthydic" ],[]) if echo $LIBS | grep "anthy" > /dev/null; then AC_DEFINE([HAVE_LIBANTHY],[1],[Anthy]) +else + ANTHYCONVERSION="false" fi +fi +AC_SUBST(ANTHYCONVERSION) + +if echo $LIBS | grep -v "wnn" > /dev/null; then + if echo $LIBS | grep -v "anthy" > /dev/null; then + AC_MSG_ERROR(Wnn or Anthy library not found.) + fi +fi + # Checks for header files. AC_HEADER_STDC diff --git a/honoka/m4/Makefile b/honoka/m4/Makefile index 4dba651..4c0e56e 100644 --- a/honoka/m4/Makefile +++ b/honoka/m4/Makefile @@ -66,6 +66,9 @@ AMDEP_FALSE = # AMDEP_TRUE = AMTAR = ${SHELL} /home/tamra/ANef/honoka/missing --run tar +ANTHYCONVERSION = +ANTHYCONVERSION_FALSE = # +ANTHYCONVERSION_TRUE = AR = ar AUTOCONF = ${SHELL} /home/tamra/ANef/honoka/missing --run autoconf AUTOHEADER = ${SHELL} /home/tamra/ANef/honoka/missing --run autoheader @@ -164,6 +167,9 @@ USE_INCLUDED_LIBINTL = no USE_NLS = yes VERSION = 0.3.0 +WNNCONVERSION = +WNNCONVERSION_FALSE = # +WNNCONVERSION_TRUE = XGETTEXT = /usr/bin/xgettext ac_aux_dir = . ac_ct_AR = ar diff --git a/honoka/m4/Makefile.in b/honoka/m4/Makefile.in index 2b20a38..630d312 100644 --- a/honoka/m4/Makefile.in +++ b/honoka/m4/Makefile.in @@ -66,6 +66,9 @@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +ANTHYCONVERSION = @ANTHYCONVERSION@ +ANTHYCONVERSION_FALSE = @ANTHYCONVERSION_FALSE@ +ANTHYCONVERSION_TRUE = @ANTHYCONVERSION_TRUE@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -164,6 +167,9 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WNNCONVERSION = @WNNCONVERSION@ +WNNCONVERSION_FALSE = @WNNCONVERSION_FALSE@ +WNNCONVERSION_TRUE = @WNNCONVERSION_TRUE@ XGETTEXT = @XGETTEXT@ ac_aux_dir = @ac_aux_dir@ ac_ct_AR = @ac_ct_AR@ diff --git a/honoka/src/Makefile.am b/honoka/src/Makefile.am index ac13818..563adbd 100644 --- a/honoka/src/Makefile.am +++ b/honoka/src/Makefile.am @@ -29,11 +29,19 @@ wnnconversion.h honoka_def.h preeditor.h kanainput.h convertor.h anthyconversion.h \ honokapluginbase.h +if WNNCONVERSION +WNNSOURCE = wnnconversion.cpp +endif + +if ANTHYCONVERSION +ANTHYSOURCE = anthyconversion.cpp +endif + moduledir = @SCIM_MODULEDIR@/IMEngine module_LTLIBRARIES = honoka.la -honoka_la_SOURCES = honoka_imengine.cpp romkan.cpp wnnconversion.cpp convertor.cpp preeditor.cpp \ - kanainput.cpp anthyconversion.cpp \ +honoka_la_SOURCES = honoka_imengine.cpp romkan.cpp convertor.cpp preeditor.cpp \ + kanainput.cpp $(WNNSOURCE) $(ANTHYSOURCE) \ honokapluginbase.cpp honoka_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ diff --git a/honoka/src/anthyconversion.cpp b/honoka/src/anthyconversion.cpp index 4c6f0b5..b039399 100644 --- a/honoka/src/anthyconversion.cpp +++ b/honoka/src/anthyconversion.cpp @@ -19,8 +19,6 @@ ***************************************************************************/ #include "anthyconversion.h" -#ifdef HAVE_LIBANTHY - AnthyConversion::AnthyConversion(ConfigPointer cfg) : Convertor(cfg) { @@ -172,5 +170,4 @@ return(String("Anthy")); } -#endif diff --git a/honoka/src/anthyconversion.h b/honoka/src/anthyconversion.h index 9660501..0cd0595 100644 --- a/honoka/src/anthyconversion.h +++ b/honoka/src/anthyconversion.h @@ -24,7 +24,6 @@ #include #endif -#ifdef HAVE_LIBANTHY #define Uses_SCIM_CONFIG_BASE @@ -79,6 +78,5 @@ }; -#endif #endif diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp index b825d1b..14d26e3 100644 --- a/honoka/src/honoka_imengine.cpp +++ b/honoka/src/honoka_imengine.cpp @@ -55,6 +55,13 @@ #endif +#define DEFAULT 0 +#define IKEIJI 1 +#define RENSOU 2 +#define YOSOKU 3 + + + static Pointer _honoka_factory; static ConfigPointer _scim_config; @@ -184,7 +191,9 @@ preeditors.push_back(new KanaInput(_scim_config)); m_preeditor = preeditors.at(0); + #ifdef HAVE_LIBWNN convertors.push_back(new WnnConversion(_scim_config)); + #endif #ifdef HAVE_LIBANTHY convertors.push_back(new AnthyConversion(_scim_config)); #endif diff --git a/honoka/src/honoka_imengine.h b/honoka/src/honoka_imengine.h index 10a78bb..8e18434 100644 --- a/honoka/src/honoka_imengine.h +++ b/honoka/src/honoka_imengine.h @@ -20,21 +20,25 @@ #ifndef SCIM_WNN_IMENGINE_H #define SCIM_WNN_IMENGINE_H +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include #include #include -#include -#include +#ifdef HAVE_LIBWNN + #include +#endif +#ifdef HAVE_LIBANTHY + #include +#endif #define Uses_SCIM_ICONV #include #include -#ifdef HAVE_CONFIG_H -#include -#endif - using namespace scim; using namespace std; diff --git a/honoka/src/wnnconversion.cpp b/honoka/src/wnnconversion.cpp index 48d40a7..01892e6 100644 --- a/honoka/src/wnnconversion.cpp +++ b/honoka/src/wnnconversion.cpp @@ -18,6 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "wnnconversion.h" + + #include #ifdef HAVE_CONFIG_H @@ -502,5 +504,3 @@ return(String("Wnn")); } - - diff --git a/honoka/src/wnnconversion.h b/honoka/src/wnnconversion.h index 39114b2..cf0df0f 100644 --- a/honoka/src/wnnconversion.h +++ b/honoka/src/wnnconversion.h @@ -20,6 +20,9 @@ #ifndef WNNCONVERSION_H #define WNNCONVERSION_H +#ifdef HAVE_CONFIG_H +#include +#endif #include #include @@ -31,9 +34,6 @@ #include #include -#ifdef HAVE_CONFIG_H -#include -#endif