diff --git Makefile.am Makefile.am
index c584ad1..b672149 100644
--- Makefile.am
+++ Makefile.am
@@ -1,3 +1,5 @@
+ACLOCAL_AMFLAGS=-I m4
+
 SUBDIRS = \
 	eplugin \
 	tools \
diff --git acinclude.m4 acinclude.m4
deleted file mode 100644
index 339be3c..0000000
--- acinclude.m4
+++ /dev/null
@@ -1,333 +0,0 @@
-# evolution/acinclude.m4
-# shared configure.in hacks between Evolution and Connector
-
-
-# EVO_PURIFY_SUPPORT
-# Add --enable-purify. If the user turns it on, subst PURIFY and set
-# the automake conditional ENABLE_PURIFY
-AC_DEFUN([EVO_PURIFY_SUPPORT], [
-	AC_ARG_ENABLE(purify, 
-	[  --enable-purify=[no/yes]      Enable support for building executables with Purify.],,enable_purify=no)
-	AC_PATH_PROG(PURIFY, purify, impure)
-	AC_ARG_WITH(purify-options, [  --with-purify-options=OPTIONS      Options passed to the purify command line (defaults to PURIFYOPTIONS variable).])
-	if test "x$with_purify_options" = "xno"; then
-		with_purify_options="-always-use-cache-dir=yes -cache-dir=/gnome/lib/purify"
-	fi
-	if test "x$PURIFYOPTIONS" = "x"; then
-		PURIFYOPTIONS=$with_purify_options
-	fi
-	AC_SUBST(PURIFY)
-	AM_CONDITIONAL(ENABLE_PURIFY, test "x$enable_purify" = "xyes" -a "x$PURIFY" != "ximpure")
-	PURIFY="$PURIFY $PURIFYOPTIONS"
-])
-
-
-# EVO_LDAP_CHECK(default)
-# Add --with-openldap and --with-static-ldap options. --with-openldap
-# defaults to the given value if not specified. If LDAP support is
-# configured, HAVE_LDAP will be defined and the automake conditional
-# ENABLE_LDAP will be set. LDAP_CFLAGS and LDAP_LIBS will be set
-# appropriately.
-AC_DEFUN([EVO_LDAP_CHECK], [
-	default="$1"
-
-	AC_ARG_WITH(openldap,     [  --with-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution])
-	AC_ARG_WITH(static-ldap,  [  --with-static-ldap=[no/yes]          Link LDAP support statically into evolution ])
-	AC_CACHE_CHECK([for OpenLDAP], ac_cv_with_openldap, ac_cv_with_openldap="${with_openldap:=$default}")
-	case $ac_cv_with_openldap in
-	no|"")
-		with_openldap=no
-		;;
-	yes)
-		with_openldap=/usr
-		;;
-	*)
-		with_openldap=$ac_cv_with_openldap
-		LDAP_CFLAGS="-I$ac_cv_with_openldap/include"
-		LDAP_LDFLAGS="-L$ac_cv_with_openldap/lib"
-		;;
-	esac
-
-	if test "$with_openldap" != no; then
-		AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
-
-		case $with_static_ldap in
-		no|"")
-			with_static_ldap=no
-			;;
-		*)
-			with_static_ldap=yes
-			;;
-		esac
-
-		AC_CACHE_CHECK(if OpenLDAP is version 2.x, ac_cv_openldap_version2, [
-			CPPFLAGS_save="$CPPFLAGS"
-			CPPFLAGS="$CPPFLAGS $LDAP_CFLAGS"
-			AC_EGREP_CPP(yes, [
-				#include "ldap.h"
-				#if LDAP_VENDOR_VERSION > 20000
-				yes
-				#endif
-			], ac_cv_openldap_version2=yes, ac_cv_openldap_version2=no)
-			CPPFLAGS="$CPPFLAGS_save"
-		])
-		if test "$ac_cv_openldap_version2" = no; then
-			AC_MSG_ERROR(evolution requires OpenLDAP version >= 2)
-		fi
-
-		AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="-lresolv")
-		AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
-		AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
-		AC_CHECK_LIB(lber, ber_get_tag, [
-			if test "$with_static_ldap" = "yes"; then
-				LDAP_LIBS="$with_openldap/lib/liblber.a $LDAP_LIBS"
-
-				# libldap might depend on OpenSSL... We need to pull
-				# in the dependency libs explicitly here since we're
-				# not using libtool for the configure test.
-				if test -f $with_openldap/lib/libldap.la; then
-					LDAP_LIBS="`. $with_openldap/lib/libldap.la; echo $dependency_libs` $LDAP_LIBS"
-				fi
-			else
-				LDAP_LIBS="-llber $LDAP_LIBS"
-			fi
-			AC_CHECK_LIB(ldap, ldap_open, [
-					if test $with_static_ldap = "yes"; then
-						LDAP_LIBS="$with_openldap/lib/libldap.a $LDAP_LIBS"
-					else
-						LDAP_LIBS="-lldap $LDAP_LIBS"
-					fi],
-				LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS)
-			LDAP_LIBS="$LDAP_LDFLAGS $LDAP_LIBS"
-		], LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS)
-
-		if test -z "$LDAP_LIBS"; then
-			AC_MSG_ERROR(could not find OpenLDAP libraries)
-		fi
-
-		AC_SUBST(LDAP_CFLAGS)
-		AC_SUBST(LDAP_LIBS)
-	fi
-	AM_CONDITIONAL(ENABLE_LDAP, test $with_openldap != no)
-])
-
-# EVO_SUNLDAP_CHECK
-# Add --with-sunldap and --with-static-sunldap options. --with-sunldap
-# defaults to the given value if not specified. If LDAP support is
-# configured, HAVE_LDAP will be defined and the automake conditional
-# ENABLE_LDAP will be set. LDAP_CFLAGS and LDAP_LIBS will be set
-# appropriately, and --with-sunldap and --with-openldap is mutually exclusive.
-AC_DEFUN([EVO_SUNLDAP_CHECK], [
-        default="$1"
-
-        AC_ARG_WITH(sunldap,     [  --with-sunldap=[no/yes/PREFIX]      Enable SunLDAP support in evolution])
-        AC_ARG_WITH(static-sunldap,  [  --with-static-sunldap=[no/yes]          Link SunLDAP support statically into evolution ])
-        AC_CACHE_CHECK([for SunLDAP], ac_cv_with_sunldap, ac_cv_with_sunldap="${with_sunldap:=$default}")
-        case $ac_cv_with_sunldap in
-        no|"")
-                with_sunldap=no
-                ;;
-        yes)
-                with_sunldap=/usr
-                ;;
-        *)
-                with_sunldap=$ac_cv_with_sunldap
-                LDAP_CFLAGS="-I$ac_cv_with_sunldap/include"
-                LDAP_LDFLAGS="-L$ac_cv_with_sunldap/lib"
-                ;;
-        esac
-
-        if test "$with_sunldap" != no; then
-                AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
-                AC_DEFINE(SUNLDAP, 1, [Define if you use SunLDAP])
-
-                case $with_static_sunldap in
-                no|"")
-                        with_static_sunldap=no
-                        ;;
-                *)
-                        with_static_sunldap=yes
-                        ;;
-                esac
-
-                AC_CACHE_CHECK(if SunLDAP is version 2.x, ac_cv_sunldap_version2, [
-                        CPPFLAGS_save="$CPPFLAGS"
-                        CPPFLAGS="$CPPFLAGS $LDAP_CFLAGS"
-                        AC_EGREP_CPP(yes, [
-                                #include "ldap.h"
-                                #if LDAP_VENDOR_VERSION >= 500
-                                yes
-                                #endif
-                        ], ac_cv_sunldap_version2=yes, ac_cv_sunldap_version2=no)
-                        CPPFLAGS="$CPPFLAGS_save"
-                ])
-                if test "$ac_cv_sunldap_version2" = no; then
-                       AC_MSG_ERROR(evolution requires SunLDAP version >= 2)
-                fi
-
-                AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="-lresolv")
-                AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
-                AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
-                AC_CHECK_LIB(ldap, ldap_open, [
-                        if test $with_static_sunldap = "yes"; then
-                                LDAP_LIBS="$with_sunldap/lib/libldap.a $LDAP_LIBS"
-                        else
-                                LDAP_LIBS="-lldap $LDAP_LIBS"
-                        fi
-                        if test `uname -s` != "SunOS" ; then
-                                AC_CHECK_LIB(lber, ber_get_tag, [
-                                        if test "$with_static_sunldap" = "yes"; then
-                                                LDAP_LIBS="$with_sunldap/lib/liblber.a $LDAP_LIBS"
-                                                # libldap might depend on OpenSSL... We need to pull
-                                                # in the dependency libs explicitly here since we're
-                                                # not using libtool for the configure test.
-                                                if test -f $with_sunldap/lib/libldap.la; then
-							LDAP_LIBS="`. $with_sunldap/lib/libldap.la; echo $dependency_libs` $LDAP_LIBS"
-                                                fi
-                                        else
-                                                LDAP_LIBS="-llber $LDAP_LIBS"
-                                        fi], LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS)
-                        fi
-                        LDAP_LIBS="$LDAP_LDFLAGS $LDAP_LIBS"
-                ], LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS)
-
-                if test -z "$LDAP_LIBS"; then
-                       AC_MSG_ERROR(could not find SunLDAP libraries)
-                fi
-
-                AC_SUBST(LDAP_CFLAGS)
-                AC_SUBST(LDAP_LIBS)
-	fi
-	AM_CONDITIONAL(ENABLE_LDAP, test $with_sunldap != no)
-])
-
-# EVO_PTHREAD_CHECK
-AC_DEFUN([EVO_PTHREAD_CHECK],[
-	PTHREAD_LIB=""
-	AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
-		[AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
-		    [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
-			[AC_CHECK_LIB(pthread, __pthread_attr_init_system, PTHREAD_LIB="-lpthread",
-				[AC_CHECK_FUNC(pthread_create)]
-			)]
-		    )]
-		)]
-	)
-	AC_SUBST(PTHREAD_LIB)
-	AC_PROVIDE([EVO_PTHREAD_CHECK])
-])
-dnl -*- mode: autoconf -*-
-
-# serial 1
-
-dnl Usage:
-dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
-AC_DEFUN([GTK_DOC_CHECK],
-[
-  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
-  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
-  dnl for overriding the documentation installation directory
-  AC_ARG_WITH(html-dir,
-    AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
-    [with_html_dir='${datadir}/gtk-doc/html'])
-  HTML_DIR="$with_html_dir"
-  AC_SUBST(HTML_DIR)
-
-  dnl enable/disable documentation building
-  AC_ARG_ENABLE(gtk-doc,
-    AC_HELP_STRING([--enable-gtk-doc],
-                   [use gtk-doc to build documentation [default=no]]),,
-    enable_gtk_doc=no)
-
-  have_gtk_doc=no
-  if test -z "$PKG_CONFIG"; then
-    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-  fi
-  if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then
-    have_gtk_doc=yes
-  fi
-
-  dnl do we want to do a version check?
-ifelse([$1],[],,
-  [gtk_doc_min_version=$1
-  if test "$have_gtk_doc" = yes; then
-    AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
-    if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then
-      AC_MSG_RESULT(yes)
-    else
-      AC_MSG_RESULT(no)
-      have_gtk_doc=no
-    fi
-  fi
-])
-  if test x$enable_gtk_doc = xyes; then
-    if test "$have_gtk_doc" != yes; then
-      enable_gtk_doc=no
-    fi
-  fi
-
-  AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
-  AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
-])
-dnl as-compiler-flag.m4 0.1.0
-
-dnl autostars m4 macro for detection of compiler flags
-
-dnl David Schleef <ds@schleef.org>
-
-dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
-
-dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
-dnl Tries to compile with the given CFLAGS.
-dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
-dnl and ACTION-IF-NOT-ACCEPTED otherwise.
-
-AC_DEFUN([AS_COMPILER_FLAG],
-[
-  AC_MSG_CHECKING([to see if compiler understands $1])
-
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $1"
-
-  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
-  CFLAGS="$save_CFLAGS"
-
-  if test "X$flag_ok" = Xyes ; then
-    m4_ifvaln([$2],[$2])
-    true
-  else
-    m4_ifvaln([$3],[$3])
-    true
-  fi
-  AC_MSG_RESULT([$flag_ok])
-])
-
-dnl AS_COMPILER_FLAGS(VAR, FLAGS)
-dnl Tries to compile with the given CFLAGS.
-
-AC_DEFUN([AS_COMPILER_FLAGS],
-[
-  list=$2
-  flags_supported=""
-  flags_unsupported=""
-  AC_MSG_CHECKING([for supported compiler flags])
-  for each in $list
-  do
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $each"
-    AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
-    CFLAGS="$save_CFLAGS"
-
-    if test "X$flag_ok" = Xyes ; then
-      flags_supported="$flags_supported $each"
-    else
-      flags_unsupported="$flags_unsupported $each"
-    fi
-  done
-  AC_MSG_RESULT([$flags_supported])
-  if test "X$flags_unsupported" != X ; then
-    AC_MSG_WARN([unsupported compiler flags: $flags_unsupported])
-  fi
-  $1="$$1 $flags_supported"
-])
-
diff --git addressbook/Makefile.am addressbook/Makefile.am
index b1e9711..9cd2ada 100644
--- addressbook/Makefile.am
+++ addressbook/Makefile.am
@@ -1,14 +1,3 @@
-AM_CPPFLAGS = \
-	-I$(top_srcdir) \
-	-DG_LOG_DOMAIN=\"e-book-backend-exchange\" \
-	$(ADDRESSBOOK_CFLAGS) \
-	$(LIBEXCHANGE_CFLAGS) \
-	$(LDAP_CFLAGS)
-
-if HAVE_LIBDB
-AM_CPPFLAGS += $(DB_CFLAGS)
-endif
-
 # GConf schemas
 
 schemadir   = $(GCONF_SCHEMA_FILE_DIR)
@@ -39,30 +28,33 @@ endif
 
 extension_LTLIBRARIES = libebookbackendexchange.la
 
+libebookbackendexchange_la_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	$(ADDRESSBOOK_CFLAGS) \
+	$(DB_CFLAGS) \
+	$(LDAP_CFLAGS) \
+	$(LIBEXCHANGE_CFLAGS) \
+	-DG_LOG_DOMAIN=\"e-book-backend-exchange\" \
+	-I$(top_srcdir) \
+	-I$(srcdir)
+
 libebookbackendexchange_la_SOURCES = \
 	e-book-backend-exchange.c \
 	e-book-backend-exchange.h \
 	e-book-backend-exchange-factory.c \
 	e-book-backend-gal.c \
-	e-book-backend-gal.h
-
-if HAVE_LIBDB
-libebookbackendexchange_la_SOURCES += \
+	e-book-backend-gal.h \
 	e-book-backend-db-cache.c \
 	e-book-backend-db-cache.h
 
-libebookbackendexchange_la_LIBADD =  				\
-	$(top_builddir)/tools/libevolution-exchange-shared.la	\
-	$(DB_LIBS)
+libebookbackendexchange_la_LIBADD =				\
+	$(DB_LIBS)						\
+	$(top_builddir)/tools/libevolution-exchange-shared.la
 
-libebookbackendexchange_la_LDFLAGS = \
-	-module -avoid-version $(NO_UNDEFINED)
-endif
+libebookbackendexchange_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
 
-EXTRA_DIST = \
-	$(schema_in_files)
+EXTRA_DIST = $(schema_in_files)
 
-CLEANFILES =  \
-	apps_exchange_addressbook-$(BASE_VERSION).schemas
+CLEANFILES = apps_exchange_addressbook-$(BASE_VERSION).schemas
 
 -include $(top_srcdir)/git.mk
diff --git autogen.sh autogen.sh
index dbbfd8b..a4cae7d 100755
--- autogen.sh
+++ autogen.sh
@@ -5,7 +5,10 @@ srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
 PKG_NAME="evolution-exchange"
-REQUIRED_AUTOMAKE_VERSION=1.6
+REQUIRED_AUTOCONF_VERSION=2.58
+REQUIRED_AUTOMAKE_VERSION=1.9
+REQUIRED_LIBTOOL_VERSION=2.2
+REQUIRED_INTLTOOL_VERSION=0.35.5
 
 (test -f $srcdir/configure.ac \
   && test -f $srcdir/ChangeLog \
diff --git calendar/Makefile.am calendar/Makefile.am
index 2664176..9b1bc93 100644
--- calendar/Makefile.am
+++ calendar/Makefile.am
@@ -1,12 +1,12 @@
-AM_CPPFLAGS = \
-	-I$(top_srcdir) \
-	$(CALENDAR_CFLAGS) \
-	$(LIBEXCHANGE_CFLAGS) \
-	$(LDAP_CFLAGS) \
-	-DG_LOG_DOMAIN=\"e-cal-backend-exchange\"
+extension_LTLIBRARIES = libecalbackendexchange.la
 
-extension_LTLIBRARIES = \
-        libecalbackendexchange.la
+libecalbackendexchange_la_CPPFLAGS =	\
+	$(AM_CPPFLAGS)			\
+	$(CALENDAR_CFLAGS)		\
+	$(LIBEXCHANGE_CFLAGS)		\
+	$(LDAP_CFLAGS)			\
+	-I$(top_srcdir)			\
+	-DG_LOG_DOMAIN=\"e-cal-backend-exchange\"
 
 libecalbackendexchange_la_SOURCES = \
 	e-cal-backend-exchange.c \
@@ -22,13 +22,12 @@ libecalbackendexchange_la_SOURCES = \
 	e2k-cal-utils.c \
 	e2k-cal-utils.h
 
-libecalbackendexchange_la_LDFLAGS = \
-	-module -avoid-version $(NO_UNDEFINED)
+libecalbackendexchange_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
 
-libecalbackendexchange_la_LIBADD =  				\
-	$(top_builddir)/tools/libevolution-exchange-shared.la	\
-	$(CALENDAR_LIBS)					\
-	$(LIBEXCHANGE_LIBS)					\
-	$(LDAP_LIBS)
+libecalbackendexchange_la_LIBADD =	\
+	$(CALENDAR_LIBS)		\
+	$(LIBEXCHANGE_LIBS)		\
+	$(LDAP_LIBS)			\
+	$(top_builddir)/tools/libevolution-exchange-shared.la
 
 -include $(top_srcdir)/git.mk
diff --git camel/Makefile.am camel/Makefile.am
index 1b8b629..7005814 100644
--- camel/Makefile.am
+++ camel/Makefile.am
@@ -1,16 +1,15 @@
-## Process this file with automake to produce Makefile.in
-
 CAMEL_provider_LTLIBRARIES = libcamelexchange.la
 CAMEL_provider_DATA = libcamelexchange.urls
 
-AM_CPPFLAGS = \
-	$(WARN_CFLAGS) \
-	$(GLIB_CFLAGS) \
-	$(CAMEL_CFLAGS) \
-	$(SHELL_CFLAGS) \
-	$(LIBEXCHANGE_CFLAGS) \
-	-DPREFIX=\"$(prefix)\" \
-	-DCONNECTOR_LOCALEDIR=\"$(localedir)\" \
+libcamelexchange_la_CPPFLAGS = 			\
+	$(AM_CPPFLAGS)				\
+	$(GLIB_CFLAGS)				\
+	$(CAMEL_CFLAGS)				\
+	$(SHELL_CFLAGS)				\
+	$(LIBEXCHANGE_CFLAGS)			\
+	-I$(top_srcdir)/tools			\
+	-DPREFIX=\"$(prefix)\"			\
+	-DCONNECTOR_LOCALEDIR=\"$(localedir)\"	\
 	-DG_LOG_DOMAIN=\"camel-exchange-provider\"
 
 libcamelexchange_la_SOURCES = \
@@ -34,16 +33,16 @@ noinst_HEADERS = \
 	camel-exchange-utils.h \
 	mail-utils.h
 
-libcamelexchange_la_LDFLAGS = \
-	-avoid-version -module $(NO_UNDEFINED)
+libcamelexchange_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
 
 libcamelexchange_la_LIBADD =		\
-	$(top_builddir)/tools/libevolution-exchange-shared.la \
 	$(LDAP_LIBS)			\
 	$(LIBEXCHANGE_LIBS)		\
 	$(EXCHANGE_STORAGE_LIBS)	\
 	$(SOCKET_LIBS)			\
-	$(PTHREAD_LIB)
+	$(PTHREAD_LIB)			\
+	$(top_builddir)/tools/libevolution-exchange-shared.la
+
 
 EXTRA_DIST = libcamelexchange.urls
 
diff --git camel/camel-exchange-utils.c camel/camel-exchange-utils.c
index e8b5253..b351f0a 100644
--- camel/camel-exchange-utils.c
+++ camel/camel-exchange-utils.c
@@ -43,7 +43,7 @@
 #include "camel-exchange-utils.h"
 #include "mail-utils.h"
 
-#include "tools/exchange-share-config-listener.h"
+#include "exchange-share-config-listener.h"
 
 #define d(x)
 
diff --git configure.ac configure.ac
index 4872904..3acb9a6 100644
--- configure.ac
+++ configure.ac
@@ -1,76 +1,38 @@
-# Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.52)
-
+dnl Sets the evolution exchange version.
 m4_define([eex_version], [2.29.1])
 
-AC_INIT(evolution-exchange, [eex_version], http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution%20Exchange)
+dnl Initializes automake/autoconf
+AC_PREREQ(2.58)
+AC_INIT([evolution-exchange],[eex_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution%20Exchange])
+AM_INIT_AUTOMAKE([gnu 1.9])
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR(camel)
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AC_CONFIG_HEADERS(config.h)
+
+dnl Automake 1.11 - Silent Build Rules
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-# Required Package Versions
+dnl Required Package Versions
 m4_define([glib_minimum_version], [2.16.0])
 m4_define([gtk_minimum_version], [2.10.0])
 m4_define([eds_minimum_version], [eex_version])
 m4_define([evo_minimum_version], [eex_version])
-m4_define([gconf_minimum_version], [2.0.0])             # XXX Just a Guess
-m4_define([libxml_minimum_version], [2.0.0])            # XXX Just a Guess
+m4_define([gconf_minimum_version], [2.0.0])		dnl XXX Just a Guess
+m4_define([libxml_minimum_version], [2.0.0])		dnl XXX Just a Guess
 m4_define([libsoup_minimum_version], [2.3.0])
 
-AM_CONFIG_HEADER(config.h)
-
-# Automake 1.11 - Silent Build Rules
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-AC_ARG_WITH(e2k-debug,     [  --with-e2k-debug              Allow debugging])
-case $withval in
-no)
-	;;
-*)
-	AC_DEFINE(E2K_DEBUG, 1, [Define if you want E2K_DEBUG to be available])
-	;;
-esac
-
+dnl ********************************************************************************
+dnl Evolution\Evolution-data-server versioning
 dnl Update these for every new development release of evolution. These numbers
 dnl actually correspond to the next stable release number
+dnl ********************************************************************************
 EVOLUTION_API_VERSION=2.30
 EDS_API_VERSION=1.2
 EDS_BASE_VERSION=2.30
 
-AC_MSG_CHECKING(Evolution version)
-EVOLUTION_VERSION=`pkg-config --modversion evolution-shell 2>/dev/null`
-if test -z "$EVOLUTION_VERSION"; then
-	AC_MSG_ERROR(Evolution development libraries not installed)
-fi
-AC_SUBST(EVOLUTION_VERSION)
-AC_MSG_RESULT($EVOLUTION_VERSION)
-
-EVOLUTION_BASE_VERSION=$EVOLUTION_API_VERSION
-AC_DEFINE_UNQUOTED(EVOLUTION_BASE_VERSION,"$EVOLUTION_BASE_VERSION",Evolution version)
-
-BASE_VERSION=$EVOLUTION_API_VERSION
-AC_DEFINE_UNQUOTED(BASE_VERSION, "$BASE_VERSION", Connector base version)
-AC_SUBST(BASE_VERSION)
-
-API_VERSION=$EDS_API_VERSION
-AC_DEFINE_UNQUOTED(API_VERSION, "$API_VERSION", Eds api version)
-AC_SUBST(API_VERSION)
-AC_SUBST(EDS_BASE_VERSION)
-
-dnl Initialize maintainer mode
-AM_MAINTAINER_MODE
-
-AC_ISC_POSIX
-AC_PROG_CC
-AC_STDC_HEADERS
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-
-dnl Initialize libtool
-AM_PROG_LIBTOOL
-
-# Compiler Warning Flags
-
+dnl ******************************
+dnl Compiler Warning Flags
+dnl ******************************
 AS_COMPILER_FLAGS(WARNING_FLAGS,
 	"-DG_DISABLE_DEPRECATED
 	-DPANGO_DISABLE_DEPRECATED
@@ -91,129 +53,197 @@ AS_COMPILER_FLAGS(WARNING_FLAGS,
 	-Wredundant-decls -Wundef -Wwrite-strings")
 AC_SUBST(WARNING_FLAGS)
 
-# Other useful compiler warnings for test builds only.
-# These may produce warnings we have no control over.
-#
-#	-Wmissing-format-attribute
-#	-Wshadow
-
-CFLAGS="$CFLAGS $WARNING_FLAGS"
+dnl Other useful compiler warnings for test builds only.
+dnl These may produce warnings we have no control over.
+dnl
+dnl	-Wmissing-format-attribute
+dnl	-Wshadow
 
-dnl ****
-dnl i18n
-dnl ****
+dnl AC_DEFINE(G_DISABLE_DEPRECATED,1,[No deprecated glib functions])
+dnl AC_DEFINE(GDK_DISABLE_DEPRECATED,1,[No deprecated gdk functions])
+dnl AC_DEFINE(GTK_DISABLE_DEPRECATED,1,[No deprecated gtk functions])
+dnl AC_DEFINE(GNOME_DISABLE_DEPRECATED,1,[No deprecated gnome functions])
+dnl AC_DEFINE(BONOBO_DISABLE_DEPRECATED,1,[No deprecated bonobo functions])
+dnl AC_DEFINE(BONOBO_UI_DISABLE_DEPRECATED,1,[No deprecated bonoboui functions])
+dnl AC_DEFINE(GCONF_DISABLE_DEPRECATED,1,[No deprecated gconf functions])
+dnl AC_DEFINE(LIBGLADE_DISABLE_DEPRECATED,1,[No deprecated libglade functions])
 
-IT_PROG_INTLTOOL([0.35.5])
-AM_GLIB_GNU_GETTEXT
+dnl **************************
+dnl Set AM_CPPFLAGS
+dnl **************************
+AM_CPPFLAGS="$WARNING_FLAGS"
+AC_SUBST(WARNING_FLAGS)
 
-GETTEXT_PACKAGE=evolution-exchange-${BASE_VERSION}
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
+dnl ******************************
+dnl Initialize maintainer mode
+dnl ******************************
+AM_MAINTAINER_MODE
 
-localedir='$(prefix)/$(DATADIRNAME)/locale'
-AC_SUBST(localedir)
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
 
 dnl ******************************
 dnl Check for Win32
 dnl ******************************
-
 AC_MSG_CHECKING([for Win32])
 case "$host" in
 *-mingw*)
-    os_win32=yes
-    NO_UNDEFINED='-no-undefined'
-    SOCKET_LIBS='-lws2_32'
-    ;;
-*)  os_win32=no
-    NO_UNDEFINED=''
-    SOCKET_LIBS=''
-    ;;
+	os_win32='yes'
+	NO_UNDEFINED='-no-undefined'
+	SOCKET_LIBS='-lws2_32'
+	;;
+*)
+	os_win32='no'
+	NO_UNDEFINED=''
+	SOCKET_LIBS=''
+	;;
 esac
 AC_MSG_RESULT([$os_win32])
-AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
+AM_CONDITIONAL(OS_WIN32, [test "x$os_win32" = "yes"])
 AC_SUBST(NO_UNDEFINED)
 AC_SUBST(SOCKET_LIBS)
 
-# Check for base dependencies early.
+dnl ******************************
+dnl Initialize libtool
+dnl ******************************
+LT_PREREQ(2.2)
+LT_INIT(disable-static win32-dll)
+
+PKG_PROG_PKG_CONFIG
+
+dnl *****************
+dnl Initialize i18n
+dnl *****************
+
+IT_PROG_INTLTOOL([0.35.5])
+AM_GLIB_GNU_GETTEXT
+
+GETTEXT_PACKAGE=evolution-exchange-${BASE_VERSION}
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
+
+localedir='$(prefix)/$(DATADIRNAME)/locale'
+AC_SUBST(localedir)
+
+dnl ***********************************
+dnl Check for base dependencies early.
+dnl ***********************************
 PKG_CHECK_MODULES(GNOME_PLATFORM,
 	[glib-2.0 >= glib_minimum_version
-	 gtk+-2.0 >= gtk_minimum_version
-	 gconf-2.0 >= gconf_minimum_version
-	 libxml-2.0 >= libxml_minimum_version
-	 libsoup-2.4 >= libsoup_minimum_version])
+	gtk+-2.0 >= gtk_minimum_version
+	gconf-2.0 >= gconf_minimum_version
+	libxml-2.0 >= libxml_minimum_version
+	libsoup-2.4 >= libsoup_minimum_version])
 
 PKG_CHECK_MODULES(EVOLUTION_DATA_SERVER,
 	[libebook-$EDS_API_VERSION >= eds_minimum_version
-	 libecal-$EDS_API_VERSION >= eds_minimum_version
-	 libedataserver-$EDS_API_VERSION >= eds_minimum_version
-	 libedataserverui-$EDS_API_VERSION >= eds_minimum_version
-	 libegroupwise-$EDS_API_VERSION >= eds_minimum_version
-	 libebackend-$EDS_API_VERSION >= eds_minimum_version
-	 libexchange-storage-$EDS_API_VERSION >= eds_minimum_version])
-
-dnl *************************
-dnl CFLAGS and LIBS and stuff
-dnl *************************
-
-GNOME_COMPILE_WARNINGS(maximum)
-CFLAGS="$CFLAGS $WARN_CFLAGS"
-case $CFLAGS in
-*-Wall*)
-	CFLAGS="$CFLAGS -Wno-sign-compare"
-	;;
-esac
-dnl AC_DEFINE(G_DISABLE_DEPRECATED,1,[No deprecated glib functions])
-dnl AC_DEFINE(GDK_DISABLE_DEPRECATED,1,[No deprecated gdk functions])
-dnl AC_DEFINE(GTK_DISABLE_DEPRECATED,1,[No deprecated gtk functions])
-dnl AC_DEFINE(GNOME_DISABLE_DEPRECATED,1,[No deprecated gnome functions])
-dnl AC_DEFINE(GCONF_DISABLE_DEPRECATED,1,[No deprecated gconf functions])
-
-AC_EGREP_HEADER(socklen_t, sys/socket.h, :, AC_DEFINE(socklen_t, int, [Define to "int" if socklen_t is not defined]))
+	libecal-$EDS_API_VERSION >= eds_minimum_version
+	libedataserver-$EDS_API_VERSION >= eds_minimum_version
+	libedataserverui-$EDS_API_VERSION >= eds_minimum_version
+	libegroupwise-$EDS_API_VERSION >= eds_minimum_version
+	libebackend-$EDS_API_VERSION >= eds_minimum_version
+	libexchange-storage-$EDS_API_VERSION >= eds_minimum_version])
+
+dnl ***************************
+dnl Check for socklen_t type
+dnl ***************************
+AC_EGREP_HEADER([socklen_t],[sys/socket.h][:],AC_DEFINE([socklen_t],[int],[Define to "int" if socklen_t is not defined]))
 
+dnl ******************************
+dnl GObject marshalling
+dnl ******************************
 AM_PATH_GLIB_2_0
-AM_PATH_ORBIT2
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+
+dnl ******************************
+dnl GConf stuff
+dnl ******************************
+AC_PATH_PROG([GCONFTOOL],[gconftool-2],[no])
 AM_GCONF_SOURCE_2
 
+dnl ******************************
+dnl Gtk Doc stuff
+dnl ******************************
+GTK_DOC_CHECK(1.9)
+
+dnl ******************************
+dnl Exchange debug
+dnl ******************************
+AC_ARG_ENABLE([e2k-debug],
+	AS_HELP_STRING([--enable-e2kdebug],
+	[Allow debugging]),
+	[enable_e2kdebug=$enableval],[enable_e2kdebug="no"])
+
+if test "x$enable_e2kdebug" = "xyes"; then
+	AC_DEFINE([E2K_DEBUG],[1],[Define if you want E2K_DEBUG to be available])
+fi
+
+dnl ***************************
+dnl Set the connector datadir
+dnl ***************************
 CONNECTOR_DATADIR='$(datadir)/evolution-exchange/$(BASE_VERSION)'
 AC_SUBST(CONNECTOR_DATADIR)
 
-dnl Check that e-d-s was built with Exchange support.
-EXCHANGE_PACKAGE="`pkg-config --exists libexchange-storage-$EDS_API_VERSION`"
+dnl ***************************************
+dnl Check for evo/eds and version setting
+dnl ***************************************
+AC_MSG_CHECKING(Evolution version)
+EVOLUTION_VERSION=`pkg-config --modversion evolution-shell 2>/dev/null`
+if test -z "$EVOLUTION_VERSION"; then
+	AC_MSG_ERROR(Evolution development libraries not installed)
+fi
+AC_SUBST(EVOLUTION_VERSION)
+AC_MSG_RESULT($EVOLUTION_VERSION)
+
+EVOLUTION_BASE_VERSION=$EVOLUTION_API_VERSION
+AC_DEFINE_UNQUOTED(EVOLUTION_BASE_VERSION,"$EVOLUTION_BASE_VERSION",Evolution version)
+
+BASE_VERSION=$EVOLUTION_API_VERSION
+AC_DEFINE_UNQUOTED(BASE_VERSION, "$BASE_VERSION", Connector base version)
+AC_SUBST(BASE_VERSION)
+
+API_VERSION=$EDS_API_VERSION
+AC_DEFINE_UNQUOTED(API_VERSION, "$API_VERSION", Eds api version)
+AC_SUBST(API_VERSION)
+AC_SUBST(EDS_BASE_VERSION)
+
+dnl **************************************************
+dnl Check that eds was built with Exchange support.
+dnl **************************************************
+EXCHANGE_PACKAGE="`$PKG_CONFIG --exists libexchange-storage-$EDS_API_VERSION`"
 if test "x$EXCHANGE_PACKAGE" != "x"; then
-	echo "
-		You probably have not built evolution-data-server with 
-		Exchange support or fix your PKG_CONFIG_PATH to point 
-		it to the proper location.
-		"
-	exit 1
+	AC_MSG_FAILURE([You probably have not built evolution-data-server with Exchange support or fix your PKG_CONFIG_PATH to point it to the proper location.])
 fi
 
-plugindir=`$PKG_CONFIG --variable=plugindir evolution-plugin`
+plugindir="`$PKG_CONFIG --variable=plugindir evolution-plugin`"
 AC_SUBST(plugindir)
 
-EVOLUTION_PLUGIN_errordir="`pkg-config --variable=errordir evolution-plugin`"
+EVOLUTION_PLUGIN_errordir="`$PKG_CONFIG --variable=errordir evolution-plugin`"
 AC_SUBST(EVOLUTION_PLUGIN_errordir)
 
-extensiondir="`pkg-config --variable=extensiondir evolution-data-server-$EDS_API_VERSION`"
+extensiondir="`$PKG_CONFIG --variable=extensiondir evolution-data-server-$EDS_API_VERSION`"
 AC_SUBST(extensiondir)
 
-EVOLUTION_idldir="`pkg-config --variable=idldir evolution-shell`"
-AC_SUBST(EVOLUTION_idldir)
+dnl ******************************
+dnl Special directories
+dnl ******************************
 
-EVOLUTION_IDL_INCLUDES="`pkg-config --variable=IDL_INCLUDES evolution-shell`"
-AC_SUBST(EVOLUTION_IDL_INCLUDES)
+dnl If you add something here, consider whether or not you also
+dnl need to add it to one or more .pc.in files (for Connector,
+dnl etc)
 
-EVOLUTION_privlibdir="`pkg-config --variable=privlibdir evolution-shell`"
+EVOLUTION_privlibdir="`$PKG_CONFIG --variable=privlibdir evolution-shell`"
 AC_SUBST(EVOLUTION_privlibdir)
 
-EVOLUTION_privlibexecdir="`pkg-config --variable=privlibexecdir evolution-shell`"
+EVOLUTION_privlibexecdir="`$PKG_CONFIG --variable=privlibexecdir evolution-shell`"
 AC_SUBST(EVOLUTION_privlibexecdir)
 
-EVOLUTION_imagesdir="`pkg-config --variable=imagesdir evolution-shell`"
+EVOLUTION_imagesdir="`$PKG_CONFIG --variable=imagesdir evolution-shell`"
 AC_SUBST(EVOLUTION_imagesdir)
 
-CAMEL_providerdir="`pkg-config --variable=camel_providerdir camel-provider-$EDS_API_VERSION`"
+CAMEL_providerdir="`$PKG_CONFIG --variable=camel_providerdir camel-provider-$EDS_API_VERSION`"
 AC_SUBST(CAMEL_providerdir)
 
 
@@ -248,11 +278,11 @@ AC_SUBST(EVOLUTION_PLUGIN_LIBS)
 dnl *********************
 dnl Pilot license support
 dnl *********************
-# This does not take leap years into account, but that's not
-# important: having the build time be slightly too early is good
-# to support slight clock skew anyway.
-# 946684800 is 2000-01-01T00:00:00Z.
-# Don't change this without testing under /bin/sh on Solaris.
+dnl This does not take leap years into account, but that's not
+dnl important: having the build time be slightly too early is good
+dnl to support slight clock skew anyway.
+dnl 946684800 is 2000-01-01T00:00:00Z.
+dnl Don't change this without testing under /bin/sh on Solaris.
 abt=`eval expr \`date '+\( \( %y \* 365 \) + %j - 1 \) \* 24 \* 60 \* 60 + 946684800'\``
 case $abt in
 "")
@@ -261,10 +291,9 @@ case $abt in
 	abt="0"
 	;;
 esac
-AC_DEFINE_UNQUOTED(E2K_APPROX_BUILD_TIME, $abt, [Used to prevent clock-setting attacks against pilot licenses])
+AC_DEFINE_UNQUOTED([E2K_APPROX_BUILD_TIME],[$abt],[Used to prevent clock-setting attacks against pilot licenses])
 
-
-AC_DEFINE(HANDLE_LIBICAL_MEMORY, 1, [Define it once memory returned by libical is free'ed properly])
+AC_DEFINE([HANDLE_LIBICAL_MEMORY],[1],[Define it once memory returned by libical is free'ed properly])
 
 dnl *************
 dnl pthread check
@@ -274,111 +303,88 @@ EVO_PTHREAD_CHECK
 dnl *********************
 dnl OpenLDAP NTLM support
 dnl *********************
-if test "$os_win32" != yes; then
-EVO_SUNLDAP_CHECK(no)
-case $with_sunldap in
-no)
-	EVO_LDAP_CHECK(yes)
-	case $with_openldap in
-	no)
-		AC_ERROR(LDAP support is required for Connector)
-	;;
-	esac
-	;;
-esac
+if test "x$os_win32" != "xyes"; then
+	EVO_SUNLDAP_CHECK(no)
+	if test "x$with_sunldap" = "xno"; then
+		EVO_LDAP_CHECK(yes)
+		if test "x$with_openldap" = "xno"; then
+			AC_MSG_ERROR([LDAP support is required for Connector])
+		fi
+	fi
+
+	SAVE_CFLAGS="$CFLAGS"
+	SAVE_LIBS="$LIBS"
+	LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
+	CFLAGS="$CFLAGS $LDAP_CFLAGS"
+	LIBS="$LIBS $LDAP_LIBS"
+	AC_CHECK_FUNCS([ldap_ntlm_bind])
+	CFLAGS="$SAVE_CFLAGS"
+	LIBS="$SAVE_LIBS"
+dnl Win32 support
+else
+	LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
+	LDAP_LIBS="-lwldap32"
+	AC_SUBST(LDAP_CFLAGS)
+	AC_SUBST(LDAP_LIBS)
+	AC_DEFINE([HAVE_LDAP],[1],[Define if you have LDAP support])
+	AM_CONDITIONAL(ENABLE_LDAP,true)
+fi
 
-SAVE_CFLAGS="$CFLAGS"
-SAVE_LIBS="$LIBS"
-LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
-CFLAGS="$CFLAGS $LDAP_CFLAGS"
-LIBS="$LIBS $LDAP_LIBS"
-AC_CHECK_FUNCS(ldap_ntlm_bind)
-CFLAGS="$SAVE_CFLAGS"
-LIBS="$SAVE_LIBS"
-else # Win32
-LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
-LDAP_LIBS="-lwldap32"
-AC_SUBST(LDAP_CFLAGS)
-AC_SUBST(LDAP_LIBS)
-AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
-AM_CONDITIONAL(ENABLE_LDAP, true)
-fi # Win32
-
-AM_CONDITIONAL(SUNLDAP, test "$with_sunldap" != no)
-
-AC_MSG_CHECKING(for LDAP Paged Control)
-AC_TRY_RUN([
-#include <ldap.h>
-#include <stdlib.h>
-
-int main(int argc, char **argv)
-{
-#ifdef LDAP_CONTROL_PAGEDRESULTS	
-		exit(0);
-#else		
-		exit(1);
-#endif		
-}],[
-AC_DEFINE(HAVE_LDAP_PAGED, 1, [Supports Paged results])
-ac_cv_ldappaged=yes
-],ac_cv_ldappaged="no (GAL Caching disabled)",ac_cv_ldappaged="no (GAL Caching disabled)",[
-AC_DEFINE(HAVE_LDAP_PAGED, 1, [Supports Paged results])
-ac_cv_ldappaged=yes
-])
-AC_MSG_RESULT($ac_cv_ldappaged)
+AM_CONDITIONAL(SUNLDAP, test "x$with_sunldap" != "xno")
+
+AC_CACHE_CHECK([for LDAP Paged Control], [ac_cv_ldappaged],
+	AC_RUN_IFELSE([AC_LANG_PROGRAM(
+	[[	#include <ldap.h>
+		#include <stdlib.h>
+	]],
+	[[	int main(int argc, char **argv) {
+		#ifdef LDAP_CONTROL_PAGEDRESULTS
+			exit(0);
+		#else
+			exit(1);
+		#endif
+		}
+	]],
+	)], [ac_cv_ldappaged="yes"], [ac_cv_ldappaged="no"],[ac_cv_ldappaged="yes"]))
+
+if test "x$ac_cv_ldappaged" = "xyes"; then
+	AC_DEFINE([HAVE_LDAP_PAGED], 1, [Supports Paged results])
+fi
 
-dnl *******
-dnl gtk-doc
-dnl *******
-dnl Putting a space before the macro call here makes gnome-autogen not
-dnl notice it, which makes it not run gtkdocize and copy gtk-doc.make
-dnl into the top level where I don't want it.
- GTK_DOC_CHECK([1.0])
+dnl ****************
+dnl libdb checking
+dnl ****************
+AC_ARG_WITH([libdb],
+	AS_HELP_STRING([--with-libdb=PREFIX],
+	[Prefix where libdb is installed]),
+	[libdb_prefix="$withval"], [libdb_prefix='${prefix}'])
 
-dnl **************************************************
-dnl * libdb checking - taken from EDS
-dnl **************************************************
+DB_CFLAGS="-I$libdb_prefix/include"
+DB_LIBS="-L$libdb_prefix/lib -ldb"
 
-AC_ARG_WITH(libdb, AC_HELP_STRING([--with-libdb],[Prefix where libdb is installed]), dynamic_libdb=yes, dynamic_libdb=no)
-if test "x${dynamic_libdb}" = "xyes"; then
-        DB_CFLAGS="-I$withval/include"
-        DB_LIBS="-L$withval/lib -ldb"
-else
-	DB_CFLAGS="$CFLAGS -I /usr/include"
-	DB_LIBS="$LIBS -ldb"
-fi
-	
 AC_MSG_CHECKING([Berkeley DB])
-save_cflags=$CFLAGS; CFLAGS=$DB_CFLAGS
-save_libs=$LIBS; LIBS="$DB_LIBS"
-AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([[#include <db.h>]],
-                         [db_create(NULL, NULL, 0)])],
-        check_db=yes,
-        check_db=no)
-AC_MSG_RESULT($check_db)
-AM_CONDITIONAL(HAVE_LIBDB, [test $check_db = yes])
-
-if test "$check_db" = "yes"; then
-  AC_DEFINE(ENABLE_CACHE, 1,
-	    [Enabling GAL Caching])
-else
-  AC_DEFINE(ENABLE_CACHE, 0,
-	    [Disabling GAL Caching])
-  DB_CFLAGS=""
-  DB_LIBS=""
-fi
+save_cflags=$CFLAGS
+save_libs=$LIBS
+CFLAGS=$DB_CFLAGS
+LIBS="$DB_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
+	[[#include <db.h>]],
+	[[db_create(NULL, NULL, 0)]])],
+	[check_db=yes],
+	[check_db=no])
+
+AC_MSG_RESULT([$check_db])
+AM_CONDITIONAL(HAVE_LIBDB, [test "x$check_db" = "xyes"])
+
 CFLAGS=$save_cflags
 LIBS=$save_libs
 AC_SUBST(DB_CFLAGS)
 AC_SUBST(DB_LIBS)
 
-
 dnl ******************************
 dnl Makefiles
 dnl ******************************
-
-AC_OUTPUT([
+AC_CONFIG_FILES([
 Makefile
 evolution-exchange-zip
 eplugin/Makefile
@@ -390,15 +396,13 @@ docs/Makefile
 docs/reference/Makefile
 po/Makefile.in
 ])
+AC_OUTPUT
 
-case $ac_cv_func_ldap_ntlm_bind in
-no)
-	echo ""
+if test "x$ac_cv_func_ldap_ntlm_bind" = "no"; then
 	AC_MSG_WARN([
 No NTLM support in OpenLDAP; Plaintext password authentication will be
 used when connecting to the Global Catalog server. Consider installing
 the evo-openldap package, or building OpenLDAP with the patch in
 docs/openldap-ntlm.diff
 ])
-	;;
-esac
+fi
diff --git docs/reference/Makefile.am docs/reference/Makefile.am
index f694c02..59a576e 100644
--- docs/reference/Makefile.am
+++ docs/reference/Makefile.am
@@ -1,14 +1,9 @@
-## Process this file with automake to produce Makefile.in
-
 # The name of the module.
 DOC_MODULE=evolution-exchange
 
 # The top-level SGML file.
 DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
 
-# Extra options to supply to gtkdoc-scan
-SCAN_OPTIONS=
-
 # Files/directories to ignore when scanning.
 IGNORE_HFILES= \
 	config.h \
@@ -30,38 +25,25 @@ IGNORE_HFILES= \
 # The directory containing the source code. Relative to $(srcdir)
 DOC_SOURCE_DIR=../../
 
+# Used for dependencies. The docs will be rebuilt if any of these change.
 HFILE_GLOB=$(top_srcdir)/*/*.h
 CFILE_GLOB=$(top_srcdir)/*/*.c
 
-# CFLAGS and LDFLAGS for compiling scan program. Only needed
-# if $(DOC_MODULE).types is non-empty.
-INCLUDES = \
+# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
+# Only needed if you are using gtkdoc-scangobj to dynamically query widget
+# signals and properties.
+GTKDOC_CFLAGS= \
 	-I$(top_srcdir)/lib \
 	-I$(top_builddir)/lib \
-	$(LIBEXCHANGE_CFLAGS) \
-	$(LDAP_CFLAGS)
-
-GTKDOC_LIBS = \
-	$(LIBEXCHANGE_LIBS) \
-	$(LDAP_LIBS)
-
-# Extra options to supply to gtkdoc-mkdb
-MKDB_OPTIONS=--ignore-files="$(IGNORE_HFILES)"
-
-# Images to copy into HTML directory
-HTML_IMAGES =
-
-# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
-content_files =
-
-# Extra options to supply to gtkdoc-fixref
-FIXXREF_OPTIONS=
+	$(LDAP_CFLAGS) \
+	$(LIBEXCHANGE_CFLAGS)
 
-include gtk-doc.make
+GTKDOC_LIBS= \
+	$(LDAP_LIBS) \
+	$(LIBEXCHANGE_LIBS)
 
-# Other files to distribute
-EXTRA_DIST += \
-	gtk-doc.make
+# This includes the standard gtk-doc make rules, copied by gtkdocize.
+include $(top_srcdir)/gtk-doc.make
 
 dist-hook-local:
 	mkdir $(distdir)/features
diff --git docs/reference/gtk-doc.make docs/reference/gtk-doc.make
deleted file mode 100644
index d307623..0000000
--- docs/reference/gtk-doc.make
+++ /dev/null
@@ -1,149 +0,0 @@
-# -*- mode: makefile -*-
-
-####################################
-# Everything below here is generic #
-####################################
-
-if GTK_DOC_USE_LIBTOOL
-GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
-else
-GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
-endif
-
-# We set GPATH here; this gives us semantics for GNU make
-# which are more like other make's VPATH, when it comes to
-# whether a source that is a target of one rule is then
-# searched for in VPATH/GPATH.
-#
-GPATH = $(srcdir)
-
-TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
-
-EXTRA_DIST = 				\
-	$(content_files)		\
-	$(HTML_IMAGES)			\
-	$(DOC_MAIN_SGML_FILE)		\
-	$(DOC_MODULE).types		\
-	$(DOC_MODULE)-sections.txt	\
-	$(DOC_MODULE)-overrides.txt
-
-DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
-	   $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
-
-SCANOBJ_FILES = 		 \
-	$(DOC_MODULE).args 	 \
-	$(DOC_MODULE).hierarchy  \
-	$(DOC_MODULE).interfaces \
-	$(DOC_MODULE).prerequisites \
-	$(DOC_MODULE).signals
-
-CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS)
-
-if ENABLE_GTK_DOC
-all-local: html-build.stamp
-
-#### scan ####
-
-scan-build.stamp: $(HFILE_GLOB)
-	@echo '*** Scanning header files ***'
-	@-chmod -R u+w $(srcdir)
-	if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
-	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
-	else \
-	    cd $(srcdir) ; \
-	    for i in $(SCANOBJ_FILES) ; do \
-               test -f $$i || touch $$i ; \
-	    done \
-	fi
-	cd $(srcdir) && \
-	  gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
-	touch scan-build.stamp
-
-$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
-	@true
-
-#### templates ####
-
-tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
-	@echo '*** Rebuilding template files ***'
-	@-chmod -R u+w $(srcdir)
-	cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
-	touch tmpl-build.stamp
-
-tmpl.stamp: tmpl-build.stamp
-	@true
-
-#### xml ####
-
-sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
-	@echo '*** Building XML ***'
-	@-chmod -R u+w $(srcdir)
-	cd $(srcdir) && \
-	gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml $(MKDB_OPTIONS)
-	touch sgml-build.stamp
-
-sgml.stamp: sgml-build.stamp
-	@true
-
-#### html ####
-
-html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
-	@echo '*** Building HTML ***'
-	@-chmod -R u+w $(srcdir)
-	rm -rf $(srcdir)/html 
-	mkdir $(srcdir)/html
-	cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
-	test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
-	@echo '-- Fixing Crossreferences' 
-	cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
-	touch html-build.stamp
-endif
-
-##############
-
-clean-local:
-	rm -f *~ *.bak
-	rm -rf .libs
-
-maintainer-clean-local: clean
-	cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
-
-install-data-local:
-	(installfiles=`echo $(srcdir)/html/*`; \
-	if test "$$installfiles" = '$(srcdir)/html/*'; \
-	then echo '-- Nothing to install' ; \
-	else \
-	  $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
-	  for i in $$installfiles; do \
-	    echo '-- Installing '$$i ; \
-	    $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
-	  done; \
-	  echo '-- Installing $(srcdir)/html/index.sgml' ; \
-	  $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \
-	fi)
-
-uninstall-local:
-	rm -f $(DESTDIR)$(TARGET_DIR)/*
-
-#
-# Require gtk-doc when making dist
-#
-if ENABLE_GTK_DOC
-dist-check-gtkdoc:
-else
-dist-check-gtkdoc:
-	@echo "*** gtk-doc must be installed and enabled in order to make dist"
-	@false
-endif
-
-dist-hook: dist-check-gtkdoc dist-hook-local
-	mkdir $(distdir)/tmpl
-	mkdir $(distdir)/xml
-	mkdir $(distdir)/html
-	-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
-	-cp $(srcdir)/xml/*.xml $(distdir)/xml
-	-cp $(srcdir)/html/* $(distdir)/html
-
-.PHONY : dist-hook-local
diff --git docs/reference/tmpl/e2k-user-dialog.sgml docs/reference/tmpl/e2k-user-dialog.sgml
index 9358f1f..7f6be37 100644
--- docs/reference/tmpl/e2k-user-dialog.sgml
+++ docs/reference/tmpl/e2k-user-dialog.sgml
@@ -18,3 +18,29 @@ addressbook's "selectnames" interface.
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### STRUCT E2kUserDialog ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### FUNCTION e2k_user_dialog_new ##### -->
+<para>
+
+</para>
+
+@parent_window:
+@label_text:
+@section_name:
+@Returns:
+
+
+<!-- ##### FUNCTION e2k_user_dialog_get_user ##### -->
+<para>
+
+</para>
+
+@dialog:
+@Returns:
diff --git eplugin/Makefile.am eplugin/Makefile.am
index 116b449..fa641c3 100644
--- eplugin/Makefile.am
+++ eplugin/Makefile.am
@@ -49,11 +49,11 @@ liborg_gnome_exchange_operations_la_SOURCES = 		\
 
 liborg_gnome_exchange_operations_la_CPPFLAGS =	\
 	$(AM_CPPFLAGS)				\
-	-I .					\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)		\
 	$(EVOLUTION_PLUGIN_CFLAGS)		\
 	$(CAMEL_EXCHANGE_CFLAGS)		\
-	$(EVOLUTION_MAIL_CFLAGS)
+	$(EVOLUTION_MAIL_CFLAGS)		\
+	-I$(top_srcdir)
 
 liborg_gnome_exchange_operations_la_LIBADD =	\
 	$(EVOLUTION_DATA_SERVER_LIBS)		\
diff --git eplugin/org-gnome-exchange-operations.eplug eplugin/org-gnome-exchange-operations.eplug
index a1a9485..28d2122 100644
--- eplugin/org-gnome-exchange-operations.eplug
+++ eplugin/org-gnome-exchange-operations.eplug
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <e-plugin-list>
-  <e-plugin type="shlib" system_plugin="true" location="/build/local/lib/evolution/2.30/plugins/liborg-gnome-exchange-operations" load-on-startup="true" id="org.gnome.evolution.plugin.exchange-operations" name="Exchange Operations">
+  <e-plugin type="shlib" system_plugin="true" location="/usr/local/lib/evolution/2.30/plugins/liborg-gnome-exchange-operations" load-on-startup="true" id="org.gnome.evolution.plugin.exchange-operations" name="Exchange Operations">
     <author name="Sushma Rai" email="rsushma@novell.com"/>
     <author name="Praveen Kumar" email="kpraveen@novell.com"/>
     <author name="Shakti Sen" email="shprasad@novell.com"/>
diff --git po/POTFILES.in po/POTFILES.in
index d9a9de1..19add15 100644
--- po/POTFILES.in
+++ po/POTFILES.in
@@ -12,6 +12,23 @@ camel/camel-exchange-store.c
 camel/camel-exchange-transport.c
 camel/camel-exchange-utils.c
 camel/mail-utils.c
+eplugin/exchange-account-setup.c
+eplugin/exchange-calendar.c
+eplugin/exchange-change-password.c
+eplugin/exchange-config-listener.c
+eplugin/exchange-contacts.c
+eplugin/exchange-delegates-user.c
+eplugin/exchange-delegates.c
+eplugin/exchange-folder-permission.c
+eplugin/exchange-folder-size-display.c
+eplugin/exchange-folder-subscription.c
+eplugin/exchange-folder.c
+eplugin/exchange-operations.c
+eplugin/exchange-permissions-dialog.c
+eplugin/exchange-send-options.c
+eplugin/exchange-user-dialog.c
+eplugin/org-gnome-exchange-operations.eplug.xml
+eplugin/org-gnome-exchange-operations.error.xml
 tools/exchange-autoconfig-wizard.c
 tools/exchange-share-config-listener.c
 tools/ximian-connector-setup.c
diff --git tools/Makefile.am tools/Makefile.am
index 37fe910..51c7eeb 100644
--- tools/Makefile.am
+++ tools/Makefile.am
@@ -1,41 +1,57 @@
-AM_CPPFLAGS = \
-	-I$(top_srcdir) \
-	-I$(top_srcdir)/camel \
-	-DG_LOG_DOMAIN=\"evolution-exchange-storage\" \
-	$(LIBEXCHANGE_CFLAGS) \
-	$(EXCHANGE_STORAGE_CFLAGS) \
-	$(LDAP_CFLAGS) \
-	-DPREFIX=\"$(prefix)\" \
-	-DSYSCONFDIR=\""$(sysconfdir)"\" \
-	-DDATADIR=\""$(datadir)"\" \
-	-DLIBDIR=\""$(datadir)"\" \
-	-DCONNECTOR_IMAGESDIR=\""$(imagesdir)"\" \
-	-DCONNECTOR_UIDIR=\""$(uidir)"\" \
-	-DCONNECTOR_LOCALEDIR=\""$(localedir)\""
-
-noinst_PROGRAMS = \
-	exchange-connector-setup
+noinst_PROGRAMS = exchange-connector-setup
 
 noinst_LTLIBRARIES = libevolution-exchange-shared.la
 
+libevolution_exchange_shared_la_CPPFLAGS = 		\
+	$(AM_CPPFLAGS)					\
+	-I$(top_srcdir) 				\
+	-I$(top_srcdir)/camel 				\
+	$(EXCHANGE_STORAGE_CFLAGS) 			\
+	$(LDAP_CFLAGS) 					\
+	$(LIBEXCHANGE_CFLAGS) 				\
+	-DG_LOG_DOMAIN=\"evolution-exchange-storage\" 	\
+	-DPREFIX=\"$(prefix)\" 				\
+	-DSYSCONFDIR=\""$(sysconfdir)"\" 		\
+	-DDATADIR=\""$(datadir)"\" 			\
+	-DLIBDIR=\""$(datadir)"\" 			\
+	-DCONNECTOR_IMAGESDIR=\""$(imagesdir)"\" 	\
+	-DCONNECTOR_UIDIR=\""$(uidir)"\" 		\
+	-DCONNECTOR_LOCALEDIR=\""$(localedir)\""
+
 libevolution_exchange_shared_la_SOURCES = 	\
 	exchange-share-config-listener.h	\
 	exchange-share-config-listener.c
 
 libevolution_exchange_shared_la_LIBADD = 	\
-	$(EXCHANGE_STORAGE_LIBS)		\
-	$(LIBEXCHANGE_LIBS)
+	$(LIBEXCHANGE_LIBS)			\
+	$(EXCHANGE_STORAGE_LIBS)
 
 libevolution_exchange_shared_la_LDFLAGS = $(NO_UNDEFINED)
 
+exchange_connector_setup_CPPFLAGS = 			\
+	$(AM_CPPFLAGS)					\
+	$(EXCHANGE_STORAGE_CFLAGS) 			\
+	$(LDAP_CFLAGS) 					\
+	$(LIBEXCHANGE_CFLAGS) 				\
+	-I$(top_srcdir) 				\
+	-I$(top_srcdir)/camel 				\
+	-DG_LOG_DOMAIN=\"evolution-exchange-storage\" 	\
+	-DPREFIX=\"$(prefix)\" 				\
+	-DSYSCONFDIR=\""$(sysconfdir)"\" 		\
+	-DDATADIR=\""$(datadir)"\" 			\
+	-DLIBDIR=\""$(datadir)"\" 			\
+	-DCONNECTOR_IMAGESDIR=\""$(imagesdir)"\" 	\
+	-DCONNECTOR_UIDIR=\""$(uidir)"\" 		\
+	-DCONNECTOR_LOCALEDIR=\""$(localedir)\""
+
 exchange_connector_setup_SOURCES =	\
 	ximian-connector-setup.c	\
 	exchange-autoconfig-wizard.h	\
 	exchange-autoconfig-wizard.c
 
-exchange_connector_setup_LDADD = \
-	$(LDAP_LIBS) \
-	$(EXCHANGE_STORAGE_LIBS) \
+exchange_connector_setup_LDADD = 	\
+	$(LDAP_LIBS) 			\
+	$(EXCHANGE_STORAGE_LIBS) 	\
 	$(LIBEXCHANGE_LIBS)
 
 install-exec-local: exchange-connector-setup
@@ -55,8 +71,6 @@ images_DATA = \
 uidir   = $(CONNECTOR_DATADIR)/ui
 ui_DATA = ximian-connector.xml
 
-#DISTCLEANFILES =
-
 EXTRA_DIST = \
 	$(images_DATA) \
 	$(ui_DATA)
