dovecot-2.2: configure: Fixed/improved finding and using libextt...

dovecot at dovecot.org dovecot at dovecot.org
Mon Apr 20 12:30:51 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/68c5e0db61db
changeset: 18413:68c5e0db61db
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Apr 20 15:27:02 2015 +0300
description:
configure: Fixed/improved finding and using libexttextcat.
libexttextcat wasn't actually being used at all by fts-lucene. Now we'll
first prefer finding it via pkg-config, next finding exttextcat and only
last look up textcat.

diffstat:

 configure.ac                             |  26 ++++++++++++++++++--------
 src/plugins/fts-lucene/Makefile.am       |  10 ++++++----
 src/plugins/fts-lucene/lucene-wrapper.cc |  10 +++++-----
 3 files changed, 29 insertions(+), 17 deletions(-)

diffs (89 lines):

diff -r 1c516f905152 -r 68c5e0db61db configure.ac
--- a/configure.ac	Mon Apr 20 15:12:14 2015 +0300
+++ b/configure.ac	Mon Apr 20 15:27:02 2015 +0300
@@ -2760,17 +2760,27 @@
 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)
-  ], [
+  if test "$PKG_CONFIG" != "" && $PKG_CONFIG --exists libexttextcat 2>/dev/null; then
+    PKG_CHECK_MODULES(LIBEXTTEXTCAT, libexttextcat)
+    have_exttextcat=yes
+  else
     AC_CHECK_LIB(exttextcat, special_textcat_Init, [
       have_fts_exttextcat=yes
-      AC_DEFINE(HAVE_FTS_EXTTEXTCAT,, Define if you want libexttextcat support for FTS)
+      AC_CHECK_HEADERS(libexttextcat/textcat.h)
+      LIBEXTTEXTCAT_LIBS=-lexttextcat
+      AC_SUBST(LIBEXTTEXTCAT_LIBS)
+    ], [
+      AC_CHECK_LIB(textcat, special_textcat_Init, [
+	have_fts_textcat=yes
+        AC_CHECK_HEADERS(libtextcat/textcat.h)
+      ])
     ])
-  ])
-  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])
+    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
+  if test "$have_fts_exttextcat" != yes || test "$have_fts_textcat" != yes; then
+    AC_DEFINE(HAVE_FTS_TEXTCAT,, Define if you want textcat support for FTS)
   fi
 fi
 AM_CONDITIONAL(BUILD_FTS_TEXTCAT, test "$have_fts_textcat" = "yes")
diff -r 1c516f905152 -r 68c5e0db61db src/plugins/fts-lucene/Makefile.am
--- a/src/plugins/fts-lucene/Makefile.am	Mon Apr 20 15:12:14 2015 +0300
+++ b/src/plugins/fts-lucene/Makefile.am	Mon Apr 20 15:27:02 2015 +0300
@@ -9,7 +9,8 @@
 	-I$(top_srcdir)/src/doveadm
 
 AM_CXXFLAGS = \
-	$(CLUCENE_CFLAGS)
+	$(CLUCENE_CFLAGS) \
+	$(LIBEXTTEXTCAT_CFLAGS)
 
 NOPLUGIN_LDFLAGS =
 lib21_fts_lucene_plugin_la_LDFLAGS = -module -avoid-version
@@ -22,11 +23,12 @@
 STEMMER_LIBS = -lstemmer
 SHOWBALL_SOURCES = Snowball.cc
 endif
+
+if BUILD_FTS_EXTTEXTCAT
+TEXTCAT_LIBS = $(LIBEXTTEXTCAT_LIBS)
+else
 if BUILD_FTS_TEXTCAT
 TEXTCAT_LIBS = -ltextcat
-else
-if BUILD_FTS_EXTTEXTCAT
-TEXTCAT_LIBS = -lexttextcat
 endif
 endif
 
diff -r 1c516f905152 -r 68c5e0db61db src/plugins/fts-lucene/lucene-wrapper.cc
--- a/src/plugins/fts-lucene/lucene-wrapper.cc	Mon Apr 20 15:12:14 2015 +0300
+++ b/src/plugins/fts-lucene/lucene-wrapper.cc	Mon Apr 20 15:27:02 2015 +0300
@@ -19,12 +19,12 @@
 #include "lucene-wrapper.h"
 
 #include <sys/stat.h>
-#ifdef HAVE_FTS_TEXTCAT
+#ifdef HAVE_LIBEXTTEXTCAT_TEXTCAT_H
+#  include <libexttextcat/textcat.h>
+#elif defined (HAVE_LIBTEXTCAT_TEXTCAT_H)
 #  include <libtextcat/textcat.h>
-#else
-#ifdef HAVE_FTS_EXTTEXTCAT
-#  include <libexttextcat/textcat.h>
-#endif
+#elif defined (HAVE_FTS_TEXTCAT)
+#  include <textcat.h>
 #endif
 };
 #include <CLucene.h>


More information about the dovecot-cvs mailing list