[Spice-devel] [PATCH] Don't build libspice-client-gtk if configured --without-gtk
Benjamin Gilbert
bgilbert at cs.cmu.edu
Wed Feb 4 00:46:48 PST 2015
libspice-client-glib is useful as a client library on platforms that
don't support GTK.
---
Makefile.am | 5 ++++-
configure.ac | 14 ++++++++------
gtk/Makefile.am | 14 ++++++++++++--
vapi/Makefile.am | 7 +++++--
4 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8ac2028..e559c4d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,9 +16,12 @@ endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
spice-client-glib-2.0.pc \
- spice-client-gtk-$(SPICE_GTK_API_VERSION).pc \
$(NULL)
+if WITH_GTK
+pkgconfig_DATA += spice-client-gtk-$(SPICE_GTK_API_VERSION).pc
+endif
+
if WITH_CONTROLLER
pkgconfig_DATA += spice-controller.pc
endif
diff --git a/configure.ac b/configure.ac
index 9b420a3..5146c72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,13 +158,13 @@ AC_SUBST([SASL_LIBS])
AC_MSG_CHECKING([which gtk+ version to compile against])
AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--with-gtk=@<:@2.0/3.0@:>@],[which gtk+ version to compile against @<:@default=3.0@:>@])],
+ [AS_HELP_STRING([--with-gtk=@<:@2.0/3.0/no@:>@],[which gtk+ version to compile against @<:@default=3.0@:>@])],
[case "$with_gtk" in
- 2.0|3.0) ;;
+ 2.0|3.0) AC_MSG_RESULT([$with_gtk]) ;;
+ no) AC_MSG_RESULT([none]) ;;
*) AC_MSG_ERROR([invalid gtk version specified]) ;;
esac],
[with_gtk=3.0])
-AC_MSG_RESULT([$with_gtk])
case "$with_gtk" in
2.0) GTK_API_VERSION=2.0
@@ -180,10 +180,12 @@ esac
AC_SUBST([GTK_API_VERSION])
AC_SUBST([GTK_REQUIRED])
AC_SUBST([SPICE_GTK_API_VERSION])
+AM_CONDITIONAL([WITH_GTK],[test "$with_gtk" != "no"])
AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
-PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
+AS_IF([test "x$with_gtk" != "xno"],
+ [PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
SPICE_GTK_REQUIRES="${SPICE_GTK_REQUIRES} gtk+-$GTK_API_VERSION >= $GTK_REQUIRED"
@@ -599,7 +601,7 @@ AC_ARG_WITH([python],
yes|no|auto) with_python="$withval";;
*) AC_MSG_ERROR([bad value $withval for python option]) ;;
esac],
- [AS_IF([test "$with_gtk" = "3.0" || test "x$os_win32" = "xyes"],
+ [AS_IF([test "$with_gtk" != "2.0" || test "x$os_win32" = "xyes"],
[with_python=no],[with_python=auto])]
)
@@ -758,8 +760,8 @@ AC_MSG_NOTICE([
prefix: ${prefix}
c compiler: ${CC}
Target: ${red_target}
- Gtk: $GTK_API_VERSION
+ Gtk: ${with_gtk}
Coroutine: ${with_coroutine}
Audio: ${with_audio}
SASL support: ${enable_sasl}
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 6003793..7728fec 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -45,7 +45,10 @@ EXTRA_DIST = \
DISTCLEANFILES = spice-version.h
-bin_PROGRAMS = spicy spicy-stats spicy-screenshot
+bin_PROGRAMS = spicy-stats spicy-screenshot
+if WITH_GTK
+bin_PROGRAMS += spicy
+endif
if WITH_POLKIT
acldir = $(ACL_HELPER_DIR)
acl_PROGRAMS = spice-client-glib-usb-acl-helper
@@ -53,11 +56,13 @@ endif
lib_LTLIBRARIES = libspice-client-glib-2.0.la
+if WITH_GTK
if HAVE_GTK_2
lib_LTLIBRARIES += libspice-client-gtk-2.0.la
else
lib_LTLIBRARIES += libspice-client-gtk-3.0.la
endif
+endif
if HAVE_LD_VERSION_SCRIPT
GLIB_SYMBOLS_LDFLAGS = -Wl,--version-script=${srcdir}/map-file
@@ -157,6 +162,7 @@ SPICE_GTK_SOURCES_COMMON += \
$(NULL)
endif
+if WITH_GTK
if HAVE_GTK_2
libspice_client_gtk_2_0_la_DEPEDENCIES = $(GTK_SYMBOLS_FILE)
libspice_client_gtk_2_0_la_LDFLAGS = $(SPICE_GTK_LDFLAGS_COMMON)
@@ -171,7 +177,6 @@ libspice_client_gtk_3_0_la_SOURCES = $(SPICE_GTK_SOURCES_COMMON)
nodist_libspice_client_gtk_3_0_la_SOURCES = $(nodist_SPICE_GTK_SOURCES_COMMON)
endif
-
libspice_client_gtkincludedir = $(includedir)/spice-client-gtk-$(SPICE_GTK_API_VERSION)
libspice_client_gtkinclude_HEADERS = \
spice-gtk-session.h \
@@ -183,6 +188,7 @@ libspice_client_gtkinclude_HEADERS = \
nodist_libspice_client_gtkinclude_HEADERS = \
spice-widget-enums.h \
$(NULL)
+endif
libspice_client_glib_2_0_la_DEPENDENCIES = $(GLIB_SYMBOLS_FILE)
@@ -449,11 +455,13 @@ spicy_stats_LDADD = \
$(libspice_client_glib_2_0_la_SOURCES): spice-glib-enums.h spice-marshal.h
+if WITH_GTK
if HAVE_GTK_2
$(libspice_client_gtk_2_0_la_SOURCES): spice-glib-enums.h spice-widget-enums.h
else
$(libspice_client_gtk_3_0_la_SOURCES): spice-glib-enums.h spice-widget-enums.h
endif
+endif
spice-marshal.c: spice-marshal.h
spice-glib-enums.c: spice-glib-enums.h
@@ -643,6 +651,7 @@ SpiceClientGLib_2_0_gir_EXPORT_PACKAGES = spice-client-glib-2.0
SpiceClientGLib_2_0_gir_SCANNERFLAGS = --c-include="spice-client.h"
INTROSPECTION_GIRS += SpiceClientGLib-2.0.gir
+if WITH_GTK
if HAVE_GTK_2
SpiceClientGtk-2.0.gir: libspice-client-gtk-2.0.la SpiceClientGLib-2.0.gir
SpiceClientGtk_2_0_gir_INCLUDES = GObject-2.0 Gtk-2.0 SpiceClientGLib-2.0
@@ -661,6 +670,7 @@ SpiceClientGtk_3_0_gir_EXPORT_PACKAGES = spice-client-gtk-3.0
SpiceClientGtk_3_0_gir_SCANNERFLAGS = --c-include="spice-widget.h"
endif
INTROSPECTION_GIRS += SpiceClientGtk-$(SPICE_GTK_API_VERSION).gir
+endif
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index ad43d69..5325aaa 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -4,13 +4,16 @@ CLEANFILES =
vapidir = $(datadir)/vala/vapi
vapi_DATA = \
spice-client-glib-2.0.vapi \
- spice-client-gtk-$(SPICE_GTK_API_VERSION).vapi \
$(NULL)
dist_vapi_DATA = \
- spice-client-gtk-$(SPICE_GTK_API_VERSION).deps \
spice-client-glib-2.0.deps \
$(NULL)
+if WITH_GTK
+vapi_DATA += spice-client-gtk-$(SPICE_GTK_API_VERSION).vapi
+dist_vapi_DATA += spice-client-gtk-$(SPICE_GTK_API_VERSION).deps
+endif
+
EXTRA_DIST = \
spice-client-gtk-2.0.deps \
spice-client-gtk-3.0.deps \
--
1.9.3
More information about the Spice-devel
mailing list