Add an option to avoid defining G_DISABLE_DEPRECATED

G_DISABLE_DEPRECATED is only intended for developers of Cogl and it
sometimes breaks the build for people just trying to build a
release. This patch adds an option to enable deprecated Glib
features. By default it is enabled for non-git versions of Cogl.

The patch is based on similar code in Clutter except it adds the flags
to COGL_EXTRA_CFLAGS instead of having a separate variable.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2011-09-27 10:27:19 +01:00
parent 34181d34f5
commit 5aab8a2310
5 changed files with 35 additions and 9 deletions

View File

@ -37,7 +37,6 @@ libcogl_pango_la_LDFLAGS = \
-version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@
INCLUDES = \
-DG_DISABLE_SINGLE_INCLUDES \
-DCLUTTER_COMPILATION \
-DG_LOG_DOMAIN=\"CoglPango\" \
-I$(top_srcdir)/cogl \

View File

@ -24,8 +24,6 @@ INCLUDES = \
$(NULL)
AM_CPPFLAGS = \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_DISABLE_DEPRECATED \
-DG_LOG_DOMAIN=\"Cogl\" \
-DCLUTTER_COMPILATION \
-DCOGL_GL_LIBNAME=\"$(COGL_GL_LIBNAME)\" \

View File

@ -284,6 +284,40 @@ AS_CASE(
COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${MAINTAINER_CFLAGS#* }"
dnl ============================================================
dnl Enable deprecation guards
dnl ============================================================
# disable deprecated options from Glib only when building from git;
# the rules for distcheck will take care of turning this on when
# making a release
m4_define([deprecated_default],
[m4_if(cogl_release_status, [git], [no], [yes])])
AC_ARG_ENABLE([deprecated],
[AS_HELP_STRING([--enable-deprecated=@<:@no/yes@:>@],
[Whether deprecated symbols should be disabled when compiling Cogl @<:@default=]deprecated_default[@:>@])],
[],
[enable_deprecated=deprecated_default])
AS_CASE([$enable_deprecated],
[no],
[
DEPRECATED_CFLAGS="-DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES"
],
[yes],
[
DEPRECATED_CFLAGS=""
],
[AC_MSG_ERROR([Unknown argument for --enable-deprecated])]
)
# strip leading spaces
COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${DEPRECATED_CFLAGS#* }"
dnl ============================================================
dnl Choose image loading backend
dnl ============================================================
@ -1011,6 +1045,7 @@ echo " Profiling: ${enable_profile}"
echo ""
echo " • Compiler options:"
echo " Cogl debug: ${enable_debug}"
echo " Enable deprecated symbols: ${enable_deprecated}"
echo " Compiler flags: ${CFLAGS} ${COGL_EXTRA_CFLAGS}"
echo " Linker flags: ${LDFLAGS} ${COGL_EXTRA_LDFLAGS}"

View File

@ -11,11 +11,6 @@ AM_CFLAGS = \
-DCOGL_ENABLE_EXPERIMENTAL_2_0_API \
-DCOGL_EXAMPLES_DATA=\""$(abs_top_srcdir)/examples/"\"
AM_CPPFLAGS = \
-DG_DISABLE_SINGLE_INCLUDES \
-DCOGL_DISABLE_DEPRECATED
common_ldadd = \
$(COGL_DEP_LIBS) \
$(top_builddir)/cogl/libcogl.la

View File

@ -106,7 +106,6 @@ BUILT_SOURCES = wrappers
INCLUDES = -I$(top_srcdir)
test_conformance_CPPFLAGS = \
-DG_DISABLE_SINGLE_INCLUDES \
-DCOGL_ENABLE_EXPERIMENTAL_API \
-DCOGL_DISABLE_DEPRECATED \
-DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\"