SOURCES: sphinx-system-libstemmer.patch (NEW) - use system libstemmer

adamg adamg at pld-linux.org
Sun Aug 3 22:36:54 CEST 2008


Author: adamg                        Date: Sun Aug  3 20:36:54 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use system libstemmer

---- Files affected:
SOURCES:
   sphinx-system-libstemmer.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/sphinx-system-libstemmer.patch
diff -u /dev/null SOURCES/sphinx-system-libstemmer.patch:1.1
--- /dev/null	Sun Aug  3 22:36:55 2008
+++ SOURCES/sphinx-system-libstemmer.patch	Sun Aug  3 22:36:49 2008
@@ -0,0 +1,195 @@
+diff -burN sphinx-0.9.8.orig/acinclude.m4 sphinx-0.9.8/acinclude.m4
+--- sphinx-0.9.8.orig/acinclude.m4	2008-08-03 02:22:01.000000000 +0200
++++ sphinx-0.9.8/acinclude.m4	2008-08-03 12:23:47.000000000 +0200
+@@ -254,6 +254,90 @@
+ ])
+ 
+ dnl ---------------------------------------------------------------------------
++dnl Macro: AC_CHECK_LIBSTEMMER
++dnl First check for custom libstemmer paths in --with-libstemmer-* options.
++dnl If some paths are missing, try to guess them
++dnl ---------------------------------------------------------------------------
++
++AC_DEFUN([AC_CHECK_LIBSTEMMER],[
++
++# internal libstemmer_c ?
++internal=0
++
++# Check for custom includes path
++if test [ -z "$ac_cv_libstemmer_includes" ] 
++then 
++	AC_ARG_WITH([libstemmer-includes], 
++		AC_HELP_STRING([--with-libstemmer-includes], [path to libstemmer header files]),
++		[ac_cv_libstemmer_includes=$withval])
++fi
++if test [ -n "$ac_cv_libstemmer_includes" ]
++then
++	AC_CACHE_CHECK([libstemmer includes], [ac_cv_libstemmer_includes], [ac_cv_libstemmer_includes=""])
++	LIBSTEMMER_CFLAGS="-I$ac_cv_libstemmer_includes"
++fi
++
++# Check for custom library path
++if test [ -z "$ac_cv_libstemmer_libs" ]
++then
++	AC_ARG_WITH([libstemmer-libs], 
++		AC_HELP_STRING([--with-libstemmer-libs], [path to libstemmer library]),
++		[ac_cv_libstemmer_libs=$withval])
++fi
++if test [ -n "$ac_cv_libstemmer_libs" ]
++then
++	AC_CACHE_CHECK([libstemmer libraries], [ac_cv_libstemmer_libs], [ac_cv_libstemmer_libs=""])
++	LIBSTEMMER_LIBS="-L$ac_cv_libstemmer_libs"
++fi
++
++# If some path is missing, try to autodetermine
++if test [ -z "$ac_cv_libstemmer_includes" -o -z "$ac_cv_libstemmer_libs" ]
++then
++        if test [ -z "$ac_cv_libstemmer_includes" ]
++        then
++            AC_MSG_CHECKING(libstemmer C flags)
++	    includedir=
++            for dir in /usr/include /usr/include/libstemmer
++	    do
++		if test -f $dir/libstemmer.h; then
++			includedir="-I$dir"
++			break;
++		fi
++	    done
++            if test x$includedir != x; then
++		LIBSTEMMER_CFLAGS="-I$dir"
++		AC_MSG_RESULT($LIBSTEMMER_CFLAGS)
++	    else
++		AC_MSG_ERROR([not found])
++	    fi
++        fi
++        if test [ -z "$ac_cv_libstemmer_libs" ]
++        then
++            AC_MSG_CHECKING(libstemmer linker flags)
++		libstemmerlibs=
++		for dir in /usr/lib /usr/lib64
++	        do
++			if test -f $dir/libstemmer.so; then
++				libstemmerlibs="-L$dir -lstemmer"
++				break;
++			fi
++			if test -f $dir/libstemmer.a; then
++				libstemmerlibs="$dir/libstemmer.a"
++				break;
++			fi
++		done
++		if test [ -n "$libstemmerlibs" ]
++		then
++			LIBSTEMMER_LIBS="$libstemmerlibs"
++			AC_MSG_RESULT($LIBSTEMMER_LIBS)
++		else
++			AC_MSG_ERROR([not found])
++		fi
++        fi
++fi
++])
++
++dnl ---------------------------------------------------------------------------
+ dnl Macro: SPHINX_CONFIGURE_PART
+ dnl
+ dnl Tells what stage is ./configure running now, nicely formatted
+diff -burN sphinx-0.9.8.orig/configure.ac sphinx-0.9.8/configure.ac
+--- sphinx-0.9.8.orig/configure.ac	2008-08-03 02:22:01.000000000 +0200
++++ sphinx-0.9.8/configure.ac	2008-08-03 12:42:07.000000000 +0200
+@@ -142,9 +142,6 @@
+ AM_CONDITIONAL(USE_PGSQL, test x$ac_cv_use_pgsql != xno)
+ 
+ 
+-# we can now set preprocessor flags for both C and C++ compilers
+-CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS $PGSQL_CFLAGS"
+-
+ dnl ---
+ 
+ AC_MSG_CHECKING([whether to use 64-bit document/word IDs])
+@@ -169,9 +166,31 @@
+ 
+ AC_MSG_CHECKING([whether to compile with libstemmer support])
+ if test x$ac_cv_use_libstemmer != xno; then
++		AC_MSG_RESULT([yes])
++	AC_CHECK_LIBSTEMMER([$ac_cv_use_listemmer])
++	AC_DEFINE(USE_LIBSTEMMER, 1, [Define to 1 if you want to compile with libstemmer support])
++	AC_SUBST([LIBSTEMMER_LIBS])
++	AC_SUBST([LIBSTEMMER_CFLAGS])
++else
++	AC_MSG_RESULT([no])
++fi
++AM_CONDITIONAL(USE_LIBSTEMMER, test x$ac_cv_use_libstemmer != xno)
++
++dnl ---
++AC_ARG_WITH([internal-libstemmer],
++	    AC_HELP_STRING([--with-internal-libstemmer], [compile with internali libstemmer]),
++	    [ac_cv_use_internal_libstemmer=$withval], [ac_cv_use_internal_libstemmer=no]
++)
++
++AC_MSG_CHECKING([whether to compile with internal libstemmer])
++if test x$ac_cv_use_internal_libstemmer != xno; then
+ 	if test -d libstemmer_c && test -f libstemmer_c/include/libstemmer.h; then
+ 		AC_MSG_RESULT([yes])
+-		AC_DEFINE(USE_LIBSTEMMER, 1, [libstemmer support])
++		INTERNAL_LIBSTEMMER_LIBS="\$(top_srcdir)/libstemmer_c/libstemmer.a"
++		INTERNAL_LIBSTEMMER_CFLAGS="-I\$(top_srcdir)/libstemmer_c/include"
++		AC_SUBST([INTERNAL_LIBSTEMMER_LIBS])
++		AC_SUBST([INTERNAL_LIBSTEMMER_CFLAGS])
++		AC_DEFINE(USE_INTERNAL_LIBSTEMMER, 1, [internal libstemmer support])
+ 	else
+ 		AC_MSG_ERROR([missing libstemmer sources from libstemmer_c.
+ 
+@@ -181,10 +200,13 @@
+ ])
+ 	fi
+ else
+-	AC_MSG_RESULT([no])
+-	AC_DEFINE(USE_LIBSTEMMER, 0, [libstemmer support])
++	AC_DEFINE(USE_INTERNAL_LIBSTEMMER, 0, [internal libstemmer support])
+ fi
+-AM_CONDITIONAL(USE_LIBSTEMMER, test x$ac_cv_use_libstemmer != xno)
++AM_CONDITIONAL(USE_INTERNAL_LIBSTEMMER, test x$ac_cv_use_internal_libstemmer != xno)
++
++
++# we can now set preprocessor flags for both C and C++ compilers
++CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS $PGSQL_CFLAGS $LIBSTEMMER_CFLAGS $INTERNAL_LIBSTEMMER_CFLAGS"
+ 
+ dnl ---
+ 
+diff -burN sphinx-0.9.8.orig/Makefile.am sphinx-0.9.8/Makefile.am
+--- sphinx-0.9.8.orig/Makefile.am	2008-08-03 02:22:01.000000000 +0200
++++ sphinx-0.9.8/Makefile.am	2008-08-03 02:56:01.000000000 +0200
+@@ -1,4 +1,4 @@
+-if USE_LIBSTEMMER
++if USE_INTERNAL_LIBSTEMMER
+ SUBDIRS = libstemmer_c src test
+ else
+ SUBDIRS = src test
+diff -burN sphinx-0.9.8.orig/src/Makefile.am sphinx-0.9.8/src/Makefile.am
+--- sphinx-0.9.8.orig/src/Makefile.am	2008-08-03 02:22:01.000000000 +0200
++++ sphinx-0.9.8/src/Makefile.am	2008-08-03 12:32:28.000000000 +0200
+@@ -19,13 +19,7 @@
+ extract-version:
+ 	if test -d ../.svn; then svn info .. --xml | perl svnxrev.pl; fi;
+ 
+-if USE_LIBSTEMMER
+-LIBSTEMMER_LIBS = $(top_srcdir)/libstemmer_c/libstemmer.a
+-AM_CPPFLAGS = -I$(top_srcdir)/libstemmer_c/include -DSYSCONFDIR="\"$(sysconfdir)\""
+-else
+-LIBSTEMMER_LIBS =
+ AM_CPPFLAGS = -DSYSCONFDIR="\"$(sysconfdir)\""
+-endif
+ 
+ COMMON_LIBS = libsphinx.a $(LIBSTEMMER_LIBS) $(MYSQL_LIBS) $(PGSQL_LIBS)
+ LDADD = $(COMMON_LIBS)
+diff -burN sphinx-0.9.8.orig/src/sphinx.cpp sphinx-0.9.8/src/sphinx.cpp
+--- sphinx-0.9.8.orig/src/sphinx.cpp	2008-08-03 02:22:01.000000000 +0200
++++ sphinx-0.9.8/src/sphinx.cpp	2008-08-03 02:22:11.000000000 +0200
+@@ -31,7 +31,7 @@
+ #include <float.h>
+ 
+ #if USE_LIBSTEMMER
+-#include "libstemmer.h"
++#include <libstemmer.h>
+ #endif
+ 
+ #if USE_LIBEXPAT
================================================================


More information about the pld-cvs-commit mailing list