summaryrefslogtreecommitdiffstats
path: root/tdeio
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2014-10-09 03:17:02 +0200
committerSlávek Banko <slavek.banko@axis.cz>2014-10-09 03:17:48 +0200
commit03a61295af97983a2313df9717653a466c99ef03 (patch)
treea322176b1ec239813aa19066af0245eb3452b32d /tdeio
parente1eaf5a90159b023cb4c0c9e5c68acba397c1457 (diff)
downloadtdelibs-03a61295af97983a2313df9717653a466c99ef03.tar.gz
tdelibs-03a61295af97983a2313df9717653a466c99ef03.zip
Fix FTBFS on missing magic_getpath
Diffstat (limited to 'tdeio')
-rw-r--r--tdeio/tdeio/CMakeLists.txt2
-rw-r--r--tdeio/tdeio/configure.in.in22
-rw-r--r--tdeio/tdeio/kmimemagic.cpp5
3 files changed, 28 insertions, 1 deletions
diff --git a/tdeio/tdeio/CMakeLists.txt b/tdeio/tdeio/CMakeLists.txt
index 2b90c0107..77d16f2c7 100644
--- a/tdeio/tdeio/CMakeLists.txt
+++ b/tdeio/tdeio/CMakeLists.txt
@@ -117,7 +117,7 @@ set( ${target}_SRCS
tde_add_library( ${target} STATIC_PIC AUTOMOC
SOURCES ${${target}_SRCS}
- LINK magic ${GAMIN_LIBRARIES}
+ LINK ${MAGIC_LIBRARIES} ${GAMIN_LIBRARIES}
)
diff --git a/tdeio/tdeio/configure.in.in b/tdeio/tdeio/configure.in.in
index 8683dfec1..70d381bac 100644
--- a/tdeio/tdeio/configure.in.in
+++ b/tdeio/tdeio/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/tdeio/tdeio/kmimemagic.cpp b/tdeio/tdeio/kmimemagic.cpp
index 41c69dd3a..97496de98 100644
--- a/tdeio/tdeio/kmimemagic.cpp
+++ b/tdeio/tdeio/kmimemagic.cpp
@@ -20,6 +20,7 @@
Boston, MA 02110-1301, USA.
*/
+#include "config.h"
#include "kmimemagic.h"
#include <kdebug.h>
#include <tdeapplication.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
if (maindatabase == "") {
kdWarning() << k_funcinfo << "Unable to locate system mime magic database; mime type detection will not function correctly!" << endl;
}