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 6 years ago
parent c49ee53043
commit 8a859540c3
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -141,6 +141,18 @@ if( ${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 ###########
include( CheckCXXCompilerFlag )

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

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

@ -28,7 +28,6 @@
#include <tdeconfig.h>
#include <kstaticdeleter.h>
#include <tqregexp.h>
#include <tqdir.h>
#include <stdio.h>
#include <unistd.h>
@ -324,7 +323,7 @@ TDEConfig *cfg;
#ifdef __OpenBSD__
{
TQString libname = findMostRecentLib("/usr/lib" KDELIBSUFF, "crypto");
TQString libname = findMostRecentLib("/usr/" SYSTEM_LIBDIR, "crypto");
if (!libname.isNull())
_cryptoLib = ll->globalLibrary(libname.latin1());
}
@ -349,13 +348,13 @@ TDEConfig *cfg;
#ifdef _AIX
<< "/opt/freeware/lib/"
#endif
<< "/usr/lib" KDELIBSUFF "/"
<< "/usr/ssl/lib" KDELIBSUFF "/"
<< "/usr/local/lib" KDELIBSUFF "/"
<< "/usr/local/openssl/lib" KDELIBSUFF "/"
<< "/usr/local/ssl/lib" KDELIBSUFF "/"
<< "/opt/openssl/lib" KDELIBSUFF "/"
<< "/lib" KDELIBSUFF "/"
<< "/usr/" SYSTEM_LIBDIR "/"
<< "/usr/ssl/" SYSTEM_LIBDIR "/"
<< "/usr/local/" SYSTEM_LIBDIR "/"
<< "/usr/local/openssl/" SYSTEM_LIBDIR "/"
<< "/usr/local/ssl/" SYSTEM_LIBDIR "/"
<< "/opt/openssl/" SYSTEM_LIBDIR "/"
<< "/" SYSTEM_LIBDIR "/"
<< "";
// FIXME: #define here for the various OS types to optimize
@ -408,18 +407,6 @@ TDEConfig *cfg;
tmpStr.replace(TQRegExp("\\(.*\\)"), "");
if (!access(tmpStr.latin1(), R_OK))
_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;
@ -611,18 +598,6 @@ TDEConfig *cfg;
tmpStr.replace(TQRegExp("\\(.*\\)"), "");
if (!access(tmpStr.latin1(), R_OK))
_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;

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

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

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

@ -444,19 +444,24 @@ void KSpellConfig::getAvailDictsIspell () {
dictcombo->insertItem( i18n("ISpell Default") );
// dictionary path
TQFileInfo dir ("/usr/lib" KDELIBSUFF "/ispell");
if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/local/lib" KDELIBSUFF "/ispell");
if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/local/share/ispell");
if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/share/ispell");
if (!dir.exists() || !dir.isDir())
dir.setFile ("/usr/pkg/lib");
TQFileInfo dir;
TQStringList dirs;
dirs
<< "/usr/" SYSTEM_LIBDIR "/ispell"
<< "/usr/lib/ispell"
<< "/usr/local/" SYSTEM_LIBDIR "/ispell"
<< "/usr/local/lib/ispell"
<< "/usr/local/share/ispell"
<< "/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.
* 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;

Loading…
Cancel
Save