null+****@clear*****
null+****@clear*****
2010年 6月 23日 (水) 16:44:27 JST
Kouhei Sutou 2010-06-23 07:44:27 +0000 (Wed, 23 Jun 2010)
New Revision: 9a87fe5dc2f19611741848d31f4878234eccbddc
Log:
check mecab_dictionary_info_t availability for old MeCab. #355
Modified files:
configure.ac
modules/tokenizers/mecab.c
Modified: configure.ac (+6 -0)
===================================================================
--- configure.ac 2010-06-23 05:57:21 +0000 (3f30e00)
+++ configure.ac 2010-06-23 07:44:27 +0000 (a2f62c9)
@@ -519,6 +519,12 @@ if test "x$with_mecab" = "xyes"; then
_SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $MECAB_CPPFLAGS"
AC_CHECK_HEADER(mecab.h, , [AC_MSG_ERROR("No mecab.h found")])
+ AC_CHECK_TYPE([mecab_dictionary_info_t],
+ [AC_DEFINE([HAVE_MECAB_DICTIONARY_INFO_T],
+ [1],
+ [Define to 1 if MeCab has the type `mecab_dictionary_info_t'.])],
+ [],
+ [[#include <mecab.h>]])
CPPFLAGS="$_SAVE_CPPFLAGS"
AC_SUBST(MECAB_CPPFLAGS)
AC_SUBST(MECAB_LDFLAGS)
Modified: modules/tokenizers/mecab.c (+2 -0)
===================================================================
--- modules/tokenizers/mecab.c 2010-06-23 05:57:21 +0000 (acd5b65)
+++ modules/tokenizers/mecab.c 2010-06-23 07:44:27 +0000 (47e3fa9)
@@ -161,6 +161,7 @@ mecab_fin(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
static void
check_mecab_dictionary_encoding(grn_ctx *ctx)
{
+#ifdef HAVE_MECAB_DICTIONARY_INFO_T
mecab_t *mecab;
mecab = mecab_new(0, NULL);
@@ -195,6 +196,7 @@ check_mecab_dictionary_encoding(grn_ctx *ctx)
grn_enctostr(encoding));
}
}
+#endif
}
grn_rc