From 1cbb299fd90097c10a4608119f3fb567d757e8be Mon Sep 17 00:00:00 2001
From: Ignacio Casal Quinteiro <icq@gnome.org>
Date: Thu, 19 Nov 2015 15:08:13 +0100
Subject: [PATCH] Remove configure magic from saslauthd

---
 configure.in                | 105 +++++++++++++-
 saslauthd/AUTHORS           |  23 ---
 saslauthd/INSTALL           |   3 -
 saslauthd/Makefile.am       |   7 +-
 saslauthd/NEWS              |   3 -
 saslauthd/README            |   4 -
 saslauthd/auth_httpform.c   |   3 +
 saslauthd/auth_shadow.c     |   2 +
 saslauthd/cache.c           |   2 +-
 saslauthd/cache.h           |   2 +-
 saslauthd/configure.in      | 340 --------------------------------------------
 saslauthd/mechanisms.h      |   2 +-
 saslauthd/saslauthd-main.h  |   3 +-
 saslauthd/testsaslauthd.c   |   2 +-
 saslauthd/utils.h           |   3 +-
 17 files changed, 115 insertions(+), 403 deletions(-)
 delete mode 100644 saslauthd/AUTHORS
 delete mode 100644 saslauthd/INSTALL
 delete mode 100644 saslauthd/NEWS
 delete mode 100644 saslauthd/README
 delete mode 100644 saslauthd/configure.in

diff --git a/configure.in b/configure.in
index eddfc854..4ca34d87 100644
--- a/configure.in
+++ b/configure.in
@@ -580,6 +580,68 @@ if test "$gssapi" != "no"; then
   AC_MSG_RESULT($use_gss_mutexes)
 fi
 
+SASL2_CRYPT_CHK
+
+AC_ARG_ENABLE(sia, [  --enable-sia            enable SIA authentication [no] ],
+  sia=$enableval,
+  sia=no)
+LIB_SIA=""
+if test "$sia" != no; then
+  if test -f /etc/sia/matrix.conf; then
+    AC_DEFINE(HAVE_SIA,[],[Include SIA Support])
+    LIB_SIA="-lsecurity -ldb -lm -laud"
+  else
+    AC_ERROR([No support for SIA found])
+  fi
+fi
+AC_SUBST(LIB_SIA)
+
+AC_ARG_ENABLE(auth-sasldb, [  --enable-auth-sasldb    enable experimental SASLdb authentication module [no] ],
+  authsasldb=$enableval,
+  authsasldb=no)
+if test "$authsasldb" != no; then
+  if test ! -d "../sasldb"; then
+     echo "ERROR: Cannot build sasldb module outside of the full SASL source tree."
+     exit 0;
+  fi
+  AC_DEFINE(AUTH_SASLDB,[],[Include SASLdb Support])
+  SASL_DB_PATH_CHECK()
+  SASL_DB_CHECK()
+  SASL_DB_LIB="$SASL_DB_LIB ../sasldb/.libs/libsasldb.al"
+fi
+
+AC_ARG_ENABLE(httpform, [  --enable-httpform       enable HTTP form authentication [[no]] ],
+  httpform=$enableval,
+  httpform=no)
+if test "$httpform" != no; then
+  AC_DEFINE(HAVE_HTTPFORM,[],[Include HTTP form Support])
+fi
+
+AC_ARG_WITH(pam, [  --with-pam=DIR          use PAM (rooted in DIR) [yes] ],
+	with_pam=$withval,
+	with_pam=yes)
+if test "$with_pam" != no; then
+  if test -d $with_pam; then
+    CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
+    LDFLAGS="$LDFLAGS -L${with_pam}/lib"
+  fi
+  cmu_save_LIBS="$LIBS"
+  AC_CHECK_LIB(pam, pam_start, [
+  AC_CHECK_HEADER(security/pam_appl.h,,
+		  with_pam=no)],
+	with_pam=no, $SASL_DL_LIB)
+  LIBS="$cmu_save_LIBS"
+fi
+
+AC_MSG_CHECKING(for PAM support)
+AC_MSG_RESULT($with_pam)
+LIB_PAM=""
+if test "$with_pam" != no; then
+  AC_DEFINE(HAVE_PAM,[],[Support for PAM?])
+  LIB_PAM="-lpam"
+fi
+AC_SUBST(LIB_PAM)
+
 dnl PLAIN
 SASL_PLAIN_CHK
 
@@ -671,9 +733,26 @@
 fi
 
 
-# make the option show up so people don't whine that it is only in the
-# saslauthd configure script --help
-AC_ARG_WITH(ldap,   [  --with-ldap=DIR         use LDAP (in DIR) for saslauthd [no] ],,with_ldap=no)
+AC_MSG_CHECKING(to include LDAP support)
+AC_ARG_WITH(ldap, [  --with-ldap=DIR         use LDAP (in DIR) for saslauthd [no] ],
+	with_ldap=$withval,
+	with_ldap=no)
+AC_MSG_RESULT($with_ldap)
+
+if test -d $with_ldap; then
+    CPPFLAGS="$CPPFLAGS -I${with_ldap}/include"
+    CMU_ADD_LIBPATH(${with_ldap}/lib)
+fi
+
+LDAP_LIBS=""
+if test "$with_ldap" != no; then
+  AC_CHECK_LIB(ldap, ldap_initialize, [ AC_DEFINE(HAVE_LDAP,[],[Support for LDAP?])
+                                        LDAP_LIBS="-lldap -llber"
+					if test "$with_openssl" != "no"; then
+					    LDAP_LIBS="$LDAP_LIBS -lcrypto $LIB_RSAREF"
+					fi],,-llber)
+fi
+AC_SUBST(LDAP_LIBS)
 
 
 dnl SQL
@@ -1195,7 +1274,7 @@
 AC_HEADER_STDC
 AC_HEADER_DIRENT
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h)
+AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h)
 
 IPv6_CHECK_SS_FAMILY()
 IPv6_CHECK_SA_LEN()
@@ -1203,7 +1282,7 @@
 
 #AC_FUNC_MEMCMP
 #AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48 getpassphrase)
+AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48 getpassphrase asprintf strlcat strlcpy)
 
 if test $enable_cmulocal = yes; then
     AC_WARN([enabling CMU local kludges])
@@ -1216,8 +1295,6 @@
 
 AC_SUBST(DIRS)
 
-AC_CONFIG_SUBDIRS(saslauthd)
-
 AH_TOP([
 /* acconfig.h - autoheader configuration input */
 /* 
@@ -1409,6 +1486,19 @@
 }
 #endif
 
+/* handy string manipulation functions */
+#ifndef HAVE_STRLCPY
+extern size_t saslauthd_strlcpy(char *dst, const char *src, size_t len);
+#define strlcpy(x,y,z) saslauthd_strlcpy((x),(y),(z))
+#endif
+#ifndef HAVE_STRLCAT
+extern size_t saslauthd_strlcat(char *dst, const char *src, size_t len);
+#define strlcat(x,y,z) saslauthd_strlcat((x),(y),(z))
+#endif
+#ifndef HAVE_ASPRINTF
+extern int asprintf(char **str, const char *fmt, ...);
+#endif
+
 #endif /* CONFIG_H */
 ])
 
@@ -1417,6 +1507,7 @@
 AC_OUTPUT(Makefile
 libsasl2.pc
 include/Makefile
+saslauthd/Makefile
 sasldb/Makefile
 plugins/Makefile
 lib/Makefile
diff --git a/saslauthd/AUTHORS b/saslauthd/AUTHORS
deleted file mode 100644
index ecb1bec8..00000000
--- a/saslauthd/AUTHORS
+++ /dev/null
@@ -1,23 +0,0 @@
-Tim Martin <tmartin@andrew.cmu.edu> wrote, debugged, and tested most of the
-code.
-
-Rob Siemborski <rjs3@andrew.cmu.edu> wrote the self-contained autoconf system.
-
-Larry Greenfield <leg+sasl@andrew.cmu.edu> talked a lot.
-
-Igor Brezac <igor@ipass.net> has done a good deal of work on the saslauthd
-LDAP module.
-
-Jeremy Rumpf <jrumpf@heavyload.net> implemented the credential cache, unified
-the different IPC methods under a common framework.
-
-Fabian Knittel <fknittel@gmx.de> wrote auth_pam plugin, based on
-Debian's pwcheck_pam daemon by Michael-John Turner <mj@debian.org>.
-
-saslauthd was originally contributed by Lyndon Nerenberg on
-behalf of MessagingDirect Ltd.
-
-getaddrinfo.c was written by Hajimu UMEMOTO <ume@mahoroba.org>
-which is based on the IPv6 code written by KIKUCHI Takahiro
-<kick@kyoto.wide.ad.jp>
-
diff --git a/saslauthd/INSTALL b/saslauthd/INSTALL
deleted file mode 100644
index ed6ed2ca..00000000
--- a/saslauthd/INSTALL
+++ /dev/null
@@ -1,3 +0,0 @@
-Follow the install documentation for SASL.  (saslauthd will install as 
-a part of the regular Cyrus SASL distribution as long as you configure
-SASL with --with-saslauthd)
diff --git a/saslauthd/Makefile.am b/saslauthd/Makefile.am
index b55fe369..2b45fc1b 100644
--- a/saslauthd/Makefile.am
+++ b/saslauthd/Makefile.am
@@ -2,6 +2,9 @@
 sbin_PROGRAMS	= saslauthd testsaslauthd
 EXTRA_PROGRAMS  = saslcache
 
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBOBJS_FULL = $(addprefix ${top_srcdir}/lib/,${LTLIBOBJS})
+
 saslauthd_SOURCES = mechanisms.c globals.h \
 		    mechanisms.h auth_dce.c auth_dce.h auth_getpwent.c \
 		    auth_getpwent.h auth_krb5.c auth_krb5.h auth_krb4.c \
@@ -13,10 +16,10 @@
                     ipc_unix.c ipc_doors.c saslauthd-main.c saslauthd-main.h \
 		    md5.c saslauthd_md5.h md5global.h 
 EXTRA_saslauthd_sources = getaddrinfo.c getnameinfo.c
-saslauthd_DEPENDENCIES = saslauthd-main.o @LTLIBOBJS@
+saslauthd_DEPENDENCIES = saslauthd-main.o $(LTLIBOBJS_FULL)
 saslauthd_LDADD	= @SASL_KRB_LIB@ \
 		  @GSSAPIBASE_LIBS@ @GSSAPI_LIBS@ @LIB_CRYPT@ @LIB_SIA@ \
-		  @LIB_SOCKET@ @SASL_DB_LIB@ @LIB_PAM@ @LDAP_LIBS@ @LTLIBOBJS@
+		  @LIB_SOCKET@ @SASL_DB_LIB@ @LIB_PAM@ @LDAP_LIBS@ $(LTLIBOBJS_FULL)
 
 testsaslauthd_SOURCES = testsaslauthd.c utils.c
 testsaslauthd_LDADD = @LIB_SOCKET@
diff --git a/saslauthd/NEWS b/saslauthd/NEWS
deleted file mode 100644
index 79b9a364..00000000
--- a/saslauthd/NEWS
+++ /dev/null
@@ -1,3 +0,0 @@
-New in v1.1.0
------------------
-- saslauthd now configures as a separate package.
diff --git a/saslauthd/README b/saslauthd/README
deleted file mode 100644
index f3184b6f..00000000
--- a/saslauthd/README
+++ /dev/null
@@ -1,4 +0,0 @@
-This directory contains the saslauthd daemon.  Similar to pwcheck, it
-allows password verification from a separate process.
-
-For more information, consult the main Cyrus SASL documentation.
diff --git a/saslauthd/auth_httpform.c b/saslauthd/auth_httpform.c
index 8dbf5518..b8e555ab 100644
--- a/saslauthd/auth_httpform.c
+++ b/saslauthd/auth_httpform.c
@@ -57,6 +57,8 @@
 #ident "$Id: auth_httpform.c,v 1.2 2006/04/19 19:51:04 murch Exp $"
 #endif
 
+#include <config.h>
+
 /* PUBLIC DEPENDENCIES */
 #include <unistd.h>
 #include <stdlib.h>
@@ -73,6 +75,7 @@
 #include <arpa/inet.h>
 #include <signal.h>
 #include <netdb.h>
+#include <stdio.h>
 
 #include "mechanisms.h"
 #include "utils.h"
diff --git a/saslauthd/auth_shadow.c b/saslauthd/auth_shadow.c
index 1988afdf..9bb0187a 100644
--- a/saslauthd/auth_shadow.c
+++ b/saslauthd/auth_shadow.c
@@ -31,6 +31,8 @@
 #ident "$Id: auth_shadow.c,v 1.12 2009/08/14 14:58:38 mel Exp $"
 #endif
 
+#include <config.h>
+
 /* PUBLIC DEPENDENCIES */
 #include "mechanisms.h"
 
diff --git a/saslauthd/cache.c b/saslauthd/cache.c
index 2b784647..543e1766 100644
--- a/saslauthd/cache.c
+++ b/saslauthd/cache.c
@@ -37,7 +37,7 @@
 /****************************************
  * includes
  *****************************************/
-#include "saslauthd.h"
+#include <config.h>
 
 #include <sys/stat.h>
 #include <sys/types.h>
diff --git a/saslauthd/cache.h b/saslauthd/cache.h
index 6a5707e2..b8c88382 100644
--- a/saslauthd/cache.h
+++ b/saslauthd/cache.h
@@ -41,7 +41,7 @@
 
 
 /* constant includes */
-#include "saslauthd.h"
+#include <config.h>
 
 
 /****************************************************************
diff --git a/saslauthd/configure.in b/saslauthd/configure.in
deleted file mode 100644
index f4bc3b56..00000000
--- a/saslauthd/configure.in
+++ /dev/null
@@ -1,340 +0,0 @@
-AC_INIT(mechanisms.h)
-AC_PREREQ([2.54])
-
-AC_CONFIG_AUX_DIR(config)
-AC_CANONICAL_HOST
-
-dnl Should we enable SASLAUTHd at all?
-AC_ARG_WITH(saslauthd, [  --with-saslauthd=DIR    enable use of the saslauth daemon using state dir DIR ],
-		with_saslauthd=$withval,
-		with_saslauthd=yes)
-  if test "$with_saslauthd" = yes; then
-    with_saslauthd="/var/state/saslauthd"
-  fi
-  AC_DEFINE(HAVE_SASLAUTHD,[],[Include support for saslauthd?])
-  AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd",[Location of saslauthd socket])
-AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no)
-
-AM_INIT_AUTOMAKE(saslauthd,2.1.26)
-CMU_INIT_AUTOMAKE
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_CPP
-AC_PROG_AWK
-AC_PROG_MAKE_SET
-AC_PROG_LN_S
-AC_PROG_INSTALL
-
-dnl Checks for build foo
-CMU_C___ATTRIBUTE__
-CMU_GUESS_RUNPATH_SWITCH
-
-dnl Checks for libraries.
-CMU_SOCKETS
-
-CMU_HAVE_OPENSSL
-AC_MSG_CHECKING(for OpenSSL)
-AC_MSG_RESULT($with_openssl)
-
-SASL_DES_CHK
-
-dnl mechanism-related checking
-SASL_KERBEROS_V4_CHK
-SASL_GSSAPI_CHK
-
-if test "$gssapi" != no; then
-	if test "$gss_impl" = "heimdal"; then
-	    AC_DEFINE(KRB5_HEIMDAL,[],[Using Heimdal])
-	fi
-	AC_DEFINE(HAVE_GSSAPI,[],[Include GSSAPI/Kerberos 5 Support])
-fi
-
-SASL2_CRYPT_CHK
-
-AC_ARG_ENABLE(sia, [  --enable-sia            enable SIA authentication [no] ],
-  sia=$enableval,
-  sia=no)
-LIB_SIA=""
-if test "$sia" != no; then
-  if test -f /etc/sia/matrix.conf; then
-    AC_DEFINE(HAVE_SIA,[],[Include SIA Support])
-    LIB_SIA="-lsecurity -ldb -lm -laud"
-  else
-    AC_ERROR([No support for SIA found])
-  fi
-fi
-AC_SUBST(LIB_SIA)
-
-AC_ARG_ENABLE(auth-sasldb, [  --enable-auth-sasldb    enable experimental SASLdb authentication module [no] ],
-  authsasldb=$enableval,
-  authsasldb=no)
-if test "$authsasldb" != no; then
-  if test ! -d "../sasldb"; then
-     echo "ERROR: Cannot build sasldb module outside of the full SASL source tree."
-     exit 0;
-  fi
-  AC_DEFINE(AUTH_SASLDB,[],[Include SASLdb Support])
-  SASL_DB_PATH_CHECK()
-  SASL_DB_CHECK()
-  SASL_DB_LIB="$SASL_DB_LIB ../sasldb/.libs/libsasldb.al"
-fi
-
-AC_ARG_ENABLE(httpform, [  --enable-httpform       enable HTTP form authentication [[no]] ],
-  httpform=$enableval,
-  httpform=no)
-if test "$httpform" != no; then
-  AC_DEFINE(HAVE_HTTPFORM,[],[Include HTTP form Support])
-fi
-
-AC_ARG_WITH(pam, [  --with-pam=DIR          use PAM (rooted in DIR) [yes] ],
-	with_pam=$withval,
-	with_pam=yes)
-if test "$with_pam" != no; then
-  if test -d $with_pam; then
-    CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
-    LDFLAGS="$LDFLAGS -L${with_pam}/lib"
-  fi
-  cmu_save_LIBS="$LIBS"
-  AC_CHECK_LIB(pam, pam_start, [
-	  AC_CHECK_HEADER(security/pam_appl.h,,
-			  with_pam=no)],
-		with_pam=no, $SASL_DL_LIB)
-  LIBS="$cmu_save_LIBS"
-fi
-
-AC_ARG_WITH(ipctype, [  --with-ipctype={unix,doors}    use ipctype [unix] ],
-	with_ipctype=$withval,
-	with_ipctype="unix")
-MAIN_COMPAT_OBJ="saslauthd-${with_ipctype}.o"
-AC_SUBST(MAIN_COMPAT_OBJ)
-if test "$with_ipctype" = "doors"; then
-  AC_DEFINE(USE_DOORS,[],[Use the doors IPC API])
-  AC_DEFINE(SASLAUTHD_THREADED,[],[Saslauthd runs threaded?])
-  LIBS="$LIBS -ldoor -lpthread"
-fi
-
-AC_MSG_CHECKING(for PAM support)
-AC_MSG_RESULT($with_pam)
-LIB_PAM=""
-if test "$with_pam" != no; then
-  AC_DEFINE(HAVE_PAM,[],[Support for PAM?])
-  LIB_PAM="-lpam"
-fi
-AC_SUBST(LIB_PAM)
-
-AC_CHECK_LIB(resolv, inet_aton)
-
-AC_MSG_CHECKING(to include LDAP support)
-AC_ARG_WITH(ldap, [  --with-ldap=DIR         use LDAP (in DIR) [no] ],
-	with_ldap=$withval,
-	with_ldap=no)
-AC_MSG_RESULT($with_ldap)
-
-if test -d $with_ldap; then
-    CPPFLAGS="$CPPFLAGS -I${with_ldap}/include"
-    CMU_ADD_LIBPATH(${with_ldap}/lib)
-fi
-
-LDAP_LIBS=""
-if test "$with_ldap" != no; then
-  AC_CHECK_LIB(ldap, ldap_initialize, [ AC_DEFINE(HAVE_LDAP,[],[Support for LDAP?])
-                                        LDAP_LIBS="-lldap -llber"
-					if test "$with_openssl" != "no"; then
-					    LDAP_LIBS="$LDAP_LIBS -lcrypto $LIB_RSAREF"
-					fi],,-llber)
-  
-fi
-AC_SUBST(LDAP_LIBS)
-
-
-dnl Checks for header files.
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_HEADER_TIME
-AC_CHECK_HEADERS(crypt.h fcntl.h krb5.h strings.h syslog.h unistd.h sys/time.h sys/uio.h)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST  
-AC_TYPE_PID_T
-
-LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
-AC_SUBST(LTLIBOBJS)
-
-dnl Checks for which function macros exist
-AC_MSG_CHECKING(whether $CC implements __func__)
-AC_CACHE_VAL(have_func,
-[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __func__);],
-have_func=yes,
-have_func=no)])
-AC_MSG_RESULT($have_func)
-if test "$have_func" = yes; then
-       AC_DEFINE(HAVE_FUNC,[],[Does the compiler understand __func__])
-else
-       AC_MSG_CHECKING(whether $CC implements __PRETTY_FUNCTION__)
-       AC_CACHE_VAL(have_pretty_function,
-       [AC_TRY_LINK([#include <stdio.h>],[printf("%s", __PRETTY_FUNCTION__);],
-       have_pretty_function=yes,
-       have_pretty_function=no)])
-       AC_MSG_RESULT($have_pretty_function)
-       if test "$have_pretty_function" = yes; then
-               AC_DEFINE(HAVE_PRETTY_FUNCTION,[],[Does compiler understand __PRETTY_FUNCTION__])
-       else
-               AC_MSG_CHECKING(whether $CC implements __FUNCTION__)
-               AC_CACHE_VAL(have_function,
-               [AC_TRY_LINK([#include <stdio.h>],[printf("%s", __FUNCTION__);],
-               have_function=yes,
-               have_function=no)])
-               AC_MSG_RESULT($have_function)
-               if test "$have_function" = yes; then
-                       AC_DEFINE(HAVE_FUNCTION,[],[Does compiler understand __FUNCTION__])
-               fi
-       fi
-fi
-
-dnl Checks for library functions.
-AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(gethostname mkdir socket strdup)
-dnl Only look for one or the other
-AC_CHECK_FUNCS(getspnam getuserpw, break)
-AC_CHECK_FUNCS(asprintf strlcat strlcpy)
-
-if test $ac_cv_func_getspnam = yes; then
-	AC_MSG_CHECKING(if getpwnam_r/getspnam_r take 5 arguments)
-	AC_TRY_COMPILE(
-		[
-#include <sys/types.h>
-#include <pwd.h>
-#include <shadow.h>
-		],
-		[
-struct passwd *pw;
-struct passwd pwbuf;
-char pwdata[512];
-(void) getpwnam_r("bin", &pwbuf, pwdata, sizeof(pwdata), &pw);
-		],
-		[AC_MSG_RESULT(yes)
-		 AC_DEFINE(GETXXNAM_R_5ARG, 1,
-			[Define if your getpwnam_r()/getspnam_r()
-			functions take 5 arguments])],
-		[AC_MSG_RESULT(no)]
-	)
-fi
-
-dnl Check for getaddrinfo
-GETADDRINFOOBJS=""
-sasl_cv_getaddrinfo=no
-IPv6_CHECK_FUNC(getaddrinfo,
-		[AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo() function?])], [sasl_cv_getaddrinfo=yes])
-if test $sasl_cv_getaddrinfo = yes; then
-	AC_LIBOBJ(getaddrinfo)
-fi
-
-dnl Check for getnameinfo
-GETNAMEINFOOBJS=""
-sasl_cv_getnameinfo=no
-IPv6_CHECK_FUNC(getnameinfo,
-		[AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo() function?])], [sasl_cv_getnameinfo=yes])
-if test $sasl_cv_getnameinfo = yes; then
-	AC_LIBOBJ(getnameinfo)
-fi
-
-IPv6_CHECK_SS_FAMILY()
-IPv6_CHECK_SA_LEN()
-IPv6_CHECK_SOCKLEN_T()
-
-AC_EGREP_HEADER(sockaddr_storage, sys/socket.h,
-                AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have a sockaddr_storage struct?]))
-
-AH_TOP([
-#ifndef _SASLAUTHD_H
-#define _SASLAUTHD_H
-
-#include <stdio.h>
-])
-
-AH_BOTTOM([
-
-#ifndef HAVE___ATTRIBUTE__
-/* Can't use attributes... */
-#define __attribute__(foo)
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#ifndef WIN32
-# include <netdb.h>   
-# include <sys/param.h>
-#else /* WIN32 */
-# include <winsock2.h>
-#endif /* WIN32 */ 
-#include <string.h>
-
-#include <netinet/in.h>
-
-#ifndef HAVE_SOCKLEN_T
-typedef unsigned int socklen_t;
-#endif /* HAVE_SOCKLEN_T */
-
-#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
-#define _SS_MAXSIZE     128     /* Implementation specific max size */
-#define _SS_PADSIZE     (_SS_MAXSIZE - sizeof (struct sockaddr))
-
-struct sockaddr_storage {
-        struct  sockaddr ss_sa;
-        char            __ss_pad2[_SS_PADSIZE];
-};
-# define ss_family ss_sa.sa_family
-#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
-
-#ifndef AF_INET6
-/* Define it to something that should never appear */
-#define AF_INET6        AF_MAX
-#endif
-
-/* Create a struct iovec if we need one */
-#if !defined(HAVE_SYS_UIO_H)
-struct iovec {
-    long iov_len;
-    char *iov_base;
-};
-#else
-#include <sys/types.h>
-#include <sys/uio.h>
-#endif
-
-#ifndef HAVE_GETADDRINFO
-#define getaddrinfo     sasl_getaddrinfo
-#define freeaddrinfo    sasl_freeaddrinfo
-#define getnameinfo     sasl_getnameinfo
-#define gai_strerror    sasl_gai_strerror
-#include "gai.h"
-#endif
-
-#ifndef AI_NUMERICHOST   /* support glibc 2.0.x */
-#define	AI_NUMERICHOST	4
-#define NI_NUMERICHOST	2
-#define NI_NAMEREQD	4
-#define NI_NUMERICSERV	8
-#endif
-
-/* handy string manipulation functions */
-#ifndef HAVE_STRLCPY
-extern size_t saslauthd_strlcpy(char *dst, const char *src, size_t len);
-#define strlcpy(x,y,z) saslauthd_strlcpy((x),(y),(z))
-#endif
-#ifndef HAVE_STRLCAT
-extern size_t saslauthd_strlcat(char *dst, const char *src, size_t len);
-#define strlcat(x,y,z) saslauthd_strlcat((x),(y),(z))
-#endif
-#ifndef HAVE_ASPRINTF
-extern int asprintf(char **str, const char *fmt, ...);
-#endif
-
-#endif
-])
-
-AC_CONFIG_HEADERS(saslauthd.h)
-
-AC_OUTPUT(Makefile)
diff --git a/saslauthd/mechanisms.h b/saslauthd/mechanisms.h
index e2323bf5..3ed8d1c0 100644
--- a/saslauthd/mechanisms.h
+++ b/saslauthd/mechanisms.h
@@ -32,7 +32,7 @@
 #ifndef _MECHANISMS_H
 #define _MECHANISMS_H
 
-#include "saslauthd.h"
+#include <config.h>
 
 /* PUBLIC DEPENDENCIES */
 /* Authentication mechanism dispatch table definition */
diff --git a/saslauthd/saslauthd-main.h b/saslauthd/saslauthd-main.h
index 87d223b3..754626c6 100644
--- a/saslauthd/saslauthd-main.h
+++ b/saslauthd/saslauthd-main.h
@@ -45,8 +45,9 @@
 #ifndef _SASLAUTHDMAIN_H
 #define _SASLAUTHDMAIN_H
 
+#include <config.h>
+
 #include <sys/types.h>
-#include "saslauthd.h"
 
 /****************************************************************
  * Plug in some autoconf magic to determine what IPC method
diff --git a/saslauthd/testsaslauthd.c b/saslauthd/testsaslauthd.c
index f1e837a7..368af76d 100644
--- a/saslauthd/testsaslauthd.c
+++ b/saslauthd/testsaslauthd.c
@@ -41,7 +41,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <saslauthd.h>
+#include <config.h>
 #include <stdio.h>
 
 #include <errno.h>
diff --git a/saslauthd/utils.h b/saslauthd/utils.h
index a2556c42..dc3a9a3e 100644
--- a/saslauthd/utils.h
+++ b/saslauthd/utils.h
@@ -45,12 +45,11 @@
 #ifndef _UTILS_H
 #define _UTILS_H
 
+#include <config.h>
 
 #include <syslog.h>
 #include <sys/types.h>
 #include <sys/uio.h>
-#include "saslauthd.h"
-
 
 /* log prioities */
 #define L_ERR			LOG_ERR
