From 03a61295af97983a2313df9717653a466c99ef03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 9 Oct 2014 03:17:02 +0200 Subject: Fix FTBFS on missing magic_getpath --- CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 11d3c4bfe..e02891634 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -525,6 +525,26 @@ if( NOT HAVE_LIBDL ) endif( NOT HAVE_LIBDL ) +##### check for magic ########################### + +set( MAGIC_LIBRARIES magic ) +check_library_exists( ${MAGIC_LIBRARIES} magic_load "" HAVE_LIBMAGIC ) +if( HAVE_LIBMAGIC ) + check_library_exists( ${MAGIC_LIBRARIES} magic_getpath "" HAVE_LIBMAGIC_GETPATH ) + if( NOT HAVE_LIBMAGIC_GETPATH ) + execute_process( + COMMAND file --version + OUTPUT_VARIABLE LIBMAGIC_VERSION + ERROR_VARIABLE LIBMAGIC_VERSION + ) + string(REGEX REPLACE ".*magic file from ([^ \n]*).*" "\\1" LIBMAGIC_PATH ${LIBMAGIC_VERSION} ) + message( STATUS "libmagick default path ${LIBMAGIC_PATH}" ) + endif( NOT HAVE_LIBMAGIC_GETPATH ) +else( HAVE_LIBMAGIC ) + tde_message_fatal( "libmagic is required, but not found on your system" ) +endif( HAVE_LIBMAGIC ) + + ##### check for utempter ######################## if( WITH_UTEMPTER ) -- cgit v1.2.1