Fix some unit tests.
[modest] / configure.ac
index 1618952..410bac2 100644 (file)
@@ -38,8 +38,6 @@ MODEST_LOCALE_DIR='$prefix/${DATADIRNAME}/locale'
 AM_GLIB_DEFINE_LOCALEDIR([MODEST_LOCALE_DIR])
 AM_GLIB_GNU_GETTEXT
 
-
-
 if test x$prefix = xNONE; then
    prefix=/usr/local
 fi
@@ -54,7 +52,7 @@ AC_PROG_LIBTOOL
 
 # Option to enable debugging
 AC_ARG_ENABLE(debug,
-              [AC_HELP_STRING([  --enable-debug],[Debugging (default=no)])],
+              [AC_HELP_STRING([--enable-debug],[Debugging (default=no)])],
               [with_debug=yes], [with_debug=no])
 
 if test "x$with_debug" == "xyes" ; then
@@ -63,6 +61,16 @@ else
         CFLAGS="$CFLAGS -O2 -Wall"
 fi
 
+# Option to enable debugging
+AC_ARG_ENABLE(gcov,
+              [AC_HELP_STRING([--enable-gcov],[Coverage reporting (default=no)])],
+              [with_gcov=yes], [with_gcov=no])
+
+if test "x$with_gcov" == "xyes" ; then
+        CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+       LDFLAGS="$LDFLAGS -lgcov"
+fi
+
 
 
 dnl -------
@@ -139,6 +147,96 @@ if test "$MODEST_PLATFORM" = "detect"; then
        with_platform=$detected_platform
 fi
 
+if test "$with_platform" = "maemo"; then
+       MODEST_PLUGIN_DEFINES=" -DMODEST_PLATFORM_MAEMO"
+elif test "$with_platform" = "gnome"; then
+       MODEST_PLUGIN_DEFINES=" -DMODEST_PLATFORM_GNOME"
+fi
+AC_SUBST(MODEST_PLUGIN_DEFINES)
+
+#
+# check the widgets library
+#
+have_hildon2=false
+have_hildon1=false
+have_hildon0=false
+have_gtk=false
+PKG_CHECK_EXISTS(hildon-1, have_hildon1=true,have_hildon1=false)
+if test "$have_hildon1" = "true"; then
+   PKG_CHECK_EXISTS(hildon-1 >= 2.1.0, have_hildon2=true, have_hildon2=false)
+   PKG_CHECK_MODULES(MODEST_HILDON_WIDGETS,hildon-1 hildon-fm-2)
+   hildonpkgs="hildon-1 hildon-fm-2"
+   detected_toolkit=hildon1
+   echo "DETECTED HILDON 1 $have_hildon2."
+else
+   hildonpkgs="hildon-libs hildon-fm"
+   detected_toolkit=hildon1
+   PKG_CHECK_EXISTS(hildon-libs >= 0.12.0, have_hildon1=true, have_hildon1=false)
+   if test "$have_hildon1" = "false"; then
+      PKG_CHECK_EXISTS(hildon-libs, have_hildon0=true, have_hildon0=false)
+      if test "$have_hildon0" = "false"; then
+        have_gtk=true
+        detected_toolkit=gtk
+        hildonpkgs=
+      fi
+   fi
+   if test "$have_gtk" = "false"; then
+      PKG_CHECK_MODULES(MODEST_HILDON_WIDGETS,hildon-libs hildon-fm)
+   fi
+fi
+
+dnl --------------- HILDON & PLUGIN PKGS -----------
+pluginpkgs=$hildonpkgs
+echo "Plugin Packages $pluginpkgs"
+AC_SUBST(pluginpkgs)
+
+# Plugin packages must not include libcanberra and libprofile
+if test "$have_hildon2" = "true"; then
+   echo "DETECTED HILDON 2 $have_hildon2."
+   detected_toolkit=hildon2
+   hildonpkgs="$hildonpkgs libcanberra profile"
+   echo "HILDON 2 PACKAGES $hildonpkgs"
+   AC_CHECK_HEADER([profiled/keys_nokia.h], [], AC_MSG_ERROR([You have to install package profile-data-dev]))
+fi
+AC_SUBST(hildonpkgs)
+
+dnl --------------- HILDON API ------------
+hildon_api=
+if test "$have_hildon0" = "true"; then
+   hildon_api=0
+elif test "$have_hildon1" = "true"; then
+   hildon_api=1
+elif test "$have_gtk" = "false"; then
+   hildon_api=`$PKG_CONFIG --modversion hildon-1 | cut -d. -f1`
+fi
+
+AC_DEFINE_UNQUOTED(MODEST_HILDON_API, $hildon_api, ["the API version of hildon"])
+MODEST_PLUGIN_DEFINES="$MODEST_PLUGIN_DEFINES -DMODEST_HILDON_API=$hildon_api"
+
+AC_ARG_WITH(toolkit, [
+Target toolkit:
+  --with-toolkit=detect  detect target toolkit (default)
+  --with-toolkit=gtk   build for Gnome
+  --with-toolkit=hildon1   build for Hildon 1.x
+  --with-toolkit=hildon2   build for Hildon 2.x
+],
+[case "${with_toolkit}" in
+       gtk|hildon1|hildon2|detect)    MODEST_TOOLKIT=${with_toolkit};;
+       *)        AC_MSG_ERROR([Unknown platform selected]);;
+esac], [MODEST_TOOLKIT=detect])
+
+if test "$MODEST_TOOLKIT" = "detect"; then
+       MODEST_TOOLKIT="$detected_toolkit"
+       with_toolkit=$detected_toolkit
+fi
+
+if test "$with_toolkit" = "hildon1"; then
+       MODEST_PLUGIN_DEFINES="$MODEST_PLUGIN_DEFINES -DMODEST_TOOLKIT_HILDON1"
+elif test "$with_toolkit" = "hildon2"; then
+       MODEST_PLUGIN_DEFINES="$MODEST_PLUGIN_DEFINES -DMODEST_TOOLKIT_HILDON2"
+elif test "$with_toolkit" = "gtk"; then
+       MODEST_PLUGIN_DEFINES="$MODEST_PLUGIN_DEFINES -DMODEST_TOOLKIT_GNOME"
+fi
 
 dnl Whether to use maemo-launcher or not
 AC_ARG_ENABLE([maemo-launcher],
@@ -157,19 +255,35 @@ then
 fi
 
 have_easysetup=false
+if test "x$with_toolkit" == "xgtk"; then
+   PKG_CHECK_MODULES(MODEST_TOOLKIT,glib-2.0 >= 2.8 gtk+-2.0 >= 2.10 libnotify)
+   AC_DEFINE_UNQUOTED(MODEST_TOOLKIT_GTK, 1, ["Whether modest is being build for the gtk toolkit."])
+   MODEST_TOOLKIT_DIR=gnome
+else
+   have_easysetup=true
+   PKG_CHECK_MODULES(MODEST_TOOLKIT,$hildonpkgs)
+   if test "$with_toolkit" = "hildon2"; then
+      AC_DEFINE_UNQUOTED(MODEST_TOOLKIT_HILDON2, 1, ["Whether modest is being build for the hildon2 toolkit."])
+      MODEST_TOOLKIT_DIR=hildon2
+   else
+      AC_DEFINE_UNQUOTED(MODEST_TOOLKIT_HILDON1, 1, ["Whether modest is being build for the hildon2 toolkit."])
+      MODEST_TOOLKIT_DIR=maemo
+   fi
+    AC_DEFINE_UNQUOTED(MODEST_HAVE_EASYSETUP, 1, ["Whether we have the easysetup feature"])
+fi
+AM_CONDITIONAL(MODEST_HAVE_EASYSETUP,test "x$have_easysetup" == "xtrue")
+AC_SUBST(MODEST_TOOLKIT)
+AC_SUBST(MODEST_TOOLKIT_DIR)
+
 if test "x$with_platform" == "xgnome"; then
-      PKG_CHECK_MODULES(MODEST_PLATFORM,libtinymail-gnome-desktop-1.0 libnm_glib glib-2.0 >= 2.8 gtk+-2.0 >= 2.10 libnotify)
+      PKG_CHECK_MODULES(MODEST_PLATFORM,libtinymail-gnome-desktop-1.0 libnm_glib glib-2.0 >= 2.8 libnotify)
     AC_DEFINE_UNQUOTED(MODEST_PLATFORM_GNOME, 1, ["Whether modest is being built for the GNOME platform."])
 dnl     AC_MSG_ERROR([The GNOME Build is currently broken; please try the Maemo build instead])
 else
-    have_easysetup=true
     have_dbusapi=true
     PKG_CHECK_MODULES(MODEST_PLATFORM,libosso dbus-1 libtinymail-maemo-1.0 libebook-1.2 )
     AC_DEFINE_UNQUOTED(MODEST_PLATFORM_MAEMO, 1, ["Whether modest is being built for the MAEMO platform."])
-    AC_DEFINE_UNQUOTED(MODEST_HAVE_EASYSETUP, 1, ["Whether we have the easysetup feature"])
-fi                 
-
-AM_CONDITIONAL(MODEST_HAVE_EASYSETUP,test "x$have_easysetup" == "xtrue")
+fi
 AM_CONDITIONAL(MODEST_HAVE_DBUS_API,test "x$have_dbusapi" == "xtrue")
 AC_SUBST(MODEST_PLATFORM)
 
@@ -178,7 +292,7 @@ AC_SUBST(MODEST_PLATFORM)
 #
 # check for wpeditor or libwpeditor-plus (on maemo)
 #
-if test "x$with_platform" == "xmaemo"; then  
+if test "x$with_toolkit" != "xgtk"; then  
 PKG_CHECK_MODULES(MODEST_WPEDITOR,wpeditor,have_wpeditor=true,have_wpeditor=false)
 if test "x$have_wpeditor" == "xfalse"; then
    PKG_CHECK_MODULES(MODEST_WPEDITOR,libwpeditor-plus,have_libwpeditorplus=true,have_libwpeditorplus=false)    
@@ -199,15 +313,15 @@ fi
 # check libalarm
 #
 if test "x$with_platform" == "xmaemo"; then  
-PKG_CHECK_MODULES(MODEST_LIBALARM,libalarm,have_libalarm=true,have_libalarm=false)
-if test "x$have_libalarm" == "xtrue"; then
-   libalarm="libalarm" 
-   AC_DEFINE_UNQUOTED(MODEST_HAVE_LIBALARM, 1, ["Whether libalarm is used."])          
-   AC_SUBST(MODEST_LIBALARM_CFLAGS)
-   AC_SUBST(MODEST_LIBALARM_LIBS)
-else
-   libalarm=""
-fi
+   PKG_CHECK_MODULES(MODEST_LIBALARM,libalarm,have_libalarm=true,have_libalarm=false)
+   if test "x$have_libalarm" == "xfalse"; then
+      PKG_CHECK_MODULES(MODEST_LIBALARM, alarm, have_libalarm=true,have_libalarm=false)
+   fi
+   if test "x$have_libalarm" == "xtrue"; then
+      AC_DEFINE_UNQUOTED(MODEST_HAVE_LIBALARM, 1, ["Whether libalarm is used."])               
+      AC_SUBST(MODEST_LIBALARM_CFLAGS)
+      AC_SUBST(MODEST_LIBALARM_LIBS)
+   fi
 fi
 
 #
@@ -246,7 +360,7 @@ fi
 #
 # check hildon-help (only for maemo)
 #
-if test "x$with_platform" == "xmaemo"; then  
+if test "x$with_toolkit" != "xgtk"; then  
    PKG_CHECK_MODULES(MODEST_HILDON_HELP,hildon-help,have_hildon_help=true,have_hildon_help=false)
    if test "x$have_hildon_help" == "xfalse"; then
       PKG_CHECK_MODULES(MODEST_HILDON_HELP,libossohelp,have_osso_help=true,have_osso_help=false)       
@@ -267,7 +381,7 @@ fi
 #
 # check for the notification stuff (only maemo)
 #
-if test "x$with_platform" == "xmaemo"; then  
+if test "x$with_toolkit" != "xgtk"; then  
    PKG_CHECK_MODULES(MODEST_HILDON_NOTIFY,hildon-notify libnotify,have_hildon_notify=true,have_hildon_notify=false)
    if test "x$have_hildon_notify" == "xtrue"; then
       AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON_NOTIFY, 1, ["Whether hildon-notify is available"])      
@@ -278,7 +392,7 @@ fi
 #
 # check for the uri/mime stuff
 #
-if test "x$with_platform" == "xmaemo"; then  
+if test "x$with_toolkit" != "xgtk"; then  
    PKG_CHECK_MODULES(MODEST_HILDON_MIME,libhildonmime,have_hildonmime=true,have_hildonmime=false)
    if test "x$have_hildonmime" == "xfalse"; then
       PKG_CHECK_MODULES(MODEST_HILDON_MIME,libossomime,have_ossomime=true,have_ossomime=false) 
@@ -342,35 +456,24 @@ fi
 
 
 
-#
-# check the version of the widgets on maemo
-#
-if test "x$with_platform" == "xmaemo"; then  
-PKG_CHECK_MODULES(MODEST_HILDON_WIDGETS, hildon-1 >= 0.9.9 hildon-fm-2, have_hildon1=true,have_hildon1=false)  
-if test "x$have_hildon1" == "xfalse"; then 
-   PKG_CHECK_MODULES(MODEST_HILDON_WIDGETS, hildon-libs >= 0.12.0 hildon-fm, have_hildon0=true,have_hildon0=false)     
-   if test "x$have_hildon0" == "xtrue"; then
-      AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON0_WIDGETS, 1, ["Whether hildon0 widgets are used."])                      
-   else
-      AC_MSG_ERROR([hildon widgets and/or hildon-fm not found])
-   fi
-else
-      AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON1_WIDGETS, 1, ["Whether hildon1 widgets are used."])                    
-fi
-fi
-
-
 
 #
 # check the version of the addressbook on maemo
 #
 if test "x$with_platform" == "xmaemo"; then  
    PKG_CHECK_MODULES(MODEST_ABOOK,osso-addressbook-1.0,have_abook=true,have_abook=false)
+   abook_api=`$PKG_CONFIG --modversion osso-addressbook-1.0 | cut -d. -f1`
    AC_SUBST(MODEST_ABOOK_CFLAGS)
    AC_SUBST(MODEST_ABOOK_LIBS)
 
+   if test "x$have_abook" == "xfalse"; then
+     PKG_CHECK_MODULES(MODEST_ABOOK, libosso-abook-1.0,have_abook=true,have_abook=false)
+     abook_api=`$PKG_CONFIG --modversion libosso-abook-1.0 | cut -d. -f1`
+     AC_SUBST(MODEST_ABOOK_CFLAGS)
+     AC_SUBST(MODEST_ABOOK_LIBE)
+   fi
+
    if test "x$have_abook" == "xtrue"; then
-      abook_api=`$PKG_CONFIG --modversion osso-addressbook-1.0 | cut -d. -f1`
       AC_DEFINE_UNQUOTED(OSSO_ABOOK_ENABLE_DEPRECATED, 1, ["use deprecated addressbook API"])
       AC_DEFINE_UNQUOTED(MODEST_ABOOK_API, $abook_api, ["the API version of osso-addressbook"])
       AC_DEFINE_UNQUOTED(MODEST_HAVE_ABOOK, 1, ["whether we have osso-addressbook"])
@@ -385,6 +488,9 @@ fi
 AM_CONDITIONAL(MODEST_USE_DUMMY_ADDRESS_BOOK,test "x$have_abook" != "xtrue")
 
 
+AM_GLIB_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.35.0])
+
 # gettext support
 GETTEXT_PACKAGE=modest 
 AC_SUBST(GETTEXT_PACKAGE)
@@ -404,6 +510,7 @@ if test "x$with_platform" == "xmaemo"; then
    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
+   ossocudscriptsdir=/etc/osso-cud-scripts
    pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
    icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
    icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
@@ -420,6 +527,7 @@ if test "x$with_platform" == "xmaemo"; then
    AC_SUBST(desktopentrydir)
    AC_SUBST(serviceentrydir)
    AC_SUBST(backupsettingsdir)
+   AC_SUBST(ossocudscriptsdir)
    AC_SUBST(localedir)
    AC_SUBST(pixmapdir)
    AC_SUBST(icon_26x26dir)
@@ -430,20 +538,8 @@ if test "x$with_platform" == "xmaemo"; then
    AC_SUBST(pluginlibdir)
    AC_SUBST(plugindesktopentrydir)
 
-else
-   # gnome frontend 
-   PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_GNOME_DESKTOP,libtinymail-gnome-desktop-1.0 libnm_glib glib-2.0 >= 2.8 gtk+-2.0 >= 2.10 libnotify)
-   AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS)
-   AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS)  
-   AC_DEFINE_UNQUOTED(MODEST_PLATFORM_GNOME, 1, ["Whether modest is being built for the GNOME platform."])
-
-  # no dbus api for gnome
-  dbus_api=""
-  AC_SUBST(dbus_api)
-
 fi
 
-
 dnl ## setup the testing framework (ie., make check)
 build_tests=false
 AC_ARG_ENABLE(tests,
@@ -480,18 +576,17 @@ AM_CONDITIONAL(BUILD_DOCS, test x$build_docs = xtrue)
 dnl ## gtk-doc
 GTK_DOC_CHECK([1.0])
 
-dnl Intltool utility programs
-#AC_PROG_INTLTOOL([0.33.0],[no-xml])
-
 AC_OUTPUT([
 po/Makefile.in
 Makefile
 man/Makefile
 src/Makefile
+src/modest-plugin-1.0.pc
 src/dbus_api/Makefile
 src/gnome/Makefile
 src/maemo/Makefile
 src/maemo/easysetup/Makefile
+src/hildon2/Makefile
 src/widgets/Makefile
 docs/Makefile
 docs/reference/Makefile
@@ -499,6 +594,8 @@ tests/Makefile
 tests/dbus_api/Makefile
 src/maemo/modest.desktop
 src/maemo/com.nokia.modest.service
+src/hildon2/modest.desktop
+src/hildon2/com.nokia.modest.service
 libmodest-dbus-client/Makefile
 libmodest-dbus-client/libmodest-dbus-client-1.0.pc
 ])
@@ -508,6 +605,7 @@ echo
 echo "modest configure results"
 echo "-----------------------------------"
 echo "Platform         : $with_platform"
+echo "Toolkit          : $with_toolkit"
 echo "Prefix           : ${prefix}"
 echo "Build tests      : $build_tests"
 echo "Build docs       : $build_docs"