summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2020-08-19 14:00:20 +0900
committerSlávek Banko <slavek.banko@axis.cz>2021-02-03 22:44:26 +0100
commit0aa014e9d244fbfb04170d36d6e1eb95e1907a33 (patch)
treea7f0914e3f733713044a2e9e92c018f1672731dc
parent711ff288fa939c7cefa7bb9a81ded2a5a10a5f8f (diff)
downloadtdelibs-0aa014e9d244fbfb04170d36d6e1eb95e1907a33.tar.gz
tdelibs-0aa014e9d244fbfb04170d36d6e1eb95e1907a33.zip
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> (cherry picked from commit bbe1b42cbbc7293041a83b154f969792a2592510)
-rw-r--r--CMakeLists.txt18
-rw-r--r--config.h.cmake3
-rw-r--r--kdeui/ksconfig.cpp4
-rw-r--r--kspell2/plugins/ispell/ispell_checker.cpp4
4 files changed, 29 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a6eac81f..dfe0e503a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1074,6 +1074,24 @@ if( 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 ##########################
# we need ASPELL_DATADIR too
diff --git a/config.h.cmake b/config.h.cmake
index d84c4b087..5104a9b15 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -1,5 +1,8 @@
/* 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 ASPELL_DATADIR "@ASPELL_DATADIR@"
diff --git a/kdeui/ksconfig.cpp b/kdeui/ksconfig.cpp
index 81c6e8417..7b58d5c33 100644
--- a/kdeui/ksconfig.cpp
+++ b/kdeui/ksconfig.cpp
@@ -603,6 +603,9 @@ KSpellConfig::fillDicts( TQComboBox* box, TQStringList* dictionaries )
box->insertItem( i18n("ISpell Default") );
// dictionary path
+#ifdef ISPELL_LIBDIR
+ TQFileInfo dir (ISPELL_LIBDIR);
+#else
TQFileInfo dir ("/usr/lib/ispell");
if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/local/lib/ispell");
@@ -617,6 +620,7 @@ KSpellConfig::fillDicts( TQComboBox* box, TQStringList* dictionaries )
if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/local/lib");
*/
+#endif
if (!dir.exists() || !dir.isDir()) return;
kdDebug(750) << "KSpellConfig::getAvailDictsIspell "
diff --git a/kspell2/plugins/ispell/ispell_checker.cpp b/kspell2/plugins/ispell/ispell_checker.cpp
index b95be5e6d..083fdfdfb 100644
--- a/kspell2/plugins/ispell/ispell_checker.cpp
+++ b/kspell2/plugins/ispell/ispell_checker.cpp
@@ -55,6 +55,9 @@ typedef struct str_ispell_map
} IspellMap;
static const char *ispell_dirs [] = {
+#ifdef ISPELL_LIBDIR
+ ISPELL_LIBDIR,
+#else
"/usr/" SYSTEM_LIBDIR "/ispell",
"/usr/lib/ispell",
"/usr/local/" SYSTEM_LIBDIR "/ispell",
@@ -62,6 +65,7 @@ static const char *ispell_dirs [] = {
"/usr/local/share/ispell",
"/usr/share/ispell",
"/usr/pkg/lib",
+#endif
0
};
static const IspellMap ispell_map [] = {