diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2014-10-09 03:17:02 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-07-22 15:56:42 +0200 |
commit | 3138567410d9120d1c77da42522d56796a191763 (patch) | |
tree | 130a26e08420c09c5fee3f1ae9c04ecab4f114e9 /kio | |
parent | 6a2645238245e1f92b4fa92fc108e4559c849da8 (diff) | |
download | tdelibs-3138567410d9120d1c77da42522d56796a191763.tar.gz tdelibs-3138567410d9120d1c77da42522d56796a191763.zip |
Fix FTBFS on missing magic_getpath
(cherry picked from commit 03a61295af97983a2313df9717653a466c99ef03)
Diffstat (limited to 'kio')
-rw-r--r-- | kio/kio/CMakeLists.txt | 2 | ||||
-rw-r--r-- | kio/kio/configure.in.in | 22 | ||||
-rw-r--r-- | kio/kio/kmimemagic.cpp | 5 |
3 files changed, 28 insertions, 1 deletions
diff --git a/kio/kio/CMakeLists.txt b/kio/kio/CMakeLists.txt index 421b3b8ab..cce7c1cb1 100644 --- a/kio/kio/CMakeLists.txt +++ b/kio/kio/CMakeLists.txt @@ -115,5 +115,5 @@ endif( USE_POSIX_ACL ) tde_add_library( ${target} STATIC_PIC AUTOMOC SOURCES ${${target}_SRCS} - LINK magic ${GAMIN_LIBRARIES} + LINK ${MAGIC_LIBRARIES} ${GAMIN_LIBRARIES} ) diff --git a/kio/kio/configure.in.in b/kio/kio/configure.in.in index 8683dfec1..70d381bac 100644 --- a/kio/kio/configure.in.in +++ b/kio/kio/configure.in.in @@ -165,3 +165,25 @@ if test "x$kde_enable_inotify" = "xyes"; then AC_MSG_RESULT(no) fi fi + +dnl ------------------------------------------------------------------------ +dnl Try to find if libmagic is installed and contains magic_getpath +dnl ------------------------------------------------------------------------ +dnl +AC_MSG_CHECKING([for libmagic]) +KDE_CHECK_LIB(magic, magic_load, kde_have_libmagic=yes, kde_have_libmagic=no) +if test $kde_have_libmagic = yes; then + AC_MSG_RESULT(yes) + AC_MSG_CHECKING([for libmagic - magic_getpath]) + KDE_CHECK_LIB(magic, magic_getpath, kde_have_libmagic_getpath=yes, kde_have_libmagic_getpath=no) + if test $kde_have_libmagic_getpath = yes; then + AC_DEFINE_UNQUOTED(HAVE_LIBMAGIC_GETPATH, 1, [Defined if libmagic contain magic_getpath function]) + AC_MSG_RESULT(yes) + else + libmagic_path=`file --version 2>&1 | sed -n "s/^magic file from //p"` + AC_DEFINE_UNQUOTED(LIBMAGIC_PATH, $libmagic_path, [Define default path for libmagic files]) + AC_MSG_RESULT(no) + fi +else + AC_MSG_RESULT(no) +fi diff --git a/kio/kio/kmimemagic.cpp b/kio/kio/kmimemagic.cpp index f9001e5cd..d33fba5e4 100644 --- a/kio/kio/kmimemagic.cpp +++ b/kio/kio/kmimemagic.cpp @@ -20,6 +20,7 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" #include "kmimemagic.h" #include <kdebug.h> #include <kapplication.h> @@ -164,7 +165,11 @@ struct config_rec { int KMimeMagic::apprentice( const TQString& magicfile ) { TQString maindatabase = magicfile; if (maindatabase == "") { +#ifdef HAVE_LIBMAGIC_GETPATH maindatabase = magic_getpath(0, FILE_LOAD); +#else + maindatabase = TQString(LIBMAGIC_PATH); +#endif } conf->databases.clear(); conf->databases.append(maindatabase); |