summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac26
-rw-r--r--src/storage/Makefile.am5
2 files changed, 28 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 40efaf4..8994d7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,10 +78,31 @@ AC_CHECK_FUNCS([gettimeofday memmove memset setlocale])
AC_CHECK_HEADERS([libintl.h string.h])
-AC_CHECK_HEADER([db.h], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
+# Check Berkeley DB or Kyoto Cabinet
+DBM="BerkeleyDB"
+AC_ARG_WITH(dbm,
+ AS_HELP_STRING([--with-dbm[=NAME]],
+ [Select BerkeleyDB or KyotoCabinet]),
+ [DBM=$with_dbm], []
+)
-AC_SEARCH_LIBS([db_create], [db], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
+if test x"$DBM" = x"BerkeleyDB"; then
+ # Check Berkeley DB
+ AC_CHECK_HEADER([db.h], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
+ AC_SEARCH_LIBS([db_create], [db], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
+fi
+
+AM_CONDITIONAL([BERKELEYDB], [test x"$DBM" = x"BerkeleyDB"])
+
+if test x"$DBM" = x"KyotoCabinet"; then
+ # Check Kyoto Cabinet
+ PKG_CHECK_MODULES(KYOTOCABINET, [
+ kyotocabinet
+ ], [])
+fi
+
+AM_CONDITIONAL([KYOTOCABINET], [test x"$DBM" = x"KyotoCabinet"])
AC_CONFIG_FILES([libpinyin.pc
libpinyin.spec
@@ -108,4 +129,5 @@ AC_MSG_RESULT([
Build options:
Version $VERSION
Install prefix $prefix
+ DBM $DBM
])
diff --git a/src/storage/Makefile.am b/src/storage/Makefile.am
index d805f18..7c28ed8 100644
--- a/src/storage/Makefile.am
+++ b/src/storage/Makefile.am
@@ -49,7 +49,7 @@ libstorage_la_CXXFLAGS = "-fPIC"
libstorage_la_LDFLAGS = -static
-libstorage_la_SOURCES = phrase_index.cpp \
+libstorage_la_SOURCES = phrase_index.cpp \
phrase_large_table2.cpp \
ngram.cpp \
tag_utility.cpp \
@@ -57,3 +57,6 @@ libstorage_la_SOURCES = phrase_index.cpp \
chewing_large_table.cpp \
table_info.cpp
+if BERKELEYDB
+libstorage_la_SOURCES += ngram_bdb.cpp
+endif