[Tritonn-commit 76] [svn] [86] Added senna/mecab build options.

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2008年 1月 22日 (火) 18:08:15 JST


Revision: 86
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=tritonn&view=rev&rev=86
Author:   mir
Date:     2008-01-22 18:08:15 +0900 (Tue, 22 Jan 2008)

Log Message:
-----------
Added senna/mecab build options.

Modified Paths:
--------------
    trunk/configure.in
    trunk/src/Makefile.am

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2008-01-22 02:24:19 UTC (rev 85)
+++ trunk/configure.in	2008-01-22 09:08:15 UTC (rev 86)
@@ -39,6 +39,112 @@
 MYSQL_SRC_TEST
 AC_SUBST(MYSQL_INC)
 
+# For senna
+MECAB_INCLUDES=
+MECAB_LIBS=
+
+AC_ARG_WITH(mecab,
+[  --with-mecab[=DIR]        Specify install prefix of mecab], [
+  if test "$withval" = "yes"; then
+    MECAB_PREFIX=""
+  else
+    MECAB_PREFIX="$withval"
+  fi
+  AC_DEFINE([ENABLE_MECAB], [1], [Define to 1 if MeCab is enabled])
+
+  if test -z "$MECAB_PREFIX"; then
+    if eval 'mecab-config --prefix 2>&1 >/dev/null'; then
+      MECAB_CONFIG='mecab-config'
+      MECAB_PREFIX='mecab-config --prefix'
+      MECAB_INCLUDES="`\"$MECAB_CONFIG\" --cflags`"
+      MECAB_LIBS="${LDFLAGS} `\"$MECAB_CONFIG\" --libs`"
+    fi
+  else
+    MECAB_CONFIG="$MECAB_PREFIX/bin/mecab-config"
+
+    if test -x "$MECAB_CONFIG"; then
+      MECAB_INCLUDES="`\"$MECAB_CONFIG\" --cflags`"
+      MECAB_LIBS="`\"$MECAB_CONFIG\" --libs`"
+    else
+      MECAB_INCLUDES="-I$MECAB_PREFIX/include"
+      MECAB_LIBS="-L$MECAB_PREFIX/lib"
+    fi
+  fi
+], [
+  MECAB_PREFIX=""
+])
+
+ 
+_CPPFLAGS="${CPPFLAGS}"
+_LIBS="${LIBS}"
+CPPFLAGS="${CPPFLAGS} ${MECAB_INCLUDES}"
+LIBS="${LIBS} ${MECAB_LIBS}"
+ 
+AC_CHECK_FUNC(mecab_new, [
+  AC_DEFINE([HAVE_MECAB], [1], [Define to 1 if libmecab is available])
+  HAVE_MECAB=1
+], [
+  HAVE_MECAB=
+  MECAB_INCLUDES=
+  MECAB_LIBS=
+])
+
+CPPFLAGS="${_CPPFLAGS}"
+LIBS="${_LIBS}"
+
+AC_SUBST(MECAB_INCLUDES)
+AC_SUBST(MECAB_LIBS)
+
+SENNA_INCLUDES=
+SENNA_LIBS=
+
+AC_ARG_WITH(senna,
+[  --with-senna[=DIR]        Enable Senna fulltext search support], [
+  case "$withval" in
+  no) : ;;
+  yes|*)
+    if test "$withval" = "yes"; then
+      if eval 'senna-cfg --cflags 2>&1 >/dev/null'; then
+        SENNA_CFG="senna-cfg"
+        SENNA_PREFIX="senna-cfg --prefix"
+        SENNA_INCLUDES="`\"$SENNA_CFG\" --cflags` $MECAB_INCLUDES"
+        SENNA_LIBS="`\"$SENNA_CFG\" --libs` -lsenna $MECAB_LIBS"
+      else 
+        SENNA_INCLUDES="$MECAB_INCLUDES"
+        SENNA_LIBS="-lsenna $MECAB_LIBS"
+      fi
+    else
+      SENNA_PREFIX="$withval"
+      SENNA_CFG="$SENNA_PREFIX/bin/senna-cfg"
+      if test -x "$SENNA_CFG"; then
+        SENNA_INCLUDES="`\"$SENNA_CFG\" --cflags` $MECAB_INCLUDES"
+        SENNA_LIBS="`\"$SENNA_CFG\" --libs` -lsenna $MECAB_LIBS"
+      else
+        SENNA_INCLUDES="-I$SENNA_PREFIX/include $MECAB_INCLUDES"
+        SENNA_LIBS="-L$SENNA_PREFIX/lib -lsenna $MECAB_LIBS"
+      fi
+    fi
+
+    _CPPFLAGS="${CPPFLAGS}"
+    _LIBS="${LIBS}"
+    CPPFLAGS="${CPPFLAGS} ${SENNA_INCLUDES}"
+    LIBS="${LIBS} ${SENNA_LIBS}"
+ 
+    AC_CHECK_FUNC(sen_init, [
+      AC_DEFINE([ENABLE_SENNA], [1], [Define to 1 if Senna is enabled])
+    ], [
+      AC_MSG_ERROR([Could not find libsenna. Check your Senna installation.])
+    ])
+
+    CPPFLAGS="${_CPPFLAGS}"
+    LIBS="${_LIBS}"
+    ;;
+  esac
+])
+
+AC_SUBST([SENNA_INCLUDES])
+AC_SUBST([SENNA_LIBS])
+
 # We only support GCC and Sun's forte at the moment
 if test "$GCC" = "yes"
 then

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2008-01-22 02:24:19 UTC (rev 85)
+++ trunk/src/Makefile.am	2008-01-22 09:08:15 UTC (rev 86)
@@ -20,7 +20,7 @@
 INCLUDES =              -I$(top_srcdir)/include -I$(top_builddir)/include \
 			-I$(top_srcdir)/regex \
 			-I$(top_srcdir)/sql \
-                        -I$(srcdir) $(MYSQL_INC)
+                        -I$(srcdir) $(MYSQL_INC) @SENNA_INCLUDES@ @MECAB_INCLUDES@
 
 lib_LTLIBRARIES = libtritonn_engine.la
 libtritonn_engine_la_SOURCES = ha_tritonn.cc
@@ -32,7 +32,7 @@
 
 WRAPLIBS=
 
-LDADD =
+LDADD = @SENNA_LIBS@ @MECAB_LIBS@
 
 DEFS =                  @DEFS@
 




Tritonn-commit メーリングリストの案内
Zurück zum Archiv-Index