# HG changeset patch # User Myhailo Danylenko # Date 1266249081 -7200 # Node ID 91987ea19f24fd21c7be02d2dfca55bdf5785406 # Parent 05469ec9c2e0a70dc95b7bcf776d65f01d0bd385 Use pkg-config to find mcabber headers diff -r 05469ec9c2e0 -r 91987ea19f24 CMakeLists.txt --- a/CMakeLists.txt Sun Jan 31 20:44:05 2010 +0200 +++ b/CMakeLists.txt Mon Feb 15 17:51:21 2010 +0200 @@ -18,17 +18,13 @@ project(disco C) ## User settable options -set(MCABBER_INCLUDE_DIR "/usr/include" CACHE FILEPATH "Path to mcabber headers") ## Check for build dependencies find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(GMODULE REQUIRED gmodule-2.0) pkg_check_modules(LM REQUIRED loudmouth-1.0) -find_program(GREP_EXECUTABLE grep DOC "Grep binary to detect functions in headers") -if(GREP_EXECUTABLE) - execute_process(COMMAND ${GREP_EXECUTABLE} xmpp_is_online ${MCABBER_INCLUDE_DIR}/mcabber/xmpp.h OUTPUT_VARIABLE HAVE_XMPP_IS_ONLINE ERROR_QUIET) -endif() +pkg_check_modules(MCABBER REQUIRED mcabber) include(CheckSymbolExists) set(CMAKE_REQUIRED_INCLUDES ${LM_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES}) @@ -36,7 +32,8 @@ check_symbol_exists(lm_connection_unregister_reply_handler loudmouth/loudmouth.h HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER) link_directories(${GLIB_LIBRARY_DIRS} ${GMODULE_LIBRARY_DIRS} - ${LM_LIBRARY_DIRS}) + ${LM_LIBRARY_DIRS} + ${MCABBER_LIBRARY_DIRS}) ## Target definitions add_library(disco MODULE disco.c) @@ -46,10 +43,11 @@ include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} ${GMODULE_INCLUDE_DIRS} ${LM_INCLUDE_DIRS} - ${MCABBER_INCLUDE_DIR}) + ${MCABBER_INCLUDE_DIRS}) target_link_libraries(disco ${GLIB_LIBRARIES} ${GMODULE_LIBRARIES} - ${LM_LIBRARIES}) + ${LM_LIBRARIES} + ${MCABBER_LIBRARIES}) include_directories(${disco_SOURCE_DIR} ${disco_BINARY_DIR}) diff -r 05469ec9c2e0 -r 91987ea19f24 config.h.in --- a/config.h.in Sun Jan 31 20:44:05 2010 +0200 +++ b/config.h.in Mon Feb 15 17:51:21 2010 +0200 @@ -4,17 +4,5 @@ #cmakedefine HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER -#cmakedefine HAVE_XMPP_IS_ONLINE - -#ifndef HAVE_XMPP_IS_ONLINE -inline gboolean xmpp_is_online (void) -{ - if (lconnection && lm_connection_is_authenticated (lconnection)) - return TRUE; - else - return FALSE; -} #endif -#endif - diff -r 05469ec9c2e0 -r 91987ea19f24 disco.c --- a/disco.c Sun Jan 31 20:44:05 2010 +0200 +++ b/disco.c Mon Feb 15 17:51:21 2010 +0200 @@ -594,19 +594,7 @@ static void disco_hh (guint32 htype, hk_arg_t *args, gpointer ignore) { -#ifdef HOOK_PRE_DISCONNECT disco_unregister_handlers (); -#else - hk_arg_t *arg; - - for (arg = args; arg->name; ++arg) - if (!strcmp (arg->name, "hook")) { - if (!strcmp (arg->value, "hook-pre-disconnect")) - disco_unregister_handlers (); - return; - } -#endif - return; } @@ -620,11 +608,7 @@ } // hook handler -#ifdef HOOK_PRE_DISCONNECT hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, NULL); -#else - hk_add_handler (disco_hh, HOOK_INTERNAL, NULL); -#endif // command cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);