diff options
author | Philip Withnall <withnall@endlessm.com> | 2018-02-14 16:15:15 +0000 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2018-02-14 16:15:15 +0000 |
commit | 40e3eefae8e2d03d549d0f26862d0e2e0883d6c9 (patch) | |
tree | 6f1681edff99d2193604debce49e7e03056d67c3 | |
parent | 6d015894292be75f5fa9138ead64aa61250fe36e (diff) | |
download | libgdata-40e3eefae8e2d03d549d0f26862d0e2e0883d6c9.tar.gz |
build: Add --enable-gtk option to conditionalise GTK+ examples
Only build the GTK+ examples if enabled explicitly with --enable-gtk, or
if --enable-gtk is not specified and GTK+ is available.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=787210
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.ac | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am index 8b17f051..144e54e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -650,10 +650,11 @@ if ENABLE_GOA noinst_PROGRAMS += demos/docs-list/docs-list endif -if HAVE_GTK +if ENABLE_GTK noinst_PROGRAMS += \ demos/scrapbook/scrapbook endif +AM_DISTCHECK_CONFIGURE_FLAGS += --enable-gtk demos_docs_list_docs_list_SOURCES = \ demos/docs-list/docs-list.c \ diff --git a/configure.ac b/configure.ac index 9d56e54b..ae8d437f 100644 --- a/configure.ac +++ b/configure.ac @@ -114,8 +114,16 @@ GDK_PIXBUF_CFLAGS="$GDK_PIXBUF_CFLAGS -DGDK_VERSION_MIN_REQUIRED=$GDK_PIXBUF_MIN AC_SUBST(GDK_PIXBUF_CFLAGS) AC_SUBST(GDK_PIXBUF_LIBS) -PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQS], [have_gtk=yes], [have_gtk=no]) -AM_CONDITIONAL([HAVE_GTK], [test "x$have_gtk" = "xyes"]) +AC_MSG_CHECKING([whether to build examples which use GTK+]) +AC_ARG_ENABLE([gtk], [AS_HELP_STRING([--enable-gtk], [Whether to enable examples which use GTK+ (default: if available)])],, [enable_gtk=maybe]) +AC_MSG_RESULT([$enable_gtk]) +AS_IF([test "$enable_gtk" != "no"],[ + PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQS], [have_gtk=yes], [have_gtk=no]) +]) +AS_IF([test "$enable_gtk" = "yes" && test "$have_gtk" != "yes"],[ + AC_MSG_ERROR([GTK+ support requested but gtk+-3.0 could not be found]) +]) +AM_CONDITIONAL([ENABLE_GTK], [test "$have_gtk" = "yes" && test "$enable_gtk" != "no"]) # GNOME support, which pulls in gcr-base-3 to provide non-pageable memory AC_MSG_CHECKING(whether to build with GNOME support) |