mlite notifications: fixed configure issues

Explicit --enable-mlite didn't enable mlite (enable_mlite not set).
The default is now to not enable it in any case (even if available),
so traditional users won't have to add --disable-mlite to suppress
the error about it being not installed.

The code which depends on mlite must not be compiled if the feature
is disabled, because if mlite is not installed, it would cause compile
errors.
This commit is contained in:
Patrick Ohly 2011-06-16 18:17:21 +02:00
parent efbce3eef9
commit b0da933afb
2 changed files with 14 additions and 6 deletions

View file

@ -506,11 +506,16 @@ if test $enable_dbus_service = "yes"; then
PKG_CHECK_MODULES(MLITE, [mlite QtGui], HAVE_MLITE=yes, HAVE_MLITE=no)
AC_ARG_ENABLE(mlite,
AS_HELP_STRING([--enable-mlite],
[send notifications for automatic sync events, using mlite]),
[ test "$enableval" = "no" || test $HAVE_MLITE = "yes" || AC_ERROR([required mlite package not found]) ],
[ test $HAVE_MLITE = "yes" || AC_ERROR([required mlite package not found, use --disable-mlite to compile without mlite based notifications]) ])
if test $HAVE_MLITE = "yes"; then
[send notifications for automatic sync events, using mlite (off by default)]),
[ enable_mlite="$enableval"
test "$enableval" = "no" || test $HAVE_MLITE = "yes" || AC_ERROR([required mlite package not found]) ],
[ enable_mlite="no" ])
if test $enable_mlite = "yes"; then
AC_DEFINE(HAS_MLITE, 1, [define if mlite could be used in dbus service])
else
# don't use mlite, even if found
MLITE_CFLAGS=
MLITE_LIBS=
fi
AC_DEFINE(DBUS_SERVICE, 1, [define if dbus service is enabled])
fi
@ -522,8 +527,6 @@ AC_SUBST(KEYRING_CFLAGS)
AC_SUBST(KEYRING_LIBS)
AC_SUBST(LIBNOTIFY_CFLAGS)
AC_SUBST(LIBNOTIFY_LIBS)
AC_SUBST(MLITE_CFLAGS)
AC_SUBST(MLITE_LIBS)
AC_SUBST(LIBEXECDIR)
AC_SUBST(BUTEOSYNCPROFILE_LIBS)
AC_SUBST(BUTEOSYNCPROFILE_CFLAGS)

View file

@ -17,6 +17,10 @@
* 02110-1301 USA
*/
#include <config.h>
#ifdef HAS_MLITE
#include "NotificationBackendMLite.h"
#include <mlite/MNotification>
@ -63,3 +67,4 @@ void NotificationBackendMLite::publish(
SE_END_CXX
#endif