[Spice-devel] [PATCH spice-gtk v2 4/4] Add check for macOS, disable ucontext on macOS (deprecated)

Daniel P. Berrange berrange at redhat.com
Thu May 11 11:14:05 UTC 2017


On Thu, May 11, 2017 at 07:08:13AM -0400, Frediano Ziglio wrote:
> > 
> > On Thu, May 11, 2017 at 12:47:08PM +0200, Christophe de Dinechin wrote:
> > > From: Christophe de Dinechin <dinechin at redhat.com>
> > > 
> > > Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
> > > ---
> > >  configure.ac | 14 ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > > 
> > > diff --git a/configure.ac b/configure.ac
> > > index 74b5811..ecab365 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -62,6 +62,18 @@ esac
> > >  AC_MSG_RESULT([$os_win32])
> > >  AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
> > >  
> > > +AC_MSG_CHECKING([for native macOS])
> > > +case "$host_os" in
> > > +     *darwin*)
> > > +        os_mac=yes
> > > +        ;;
> > > +     *)
> > > +        os_mac=no
> > > +        ;;
> > > +esac
> > > +AC_MSG_RESULT([$os_mac])
> > > +AM_CONDITIONAL([OS_MAC],[test "$os_mac" = "yes"])
> > > +
> > >  AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h])
> > >  AC_CHECK_HEADERS([termios.h])
> > >  AC_CHECK_HEADERS([epoxy/egl.h],
> > > @@ -468,6 +480,8 @@ esac
> > >  if test "$with_coroutine" = "auto"; then
> > >    if test "$os_win32" = "yes"; then
> > >      with_coroutine=winfiber
> > > +  elif test "$os_mac" = "yes"; then
> > > +    with_coroutine=gthread
> > >    else
> > >      with_coroutine=ucontext
> > >    fi
> > 
> > Despite ucontext being deprecated we are still better off using that &
> > ignoring the warnings, than using the gthread impl.
> > 
> > Regards,
> > Daniel
> 
> But Christophe reported that this is not compiling at all.
> Did you manage to compile under OsX with ucontext ?

Is that with or without -Werror though ?  I understand if -Werror makes
it fail due to the deprecation warnings, but AFAIK, the functionality
still exists & should be compatible.

> Why ucontext is better?

Better performance essentially. 

> According to http://duriansoftware.com/joe/PSA:-avoiding-the-%22ucontext-routines-are-deprecated%22-error-on-Mac-OS-X-Snow-Leopard.html
> seems that defining _XOPEN_SOURCE should remove at least the error.

Better is to just use a GCC pragma to silence the compile warning for that
piece of code only.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the Spice-devel mailing list