[Spice-devel] [PATCH] Add missing libX11 reference to build system

Ian Stakenvicius axs at gentoo.org
Wed Aug 17 23:16:02 UTC 2016


GTK on its own is not enough to ensure libX11 is properly linked with
libspice-client-gtk.  This patch adds X11_LIBS to SPICE_GTK_LIBADD_COMMON
(and X11_CFLAGS to a relevant section as well) in src/Makefile.am, and
performs an approriate pkg-config based check to determine the correct
values in configure.ac when not building for win32 or quartz.

For more info see http://bugs.gentoo.org/585118

Closes: https://github.com/SPICE/spice-gtk/pull/3
---
 configure.ac    | 7 +++++++
 src/Makefile.am | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/configure.ac b/configure.ac
index ce80d88..91b523b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,6 +151,13 @@ AS_IF([test "x$have_win32" = "xyes"], [AC_DEFINE([HAVE_WINDOWS], 1, [Have Win32?
 AM_CONDITIONAL([WITH_DISPLAY_WINDOWS], [test "x$have_win32" = "xyes"])
 
 AC_CHECK_HEADERS([X11/XKBlib.h])
+AS_IF([test "x$have_quartz" != "xyes"],[
+  AS_IF([test "x$have_win32" != "xyes"],[
+    PKG_CHECK_MODULES(X11,x11)
+  ])
+])
+AC_SUBST(X11_CFLAGS)
+AC_SUBST(X11_LIBS)
 
 AC_ARG_WITH([pnp-ids-path],
   AC_HELP_STRING([--with-pnp-ids-path],
diff --git a/src/Makefile.am b/src/Makefile.am
index 0ef3bea..d70417a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -99,6 +99,7 @@ SPICE_COMMON_CPPFLAGS =						\
 	$(GUDEV_CFLAGS)						\
 	$(SOUP_CFLAGS)						\
 	$(PHODAV_CFLAGS)					\
+	$(X11_CFLAGS)					\
 	$(LZ4_CFLAGS)					\
 	$(NULL)
 
@@ -118,6 +119,7 @@ SPICE_GTK_LIBADD_COMMON =		\
 	libspice-client-glib-2.0.la	\
 	$(GTK_LIBS)			\
 	$(CAIRO_LIBS)			\
+	$(X11_LIBS)			\
 	$(LIBM)				\
 	$(NULL)
 
-- 
2.7.3



More information about the Spice-devel mailing list