Switch to unified view

a/src/aspell/rclaspell.cpp b/src/aspell/rclaspell.cpp
...
...
69
#define NMTOPTR(NM, TP)                         \
69
#define NMTOPTR(NM, TP)                         \
70
    if ((aapi.NM = TP dlsym(m_data->m_handle, #NM)) == 0) {     \
70
    if ((aapi.NM = TP dlsym(m_data->m_handle, #NM)) == 0) {     \
71
    badnames += #NM + string(" ");                  \
71
    badnames += #NM + string(" ");                  \
72
    }
72
    }
73
73
74
static const char *aspell_lib_suffixes[] = {
74
static const vector<string> aspell_lib_suffixes {
75
#if defined(__APPLE__) 
76
        ".15.dylib",
77
        ".dylib",
78
#else
75
  ".so",
79
        ".so",
76
  ".so.15",
80
        ".so.15",
77
  ".so.16"
81
        ".so.16",
82
#endif
78
};
83
};
79
static const unsigned int nlibsuffs  = sizeof(aspell_lib_suffixes) / sizeof(char *);
80
84
81
// Stuff that we don't wish to see in the .h (possible sysdeps, etc.)
85
// Stuff that we don't wish to see in the .h (possible sysdeps, etc.)
82
class AspellData {
86
class AspellData {
83
public:
87
public:
84
    AspellData() 
88
    AspellData() 
...
...
158
    reason = "aspell program not found or not executable";
162
    reason = "aspell program not found or not executable";
159
        deleteZ(m_data);
163
        deleteZ(m_data);
160
    return false;
164
    return false;
161
    }
165
    }
162
166
167
168
    // Don't know what with Apple and (DY)LD_LIBRARY_PATH. Does not work
169
    // So we look in all ../lib in the PATH...
170
#if defined(__APPLE__) 
171
    vector<string> path;
172
    const char *pp = getenv("PATH");
173
    if (pp) {
174
        stringToTokens(pp, path, ":");
175
    }
176
#endif
177
    
163
    reason = "Could not open shared library ";
178
    reason = "Could not open shared library ";
164
    string libbase("libaspell");
179
    string libbase("libaspell");
165
    string lib;
180
    string lib;
166
    for (unsigned int i = 0; i < nlibsuffs; i++) {
181
    for (const auto& suff : aspell_lib_suffixes) {
167
        lib = libbase + aspell_lib_suffixes[i];
182
        lib = libbase + suff;
168
        reason += string("[") + lib + "] ";
183
        reason += string("[") + lib + "] ";
169
        if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) {
184
        if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) {
170
            reason.erase();
185
            reason.erase();
171
            goto found;
186
            goto found;
172
        }
187
        }
188
#if defined(__APPLE__) 
189
        // Above was the normal lookup: let dlopen search the directories.
190
        // Here is for Apple. Also look at all ../lib along the PATH
191
        for (const auto& dir : path) {
192
            string lib1 = path_canon(dir + "/../lib/" + lib);
193
            if ((m_data->m_handle = dlopen(lib1.c_str(), RTLD_LAZY)) != 0) {
194
                reason.erase();
195
                lib=lib1;
196
                goto found;
197
            }
198
        }
199
#endif
173
    }
200
    }
174
    
201
    
175
 found:
202
 found:
176
    if (m_data->m_handle == 0) {
203
    if (m_data->m_handle == 0) {
177
        reason += string(" : ") + dlerror();
204
        reason += string(" : ") + dlerror();