diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2016-07-06 10:54:02 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2016-07-06 11:27:06 +0100 |
commit | b5dae8163e715980f476cde4ea5e2ee8ee897d44 (patch) | |
tree | b1dd75025babf2c9ac75ca19588ee448161f8b50 | |
parent | 760e79ccafc97bc7973e4e2d11bb6ca5d6eed1e0 (diff) | |
download | colord-b5dae8163e715980f476cde4ea5e2ee8ee897d44.tar.gz |
Check polkit version before defining g_autoptr macros
We cannot check on the internal name created by G_DECLARE_AUTO* macros
because it's not a pre-processor symbol.
Instead, we should check whether we're being built against a version of
PolKit that has those symbols, and only define them ourselves for
previous versions.
This commit fixes a build failure in GNOME Continuous.
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/cd-common.c | 4 |
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: |