From 08635d5957526be62bea03f795d7c2be478b012f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 9 Nov 2011 17:18:36 +0000 Subject: [PATCH 1/2] Allow a reduced set of installable tests (none yet) to be built without GLib --enable-modular-tests=auto will build as many as possible, perhaps excluding the GLib ones. --enable-modular-tests=yes or --enable-tests=yes will insist on having GLib, to be able to run everything. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42811 Signed-off-by: Simon McVittie --- configure.ac | 24 +++++++++++++++--------- test/Makefile.am | 5 +++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 23e886f..3323ea3 100644 --- a/configure.ac +++ b/configure.ac @@ -190,6 +190,9 @@ fi # These use GTest, from GLib, because life's too short. They're enabled by # default (unless you don't have GLib), because they don't bloat the library # or binaries. + +with_glib=yes + if test "x$enable_modular_tests" != xno; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22, gio-2.0 >= 2.22], [], @@ -197,7 +200,7 @@ if test "x$enable_modular_tests" != xno; then AC_MSG_NOTICE([Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires GLib]) AC_MSG_ERROR([$GLIB_ERRORS]) else # assumed to be "auto" - enable_modular_tests=no + with_glib=no fi]) # If dbus-gmain.[ch] returned to libdbus then we wouldn't need this PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1], @@ -206,19 +209,21 @@ if test "x$enable_modular_tests" != xno; then AC_MSG_NOTICE([Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires dbus-glib]) AC_MSG_ERROR([$DBUS_GLIB_ERRORS]) else # assumed to be "auto" - enable_modular_tests=no + with_glib=no fi]) - if test "x$enable_modular_tests" != xno; then - # dependencies checked, switch from auto to yes - enable_modular_tests=yes - fi fi -if test "x$enable_modular_tests" = xyes; then +if test "x$enable_modular_tests" != xno; then AC_DEFINE([DBUS_ENABLE_MODULAR_TESTS], [1], - [Define to build independent test binaries (requires GLib)]) + [Define to build independent test binaries]) fi AM_CONDITIONAL([DBUS_ENABLE_MODULAR_TESTS], - [test "x$enable_modular_tests" = xyes]) + [test "x$enable_modular_tests" != xno]) + +if test "x$with_glib" != xno; then + AC_DEFINE([DBUS_WITH_GLIB], [1], + [Define if GLib, GObject, GIO are available]) +fi +AM_CONDITIONAL([DBUS_WITH_GLIB], [test "x$with_glib" != xno]) AC_ARG_ENABLE([installed-tests], AS_HELP_STRING([--enable-installed-tests], @@ -1642,6 +1647,7 @@ echo " gcc coverage profiling: ${enable_compiler_coverage} Building embedded tests: ${enable_embedded_tests} Building modular tests: ${enable_modular_tests} + - with GLib: ${with_glib} Building verbose mode: ${enable_verbose_mode} Building assertions: ${enable_asserts} Building checks: ${enable_checks} diff --git a/test/Makefile.am b/test/Makefile.am index b890c63..9b5b3b1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -112,6 +112,10 @@ testexecdir = $(libdir)/dbus-1.0/test testexec_PROGRAMS = installable_tests = \ + $(NULL) + +if DBUS_WITH_GLIB +installable_tests += \ test-corrupt \ test-dbus-daemon \ test-loopback \ @@ -120,6 +124,7 @@ installable_tests = \ test-relay \ test-syslog \ $(NULL) +endif DBUS_WITH_GLIB installcheck_tests = installcheck_environment = \ -- 1.7.7.2