[Spice-devel] [spice-gtk v2 2/2] Fix build with automake 1.14

Christophe Fergeau cfergeau at redhat.com
Wed Aug 6 08:46:16 PDT 2014


When building a source file from a different directory, automake 1.14
is warning that the automake option 'subdir-objects' must be used:

automake: warnings are treated as errors
gtk/Makefile.am:218: warning: source file
'$(top_srcdir)/spice-common/common/sw_canvas.c' is in a subdirectory,
gtk/Makefile.am:218: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the
'subdir-objects'
automake: automake option hasn't been enabled.  For now, the
corresponding output
automake: object file(s) will be placed in the top-level directory.
However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same
subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option
throughout your
automake: project, to avoid future incompatibilities.
autoreconf: automake failed with exit status: 1

This causes the build to fail because we are also using the -Werror
automake option.
Updating the spice-common submodule to git master fixes part of this
issue as 7ea1cc5 'Fix generation of marshallers in VPATH builds' removed
directory references from some source files.

This commit removes the references to
$(top_srcdir)/spice-common/common/sw_canvas.[ch] from gtk/Makefile.am.
At this point, automake subdir-objects support does not seem to cope
very well with source files which are not in relative subdirectories,
see http://mytestbed.net/issues/1327
What is done instead is to add some local client_sw_canvas.[ch] files
which will include the needed files from spice-common with the
appropriate #define set (these sw_canvas.[ch] files are meant to be used
as templates).

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=67304
---
 gtk/Makefile.am            |  5 ++---
 gtk/channel-display-priv.h |  3 +--
 gtk/client_sw_canvas.c     | 20 ++++++++++++++++++++
 gtk/client_sw_canvas.h     | 25 +++++++++++++++++++++++++
 gtk/decode.h               |  2 +-
 5 files changed, 49 insertions(+), 6 deletions(-)
 create mode 100644 gtk/client_sw_canvas.c
 create mode 100644 gtk/client_sw_canvas.h

diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index f70f821..3d87958 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -72,7 +72,6 @@ KEYMAP_GEN = $(srcdir)/keymap-gen.pl
 SPICE_COMMON_CPPFLAGS =						\
 	-DG_LOG_DOMAIN=\"GSpice\"				\
 	-DSPICE_NO_DEPRECATED					\
-	-DSW_CANVAS_CACHE					\
 	-DSPICE_GTK_LOCALEDIR=\"${SPICE_GTK_LOCALEDIR}\"	\
 	-DPNP_IDS=\""$(PNP_IDS)"\"				\
 	-DUSB_IDS=\""$(USB_IDS)"\"				\
@@ -271,8 +270,8 @@ libspice_client_glib_2_0_la_SOURCES =			\
 	decode-jpeg.c					\
 	decode-zlib.c					\
 							\
-	$(top_srcdir)/spice-common/common/sw_canvas.c	\
-	$(top_srcdir)/spice-common/common/sw_canvas.h	\
+	client_sw_canvas.c	\
+	client_sw_canvas.h	\
 	$(NULL)
 
 if WITH_GPROXY
diff --git a/gtk/channel-display-priv.h b/gtk/channel-display-priv.h
index 92cd231..ab66cca 100644
--- a/gtk/channel-display-priv.h
+++ b/gtk/channel-display-priv.h
@@ -26,9 +26,8 @@
 #endif
 #include <jpeglib.h>
 
-#include "common/canvas_base.h"
 #include "common/canvas_utils.h"
-#include "common/sw_canvas.h"
+#include "client_sw_canvas.h"
 #include "common/ring.h"
 #include "common/quic.h"
 #include "common/rop3.h"
diff --git a/gtk/client_sw_canvas.c b/gtk/client_sw_canvas.c
new file mode 100644
index 0000000..a69abe0
--- /dev/null
+++ b/gtk/client_sw_canvas.c
@@ -0,0 +1,20 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+   Copyright (C) 2014 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, see <http://www.gnu.org/licenses/>.
+*/
+#define SW_CANVAS_CACHE
+
+#include "common/sw_canvas.c"
diff --git a/gtk/client_sw_canvas.h b/gtk/client_sw_canvas.h
new file mode 100644
index 0000000..1180c5b
--- /dev/null
+++ b/gtk/client_sw_canvas.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+   Copyright (C) 2014 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, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef __SPICE_CLIENT_SW_CANVAS_H__
+#define __SPICE_CLIENT_SW_CANVAS_H__
+
+#define SW_CANVAS_CACHE
+
+#include <common/sw_canvas.h>
+
+#endif /* __SPICE_CLIENT_SW_CANVAS_H__ */
diff --git a/gtk/decode.h b/gtk/decode.h
index 7af0760..b274d67 100644
--- a/gtk/decode.h
+++ b/gtk/decode.h
@@ -20,7 +20,7 @@
 
 #include <glib.h>
 
-#include "common/canvas_base.h"
+#include "client_sw_canvas.h"
 
 G_BEGIN_DECLS
 
-- 
1.9.3



More information about the Spice-devel mailing list