diff options
author | Peng Wu <alexepico@gmail.com> | 2015-04-10 14:08:03 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-04-10 14:08:03 +0800 |
commit | 5ebfb006ccc4a90777c4266623fd5ee05d8d9dd4 (patch) | |
tree | e474b6a4e658e21d42b1e2bd610c7a636b5a3bc6 | |
parent | b77d7fb0df28c02389f873717a7557bb7fba62a1 (diff) | |
download | libpinyin-5ebfb006ccc4a90777c4266623fd5ee05d8d9dd4.tar.gz libpinyin-5ebfb006ccc4a90777c4266623fd5ee05d8d9dd4.tar.xz libpinyin-5ebfb006ccc4a90777c4266623fd5ee05d8d9dd4.zip |
update autoconf to detect Kyoto Cabinet
-rw-r--r-- | configure.ac | 26 | ||||
-rw-r--r-- | src/storage/Makefile.am | 5 |
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 |