|
a/src/aspell/rclaspell.cpp |
|
b/src/aspell/rclaspell.cpp |
|
... |
|
... |
65 |
#define NMTOPTR(NM, TP) \
|
65 |
#define NMTOPTR(NM, TP) \
|
66 |
if ((aapi.NM = TP dlsym(m_data->m_handle, #NM)) == 0) { \
|
66 |
if ((aapi.NM = TP dlsym(m_data->m_handle, #NM)) == 0) { \
|
67 |
badnames += #NM + string(" "); \
|
67 |
badnames += #NM + string(" "); \
|
68 |
}
|
68 |
}
|
69 |
|
69 |
|
70 |
static const char *aspell_progs[] = {
|
|
|
71 |
#ifdef ASPELL_PROG
|
|
|
72 |
ASPELL_PROG ,
|
|
|
73 |
#endif
|
|
|
74 |
"/usr/local/bin/aspell",
|
|
|
75 |
"/usr/bin/aspell"
|
|
|
76 |
};
|
|
|
77 |
static const unsigned int naspellprogs = sizeof(aspell_progs) / sizeof(char*);
|
|
|
78 |
static const char *aspell_lib_suffixes[] = {
|
70 |
static const char *aspell_lib_suffixes[] = {
|
79 |
".so",
|
71 |
".so",
|
80 |
".so.15",
|
72 |
".so.15",
|
81 |
".so.16"
|
73 |
".so.16"
|
82 |
};
|
74 |
};
|
|
... |
|
... |
135 |
lang = "en";
|
127 |
lang = "en";
|
136 |
m_lang = lang.substr(0, lang.find_first_of("_"));
|
128 |
m_lang = lang.substr(0, lang.find_first_of("_"));
|
137 |
}
|
129 |
}
|
138 |
|
130 |
|
139 |
m_data = new AspellData;
|
131 |
m_data = new AspellData;
|
140 |
for (unsigned int i = 0; i < naspellprogs; i++) {
|
132 |
|
141 |
if (access(aspell_progs[i], X_OK) == 0) {
|
133 |
const char *aspell_prog_from_env = getenv("ASPELL_PROG");
|
|
|
134 |
if (aspell_prog_from_env && access(aspell_prog_from_env, X_OK) == 0) {
|
142 |
m_data->m_exec = aspell_progs[i];
|
135 |
m_data->m_exec = aspell_prog_from_env;
|
143 |
break;
|
136 |
#ifdef ASPELL_PROG
|
144 |
}
|
137 |
} else if (access(ASPELL_PROG, X_OK) == 0) {
|
|
|
138 |
m_data->m_exec = ASPELL_PROG;
|
|
|
139 |
#endif // ASPELL_PROG
|
|
|
140 |
} else {
|
|
|
141 |
ExecCmd::which("aspell", m_data->m_exec);
|
145 |
}
|
142 |
}
|
|
|
143 |
|
146 |
if (m_data->m_exec.empty()) {
|
144 |
if (m_data->m_exec.empty()) {
|
147 |
reason = "aspell program not found or not executable";
|
145 |
reason = "aspell program not found or not executable";
|
148 |
deleteZ(m_data);
|
146 |
deleteZ(m_data);
|
149 |
return false;
|
147 |
return false;
|
150 |
}
|
148 |
}
|
151 |
|
149 |
|
152 |
// We first look for the aspell library in libdir, and also try to
|
150 |
// We first look for the aspell library in libdir, and also try to
|
153 |
// be clever with ASPELL_PROG.
|
151 |
// be clever with ASPELL_PROG.
|
154 |
vector<string> libdirs;
|
152 |
vector<string> libdirs;
|
155 |
libdirs.push_back(LIBDIR);
|
153 |
libdirs.push_back(LIBDIR);
|
156 |
#ifdef ASPELL_PROG
|
154 |
// If not in the standard place, the aspell library has to live
|
157 |
// The aspell library has to live under the same prefix as the
|
155 |
// under the same prefix as the aspell program.
|
158 |
// aspell program.
|
|
|
159 |
{
|
156 |
{
|
160 |
string aspellPrefix = path_getfather(path_getfather(m_data->m_exec));
|
157 |
string aspellPrefix = path_getfather(path_getfather(m_data->m_exec));
|
161 |
// This would probably require some more tweaking on solaris/irix etc.
|
158 |
// This would probably require some more tweaking on solaris/irix etc.
|
162 |
string dir = sizeof(long) > 4 ? "lib64" : "lib";
|
159 |
string dir = sizeof(long) > 4 ? "lib64" : "lib";
|
163 |
string libaspell = path_cat(aspellPrefix, dir);
|
160 |
string libaspell = path_cat(aspellPrefix, dir);
|
164 |
if (libaspell != LIBDIR)
|
161 |
if (libaspell != LIBDIR)
|
165 |
libdirs.push_back(libaspell);
|
162 |
libdirs.push_back(libaspell);
|
166 |
}
|
163 |
}
|
167 |
#endif
|
|
|
168 |
|
164 |
|
169 |
reason = "Could not open shared library ";
|
165 |
reason = "Could not open shared library ";
|
170 |
for (vector<string>::iterator it = libdirs.begin();
|
166 |
for (vector<string>::iterator it = libdirs.begin();
|
171 |
it != libdirs.end(); it++) {
|
167 |
it != libdirs.end(); it++) {
|
172 |
string libbase = path_cat(*it, "libaspell");
|
168 |
string libbase = path_cat(*it, "libaspell");
|