Commit Graph

58 Commits

Author SHA1 Message Date
Frediano Ziglio
bb03ff099b Add helper code for agent messages
Add agent.h and agent.c to deal with some common agent job:
- checking message from network and fixing network order.
- send back file transfer status.

Code based on Linux agent and Windows agent.
AgentXxxx and agent_xxx are used to avoid conflicts with protocol.

See agent.h for more detail on how to use these APIs.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 09:42:46 +01:00
Victor Toso
31a14b20d0 sound: remove celt support
Follow up of spice-protocol's deprecation of celt mode.
See: https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/15

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-17 16:38:10 +00:00
Frediano Ziglio
b2f919f109 Add missing dependency in Autoconf integration
spice-common depends on Glib2, so automatically add to the
dependency list.
You can define a GLIB2_MIN_VER m4 variable in configure.ac
to raise the default GLib2 required version.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 09:58:42 +00:00
Frediano Ziglio
19ea60416c m4: Make easier to integrate in other projects
Add a common.m4 file to be included directly in other project.
This include will include all needed checks to use spice-common.
Just include directly this file in your configure.ac.
This will define SPICE_COMMON_CFLAGS and SPICE_COMMON_DIR (for
linking .la files) which are needed to use spice-common.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-02 13:54:12 +00:00
Frediano Ziglio
26d3f6e138 build: Clean up some configure checks
Remove some system checks.
Specifically:
- functions in the standard C (memset, memmove);
- functions we use but we assume in the specific implementation
  present (dup2, fork);
- functions we don't use (error_at_line);
- headers in the standard C (stddef.h, stdint.h, string.h);
- headers present in all systems we support if are not checked
  in the source files (malloc.h);
- types we assume being present (XintYY_t, pid_t).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-02-06 19:26:21 +00:00
Kevin Pouget
f191053a8c build: Introduce the agent-interface as an alternative instrumentation library
The agent-interface is an experimental instrumentation library for
capturing and sharing Spice performance indicators with an external
agent.

    --enable-instrumentation=[recorder/agent/no]
             Enable instrumentation [default=no]

The former configuration option '--enable-recorder' is transformed
into '--enable-instrumentation=recorder'.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-18 17:04:09 +01:00
Frediano Ziglio
ff2e99d893 build: Disable Celt support by default
We started disabling Celt support making the option required.
After 2 releases start making it disabled unless explicitly
enabled.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-06-13 08:51:11 +01:00
Frediano Ziglio
9ca8914b7c Remove obsolete Autoconf macros
Autoconf 2.63 was released on September 2008.
These simple macros conflict with system ones and can
causes issues with some systems (currently MacOS).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-30 13:14:40 +00:00
Frediano Ziglio
2e914f3305 Integrate recorder library
Allow to use recorder library. See https://github.com/c3d/recorder for
details.
The main usage will be to collect statistics while the programs will run.
By default the recorder will be disabled at compile time. The idea of the
usage in SPICE is to collect data while the program run. Using current
SPICE logging facility was discussed but not easy to filter data. Other
solutions (SystemTap, LTTng) were discarded due to not cross platform.
A printf based solution was discussed too but missing the additional tools
which are useful. Currently we don't plan to use as extensively as to be a
problem to be replaced or removed in the future.

Both Autoconf and Meson build systems are supported.
Autoconf requires the addition of SPICE_CHECK_RECORDER call in configure.ac.
Meson requires to add recorder option.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-01-23 14:44:19 +00:00
Marc-André Lureau
924f47a653 Bump libcacard requirement to 2.5.1
v2.5.1 was released on 2015-11-24.

According to repology, from the distro we care about, CentOS 6,
openSUSE Leap 42.3 have too old version (0.1.2).

spice-gtk & spice-server will have to be updated to drop
USE_SMARTCARD_012.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-08 13:12:55 +04:00
Frediano Ziglio
a4aad511f1 Update --enable-celt051 help string
Use AS_HELP_STRING in order to fix indentation of configure --help.
Default is now auto, as the "[enable_celt051="auto"]" parameter.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-12-12 16:27:18 +00:00
Christophe Fergeau
9bf4c32288 build: Define GLIB_VERSION_MIN_REQUIRED/GLIB_VERSION_MAX_ALLOWED
This is defined for the meson build, but not the autotools build. This
commit makes them consistent.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 18:12:16 +02:00
Christophe Fergeau
f7d3a57ce4 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-05 14:10:14 +01:00
Christophe Fergeau
42795a6d00 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-05 14:10:07 +01:00
Christophe Fergeau
f522473842 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-05 14:10:02 +01:00
Christophe Fergeau
72b0d603e1 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-05 14:09:55 +01:00
Christophe Fergeau
e98f8a430f 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-05 14:09:50 +01:00
Christophe Fergeau
d58a5b6a5a quic: Add test case for compression/decompression
This only adds a basic test relying on gdk-pixbuf.
The main limitation is that gdk-pixbuf does not handle 16bpp images,
nor 32bpp/no alpha images. I should have picked something else instead ;)

This allows at least to exercise the QUIC_IMAGE_TYPE_RGB24 and
QUIC_IMAGE_TYPE_RGBA codepaths.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-25 17:04:23 +01:00
Eduardo Lima (Etrunko)
d1d6210547 Bump glib requirements to 2.38
test-logging makes use of functions only available from this version

../tests/test-logging.c: In function ‘test_spice_abort_level’:
../tests/test-logging.c:50:5: error: ‘g_test_subprocess’ is deprecated: Not available before 2.38 [-Werror=deprecated-declarations]
     if (g_test_subprocess()) {
     ^~
In file included from /usr/include/glib-2.0/glib.h:82:0,
                 from ../tests/test-logging.c:23:
/usr/include/glib-2.0/glib/gtestutils.h:151:10: note: declared here
 gboolean g_test_subprocess (void);
          ^~~~~~~~~~~~~~~~~

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24 09:32:26 +01:00
Frediano Ziglio
4c2d0e9772 Add --enable-extra-checks option
Allow to enable code to do additional or expensive checks.
The option should be used by higher level libraries.
By default the option is disabled.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-03-19 14:47:21 +00:00
Pavel Grunt
5f241e655b spice-deps: Set python version based on modules availability
Building spice or spice-gtk from git requires python modules pyparsing
and six. Search for them in the both Python versions and set
the Python version accordingly.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-29 11:43:25 +01:00
Frediano Ziglio
6b409c4a79 Detect LZ4_compress_fast_continue function
Newer lz4 headers give deprecated warning using LZ4_compress_continue
instead of LZ_compress_fast_continue so detect this function
to allow usage and avoid the warning.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-28 18:36:21 +00:00
Pavel Grunt
48da2c6654 spice-deps: Make LZ4 check depending on function
LZ4 changed versioning scheme from r131 to v1.7.3 making our configure
fail with (1.7.3 < 129).

Switch from version checking to checking that the necessary function
is available.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-25 14:01:04 +00:00
Pavel Grunt
de1dee75c2 spice-deps: Fix accidently deleted comment
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-24 15:54:09 +00:00
Frediano Ziglio
3983097ed5 Start adding protocol file documentation
The protocol file is not documented and people have to read code to
understand the specification.
This can lead to unexpected or not optimal results so it's better
to have it documented.
The m4/spice_manual.m4 came from spice server and is meant to be
reused.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-10-17 11:43:26 +01:00
Victor Toso
642308ecec build-sys: requires liblz4 129 or newer
LZ4 data compression on spicevmc channel uses LZ4_compress_default()
API introduced in 129 release (see commit bellow)

[0] https://github.com/Cyan4973/lz4/commit/1b17bf2ab8cf66dd2b740e

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Reported-by: Fabio Fantoni <fantonifabio@tiscali.it>
2016-08-09 16:40:00 +02:00
Eduardo Lima (Etrunko)
5359304713 Make LZ4 dependency check more robust
Add a new 'HAVE_LZ4' automake conditional to really tell if we have the
dependency installed on the system. It will later be used in Makefile to
decide whether or not the specific files related to LZ4 should be built.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-06-16 10:36:48 -03:00
Pavel Grunt
384698af37 Remove GL support
It is not needed since spice-server commit
c5c176a5c7718177f23b07981556b5d460627498

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-11 16:54:23 +01:00
Lin Ma
2eaf7c9572 build-sys: Define opengl GL_LIBS and GL_CFLAGS in generated Makefile.in
SPICE_COMMON_{CFLAGS,LIBS} references '$(GL_{CFLAGS,LIBS)', so these
variables are going to be expanded at 'make' time rather than at
'configure' time.
The linker flag and the compiler flag won't be substituted in the
generated Makefile without AC_SUBST.
It causes spice-gtk building failure with --enable-opengl option.

The patch fixes this issue.

Signed-off-by: Lin Ma <lma@suse.com>
2016-04-18 10:59:07 +02:00
Christophe Fergeau
2a4bf49edd log: Make sure glib threading is initialized
While testing spice-server on EL6, I was getting random crashes in the
glib logging code because g_logv was called recursively even though this
was not visible in a backtrace.

It turns out on older glib versions (EL6 has 2.28), g_logv is not
thread-safe unless g_thread_init() is called first. If g_thread_init()
is not called, the GMutex/GPrivate calls g_logv makes are turned into
no-ops, which is going to cause the recursion issue I was seeing.

This commit adds a call to g_thread_init() for these older glib
versions.

(gdb) bt
    0x7fff9f9fb110 "item.type: 114", unused_data=0x0) at gmessages.c:863
    format=0x7ffff50e72ac "item.type: %d", args1=0x7fff9f9fb640) at gmessages.c:517
    SPICE_LOG_LEVEL_DEBUG, strloc=0x7ffff50e72ba "dcc.c:1652", function=
    0x7ffff50e7320 "release_item_before_push", format=0x7ffff50e72ac "item.type: %d", args=
    0x7fff9f9fb640) at log.c:163
    SPICE_LOG_LEVEL_DEBUG, strloc=0x7ffff50e72ba "dcc.c:1652", function=
    0x7ffff50e7320 "release_item_before_push", format=0x7ffff50e72ac "item.type: %d") at log.c:195
    at dcc.c:1652
    at dcc.c:1719
    at dcc-send.c:2450
    at red-channel.c:578
    at red-channel.c:1587
    at event-loop.c:122
    0x7ffff4fb2ef2 <watch_func>, user_data=0x7fff980244e0) at giounix.c:166
    0x7ffff86ec770) at gmain.c:3092
2016-04-05 15:38:18 +02:00
Eduardo Lima (Etrunko)
55ec596798 2/2] Add check for openssl
It is required to compile ssl-verify.[ch].

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-03-31 11:25:49 +02:00
Pavel Grunt
6424c0baee Use lz4 if possible
Change the default option to "auto"

Acked-by: Victor Toso <victortoso@redhat.com>
2016-01-28 14:16:10 +01:00
Pavel Grunt
c3f2d217af m4: Add macro for --with-sasl
It is not used by spice-common, but both server and client can use it.
Compared to current checks in spice-gtk and spice server this macro only
supports libsasl2.

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-12-18 13:57:58 +01:00
Christophe Fergeau
d13fdd7fa9 m4: Fix SPICE_WARNING on el6
autogen.sh fails on el6 unless the second argument to
AC_DEFUN([SPICE_WARNING]) is enclosed in []
2015-12-14 15:30:41 +01:00
Marc-André Lureau
f8db887eb0 Use new libcacard.h if possible
libcacard.h requires 2.5.1. Keep compatibility for older versions until
the transition in distros to the standalone version is done.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[ Christophe: add < 2.5.1 fallback ]
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2015-11-25 15:16:35 +01:00
Francois Gouget
f471022453 build-sys: Add SPICE_CHECK_GSTREAMER_ELEMENTS()
This makes it possible to warn the developer that the GStreamer elements
needed at runtime are missing and give him a hint on how to fix the
issue.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-11-16 16:31:06 +01:00
Francois Gouget
437b817f49 build-sys: Add SPICE_CHECK_GSTREAMER()
This simplifies checking for GStreamer modules by setting all the
variables we normally need.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-11-04 10:34:19 +01:00
Francois Gouget
899a7c75e3 build-sys: Add the SPICE_WARNING() and SPICE_PRINT_MESSAGES m4 macros
A call to SPICE_WARNING() anywhere in the configure file results in the
warning being printed at the end of the configure run where it will be
be visible. This makes it possible to keep the SPICE_WARNING() calls
together with the related feature checks instead of having to put a
separate AC_MSG_WARN() call near the end.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-11-04 10:34:19 +01:00
Christophe Fergeau
304a16fdad build-sys: Add missing # to comment
SPICE_CHECK_SMARTCARD documentation ends with a '-------' comment, but
the # to start the comment is missing, causing a warning message when
running configure.
2015-11-02 12:30:09 +01:00
Christophe Fergeau
d8c3568a31 build-sys: Rename SUPPORT_GL to HAVE_GL
The other conditionals are using the HAVE_ prefix, using HAVE_GL rather
than SUPPORT_GL improves consistency.
2015-10-23 14:05:39 +02:00
Christophe Fergeau
f77805773f build-sys: Set automake conditional in SPICE_CHECK_SMARTCARD
spice-server will use this.
2015-10-23 14:05:39 +02:00
Christophe Fergeau
986ad88c28 build-sys: Fix error in SPICE_CHECK_LZ4 description
This macro does not define a SUPPORT_LZ4 automake conditional.
2015-10-23 14:05:23 +02:00
Christophe Fergeau
04ed3b8cbe build-sys: Add gio-2.0 to SPICE_CHECK_GLIB2
GInetAddress is defined in gio, not glib. Not checking for gio-2.0 in
SPICE_CHECK_GLIB2 means gio won't be in GLIB2_LIBS, which causes link
errors when trying to build spice-server.
2015-10-23 14:05:23 +02:00
Lukas Venhoda
9b74e47ed3 m4: Require glib version >= 2.22
This is required by the GInetAddress functions.
2015-10-23 11:07:58 +02:00
Christophe Fergeau
f7ec855af3 build-sys: Rework SPICE_CHECK_* m4 macros
These macros were automatically appending the needed CFLAGS/LIBS to
variables passed as arguments. This is how spice-common uses them, but
now how spice-gtk/spice want to use them, and is making the macros more
complicated than they could (in particular this makes them use
AS_VAR_APPEND).
This  is also not flexible enough as spice-gtk uses libcacard libraries,
while spice-common does not need them. If SPICE_CHECK_SMARTCARD
unconditionnally libcacard libraries to the variable spice-common passes
it as an argument, we'll end up linking with an unneeded library.

This commit removes this automatic appending from the SPICE_CHECK_*
macros and moves it to spice-common as it's the only one which needs it.
2015-10-13 11:26:01 +02:00
Christophe Fergeau
f88a7b7bec Use installed spice-protocol for code generation
Now that spice-protocol ships the needed .proto files as well as the
corresponding python scripts, spice-common can use these in order to
generate the C code for the SPICE (de)marshallers.
2015-08-11 10:26:06 +02:00
Christophe Fergeau
2d054e0e69 m4: Add compat AS_VAR_APPEND for older autoconf
This causes failures on EL6 otherwise as autoconf is too old there.
2015-07-02 17:02:21 +02:00
Christophe Fergeau
1b5edbe49e m4: Add macro for --enable-lz4
It's not directly used by spice-common, but this way spice-gtk and
spice-server can share the same implementation.
2015-06-17 19:25:05 +02:00
Christophe Fergeau
838ec7d87b configure.ac: Check for needed python modules for git builds
After the patch adding support for python 3 to the code generator,
python-six is required when building from git. Since I got 2 different
reports of SPICE build failures right after introducing it, it's
probably better to check for the needed python modules from configure,
and exit with an error if they are missing.
This commit adds a --enable-python-checks configure flag for that
though, since we only want to do that when building from git. It assumes
that people running from git will be running autogen.sh, while people
building from tarballs will run configure.
2015-04-13 13:08:11 +02:00
Erlon Cruz
c6e6dacb30 ppc: build-sys: Add big-endian support
A few files (the generated marshalling code and pixman-related utils)
make use of WORDS_BIGENDIAN in order to do the right thing depending on
endianness. configure.ac must call AC_C_BIGENDIAN for it to be defined.

Signed-off-by: Erlon R. Cruz <erlon.cruz@br.flextronics.com>
Signed-off-by: Rafael F. Santos <fonsecasantos.rafael@gmail.com>
Signed-off-by: Fabiano Fidêncio <Fabiano.Fidêncio@fit-tecnologia.org.br>
2015-04-10 20:20:49 +02:00