Add the ability to detect ispell lib directory

Check LIBDIR ispell compile option and use only it for ispell lib directory
if found.

Signed-off-by: OBATA Akio <obache@wizdas.com>
pull/107/head
OBATA Akio 4 years ago committed by Slávek Banko
parent 2706c5674e
commit bbe1b42cbb

@ -1206,6 +1206,24 @@ if( WITH_GAMIN )
endif( WITH_GAMIN ) endif( WITH_GAMIN )
##### check for ispell ##########################
if ( NOT ISPELL_LIBDIR )
find_program( ISPELL_EXECUTABLE NAMES ispell DOC "path to the ispell executable" )
if( ISPELL_EXECUTABLE )
execute_process (
COMMAND ${ISPELL_EXECUTABLE} -vv
COMMAND awk "$1 == \"LIBDIR\" && $2 == \"=\" {gsub(/\"/, \"\", $3); print $3;}"
OUTPUT_VARIABLE ISPELL_LIBDIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
if ( ISPELL_LIBDIR )
set ( ISPELL_LIBDIR "${ISPELL_LIBDIR}" CACHE PATH "ispell lib directory contains dictionaries" )
else ( ISPELL_LIBDIR )
unset ( ISPELL_LIBDIR )
endif ( ISPELL_LIBDIR )
endif( ISPELL_EXECUTABLE )
endif ( NOT ISPELL_LIBDIR )
##### check for aspell ########################## ##### check for aspell ##########################
# we need ASPELL_DATADIR too # we need ASPELL_DATADIR too

@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.in by autoheader. */ /* config.h.in. Generated from configure.in by autoheader. */
/* Define where ispell libdir is */
#cmakedefine ISPELL_LIBDIR "@ISPELL_LIBDIR@"
/* Define where aspell data dir is */ /* Define where aspell data dir is */
#define ASPELL_DATADIR "@ASPELL_DATADIR@" #define ASPELL_DATADIR "@ASPELL_DATADIR@"

@ -54,6 +54,9 @@ typedef struct str_ispell_map
} IspellMap; } IspellMap;
static const char *ispell_dirs [] = { static const char *ispell_dirs [] = {
#ifdef ISPELL_LIBDIR
ISPELL_LIBDIR,
#else
"/usr/" SYSTEM_LIBDIR "/ispell", "/usr/" SYSTEM_LIBDIR "/ispell",
"/usr/lib/ispell", "/usr/lib/ispell",
"/usr/local/" SYSTEM_LIBDIR "/ispell", "/usr/local/" SYSTEM_LIBDIR "/ispell",
@ -61,6 +64,7 @@ static const char *ispell_dirs [] = {
"/usr/local/share/ispell", "/usr/local/share/ispell",
"/usr/share/ispell", "/usr/share/ispell",
"/usr/pkg/lib", "/usr/pkg/lib",
#endif
0 0
}; };
static const IspellMap ispell_map [] = { static const IspellMap ispell_map [] = {

@ -603,6 +603,9 @@ KSpellConfig::fillDicts( TQComboBox* box, TQStringList* dictionaries )
box->insertItem( i18n("ISpell Default") ); box->insertItem( i18n("ISpell Default") );
// dictionary path // dictionary path
#ifdef ISPELL_LIBDIR
TQFileInfo dir (ISPELL_LIBDIR);
#else
TQFileInfo dir ("/usr/lib/ispell"); TQFileInfo dir ("/usr/lib/ispell");
if (!dir.exists() || !dir.isDir()) if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/local/lib/ispell"); dir.setFile ("/usr/local/lib/ispell");
@ -617,6 +620,7 @@ KSpellConfig::fillDicts( TQComboBox* box, TQStringList* dictionaries )
if (!dir.exists() || !dir.isDir()) if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/local/lib"); dir.setFile ("/usr/local/lib");
*/ */
#endif
if (!dir.exists() || !dir.isDir()) return; if (!dir.exists() || !dir.isDir()) return;
kdDebug(750) << "KSpellConfig::getAvailDictsIspell " kdDebug(750) << "KSpellConfig::getAvailDictsIspell "

Loading…
Cancel
Save