From 9a11250983feaa59e92ae638563adc14b7bc74da Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Thu, 12 Feb 2009 22:34:31 +0200 Subject: [PATCH] Make champlain-gtk build conditional --- Makefile.am | 15 +++++++++++---- champlain-gtk/Makefile.am | 6 +++--- configure.ac | 32 +++++++++++++++++++++++++++----- demos/Makefile.am | 8 ++++++-- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7995343..97b1bb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,13 +1,17 @@ -SUBDIRS = tidy champlain champlain-gtk demos docs/reference +SUBDIRS = tidy champlain docs/reference ACLOCAL_AMFLAGS = -I m4 -pcfiles = champlain-@API_VERSION@.pc champlain-gtk-@API_VERSION@.pc +pcfiles = champlain-@API_VERSION@.pc -champlain-@API_VERSION@.pc: champlain.pc +if ENABLE_GTK +SUBDIRS += champlain-gtk +pcfiles += champlain-gtk-@API_VERSION@.pc +champlain-gtk-@API_VERSION@.pc: champlain-gtk.pc @cp -f $< $@ +endif -champlain-gtk-@API_VERSION@.pc: champlain-gtk.pc +champlain-@API_VERSION@.pc: champlain.pc @cp -f $< $@ pkgconfig_DATA = $(pcfiles) @@ -16,3 +20,6 @@ pkgconfigdir = $(libdir)/pkgconfig DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc CLEANFILES = $(pcfiles) + +# Have the demos build at the end as they depend on optional parts +SUBDIRS += demos diff --git a/champlain-gtk/Makefile.am b/champlain-gtk/Makefile.am index dedeb15..a6b4ed3 100644 --- a/champlain-gtk/Makefile.am +++ b/champlain-gtk/Makefile.am @@ -17,7 +17,7 @@ libchamplain_gtk_0_3_la_SOURCES = \ noinst_HEADERS = champlain-view-embed.h -libchamplain_gtk_0_3_la_LIBADD = $(DEPS_LIBS) $(CPLAIN_DEPS_LIBS) +libchamplain_gtk_0_3_la_LIBADD = $(GTK_DEPS_LIBS) champlain-gtk-marshal.h: $(CHAMPLAIN_GTK_MARSHAL_LIST) @GLIB_GENMARSHAL@ --header --prefix=champlain_gtk_marshal $< > $(CHAMPLAIN_GTK_MARSHAL).h @@ -30,7 +30,7 @@ libchamplain_include_HEADERS = champlain-gtk.h champlain-view-embed.h libchamplain_gtk_0_3_la_LDFLAGS= -version-info $(LIBRARY_VERSION) -AM_CPPFLAGS = $(DEPS_CFLAGS) $(CPLAIN_DEPS_CFLAGS) -I$(top_srcdir) -DCHAMPLAIN_GTK_COMPILATION -AM_LDFLAGS = $(DEPS_LIBS) $(CPLAIN_DEPS_LIBS) -export-symbols-regex ^champlain_.* +AM_CPPFLAGS = $(GTK_DEPS_CFLAGS) -I$(top_srcdir) -DCHAMPLAIN_GTK_COMPILATION +AM_LDFLAGS = $(GTK_DEPS_LIBS) -export-symbols-regex ^champlain_.* EXTRA_DIST = $(CHAMPLAIN_GTK_MARSHAL_LIST) diff --git a/configure.ac b/configure.ac index f144e0b..a5442e5 100644 --- a/configure.ac +++ b/configure.ac @@ -31,11 +31,9 @@ PKG_CHECK_MODULES(DEPS, gdk-2.0 >= 2.10, clutter-0.8 >= 0.8, clutter-cairo-0.8 >= 0.8, - clutter-gtk-0.8 >= 0.8, cairo >= 1.4, libsoup-2.4 >= 2.4.1, gio-2.0 >= 2.16 - gtk+-2.0 >= 2.2 ] ) # check for gtk-doc @@ -52,17 +50,40 @@ AC_ARG_ENABLE(debug, if test x$enable_debug = xyes; then AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code]) fi + +# ----------------------------------------------------------- +# Enable debug +# ----------------------------------------------------------- + +AC_ARG_ENABLE(gtk, + AC_HELP_STRING([--disable-gtk],[Don't compile Gtk+ embedded view]), + enable_gtk=$enableval, enable_gtk=yes ) + +if test x$enable_gtk = xyes; then + AC_SUBST(GTK_DEPS_CFLAGS) + AC_SUBST(GTK_DEPS_LIBS) + PKG_CHECK_MODULES(GTK_DEPS, + [ gtk+-2.0 >= 2.2 + clutter-gtk-0.8 >= 0.8 + ] + ) + + AC_CONFIG_FILES([champlain-gtk/Makefile + champlain-gtk.pc]) + + AC_DEFINE(ENABLE_GTK, [], [Enable Gtk+ view code]) +fi + +AM_CONDITIONAL(ENABLE_GTK, test "x$enable_gtk" = "xyes") # ----------------------------------------------------------- AC_CONFIG_FILES([Makefile champlain/Makefile - champlain-gtk/Makefile demos/Makefile tidy/Makefile docs/reference/Makefile docs/reference/version.xml - champlain.pc - champlain-gtk.pc]) + champlain.pc]) AC_OUTPUT echo "" @@ -71,4 +92,5 @@ echo "" echo " Prefix: ${prefix}" echo " Compiler flags: ${CPPFLAGS}" echo " Debug: ${enable_debug}" +echo " Gtk+ View: ${enable_gtk}" diff --git a/demos/Makefile.am b/demos/Makefile.am index 8ff4f52..710c090 100644 --- a/demos/Makefile.am +++ b/demos/Makefile.am @@ -1,4 +1,4 @@ -noinst_PROGRAMS = launcher launcher-gtk animated-marker +noinst_PROGRAMS = launcher animated-marker INCLUDES = -I$(top_srcdir) @@ -11,7 +11,11 @@ launcher_LDADD = $(DEPS_LIBS) ../champlain/libchamplain-0.3.la animated_marker_SOURCES = animated-marker.c animated_marker_LDADD = $(DEPS_LIBS) ../champlain/libchamplain-0.3.la +if ENABLE_GTK +noinst_PROGRAMS += launcher-gtk launcher_gtk_SOURCES = launcher-gtk.c -launcher_gtk_LDADD = $(DEPS_LIBS) $(CPLAIN_DEPS_LIBS) \ +launcher_gtk_CPPFLAGS = $(GTK_DEPS_CFLAGS) +launcher_gtk_LDADD = $(GTK_DEPS_LIBS) $(DEPS_LIBS) \ ../champlain-gtk/libchamplain-gtk-0.3.la \ ../champlain/libchamplain-0.3.la +endif -- 2.39.5