[Spice-devel,3/3] build-sys: Warn on usage of unavailable glib functions

Submitted by Pavel Grunt on Dec. 5, 2016, 2:49 p.m.

Details

Message ID 20161205144949.9592-3-pgrunt@redhat.com
State Accepted
Commit c1103b76fa9294e1e905f1f20e357b71666db530
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Pavel Grunt Dec. 5, 2016, 2:49 p.m.
It works only with glib2 >= 2.32
---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/configure.ac b/configure.ac
index c978b924..1400c503 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,7 +149,10 @@  PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >= $SPICE_PROTOCOL_MIN_VER])
 AC_SUBST([SPICE_PROTOCOL_MIN_VER])
 
 GLIB2_REQUIRED=2.28
+GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
 PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >= $GLIB2_REQUIRED])
+GLIB2_CFLAGS="$GLIB2_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION \
+  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
 AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >= $GLIB2_REQUIRED"])
 
 PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])

Comments

> 
> It works only with glib2 >= 2.32
> ---
>  configure.ac | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index c978b924..1400c503 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -149,7 +149,10 @@ PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >=
> $SPICE_PROTOCOL_MIN_VER])
>  AC_SUBST([SPICE_PROTOCOL_MIN_VER])
>  
>  GLIB2_REQUIRED=2.28
> +GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
>  PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >=
>  $GLIB2_REQUIRED])
> +GLIB2_CFLAGS="$GLIB2_CFLAGS
> -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION \
> +  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
>  AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >=
>  $GLIB2_REQUIRED"])
>  
>  PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])

Does this work if then we use a compatibility layer ?
Or even if we have a newer version we'll use the compatibility functions/macros ?

Frediano
On Mon, 2016-12-05 at 11:06 -0500, Frediano Ziglio wrote:
> > 
> > It works only with glib2 >= 2.32
> > ---
> >  configure.ac | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index c978b924..1400c503 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -149,7 +149,10 @@ PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-
> > protocol >=
> > $SPICE_PROTOCOL_MIN_VER])
> >  AC_SUBST([SPICE_PROTOCOL_MIN_VER])
> >  
> >  GLIB2_REQUIRED=2.28
> > +GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
> >  PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0
> > >=
> >  $GLIB2_REQUIRED])
> > +GLIB2_CFLAGS="$GLIB2_CFLAGS
> > -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION \
> > +  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
> >  AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED
> > gio-2.0 >=
> >  $GLIB2_REQUIRED"])
> >  
> >  PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])
> 
> Does this work if then we use a compatibility layer ?
> Or even if we have a newer version we'll use the compatibility
> functions/macros ?

It just defines some macros and these are used in GLIB 2.32 and newer
and if the deprecation warnings are enabled. If you have an older glib
(in our case 2.28, 2.30) than they are unused

Pavel

> 
> Frediano