From baae55ac95860c8e0613dd13b3cdcf38b59c00da Mon Sep 17 00:00:00 2001 From: dockes Date: Thu, 1 Feb 2007 15:01:08 +0000 Subject: [PATCH] use configure libdir to search for aspell lib (mainly for 64 bits machines) --- src/aspell/rclaspell.cpp | 48 ++++++++++++++++++++++++++++------------ src/mk/localdefs.in | 10 ++++++++- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/aspell/rclaspell.cpp b/src/aspell/rclaspell.cpp index 20016ada..c8277e3c 100644 --- a/src/aspell/rclaspell.cpp +++ b/src/aspell/rclaspell.cpp @@ -1,6 +1,6 @@ #ifndef TEST_RCLASPELL #ifndef lint -static char rcsid[] = "@(#$Id: rclaspell.cpp,v 1.6 2006-11-30 13:38:43 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclaspell.cpp,v 1.7 2007-02-01 15:01:08 dockes Exp $ (C) 2006 J.F.Dockes"; #endif #ifdef HAVE_CONFIG_H #include "autoconfig.h" @@ -12,6 +12,8 @@ static char rcsid[] = "@(#$Id: rclaspell.cpp,v 1.6 2006-11-30 13:38:43 dockes Ex #include #include +#include + #include ASPELL_INCLUDE #include "pathut.h" @@ -115,21 +117,39 @@ bool Aspell::init(string &reason) return false; } - // For now, the aspell library has to live under the same prefix as the + // We first look for the aspell library in libdir, and also try to + // be clever with ASPELL_PROG. + vector libdirs; + libdirs.push_back(LIBDIR); +#ifdef ASPELL_PROG + // The aspell library has to live under the same prefix as the // aspell program. - string aspellPrefix = path_getfather(path_getfather(m_data->m_exec)); - string libbase = path_cat(aspellPrefix, "lib"); - libbase = path_cat(libbase, "libaspell"); - string lib; - reason = "Could not open shared library ["; - for (unsigned int i = 0; i < nlibsuffs; i++) { - lib = libbase + aspell_lib_suffixes[i]; - reason += lib + "]"; - if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) { - reason.erase(); - break; - } + { + string aspellPrefix = path_getfather(path_getfather(m_data->m_exec)); + // This would probably require some more tweaking on solaris/irix etc. + string dir = sizeof(long) > 4 ? "lib64" : "lib"; + string libaspell = path_cat(aspellPrefix, dir); + if (libaspell != LIBDIR) + libdirs.push_back(libaspell); } +#endif + + reason = "Could not open shared library "; + for (vector::iterator it = libdirs.begin(); + it != libdirs.end(); it++) { + string libbase = path_cat(*it, "libaspell"); + string lib; + for (unsigned int i = 0; i < nlibsuffs; i++) { + lib = libbase + aspell_lib_suffixes[i]; + reason += string("[") + lib + "] "; + if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) { + reason.erase(); + goto found; + } + } + } + + found: if (m_data->m_handle == 0) { reason += string(" : ") + dlerror(); return false; diff --git a/src/mk/localdefs.in b/src/mk/localdefs.in index 6db1067c..6f628f61 100644 --- a/src/mk/localdefs.in +++ b/src/mk/localdefs.in @@ -1,3 +1,6 @@ +# @(#$Id: localdefs.in,v 1.12 2007-02-01 15:01:08 dockes Exp $ (C) 2006 J.F.Dockes + +# 'Make' definitions which depend on local configuration. LIBXAPIAN=@LIBXAPIAN@ XAPIANCXXFLAGS=@XAPIANCXXFLAGS@ @@ -13,10 +16,15 @@ X_LIBS=@X_LIBS@ X_EXTRA_LIBS=@X_EXTRA_LIBS@ prefix = @prefix@ +exec_prefix = @exec_prefix@ datadir = @datadir@ +libdir = @libdir@ + RECOLL_DATADIR = ${datadir}/recoll LOCALCXXFLAGS = $(INCICONV) $(XAPIANCXXFLAGS) $(X_CFLAGS) \ - -DRECOLL_DATADIR=\"$(RECOLL_DATADIR)\" @DEFS@ + -DRECOLL_DATADIR=\"$(RECOLL_DATADIR)\" \ + -DLIBDIR=\"$(libdir)\" \ + @DEFS@ CXXFLAGS = -g -O2 -Wall -Wno-unused