From 30d819c07b3826665cf6cff331dafdc15e3e3328 Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Tue, 12 Apr 2011 13:56:03 +0200 Subject: [PATCH] check for polkit_authority_get_sync polkit_authority_get_sync does not exist in policykit 0.96 which is still widely used. Use the depricated function polkit_authority_get on older versions. --- CMakeLists.txt | 4 ++++ src/config.h.tmpl | 1 + src/core.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cca1bc..7caf15f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,10 @@ endif(ENABLE_DBUS) pkg_check_modules(GIO gio-2.0 REQUIRED) +if(POLKIT_FOUND) + INCLUDE (CheckLibraryExists) + CHECK_LIBRARY_EXISTS(polkit-gobject-1 polkit_authority_get_sync "" POLKIT_HAVE_GET_SYNC) +endif(POLKIT_FOUND) # FIXME: libproc should export more symbols # find libproc diff --git a/src/config.h.tmpl b/src/config.h.tmpl index 590300a..f4cc15d 100644 --- a/src/config.h.tmpl +++ b/src/config.h.tmpl @@ -29,6 +29,7 @@ #cmakedefine ENABLE_DBUS #cmakedefine DEVELOP_DBUS_SESSION #cmakedefine POLKIT_FOUND +#cmakedefine POLKIT_HAVE_GET_SYNC #cmakedefine DEVELOP_MODE #ifdef DEVELOP_MODE #define RELEASE_AGENT ${CMAKE_CURRENT_BINARY_DIR}/src/ulatencyd_cleanup.lua diff --git a/src/core.c b/src/core.c index 8776b63..0943a08 100644 --- a/src/core.c +++ b/src/core.c @@ -1809,7 +1809,11 @@ int core_init() { #endif #ifdef POLKIT_FOUND +#ifdef POLKIT_HAVE_GET_SYNC U_polkit_authority = polkit_authority_get_sync (NULL, NULL); +#else + U_polkit_authority = polkit_authority_get(); +#endif #endif // delay stack delay_stack = g_ptr_array_new_with_free_func(free);