Use system libdir when searching for dynamically loaded libraries.

This prevents finding an incorrect architecture on multi-arch systems.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/25/head
Slávek Banko 5 years ago
parent c49ee53043
commit 8a859540c3
Signed by: SlavekB
GPG Key ID: 608F5293A04BE668

@ -141,6 +141,18 @@ if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
##### get the system's default path for libraries
tde_save_and_set( CMAKE_INSTALL_PREFIX "/usr" )
include( GNUInstallDirs OPTIONAL )
if( CMAKE_INSTALL_LIBDIR )
set( SYSTEM_LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
else( )
set( SYSTEM_LIBDIR "lib${LIB_SUFFIX}" )
endif( )
tde_restore( CMAKE_INSTALL_PREFIX )
##### check for compiler capabilities ########### ##### check for compiler capabilities ###########
include( CheckCXXCompilerFlag ) include( CheckCXXCompilerFlag )

@ -790,6 +790,7 @@
/* Suffix for lib directories */ /* Suffix for lib directories */
#define KDELIBSUFF "@KDELIBSUFF@" #define KDELIBSUFF "@KDELIBSUFF@"
#define SYSTEM_LIBDIR "@SYSTEM_LIBDIR@"
/* The compiled in system configuration prefix */ /* The compiled in system configuration prefix */
#define KDESYSCONFDIR "@CONFIG_INSTALL_DIR@" #define KDESYSCONFDIR "@CONFIG_INSTALL_DIR@"

@ -254,13 +254,13 @@ KSocks::KSocks(TDEConfigBase *config) : _socksLib(0L), _st(0L) {
return; return;
_libPaths << "" _libPaths << ""
<< "/usr/lib" KDELIBSUFF "/" << "/usr/" SYSTEM_LIBDIR "/"
<< "/usr/lib/" << "/usr/lib/"
<< "/usr/local/lib" KDELIBSUFF "/" << "/usr/local/" SYSTEM_LIBDIR "/"
<< "/usr/local/lib/" << "/usr/local/lib/"
<< "/usr/local/socks5/lib" KDELIBSUFF "/" << "/usr/local/socks5/" SYSTEM_LIBDIR "/"
<< "/usr/local/socks5/lib/" << "/usr/local/socks5/lib/"
<< "/opt/socks5/lib" KDELIBSUFF "/" << "/opt/socks5/" SYSTEM_LIBDIR "/"
<< "/opt/socks5/lib/"; << "/opt/socks5/lib/";
_libNames << "libsocks.so" // Dante _libNames << "libsocks.so" // Dante
<< "libdsocksd.so.0" // Dante 1.1.14-2 on << "libdsocksd.so.0" // Dante 1.1.14-2 on

@ -28,7 +28,6 @@
#include <tdeconfig.h> #include <tdeconfig.h>
#include <kstaticdeleter.h> #include <kstaticdeleter.h>
#include <tqregexp.h> #include <tqregexp.h>
#include <tqdir.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -324,7 +323,7 @@ TDEConfig *cfg;
#ifdef __OpenBSD__ #ifdef __OpenBSD__
{ {
TQString libname = findMostRecentLib("/usr/lib" KDELIBSUFF, "crypto"); TQString libname = findMostRecentLib("/usr/" SYSTEM_LIBDIR, "crypto");
if (!libname.isNull()) if (!libname.isNull())
_cryptoLib = ll->globalLibrary(libname.latin1()); _cryptoLib = ll->globalLibrary(libname.latin1());
} }
@ -349,13 +348,13 @@ TDEConfig *cfg;
#ifdef _AIX #ifdef _AIX
<< "/opt/freeware/lib/" << "/opt/freeware/lib/"
#endif #endif
<< "/usr/lib" KDELIBSUFF "/" << "/usr/" SYSTEM_LIBDIR "/"
<< "/usr/ssl/lib" KDELIBSUFF "/" << "/usr/ssl/" SYSTEM_LIBDIR "/"
<< "/usr/local/lib" KDELIBSUFF "/" << "/usr/local/" SYSTEM_LIBDIR "/"
<< "/usr/local/openssl/lib" KDELIBSUFF "/" << "/usr/local/openssl/" SYSTEM_LIBDIR "/"
<< "/usr/local/ssl/lib" KDELIBSUFF "/" << "/usr/local/ssl/" SYSTEM_LIBDIR "/"
<< "/opt/openssl/lib" KDELIBSUFF "/" << "/opt/openssl/" SYSTEM_LIBDIR "/"
<< "/lib" KDELIBSUFF "/" << "/" SYSTEM_LIBDIR "/"
<< ""; << "";
// FIXME: #define here for the various OS types to optimize // FIXME: #define here for the various OS types to optimize
@ -408,18 +407,6 @@ TDEConfig *cfg;
tmpStr.replace(TQRegExp("\\(.*\\)"), ""); tmpStr.replace(TQRegExp("\\(.*\\)"), "");
if (!access(tmpStr.latin1(), R_OK)) if (!access(tmpStr.latin1(), R_OK))
_cryptoLib = ll->globalLibrary(alib.latin1()); _cryptoLib = ll->globalLibrary(alib.latin1());
if (!_cryptoLib) {
// Multiarch triplet search
TQDir madir (*it);
TQStringList multiarchdirs = madir.entryList("*-*-*", TQDir::Dirs);
for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) {
TQString malib = *it + *mait + "/" + *shit;
TQString tmpStr(malib.latin1());
tmpStr.replace(TQRegExp("\\(.*\\)"), "");
if (!access(tmpStr.latin1(), R_OK))
_cryptoLib = ll->globalLibrary(malib.latin1());
}
}
if (_cryptoLib) break; if (_cryptoLib) break;
} }
if (_cryptoLib) break; if (_cryptoLib) break;
@ -611,18 +598,6 @@ TDEConfig *cfg;
tmpStr.replace(TQRegExp("\\(.*\\)"), ""); tmpStr.replace(TQRegExp("\\(.*\\)"), "");
if (!access(tmpStr.latin1(), R_OK)) if (!access(tmpStr.latin1(), R_OK))
_sslLib = ll->globalLibrary(alib.latin1()); _sslLib = ll->globalLibrary(alib.latin1());
if (!_sslLib) {
// Multiarch triplet search
TQDir madir (*it);
TQStringList multiarchdirs = madir.entryList("*-*-*", TQDir::Dirs);
for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) {
TQString malib = *it + *mait + "/" + *shit;
TQString tmpStr(malib.latin1());
tmpStr.replace(TQRegExp("\\(.*\\)"), "");
if (!access(tmpStr.latin1(), R_OK))
_sslLib = ll->globalLibrary(malib.latin1());
}
}
if (_sslLib) break; if (_sslLib) break;
} }
if (_sslLib) break; if (_sslLib) break;

@ -71,10 +71,15 @@ CupsdConf::CupsdConf()
//fontpath_ << (datadir_+"/fonts"); //fontpath_ << (datadir_+"/fonts");
requestdir_ = findDir(TQStringList("/var/spool/cups") requestdir_ = findDir(TQStringList("/var/spool/cups")
<< "/var/cups"); << "/var/cups");
serverbin_ = findDir(TQStringList("/usr/lib" KDELIBSUFF "/cups") serverbin_ = findDir(TQStringList()
<< "/usr/local/lib" KDELIBSUFF "/cups" << "/usr/" SYSTEM_LIBDIR "/cups"
<< "/opt/lib" KDELIBSUFF "/cups" << "/usr/lib/cups"
<< "/opt/local/lib" KDELIBSUFF "/cups"); << "/usr/local/" SYSTEM_LIBDIR "/cups"
<< "/usr/local/lib/cups"
<< "/opt/" SYSTEM_LIBDIR "/cups"
<< "/opt/lib/cups"
<< "/opt/local/" SYSTEM_LIBDIR "/cups"
<< "/opt/local/lib/cups");
serverfiles_ = findDir(TQStringList("/etc/cups") serverfiles_ = findDir(TQStringList("/etc/cups")
<< "/usr/local/etc/cups"); << "/usr/local/etc/cups");
tmpfiles_ = requestdir_+"/tmp"; tmpfiles_ = requestdir_+"/tmp";

@ -12,6 +12,7 @@
include_directories( include_directories(
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/tdecore ${CMAKE_BINARY_DIR}/tdecore
${CMAKE_SOURCE_DIR}/tdespell2 ${CMAKE_SOURCE_DIR}/tdespell2
${CMAKE_SOURCE_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdecore

@ -29,6 +29,8 @@
* do so, delete this exception statement from your version. * do so, delete this exception statement from your version.
*/ */
#include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -53,7 +55,9 @@ typedef struct str_ispell_map
} IspellMap; } IspellMap;
static const char *ispell_dirs [] = { static const char *ispell_dirs [] = {
"/usr/" SYSTEM_LIBDIR "/ispell",
"/usr/lib/ispell", "/usr/lib/ispell",
"/usr/local/" SYSTEM_LIBDIR "/ispell",
"/usr/local/lib/ispell", "/usr/local/lib/ispell",
"/usr/local/share/ispell", "/usr/local/share/ispell",
"/usr/share/ispell", "/usr/share/ispell",

@ -444,20 +444,25 @@ void KSpellConfig::getAvailDictsIspell () {
dictcombo->insertItem( i18n("ISpell Default") ); dictcombo->insertItem( i18n("ISpell Default") );
// dictionary path // dictionary path
TQFileInfo dir ("/usr/lib" KDELIBSUFF "/ispell"); TQFileInfo dir;
if (!dir.exists() || !dir.isDir()) TQStringList dirs;
dir.setFile ("/usr/local/lib" KDELIBSUFF "/ispell"); dirs
if (!dir.exists() || !dir.isDir()) << "/usr/" SYSTEM_LIBDIR "/ispell"
dir.setFile ("/usr/local/share/ispell"); << "/usr/lib/ispell"
if (!dir.exists() || !dir.isDir()) << "/usr/local/" SYSTEM_LIBDIR "/ispell"
dir.setFile ("/usr/share/ispell"); << "/usr/local/lib/ispell"
if (!dir.exists() || !dir.isDir()) << "/usr/local/share/ispell"
dir.setFile ("/usr/pkg/lib"); << "/usr/share/ispell"
<< "/usr/pkg/lib";
for (TQStringList::ConstIterator it=dirs.begin(); it != dirs.end(); ++it) {
dir.setFile(*it);
if (dir.exists() && dir.isDir()) {
break;
}
}
/* TODO get them all instead of just one of them. /* TODO get them all instead of just one of them.
* If /usr/local/lib exists, it skips the rest * If /usr/local/lib exists, it skips the rest
if (!dir.exists() || !dir.isDir()) */
dir.setFile ("/usr/local/lib");
*/
if (!dir.exists() || !dir.isDir()) return; if (!dir.exists() || !dir.isDir()) return;
kdDebug(750) << "KSpellConfig::getAvailDictsIspell " kdDebug(750) << "KSpellConfig::getAvailDictsIspell "

Loading…
Cancel
Save