[Cogl] [PATCH 1/2] configure: Don't allow --enable-gdk-pixbuf with --disable-glib

Neil Roberts neil at linux.intel.com
Thu Nov 22 09:07:14 PST 2012


The GDK pixbuf support requires being able to propagate errors from
GDKPixbuf as GErrors. This won't work if we are using the builtin
version of GLib because any attempt to call g_error_free from within
Cogl will use the internal version which will free the error using the
wrong slice allocator. It probably doesn't make much sense to build
without glib but with gdk-pixbuf so there's not much point in trying
to work around this situation.

Previously if you specified --enable-gdk-pixbuf but gdk-pixbuf was not
available it would silently disable it. This pach also fixes it so
that it will report an error in that case.

If --enable-gdk-pixbuf is not specified it will now default to
enabling it only if both glib is enabled and gdk-pixbuf is available.

This patch looks slightly longer than it ought to be because it moves
the check for glib up to above the descisions about the image backend.
---
 configure.ac | 141 +++++++++++++++++++++++++++++------------------------------
 1 file changed, 70 insertions(+), 71 deletions(-)

diff --git a/configure.ac b/configure.ac
index ced55bf..17d696e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -360,6 +360,69 @@ AS_CASE([$enable_deprecated],
 # strip leading spaces
 COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${DEPRECATED_CFLAGS#*  }"
 
+dnl ================================================================
+dnl Check for dependency packages.
+dnl ================================================================
+
+dnl     ============================================================
+dnl     Should glib be used?
+dnl     ============================================================
+AM_PATH_GLIB_2_0([glib_req_version],
+                 [have_glib=yes], [have_glib=no],
+                 [gobject gthread gmodule-no-export])
+AC_ARG_ENABLE(
+  [glib],
+  [AC_HELP_STRING([--enable-glib=@<:@no/yes@:>@], [Enable glib support @<:@default=yes@:>@])],
+  [],
+  enable_glib=yes
+)
+
+AS_IF([test "x$have_glib" = "xno" && test "x$enable_glib" = "xyes"],
+      [AC_MSG_ERROR([gobject-2.0 is required])])
+
+AM_CONDITIONAL([USE_GLIB], [test "x$enable_glib" = "xyes"])
+
+AS_IF([test "x$enable_glib" = "xyes"],
+      [
+        COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLIB_SUPPORT"
+        COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GTYPE_SUPPORT"
+        COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0"
+      ],
+      [
+        AS_GLIBCONFIG([deps/glib])
+        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps"
+        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/glib"
+        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/gmodule"
+        EXPERIMENTAL_CONFIG=yes
+        EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib,"
+        enable_nls=no
+      ]
+)
+
+dnl     ============================================================
+dnl     Should cogl-pango be built?
+dnl     ============================================================
+
+AS_IF([test "x$enable_glib" != "xyes"],
+      [
+        AS_IF([test "x$enable_cogl_pango" = "xyes"],
+              AC_MSG_ERROR([--enable-cogl-pango conflicts with --disable-glib]))
+        enable_cogl_pango=no
+      ]
+)
+
+AC_ARG_ENABLE(
+  [cogl-pango],
+  [AC_HELP_STRING([--enable-cogl-pango=@<:@no/yes@:>@], [Enable pango support @<:@default=yes@:>@])],
+  [],
+  enable_cogl_pango=yes
+)
+AS_IF([test "x$enable_cogl_pango" = "xyes"],
+      [
+	COGL_PANGO_PKG_REQUIRES="$COGL_PANGO_PKG_REQUIRES pangocairo >= pangocairo_req_version"
+      ]
+)
+
 dnl     ============================================================
 dnl     Choose image loading backend
 dnl     ============================================================
@@ -367,13 +430,11 @@ AC_ARG_ENABLE(
   [gdk-pixbuf],
   [AC_HELP_STRING([--enable-gdk-pixbuf=@<:@no/yes@:>@], [Enable image loading via gdk-pixbuf @<:@default=yes@:>@])],
   [],
-  enable_gdk_pixbuf=yes
+  [AS_IF([test "x$enable_glib" = "xyes"],
+         [PKG_CHECK_EXISTS([gdk-pixbuf-2.0 >= gdk_pixbuf_req_version],
+                           [enable_gdk_pixbuf=yes],
+                           [enable_gdk_pixbuf=no])])]
 )
-if test "x$enable_gdk_pixbuf" = "xyes"; then
-  PKG_CHECK_EXISTS([gdk-pixbuf-2.0], [have_gdk_pixbuf=yes], [have_gdk_pixbuf=no])
-else
-  have_gdk_pixbuf=no
-fi
 
 AC_ARG_ENABLE(
   [quartz-image],
@@ -383,8 +444,10 @@ AC_ARG_ENABLE(
 )
 
 AS_IF(
-  [test "x$have_gdk_pixbuf" = "xyes"],
+  [test "x$enable_gdk_pixbuf" = "xyes"],
   [
+    AS_IF([test "x$enable_glib" != "xyes"],
+          [AC_MSG_ERROR([--disable-glib conflicts with --enable-gdk-pixbuf])])
     AC_DEFINE([USE_GDKPIXBUF], 1, [Use GdkPixbuf for loading image data])
     COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gdk-pixbuf-2.0 >= gdk_pixbuf_req_version"
     COGL_IMAGE_BACKEND="gdk-pixbuf"
@@ -1011,70 +1074,6 @@ GTK_DOC_CHECK([gtk_doc_req_version], [--flavour no-tmpl])
 AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes"])
 
 dnl ================================================================
-dnl Check for dependency packages.
-dnl ================================================================
-
-dnl     ============================================================
-dnl     Should glib be used?
-dnl     ============================================================
-AM_PATH_GLIB_2_0([glib_req_version],
-                 [have_glib=yes], [have_glib=no],
-                 [gobject gthread gmodule-no-export])
-AC_ARG_ENABLE(
-  [glib],
-  [AC_HELP_STRING([--enable-glib=@<:@no/yes@:>@], [Enable glib support @<:@default=yes@:>@])],
-  [],
-  enable_glib=yes
-)
-
-AS_IF([test "x$have_glib" = "xno" && test "x$enable_glib" = "xyes"],
-      [AC_MSG_ERROR([gobject-2.0 is required])])
-
-AM_CONDITIONAL([USE_GLIB], [test "x$enable_glib" = "xyes"])
-
-AS_IF([test "x$enable_glib" = "xyes"],
-      [
-        COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLIB_SUPPORT"
-        COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GTYPE_SUPPORT"
-        COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0"
-      ],
-      [
-        AS_GLIBCONFIG([deps/glib])
-        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps"
-        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/glib"
-        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/gmodule"
-        EXPERIMENTAL_CONFIG=yes
-        EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib,"
-        enable_nls=no
-      ]
-)
-
-dnl     ============================================================
-dnl     Should cogl-pango be built?
-dnl     ============================================================
-
-AS_IF([test "x$enable_glib" != "xyes"],
-      [
-        AS_IF([test "x$enable_cogl_pango" = "xyes"],
-              AC_MSG_ERROR([--enable-cogl-pango conflicts with --disable-glib]))
-        enable_cogl_pango=no
-      ]
-)
-
-AC_ARG_ENABLE(
-  [cogl-pango],
-  [AC_HELP_STRING([--enable-cogl-pango=@<:@no/yes@:>@], [Enable pango support @<:@default=yes@:>@])],
-  [],
-  enable_cogl_pango=yes
-)
-AS_IF([test "x$enable_cogl_pango" = "xyes"],
-      [
-	COGL_PANGO_PKG_REQUIRES="$COGL_PANGO_PKG_REQUIRES pangocairo >= pangocairo_req_version"
-      ]
-)
-
-
-dnl ================================================================
 dnl I18n stuff.
 dnl ================================================================
 AM_GNU_GETTEXT_VERSION([0.17])
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list