[gupnp-dlna] Lower the GLib version dependency to 2.32.



commit 2e1b32df3c2b5aec1a05f357d58e3ce10d8e2db8
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Tue Dec 4 12:51:23 2012 +0100

    Lower the GLib version dependency to 2.32.
    
    If GLib does not have g_clear_pointer then we provide our own naive
    implementation for it in config.h.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689612

 configure.ac                                       |   36 +++++++++++++++++++-
 libgupnp-dlna/gupnp-dlna-profile-loader.c          |    3 ++
 .../gstreamer/gupnp-dlna-gst-audio-information.c   |    3 ++
 .../gupnp-dlna-gst-container-information.c         |    3 ++
 .../gstreamer/gupnp-dlna-gst-image-information.c   |    3 ++
 .../gstreamer/gupnp-dlna-gst-information.c         |    3 ++
 .../gstreamer/gupnp-dlna-gst-video-information.c   |    3 ++
 .../native/gupnp-dlna-native-profile-loader.c      |    3 ++
 8 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6ce354e..b1e4877 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,7 +119,7 @@ GUPNP_DLNA_METADATA_BACKEND_CFLAGS="$GUPNP_DLNA_METADATA_BACKEND_CFLAGS -DGUPNP_
 
 AC_SUBST(GUPNP_DLNA_METADATA_BACKEND_CFLAGS)
 
-PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.34])
+PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32])
 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
 PKG_CHECK_MODULES([GMODULE], [gmodule-2.0])
 
@@ -130,6 +130,40 @@ AC_SUBST(GOBJECT_LIBS)
 AC_SUBST(GMODULE_CFLAGS)
 AC_SUBST(GMODULE_LIBS)
 
+# Check for g_clear_pointer
+have_g_clear_pointer='no'
+PKG_CHECK_EXISTS([glib-2.0 >= 2.34],
+                 [have_g_clear_pointer='yes'])
+AS_VAR_IF([have_g_clear_pointer], [no],
+          [GUPNP_DLNA_TEMP_CFLAGS="$CFLAGS"
+           CFLAGS="$CFLAGS $GLIB_CFLAGS"
+           GUPNP_DLNA_TEMP_LIBS="$LIBS"
+           LIBS="$LIBS $GLIB_LIBS"
+           AC_LANG([C])
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+                                             #include <glib.h>
+                                           ]],
+                                           [[
+                                             gchar *test = g_malloc (2);
+                                             g_clear_pointer (&test, g_free);
+                                             return (test == NULL)
+                                           ]])],
+                          [have_g_clear_pointer='yes'])
+          LIBS="$GUPNP_DLNA_TEMP_LIBS"
+          CFLAGS="$GUPNP_DLNA_TEMP_CFLAGS"])
+
+AS_VAR_IF([have_g_clear_pointer], [no],
+          [AC_DEFINE([g_clear_pointer(ptr, func)],
+                     [\
+                      G_STMT_START { \
+                        if (ptr != NULL && func != NULL) { \
+                          gpointer g_clear_pointer_tmp_var = *ptr; \
+                          *ptr = NULL; \
+                          func (g_clear_pointer_tmp_var); \
+                        } \
+                      } G_STMT_END],
+                     [Naive g_clear_pointer implementation.])])
+
 # Debugging
 AC_ARG_ENABLE([debug],
               AS_HELP_STRING([--enable-debug], [enable debugging @<:@default=no@:>@]),
diff --git a/libgupnp-dlna/gupnp-dlna-profile-loader.c b/libgupnp-dlna/gupnp-dlna-profile-loader.c
index e20a523..93ef0a4 100644
--- a/libgupnp-dlna/gupnp-dlna-profile-loader.c
+++ b/libgupnp-dlna/gupnp-dlna-profile-loader.c
@@ -21,6 +21,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
 #include <glib/gstdio.h>
 #include <libxml/xmlreader.h>
 #include <libxml/relaxng.h>
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c
index e7dcb0e..a6ea58d 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c
@@ -19,6 +19,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
 #include "gupnp-dlna-gst-audio-information.h"
 #include "gupnp-dlna-gst-info-utils.h"
 
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c
index 4d1e2c8..6ad3133 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c
@@ -19,6 +19,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
 #include "gupnp-dlna-gst-container-information.h"
 #include "gupnp-dlna-gst-info-utils.h"
 
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c
index 0f2782a..6547819 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c
@@ -19,6 +19,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
 #include "gupnp-dlna-gst-image-information.h"
 #include "gupnp-dlna-gst-info-utils.h"
 
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c
index 2930762..bd7fc6b 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c
@@ -19,6 +19,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
 #include "gupnp-dlna-gst-information.h"
 #include "gupnp-dlna-gst-info-utils.h"
 #include "gupnp-dlna-gst-audio-information.h"
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
index 706ab76..3a3b3c9 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
@@ -19,6 +19,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
 #include "gupnp-dlna-gst-video-information.h"
 #include "gupnp-dlna-gst-info-utils.h"
 
diff --git a/libgupnp-dlna/profile-backends/native/gupnp-dlna-native-profile-loader.c b/libgupnp-dlna/profile-backends/native/gupnp-dlna-native-profile-loader.c
index a90d170..33e6cd6 100644
--- a/libgupnp-dlna/profile-backends/native/gupnp-dlna-native-profile-loader.c
+++ b/libgupnp-dlna/profile-backends/native/gupnp-dlna-native-profile-loader.c
@@ -21,6 +21,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
 #include "gupnp-dlna-native-profile-loader.h"
 #include "gupnp-dlna-native-profile.h"
 #include "gupnp-dlna-native-sets.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]