From: Axel S. <A....@ke...> - 2006-05-03 18:45:17
|
Wed May 3 11:41:01 PDT 2006 Axel Simon <A....@ke...> * Improve the new GObject reference-count update. I've added new macros to test for the appropriate GLIB verions. This seems to be the first time that we compile things differently due to different GLIB versions. I also removed an incorrect comment from GObject: The semantic of makeGObject and constructGObject stays the same as before. There's a glitch when building Structs.hsc: cpp complaints that the GLIB version definitions are duplicated. This is true, but it elludes me why this doesn't happen for the GTK and PANGO macros, too. hunk ./configure.ac 419 +dnl Also allow us to conditionally compile bindings to Glib APIs. +GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion` +GLIB_MAJOR_VERSION=`echo $GLIB_VERSION | $CUT -d. -f1` +GLIB_MINOR_VERSION=`echo $GLIB_VERSION | $CUT -d. -f2` +GLIB_MICRO_VERSION=`echo $GLIB_VERSION | $CUT -d. -f3` +AC_DEFINE_UNQUOTED(GLIB_MAJOR_VERSION, ($GLIB_MAJOR_VERSION), [Glib major version number]) +AC_DEFINE_UNQUOTED(GLIB_MINOR_VERSION, ($GLIB_MINOR_VERSION), [Glib minor version number]) +AC_DEFINE_UNQUOTED(GLIB_MICRO_VERSION, ($GLIB_MICRO_VERSION), [Glib minor patch level]) +AH_BOTTOM([ +/* Allow code to be compiled differently for different versions of Glib */ +#define GLIB_CHECK_VERSION(major,minor,micro) \ + (GLIB_MAJOR_VERSION > (major) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \ + GLIB_MICRO_VERSION >= (micro))) +]) + hunk ./glib/System/Glib/GObject.chs.pp 90 -#if GTK_CHECK_VERSION(2,10,0) +#if GLIB_CHECK_VERSION(2,10,0) hunk ./glib/System/Glib/GObject.chs.pp 148 --- --- * Note that from Glib 2.10 onwards, 'makeNewGObject' and --- 'constructNewGObject' are semantically synonyms. In these new Glib --- implementations, each newly created 'GObject' has a reference count --- of zero (and a floating reference to keep it alive until it is --- referenced). However, for older Glib releases, the distinction --- is crucial. |