Current git version (681d5d29) fails to build with glib 2.56
I am trying to build current git version (681d5d29) on centos 7, which comes with glib 2.56. I get the following errors messages during build:
mm-common-helpers.c: In function '_enum_from_string':
mm-common-helpers.c:174:5: error: unknown type name 'GEnumClass_autoptr'
g_autoptr(GEnumClass) enum_class = NULL;
mm-common-helpers.c: In function '_flags_from_string':
mm-common-helpers.c:204:5: error: unknown type name 'GFlagsClass_autoptr'
g_autoptr(GFlagsClass) flags_class = NULL;
The build failure was introduced by commit 30c9fc65 libmm-glib,common-helpers: refactor helper methods.
Digging a bit more, it seems that autoptr for GEnumClass and GFlagsClass were introduced in glib 2.58, hence the error with glib 2.56.
The following quick and dirty patch fixes the build but there may be better way to do (do away with autoptr in that case or bump minimum version to 2.58):
diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c
index 8c3415ff..1f146f6f 100644
--- a/libmm-glib/mm-common-helpers.c
+++ b/libmm-glib/mm-common-helpers.c
@@ -25,6 +25,11 @@
#include "mm-errors-types.h"
#include "mm-common-helpers.h"
+#if (!GLIB_CHECK_VERSION (2, 58, 0))
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEnumClass, g_type_class_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFlagsClass, g_type_class_unref)
+#endif
+
/******************************************************************************/
/* Enums/flags to string builders */