---
 * fix whitespace policy in configure.in
 * make openldap support optional and auto-detected
 * raise AC_PREREQ to be able to use AS_HELP_STRING and other improvments of autoconf
 * add a configure summary at the end of configure
 * fix "make distcheck"

 Makefile.am  |    2 
 configure.in |  173 ++++++++++++++++++++++++++++++++++++-----------------------
 2 files changed, 109 insertions(+), 66 deletions(-)

Index: b/configure.in
===================================================================
--- a/configure.in
+++ b/configure.in
@@ -1,11 +1,16 @@
-AC_INIT([GConf],[2.23.91],[http://bugzilla.gnome.org/enter_bug.cgi?product=GConf],[GConf])
+AC_PREREQ(2.60)
+
+AC_INIT([GConf],
+  [2.23.91],
+  [http://bugzilla.gnome.org/enter_bug.cgi?product=GConf],
+  [GConf])
 
 AC_DEFUN([AC_FYI], [echo "FYI: " $1])
 
 AC_CONFIG_SRCDIR([gconf/gconf.h])
-AM_CONFIG_HEADER(config.h)
+AM_CONFIG_HEADER([config.h])
 
-AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2 -Wall])
 
 AM_MAINTAINER_MODE
 
@@ -19,14 +24,14 @@ case "$host" in
     ;;
 esac
 
-AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
+AM_CONDITIONAL(OS_WIN32, [test "x$os_win32" = "xyes"])
 
-if test "$os_win32" = "yes"; then
-  if test x$enable_static = xyes -o x$enable_static = x; then
+if test "x$os_win32" = "xyes"; then
+  if test "x$enable_static" = "xyes" -o "x$enable_static" = "x"; then
     AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
     enable_static=no
   fi
-  if test x$enable_shared = xno; then
+  if test "x$enable_shared" = "xno"; then
     AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
   fi
   enable_shared=yes
@@ -44,19 +49,19 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genma
 changequote(,)dnl
 if test "x$GCC" = "xyes"; then
   case " $CFLAGS " in
-  *[\ \	]-Wall[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wall" ;;
+    *[\ \	]-Wall[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wall" ;;
   esac
 
   if test "x$enable_ansi" = "xyes"; then
     case " $CFLAGS " in
-    *[\ \	]-ansi[\ \	]*) ;;
-    *) CFLAGS="$CFLAGS -ansi" ;;
+      *[\ \	]-ansi[\ \	]*) ;;
+      *) CFLAGS="$CFLAGS -ansi" ;;
     esac
 
     case " $CFLAGS " in
-    *[\ \	]-pedantic[\ \	]*) ;;
-    *) CFLAGS="$CFLAGS -pedantic" ;;
+      *[\ \	]-pedantic[\ \	]*) ;;
+      *) CFLAGS="$CFLAGS -pedantic" ;;
     esac
   fi
 fi
@@ -76,12 +81,12 @@ dnl libtool versioning for libgconf
 dnl increment if the interface has additions, changes, removals.
 GCONF_CURRENT=5
 
-dnl increment any time the source changes; set to 
+dnl increment any time the source changes; set to
 dnl  0 if you increment CURRENT
 GCONF_REVISION=5
 
 dnl increment if any interfaces have been added; set to 0
-dnl  if any interfaces have been removed. removal has 
+dnl  if any interfaces have been removed. removal has
 dnl  precedence over adding, so set to 0 if both happened.
 GCONF_AGE=1
 
@@ -97,14 +102,16 @@ else
   REAL_PREFIX=$prefix
 fi
 
-AC_ARG_WITH(sysconfsubdir, AC_HELP_STRING([--with-sysconfsubdir],
-            [directory name used under sysconfdir, default=gconf]),
-            sysconfsubdir=${withval}, sysconfsubdir=gconf)
+AC_ARG_WITH(sysconfsubdir,
+  AS_HELP_STRING([--with-sysconfsubdir],
+    [directory name used under sysconfdir @<:@default=gconf@:>@]),
+  sysconfsubdir=${withval}, sysconfsubdir=gconf)
 AC_SUBST(sysconfsubdir)
-if test x"${sysconfsubdir}" != x; then
-    sysgconfdir='${sysconfdir}/${sysconfsubdir}'
+
+if test "x${sysconfsubdir}" != "x"; then
+  sysgconfdir='${sysconfdir}/${sysconfsubdir}'
 else
-    sysgconfdir='${sysconfdir}'
+  sysgconfdir='${sysconfdir}'
 fi
 AC_SUBST(sysgconfdir)
 
@@ -112,24 +119,29 @@ dnl Save flags to aclocal
 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
 
 dnl Default to debug spew in unstable branch
-AC_ARG_ENABLE(debug, 
-            [  --enable-debug=[no/yes/minimum]      Compile with debug checks.],,enable_debug=minimum)
+AC_ARG_ENABLE(debug,
+  AS_HELP_STRING([--enable-debug=@<:@no/yes/minimum@:>@],
+    [Compile with debug checks.]),
+  ,enable_debug=minimum)
 
 if test "x$enable_debug" = "xyes"; then
-        CFLAGS="$CFLAGS -DGCONF_ENABLE_DEBUG=1"
-        AC_FYI("Will build with debugging spew and checks")
+  CFLAGS="$CFLAGS -DGCONF_ENABLE_DEBUG=1"
+  AC_FYI("Will build with debugging spew and checks")
 else
   if test "x$enable_debug" = "xno"; then
-          CFLAGS="$CFLAGS -DG_DISABLE_CHECKS=1 -DG_DISABLE_ASSERT=1"
-          AC_FYI("Will build without *any* debugging code")
+    CFLAGS="$CFLAGS -DG_DISABLE_CHECKS=1 -DG_DISABLE_ASSERT=1"
+    AC_FYI("Will build without *any* debugging code")
   else
-          AC_FYI("Will build with debug checks but no debug spew")
+    AC_FYI("Will build with debug checks but no debug spew")
   fi
 fi
 
 GTK_DOC_CHECK([1.0])
 
-AC_ARG_ENABLE(gtk, [  --enable-gtk          Enable GTK+ support (for gconf-sanity-check) [default=auto]], enable_gtk="$enableval", enable_gtk=auto)
+AC_ARG_ENABLE(gtk,
+  AS_HELP_STRING([--enable-gtk],
+    [Enable GTK+ support (for gconf-sanity-check) @<:@default=auto@:>@]),
+  enable_gtk="$enableval", enable_gtk=auto)
 
 PKGCONFIG_MODULES='glib-2.0 > 2.14.0 gmodule-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0 ORBit-2.0 >= 2.4.0 dbus-1 >= 1.0.0 dbus-glib-1 >= 0.74'
 PKGCONFIG_MODULES_WITH_XML="$PKGCONFIG_MODULES libxml-2.0"
@@ -141,8 +153,7 @@ PKG_CHECK_MODULES(DEPENDENT_WITH_XML, $P
 
 if test "x$enable_gtk" != "xno"; then
   PKG_CHECK_MODULES(DEPENDENT_WITH_GTK, $PKGCONFIG_MODULES_WITH_GTK, HAVE_GTK=yes, HAVE_GTK=no)
-  PKG_CHECK_MODULES(DEPENDENT_WITH_XML_AND_GTK, $PKGCONFIG_MODULES_WITH_XML_AND_GTK, ,
-                    DEPENDENT_WITH_XML_AND_GTK_CFLAGS=$DEPENDENT_WITH_XML_CFLAGS DEPENDENT_WITH_XML_AND_GTK_LIBS=$DEPENDENT_WITH_XML_LIBS)
+  PKG_CHECK_MODULES(DEPENDENT_WITH_XML_AND_GTK, $PKGCONFIG_MODULES_WITH_XML_AND_GTK, , DEPENDENT_WITH_XML_AND_GTK_CFLAGS=$DEPENDENT_WITH_XML_CFLAGS DEPENDENT_WITH_XML_AND_GTK_LIBS=$DEPENDENT_WITH_XML_LIBS)
 
   if test "x$enable_gtk" = "xyes" && test "x$HAVE_GTK" = "xno"; then
     AC_MSG_ERROR([[
@@ -155,7 +166,7 @@ else
   DEPENDENT_WITH_XML_AND_GTK_LIBS=$DEPENDENT_WITH_XML_LIBS
 fi
 
-AM_CONDITIONAL(GTK, test x$HAVE_GTK != xno)
+AM_CONDITIONAL(GTK, [test "x$HAVE_GTK" != "xno"])
 
 AC_SUBST(DEPENDENT_LIBS)
 AC_SUBST(DEPENDENT_CFLAGS)
@@ -166,19 +177,20 @@ AC_SUBST(DEPENDENT_WITH_GTK_CFLAGS)
 AC_SUBST(DEPENDENT_WITH_XML_AND_GTK_LIBS)
 AC_SUBST(DEPENDENT_WITH_XML_AND_GTK_CFLAGS)
 
+enable_defaults_service=no
+HAVE_POLKIT=no
 AC_ARG_ENABLE(defaults-service,
-              [AC_HELP_STRING([--enable-defaults-service],
-                              [build the defaults DBus service [default=auto]])],
-              [enable_defaults_service="$enableval"],
-              [enable_defaults_service=auto])
+  AS_HELP_STRING([--enable-defaults-service],
+    [build the defaults DBus service @<:@default=auto@:>@])],
+  [enable_defaults_service="$enableval"],
+  [enable_defaults_service=auto])
+
 if test "x$enable_defaults_service" != "xno" ; then
-  PKG_CHECK_MODULES(DEFAULTS, glib-2.0 gobject-2.0 dbus-1 dbus-glib-1 polkit-dbus, HAVE_POLKIT=yes, HAVE_POLKIT=no)
+  PKG_CHECK_MODULES(DEFAULTS, glib-2.0 gobject-2.0 dbus-1 dbus-glib-1 polkit-dbus, HAVE_POLKIT=yes)
   if test "x$HAVE_POLKIT" = "xno"; then
     if test "x$enable_defaults_service" = "xyes" ; then
       AC_MSG_ERROR([[
 *** Could not find PolicyKit.]])
-    else
-      enable_defaults_service=no
     fi
   else
     enable_defaults_service=yes
@@ -189,9 +201,10 @@ if test "x$enable_defaults_service" != "
   AC_DEFINE(ENABLE_DEFAULTS_SERVICE, 1, [enable defaults DBus service])
 
   AC_CHECK_PROG([POLKIT_POLICY_FILE_VALIDATE],
-                [polkit-policy-file-validate], [polkit-policy-file-validate])
+    [polkit-policy-file-validate], [polkit-policy-file-validate])
+
   if test -z "$POLKIT_POLICY_FILE_VALIDATE"; then
-      AC_MSG_ERROR([polkit-policy-file-validate not found])
+    AC_MSG_ERROR([polkit-policy-file-validate not found])
   fi
 fi
 
@@ -201,42 +214,63 @@ ORBIT_IDL="`$PKG_CONFIG --variable=orbit
 AC_SUBST(ORBIT_IDL)
 
 AC_CHECK_HEADER(pthread.h, have_pthreads=yes)
-AM_CONDITIONAL(PTHREADS, test -n "$have_pthreads")
+AM_CONDITIONAL(PTHREADS, [test -n "$have_pthreads"])
 
 AC_CHECK_HEADERS(syslog.h sys/wait.h)
 
 AC_CHECK_FUNCS(getuid sigaction fsync fchmod fdwalk)
 
+dnl **************************************************
+dnl LDAP support.
+dnl **************************************************
+
+AC_ARG_WITH(openldap,
+  AS_HELP_STRING([--with-openldap],
+    [Enable LDAP backend @<:@default=auto@:>@]),
+  ,with_openldap=auto)
 
 LDAP_LIBS=
-AC_CHECK_HEADER(ldap.h, [
+
+if test "x$with_openldap" != "xno"; then
+  AC_CHECK_HEADER(ldap.h, [
     AC_CHECK_LIB(ldap, ldap_init, AC_CHECK_LIB(lber, ber_free, [LDAP_LIBS="-lldap -llber"]))
   ])
-AC_SUBST(LDAP_LIBS)
-AM_CONDITIONAL(LDAP_SUPPORT, test -n "$LDAP_LIBS")
 
-dnl **************************************************
-dnl LDAP support.
-dnl **************************************************
-if test "$os_win32" != yes; then
+  if test "x$os_win32" != "xyes"; then
+    SAVE_CFLAGS="$CFLAGS"
+    SAVE_LIBS="$LIBS"
+    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="-DLDAP_DEPRECATED"
+    LDAP_LIBS="-lwldap32"
+    AC_SUBST(LDAP_CFLAGS)
+    AC_SUBST(LDAP_LIBS)
+    AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
+    msg_ldap="yes"
+
+  fi # Win32
+
+  if test -z "$LDAP_LIBS"; then
+    if test "x$with_openldap" = "xyes"; then
+      AC_MSG_ERROR([*** LDAP support explicitely requested but not found ***])
+    else
+      AC_MSG_WARN([*** LDAP support not found ***])
+    fi
+  fi
 
-SAVE_CFLAGS="$CFLAGS"
-SAVE_LIBS="$LIBS"
-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="-DLDAP_DEPRECATED"
-LDAP_LIBS="-lwldap32"
+  have_ldap=yes
+else
+  have_ldap=no
+fi
 AC_SUBST(LDAP_CFLAGS)
 AC_SUBST(LDAP_LIBS)
-AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
-msg_ldap="yes"
-fi # Win32
+AM_CONDITIONAL(LDAP_SUPPORT, [test -n "$LDAP_LIBS"])
 
 IT_PROG_INTLTOOL([0.35.0])
 
@@ -274,7 +308,7 @@ fi
 
 REBUILD=\#
 if test $_found_perl -eq 1; then
-  if test -n "$AWK" ; then 
+  if test -n "$AWK" ; then
     REBUILD=
   fi
 fi
@@ -296,3 +330,12 @@ gconf-2.0.pc
 ])
 
 AC_OUTPUT
+
+echo "
+	sysconfsubdir:	${sysconfsubdir}
+
+	gtk+:		${HAVE_GTK}
+	ldap:		${have_ldap}
+	policykit:	${HAVE_POLKIT}
+
+"
Index: b/Makefile.am
===================================================================
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@ if ENABLE_DEFAULTS_SERVICE
 SUBDIRS += defaults
 endif
 
-DIST_SUBDIRS=tests $(SUBDIRS) 
+DIST_SUBDIRS = tests $(SUBDIRS) defaults
 
 EXTRA_DIST =                \
 	TODO                \
