diff --git configure.ac configure.ac
index 30c979f..0035b80 100644
--- configure.ac
+++ configure.ac
@@ -16,69 +16,30 @@ 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([gconf_minimum_version], [2.0.0])             # XXX Just a Guess
+m4_define([gconf_minimum_version], [2.0.0])		dnl XXX Just a Guess
 m4_define([libbonobo_minimum_version], [2.20.3])
-m4_define([libglade_minimum_version], [2.0.0])          # XXX Just a Guess
-m4_define([libgnomeui_minimum_version], [2.0.0])        # XXX Just a Guess
-m4_define([libxml_minimum_version], [2.0.0])            # XXX Just a Guess
+m4_define([libglade_minimum_version], [2.0.0])		dnl XXX Just a Guess
+m4_define([libgnomeui_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])
 
-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 Update these for every new development release of evolution. These numbers
 dnl actually correspond to the next stable release number
 EVOLUTION_API_VERSION=2.30
 EDS_API_VERSION=1.2
 EDS_BASE_VERSION=2.30
 
-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 Initialize maintainer mode
 dnl ******************************
 AM_MAINTAINER_MODE
 
-AC_ISC_POSIX
 AC_PROG_CC
-AC_STDC_HEADERS
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 
 dnl ******************************
-dnl Initialize libtool
-dnl ******************************
-AM_PROG_LIBTOOL
-
-dnl ******************************
 dnl Compiler Warning Flags
 dnl ******************************
 AS_COMPILER_FLAGS(WARNING_FLAGS,
@@ -109,18 +70,14 @@ dnl	-Wshadow
 
 CFLAGS="$CFLAGS $WARNING_FLAGS"
 
-dnl ******************************
-dnl I18N stuff
-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 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])
 
 dnl ******************************
 dnl Check for Win32
@@ -128,60 +85,88 @@ 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])
 AC_SUBST(NO_UNDEFINED)
 AC_SUBST(SOCKET_LIBS)
 
+dnl **********************
+dnl Initialize pkg-config
+dnl **********************
+PKG_PROG_PKG_CONFIG
+
+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 Initialize libtool
+dnl ******************************
+AM_PROG_LIBTOOL
+
+dnl ******************************
+dnl I18N stuff
+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
-	 libbonobo-2.0 >= libbonobo_minimum_version
-	 libglade-2.0 >= libglade_minimum_version
-	 libgnomeui-2.0 >= libgnomeui_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
+	libbonobo-2.0 >= libbonobo_minimum_version
+	libglade-2.0 >= libglade_minimum_version
+	libgnomeui-2.0 >= libgnomeui_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(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])
+	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])
 
 AC_EGREP_HEADER(socklen_t, sys/socket.h, :, AC_DEFINE(socklen_t, int, [Define to "int" if socklen_t is not defined]))
 
@@ -202,24 +187,20 @@ AC_SUBST(CONNECTOR_DATADIR)
 dnl **************************************************
 dnl Check that eds was built with Exchange support.
 dnl **************************************************
-EXCHANGE_PACKAGE="`pkg-config --exists libexchange-storage-$EDS_API_VERSION`"
+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_ERROR([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
 
 dnl *************************
 dnl Orbit / Bonobo
 dnl *************************
 AM_PATH_ORBIT2
-EVOLUTION_idldir="`pkg-config --variable=idldir evolution-shell`"
+EVOLUTION_idldir="`${PKG_CONFIG} --variable=idldir evolution-shell`"
 AC_SUBST(EVOLUTION_idldir)
 
-EVOLUTION_IDL_INCLUDES="`pkg-config --variable=IDL_INCLUDES evolution-shell`"
+EVOLUTION_IDL_INCLUDES="`${PKG_CONFIG} --variable=IDL_INCLUDES evolution-shell`"
 AC_SUBST(EVOLUTION_IDL_INCLUDES)
 
 dnl ******************************
@@ -230,22 +211,34 @@ 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_privdatadir="`pkg-config --variable=privdatadir evolution-shell`"
+EVOLUTION_privdatadir="`${PKG_CONFIG} --variable=privdatadir evolution-shell`"
 AC_SUBST(EVOLUTION_privdatadir)
 
-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)
 
 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 "$enable_e2kdebug" = "yes"; then
+	AC_DEFINE(E2K_DEBUG, 1, [Define if you want E2K_DEBUG to be available])
+fi
+
+dnl ******************************
 dnl libedata-book check
 dnl ******************************
 PKG_CHECK_MODULES(ADDRESSBOOK, libedata-book-$EDS_API_VERSION camel-provider-$EDS_API_VERSION)
@@ -302,7 +295,6 @@ case $abt in
 esac
 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])
 
 dnl *************
@@ -314,58 +306,56 @@ 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
+	EVO_SUNLDAP_CHECK(no)
+	case $with_sunldap in
 	no)
-		AC_ERROR(LDAP support is required for Connector)
+		EVO_LDAP_CHECK(yes)
+		case $with_openldap in
+		no)
+			AC_ERROR(LDAP support is required for Connector)
+		;;
+		esac
 	;;
 	esac
-	;;
-esac
 
-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"
+	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)
+	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
 
 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)
+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 $ac_cv_ldappaged = yes; then
+	AC_DEFINE([HAVE_LDAP_PAGED], 1, [Supports Paged results])
+fi
 
 dnl *******
 dnl gtk-doc
@@ -378,34 +368,38 @@ dnl into the top level where I don't want it.
 dnl **************************************************
 dnl libdb checking - taken from EDS
 dnl **************************************************
-AC_ARG_WITH(libdb, AC_HELP_STRING([--with-libdb],[Prefix where libdb is installed]), dynamic_libdb=yes, dynamic_libdb=no)
+AC_ARG_WITH([libdb],
+	AS_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"
+	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)
+	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])
+	AC_DEFINE(ENABLE_CACHE, 1,
+	[Enabling GAL Caching])
 else
-  AC_DEFINE(ENABLE_CACHE, 0,
-	    [Disabling GAL Caching])
-  DB_CFLAGS=""
-  DB_LIBS=""
+	AC_DEFINE(ENABLE_CACHE, 0,
+	[Disabling GAL Caching])
+	DB_CFLAGS=""
+	DB_LIBS=""
 fi
 CFLAGS=$save_cflags
 LIBS=$save_libs
@@ -415,7 +409,7 @@ AC_SUBST(DB_LIBS)
 dnl ******************************
 dnl Makefiles
 dnl ******************************
-AC_OUTPUT([
+AC_CONFIG_FILES([
 Makefile
 evolution-exchange-zip
 camel/Makefile
@@ -427,15 +421,13 @@ docs/Makefile
 docs/reference/Makefile
 po/Makefile.in
 ])
+AC_OUTPUT
 
-case $ac_cv_func_ldap_ntlm_bind in
-no)
-	echo ""
+if test $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
