summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-07-06 12:10:10 +0100
committerGitHub <noreply@github.com>2016-07-06 12:10:10 +0100
commit2f9b0890fad22cc686b3f1293c961493d01e923b (patch)
treeb1dd75025babf2c9ac75ca19588ee448161f8b50
parent760e79ccafc97bc7973e4e2d11bb6ca5d6eed1e0 (diff)
parentb5dae8163e715980f476cde4ea5e2ee8ee897d44 (diff)
downloadcolord-2f9b0890fad22cc686b3f1293c961493d01e923b.tar.gz
Merge pull request #30 from ebassi/polkit-autoptr
Check polkit version before defining g_autoptr macros
-rw-r--r--configure.ac4
-rw-r--r--src/cd-common.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index e7821b1..5583076 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,6 +248,10 @@ AM_CONDITIONAL(CD_BUILD_POLKIT, test x$enable_polkit = xyes)
if test x$enable_polkit = xyes; then
PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= 0.103)
AC_DEFINE(USE_POLKIT, 1, [if we should use PolicyKit])
+
+ PKG_CHECK_EXISTS([polkit-gobject-1 >= 0.114],
+ [AC_DEFINE(POLKIT_HAS_AUTOPTR_MACROS, 1, [if PolKit has autoptr macros])],
+ [])
fi
dnl ---------------------------------------------------------------------------
diff --git a/src/cd-common.c b/src/cd-common.c
index 7d2b3fb..62de666 100644
--- a/src/cd-common.c
+++ b/src/cd-common.c
@@ -29,13 +29,11 @@
#include "cd-common.h"
-#ifdef USE_POLKIT
-#ifndef PolkitAuthorizationResult_autoptr
+#if defined(USE_POLKIT) && !defined(POLKIT_HAS_AUTOPTR_MACROS)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PolkitAuthorizationResult, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PolkitSubject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PolkitAuthority, g_object_unref)
#endif
-#endif
/**
* cd_client_error_quark: