-dnl dnl build the Hildon UI?
-PKG_CHECK_MODULES(MODEST_HILDON,hildon-libs,hildon_support=yes,echo "no";hildon_support=no)
-
-dnl now, determine what to build
-AC_MSG_NOTICE([Determining what UI to build])
-modest_ui="none"
-if test "x$hildon_support" = "xyes"; then
- AC_MSG_NOTICE([Looks like Hildon])
-
- AC_SUBST(MODEST_UI_DIR,"hildon-libs")
- AC_DEFINE([MODEST_ENABLE_HILDON_UI],1,[Enable Hildon UI])
- PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO,libtinymail-maemo-1.0 hildon-libs hildon-lgpl)
- AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_CFLAGS)
- AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_LIBS)
- modest_ui="hildon"
+dnl dnl now, determine what to build
+AC_MSG_NOTICE([Determining what platform to build])
+PKG_CHECK_MODULES(LIBOSSO,libosso,[with_platform=maemo],true)
+
+AC_ARG_WITH(platform,
+[--with-platform=gnome platform to build for [gnome]],
+[case "${with_platform}" in
+ gnome) MODEST_PLATFORM=gnome;;
+ maemo) MODEST_PLATFORM=maemo;;
+ *) MODEST_PLATFORM=${with_platform}
+esac], [MODEST_PLATFORM=gnome
+ with_platform=gnome])
+AC_SUBST(MODEST_PLATFORM)
+
+
+if test "x$with_platform" = "xmaemo"; then
+
+ PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.9, hildon1=yes, hildon1=no)
+ if test "$hildon1" == "yes"; then # the 'new' hildon
+ PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO, conic libtinymail-maemo-1.0 hildon-1 libosso libhildonmime osso-addressbook-1.0 wpeditor hildon-help libebook-1.2 libalarm hildon-notify libnotify)
+
+ else # the old hildon
+ PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO, conic libtinymail-maemo-1.0 hildon-libs >= 0.12.0 libosso libossomime libossohelp osso-addressbook-1.0 libwpeditor-plus libebook-1.2 libalarm gnome-vfs-module-2.0 hildon-notify libnotify)
+ AC_DEFINE_UNQUOTED(MODEST_HILDON_VERSION_0, 1, ["The Hildon version we support."])
+ fi
+
+ AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_CFLAGS)
+ AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_LIBS)
+
+ AC_DEFINE_UNQUOTED(MODEST_PLATFORM_MAEMO, 1, ["Whether modest is being built for the Maemo platform."])
+
+ desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
+ serviceentrydir=`$PKG_CONFIG dbus-glib-1 --variable=prefix`/share/dbus-1/services
+ localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
+ backupsettingsdir=/etc/osso-backup/applications
+ pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
+ icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
+ icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
+ icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
+ icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
+ icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
+ pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
+ plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
+
+ dbus_api="dbus_api"
+ AC_SUBST(dbus_api)
+
+ # Define as variables in Makefiles
+ AC_SUBST(desktopentrydir)
+ AC_SUBST(serviceentrydir)
+ AC_SUBST(backupsettingsdir)
+ AC_SUBST(localedir)
+ AC_SUBST(pixmapdir)
+ AC_SUBST(icon_26x26dir)
+ AC_SUBST(icon_34x34dir)
+ AC_SUBST(icon_40x40dir)
+ AC_SUBST(icon_50x50dir)
+ AC_SUBST(icon_scalabledir)
+ AC_SUBST(pluginlibdir)
+ AC_SUBST(plugindesktopentrydir)
+
+ # warnings are errors, but don't check format errors, because
+ # it breaks with logical ids
+ CFLAGS="$CFLAGS -Wno-format-extra-args -Werror"