[Date Prev][Date Next] [Chronological] [Thread] [Top]

Patches for 2.0.7 (need testers - Tru64 UNIX, HP-UX)



Before submitting these patches to ITS, I would like folks to test
them out. This should make building on Tru64 UNIX and HP-UX 10.20
work. It contains the following:
  0. Clean up OL_ARG_WITH (alignment issues with --help)
  1. Reintroduction of OL_FUNC_CTIME_R_TYPE and a proper autoconf
     fix
  2. Better TCP wrappers test
  3. Autoconf test for OL_BERKELEY_DB_THREAD should all the
     threading options if detected
  4. Better tests for OL_FUNC_GETHOSTBYNAME_R_NARGS and
     OL_FUNC_GETHOSTBYADDR_R_NARGS to determine the number
     of arguments each function takes. On Tru64 UNIX and HP-UX,
     gethostbyname_r takes 3 arguments.
  5. Better -lsocket and -lnsl checks

-- 
albert chin (china@thewrittenword.com)

-- snip snip
--- configure.in.orig	Fri Dec 29 03:06:43 2000
+++ configure.in	Tue Jan 23 11:34:14 2001
@@ -113,22 +113,25 @@
 
 dnl ----------------------------------------------------------------
 dnl General "with" options
-dnl OL_ARG_ENABLE(dmalloc,[  --enable-dmalloc	  enable debug malloc support], no)dnl
-
-OL_ARG_WITH(cyrus_sasl,[  --with-cyrus-sasl	  with Cyrus SASL support],
-	auto, [auto yes no] )
-OL_ARG_WITH(fetch,[  --with-fetch		  with fetch URL support],
-	auto, [auto yes no] )
-OL_ARG_WITH(kerberos,[  --with-kerberos	  with support],
-	auto, [auto k5 k5only k425 kth k4 afs yes no])
-OL_ARG_WITH(readline,[  --with-readline	  with readline support],
-	auto, [auto yes no] )
-OL_ARG_WITH(threads,[  --with-threads	  with threads],
-	auto, [auto nt posix mach pth lwp yes no manual] )
-OL_ARG_WITH(tls,[  --with-tls		  with TLS/SSL support],
-	auto, [auto ssleay openssl yes no] )
-OL_ARG_WITH(yielding_select,[  --with-yielding-select  with implicitly yielding select],
-	auto, [auto yes no manual] )
+dnl OL_ARG_ENABLE(dmalloc, [  --enable-dmalloc        enable debug malloc support], no)
+OL_ARG_WITH(cyrus_sasl,
+[  --with-cyrus-sasl       with Cyrus SASL support], auto, [auto yes no])
+OL_ARG_WITH(fetch,
+[  --with-fetch            with fetch URL support], auto, [auto yes no])
+OL_ARG_WITH(kerberos,
+[  --with-kerberos         with support],
+auto, [auto k5 k5only k425 kth k4 afs yes no])
+OL_ARG_WITH(readline,
+[  --with-readline         with readline support in DIR], auto, [auto yes no])
+OL_ARG_WITH(threads,
+[  --with-threads          with threads],
+auto, [auto nt posix mach pth lwp yes no manual])
+OL_ARG_WITH(tls,
+[  --with-tls              with TLS/SSL support],
+auto, [auto ssleay openssl yes no])
+OL_ARG_WITH(yielding_select,
+[  --with-yielding-select  with implicitly yielding select],
+auto, [auto yes no manual] )
 
 dnl ----------------------------------------------------------------
 dnl Server options
@@ -137,42 +140,66 @@
 dnl ----------------------------------------------------------------
 dnl SLAPD OPTIONS
 AC_ARG_WITH(xxslapdoptions,[SLAPD (Standalone LDAP Daemon) Options:])
-OL_ARG_ENABLE(slapd,[  --enable-slapd	  enable building slapd], yes)dnl
-OL_ARG_ENABLE(cleartext,[    --enable-cleartext	  enable cleartext passwords], yes)dnl
-OL_ARG_ENABLE(crypt,[    --enable-crypt	  enable crypt(3) passwords], auto)dnl
-OL_ARG_ENABLE(kpasswd,[    --enable-kpasswd	  enable kerberos password verification], no)dnl
-OL_ARG_ENABLE(spasswd,[    --enable-spasswd	  enable (Cyrus) SASL password verification], no)dnl
-OL_ARG_ENABLE(modules,[    --enable-modules	  enable dynamic module support], no)dnl
-OL_ARG_ENABLE(multimaster,[    --enable-multimaster  enable multimaster replication], no)dnl
-OL_ARG_ENABLE(phonetic,[    --enable-phonetic	  enable phonetic/soundex], no)dnl
-OL_ARG_ENABLE(rlookups,[    --enable-rlookups	  enable reverse lookups], auto)dnl
-OL_ARG_ENABLE(aci,[    --enable-aci	  enable per-object ACIs], no)dnl
-OL_ARG_ENABLE(wrappers,[    --enable-wrappers	  enable tcp wrapper support], no)dnl
-OL_ARG_ENABLE(dynamic,[    --enable-dynamic	  enable linking built binaries with dynamic libs], no)dnl
+OL_ARG_ENABLE(slapd,
+[  --enable-slapd          enable building slapd], yes)dnl
+OL_ARG_ENABLE(cleartext,
+[  --enable-cleartext      enable cleartext passwords], yes)dnl
+OL_ARG_ENABLE(crypt,
+[  --enable-crypt          enable crypt(3) passwords], auto)dnl
+OL_ARG_ENABLE(kpasswd,
+[  --enable-kpasswd        enable kerberos password verification], no)dnl
+OL_ARG_ENABLE(spasswd,
+[  --enable-spasswd        enable (Cyrus) SASL password verification], no)
+OL_ARG_ENABLE(modules,
+[  --enable-modules        enable dynamic module support], no)
+OL_ARG_ENABLE(multimaster,
+[  --enable-multimaster    enable multimaster replication], no)
+OL_ARG_ENABLE(phonetic,
+[  --enable-phonetic       enable phonetic/soundex], no)
+OL_ARG_ENABLE(rlookups,
+[  --enable-rlookups       enable reverse lookups], auto)
+OL_ARG_ENABLE(aci,
+[  --enable-aci            enable per-object ACIs], no)
+OL_ARG_ENABLE(wrappers,
+[  --enable-wrappers       enable tcp wrapper support], no)
+OL_ARG_ENABLE(dynamic,
+[  --enable-dynamic        enable linking built binaries with dynamic libs], no)
 
 dnl SLAPD Backend options
-OL_ARG_ENABLE(dnssrv,[    --enable-dnssrv	  enable dnssrv backend], no)dnl
-OL_ARG_WITH(dnssrv_module,[    --with-dnssrv-module  module type], static,
-	[static dynamic])
-OL_ARG_ENABLE(ldap,[    --enable-ldap	  enable ldap backend], no)dnl
-OL_ARG_WITH(ldap_module,[    --with-ldap-module	  module type], static,
-	[static dynamic])
-OL_ARG_ENABLE(ldbm,[    --enable-ldbm	  enable ldbm backend], yes)dnl
-OL_ARG_WITH(ldbm_api,[    --with-ldbm-api       with LDBM API], auto,
-	[auto berkeley bcompat mdbm gdbm])
-OL_ARG_WITH(ldbm_module,[    --with-ldbm-module	  module type], static,
-	[static dynamic])
-OL_ARG_WITH(ldbm_type,[    --with-ldbm-type	  use LDBM type], auto,
-	[auto btree hash])
-OL_ARG_ENABLE(passwd,[    --enable-passwd	  enable passwd backend], no)dnl
-OL_ARG_WITH(passwd_module,[    --with-passwd-module  module type], static,
-	[static dynamic])
-OL_ARG_ENABLE(shell,[    --enable-shell	  enable shell backend], no)dnl
-OL_ARG_WITH(shell_module,[    --with-shell-module	  module type], static,
+OL_ARG_ENABLE(dnssrv,
+[  --enable-dnssrv         enable dnssrv backend], no)dnl
+OL_ARG_WITH(dnssrv_module,
+[  --with-dnssrv-module    module type], static,
 	[static dynamic])
-OL_ARG_ENABLE(sql,[    --enable-sql	  enable sql backend], no)dnl
-OL_ARG_WITH(sql_module,[    --with-sql-module	  module type], static,
+OL_ARG_ENABLE(ldap,
+[  --enable-ldap           enable ldap backend], no)dnl
+OL_ARG_WITH(ldap_module,
+[  --with-ldap-module      module type], static,
 	[static dynamic])
+OL_ARG_ENABLE(ldbm,
+[  --enable-ldbm           enable ldbm backend], yes)dnl
+OL_ARG_WITH(ldbm_api,
+[  --with-ldbm-api         with LDBM API], auto,
+[auto berkeley bcompat mdbm gdbm])
+OL_ARG_WITH(ldbm_module,
+[  --with-ldbm-module      module type], static, [static dynamic])
+OL_ARG_WITH(ldbm_type,
+[  --with-ldbm-type        use LDBM type], auto,
+[auto btree hash])
+OL_ARG_ENABLE(passwd,
+[  --enable-passwd         enable passwd backend], no)dnl
+OL_ARG_WITH(passwd_module,
+[  --with-passwd-module    module type], static, [static dynamic])
+OL_ARG_ENABLE(shell,
+[  --enable-shell          enable shell backend], no)dnl
+OL_ARG_WITH(shell_module,
+[  --with-shell-module     module type], static,
+[static dynamic])
+OL_ARG_ENABLE(sql,
+[  --enable-sql            enable sql backend], no)dnl
+OL_ARG_WITH(sql_module,
+[  --with-sql-module       module type], static,
+[static dynamic])
 
 dnl ----------------------------------------------------------------
 dnl SLURPD OPTIONS
@@ -659,15 +686,8 @@
 dnl		-lsocket [ -lnsl_s | -lnsl ]
 dnl		-linet
 
-AC_CHECK_FUNC(socket, :, [	
-dnl hopefully we won't include too many libraries
-	AC_CHECK_LIB(socket, main)
-	AC_CHECK_LIB(net, main)
-	AC_CHECK_LIB(nsl_s, main)
-	AC_CHECK_LIB(nsl, main)
-	AC_CHECK_LIB(inet, socket)
-	AC_CHECK_LIB(gen, main)
-])
+AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
+AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
 
 dnl require select
 AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.]))
@@ -1004,7 +1024,7 @@
 	ol_cv_func_ctime_r_nargs=0
 else
 	OL_FUNC_CTIME_R_NARGS
-dnl	OL_FUNC_CTIME_R_TYPE
+	OL_FUNC_CTIME_R_TYPE
 fi
 
 if test "$ac_cv_func_gethostbyname_r" = yes ; then
@@ -1691,33 +1711,45 @@
 
 dnl ----------------------------------------------------------------
 if test $ol_enable_wrappers != no ; then
-	AC_CHECK_HEADERS(tcpd.h)
-
-	if test $ac_cv_header_tcpd_h != yes ; then
 		have_wrappers=no
-	else
-		AC_TRY_COMPILE([
+	AC_CHECK_HEADERS(tcpd.h,
+		AC_MSG_CHECKING([for TCP wrappers library -lwrap])
+		_libs=${LIBS}
+		LIBS="${LIBS} -lwrap"
+		AC_TRY_LINK([#include <tcpd.h>
 int allow_severity = 0;
 int deny_severity  = 0;
-		],[hosts_access()],[have_wrappers=yes],[have_wrappers=no])
-	fi
+
+struct request_info *req;], [
+		hosts_access(req)], [
+		AC_MSG_RESULT(yes)
+		have_wrappers=yes
+		LIBS=${_libs}], [
+
+		# try with -lnsl
+		LIBS="${LIBS} -lnsl"
+		AC_TRY_LINK([#include <tcpd.h>
+int allow_severity = 0;
+int deny_severity  = 0;
+
+struct request_info *req;], [
+		hosts_access(req)], [
+
+		AC_MSG_RESULT(yes)
+		have_wrappers=yes
+		LIBS="${_libs} -lnsl"], [
+
+		AC_MSG_RESULT(no)
+		have_wrappers=no
+		LIBS=${_libs}])],
+
+		have_wrappers=no))
 
 	if test $have_wrappers = yes ; then
 		AC_DEFINE(HAVE_TCPD,1, [define if you have -lwrap])
 		WRAP_LIBS="-lwrap"
-
-		dnl We add another check for -lnsl since some libwrap's
-		dnl need it, but it isn't always included from above
-		AC_CHECK_LIB(nsl, main)
 	else
-		AC_MSG_WARN(could not find -lwrap)
-		if test $ol_enable_wrappers = yes ; then
-			AC_MSG_ERROR(could not find wrappers, select appropriate options or disable)
-		fi
-
-		AC_MSG_WARN(disabling wrappers support)
-		ol_enable_wrappers=no
-		WRAP_LIBS=""
+		AC_MSG_ERROR(could not find -lwrap. rerun without --enable-wrappers)
 	fi
 fi
 
--- build/openldap.m4.orig	Fri Dec 29 04:21:44 2000
+++ build/openldap.m4	Tue Jan 23 11:50:17 2001
@@ -297,10 +297,14 @@
 dnl --------------------------------------------------------------------
 dnl Check if Berkeley DB supports DB_THREAD
 AC_DEFUN([OL_BERKELEY_DB_THREAD],
-[AC_CACHE_CHECK([for Berkeley DB thread support], [ol_cv_berkeley_db_thread], [
+[AC_CACHE_CHECK([for Berkeley DB thread support],
+	[ol_cv_berkeley_db_thread],[
 	ol_LIBS="$LIBS"
 	if test $ol_cv_lib_db != yes ; then
-		LIBS="$ol_cv_lib_db"
+		LIBS="$ol_cv_lib_db $LIBS"
+	fi
+	if test "$ol_link_threads" != no ; then
+		LIBS="$LIBS $ol_link_pthreads"
 	fi
 
 	AC_TRY_RUN([
@@ -952,31 +956,38 @@
 dnl ====================================================================
 dnl check no of arguments for ctime_r
 AC_DEFUN(OL_FUNC_CTIME_R_NARGS,
- [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
-   [AC_TRY_COMPILE([#include <time.h>],
-		[time_t ti; char *buffer; ctime_r(&ti,buffer,32);],
-			ol_cv_func_ctime_r_nargs3=yes,
-			ol_cv_func_ctime_r_nargs3=no)
-
-	AC_TRY_COMPILE([#include <time.h>],
-		[time_t ti; char *buffer; ctime_r(&ti,buffer);],
-			ol_cv_func_ctime_r_nargs2=yes,
-			ol_cv_func_ctime_r_nargs2=no)
-
-	if test $ol_cv_func_ctime_r_nargs3 = yes -a \
-		$ol_cv_func_ctime_r_nargs2 = no ; then
-
-		ol_cv_func_ctime_r_nargs=3
+ [AC_CACHE_CHECK(number of arguments of ctime_r,
+	ol_cv_func_ctime_r_nargs,[
+	ol_cv_func_ctime_r_nargs=0
+
+	# some C compilers won't complain if a prototype is
+	# not available so we EGREP_CPP with and without
+	# _REENTRANT to determine if we need it defined
+	AC_EGREP_CPP(ctime_r, [#include <time.h>], ,[
+		AC_EGREP_CPP(ctime_r, [
+#define _REENTRANT
+#include <time.h>], AC_DEFINE(NEED_REENTRANT))])
 
-	elif test $ol_cv_func_ctime_r_nargs3 = no -a \
-		$ol_cv_func_ctime_r_nargs2 = yes ; then
+	AC_TRY_COMPILE([
+#ifdef NEED_REENTRANT
+#define _REENTRANT
+#endif
 
-		ol_cv_func_ctime_r_nargs=2
+#include <time.h>],[
+time_t ti;
+char *buffer=NULL;
+ctime_r(&ti,buffer,32)],
+	ol_cv_func_ctime_r_nargs=3,[
+	AC_TRY_COMPILE([
+#ifdef NEED_REENTRANT
+#define _REENTRANT
+#endif
 
-	else
-		ol_cv_func_ctime_r_nargs=0
-	fi
-  ])
+#include <time.h>],[
+time_t ti;
+char *buffer=NULL;
+ctime_r(&ti,buffer)],
+	ol_cv_func_ctime_r_nargs=2)])])
 
   if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
  	AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
@@ -988,10 +999,21 @@
 dnl check return type of ctime_r()
 AC_DEFUN(OL_FUNC_CTIME_R_TYPE,
  [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
-   [AC_TRY_COMPILE([#include <time.h>],
-		[extern int (ctime_r)();],
-			ol_cv_func_ctime_r_type="int", ol_cv_func_ctime_r_type="charp")
-	])
+   [AC_TRY_COMPILE([
+#ifdef NEED_REENTRANT
+#define _REENTRANT
+#endif
+
+#include <time.h>],
+		[
+#if CTIME_R_NARGS == 3
+extern int ctime_r (const time_t *, char *, int);
+#else
+extern int ctime_r (const time_t *, char *);
+#endif],
+		ol_cv_func_ctime_r_type="int",
+		ol_cv_func_ctime_r_type="charp")])
+
   if test $ol_cv_func_ctime_r_type = "int" ; then
 	AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
   fi
@@ -1001,45 +1023,72 @@
 AC_DEFUN(OL_FUNC_GETHOSTBYNAME_R_NARGS,
  [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
 	ol_cv_func_gethostbyname_r_nargs,
-	[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+	ol_cv_func_gethostbyname_r_nargs=0
+	[AC_TRY_RUN([
+#include <string.h>
+#include <sys/types.h>
 #include <netdb.h>
-#define BUFSIZE (sizeof(struct hostent)+10)],
-		[struct hostent hent; char buffer[BUFSIZE];
-		int bufsize=BUFSIZE;int h_errno;
-		(void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
-			buffer, bufsize, &h_errno);],
-		ol_cv_func_gethostbyname_r_nargs5=yes, 
-		ol_cv_func_gethostbyname_r_nargs5=no)
 
-	AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+int
+main () {
+struct hostent h;
+struct hostent_data hdata;
+char *name = "localhost";
+int rc;
+memset(&h, 0, sizeof(struct hostent));
+memset(&hdata, 0, sizeof(struct hostent_data));
+rc = gethostbyname_r(name, &h, &hdata);
+exit (rc != 0 ? 1 : 0); }],
+	ol_cv_func_gethostbyname_r_nargs=3,[
+	AC_TRY_RUN([
+#define _REENTRANT
+
+#include <string.h>
+#include <sys/types.h>
 #include <netdb.h>
-#define BUFSIZE (sizeof(struct hostent)+10)],
-		[struct hostent hent;struct hostent *rhent;
-		char buffer[BUFSIZE];
-		int bufsize=BUFSIZE;int h_errno;
-		(void)gethostbyname_r("localhost", &hent, buffer, bufsize,
-			&rhent, &h_errno);],
-		ol_cv_func_gethostbyname_r_nargs6=yes,
-		ol_cv_func_gethostbyname_r_nargs6=no)
-
-	if test $ol_cv_func_gethostbyname_r_nargs5 = yes -a \
-		$ol_cv_func_gethostbyname_r_nargs6 = no ; then
 
-		ol_cv_func_gethostbyname_r_nargs=5
+int
+main () {
+struct hostent h;
+struct hostent_data hdata;
+char *name = "localhost";
+int rc;
+memset(&h, 0, sizeof(struct hostent));
+memset(&hdata, 0, sizeof(struct hostent_data));
+rc = gethostbyname_r(name, &h, &hdata);
+exit (rc != 0 ? 1 : 0); }],[
+	ol_cv_func_gethostbyname_r_nargs=3
+	AC_DEFINE(NEED_REENTRANT)],[
+	AC_TRY_RUN([
+#include <sys/types.h>
+#include <netdb.h>
 
-	elif test $ol_cv_func_gethostbyname_r_nargs5 = no -a \
-		$ol_cv_func_gethostbyname_r_nargs6 = yes ; then
+int
+main () {
+struct hostent *hp;
+struct hostent h;
+char *name = "localhost";
+char buffer[8192];
+int h_errno;
+hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
+exit (hp == NULL ? 1 : 0); }],
+	ol_cv_func_gethostbyname_r_nargs=5,[
+	AC_TRY_RUN([
+#include <sys/types.h>
+#include <netdb.h>
 
-		ol_cv_func_gethostbyname_r_nargs=6
+int
+main () {
+struct hostent h;
+struct hostent *hp;
+char *name = "localhost";
+char buf[8192];
+int rc;
+int h_errno;
+rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
+exit (rc != 0 ? 1 : 0); }],
+	ol_cv_func_gethostbyname_r_nargs=6)])])])])
 
-	else
-		ol_cv_func_gethostbyname_r_nargs=0
-	fi
-  ])
   if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
 	AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
 		$ol_cv_func_gethostbyname_r_nargs,
@@ -1050,51 +1099,62 @@
 dnl check no of arguments for gethostbyaddr_r
 AC_DEFUN(OL_FUNC_GETHOSTBYADDR_R_NARGS,
  [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
-	[ol_cv_func_gethostbyaddr_r_nargs],
-	[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#define BUFSIZE (sizeof(struct hostent)+10)],
-	   [struct hostent hent; char buffer[BUFSIZE]; 
-	    struct in_addr add;
-	    size_t alen=sizeof(struct in_addr);
-	    int bufsize=BUFSIZE;int h_errno;
-		(void)gethostbyaddr_r( (void *)&(add.s_addr),
-			alen, AF_INET, &hent, buffer, bufsize, &h_errno);],
-		ol_cv_func_gethostbyaddr_r_nargs7=yes,
-		ol_cv_func_gethostbyaddr_r_nargs7=no)
-
-	AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#define BUFSIZE (sizeof(struct hostent)+10)],
-		[struct hostent hent;
-		struct hostent *rhent; char buffer[BUFSIZE]; 
-		struct in_addr add;
-		size_t alen=sizeof(struct in_addr);
-		int bufsize=BUFSIZE;int h_errno;
-		(void)gethostbyaddr_r( (void *)&(add.s_addr),
-			alen, AF_INET, &hent, buffer, bufsize, 
-			&rhent, &h_errno);],
-		ol_cv_func_gethostbyaddr_r_nargs8=yes,
-		ol_cv_func_gethostbyaddr_r_nargs8=no)
-
-	if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes -a \
-		$ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
-
-		ol_cv_func_gethostbyaddr_r_nargs=7
-
-	elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no -a \
-		$ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
-
-		ol_cv_func_gethostbyaddr_r_nargs=8
+	[ol_cv_func_gethostbyaddr_r_nargs],[
+	ol_cv_func_gethostbyaddr_r_nargs=0
+	AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+struct hostent_data hdata;
+int rc;
+rc = gethostbyaddr_r(address, length, type, &h, &hdata);],
+	ol_cv_func_gethostbyaddr_r_nargs=5,[
+	AC_TRY_COMPILE([
+#define _REENTRANT
+#include <sys/types.h>
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+struct hostent_data hdata;
+int rc;
+rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
+	ol_cv_func_gethostbyaddr_r_nargs=5
+	AC_DEFINE(NEED_REENTRANT)],[
+	AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+char buffer[8192];
+int h_errnop;
+struct hostent * hp;
+
+hp = gethostbyaddr_r(address, length, type, &h,
+                     buffer, 8192, &h_errnop);],
+	ol_cv_func_gethostbyaddr_r_nargs=7,[
+	AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+char buffer[8192];
+int h_errnop;
+struct hostent * hp;
+int rc;
+
+rc = gethostbyaddr_r(address, length, type, &h,
+                     buffer, 8192, &hp, &h_errnop);],
+	ol_cv_func_gethostbyaddr_r_nargs=8)])])])])
 
-	else
-		ol_cv_func_gethostbyaddr_r_nargs=0
-	fi
-  ])
   if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
     AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
 		$ol_cv_func_gethostbyaddr_r_nargs,
--- include/portable.h.in.orig	Fri Dec 29 05:29:32 2000
+++ include/portable.h.in	Fri Dec 29 05:30:42 2000
@@ -135,6 +135,9 @@
 /* Define if you have the ctime_r function.  */
 #undef HAVE_CTIME_R
 
+/* Define if your ctime_r() returns int.  */
+#undef CTIME_R_RETURNS_INT
+
 /* Define if you have the endgrent function.  */
 #undef HAVE_ENDGRENT
 
--- libraries/libldap/util-int.c.orig	Fri Dec 29 05:00:27 2000
+++ libraries/libldap/util-int.c	Wed Jan 24 00:25:14 2001
@@ -45,12 +45,12 @@
 #endif
 
 #if defined(HAVE_GETHOSTBYNAME_R) && \
-    (GETHOSTBYNAME_R_NARGS > 6 || GETHOSTBYNAME_R_NARGS < 5)
+    (GETHOSTBYNAME_R_NARGS > 6 || GETHOSTBYNAME_R_NARGS < 3)
 	/* Don't know how to handle this version, pretend it's not there */
 #	undef HAVE_GETHOSTBYNAME_R
 #endif
 #if defined(HAVE_GETHOSTBYADDR_R) && \
-    (GETHOSTBYADDR_R_NARGS > 8 || GETHOSTBYADDR_R_NARGS < 7)
+    (GETHOSTBYADDR_R_NARGS > 8 || GETHOSTBYADDR_R_NARGS < 5)
 	/* Don't know how to handle this version, pretend it's not there */
 #	undef HAVE_GETHOSTBYADDR_R
 #endif
@@ -118,13 +118,16 @@
 		if (safe_realloc( buf, buflen )==NULL)
 			return r;
 
-#if (GETHOSTBYNAME_R_NARGS < 6)
+#if (GETHOSTBYNAME_R_NARGS == 6)
+		r = gethostbyname_r( name, resbuf, *buf,
+			buflen, result, herrno_ptr );
+#elif (GETHOSTBYNAME_R_NARGS == 5)
 		r = ((*result=gethostbyname_r( name, resbuf, *buf,
 					       buflen, herrno_ptr ))== NULL) ?
 		    -1 : 0;
-#else
-		r = gethostbyname_r( name, resbuf, *buf,
-			buflen, result, herrno_ptr );
+#elif (GETHOSTBYNAME_R_NARGS == 3)
+		r = gethostbyname_r( name, resbuf,
+				     (struct hostent_data *)*buf );
 #endif
 
 		Debug( LDAP_DEBUG_TRACE, "ldap_pvt_gethostbyname_a: host=%s, r=%d\n",
@@ -199,12 +202,15 @@
 	for(;buflen<BUFMAX;) {
 		if (safe_realloc( buf, buflen )==NULL)
 			return r;
-#if (GETHOSTBYADDR_R_NARGS < 8)
+#if (GETHOSTBYADDR_R_NARGS == 7)
 		r = ((*result=gethostbyaddr_r( addr, len, type,
 					       resbuf, *buf, buflen, 
 					       herrno_ptr )) == NULL) ?
 		    -1 : 0;
-#else
+#elif (GETHOSTBYADDR_R_NARGS == 5)
+		memset (*buf, 0, buflen);
+		r = gethostbyaddr_r( addr, len, type, resbuf, *buf );
+#elif (GETHOSTBYADDR_R_NARGS == 8)
 		r = gethostbyaddr_r( addr, len, type,
 			resbuf, *buf, buflen, 
 			result, herrno_ptr );