AM_CONDITIONAL(DBUS_UNIX, test "$dbus_unix" = yes)
AM_CONDITIONAL(DBUS_CYGWIN, test "$dbus_cygwin" = yes)
-AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code in the library and binaries]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no)
AC_ARG_ENABLE(verbose-mode, AS_HELP_STRING([--enable-verbose-mode],[support verbose debug mode]),enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion checks]),enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)]))
AC_ARG_WITH(dbus_daemondir, AS_HELP_STRING([--with-dbus-daemondir=[dirname]],[Directory for installing the DBUS daemon]))
-dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
-dnl and also some stuff in the test/ subdir
-AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
-if test x$enable_tests = xyes; then
- AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
+AC_ARG_ENABLE([embedded-tests],
+ AS_HELP_STRING([--enable-embedded-tests],
+ [enable unit test code in the library and binaries]),
+ [], [enable_embedded_tests=$USE_MAINTAINER_MODE])
+AC_ARG_ENABLE([modular-tests],
+ AS_HELP_STRING([--enable-modular-tests],
+ [enable modular regression tests (requires GLib)]),
+ [], [enable_modular_tests=auto])
+# --enable-tests overrides both --enable-embedded-tests and
+# --enable-modular-tests
+AC_ARG_ENABLE([tests],
+ AS_HELP_STRING([--enable-tests],
+ [enable/disable all tests, overriding embedded-tests/modular-tests]),
+ [enable_embedded_tests=$enableval; enable_modular_tests=$enableval],
+ [])
+
+# DBUS_ENABLE_EMBEDDED_TESTS controls unit tests built in to .c files
+# and also some stuff in the test/ subdir. DBUS_BUILD_TESTS was an older
+# name for this.
+AM_CONDITIONAL([DBUS_BUILD_TESTS], [test "x$enable_embedded_tests" = xyes])
+AM_CONDITIONAL([DBUS_ENABLE_EMBEDDED_TESTS],
+ [test "x$enable_embedded_tests" = xyes])
+if test "x$enable_embedded_tests" = xyes; then
+ AC_DEFINE([DBUS_ENABLE_EMBEDDED_TESTS], [1],
+ [Define to build test code into the library and binaries])
+ AC_DEFINE([DBUS_BUILD_TESTS], [1],
+ [Define to build test code into the library and binaries])
+fi
+
+# DBUS_ENABLE_MODULAR_TESTS controls tests that work based on public API.
+# 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.
+if test "x$enable_modular_tests" != xno; then
+ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.18],
+ [],
+ [if test "x$enable_modular_tests" = xyes; then
+ AC_MSG_ERROR([GLib is required by the modular tests])
+ else # assumed to be "auto"
+ enable_modular_tests=no
+ fi])
+ # If dbus-gmain.[ch] returned to libdbus then we wouldn't need this
+ PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1],
+ [],
+ [if test "x$enable_modular_tests" = xyes; then
+ AC_MSG_ERROR([dbus-glib is required by the modular tests (for now)])
+ else # assumed to be "auto"
+ enable_modular_tests=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
+ AC_DEFINE([DBUS_ENABLE_MODULAR_TESTS], [1],
+ [Define to build independent test binaries (requires GLib)])
fi
+AM_CONDITIONAL([DBUS_ENABLE_MODULAR_TESTS],
+ [test "x$enable_modular_tests" = xyes])
if test x$enable_verbose_mode = xyes; then
AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
echo "
Maintainer mode: ${USE_MAINTAINER_MODE}
gcc coverage profiling: ${enable_compiler_coverage}
- Building unit tests: ${enable_tests}
+ Building embedded tests: ${enable_embedded_tests}
+ Building modular tests: ${enable_modular_tests}
Building verbose mode: ${enable_verbose_mode}
Building assertions: ${enable_asserts}
Building checks: ${enable_checks}
fi
echo
-if test x$enable_tests = xyes; then
+if test x$enable_embedded_tests = xyes; then
echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
fi
-if test x$enable_tests = xyes -a x$enable_asserts = xno; then
- echo "NOTE: building with unit tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)"
+if test x$enable_embedded_tests = xyes -a x$enable_asserts = xno; then
+ echo "NOTE: building with embedded tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)"
fi
if test x$enable_compiler_coverage = xyes; then
echo "NOTE: building with coverage profiling is definitely for developers only."