diff --git a/Makefile.am b/Makefile.am
index a9373e6..9e94648 100644
--- a/Makefile.am
+++ b/Makefile.am
TESTS = $(unit_tests)
AM_TESTS_ENVIRONMENT = MALLOC_CHECK_=3 MALLOC_PERTURB_=69
+if DBUS_RUN_SESSION
+AM_TESTS_ENVIRONMENT += dbus-run-session --
+endif
+
pkgconfigdir = $(libdir)/pkgconfig
if LIBRARY
diff --git a/configure.ac b/configure.ac
index 1016ee4..d632657 100644
--- a/configure.ac
+++ b/configure.ac
if (test "$USE_MAINTAINER_MODE" = "yes"); then
AC_CHECK_PROG(enable_coverage, [lcov], [yes], [no])
+ AC_CHECK_PROG(enable_dbus_run_session, [dbus-run-session], [yes])
fi
AM_CONDITIONAL(COVERAGE, test "${enable_coverage}" = "yes")
+AM_CONDITIONAL(DBUS_RUN_SESSION, test "${enable_dbus_run_session}" = "yes")
MISC_FLAGS