[cogl] Add an option to avoid defining G_DISABLE_DEPRECATED



commit 5aab8a231090f10ff8de8e40c6fff38e50084655
Author: Neil Roberts <neil linux intel com>
Date:   Tue Sep 27 10:27:19 2011 +0100

    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>

 cogl-pango/Makefile.am    |    1 -
 cogl/Makefile.am          |    2 --
 configure.ac              |   35 +++++++++++++++++++++++++++++++++++
 examples/Makefile.am      |    5 -----
 tests/conform/Makefile.am |    1 -
 5 files changed, 35 insertions(+), 9 deletions(-)
---
diff --git a/cogl-pango/Makefile.am b/cogl-pango/Makefile.am
index 9f0525e..6917c1c 100644
--- a/cogl-pango/Makefile.am
+++ b/cogl-pango/Makefile.am
@@ -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		\
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index e9a7d90..f12354f 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -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)\" \
diff --git a/configure.ac b/configure.ac
index 04becb0..9166e3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -285,6 +285,40 @@ 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     ============================================================
 AC_ARG_ENABLE(
@@ -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}"
 
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 8b55c09..1ebe11a 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -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
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index 98cdff1..c79ae61 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -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"\"



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