[Spice-devel] [spice-common RFC] Use m4 macro to configure the spice-common submodule

Christophe Fergeau cfergeau at redhat.com
Fri Nov 8 08:36:53 PST 2013


Hey,

We currently configure the spice-common submodule by running its configure
script, which takes quite some time, and is not very flexible (for example
if we want to pass back information to the module using the spice-common
submodule).
This patch replaces this by a macro that does all this work. This is just a
RFC so far to know if I should clean that up a bit more and submit official
patches for inclusion.
I've tested that this works with both spice-gtk and spice, the corresponding
spice change would be:

>From 3dae7ed1357b608b58110fba568a4c0178a486dd Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau at redhat.com>
Date: Wed, 6 Nov 2013 16:14:55 +0100
Subject: [PATCH] Use the new SPICE_COMMON_SETUP macros

This speeds up configure quite a lot as we no longer run multiple
configure.
---
 client/Makefile.am       |  4 ++--
 configure.ac             | 18 +++++-------------
 server/Makefile.am       |  4 ++--
 server/tests/Makefile.am |  2 +-
 spice-common             |  2 +-
 5 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/client/Makefile.am b/client/Makefile.am
index 97b56f6..77ad27f 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -181,7 +181,7 @@ endif
 
 endif
 
-if SUPPORT_SMARTCARD
+if WITH_SMARTCARD
 spicec_SOURCES +=		\
 	smartcard_channel.cpp	\
 	smartcard_channel.h	\
@@ -200,7 +200,7 @@ AM_CPPFLAGS = \
 	$(GL_CFLAGS)					\
 	$(MISC_X_CFLAGS)				\
 	$(PIXMAN_CFLAGS)				\
-	$(COMMON_CFLAGS)				\
+	$(SPICE_COMMON_CFLAGS)				\
 	$(SPICE_NONPKGCONFIG_CFLAGS)			\
 	$(SMARTCARD_CFLAGS)				\
 	$(SSL_CFLAGS)					\
diff --git a/configure.ac b/configure.ac
index b1445f6..6842f78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,8 @@ m4_define([SPICE_AGE], [8])
 AC_INIT(spice, [m4_esyscmd(build-aux/git-version-gen .tarball-version)],
         [spice-devel at lists.freedesktop.org], spice)
 
-AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_MACRO_DIRS([m4 spice-common/m4])
+
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_AUX_DIR(.)
 
@@ -131,15 +132,6 @@ AC_ARG_ENABLE(opengl,
 AS_IF([test x"$enable_opengl" != "xno"], [enable_opengl="yes"])
 AM_CONDITIONAL(SUPPORT_GL, test "x$enable_opengl" = "xyes")
 
-AC_ARG_ENABLE(smartcard,
-[  --enable-smartcard         Enable network redirection],,
-[enable_smartcard="no"])
-AS_IF([test x"$enable_smartcard" != "xno"], [enable_smartcard="yes"])
-AM_CONDITIONAL(SUPPORT_SMARTCARD, test "x$enable_smartcard" != "xno")
-if test "x$enable_smartcard" = "xyes"; then
-   AC_DEFINE([USE_SMARTCARD], [1], [Define if supporting smartcard proxying])
-fi
-
 AC_ARG_ENABLE(client,
 [  --enable-client         Enable spice client],,
 [enable_client="no"])
@@ -156,9 +148,9 @@ AM_CONDITIONAL(SUPPORT_AUTOMATED_TESTS, test "x$enable_automated_tests" != "xno"
 dnl =========================================================================
 dnl Check deps
 
-AC_CONFIG_SUBDIRS([spice-common])
-COMMON_CFLAGS='-I ${top_srcdir}/spice-common/ -I ${top_srcdir}/spice-common/spice-protocol/'
-AC_SUBST(COMMON_CFLAGS)
+SPICE_COMMON_SETUP([spice-common])
+AC_SUBST(SPICE_COMMON_CFLAGS)
+AC_SUBST(SPICE_COMMON_LIBS)
 
 AC_CHECK_LIBM
 AC_SUBST(LIBM)
diff --git a/server/Makefile.am b/server/Makefile.am
index b98385c..4be1153 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -4,7 +4,7 @@ SUBDIRS = . tests
 AM_CPPFLAGS =					\
 	-DSPICE_SERVER_INTERNAL			\
 	-DRED_STATISTICS			\
-	$(COMMON_CFLAGS)			\
+	$(SPICE_COMMON_CFLAGS)			\
 	$(GLIB2_CFLAGS)				\
 	$(PIXMAN_CFLAGS)			\
 	$(SASL_CFLAGS)				\
@@ -112,7 +112,7 @@ libspice_server_la_SOURCES +=	\
 	$(NULL)
 endif
 
-if SUPPORT_SMARTCARD
+if WITH_SMARTCARD
 libspice_server_la_SOURCES +=	\
 	smartcard.c		\
 	smartcard.h		\
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index f4ae661..7d67192 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -5,7 +5,7 @@ AM_CPPFLAGS =					\
 	-I$(top_srcdir)/common			\
 	-I$(top_srcdir)/server			\
 	-I$(top_srcdir)/server/tests		\
-	$(COMMON_CFLAGS)			\
+	$(SPICE_COMMON_CFLAGS)			\
 	$(SMARTCARD_CFLAGS)			\
 	$(SPICE_NONPKGCONFIG_CFLAGS)		\
 	$(NULL)
diff --git a/spice-common b/spice-common
index 4c3d58c..e563098 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 4c3d58cc80b8b725bd2290139d47c444d30cbed5
+Subproject commit e563098d24fdb9b7093754a1a37a87b8c23e0b1b
-- 
1.8.4.2

Christophe




More information about the Spice-devel mailing list