changeset 18412:1c516f905152

configure: Stemmer and textcat checks are now done even if CLucene isn't used. They'll be useful for other FTS backends as well. This patch doesn't change any actual functionality.
author Timo Sirainen <tss@iki.fi>
date Mon, 20 Apr 2015 15:12:14 +0300
parents 14e6d5289a87
children 68c5e0db61db
files configure.ac src/plugins/fts-lucene/Makefile.am src/plugins/fts-lucene/fts-lucene-plugin.c src/plugins/fts-lucene/lucene-wrapper.cc
diffstat 4 files changed, 42 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Apr 20 15:02:04 2015 +0300
+++ b/configure.ac	Mon Apr 20 15:12:14 2015 +0300
@@ -160,12 +160,12 @@
 AM_CONDITIONAL(BUILD_LUCENE, test "$want_lucene" = "yes")
 
 AC_ARG_WITH(stemmer,
-AS_HELP_STRING([--with-stemmer], [Build with libstemmer support (for CLucene) (auto)]),
+AS_HELP_STRING([--with-stemmer], [Build with libstemmer support (for FTS) (auto)]),
   TEST_WITH(stemmer, $withval),
   want_stemmer=auto)
 
 AC_ARG_WITH(textcat,
-AS_HELP_STRING([--with-textcat], [Build with libtextcat support (for CLucene) (auto)]),
+AS_HELP_STRING([--with-textcat], [Build with libtextcat support (for FTS) (auto)]),
   TEST_WITH(textcat, $withval),
   want_textcat=auto)
 
@@ -2743,36 +2743,38 @@
     # FIXME: we should verify here that this actually works..
     CLUCENE_LIBS="-lclucene-shared -lclucene-core"
   ])
-  if test $want_stemmer != no; then
-    AC_CHECK_LIB(stemmer, sb_stemmer_new, [
-      have_lucene_stemmer=yes
-      AC_DEFINE(HAVE_LUCENE_STEMMER,, Define if you want stemming support for CLucene)
-      if test $want_textcat != no; then
-	AC_CHECK_LIB(textcat, special_textcat_Init, [
-	  have_lucene_textcat=yes
-	  AC_DEFINE(HAVE_LUCENE_TEXTCAT,, Define if you want textcat support for CLucene)
-	], [
-	  AC_CHECK_LIB(exttextcat, special_textcat_Init, [
-	    have_lucene_exttextcat=yes
-	    AC_DEFINE(HAVE_LUCENE_EXTTEXTCAT,, Define if you want textcat (Debian version) support for CLucene)
-	  ])
-	])
-        if test $want_textcat = yes && test "$have_lucene_exttextcat" != yes && test "$have_lucene_textcat" != yes; then
-	  AC_ERROR([Can't build with textcat support: libtextcat or libexttextcat not found])
-	fi
-      fi
-    ], [
-      if test $want_stemmer = yes; then
-	AC_ERROR([Can't build with stemmer support: libstemmer not found])
-      fi
-    ])
-  fi
   have_lucene=yes
   fts="$fts lucene"
 fi
-AM_CONDITIONAL(BUILD_LUCENE_STEMMER, test "$have_lucene_stemmer" = "yes")
-AM_CONDITIONAL(BUILD_LUCENE_TEXTCAT, test "$have_lucene_textcat" = "yes")
-AM_CONDITIONAL(BUILD_LUCENE_EXTTEXTCAT, test "$have_lucene_exttextcat" = "yes")
+
+if test $want_stemmer != no; then
+  AC_CHECK_LIB(stemmer, sb_stemmer_new, [
+    have_fts_stemmer=yes
+    AC_DEFINE(HAVE_FTS_STEMMER,, Define if you want stemming support for FTS)
+  ], [
+    if test $want_stemmer = yes; then
+      AC_ERROR([Can't build with stemmer support: libstemmer not found])
+    fi
+  ])
+fi
+AM_CONDITIONAL(BUILD_FTS_STEMMER, test "$have_fts_stemmer" = "yes")
+
+if test $want_textcat != no; then
+  AC_CHECK_LIB(textcat, special_textcat_Init, [
+    have_fts_textcat=yes
+    AC_DEFINE(HAVE_FTS_TEXTCAT,, Define if you want textcat support for FTS)
+  ], [
+    AC_CHECK_LIB(exttextcat, special_textcat_Init, [
+      have_fts_exttextcat=yes
+      AC_DEFINE(HAVE_FTS_EXTTEXTCAT,, Define if you want libexttextcat support for FTS)
+    ])
+  ])
+  if test $want_textcat = yes && test "$have_fts_exttextcat" != yes && test "$have_fts_textcat" != yes; then
+    AC_ERROR([Can't build with textcat support: libtextcat or libexttextcat not found])
+  fi
+fi
+AM_CONDITIONAL(BUILD_FTS_TEXTCAT, test "$have_fts_textcat" = "yes")
+AM_CONDITIONAL(BUILD_FTS_EXTTEXTCAT, test "$have_fts_exttextcat" = "yes")
 
 if test $have_lucene = no; then
   not_fts="$not_fts lucene"
--- a/src/plugins/fts-lucene/Makefile.am	Mon Apr 20 15:02:04 2015 +0300
+++ b/src/plugins/fts-lucene/Makefile.am	Mon Apr 20 15:12:14 2015 +0300
@@ -18,14 +18,14 @@
 module_LTLIBRARIES = \
 	lib21_fts_lucene_plugin.la
 
-if BUILD_LUCENE_STEMMER
+if BUILD_FTS_STEMMER
 STEMMER_LIBS = -lstemmer
 SHOWBALL_SOURCES = Snowball.cc
 endif
-if BUILD_LUCENE_TEXTCAT
+if BUILD_FTS_TEXTCAT
 TEXTCAT_LIBS = -ltextcat
 else
-if BUILD_LUCENE_EXTTEXTCAT
+if BUILD_FTS_EXTTEXTCAT
 TEXTCAT_LIBS = -lexttextcat
 endif
 endif
@@ -45,7 +45,7 @@
 	SnowballAnalyzer.h \
 	SnowballFilter.h
 
-if BUILD_LUCENE_TEXTCAT
+if BUILD_FTS_TEXTCAT
 exampledir = $(docdir)/example-config
 example_DATA = \
 	textcat.conf
--- a/src/plugins/fts-lucene/fts-lucene-plugin.c	Mon Apr 20 15:02:04 2015 +0300
+++ b/src/plugins/fts-lucene/fts-lucene-plugin.c	Mon Apr 20 15:12:14 2015 +0300
@@ -49,7 +49,7 @@
 	}
 	if (set->whitespace_chars == NULL)
 		set->whitespace_chars = "";
-#ifndef HAVE_LUCENE_STEMMER
+#ifndef HAVE_FTS_STEMMER
 	if (set->default_language != NULL) {
 		i_error("fts_lucene: default_language set, "
 			"but Dovecot built without stemmer support");
@@ -59,7 +59,7 @@
 	if (set->default_language == NULL)
 		set->default_language = "english";
 #endif
-#ifndef HAVE_LUCENE_TEXTCAT
+#ifndef HAVE_FTS_TEXTCAT
 	if (set->textcat_conf != NULL) {
 		i_error("fts_lucene: textcat_dir set, "
 			"but Dovecot built without textcat support");
--- a/src/plugins/fts-lucene/lucene-wrapper.cc	Mon Apr 20 15:02:04 2015 +0300
+++ b/src/plugins/fts-lucene/lucene-wrapper.cc	Mon Apr 20 15:12:14 2015 +0300
@@ -19,10 +19,10 @@
 #include "lucene-wrapper.h"
 
 #include <sys/stat.h>
-#ifdef HAVE_LUCENE_TEXTCAT
+#ifdef HAVE_FTS_TEXTCAT
 #  include <libtextcat/textcat.h>
 #else
-#ifdef HAVE_LUCENE_EXTTEXTCAT
+#ifdef HAVE_FTS_EXTTEXTCAT
 #  include <libexttextcat/textcat.h>
 #endif
 #endif
@@ -124,7 +124,7 @@
 		/* this is valid only for doveadm dump, so it doesn't matter */
 		index->set.default_language = "";
 	}
-#ifdef HAVE_LUCENE_STEMMER
+#ifdef HAVE_FTS_STEMMER
 	if (set == NULL || !set->no_snowball) {
 		index->default_analyzer =
 			_CLNEW snowball::SnowballAnalyzer(index->normalizer,
@@ -180,7 +180,7 @@
 	}
 	array_free(&index->analyzers);
 	if (--textcat_refcount == 0 && textcat != NULL) {
-#ifdef HAVE_LUCENE_TEXTCAT
+#ifdef HAVE_FTS_TEXTCAT
 		textcat_Done(textcat);
 #endif
 		textcat = NULL;
@@ -458,7 +458,7 @@
 	return 0;
 }
 
-#ifdef HAVE_LUCENE_TEXTCAT
+#ifdef HAVE_FTS_TEXTCAT
 static Analyzer *get_analyzer(struct lucene_index *index, const char *lang)
 {
 	normalizer_func_t *normalizer = index->normalizer;