configure: Don't allow --enable-gdk-pixbuf with --disable-glib

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.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8b1eabdc08da89a57792f9eb666e893a6cbb4e26)
This commit is contained in:
Neil Roberts 2012-11-22 17:07:14 +00:00 committed by Robert Bragg
parent eec0f1cd65
commit 5c8eebb3d9

View File

@ -370,6 +370,69 @@ AS_CASE([$enable_deprecated],
# strip leading spaces # strip leading spaces
COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${DEPRECATED_CFLAGS#* }" 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 ============================================================
dnl Choose image loading backend dnl Choose image loading backend
dnl ============================================================ dnl ============================================================
@ -377,13 +440,11 @@ AC_ARG_ENABLE(
[gdk-pixbuf], [gdk-pixbuf],
[AC_HELP_STRING([--enable-gdk-pixbuf=@<:@no/yes@:>@], [Enable image loading via gdk-pixbuf @<:@default=yes@:>@])], [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( AC_ARG_ENABLE(
[quartz-image], [quartz-image],
@ -393,8 +454,10 @@ AC_ARG_ENABLE(
) )
AS_IF( 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]) 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_PKG_REQUIRES="$COGL_PKG_REQUIRES gdk-pixbuf-2.0 >= gdk_pixbuf_req_version"
COGL_IMAGE_BACKEND="gdk-pixbuf" COGL_IMAGE_BACKEND="gdk-pixbuf"
@ -1033,70 +1096,6 @@ GTK_DOC_CHECK([gtk_doc_req_version], [--flavour no-tmpl])
]) ])
AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes"]) 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 ================================================================
dnl I18n stuff. dnl I18n stuff.
dnl ================================================================ dnl ================================================================