diff --git a/acconfig.h b/acconfig.h
index 48c2f9d0bd5f0e90ba84cd4718beda23aa7e5452..e204299f8a50daf8eec5364cf2331f4ebb5df287 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,15 +1,6 @@
 /* acconfig.h
-   This file is in the public domain.
-
    Descriptive text for the C preprocessor macros that
    the distributed Autoconf macros can define.
-   No software package will use all of them; autoheader copies the ones
-   your configure.in uses into your configuration header file templates.
-
-   The entries are in sort -df order: alphabetical, case insensitive,
-   ignoring punctuation (such as underscores).  Although this order
-   can split up related entries, it makes it easier to check whether
-   a given entry is in the file.
 
    Leave the following blank line there!!  Autoheader needs it.  */
 
@@ -21,7 +12,7 @@
 #undef HAVE_CRYPT
 
 /* define this for connectionless LDAP support */
-#undef LDAP_CONN_LESS
+#undef LDAP_CONNECTIONLESS
 
 /* define this to remove -lldap cache support */
 #undef LDAP_NOCACHE
@@ -33,13 +24,13 @@
 #undef LDAP_REFERRALS
 
 /* define this to use SLAPD shell backend */
-#undef LDAP_SHELL
+#undef SLAPD_SHELL
 
 /* define this to use SLAPD passwd backend */
-#undef LDAP_PASSWD
+#undef SLAPD_PASSWD
 
 /* define this to use SLAPD LDBM backend */
-#undef LDAP_LDBM
+#undef SLAPD_LDBM
 
 /* define this to use DBBTREE w/ LDBM backend */
 #undef LDBM_USE_DBBTREE
@@ -54,7 +45,4 @@
 #undef LDBM_USE_NDBM
 
 
-/* Leave that blank line there!!  Autoheader needs it.
-   If you're adding to this file, keep in mind:
-   The entries are in sort -df order: alphabetical, case insensitive,
-   ignoring punctuation (such as underscores).  */
+/* Leave that blank line there!!  Autoheader needs it. */
diff --git a/build/top.mk b/build/top.mk
index 78ac505a4b51e16915941abb3b22265935e9f94e..19bbb20ce1a3f29c8aec79e6eec0bb4d2c69e6e0 100644
--- a/build/top.mk
+++ b/build/top.mk
@@ -1,5 +1,7 @@
 ##
-## Copyright 1998 Net Boolean Incorporated
+## Copyright 1998 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+## of this package for details.
 ##
 @SET_MAKE@
 
@@ -15,7 +17,7 @@ bindir = @bindir@
 sbindir = @sbindir@
 libexecdir = @libexecdir@
 datadir = @datadir@
-sysconfdir = @sysconfdir@/ldap
+sysconfdir = @sysconfdir@
 sharedstatedir = @sharedstatedir@
 localstatedir = @localstatedir@
 libdir = @libdir@
diff --git a/configure.in b/configure.in
index b8f3d67ece4783efb35b93a525e735504748267c..6ca9263392ab7341b1b37c46288ecccb9dfbc3db 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,11 @@
+dnl Copyright 1998 The OpenLDAP Foundation.  All Rights Reserved.
 dnl 
-dnl Configure.in
+dnl Redistribution and use in source and binary forms are permitted only
+dnl as authorized by the OpenLDAP Public License.  A copy of this
+dnl license is available at http://www.OpenLDAP.org/license.html or
+dnl in file LICENSE in the top-level directory of the distribution.
+dnl ----
+dnl Configure.in for OpenLDAP
 dnl
 AC_INIT(include/ldap.h)
 dnl
@@ -27,8 +33,6 @@ CF_ARG_OPTION(referrals,[  --enable-referrals	enable referrals (yes)],[
 
 CF_ARG_OPTION(cldap,[  --enable-clapd	enable connectionless ldap (no)],[
 	LDAP_CLDAP=yes],[LDAP_CLDAP=no],no)dnl
-CF_ARG_OPTION(phonetic,[  --enable-phonetic	enable phonetic/soundex  (no)],[
-	LDAP_PHONETIC=yes],[LDAP_PHONETIC=no],no)dnl
 
 dnl General "with" options
 AC_ARG_WITH(kerberos,[  --with-kerberos	use Kerberos (no)],[
@@ -57,8 +61,10 @@ CF_ARG_OPTION(sha1,[    --enable-sha1	enable SHA1 passwords (yes)],[
 	SLAPD_SHA1=no],[SLAPD_SHA1=yes],yes)dnl
 CF_ARG_OPTION(wrappers,[    --enable-wrappers	enable tcp wrapper support (no)],[
 	SLAPD_TCP_WRAPPERS=yes],[LDAP_TCP_WRAPPERS=no],no)dnl
+CF_ARG_OPTION(phonetic,[    --enable-phonetic	enable phonetic/soundex  (no)],[
+	SLAPD_PHONETIC=yes],[SLAPD_PHONETIC=no],no)dnl
 CF_ARG_OPTION(rlookups,[    --enable-rlookups	enable reverse lookups (yes)],[
-	LDAP_RLOOKUP=no],[LDAP_RLOOKUP=yes],yes)dnl
+	SLAPD_RLOOKUP=no],[SLAPD_RLOOKUP=yes],yes)dnl
 
 dnl SLAPD Backend options
 CF_ARG_OPTION(ldbm,[    --enable-ldbm	enable ldbm backend (yes)],[
@@ -111,12 +117,14 @@ if test "$BUILD_SLAPD" != "yes" ; then
 fi
 
 AC_SUBST(BUILD_LDAPD)
+
 AC_SUBST(BUILD_SLAPD)
+  AC_SUBST(SLAPD_LDBM)
+  AC_SUBST(SLAPD_PASSWD)
+  AC_SUBST(SLAPD_SHELL)
+
 AC_SUBST(BUILD_SLURPD)
 
-AC_SUBST(SLAPD_LDBM)
-AC_SUBST(SLAPD_PASSWD)
-AC_SUBST(SLAPD_SHELL)
 
 dnl general LDAP arguments
 LDAP_DEFS=
@@ -125,7 +133,7 @@ if test "$LDAP_DEBUG" = "yes" ; then
 	LDAP_DEFS="$LDAP_DEFS -DLDAP_DEBUG"
 fi
 if test "$LDAP_REFERRALS" = "yes" ; then
-dnl	AC_DEFINE(LDAP_REFERRALS,1)
+	AC_DEFINE(LDAP_REFERRALS,1)
 	LDAP_DEFS="$LDAP_DEFS -DLDAP_REFERRALS"
 fi
 if test "$LDAP_CACHE" = "no" ; then
@@ -136,16 +144,16 @@ if test "$LDAP_CLDAP" = "yes" ; then
 	AC_DEFINE(LDAP_CONNECTIONLESS,1)
 	LDAP_DEFS="$LDAP_DEFS -DCLDAP"
 fi
-if test "$LDAP_PHONETIC" = "yes" ; then
-	AC_DEFINE(LDAP_PHONETIC,1)
-	LDAP_DEFS="$LDAP_DEFS -DSOUNDEX"
-fi
 
 dnl ldapd arguments
 LDAPD_DEFS=
 
 dnl slapd arguments
 SLAPD_DEFS=
+if test "$SLAPD_PHONETIC" = "yes" ; then
+	AC_DEFINE(SLAPD_PHONETIC,1)
+	SLAPD_DEFS="$SLAPD_DEFS -DSOUNDEX"
+fi
 
 if test "$SLAPD_LDBM" = "yes" ; then
 	AC_DEFINE(SLAPD_LDBM,1)
@@ -318,12 +326,12 @@ dnl need do this early
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
+dnl append /ldap to $sysconfdir, probably should make this a settable option.
+sysconfdir="$sysconfdir/ldap"
 SYSCONFDIR=`eval echo $sysconfdir`
 AC_SUBST(SYSCONFDIR)
 
 dnl AC_OUTPUT( \
-dnl include/ldapconfig.h \
-dnl include/Makefile:build/top.mk:include/Makefile.in	\
 dnl clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
 dnl clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
 dnl clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
@@ -356,5 +364,7 @@ dnl Makefile:build/top.mk:Makefile.in:build/dir.mk, \
 dnl [date > stamp-h])
 
 AC_OUTPUT( \
+include/ldapconfig.h \
+include/Makefile:build/top.mk:include/Makefile.in \
 Makefile:build/top.mk:Makefile.in:build/dir.mk \
 ,[date > stamp-h])
diff --git a/include/Makefile.in b/include/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..c23de8a47fa2c05cf232c5085c76b9c3b7198e80
--- /dev/null
+++ b/include/Makefile.in
@@ -0,0 +1,18 @@
+#
+# Makefile.in for OpenLDAP include directory
+#
+
+install: all FORCE
+		-$(MKDIR) -p $(includedir)
+		$(INSTALL) $(INSTALLFLAGS) -m 644 ldap.h $(includedir)
+		$(INSTALL) $(INSTALLFLAGS) -m 644 lber.h $(includedir)
+		$(INSTALL) $(INSTALLFLAGS) -m 644 proto-lber.h $(includedir)
+		$(INSTALL) $(INSTALLFLAGS) -m 644 proto-ldap.h $(includedir)
+		$(INSTALL) $(INSTALLFLAGS) -m 644 disptmpl.h $(includedir)
+		$(INSTALL) $(INSTALLFLAGS) -m 644 srchpref.h $(includedir)
+
+all: FORCE
+clean: FORCE 
+veryclean: FORCE
+depend: FORCE
+
diff --git a/include/ldapconfig.h.in b/include/ldapconfig.h.in
index 265016a2e8a09dac6e37114751081c7320b36d8f..5ec6126656da9d6b1c67892c3f9a39307ecee35c 100644
--- a/include/ldapconfig.h.in
+++ b/include/ldapconfig.h.in
@@ -26,27 +26,28 @@
  * SHARED DEFINITIONS - things you should change
  */
 #define DEFAULT_BINDIR		"@BINDIR@"
-#define DEFAULT_SBINDIR		"@SBINDIR@"
 #define DEFAULT_ETCDIR		"@ETCDIR@"
 #define DEFAULT_LIBEXECDIR	"@LIBEXECDIR@"
+#define DEFAULT_SBINDIR		"@SBINDIR@"
+#define DEFAULT_SYSCONFDIR	"@SYSCONFDIR@"
 
 /* default ldap host */
 #define LDAPHOST	"localhost"
 
-#define DEFAULT_LDAPHOST_FILE "@ETCDIR@/ldaphost"
+#define DEFAULT_LDAPHOST_FILE "@SYSCONFDIR@/ldaphost"
 /* default place to start searching */
 #define DEFAULT_BASE	"o=Your Organization Name, c=US"
-#define DEFAULT_BASE_FILE "@ETCDIR@/ldapbase"
+#define DEFAULT_BASE_FILE "@SYSCONFDIR@/ldapbase"
 
 /*
  * default binddn and creditials
  *  use files, make sure they are not generally readable
  */
 #define DEFAULT_BINDDN		NULL
-#define DEFAULT_BINDDN_FILE "@ETCDIR@/ldapbinddn"
+#define DEFAULT_BINDDN_FILE "@SYSCONFDIR@/ldapbinddn"
 
 #define DEFAULT_BIND_CRED	NULL
-#define DEFAULT_BIND_CRED_FILE "@ETCDIR@/ldapbindcred"
+#define DEFAULT_BIND_CRED_FILE "@SYSCONFDIR@/ldapbindcred"
 
 /*********************************************************************
  *                                                                   *
@@ -62,10 +63,10 @@
 	/* default count of DN components to show in entry displays */
 #define DEFAULT_RDNCOUNT	2
 	/* default config file locations */
-#define FILTERFILE		"@ETCDIR@/ldapfilter.conf"
-#define TEMPLATEFILE	"@ETCDIR@/ldaptemplates.conf"
-#define SEARCHFILE		"@ETCDIR@/ldapsearchprefs.conf"
-#define FRIENDLYFILE	"@ETCDIR@/ldapfriendly"
+#define FILTERFILE		"@SYSCONFDIR@/ldapfilter.conf"
+#define TEMPLATEFILE	"@SYSCONFDIR@/ldaptemplates.conf"
+#define SEARCHFILE		"@SYSCONFDIR@/ldapsearchprefs.conf"
+#define FRIENDLYFILE	"@SYSCONFDIR@/ldapfriendly"
 
 /*
  * FINGER DEFINITIONS
@@ -139,7 +140,7 @@ Please try again later.\r\n"
 #define GO500GW_BINDDN			NULL
 #define GO500GW_BIND_CRED		NULL
 	/* where the helpfile lives */
-#define GO500GW_HELPFILE	"@ETCDIR@/go500gw.help"
+#define GO500GW_HELPFILE	"@SYSCONFDIR@/go500gw.help"
 	/* port on which to listen */
 #define GO500GW_PORT		7777
 	/* timeout on all searches */
@@ -163,7 +164,7 @@ Please try again later.\r\n"
 #define RCPT500_BINDDN		NULL
 #define RCPT500_BIND_CRED	NULL
 	/* where the helpfile lives */
-#define RCPT500_HELPFILE	"@ETCDIR@/rcpt500.help"
+#define RCPT500_HELPFILE	"@SYSCONFDIR@/rcpt500.help"
 	/* maximum number of matches returned */
 #define RCPT500_SIZELIMIT	50
 	/* address replies will appear to come from */
@@ -237,7 +238,7 @@ Please try again later.\r\n"
  * UD DEFINITIONS
  */
 	/* ud configuration file */
-#define UD_CONFIG_FILE		"@ETCDIR@/ud.conf"
+#define UD_CONFIG_FILE		"@SYSCONFDIR@/ud.conf"
 	/* default editor */
 #define UD_DEFAULT_EDITOR	"@EDITOR@"
 	/* default bbasename of user config file */
@@ -286,7 +287,7 @@ Please try again later.\r\n"
  * SLAPD DEFINITIONS
  */
 	/* location of the default slapd config file */
-#define SLAPD_DEFAULT_CONFIGFILE	"@ETCDIR@/slapd.conf"
+#define SLAPD_DEFAULT_CONFIGFILE	"@SYSCONFDIR@/slapd.conf"
 	/* default sizelimit on number of entries from a search */
 #define SLAPD_DEFAULT_SIZELIMIT		500
 	/* default timelimit to spend on a search */