[Snowball-discuss] Using libstemmer_c with an autotools packages

Richard Boulton richard at lemurconsulting.com
Mon Mar 26 11:46:20 BST 2007


Vegard Nossum wrote:
> Hello,
> 
> My project is using the GNU autotools (autoconf/automake) for the build
> process. We also use the Snowball stemmer. The Snowball's makefile is not
> compatible with GNU autotools, and in order to quickly integrate new
> Snowball versions into our project without having to rewrite makefiles and
> paths, I have written a script which automatically takes the
> libstemmer_c.tgz file and "converts" it to a local library which is easy
> to use with projects that use the GNU autotools.

Thanks for your submission - it seems to work.  However, I'm not 
convinced that you need to go to the lengths your script does to use 
libstemmer with autotools (and automake in particular).

I'm using libstemmer with an autotools project, simply by doing the 
following:

1) Unpack libstemmer_c.tgz so that there is a libstemmer_c subdirectory 
of the top level directory of my project.

2) Add a file "Makefile.am" to the unpacked libstemmer_c folder, containing:

noinst_LTLIBRARIES = libstemmer.la
include $(srcdir)/mkinc.mak
noinst_HEADERS = $(snowball_headers)
libstemmer_la_SOURCES = $(snowball_sources)

3) Add to the top level makefile the following lines (or modify existing 
assignments to these variables appropriately):

AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = -I$(top_srcdir)/libstemmer_c/include
SUBDIRS=libstemmer_c
<name>_LIBADD = libstemmer_c/libstemmer.la

(Where <name> is the name of the library which links against libstemmer)


Perhaps I should have documented this somewhere...

Is there any reason that the above solution doesn't work for some 
projects?  If there is, I'd be happy to incorporate your solution 
somehow, but I don't want to make things unnecessarily complicated.  I 
also like the neatness of only adding the public headers of libstemmer 
(ie, the header files in the include/ subdirectory) to the include paths 
of the other files in the project.

-- 
Richard



More information about the Snowball-discuss mailing list