[Spice-commits] 7 commits - common/bitops.h common/Makefile.am common/meson.build common/quic.c configure.ac m4/spice-deps.m4 meson.build meson_options.txt

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 5 13:11:09 UTC 2018


 common/Makefile.am |    9 ++---
 common/bitops.h    |   87 -----------------------------------------------------
 common/meson.build |    1 
 common/quic.c      |    1 
 configure.ac       |    2 -
 m4/spice-deps.m4   |   50 +++++++++++++++++++++---------
 meson.build        |   24 +++++++++-----
 meson_options.txt  |    7 +++-
 8 files changed, 63 insertions(+), 118 deletions(-)

New commits:
commit b208389334e818883524de9a176a78561e98817d
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 5 11:27:02 2018 +0200

    build: Move client sources to libspice_common_client_la_SOURCES
    
    These sources are only used by the client, so they do not belong in
    libspice_common_la_SOURCES.
    
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/Makefile.am b/common/Makefile.am
index dd37b80..3cbc49f 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -23,8 +23,6 @@ libspice_common_la_SOURCES =		\
 	backtrace.h			\
 	canvas_utils.c			\
 	canvas_utils.h			\
-	client_demarshallers.h		\
-	client_marshallers.h		\
 	draw.h				\
 	lines.c				\
 	lines.h				\
@@ -54,8 +52,6 @@ libspice_common_la_SOURCES =		\
 	snd_codec.c			\
 	snd_codec.h			\
 	spice_common.h			\
-	ssl_verify.c			\
-	ssl_verify.h			\
 	verify.h			\
 	$(NULL)
 
@@ -70,6 +66,10 @@ EXTRA_libspice_common_la_SOURCES = 	\
 	$(NULL)
 
 libspice_common_client_la_SOURCES =		\
+	client_demarshallers.h			\
+	client_marshallers.h			\
+	ssl_verify.c				\
+	ssl_verify.h				\
 	$(CLIENT_MARSHALLERS)			\
 	$(NULL)
 
commit 992ebac6b511811c73559421a46732c5233118c1
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 5 11:27:01 2018 +0200

    build: Remove bitops.h
    
    Nothing uses it since the GL backend was removed in 384698a
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/Makefile.am b/common/Makefile.am
index defcb35..dd37b80 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -21,7 +21,6 @@ noinst_LTLIBRARIES = libspice-common.la libspice-common-server.la libspice-commo
 libspice_common_la_SOURCES =		\
 	backtrace.c			\
 	backtrace.h			\
-	bitops.h			\
 	canvas_utils.c			\
 	canvas_utils.h			\
 	client_demarshallers.h		\
diff --git a/common/bitops.h b/common/bitops.h
deleted file mode 100644
index eb294fe..0000000
--- a/common/bitops.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   Copyright (C) 2009 Red Hat, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, write to the Free Software
-
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef BITOPS_H
-#define BITOPS_H
-
-#include <spice/macros.h>
-
-SPICE_BEGIN_DECLS
-
-#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-static inline int spice_bit_find_msb(unsigned int val)
-{
-    int ret;
-
-    asm ("bsrl %1,%0\n\t"
-         "jnz 1f\n\t"
-         "movl $-1,%0\n"
-         "1:"
-         : "=r"(ret) : "r"(val));
-    return ret + 1;
-}
-
-#elif defined(WIN32) && !defined(_WIN64)
-static inline int spice_bit_find_msb(uint32_t val)
-{
-    uint32_t r;
-    __asm {
-        bsr eax, val
-        jnz found
-        mov eax, -1
-
-found:
-        mov r, eax
-    }
-    return r + 1;
-}
-
-#else
-static inline int spice_bit_find_msb(unsigned int val)
-{
-    signed char index = 31;
-
-    if(val == 0) {
-        return 0;
-    }
-
-    do {
-        if(val & 0x80000000) {
-            break;
-        }
-        val <<= 1;
-    } while(--index >= 0);
-
-    return index+1;
-}
-
-#endif
-
-static inline int spice_bit_next_pow2(unsigned int val)
-{
-    if ((val & (val - 1)) == 0) {
-        return val;
-    }
-    return 1 << spice_bit_find_msb(val);
-}
-
-SPICE_END_DECLS
-
-#endif
diff --git a/common/meson.build b/common/meson.build
index 9d46899..22dcbb8 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -4,7 +4,6 @@
 spice_common_sources = [
   'backtrace.c',
   'backtrace.h',
-  'bitops.h',
   'canvas_utils.c',
   'canvas_utils.h',
   'draw.h',
diff --git a/common/quic.c b/common/quic.c
index e31f789..c0ef5e8 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -27,7 +27,6 @@
 
 #include "quic.h"
 #include "spice_common.h"
-#include "bitops.h"
 
 /* ASCII "QUIC" */
 #define QUIC_MAGIC 0x43495551
diff --git a/configure.ac b/configure.ac
index 4653694..6e1f5a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_INIT([spice-common],
         [noversion],
         [spice-devel at lists.freedesktop.org])
 
-AC_CONFIG_SRCDIR([common/bitops.h])
+AC_CONFIG_SRCDIR([common/log.h])
 AC_CONFIG_MACRO_DIR([m4])
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_AUX_DIR([build-aux])
commit f7d3a57ce43cb51d6377588994f2ba16c0e0184e
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 5 11:27:00 2018 +0200

    build: Remove checks for functions which are never called
    
    Grepping for 'pow', 'sqrt' or 'inet_ntoa' returns no results in
    spice-common code base.
    inet_ntoa use was removed in 9749e7e 'ssl-verify: Changed IPv4 hostname
    to IPv6' and pow/sqrt use in 384698a 'Remove GL support'
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 3c25187..61290fe 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -62,7 +62,7 @@ AC_DEFUN([SPICE_CHECK_SYSDEPS], [
     # do not check malloc or realloc, since that cannot be cross-compiled checked
     AC_FUNC_ERROR_AT_LINE
     AC_FUNC_FORK
-    AC_CHECK_FUNCS([dup2 floor inet_ntoa memmove memset pow sqrt])
+    AC_CHECK_FUNCS([dup2 floor memmove memset])
     AC_SEARCH_LIBS([hypot], [m], [], [
         AC_MSG_ERROR([unable to find the hypot() function])
     ])
diff --git a/meson.build b/meson.build
index 2cf2c3c..9c12467 100644
--- a/meson.build
+++ b/meson.build
@@ -74,11 +74,8 @@ functions = ['alloca',
              'dup2',
              'floor',
              'fork',
-             'inet_ntoa',
              'memmove',
              'memset',
-             'pow',
-             'sqrt',
              'vfork']
 
 foreach func : functions
commit 42795a6d0072263846d1ea7f7fdebb21c1d417f8
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 5 11:26:59 2018 +0200

    build: Use AM_COND_IF
    
    AM_COND_IF can be replaced in constructs like:
    
        AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
        if test "x$have_opus" = "xyes" ; then
          AC_DEFINE([HAVE_OPUS], [1], [Define if we have OPUS])
        fi
    
    which becomes:
    
        AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
        AM_COND_IF([HAVE_OPUS], AC_DEFINE([HAVE_OPUS], [1], [Define if we have OPUS]))
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 562071f..3c25187 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -32,8 +32,7 @@ AC_ARG_ENABLE([extra-checks],
                AS_HELP_STRING([--enable-extra-checks=@<:@yes/no@:>@],
                               [Enable expensive checks @<:@default=no@:>@]))
 AM_CONDITIONAL(ENABLE_EXTRA_CHECKS, test "x$enable_extra_checks" = "xyes")
-AS_IF([test "x$enable_extra_checks" = "xyes"],
-      [AC_DEFINE([ENABLE_EXTRA_CHECKS], 1, [Enable extra checks on code])])
+AM_COND_IF([ENABLE_EXTRA_CHECKS], AC_DEFINE([ENABLE_EXTRA_CHECKS], 1, [Enable extra checks on code]))
 ])
 
 
@@ -163,9 +162,7 @@ AC_DEFUN([SPICE_CHECK_OPUS], [
     fi
 
     AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
-    if test "x$have_opus" = "xyes" ; then
-      AC_DEFINE([HAVE_OPUS], [1], [Define if we have OPUS])
-    fi
+    AM_COND_IF([HAVE_OPUS], AC_DEFINE([HAVE_OPUS], [1], [Define if we have OPUS]))
 ])
 
 
@@ -198,9 +195,7 @@ AC_DEFUN([SPICE_CHECK_GDK_PIXBUF], [
     PKG_CHECK_MODULES([GDK_PIXBUF], [gdk-pixbuf-2.0 >= 2.26], [have_gdk_pixbuf=yes], [have_gdk_pixbuf=no])
 
     AM_CONDITIONAL([HAVE_GDK_PIXBUF], [test "x$have_gdk_pixbuf" = "xyes"])
-    if test "x$have_gdk_pixbuf" = "xyes" ; then
-      AC_DEFINE([HAVE_GDK_PIXBUF], [1], [Define if gdk-pixbuf was found])
-    fi
+    AM_COND_IF([HAVE_GDK_PIXBUF], AC_DEFINE([HAVE_GDK_PIXBUF], [1], [Define if gdk-pixbuf was found]))
 ])
 
 # SPICE_CHECK_PYTHON_MODULES()
commit f5224738425a7e97e1c32ea85bb3b243e50d4e22
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 5 11:26:58 2018 +0200

    build: By default, error out if Opus is missing
    
    Following the commit disabling celt by default, it's quite easy to have
    a build without both celt and opus. After this commit, Opus will have to
    be installed for a successful build unless one passes --disable-opus.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 7982b68..562071f 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -149,7 +149,18 @@ AC_DEFUN([SPICE_CHECK_CELT051], [
 # HAVE_OPUS preprocessor symbol as well as a HAVE_OPUS Makefile conditional.
 # ----------------
 AC_DEFUN([SPICE_CHECK_OPUS], [
-    PKG_CHECK_MODULES([OPUS], [opus >= 0.9.14], [have_opus=yes], [have_opus=no])
+    AC_ARG_ENABLE([opus],
+        [  --disable-opus       Disable Opus audio codec (enabled by default)],,
+        [enable_opus="auto"])
+    if test "x$enable_opus" != "xno"; then
+        PKG_CHECK_MODULES([OPUS], [opus >= 0.9.14], [have_opus=yes], [have_opus=no])
+        if test "x$enable_opus" = "xauto" && test "x$have_opus" = "xno"; then
+            AC_MSG_ERROR([Opus could not be detected, explicitly use --disable-opus if that's intentional])
+        fi
+        if test "x$enable_opus" = "xyes" && test "x$have_opus" != "xyes"; then
+            AC_MSG_ERROR([--enable-opus has been specified, but Opus is missing])
+        fi
+    fi
 
     AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
     if test "x$have_opus" = "xyes" ; then
diff --git a/meson.build b/meson.build
index 4dd4610..2cf2c3c 100644
--- a/meson.build
+++ b/meson.build
@@ -118,12 +118,13 @@ endforeach
 #
 # Non-mandatory/optional dependencies
 #
-deps = [['opus', '>= 0.9.14', 'HAVE_OPUS'],]
-
 # Check deps which are optional but enabled by default. This foreach block only
 # checks the option, and adds the package to the deps list, while the real check
 # for the dependency is done in the foeach block below.
-optional_deps = [['celt051', '>= 0.5.1.1', 'HAVE_CELT051'],]
+optional_deps = [
+                    ['celt051', '>= 0.5.1.1', false, 'HAVE_CELT051'],
+                    ['opus', '>= 0.9.14', true, 'HAVE_OPUS'],
+                ]
 foreach dep : optional_deps
   if get_option(dep[0])
     deps += [dep]
@@ -131,10 +132,10 @@ foreach dep : optional_deps
 endforeach
 
 foreach dep : deps
-  d = dependency(dep[0], required : false, version : dep[1])
+  d = dependency(dep[0], required : dep[2], version : dep[1])
   if d.found()
     spice_common_deps += d
-    spice_common_config_data.set(dep[2], '1')
+    spice_common_config_data.set(dep[3], '1')
   endif
 endforeach
 
diff --git a/meson_options.txt b/meson_options.txt
index 9f07bcc..9796833 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -15,6 +15,11 @@ option('celt051',
     value : false,
     description: 'Enable celt051 audio codec (default=false)')
 
+option('opus',
+    type : 'boolean',
+    value : true,
+    description: 'Enable Opus audio codec (default=true)')
+
 option('python-checks',
     type : 'boolean',
     value : true,
commit 72b0d603e128cd3af15974fe6b3e4b56ea9c6f34
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 5 11:26:57 2018 +0200

    build: Disable celt 0.5.1 by default
    
    This version of the CELT codec has long been obsolete, and Opus support
    has been added nearly 5 years ago. It's time we move on and try to stop
    using Celt ;)
    This commit disables CELT by default, but since this could be an
    unexpected change for packagers, if CELT 0.5.1 development headers are
    installed, it will error out unless --enable-celt051/--disable-celt051
    has been explicitly specified.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 3f6c056..7982b68 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -107,7 +107,7 @@ AC_DEFUN([SPICE_CHECK_SMARTCARD], [
 
 # SPICE_CHECK_CELT051
 # -------------------
-# Adds a --disable-celt051 switch in order to enable/disable CELT 0.5.1
+# Adds a --enable-celt051 switch in order to enable/disable CELT 0.5.1
 # support, and checks if the needed libraries are available. If found, it will
 # return the flags to use in the CELT051_CFLAGS and CELT051_LIBS variables, and
 # it will define a HAVE_CELT051 preprocessor symbol as well as a HAVE_CELT051
@@ -115,11 +115,24 @@ AC_DEFUN([SPICE_CHECK_SMARTCARD], [
 #--------------------
 AC_DEFUN([SPICE_CHECK_CELT051], [
     AC_ARG_ENABLE([celt051],
-        [  --disable-celt051       Disable celt051 audio codec (enabled by default)],,
-        [enable_celt051="yes"])
+        [  --enable-celt051       Enable celt051 audio codec (disabled by default)],,
+        [enable_celt051="auto"])
 
-    if test "x$enable_celt051" = "xyes"; then
+    if test "x$enable_celt051" != "xno"; then
         PKG_CHECK_MODULES([CELT051], [celt051 >= 0.5.1.1], [have_celt051=yes], [have_celt051=no])
+        if test "x$enable_celt051" = "xauto"; then
+            if test "x$have_celt051" = "xyes"; then
+                AC_MSG_ERROR(m4_normalize([
+                                CELT 0.5.1.x has been detected, \
+                                but CELT support is no longer automatically enabled by default. \
+                                Please explicitly use --enable-celt051 or --disable-celt051
+                             ]))
+            fi
+            # have_celt051 is "no" here, so celt is disabled by default
+        fi
+        if test "x$enable_celt051" = "xyes" && test "x$have_celt051" != "xyes"; then
+            AC_MSG_ERROR(["--enable-celt051 has been specified, but CELT 0.5.1 is missing"])
+        fi
     else
         have_celt051=no
     fi
diff --git a/meson_options.txt b/meson_options.txt
index 5189f4f..9f07bcc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -12,8 +12,8 @@ option('extra-checks',
 
 option('celt051',
     type : 'boolean',
-    value : true,
-    description: 'Enable celt051 audio codec (default=true)')
+    value : false,
+    description: 'Enable celt051 audio codec (default=false)')
 
 option('python-checks',
     type : 'boolean',
commit e98f8a430f7e2fd64dab74f9b9a85ee2dfa1b92f
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 5 11:26:56 2018 +0200

    build: Ensure we link with -lm if needed
    
    lines.c uses hypot(), which is found in libm on some systems. This means
    we are currently relying on getting -lm indirectly through some other
    means, as otherwise linking any binary with spice-common would fail.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 7c0cca4..3f6c056 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -64,6 +64,9 @@ AC_DEFUN([SPICE_CHECK_SYSDEPS], [
     AC_FUNC_ERROR_AT_LINE
     AC_FUNC_FORK
     AC_CHECK_FUNCS([dup2 floor inet_ntoa memmove memset pow sqrt])
+    AC_SEARCH_LIBS([hypot], [m], [], [
+        AC_MSG_ERROR([unable to find the hypot() function])
+    ])
 ])
 
 
diff --git a/meson.build b/meson.build
index de777db..4dd4610 100644
--- a/meson.build
+++ b/meson.build
@@ -87,6 +87,16 @@ foreach func : functions
   endif
 endforeach
 
+# check for hypot function
+#
+# Include math.h header to avoid problems with builtins.
+# In some systems the function is in libm.
+if not compiler.has_function('hypot', prefix : '#include <math.h>')
+  libm = compiler.find_library('m', required : false)
+  if compiler.has_function('hypot', prefix : '#include <math.h>', dependencies : libm)
+    spice_common_deps += libm
+  endif
+endif
 
 #
 # check for mandatory dependencies


More information about the Spice-commits mailing list