]> git.sur5r.net Git - openldap/blobdiff - configure
fix attribute description parsing (ITS#5402)
[openldap] / configure
index 2657cd8e1cff8542944c883cdcef7c35673ef1c2..a5300692e63039d5fcedb7b04a18cba6be1aa9aa 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,9 +1,9 @@
 #! /bin/sh
-# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.635 2006/07/26 00:55:07 hyc Exp .
+# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.660 2007/09/07 10:02:43 hyc Exp .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
-# Copyright 1998-2006 The OpenLDAP Foundation. All rights reserved.
+# Copyright 1998-2008 The OpenLDAP Foundation. All rights reserved.
 # Restrictions apply, see COPYRIGHT and LICENSE files.
 #
 # Copyright (C) 2003 Free Software Foundation, Inc.
@@ -465,7 +465,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar OPENLDAP_LIBRELEASE OPENLDAP_LIBVERSION OPENLDAP_RELEASE_DATE top_builddir ldap_subdir CC AR CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP LIBTOOL PERLBIN OL_MKDEP OL_MKDEP_FLAGS LTSTATIC LIBOBJS LIBSRCS PLAT WITH_SASL WITH_TLS WITH_MODULES_ENABLED WITH_ACI_ENABLED BUILD_THREAD BUILD_LIBS_DYNAMIC BUILD_SLAPD BUILD_SLAPI SLAPD_SLAPI_DEPEND BUILD_BDB BUILD_DNSSRV BUILD_HDB BUILD_LDAP BUILD_META BUILD_MONITOR BUILD_NULL BUILD_PASSWD BUILD_RELAY BUILD_PERL BUILD_SHELL BUILD_SQL BUILD_ACCESSLOG BUILD_AUDITLOG BUILD_CONSTRAINT BUILD_DDS BUILD_DENYOP BUILD_DYNGROUP BUILD_DYNLIST BUILD_LASTMOD BUILD_PPOLICY BUILD_PROXYCACHE BUILD_REFINT BUILD_RETCODE BUILD_RWM BUILD_SEQMOD BUILD_SYNCPROV BUILD_TRANSLUCENT BUILD_UNIQUE BUILD_VALSORT BUILD_SLURPD LDAP_LIBS SLAPD_LIBS SLURPD_LIBS BDB_LIBS LTHREAD_LIBS LUTIL_LIBS WRAP_LIBS SLAPD_MODULES_CPPFLAGS SLAPD_MODULES_LDFLAGS SLAPD_NO_STATIC SLAPD_STATIC_BACKENDS SLAPD_DYNAMIC_BACKENDS SLAPD_STATIC_OVERLAYS SLAPD_DYNAMIC_OVERLAYS PERL_CPPFLAGS SLAPD_PERL_LDFLAGS MOD_PERL_LDFLAGS KRB4_LIBS KRB5_LIBS SASL_LIBS TLS_LIBS MODULES_LIBS SLAPI_LIBS LIBSLAPI LIBSLAPITOOLS AUTH_LIBS ICU_LIBS SLAPD_SLP_LIBS SLAPD_GMP_LIBS SLAPD_SQL_LDFLAGS SLAPD_SQL_LIBS SLAPD_SQL_INCLUDES LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar OPENLDAP_LIBRELEASE OPENLDAP_LIBVERSION OPENLDAP_RELEASE_DATE top_builddir ldap_subdir CC AR CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP LIBTOOL PERLBIN OL_MKDEP OL_MKDEP_FLAGS LTSTATIC LIBOBJS LIBSRCS PLAT WITH_SASL WITH_TLS WITH_MODULES_ENABLED WITH_ACI_ENABLED BUILD_THREAD BUILD_LIBS_DYNAMIC BUILD_SLAPD BUILD_SLAPI SLAPD_SLAPI_DEPEND BUILD_BDB BUILD_DNSSRV BUILD_HDB BUILD_LDAP BUILD_META BUILD_MONITOR BUILD_NULL BUILD_PASSWD BUILD_RELAY BUILD_PERL BUILD_SHELL BUILD_SOCK BUILD_SQL BUILD_ACCESSLOG BUILD_AUDITLOG BUILD_CONSTRAINT BUILD_DDS BUILD_DENYOP BUILD_DYNGROUP BUILD_DYNLIST BUILD_LASTMOD BUILD_MEMBEROF BUILD_PPOLICY BUILD_PROXYCACHE BUILD_REFINT BUILD_RETCODE BUILD_RWM BUILD_SEQMOD BUILD_SYNCPROV BUILD_TRANSLUCENT BUILD_UNIQUE BUILD_VALSORT LDAP_LIBS SLAPD_LIBS BDB_LIBS LTHREAD_LIBS LUTIL_LIBS WRAP_LIBS SLAPD_MODULES_CPPFLAGS SLAPD_MODULES_LDFLAGS SLAPD_NO_STATIC SLAPD_STATIC_BACKENDS SLAPD_DYNAMIC_BACKENDS SLAPD_STATIC_OVERLAYS SLAPD_DYNAMIC_OVERLAYS PERL_CPPFLAGS SLAPD_PERL_LDFLAGS MOD_PERL_LDFLAGS KRB4_LIBS KRB5_LIBS SASL_LIBS TLS_LIBS MODULES_LIBS SLAPI_LIBS LIBSLAPI LIBSLAPITOOLS AUTH_LIBS ICU_LIBS SLAPD_SLP_LIBS SLAPD_GMP_LIBS SLAPD_SQL_LDFLAGS SLAPD_SQL_LIBS SLAPD_SQL_INCLUDES LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1041,6 +1041,7 @@ SLAPD Backend Options:
     --enable-perl        enable perl backend no|yes|mod [no]
     --enable-relay       enable relay backend no|yes|mod [yes]
     --enable-shell       enable shell backend no|yes|mod [no]
+    --enable-sock        enable sock backend no|yes|mod [no]
     --enable-sql         enable sql backend no|yes|mod [no]
 
 SLAPD Overlay Options:
@@ -1049,10 +1050,9 @@ SLAPD Overlay Options:
     --enable-auditlog    Audit Logging overlay no|yes|mod [no]
     --enable-constraint          Attribute Constraint overlay no|yes|mod [no]
     --enable-dds         Dynamic Directory Services overlay no|yes|mod [no]
-    --enable-denyop      Deny Operation overlay no|yes|mod [no]
     --enable-dyngroup    Dynamic Group overlay no|yes|mod [no]
     --enable-dynlist     Dynamic List overlay no|yes|mod [no]
-    --enable-lastmod     Last Modification overlay no|yes|mod [no]
+    --enable-memberof    Reverse Group Membership overlay no|yes|mod [no]
     --enable-ppolicy     Password Policy overlay no|yes|mod [no]
     --enable-proxycache          Proxy Cache overlay no|yes|mod [no]
     --enable-refint      Referential Integrity overlay no|yes|mod [no]
@@ -1064,9 +1064,6 @@ SLAPD Overlay Options:
     --enable-unique       Attribute Uniqueness overlay no|yes|mod [no]
     --enable-valsort      Value Sorting overlay no|yes|mod [no]
 
-SLURPD (Replication Daemon) Options:
-  --enable-slurpd        enable building slurpd [auto]
-
 Library Generation & Linking Options
   --enable-static[=PKGS]
                           build static libraries [default=yes]
@@ -1085,9 +1082,10 @@ Optional Packages:
   --with-cyrus-sasl      with Cyrus SASL support [auto]
   --with-fetch           with fetch(3) URL support [auto]
   --with-threads         with threads [auto]
-  --with-tls             with TLS/SSL support [auto]
+  --with-tls             with TLS/SSL support auto|openssl|gnutls [auto]
   --with-yielding-select  with implicitly yielding select [auto]
   --with-mp               with multiple precision statistics auto|longlong|long|bignum|gmp [auto]
+  --with-odbc             with specific ODBC support iodbc|unixodbc|auto [auto]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
@@ -1208,7 +1206,7 @@ Copyright (C) 2003 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 
-Copyright 1998-2006 The OpenLDAP Foundation. All rights reserved.
+Copyright 1998-2008 The OpenLDAP Foundation. All rights reserved.
 Restrictions apply, see COPYRIGHT and LICENSE files.
 _ACEOF
   exit 0
@@ -1596,8 +1594,11 @@ fi
 
 SHTOOL="$ac_cv_shtool"
 
-TB="`$SHTOOL echo -e '%B' 2>/dev/null`"
-TN="`$SHTOOL echo -e '%b' 2>/dev/null`"
+TB="" TN=""
+if test -t 1; then
+       TB="`$SHTOOL echo -e '%B' 2>/dev/null`"
+       TN="`$SHTOOL echo -e '%b' 2>/dev/null`"
+fi
 
 OPENLDAP_CVS=""
 if test -d $ac_aux_dir/CVS; then
@@ -2262,7 +2263,6 @@ else
 fi;
 # end --enable-proctitle
 ol_enable_referrals=${ol_enable_referrals-no}
-ol_enable_kbind=${ol_enable_kbind-no}
 # OpenLDAP --enable-ipv6
 
        # Check whether --enable-ipv6 or --disable-ipv6 was given.
@@ -2356,7 +2356,6 @@ else
        ol_with_fetch="auto"
 fi; # end --with-fetch
 
-ol_with_kerberos=${ol_with_kerberos-auto}
 # OpenLDAP --with-threads
 
 # Check whether --with-threads or --without-threads was given.
@@ -2387,7 +2386,7 @@ if test "${with_tls+set}" = set; then
   withval="$with_tls"
 
        ol_arg=invalid
-       for ol_val in auto openssl yes no  ; do
+       for ol_val in auto openssl gnutls yes no  ; do
                if test "$withval" = "$ol_val" ; then
                        ol_arg="$ol_val"
                fi
@@ -2449,6 +2448,29 @@ else
        ol_with_mp="auto"
 fi; # end --with-mp
 
+# OpenLDAP --with-odbc
+
+# Check whether --with-odbc or --without-odbc was given.
+if test "${with_odbc+set}" = set; then
+  withval="$with_odbc"
+
+       ol_arg=invalid
+       for ol_val in auto iodbc unixodbc  ; do
+               if test "$withval" = "$ol_val" ; then
+                       ol_arg="$ol_val"
+               fi
+       done
+       if test "$ol_arg" = "invalid" ; then
+               { { echo "$as_me:$LINENO: error: bad value $withval for --with-odbc" >&5
+echo "$as_me: error: bad value $withval for --with-odbc" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
+       ol_with_odbc="$ol_arg"
+
+else
+       ol_with_odbc="auto"
+fi; # end --with-odbc
+
 
 
 # Check whether --enable-xxslapdoptions or --disable-xxslapdoptions was given.
@@ -2767,6 +2789,7 @@ Backends="bdb \
        perl \
        relay \
        shell \
+       sock \
        sql"
 
 # Check whether --enable-xxslapbackends or --disable-xxslapbackends was given.
@@ -3049,6 +3072,29 @@ else
        ol_enable_shell=${ol_enable_backends:-no}
 fi;
 # end --enable-shell
+# OpenLDAP --enable-sock
+
+       # Check whether --enable-sock or --disable-sock was given.
+if test "${enable_sock+set}" = set; then
+  enableval="$enable_sock"
+
+       ol_arg=invalid
+       for ol_val in no yes mod ; do
+               if test "$enableval" = "$ol_val" ; then
+                       ol_arg="$ol_val"
+               fi
+       done
+       if test "$ol_arg" = "invalid" ; then
+               { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-sock" >&5
+echo "$as_me: error: bad value $enableval for --enable-sock" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
+       ol_enable_sock="$ol_arg"
+
+else
+       ol_enable_sock=${ol_enable_backends:-no}
+fi;
+# end --enable-sock
 # OpenLDAP --enable-sql
 
        # Check whether --enable-sql or --disable-sql was given.
@@ -3077,10 +3123,9 @@ Overlays="accesslog \
        auditlog \
        constraint \
        dds \
-       denyop \
        dyngroup \
        dynlist \
-       lastmod \
+       memberof \
        ppolicy \
        proxycache \
        refint \
@@ -3215,30 +3260,6 @@ else
 fi;
 # end --enable-dds
 
-# OpenLDAP --enable-denyop
-
-       # Check whether --enable-denyop or --disable-denyop was given.
-if test "${enable_denyop+set}" = set; then
-  enableval="$enable_denyop"
-
-       ol_arg=invalid
-       for ol_val in no yes mod ; do
-               if test "$enableval" = "$ol_val" ; then
-                       ol_arg="$ol_val"
-               fi
-       done
-       if test "$ol_arg" = "invalid" ; then
-               { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-denyop" >&5
-echo "$as_me: error: bad value $enableval for --enable-denyop" >&2;}
-   { (exit 1); exit 1; }; }
-       fi
-       ol_enable_denyop="$ol_arg"
-
-else
-       ol_enable_denyop=${ol_enable_overlays:-no}
-fi;
-# end --enable-denyop
-
 # OpenLDAP --enable-dyngroup
 
        # Check whether --enable-dyngroup or --disable-dyngroup was given.
@@ -3287,11 +3308,11 @@ else
 fi;
 # end --enable-dynlist
 
-# OpenLDAP --enable-lastmod
+# OpenLDAP --enable-memberof
 
-       # Check whether --enable-lastmod or --disable-lastmod was given.
-if test "${enable_lastmod+set}" = set; then
-  enableval="$enable_lastmod"
+       # Check whether --enable-memberof or --disable-memberof was given.
+if test "${enable_memberof+set}" = set; then
+  enableval="$enable_memberof"
 
        ol_arg=invalid
        for ol_val in no yes mod ; do
@@ -3300,16 +3321,16 @@ if test "${enable_lastmod+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-lastmod" >&5
-echo "$as_me: error: bad value $enableval for --enable-lastmod" >&2;}
+               { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-memberof" >&5
+echo "$as_me: error: bad value $enableval for --enable-memberof" >&2;}
    { (exit 1); exit 1; }; }
        fi
-       ol_enable_lastmod="$ol_arg"
+       ol_enable_memberof="$ol_arg"
 
 else
-       ol_enable_lastmod=${ol_enable_overlays:-no}
+       ol_enable_memberof=${ol_enable_overlays:-no}
 fi;
-# end --enable-lastmod
+# end --enable-memberof
 
 # OpenLDAP --enable-ppolicy
 
@@ -3552,35 +3573,6 @@ fi;
 # end --enable-valsort
 
 
-# Check whether --enable-xxslurpdoptions or --disable-xxslurpdoptions was given.
-if test "${enable_xxslurpdoptions+set}" = set; then
-  enableval="$enable_xxslurpdoptions"
-
-fi;
-# OpenLDAP --enable-slurpd
-
-       # Check whether --enable-slurpd or --disable-slurpd was given.
-if test "${enable_slurpd+set}" = set; then
-  enableval="$enable_slurpd"
-
-       ol_arg=invalid
-       for ol_val in auto yes no ; do
-               if test "$enableval" = "$ol_val" ; then
-                       ol_arg="$ol_val"
-               fi
-       done
-       if test "$ol_arg" = "invalid" ; then
-               { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-slurpd" >&5
-echo "$as_me: error: bad value $enableval for --enable-slurpd" >&2;}
-   { (exit 1); exit 1; }; }
-       fi
-       ol_enable_slurpd="$ol_arg"
-
-else
-       ol_enable_slurpd=auto
-fi;
-# end --enable-slurpd
-
 # Check whether --enable-xxliboptions or --disable-xxliboptions was given.
 if test "${enable_xxliboptions+set}" = set; then
   enableval="$enable_xxliboptions"
@@ -3673,11 +3665,6 @@ echo "$as_me: WARNING: slapd disabled, ignoring --enable-dynacl argument" >&2;}
        if test $ol_enable_aci != no ; then
                { echo "$as_me:$LINENO: WARNING: slapd disabled, ignoring --enable-aci argument" >&5
 echo "$as_me: WARNING: slapd disabled, ignoring --enable-aci argument" >&2;}
-       fi
-       if test $ol_enable_slurpd = yes ; then
-               { { echo "$as_me:$LINENO: error: slurpd requires slapd" >&5
-echo "$as_me: error: slurpd requires slapd" >&2;}
-   { (exit 1); exit 1; }; }
        fi
        if test $ol_enable_rewrite = yes ; then
                { echo "$as_me:$LINENO: WARNING: slapd disabled, ignoring --enable-rewrite argument" >&5
@@ -3707,8 +3694,6 @@ echo "$as_me: WARNING: slapd disabled, ignoring --enable-$i argument" >&2;}
        ol_enable_aci=no
        ol_enable_wrappers=no
 
-       ol_enable_slurpd=no
-
        ol_enable_rewrite=no
 
 elif test $ol_enable_modules != yes &&
@@ -3723,6 +3708,7 @@ elif test $ol_enable_modules != yes &&
        test $ol_enable_perl = no &&
        test $ol_enable_relay = no &&
        test $ol_enable_shell = no &&
+       test $ol_enable_sock = no &&
        test $ol_enable_sql = no ; then
 
        if test $ol_enable_slapd = yes ; then
@@ -3742,14 +3728,6 @@ echo "$as_me: error: --enable-meta requires --enable-ldap" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-if test $ol_enable_slurpd = yes ; then
-               if test $ol_with_threads = no ; then
-               { { echo "$as_me:$LINENO: error: slurpd requires threads" >&5
-echo "$as_me: error: slurpd requires threads" >&2;}
-   { (exit 1); exit 1; }; }
-       fi
-fi
-
 if test $ol_enable_lmpasswd = yes ; then
        if test $ol_with_tls = no ; then
                { { echo "$as_me:$LINENO: error: LAN Manager passwords require OpenSSL" >&5
@@ -3758,25 +3736,6 @@ echo "$as_me: error: LAN Manager passwords require OpenSSL" >&2;}
        fi
 fi
 
-if test $ol_enable_kbind = yes ; then
-       if test $ol_with_kerberos = no ; then
-               { { echo "$as_me:$LINENO: error: options require --with-kerberos" >&5
-echo "$as_me: error: options require --with-kerberos" >&2;}
-   { (exit 1); exit 1; }; }
-       elif test $ol_with_kerberos = auto ; then
-               ol_with_kerberos=yes
-       fi
-
-elif test $ol_enable_kbind = no ; then
-       if test $ol_with_kerberos = auto ; then
-               ol_with_kerberos=no
-       elif test $ol_with_kerberos != no ; then
-               { echo "$as_me:$LINENO: WARNING: Kerberos detection enabled unnecessarily" >&5
-echo "$as_me: WARNING: Kerberos detection enabled unnecessarily" >&2;};
-               ol_with_kerberos=no
-       fi
-fi
-
 if test $ol_enable_spasswd = yes ; then
        if test $ol_with_cyrus_sasl = no ; then
                { { echo "$as_me:$LINENO: error: options require --with-cyrus-sasl" >&5
@@ -3795,10 +3754,8 @@ LTHREAD_LIBS=
 LUTIL_LIBS=
 
 SLAPD_LIBS=
-SLURPD_LIBS=
 
 BUILD_SLAPD=no
-BUILD_SLURPD=no
 
 BUILD_THREAD=no
 
@@ -3816,6 +3773,7 @@ BUILD_PASSWD=no
 BUILD_PERL=no
 BUILD_RELAY=no
 BUILD_SHELL=no
+BUILD_SOCK=no
 BUILD_SQL=no
 
 BUILD_ACCESSLOG=no
@@ -3826,6 +3784,7 @@ BUILD_DENYOP=no
 BUILD_DYNGROUP=no
 BUILD_DYNLIST=no
 BUILD_LASTMOD=no
+BUILD_MEMBEROF=no
 BUILD_PPOLICY=no
 BUILD_PROXYCACHE=no
 BUILD_REFINT=no
@@ -5662,7 +5621,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5665 "configure"' > conftest.$ac_ext
+  echo '#line 5624 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7642,11 +7601,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7645: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7604: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7649: \$? = $ac_status" >&5
+   echo "$as_me:7608: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7904,11 +7863,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7907: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7866: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7911: \$? = $ac_status" >&5
+   echo "$as_me:7870: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7966,11 +7925,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7969: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7928: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7973: \$? = $ac_status" >&5
+   echo "$as_me:7932: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10214,7 +10173,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10217 "configure"
+#line 10176 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10312,7 +10271,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10315 "configure"
+#line 10274 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12798,6 +12757,7 @@ EOF
 fi
 echo "$as_me:$LINENO: result: $ol_cv_mkdep" >&5
 echo "${ECHO_T}$ol_cv_mkdep" >&6
+               test "$ol_cv_mkdep" = no && OL_MKDEP=":"
        else
                cc_cv_mkdep=yes
                OL_MKDEP_FLAGS="${MKDEP_FLAGS}"
@@ -13886,6 +13846,9 @@ fi
 
 
 
+
+
+
 
 
 
@@ -13920,9 +13883,11 @@ for ac_header in \
        sysexits.h              \
        sys/file.h              \
        sys/filio.h             \
+       sys/fstyp.h             \
        sys/errno.h             \
        sys/ioctl.h             \
        sys/param.h             \
+       sys/privgrp.h   \
        sys/resource.h  \
        sys/select.h    \
        sys/socket.h    \
@@ -13931,6 +13896,7 @@ for ac_header in \
        sys/time.h              \
        sys/types.h             \
        sys/uio.h               \
+       sys/vmount.h    \
        syslog.h                \
        termios.h               \
        unistd.h                \
@@ -15664,8 +15630,10 @@ _ACEOF
 fi
 done
 
+if test $ac_cv_func_poll = yes; then
+
 
-for ac_header in poll.h
+for ac_header in poll.h sys/poll.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -15814,6 +15782,7 @@ fi
 
 done
 
+fi
 
 
 for ac_header in sys/epoll.h
@@ -15966,9 +15935,9 @@ fi
 done
 
 if test "${ac_cv_header_sys_epoll_h}" = yes; then
-echo "$as_me:$LINENO: checking for epoll system call" >&5
+       echo "$as_me:$LINENO: checking for epoll system call" >&5
 echo $ECHO_N "checking for epoll system call... $ECHO_C" >&6
-if test "$cross_compiling" = yes; then
+       if test "$cross_compiling" = yes; then
   echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 else
@@ -15978,7 +15947,7 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-int main(int argc, char *argv)
+int main(int argc, char **argv)
 {
        int epfd = epoll_create(256);
        exit (epfd == -1 ? 1 : 0);
@@ -16015,6 +15984,208 @@ rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftes
 fi
 fi
 
+
+for ac_header in sys/devpoll.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to <http://www.openldap.org/its/> ##
+## --------------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+if test "${ac_cv_header_sys_devpoll_h}" = yes \
+               -a "${ac_cv_header_poll_h}" = yes ; \
+then
+       echo "$as_me:$LINENO: checking for /dev/poll" >&5
+echo $ECHO_N "checking for /dev/poll... $ECHO_C" >&6
+       if test "$cross_compiling" = yes; then
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+int main(int argc, char **argv)
+{
+       int devpollfd = open("/dev/poll", /* O_RDWR */ 2);
+       exit (devpollfd == -1 ? 1 : 0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DEVPOLL 1
+_ACEOF
+
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+
 # strerror checks
 echo "$as_me:$LINENO: checking declaration of sys_errlist" >&5
 echo $ECHO_N "checking declaration of sys_errlist... $ECHO_C" >&6
 for ac_header in regex.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo "$as_me:$LINENO: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
@@ -16565,100 +16734,17 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+eval "$as_ac_Header=no"
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## --------------------------------------------- ##
-## Report this to <http://www.openldap.org/its/> ##
-## --------------------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -16668,6 +16754,7 @@ fi
 
 done
 
+
 if test "$ac_cv_header_regex_h" != yes ; then
        { { echo "$as_me:$LINENO: error: POSIX regex.h required." >&5
 echo "$as_me: error: POSIX regex.h required." >&2;}
@@ -17173,27 +17260,323 @@ _ACEOF
 fi
 
 if test $have_uuid = no ; then
-       echo "$as_me:$LINENO: checking to see if -lrpcrt4 is needed for win32 UUID support" >&5
-echo $ECHO_N "checking to see if -lrpcrt4 is needed for win32 UUID support... $ECHO_C" >&6
-       save_LIBS="$LIBS"
-       LIBS="$LIBS -lrpcrt4"
-       cat >conftest.$ac_ext <<_ACEOF
+
+for ac_header in uuid/uuid.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-               int __stdcall UuidCreate(void *);
-               int __stdcall UuidToStringA(void *,void **);
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
 
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to <http://www.openldap.org/its/> ##
+## --------------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+       if test $ac_cv_header_uuid_uuid_h = yes ; then
+               save_LIBS="$LIBS"
+               echo "$as_me:$LINENO: checking for library containing uuid_generate" >&5
+echo $ECHO_N "checking for library containing uuid_generate... $ECHO_C" >&6
+if test "${ac_cv_search_uuid_generate+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_uuid_generate=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char uuid_generate ();
 int
 main ()
 {
-
-               UuidCreate(0);
-               UuidToStringA(0,0);
-
+uuid_generate ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_uuid_generate="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_uuid_generate" = no; then
+  for ac_lib in uuid; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char uuid_generate ();
+int
+main ()
+{
+uuid_generate ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_uuid_generate="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_uuid_generate" >&5
+echo "${ECHO_T}$ac_cv_search_uuid_generate" >&6
+if test "$ac_cv_search_uuid_generate" != no; then
+  test "$ac_cv_search_uuid_generate" = "none required" || LIBS="$ac_cv_search_uuid_generate $LIBS"
+  have_uuid=yes
+else
+  :
+fi
+
+               LIBS="$save_LIBS"
+
+               if test have_uuid = yes ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UUID_GENERATE 1
+_ACEOF
+
+
+                       test "$ac_cv_search_uuid_generate" = "none required" || \
+                               SLAPD_LIBS="$SLAPD_LIBS $ac_cv_search_uuid_generate"
+               fi
+       fi
+fi
+
+if test $have_uuid = no ; then
+       echo "$as_me:$LINENO: checking to see if -lrpcrt4 is needed for win32 UUID support" >&5
+echo $ECHO_N "checking to see if -lrpcrt4 is needed for win32 UUID support... $ECHO_C" >&6
+       save_LIBS="$LIBS"
+       LIBS="$LIBS -lrpcrt4"
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+               int __stdcall UuidCreate(void *);
+               int __stdcall UuidToStringA(void *,void **);
+
+int
+main ()
+{
+
+               UuidCreate(0);
+               UuidToStringA(0,0);
+
   ;
   return 0;
 }
@@ -18080,166 +18463,15 @@ echo "$as_me: error: AF_LOCAL domain support requires sys/un.h" >&2;}
        fi
 fi
 
-ol_link_kbind=no
-ol_link_krb5=no
-ol_link_krb4=no
-
-case $ol_with_kerberos in yes | auto | k5 | k5only | k425)
-
-
-for ac_header in krb5.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## --------------------------------------------- ##
-## Report this to <http://www.openldap.org/its/> ##
-## --------------------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
+if test $ol_with_tls = yes ; then
+       ol_with_tls=auto
 fi
 
-done
-
-
-       if test $ac_cv_header_krb5_h = yes ; then
+ol_link_tls=no
+if test $ol_with_tls = openssl || test $ol_with_tls = auto ; then
 
-for ac_header in heim_err.h
+for ac_header in openssl/ssl.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
 
 done
 
-               if test $ac_cv_header_heim_err_h = yes ; then
-                       krb5_impl=heimdal
-               else
-                       krb5_impl=mit
-               fi
 
-               if test $krb5_impl = mit; then
-                       echo "$as_me:$LINENO: checking for main in -lk5crypto" >&5
-echo $ECHO_N "checking for main in -lk5crypto... $ECHO_C" >&6
-if test "${ac_cv_lib_k5crypto_main+set}" = set; then
+       if test $ac_cv_header_openssl_ssl_h = yes ; then
+               echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5
+echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6
+if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lk5crypto  $LIBS"
+LIBS="-lssl -lcrypto $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -18409,11 +18636,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char SSL_library_init ();
 int
 main ()
 {
-main ();
+SSL_library_init ();
   ;
   return 0;
 }
@@ -18440,33 +18673,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_k5crypto_main=yes
+  ac_cv_lib_ssl_SSL_library_init=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_k5crypto_main=no
+ac_cv_lib_ssl_SSL_library_init=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_k5crypto_main" >&5
-echo "${ECHO_T}$ac_cv_lib_k5crypto_main" >&6
-if test $ac_cv_lib_k5crypto_main = yes; then
-  krb5crypto=k5crypto
+echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5
+echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6
+if test $ac_cv_lib_ssl_SSL_library_init = yes; then
+  have_openssl=yes
+                       need_rsaref=no
 else
-  krb5crypto=crypto
+  have_openssl=no
 fi
 
 
-                       echo "$as_me:$LINENO: checking for main in -lkrb5" >&5
-echo $ECHO_N "checking for main in -lkrb5... $ECHO_C" >&6
-if test "${ac_cv_lib_krb5_main+set}" = set; then
+               if test $have_openssl = no ; then
+                       echo "$as_me:$LINENO: checking for ssl3_accept in -lssl" >&5
+echo $ECHO_N "checking for ssl3_accept in -lssl... $ECHO_C" >&6
+if test "${ac_cv_lib_ssl_ssl3_accept+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb5 -l$krb5crypto -lcom_err $LIBS"
+LIBS="-lssl -lcrypto -lRSAglue -lrsaref $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -18474,11 +18709,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char ssl3_accept ();
 int
 main ()
 {
-main ();
+ssl3_accept ();
   ;
   return 0;
 }
@@ -18505,202 +18746,100 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_krb5_main=yes
+  ac_cv_lib_ssl_ssl3_accept=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_krb5_main=no
+ac_cv_lib_ssl_ssl3_accept=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_krb5_main" >&5
-echo "${ECHO_T}$ac_cv_lib_krb5_main" >&6
-if test $ac_cv_lib_krb5_main = yes; then
-  have_krb5=yes
-                               KRB5_LIBS="-lkrb5 -l$krb5crypto -lcom_err"
+echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_ssl3_accept" >&5
+echo "${ECHO_T}$ac_cv_lib_ssl_ssl3_accept" >&6
+if test $ac_cv_lib_ssl_ssl3_accept = yes; then
+  have_openssl=yes
+                               need_rsaref=yes
 else
-  have_krb5=no
+  have_openssl=no
 fi
 
+               fi
 
-               elif test $krb5_impl = heimdal; then
-                       echo "$as_me:$LINENO: checking for main in -ldes" >&5
-echo $ECHO_N "checking for main in -ldes... $ECHO_C" >&6
-if test "${ac_cv_lib_des_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldes  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+               if test $have_openssl = yes ; then
+                       ol_with_tls=openssl
+                       ol_link_tls=yes
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_OPENSSL 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
 
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
+                       if test $need_rsaref = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_RSAREF 1
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_des_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_des_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_des_main" >&5
-echo "${ECHO_T}$ac_cv_lib_des_main" >&6
-if test $ac_cv_lib_des_main = yes; then
-  krb5crypto=des
-else
-  krb5crypto=crypto
-fi
 
+                               TLS_LIBS="-lssl -lcrypto -lRSAglue -lrsaref"
+                       else
+                               TLS_LIBS="-lssl -lcrypto"
+                       fi
 
-                       echo "$as_me:$LINENO: checking for main in -lkrb5" >&5
-echo $ECHO_N "checking for main in -lkrb5... $ECHO_C" >&6
-if test "${ac_cv_lib_krb5_main+set}" = set; then
+                       echo "$as_me:$LINENO: checking OpenSSL library version (CRL checking capability)" >&5
+echo $ECHO_N "checking OpenSSL library version (CRL checking capability)... $ECHO_C" >&6
+if test "${ol_cv_ssl_crl_compat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+
+               cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+#ifdef HAVE_OPENSSL_SSL_H
+#include <openssl/ssl.h>
+#endif
 
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_krb5_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+/* Require 0.9.7d+ */
+#if OPENSSL_VERSION_NUMBER >= 0x0090704fL
+       char *__ssl_compat = "0.9.7d";
+#endif
 
-ac_cv_lib_krb5_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_krb5_main" >&5
-echo "${ECHO_T}$ac_cv_lib_krb5_main" >&6
-if test $ac_cv_lib_krb5_main = yes; then
-  have_krb5=yes
-                               KRB5_LIBS="-lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err"
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__ssl_compat" >/dev/null 2>&1; then
+  ol_cv_ssl_crl_compat=yes
 else
-  have_krb5=no
+  ol_cv_ssl_crl_compat=no
 fi
+rm -f conftest*
 
+fi
+echo "$as_me:$LINENO: result: $ol_cv_ssl_crl_compat" >&5
+echo "${ECHO_T}$ol_cv_ssl_crl_compat" >&6
 
+                       if test $ol_cv_ssl_crl_compat = yes ; then
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_HEIMDAL_KERBEROS 1
-_ACEOF
-
-
-               else
-                       have_krb5=no
-                       { echo "$as_me:$LINENO: WARNING: Unrecognized Kerberos5 Implementation" >&5
-echo "$as_me: WARNING: Unrecognized Kerberos5 Implementation" >&2;}
-               fi
-
-               if test $have_krb5 = yes ; then
-                       ol_link_krb5=yes
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_KRB5 1
+#define HAVE_OPENSSL_CRL 1
 _ACEOF
 
-
-                       if test $ol_with_kerberos = k5only ; then
-                               ol_with_kerberos=found
                        fi
-
-               elif test $ol_with_kerberos != auto ; then
-                       { { echo "$as_me:$LINENO: error: Required Kerberos 5 support not available" >&5
-echo "$as_me: error: Required Kerberos 5 support not available" >&2;}
-   { (exit 1); exit 1; }; }
                fi
-
        fi
-       ;;
-esac
-
-if test $ol_link_krb5 = yes &&
-   { test $ol_with_kerberos = yes ||
-     test $ol_with_kerberos = auto ||
-     test $ol_with_kerberos = k425; }; then
-
+fi
 
+if test $ol_link_tls = no ; then
+       if test $ol_with_tls = gnutls || test $ol_with_tls = auto ; then
 
-for ac_header in kerberosIV/krb.h kerberosIV/des.h
+for ac_header in gnutls/gnutls.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
 done
 
 
-       if test $ac_cv_header_kerberosIV_krb_h = yes ; then
-               if test $krb5_impl = mit; then
-                       echo "$as_me:$LINENO: checking for main in -lkrb4" >&5
-echo $ECHO_N "checking for main in -lkrb4... $ECHO_C" >&6
-if test "${ac_cv_lib_krb4_main+set}" = set; then
+               if test $ac_cv_header_gnutls_gnutls_h = yes ; then
+                       echo "$as_me:$LINENO: checking for gnutls_init in -lgnutls" >&5
+echo $ECHO_N "checking for gnutls_init in -lgnutls... $ECHO_C" >&6
+if test "${ac_cv_lib_gnutls_gnutls_init+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb4 -ldes425 -lkrb5 -l$krb5crypto -lcom_err $LIBS"
+LIBS="-lgnutls  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -18866,11 +19004,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gnutls_init ();
 int
 main ()
 {
-main ();
+gnutls_init ();
   ;
   return 0;
 }
@@ -18897,140 +19041,135 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_krb4_main=yes
+  ac_cv_lib_gnutls_gnutls_init=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_krb4_main=no
+ac_cv_lib_gnutls_gnutls_init=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_krb4_main" >&5
-echo "${ECHO_T}$ac_cv_lib_krb4_main" >&6
-if test $ac_cv_lib_krb4_main = yes; then
-  have_k425=yes
-                               KRB4_LIBS="-lkrb4 -ldes425"
+echo "$as_me:$LINENO: result: $ac_cv_lib_gnutls_gnutls_init" >&5
+echo "${ECHO_T}$ac_cv_lib_gnutls_gnutls_init" >&6
+if test $ac_cv_lib_gnutls_gnutls_init = yes; then
+  have_gnutls=yes
 else
-  have_k425=no
+  have_gnutls=no
 fi
 
 
-               elif test $krb5_impl = heimdal; then
-                       echo "$as_me:$LINENO: checking for main in -lkrb4" >&5
-echo $ECHO_N "checking for main in -lkrb4... $ECHO_C" >&6
-if test "${ac_cv_lib_krb4_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb4 -lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+                       if test $have_gnutls = yes ; then
+                               ol_with_tls=gnutls
+                               ol_link_tls=yes
 
+                               TLS_LIBS="-lgnutls"
 
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GNUTLS 1
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_krb4_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_krb4_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_krb4_main" >&5
-echo "${ECHO_T}$ac_cv_lib_krb4_main" >&6
-if test $ac_cv_lib_krb4_main = yes; then
-  have_k425=yes
-                               KRB4_LIBS="-lkrb4"
-else
-  have_k425=no
+                       fi
+               fi
+       fi
 fi
 
+WITH_TLS=no
+if test $ol_link_tls = yes ; then
 
-               else
-                       have_425=no
-                       { echo "$as_me:$LINENO: WARNING: Unrecongized Kerberos V Implementation" >&5
-echo "$as_me: WARNING: Unrecongized Kerberos V Implementation" >&2;}
-               fi
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TLS 1
+_ACEOF
+
+       WITH_TLS=yes
+elif test $ol_with_tls = auto ; then
+       { echo "$as_me:$LINENO: WARNING: Could not locate TLS/SSL package" >&5
+echo "$as_me: WARNING: Could not locate TLS/SSL package" >&2;}
+       { echo "$as_me:$LINENO: WARNING: TLS data protection not supported!" >&5
+echo "$as_me: WARNING: TLS data protection not supported!" >&2;}
+elif test $ol_with_tls != no ; then
+       { { echo "$as_me:$LINENO: error: Could not locate TLS/SSL package" >&5
+echo "$as_me: error: Could not locate TLS/SSL package" >&2;}
+   { (exit 1); exit 1; }; }
+else
+       { echo "$as_me:$LINENO: WARNING: TLS data protection not supported!" >&5
+echo "$as_me: WARNING: TLS data protection not supported!" >&2;}
+fi
 
-               if test $have_k425 = yes ; then
-                       ol_with_kerberos=found
-                       ol_link_krb4=yes
+if test $ol_enable_lmpasswd != no; then
+       if test $ol_link_tls != yes ; then
+               { { echo "$as_me:$LINENO: error: LAN Manager passwords require OpenSSL" >&5
+echo "$as_me: error: LAN Manager passwords require OpenSSL" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
 
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_KRB425 1
+#define SLAPD_LMHASH 1
 _ACEOF
 
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_KRB4 1
-_ACEOF
+ol_link_threads=no
+
+case $ol_with_threads in auto | yes | nt)
 
 
-                       echo "$as_me:$LINENO: checking for des_debug in Kerberos libraries" >&5
-echo $ECHO_N "checking for des_debug in Kerberos libraries... $ECHO_C" >&6
-if test "${ol_cv_var_des_debug+set}" = set; then
+       echo "$as_me:$LINENO: checking for _beginthread" >&5
+echo $ECHO_N "checking for _beginthread... $ECHO_C" >&6
+if test "${ac_cv_func__beginthread+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-
-                                                               save_LIBS="$LIBS"
-                               LIBS="$KRB4_LIBS $KRB5_LIBS $LIBS"
-                               cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define _beginthread to an innocuous variant, in case <limits.h> declares _beginthread.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define _beginthread innocuous__beginthread
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _beginthread (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 
-#include <kerberosIV/krb.h>
-#include <kerberosIV/des.h>
-extern int des_debug;
+#undef _beginthread
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char _beginthread ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub__beginthread) || defined (__stub____beginthread)
+choke me
+#else
+char (*f) () = _beginthread;
+#endif
+#ifdef __cplusplus
+}
+#endif
 
 int
 main ()
 {
-
-des_debug = 1;
-
+return f != _beginthread;
   ;
   return 0;
 }
@@ -19057,44 +19196,59 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_var_des_debug=yes
+  ac_cv_func__beginthread=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_var_des_debug=no
+ac_cv_func__beginthread=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-                                                               LIBS="$save_LIBS"
-
 fi
-echo "$as_me:$LINENO: result: $ol_cv_var_des_debug" >&5
-echo "${ECHO_T}$ol_cv_var_des_debug" >&6
+echo "$as_me:$LINENO: result: $ac_cv_func__beginthread" >&5
+echo "${ECHO_T}$ac_cv_func__beginthread" >&6
 
-                       if test $ol_cv_var_des_debug = yes ; then
+
+       if test $ac_cv_func__beginthread = yes ; then
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_DES_DEBUG 1
+#define HAVE_NT_THREADS 1
 _ACEOF
 
-                       fi
-
-                       LIBS="$save_LIBS"
-               fi
+               ol_cv_nt_threads=yes
        fi
-fi
 
-if test $ol_link_krb5 = yes ; then
-       ol_with_kerberos=found
-fi
 
-case $ol_with_kerberos in yes | auto | k4 | kth)
+       if test "$ol_cv_nt_threads" = yes ; then
+               ol_link_threads=nt
+               ol_with_threads=found
+               ol_with_yielding_select=yes
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_NT_SERVICE_MANAGER 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_NT_EVENT_LOG 1
+_ACEOF
+
+       fi
 
+       if test $ol_with_threads = nt ; then
+               { { echo "$as_me:$LINENO: error: could not locate NT Threads" >&5
+echo "$as_me: error: could not locate NT Threads" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
+       ;;
+esac
 
+case $ol_with_threads in auto | yes | posix)
 
 
-for ac_header in krb.h des.h krb-archaeology.h
+for ac_header in pthread.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
 done
 
 
-       if test $ac_cv_header_krb_h = yes ; then
-               echo "$as_me:$LINENO: checking for main in -lkrb" >&5
-echo $ECHO_N "checking for main in -lkrb... $ECHO_C" >&6
-if test "${ac_cv_lib_krb_main+set}" = set; then
+       if test $ac_cv_header_pthread_h = yes ; then
+               echo "$as_me:$LINENO: checking POSIX thread version" >&5
+echo $ECHO_N "checking POSIX thread version... $ECHO_C" >&6
+if test "${ol_cv_pthread_version+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb -ldes $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+#              include <pthread.h>
 
 int
 main ()
 {
-main ();
+
+               int i = PTHREAD_CREATE_JOINABLE;
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -19284,99 +19440,198 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+        { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_krb_main=yes
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "pthread_detach" >/dev/null 2>&1; then
+  ol_cv_pthread_version=10
+else
+  ol_cv_pthread_version=8
+fi
+rm -f conftest*
+
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_krb_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_krb_main" >&5
-echo "${ECHO_T}$ac_cv_lib_krb_main" >&6
-if test $ac_cv_lib_krb_main = yes; then
-  have_k4=yes
-else
-  have_k4=no
-fi
 
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
-               if test $have_k4 = yes ; then
-                       ol_with_kerberos=found
-                       ol_link_krb4=yes
+#              include <pthread.h>
+#              ifdef PTHREAD_CREATE_UNDETACHED
+               draft7
+#              endif
 
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "draft7" >/dev/null 2>&1; then
+  ol_cv_pthread_version=7
+else
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_KRB4 1
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
 
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "pthread_attr_init" >/dev/null 2>&1; then
+  ol_cv_pthread_version=6
+else
 
-                       KRB4_LIBS="-lkrb -ldes"
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
-                       if test $ac_cv_header_krb_archaeology_h = yes ; then
+#              include <pthread.h>
+#ifdef         PTHREAD_MUTEX_INITIALIZER
+               draft5
+#endif
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_KTH_KERBEROS 1
 _ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "draft5" >/dev/null 2>&1; then
+  ol_cv_pthread_version=5
+else
+  ol_cv_pthread_version=4
+fi
+rm -f conftest*
 
-                       fi
-               fi
-       fi
-       ;;
-esac
+fi
+rm -f conftest*
 
-if test $ol_link_krb4 = yes && test $ol_enable_kbind != no ; then
-       ol_link_kbind=yes
+fi
+rm -f conftest*
 
-elif test $ol_enable_kbind = yes ; then
-       { { echo "$as_me:$LINENO: error: Kerberos IV detection failed" >&5
-echo "$as_me: error: Kerberos IV detection failed" >&2;}
-   { (exit 1); exit 1; }; }
 fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 
-if test $ol_link_krb4 = yes || test $ol_link_krb5 = yes ; then
+fi
+echo "$as_me:$LINENO: result: $ol_cv_pthread_version" >&5
+echo "${ECHO_T}$ol_cv_pthread_version" >&6
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_KERBEROS 1
-_ACEOF
 
+               if test $ol_cv_pthread_version != 0 ; then
 
-elif test $ol_with_kerberos != auto && test $ol_with_kerberos != no ; then
-       { { echo "$as_me:$LINENO: error: Kerberos detection failed" >&5
-echo "$as_me: error: Kerberos detection failed" >&2;}
-   { (exit 1); exit 1; }; }
-fi
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREADS $ol_cv_pthread_version
+_ACEOF
 
+               else
+                       { { echo "$as_me:$LINENO: error: unknown pthread version" >&5
+echo "$as_me: error: unknown pthread version" >&2;}
+   { (exit 1); exit 1; }; }
+               fi
 
-if test $ol_with_tls = yes ; then
-       ol_with_tls=auto
-fi
+               # consider threads found
+               ol_with_threads=found
 
-ol_link_tls=no
-if test $ol_with_tls = openssl || test $ol_with_tls = auto ; then
 
-for ac_header in openssl/ssl.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+       echo "$as_me:$LINENO: checking for LinuxThreads pthread.h" >&5
+echo $ECHO_N "checking for LinuxThreads pthread.h... $ECHO_C" >&6
+if test "${ol_cv_header_linux_threads+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  # Is the header compilable?
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "pthread_kill_other_threads_np" >/dev/null 2>&1; then
+  ol_cv_header_linux_threads=yes
+else
+  ol_cv_header_linux_threads=no
+fi
+rm -f conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_header_linux_threads" >&5
+echo "${ECHO_T}$ol_cv_header_linux_threads" >&6
+       if test $ol_cv_header_linux_threads = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LINUX_THREADS 1
+_ACEOF
+
+       fi
+
+
+       echo "$as_me:$LINENO: checking for GNU Pth pthread.h" >&5
+echo $ECHO_N "checking for GNU Pth pthread.h... $ECHO_C" >&6
+if test "${ol_cv_header_gnu_pth_pthread_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+#ifdef _POSIX_THREAD_IS_GNU_PTH
+       __gnu_pth__;
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__gnu_pth__" >/dev/null 2>&1; then
+  ol_cv_header_gnu_pth_pthread_h=yes
+else
+  ol_cv_header_gnu_pth_pthread_h=no
+fi
+rm -f conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_header_gnu_pth_pthread_h" >&5
+echo "${ECHO_T}$ol_cv_header_gnu_pth_pthread_h" >&6
+
+
+               if test $ol_cv_header_gnu_pth_pthread_h = no ; then
+
+for ac_header in sched.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 
 done
 
+               fi
 
-       if test $ac_cv_header_openssl_ssl_h = yes ; then
-               echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5
-echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6
-if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then
+
+                               echo "$as_me:$LINENO: checking for pthread_create in default libraries" >&5
+echo $ECHO_N "checking for pthread_create in default libraries... $ECHO_C" >&6
+if test "${ol_cv_pthread_create+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssl -lcrypto $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+
+                       if test "$cross_compiling" = yes; then
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
+/* pthread test headers */
+#include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char SSL_library_init ();
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+static void *task(p)
+       void *p;
+{
+       return (void *) (p == NULL);
+}
+
 int
 main ()
 {
-SSL_library_init ();
+
+       /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
+       pthread_t t;
+       int status;
+       int detach = PTHREAD_CREATE_DETACHED;
+
+#if HAVE_PTHREADS > 4
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
+#else
+       status = pthread_attr_setdetachstate(&attr, detach);
+#endif
+       if( status ) return status;
+       status = pthread_create( &t, &attr, task, NULL );
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
+#endif
+       if( status ) return status;
+#else
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return errno;
+
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
+
+       status = pthread_detach( &t );
+       if( status ) return errno;
+#endif
+
+#ifdef HAVE_LINUX_THREADS
+       pthread_kill_other_threads_np();
+#endif
+
+       return 0;
+
   ;
   return 0;
 }
@@ -19566,262 +19876,210 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ssl_SSL_library_init=yes
+  ol_cv_pthread_create=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ssl_SSL_library_init=no
+ol_cv_pthread_create=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5
-echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6
-if test $ac_cv_lib_ssl_SSL_library_init = yes; then
-  have_openssl=yes
-                       need_rsaref=no
-else
-  have_openssl=no
-fi
-
-
-               if test $have_openssl = no ; then
-                       echo "$as_me:$LINENO: checking for ssl3_accept in -lssl" >&5
-echo $ECHO_N "checking for ssl3_accept in -lssl... $ECHO_C" >&6
-if test "${ac_cv_lib_ssl_ssl3_accept+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssl -lcrypto -lRSAglue -lrsaref $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
+/* pthread test headers */
+#include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char ssl3_accept ();
-int
-main ()
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+static void *task(p)
+       void *p;
 {
-ssl3_accept ();
-  ;
-  return 0;
+       return (void *) (p == NULL);
+}
+
+
+int main(argc, argv)
+       int argc;
+       char **argv;
+{
+
+       /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
+       pthread_t t;
+       int status;
+       int detach = PTHREAD_CREATE_DETACHED;
+
+#if HAVE_PTHREADS > 4
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
+#else
+       status = pthread_attr_setdetachstate(&attr, detach);
+#endif
+       if( status ) return status;
+       status = pthread_create( &t, &attr, task, NULL );
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
+#endif
+       if( status ) return status;
+#else
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return errno;
+
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
+
+       status = pthread_detach( &t );
+       if( status ) return errno;
+#endif
+
+#ifdef HAVE_LINUX_THREADS
+       pthread_kill_other_threads_np();
+#endif
+
+       return 0;
+
 }
+
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
+rm -f conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ssl_ssl3_accept=yes
+  ol_cv_pthread_create=yes
 else
-  echo "$as_me: failed program was:" >&5
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ssl_ssl3_accept=no
+( exit $ac_status )
+ol_cv_pthread_create=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_ssl3_accept" >&5
-echo "${ECHO_T}$ac_cv_lib_ssl_ssl3_accept" >&6
-if test $ac_cv_lib_ssl_ssl3_accept = yes; then
-  have_openssl=yes
-                               need_rsaref=yes
-else
-  have_openssl=no
 fi
+echo "$as_me:$LINENO: result: $ol_cv_pthread_create" >&5
+echo "${ECHO_T}$ol_cv_pthread_create" >&6
 
+               if test $ol_cv_pthread_create != no ; then
+                       ol_link_threads=posix
+                       ol_link_pthreads=""
                fi
 
-               if test $have_openssl = yes ; then
-                       ol_with_tls=openssl
-                       ol_link_tls=yes
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_OPENSSL 1
-_ACEOF
-
-
-                       if test $need_rsaref = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_RSAREF 1
-_ACEOF
-
-
-                               TLS_LIBS="-lssl -lcrypto -lRSAglue -lrsaref"
-                       else
-                               TLS_LIBS="-lssl -lcrypto"
-                       fi
-
-                       echo "$as_me:$LINENO: checking OpenSSL library version (CRL checking capability)" >&5
-echo $ECHO_N "checking OpenSSL library version (CRL checking capability)... $ECHO_C" >&6
-if test "${ol_cv_ssl_crl_compat+set}" = set; then
+               # Pthread try link: -kthread (ol_cv_pthread_kthread)
+if test "$ol_link_threads" = no ; then
+       # try -kthread
+       echo "$as_me:$LINENO: checking for pthread link with -kthread" >&5
+echo $ECHO_N "checking for pthread link with -kthread... $ECHO_C" >&6
+if test "${ol_cv_pthread_kthread+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-               cat >conftest.$ac_ext <<_ACEOF
+               # save the flags
+               ol_LIBS="$LIBS"
+               LIBS="-kthread $LIBS"
+
+               if test "$cross_compiling" = yes; then
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#ifdef HAVE_OPENSSL_SSL_H
-#include <openssl/ssl.h>
+/* pthread test headers */
+#include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
 #endif
-
-/* Require 0.9.7d+ */
-#if OPENSSL_VERSION_NUMBER >= 0x0090704fL
-       char *__ssl_compat = "0.9.7d";
+#ifndef NULL
+#define NULL (void*)0
 #endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__ssl_compat" >/dev/null 2>&1; then
-  ol_cv_ssl_crl_compat=yes
-else
-  ol_cv_ssl_crl_compat=no
-fi
-rm -f conftest*
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_ssl_crl_compat" >&5
-echo "${ECHO_T}$ol_cv_ssl_crl_compat" >&6
-
-                       if test $ol_cv_ssl_crl_compat = yes ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_OPENSSL_CRL 1
-_ACEOF
-
-                       fi
-               fi
-       fi
-fi
-
-WITH_TLS=no
-if test $ol_link_tls = yes ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TLS 1
-_ACEOF
-
-       WITH_TLS=yes
-elif test $ol_with_tls = auto ; then
-       { echo "$as_me:$LINENO: WARNING: Could not locate TLS/SSL package" >&5
-echo "$as_me: WARNING: Could not locate TLS/SSL package" >&2;}
-       { echo "$as_me:$LINENO: WARNING: TLS data protection not supported!" >&5
-echo "$as_me: WARNING: TLS data protection not supported!" >&2;}
-elif test $ol_with_tls != no ; then
-       { { echo "$as_me:$LINENO: error: Could not locate TLS/SSL package" >&5
-echo "$as_me: error: Could not locate TLS/SSL package" >&2;}
-   { (exit 1); exit 1; }; }
-else
-       { echo "$as_me:$LINENO: WARNING: TLS data protection not supported!" >&5
-echo "$as_me: WARNING: TLS data protection not supported!" >&2;}
-fi
-
-if test $ol_enable_lmpasswd != no; then
-       if test $ol_link_tls != yes ; then
-               { { echo "$as_me:$LINENO: error: LAN Manager passwords require OpenSSL" >&5
-echo "$as_me: error: LAN Manager passwords require OpenSSL" >&2;}
-   { (exit 1); exit 1; }; }
-       fi
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SLAPD_LMHASH 1
-_ACEOF
-
-fi
-
-ol_link_threads=no
+static void *task(p)
+       void *p;
+{
+       return (void *) (p == NULL);
+}
 
-case $ol_with_threads in auto | yes | nt)
+int
+main ()
+{
 
+       /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
+       pthread_t t;
+       int status;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-       echo "$as_me:$LINENO: checking for _beginthread" >&5
-echo $ECHO_N "checking for _beginthread... $ECHO_C" >&6
-if test "${ac_cv_func__beginthread+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define _beginthread to an innocuous variant, in case <limits.h> declares _beginthread.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define _beginthread innocuous__beginthread
+#if HAVE_PTHREADS > 4
+       /* Final pthreads */
+       pthread_attr_t attr;
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char _beginthread (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
 
-#ifdef __STDC__
-# include <limits.h>
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-# include <assert.h>
+       status = pthread_attr_setdetachstate(&attr, detach);
 #endif
-
-#undef _beginthread
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
+       if( status ) return status;
+       status = pthread_create( &t, &attr, task, NULL );
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char _beginthread ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub__beginthread) || defined (__stub____beginthread)
-choke me
+       if( status ) return status;
 #else
-char (*f) () = _beginthread;
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return errno;
+
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
+
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
-#ifdef __cplusplus
-}
+
+#ifdef HAVE_LINUX_THREADS
+       pthread_kill_other_threads_np();
 #endif
 
-int
-main ()
-{
-return f != _beginthread;
+       return 0;
+
   ;
   return 0;
 }
@@ -19848,237 +20106,222 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_func__beginthread=yes
+  ol_cv_pthread_kthread=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func__beginthread=no
+ol_cv_pthread_kthread=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func__beginthread" >&5
-echo "${ECHO_T}$ac_cv_func__beginthread" >&6
-
-
-       if test $ac_cv_func__beginthread = yes ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NT_THREADS 1
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
-               ol_cv_nt_threads=yes
-       fi
+/* pthread test headers */
+#include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
+#ifndef NULL
+#define NULL (void*)0
+#endif
 
+static void *task(p)
+       void *p;
+{
+       return (void *) (p == NULL);
+}
 
-       if test "$ol_cv_nt_threads" = yes ; then
-               ol_link_threads=nt
-               ol_with_threads=found
-               ol_with_yielding_select=yes
 
+int main(argc, argv)
+       int argc;
+       char **argv;
+{
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NT_SERVICE_MANAGER 1
-_ACEOF
+       /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
+       pthread_t t;
+       int status;
+       int detach = PTHREAD_CREATE_DETACHED;
 
+#if HAVE_PTHREADS > 4
+       /* Final pthreads */
+       pthread_attr_t attr;
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NT_EVENT_LOG 1
-_ACEOF
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
 
-       fi
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
+#else
+       status = pthread_attr_setdetachstate(&attr, detach);
+#endif
+       if( status ) return status;
+       status = pthread_create( &t, &attr, task, NULL );
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
+#endif
+       if( status ) return status;
+#else
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return errno;
 
-       if test $ol_with_threads = nt ; then
-               { { echo "$as_me:$LINENO: error: could not locate NT Threads" >&5
-echo "$as_me: error: could not locate NT Threads" >&2;}
-   { (exit 1); exit 1; }; }
-       fi
-       ;;
-esac
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-case $ol_with_threads in auto | yes | posix)
+       status = pthread_detach( &t );
+       if( status ) return errno;
+#endif
 
+#ifdef HAVE_LINUX_THREADS
+       pthread_kill_other_threads_np();
+#endif
+
+       return 0;
+
+}
 
-for ac_header in pthread.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ol_cv_pthread_kthread=yes
 else
-  echo "$as_me: failed program was:" >&5
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
+( exit $ac_status )
+ol_cv_pthread_kthread=no
 fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## --------------------------------------------- ##
-## Report this to <http://www.openldap.org/its/> ##
-## --------------------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+               # restore the LIBS
+               LIBS="$ol_LIBS"
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+echo "$as_me:$LINENO: result: $ol_cv_pthread_kthread" >&5
+echo "${ECHO_T}$ol_cv_pthread_kthread" >&6
 
+       if test $ol_cv_pthread_kthread = yes ; then
+               ol_link_pthreads="-kthread"
+               ol_link_threads=posix
+       fi
 fi
 
-done
-
-
-       if test $ac_cv_header_pthread_h = yes ; then
-               echo "$as_me:$LINENO: checking POSIX thread version" >&5
-echo $ECHO_N "checking POSIX thread version... $ECHO_C" >&6
-if test "${ol_cv_pthread_version+set}" = set; then
+               # Pthread try link: -pthread (ol_cv_pthread_pthread)
+if test "$ol_link_threads" = no ; then
+       # try -pthread
+       echo "$as_me:$LINENO: checking for pthread link with -pthread" >&5
+echo $ECHO_N "checking for pthread link with -pthread... $ECHO_C" >&6
+if test "${ol_cv_pthread_pthread+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       cat >conftest.$ac_ext <<_ACEOF
+               # save the flags
+               ol_LIBS="$LIBS"
+               LIBS="-pthread $LIBS"
+
+               if test "$cross_compiling" = yes; then
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#              include <pthread.h>
+/* pthread test headers */
+#include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+static void *task(p)
+       void *p;
+{
+       return (void *) (p == NULL);
+}
 
 int
 main ()
 {
 
-               int i = PTHREAD_CREATE_JOINABLE;
+       /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
+       pthread_t t;
+       int status;
+       int detach = PTHREAD_CREATE_DETACHED;
+
+#if HAVE_PTHREADS > 4
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
+#else
+       status = pthread_attr_setdetachstate(&attr, detach);
+#endif
+       if( status ) return status;
+       status = pthread_create( &t, &attr, task, NULL );
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
+#endif
+       if( status ) return status;
+#else
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return errno;
+
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
+
+       status = pthread_detach( &t );
+       if( status ) return errno;
+#endif
+
+#ifdef HAVE_LINUX_THREADS
+       pthread_kill_other_threads_np();
+#endif
+
+       return 0;
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -20092,352 +20335,157 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
+  ol_cv_pthread_pthread=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-       cat >conftest.$ac_ext <<_ACEOF
+ol_cv_pthread_pthread=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+else
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
+/* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
+#ifndef NULL
+#define NULL (void*)0
+#endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "pthread_detach" >/dev/null 2>&1; then
-  ol_cv_pthread_version=10
-else
-  ol_cv_pthread_version=8
-fi
-rm -f conftest*
+static void *task(p)
+       void *p;
+{
+       return (void *) (p == NULL);
+}
 
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
+int main(argc, argv)
+       int argc;
+       char **argv;
+{
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+       /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
+       pthread_t t;
+       int status;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#              include <pthread.h>
-#              ifdef PTHREAD_CREATE_UNDETACHED
-               draft7
-#              endif
+#if HAVE_PTHREADS > 4
+       /* Final pthreads */
+       pthread_attr_t attr;
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "draft7" >/dev/null 2>&1; then
-  ol_cv_pthread_version=7
-else
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
+#else
+       status = pthread_attr_setdetachstate(&attr, detach);
+#endif
+       if( status ) return status;
+       status = pthread_create( &t, &attr, task, NULL );
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
+#endif
+       if( status ) return status;
+#else
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return errno;
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "pthread_attr_init" >/dev/null 2>&1; then
-  ol_cv_pthread_version=6
-else
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+       status = pthread_detach( &t );
+       if( status ) return errno;
+#endif
 
-#              include <pthread.h>
-#ifdef         PTHREAD_MUTEX_INITIALIZER
-               draft5
+#ifdef HAVE_LINUX_THREADS
+       pthread_kill_other_threads_np();
 #endif
 
+       return 0;
+
+}
+
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "draft5" >/dev/null 2>&1; then
-  ol_cv_pthread_version=5
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_pthread_pthread=yes
 else
-  ol_cv_pthread_version=4
-fi
-rm -f conftest*
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+( exit $ac_status )
+ol_cv_pthread_pthread=no
 fi
-rm -f conftest*
-
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f conftest*
 
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+               # restore the LIBS
+               LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_version" >&5
-echo "${ECHO_T}$ol_cv_pthread_version" >&6
-
-
-               if test $ol_cv_pthread_version != 0 ; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PTHREADS $ol_cv_pthread_version
-_ACEOF
-
-               else
-                       { { echo "$as_me:$LINENO: error: unknown pthread version" >&5
-echo "$as_me: error: unknown pthread version" >&2;}
-   { (exit 1); exit 1; }; }
-               fi
-
-               # consider threads found
-               ol_with_threads=found
+echo "$as_me:$LINENO: result: $ol_cv_pthread_pthread" >&5
+echo "${ECHO_T}$ol_cv_pthread_pthread" >&6
 
+       if test $ol_cv_pthread_pthread = yes ; then
+               ol_link_pthreads="-pthread"
+               ol_link_threads=posix
+       fi
+fi
 
-       echo "$as_me:$LINENO: checking for LinuxThreads pthread.h" >&5
-echo $ECHO_N "checking for LinuxThreads pthread.h... $ECHO_C" >&6
-if test "${ol_cv_header_linux_threads+set}" = set; then
+               # Pthread try link: -pthreads (ol_cv_pthread_pthreads)
+if test "$ol_link_threads" = no ; then
+       # try -pthreads
+       echo "$as_me:$LINENO: checking for pthread link with -pthreads" >&5
+echo $ECHO_N "checking for pthread link with -pthreads... $ECHO_C" >&6
+if test "${ol_cv_pthread_pthreads+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+
+               # save the flags
+               ol_LIBS="$LIBS"
+               LIBS="-pthreads $LIBS"
+
+               if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <pthread.h>
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "pthread_kill_other_threads_np" >/dev/null 2>&1; then
-  ol_cv_header_linux_threads=yes
-else
-  ol_cv_header_linux_threads=no
-fi
-rm -f conftest*
-
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_header_linux_threads" >&5
-echo "${ECHO_T}$ol_cv_header_linux_threads" >&6
-       if test $ol_cv_header_linux_threads = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LINUX_THREADS 1
-_ACEOF
-
-       fi
-
-
-       echo "$as_me:$LINENO: checking for GNU Pth pthread.h" >&5
-echo $ECHO_N "checking for GNU Pth pthread.h... $ECHO_C" >&6
-if test "${ol_cv_header_gnu_pth_pthread_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
-#ifdef _POSIX_THREAD_IS_GNU_PTH
-       __gnu_pth__;
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__gnu_pth__" >/dev/null 2>&1; then
-  ol_cv_header_gnu_pth_pthread_h=yes
-else
-  ol_cv_header_gnu_pth_pthread_h=no
-fi
-rm -f conftest*
-
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_header_gnu_pth_pthread_h" >&5
-echo "${ECHO_T}$ol_cv_header_gnu_pth_pthread_h" >&6
-
-
-               if test $ol_cv_header_gnu_pth_pthread_h = no ; then
-
-for ac_header in sched.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## --------------------------------------------- ##
-## Report this to <http://www.openldap.org/its/> ##
-## --------------------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-               fi
-
-
-                               echo "$as_me:$LINENO: checking for pthread_create in default libraries" >&5
-echo $ECHO_N "checking for pthread_create in default libraries... $ECHO_C" >&6
-if test "${ol_cv_pthread_create+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-                       if test "$cross_compiling" = yes; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* pthread test headers */
+
+/* pthread test headers */
 #include <pthread.h>
 #if HAVE_PTHREADS < 7
 #include <errno.h>
@@ -20528,12 +20576,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_create=yes
+  ol_cv_pthread_pthreads=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_create=no
+ol_cv_pthread_pthreads=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -20626,38 +20674,43 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_create=yes
+  ol_cv_pthread_pthreads=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_create=no
+ol_cv_pthread_pthreads=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+               # restore the LIBS
+               LIBS="$ol_LIBS"
+
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_create" >&5
-echo "${ECHO_T}$ol_cv_pthread_create" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_pthreads" >&5
+echo "${ECHO_T}$ol_cv_pthread_pthreads" >&6
 
-               if test $ol_cv_pthread_create != no ; then
-                       ol_link_threads=posix
-                       ol_link_pthreads=""
-               fi
+       if test $ol_cv_pthread_pthreads = yes ; then
+               ol_link_pthreads="-pthreads"
+               ol_link_threads=posix
+       fi
+fi
 
-               # Pthread try link: -kthread (ol_cv_pthread_kthread)
+               # Pthread try link: -mthreads (ol_cv_pthread_mthreads)
 if test "$ol_link_threads" = no ; then
-       # try -kthread
-       echo "$as_me:$LINENO: checking for pthread link with -kthread" >&5
-echo $ECHO_N "checking for pthread link with -kthread... $ECHO_C" >&6
-if test "${ol_cv_pthread_kthread+set}" = set; then
+       # try -mthreads
+       echo "$as_me:$LINENO: checking for pthread link with -mthreads" >&5
+echo $ECHO_N "checking for pthread link with -mthreads... $ECHO_C" >&6
+if test "${ol_cv_pthread_mthreads+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-kthread $LIBS"
+               LIBS="-mthreads $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -20758,12 +20811,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_kthread=yes
+  ol_cv_pthread_mthreads=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_kthread=no
+ol_cv_pthread_mthreads=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -20856,14 +20909,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_kthread=yes
+  ol_cv_pthread_mthreads=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_kthread=no
+ol_cv_pthread_mthreads=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_kthread" >&5
-echo "${ECHO_T}$ol_cv_pthread_kthread" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_mthreads" >&5
+echo "${ECHO_T}$ol_cv_pthread_mthreads" >&6
 
-       if test $ol_cv_pthread_kthread = yes ; then
-               ol_link_pthreads="-kthread"
+       if test $ol_cv_pthread_mthreads = yes ; then
+               ol_link_pthreads="-mthreads"
                ol_link_threads=posix
        fi
 fi
 
-               # Pthread try link: -pthread (ol_cv_pthread_pthread)
+               # Pthread try link: -thread (ol_cv_pthread_thread)
 if test "$ol_link_threads" = no ; then
-       # try -pthread
-       echo "$as_me:$LINENO: checking for pthread link with -pthread" >&5
-echo $ECHO_N "checking for pthread link with -pthread... $ECHO_C" >&6
-if test "${ol_cv_pthread_pthread+set}" = set; then
+       # try -thread
+       echo "$as_me:$LINENO: checking for pthread link with -thread" >&5
+echo $ECHO_N "checking for pthread link with -thread... $ECHO_C" >&6
+if test "${ol_cv_pthread_thread+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-pthread $LIBS"
+               LIBS="-thread $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -20993,12 +21046,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_pthread=yes
+  ol_cv_pthread_thread=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_pthread=no
+ol_cv_pthread_thread=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -21091,14 +21144,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_pthread=yes
+  ol_cv_pthread_thread=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_pthread=no
+ol_cv_pthread_thread=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_pthread" >&5
-echo "${ECHO_T}$ol_cv_pthread_pthread" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_thread" >&5
+echo "${ECHO_T}$ol_cv_pthread_thread" >&6
 
-       if test $ol_cv_pthread_pthread = yes ; then
-               ol_link_pthreads="-pthread"
+       if test $ol_cv_pthread_thread = yes ; then
+               ol_link_pthreads="-thread"
                ol_link_threads=posix
        fi
 fi
 
-               # Pthread try link: -pthreads (ol_cv_pthread_pthreads)
+
+               # Pthread try link: -lpthread -lmach -lexc -lc_r (ol_cv_pthread_lpthread_lmach_lexc_lc_r)
 if test "$ol_link_threads" = no ; then
-       # try -pthreads
-       echo "$as_me:$LINENO: checking for pthread link with -pthreads" >&5
-echo $ECHO_N "checking for pthread link with -pthreads... $ECHO_C" >&6
-if test "${ol_cv_pthread_pthreads+set}" = set; then
+       # try -lpthread -lmach -lexc -lc_r
+       echo "$as_me:$LINENO: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
+echo $ECHO_N "checking for pthread link with -lpthread -lmach -lexc -lc_r... $ECHO_C" >&6
+if test "${ol_cv_pthread_lpthread_lmach_lexc_lc_r+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-pthreads $LIBS"
+               LIBS="-lpthread -lmach -lexc -lc_r $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -21228,12 +21282,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_pthreads=yes
+  ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_pthreads=no
+ol_cv_pthread_lpthread_lmach_lexc_lc_r=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -21326,14 +21380,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_pthreads=yes
+  ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_pthreads=no
+ol_cv_pthread_lpthread_lmach_lexc_lc_r=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_pthreads" >&5
-echo "${ECHO_T}$ol_cv_pthread_pthreads" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthread_lmach_lexc_lc_r" >&5
+echo "${ECHO_T}$ol_cv_pthread_lpthread_lmach_lexc_lc_r" >&6
 
-       if test $ol_cv_pthread_pthreads = yes ; then
-               ol_link_pthreads="-pthreads"
+       if test $ol_cv_pthread_lpthread_lmach_lexc_lc_r = yes ; then
+               ol_link_pthreads="-lpthread -lmach -lexc -lc_r"
                ol_link_threads=posix
        fi
 fi
 
-               # Pthread try link: -mthreads (ol_cv_pthread_mthreads)
+               # Pthread try link: -lpthread -lmach -lexc (ol_cv_pthread_lpthread_lmach_lexc)
 if test "$ol_link_threads" = no ; then
-       # try -mthreads
-       echo "$as_me:$LINENO: checking for pthread link with -mthreads" >&5
-echo $ECHO_N "checking for pthread link with -mthreads... $ECHO_C" >&6
-if test "${ol_cv_pthread_mthreads+set}" = set; then
+       # try -lpthread -lmach -lexc
+       echo "$as_me:$LINENO: checking for pthread link with -lpthread -lmach -lexc" >&5
+echo $ECHO_N "checking for pthread link with -lpthread -lmach -lexc... $ECHO_C" >&6
+if test "${ol_cv_pthread_lpthread_lmach_lexc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-mthreads $LIBS"
+               LIBS="-lpthread -lmach -lexc $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -21463,12 +21517,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_mthreads=yes
+  ol_cv_pthread_lpthread_lmach_lexc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_mthreads=no
+ol_cv_pthread_lpthread_lmach_lexc=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -21561,14 +21615,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_mthreads=yes
+  ol_cv_pthread_lpthread_lmach_lexc=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_mthreads=no
+ol_cv_pthread_lpthread_lmach_lexc=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_mthreads" >&5
-echo "${ECHO_T}$ol_cv_pthread_mthreads" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthread_lmach_lexc" >&5
+echo "${ECHO_T}$ol_cv_pthread_lpthread_lmach_lexc" >&6
 
-       if test $ol_cv_pthread_mthreads = yes ; then
-               ol_link_pthreads="-mthreads"
+       if test $ol_cv_pthread_lpthread_lmach_lexc = yes ; then
+               ol_link_pthreads="-lpthread -lmach -lexc"
                ol_link_threads=posix
        fi
 fi
 
-               # Pthread try link: -thread (ol_cv_pthread_thread)
+
+               # Pthread try link: -lpthread -Wl,-woff,85 (ol_cv_pthread_lib_lpthread_woff)
 if test "$ol_link_threads" = no ; then
-       # try -thread
-       echo "$as_me:$LINENO: checking for pthread link with -thread" >&5
-echo $ECHO_N "checking for pthread link with -thread... $ECHO_C" >&6
-if test "${ol_cv_pthread_thread+set}" = set; then
+       # try -lpthread -Wl,-woff,85
+       echo "$as_me:$LINENO: checking for pthread link with -lpthread -Wl,-woff,85" >&5
+echo $ECHO_N "checking for pthread link with -lpthread -Wl,-woff,85... $ECHO_C" >&6
+if test "${ol_cv_pthread_lib_lpthread_woff+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-thread $LIBS"
+               LIBS="-lpthread -Wl,-woff,85 $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -21698,12 +21753,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_thread=yes
+  ol_cv_pthread_lib_lpthread_woff=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_thread=no
+ol_cv_pthread_lib_lpthread_woff=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -21796,14 +21851,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_thread=yes
+  ol_cv_pthread_lib_lpthread_woff=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_thread=no
+ol_cv_pthread_lib_lpthread_woff=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_thread" >&5
-echo "${ECHO_T}$ol_cv_pthread_thread" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lib_lpthread_woff" >&5
+echo "${ECHO_T}$ol_cv_pthread_lib_lpthread_woff" >&6
 
-       if test $ol_cv_pthread_thread = yes ; then
-               ol_link_pthreads="-thread"
+       if test $ol_cv_pthread_lib_lpthread_woff = yes ; then
+               ol_link_pthreads="-lpthread -Wl,-woff,85"
                ol_link_threads=posix
        fi
 fi
 
 
-               # Pthread try link: -lpthread -lmach -lexc -lc_r (ol_cv_pthread_lpthread_lmach_lexc_lc_r)
+               # Pthread try link: -lpthread (ol_cv_pthread_lpthread)
 if test "$ol_link_threads" = no ; then
-       # try -lpthread -lmach -lexc -lc_r
-       echo "$as_me:$LINENO: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
-echo $ECHO_N "checking for pthread link with -lpthread -lmach -lexc -lc_r... $ECHO_C" >&6
-if test "${ol_cv_pthread_lpthread_lmach_lexc_lc_r+set}" = set; then
+       # try -lpthread
+       echo "$as_me:$LINENO: checking for pthread link with -lpthread" >&5
+echo $ECHO_N "checking for pthread link with -lpthread... $ECHO_C" >&6
+if test "${ol_cv_pthread_lpthread+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-lpthread -lmach -lexc -lc_r $LIBS"
+               LIBS="-lpthread $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -21934,12 +21989,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
+  ol_cv_pthread_lpthread=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lpthread_lmach_lexc_lc_r=no
+ol_cv_pthread_lpthread=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -22032,14 +22087,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
+  ol_cv_pthread_lpthread=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_lpthread_lmach_lexc_lc_r=no
+ol_cv_pthread_lpthread=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthread_lmach_lexc_lc_r" >&5
-echo "${ECHO_T}$ol_cv_pthread_lpthread_lmach_lexc_lc_r" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthread" >&5
+echo "${ECHO_T}$ol_cv_pthread_lpthread" >&6
 
-       if test $ol_cv_pthread_lpthread_lmach_lexc_lc_r = yes ; then
-               ol_link_pthreads="-lpthread -lmach -lexc -lc_r"
+       if test $ol_cv_pthread_lpthread = yes ; then
+               ol_link_pthreads="-lpthread"
                ol_link_threads=posix
        fi
 fi
 
-               # Pthread try link: -lpthread -lmach -lexc (ol_cv_pthread_lpthread_lmach_lexc)
+               # Pthread try link: -lc_r (ol_cv_pthread_lc_r)
 if test "$ol_link_threads" = no ; then
-       # try -lpthread -lmach -lexc
-       echo "$as_me:$LINENO: checking for pthread link with -lpthread -lmach -lexc" >&5
-echo $ECHO_N "checking for pthread link with -lpthread -lmach -lexc... $ECHO_C" >&6
-if test "${ol_cv_pthread_lpthread_lmach_lexc+set}" = set; then
+       # try -lc_r
+       echo "$as_me:$LINENO: checking for pthread link with -lc_r" >&5
+echo $ECHO_N "checking for pthread link with -lc_r... $ECHO_C" >&6
+if test "${ol_cv_pthread_lc_r+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-lpthread -lmach -lexc $LIBS"
+               LIBS="-lc_r $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -22169,12 +22224,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthread_lmach_lexc=yes
+  ol_cv_pthread_lc_r=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lpthread_lmach_lexc=no
+ol_cv_pthread_lc_r=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -22267,14 +22322,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthread_lmach_lexc=yes
+  ol_cv_pthread_lc_r=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_lpthread_lmach_lexc=no
+ol_cv_pthread_lc_r=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthread_lmach_lexc" >&5
-echo "${ECHO_T}$ol_cv_pthread_lpthread_lmach_lexc" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lc_r" >&5
+echo "${ECHO_T}$ol_cv_pthread_lc_r" >&6
 
-       if test $ol_cv_pthread_lpthread_lmach_lexc = yes ; then
-               ol_link_pthreads="-lpthread -lmach -lexc"
+       if test $ol_cv_pthread_lc_r = yes ; then
+               ol_link_pthreads="-lc_r"
                ol_link_threads=posix
        fi
 fi
 
 
-               # Pthread try link: -lpthread -Wl,-woff,85 (ol_cv_pthread_lib_lpthread_woff)
+               # Pthread try link: -threads (ol_cv_pthread_threads)
 if test "$ol_link_threads" = no ; then
-       # try -lpthread -Wl,-woff,85
-       echo "$as_me:$LINENO: checking for pthread link with -lpthread -Wl,-woff,85" >&5
-echo $ECHO_N "checking for pthread link with -lpthread -Wl,-woff,85... $ECHO_C" >&6
-if test "${ol_cv_pthread_lib_lpthread_woff+set}" = set; then
+       # try -threads
+       echo "$as_me:$LINENO: checking for pthread link with -threads" >&5
+echo $ECHO_N "checking for pthread link with -threads... $ECHO_C" >&6
+if test "${ol_cv_pthread_threads+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-lpthread -Wl,-woff,85 $LIBS"
+               LIBS="-threads $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -22405,12 +22460,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lib_lpthread_woff=yes
+  ol_cv_pthread_threads=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lib_lpthread_woff=no
+ol_cv_pthread_threads=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -22503,14 +22558,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lib_lpthread_woff=yes
+  ol_cv_pthread_threads=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_lib_lpthread_woff=no
+ol_cv_pthread_threads=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lib_lpthread_woff" >&5
-echo "${ECHO_T}$ol_cv_pthread_lib_lpthread_woff" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_threads" >&5
+echo "${ECHO_T}$ol_cv_pthread_threads" >&6
 
-       if test $ol_cv_pthread_lib_lpthread_woff = yes ; then
-               ol_link_pthreads="-lpthread -Wl,-woff,85"
+       if test $ol_cv_pthread_threads = yes ; then
+               ol_link_pthreads="-threads"
                ol_link_threads=posix
        fi
 fi
 
 
-               # Pthread try link: -lpthread (ol_cv_pthread_lpthread)
+               # Pthread try link: -lpthreads -lmach -lexc -lc_r (ol_cv_pthread_lpthreads_lmach_lexc_lc_r)
 if test "$ol_link_threads" = no ; then
-       # try -lpthread
-       echo "$as_me:$LINENO: checking for pthread link with -lpthread" >&5
-echo $ECHO_N "checking for pthread link with -lpthread... $ECHO_C" >&6
-if test "${ol_cv_pthread_lpthread+set}" = set; then
+       # try -lpthreads -lmach -lexc -lc_r
+       echo "$as_me:$LINENO: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
+echo $ECHO_N "checking for pthread link with -lpthreads -lmach -lexc -lc_r... $ECHO_C" >&6
+if test "${ol_cv_pthread_lpthreads_lmach_lexc_lc_r+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-lpthread $LIBS"
+               LIBS="-lpthreads -lmach -lexc -lc_r $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -22641,12 +22696,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthread=yes
+  ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lpthread=no
+ol_cv_pthread_lpthreads_lmach_lexc_lc_r=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -22739,14 +22794,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthread=yes
+  ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_lpthread=no
+ol_cv_pthread_lpthreads_lmach_lexc_lc_r=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthread" >&5
-echo "${ECHO_T}$ol_cv_pthread_lpthread" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthreads_lmach_lexc_lc_r" >&5
+echo "${ECHO_T}$ol_cv_pthread_lpthreads_lmach_lexc_lc_r" >&6
 
-       if test $ol_cv_pthread_lpthread = yes ; then
-               ol_link_pthreads="-lpthread"
+       if test $ol_cv_pthread_lpthreads_lmach_lexc_lc_r = yes ; then
+               ol_link_pthreads="-lpthreads -lmach -lexc -lc_r"
                ol_link_threads=posix
        fi
 fi
 
-               # Pthread try link: -lc_r (ol_cv_pthread_lc_r)
+               # Pthread try link: -lpthreads -lmach -lexc (ol_cv_pthread_lpthreads_lmach_lexc)
 if test "$ol_link_threads" = no ; then
-       # try -lc_r
-       echo "$as_me:$LINENO: checking for pthread link with -lc_r" >&5
-echo $ECHO_N "checking for pthread link with -lc_r... $ECHO_C" >&6
-if test "${ol_cv_pthread_lc_r+set}" = set; then
+       # try -lpthreads -lmach -lexc
+       echo "$as_me:$LINENO: checking for pthread link with -lpthreads -lmach -lexc" >&5
+echo $ECHO_N "checking for pthread link with -lpthreads -lmach -lexc... $ECHO_C" >&6
+if test "${ol_cv_pthread_lpthreads_lmach_lexc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-lc_r $LIBS"
+               LIBS="-lpthreads -lmach -lexc $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -22876,12 +22931,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lc_r=yes
+  ol_cv_pthread_lpthreads_lmach_lexc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lc_r=no
+ol_cv_pthread_lpthreads_lmach_lexc=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -22974,14 +23029,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lc_r=yes
+  ol_cv_pthread_lpthreads_lmach_lexc=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_lc_r=no
+ol_cv_pthread_lpthreads_lmach_lexc=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lc_r" >&5
-echo "${ECHO_T}$ol_cv_pthread_lc_r" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthreads_lmach_lexc" >&5
+echo "${ECHO_T}$ol_cv_pthread_lpthreads_lmach_lexc" >&6
 
-       if test $ol_cv_pthread_lc_r = yes ; then
-               ol_link_pthreads="-lc_r"
+       if test $ol_cv_pthread_lpthreads_lmach_lexc = yes ; then
+               ol_link_pthreads="-lpthreads -lmach -lexc"
                ol_link_threads=posix
        fi
 fi
 
-
-               # Pthread try link: -threads (ol_cv_pthread_threads)
+               # Pthread try link: -lpthreads -lexc (ol_cv_pthread_lpthreads_lexc)
 if test "$ol_link_threads" = no ; then
-       # try -threads
-       echo "$as_me:$LINENO: checking for pthread link with -threads" >&5
-echo $ECHO_N "checking for pthread link with -threads... $ECHO_C" >&6
-if test "${ol_cv_pthread_threads+set}" = set; then
+       # try -lpthreads -lexc
+       echo "$as_me:$LINENO: checking for pthread link with -lpthreads -lexc" >&5
+echo $ECHO_N "checking for pthread link with -lpthreads -lexc... $ECHO_C" >&6
+if test "${ol_cv_pthread_lpthreads_lexc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-threads $LIBS"
+               LIBS="-lpthreads -lexc $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -23112,12 +23166,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_threads=yes
+  ol_cv_pthread_lpthreads_lexc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_threads=no
+ol_cv_pthread_lpthreads_lexc=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -23210,14 +23264,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_threads=yes
+  ol_cv_pthread_lpthreads_lexc=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_threads=no
+ol_cv_pthread_lpthreads_lexc=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_threads" >&5
-echo "${ECHO_T}$ol_cv_pthread_threads" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthreads_lexc" >&5
+echo "${ECHO_T}$ol_cv_pthread_lpthreads_lexc" >&6
 
-       if test $ol_cv_pthread_threads = yes ; then
-               ol_link_pthreads="-threads"
+       if test $ol_cv_pthread_lpthreads_lexc = yes ; then
+               ol_link_pthreads="-lpthreads -lexc"
                ol_link_threads=posix
        fi
 fi
 
 
-               # Pthread try link: -lpthreads -lmach -lexc -lc_r (ol_cv_pthread_lpthreads_lmach_lexc_lc_r)
+               # Pthread try link: -lpthreads (ol_cv_pthread_lib_lpthreads)
 if test "$ol_link_threads" = no ; then
-       # try -lpthreads -lmach -lexc -lc_r
-       echo "$as_me:$LINENO: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
-echo $ECHO_N "checking for pthread link with -lpthreads -lmach -lexc -lc_r... $ECHO_C" >&6
-if test "${ol_cv_pthread_lpthreads_lmach_lexc_lc_r+set}" = set; then
+       # try -lpthreads
+       echo "$as_me:$LINENO: checking for pthread link with -lpthreads" >&5
+echo $ECHO_N "checking for pthread link with -lpthreads... $ECHO_C" >&6
+if test "${ol_cv_pthread_lib_lpthreads+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
                # save the flags
                ol_LIBS="$LIBS"
-               LIBS="-lpthreads -lmach -lexc -lc_r $LIBS"
+               LIBS="-lpthreads $LIBS"
 
                if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
@@ -23348,12 +23402,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
+  ol_cv_pthread_lib_lpthreads=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lpthreads_lmach_lexc_lc_r=no
+ol_cv_pthread_lib_lpthreads=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -23446,14 +23500,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
+  ol_cv_pthread_lib_lpthreads=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ol_cv_pthread_lpthreads_lmach_lexc_lc_r=no
+ol_cv_pthread_lib_lpthreads=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
                LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthreads_lmach_lexc_lc_r" >&5
-echo "${ECHO_T}$ol_cv_pthread_lpthreads_lmach_lexc_lc_r" >&6
+echo "$as_me:$LINENO: result: $ol_cv_pthread_lib_lpthreads" >&5
+echo "${ECHO_T}$ol_cv_pthread_lib_lpthreads" >&6
 
-       if test $ol_cv_pthread_lpthreads_lmach_lexc_lc_r = yes ; then
-               ol_link_pthreads="-lpthreads -lmach -lexc -lc_r"
+       if test $ol_cv_pthread_lib_lpthreads = yes ; then
+               ol_link_pthreads="-lpthreads"
                ol_link_threads=posix
        fi
 fi
 
-               # Pthread try link: -lpthreads -lmach -lexc (ol_cv_pthread_lpthreads_lmach_lexc)
-if test "$ol_link_threads" = no ; then
-       # try -lpthreads -lmach -lexc
-       echo "$as_me:$LINENO: checking for pthread link with -lpthreads -lmach -lexc" >&5
-echo $ECHO_N "checking for pthread link with -lpthreads -lmach -lexc... $ECHO_C" >&6
-if test "${ol_cv_pthread_lpthreads_lmach_lexc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
 
-               # save the flags
-               ol_LIBS="$LIBS"
-               LIBS="-lpthreads -lmach -lexc $LIBS"
+               if test $ol_link_threads != no ; then
+                       LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads"
 
-               if test "$cross_compiling" = yes; then
+                                               save_CPPFLAGS="$CPPFLAGS"
+                       save_LIBS="$LIBS"
+                       LIBS="$LTHREAD_LIBS $LIBS"
+
+
+
+
+for ac_func in sched_yield pthread_yield thr_yield
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
 
-/* pthread test headers */
-#include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
-#ifndef NULL
-#define NULL (void*)0
-#endif
-
-static void *task(p)
-       void *p;
-{
-       return (void *) (p == NULL);
-}
-
-int
-main ()
-{
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
 
-       /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
 #endif
-       pthread_t t;
-       int status;
-       int detach = PTHREAD_CREATE_DETACHED;
 
-#if HAVE_PTHREADS > 4
-       /* Final pthreads */
-       pthread_attr_t attr;
-
-       status = pthread_attr_init(&attr);
-       if( status ) return status;
+#undef $ac_func
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
-#else
-       status = pthread_attr_setdetachstate(&attr, detach);
-#endif
-       if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
 #endif
-       if( status ) return status;
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
 #else
-       /* Draft 4 pthreads */
-       status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
-
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
-
-       status = pthread_detach( &t );
-       if( status ) return errno;
+char (*f) () = $ac_func;
 #endif
-
-#ifdef HAVE_LINUX_THREADS
-       pthread_kill_other_threads_np();
+#ifdef __cplusplus
+}
 #endif
 
-       return 0;
-
+int
+main ()
+{
+return f != $ac_func;
   ;
   return 0;
 }
@@ -23583,215 +23617,170 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthreads_lmach_lexc=yes
+  eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lpthreads_lmach_lexc=no
+eval "$as_ac_var=no"
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+                       if test $ac_cv_func_sched_yield = no &&
+                          test $ac_cv_func_pthread_yield = no &&
+                          test $ac_cv_func_thr_yield = no ; then
+                                                               echo "$as_me:$LINENO: checking for sched_yield in -lrt" >&5
+echo $ECHO_N "checking for sched_yield in -lrt... $ECHO_C" >&6
+if test "${ac_cv_lib_rt_sched_yield+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* pthread test headers */
-#include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
-#ifndef NULL
-#define NULL (void*)0
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
 #endif
-
-static void *task(p)
-       void *p;
-{
-       return (void *) (p == NULL);
-}
-
-
-int main(argc, argv)
-       int argc;
-       char **argv;
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sched_yield ();
+int
+main ()
 {
-
-       /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
-       pthread_t t;
-       int status;
-       int detach = PTHREAD_CREATE_DETACHED;
-
-#if HAVE_PTHREADS > 4
-       /* Final pthreads */
-       pthread_attr_t attr;
-
-       status = pthread_attr_init(&attr);
-       if( status ) return status;
-
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
-#else
-       status = pthread_attr_setdetachstate(&attr, detach);
-#endif
-       if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
-#endif
-       if( status ) return status;
-#else
-       /* Draft 4 pthreads */
-       status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
-
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
-
-       status = pthread_detach( &t );
-       if( status ) return errno;
-#endif
-
-#ifdef HAVE_LINUX_THREADS
-       pthread_kill_other_threads_np();
-#endif
-
-       return 0;
-
+sched_yield ();
+  ;
+  return 0;
 }
-
 _ACEOF
-rm -f conftest$ac_exeext
+rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthreads_lmach_lexc=yes
+  ac_cv_lib_rt_sched_yield=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-ol_cv_pthread_lpthreads_lmach_lexc=no
+ac_cv_lib_rt_sched_yield=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_rt_sched_yield" >&5
+echo "${ECHO_T}$ac_cv_lib_rt_sched_yield" >&6
+if test $ac_cv_lib_rt_sched_yield = yes; then
+  LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
 
-               # restore the LIBS
-               LIBS="$ol_LIBS"
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCHED_YIELD 1
+_ACEOF
 
+                                       ac_cv_func_sched_yield=yes
+else
+  ac_cv_func_sched_yield=no
 fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthreads_lmach_lexc" >&5
-echo "${ECHO_T}$ol_cv_pthread_lpthreads_lmach_lexc" >&6
 
-       if test $ol_cv_pthread_lpthreads_lmach_lexc = yes ; then
-               ol_link_pthreads="-lpthreads -lmach -lexc"
-               ol_link_threads=posix
-       fi
-fi
+                       fi
+                       if test $ac_cv_func_sched_yield = no &&
+                          test $ac_cv_func_pthread_yield = no &&
+                          test "$ac_cv_func_thr_yield" = no ; then
+                               { echo "$as_me:$LINENO: WARNING: could not locate sched_yield() or pthread_yield()" >&5
+echo "$as_me: WARNING: could not locate sched_yield() or pthread_yield()" >&2;}
+                       fi
 
-               # Pthread try link: -lpthreads -lexc (ol_cv_pthread_lpthreads_lexc)
-if test "$ol_link_threads" = no ; then
-       # try -lpthreads -lexc
-       echo "$as_me:$LINENO: checking for pthread link with -lpthreads -lexc" >&5
-echo $ECHO_N "checking for pthread link with -lpthreads -lexc... $ECHO_C" >&6
-if test "${ol_cv_pthread_lpthreads_lexc+set}" = set; then
+
+for ac_func in pthread_kill
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-
-               # save the flags
-               ol_LIBS="$LIBS"
-               LIBS="-lpthreads -lexc $LIBS"
-
-               if test "$cross_compiling" = yes; then
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
 
-/* pthread test headers */
-#include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
-#ifndef NULL
-#define NULL (void*)0
-#endif
-
-static void *task(p)
-       void *p;
-{
-       return (void *) (p == NULL);
-}
-
-int
-main ()
-{
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
 
-       /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
 #endif
-       pthread_t t;
-       int status;
-       int detach = PTHREAD_CREATE_DETACHED;
 
-#if HAVE_PTHREADS > 4
-       /* Final pthreads */
-       pthread_attr_t attr;
-
-       status = pthread_attr_init(&attr);
-       if( status ) return status;
+#undef $ac_func
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
-#else
-       status = pthread_attr_setdetachstate(&attr, detach);
-#endif
-       if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
 #endif
-       if( status ) return status;
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
 #else
-       /* Draft 4 pthreads */
-       status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
-
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
-
-       status = pthread_detach( &t );
-       if( status ) return errno;
+char (*f) () = $ac_func;
 #endif
-
-#ifdef HAVE_LINUX_THREADS
-       pthread_kill_other_threads_np();
+#ifdef __cplusplus
+}
 #endif
 
-       return 0;
-
+int
+main ()
+{
+return f != $ac_func;
   ;
   return 0;
 }
@@ -23818,216 +23807,116 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthreads_lexc=yes
+  eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lpthreads_lexc=no
+eval "$as_ac_var=no"
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+                                                                       echo "$as_me:$LINENO: checking for pthread_rwlock_destroy with <pthread.h>" >&5
+echo $ECHO_N "checking for pthread_rwlock_destroy with <pthread.h>... $ECHO_C" >&6
+if test "${ol_cv_func_pthread_rwlock_destroy+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+
+                                                               cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* pthread test headers */
 #include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
-#ifndef NULL
-#define NULL (void*)0
-#endif
-
-static void *task(p)
-       void *p;
-{
-       return (void *) (p == NULL);
-}
-
+pthread_rwlock_t rwlock;
 
-int main(argc, argv)
-       int argc;
-       char **argv;
+int
+main ()
 {
-
-       /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
-       pthread_t t;
-       int status;
-       int detach = PTHREAD_CREATE_DETACHED;
-
-#if HAVE_PTHREADS > 4
-       /* Final pthreads */
-       pthread_attr_t attr;
-
-       status = pthread_attr_init(&attr);
-       if( status ) return status;
-
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
-#else
-       status = pthread_attr_setdetachstate(&attr, detach);
-#endif
-       if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
-#endif
-       if( status ) return status;
-#else
-       /* Draft 4 pthreads */
-       status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
-
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
-
-       status = pthread_detach( &t );
-       if( status ) return errno;
-#endif
-
-#ifdef HAVE_LINUX_THREADS
-       pthread_kill_other_threads_np();
-#endif
-
-       return 0;
-
+pthread_rwlock_destroy(&rwlock);
+  ;
+  return 0;
 }
-
 _ACEOF
-rm -f conftest$ac_exeext
+rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lpthreads_lexc=yes
+  ol_cv_func_pthread_rwlock_destroy=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-ol_cv_pthread_lpthreads_lexc=no
+ol_cv_func_pthread_rwlock_destroy=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
 fi
+echo "$as_me:$LINENO: result: $ol_cv_func_pthread_rwlock_destroy" >&5
+echo "${ECHO_T}$ol_cv_func_pthread_rwlock_destroy" >&6
+                       if test $ol_cv_func_pthread_rwlock_destroy = yes ; then
 
-               # restore the LIBS
-               LIBS="$ol_LIBS"
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lpthreads_lexc" >&5
-echo "${ECHO_T}$ol_cv_pthread_lpthreads_lexc" >&6
-
-       if test $ol_cv_pthread_lpthreads_lexc = yes ; then
-               ol_link_pthreads="-lpthreads -lexc"
-               ol_link_threads=posix
-       fi
-fi
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_RWLOCK_DESTROY 1
+_ACEOF
 
+                       fi
 
-               # Pthread try link: -lpthreads (ol_cv_pthread_lib_lpthreads)
-if test "$ol_link_threads" = no ; then
-       # try -lpthreads
-       echo "$as_me:$LINENO: checking for pthread link with -lpthreads" >&5
-echo $ECHO_N "checking for pthread link with -lpthreads... $ECHO_C" >&6
-if test "${ol_cv_pthread_lib_lpthreads+set}" = set; then
+                                                                       echo "$as_me:$LINENO: checking for pthread_detach with <pthread.h>" >&5
+echo $ECHO_N "checking for pthread_detach with <pthread.h>... $ECHO_C" >&6
+if test "${ol_cv_func_pthread_detach+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-               # save the flags
-               ol_LIBS="$LIBS"
-               LIBS="-lpthreads $LIBS"
-
-               if test "$cross_compiling" = yes; then
-  cat >conftest.$ac_ext <<_ACEOF
+                                                               cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* pthread test headers */
 #include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
 
-static void *task(p)
-       void *p;
-{
-       return (void *) (p == NULL);
-}
-
 int
 main ()
 {
-
-       /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
-       pthread_t t;
-       int status;
-       int detach = PTHREAD_CREATE_DETACHED;
-
-#if HAVE_PTHREADS > 4
-       /* Final pthreads */
-       pthread_attr_t attr;
-
-       status = pthread_attr_init(&attr);
-       if( status ) return status;
-
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
-#else
-       status = pthread_attr_setdetachstate(&attr, detach);
-#endif
-       if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
-#endif
-       if( status ) return status;
-#else
-       /* Draft 4 pthreads */
-       status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
-
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
-
-       status = pthread_detach( &t );
-       if( status ) return errno;
-#endif
-
-#ifdef HAVE_LINUX_THREADS
-       pthread_kill_other_threads_np();
-#endif
-
-       return 0;
-
+pthread_detach(NULL);
   ;
   return 0;
 }
@@ -24054,141 +23943,42 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_pthread_lib_lpthreads=yes
+  ol_cv_func_pthread_detach=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_pthread_lib_lpthreads=no
+ol_cv_func_pthread_detach=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* pthread test headers */
-#include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
-#ifndef NULL
-#define NULL (void*)0
-#endif
-
-static void *task(p)
-       void *p;
-{
-       return (void *) (p == NULL);
-}
-
-
-int main(argc, argv)
-       int argc;
-       char **argv;
-{
-
-       /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
-       pthread_t t;
-       int status;
-       int detach = PTHREAD_CREATE_DETACHED;
-
-#if HAVE_PTHREADS > 4
-       /* Final pthreads */
-       pthread_attr_t attr;
-
-       status = pthread_attr_init(&attr);
-       if( status ) return status;
-
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
-#else
-       status = pthread_attr_setdetachstate(&attr, detach);
-#endif
-       if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
-#endif
-       if( status ) return status;
-#else
-       /* Draft 4 pthreads */
-       status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
-
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
-
-       status = pthread_detach( &t );
-       if( status ) return errno;
-#endif
-
-#ifdef HAVE_LINUX_THREADS
-       pthread_kill_other_threads_np();
-#endif
-
-       return 0;
-
-}
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ol_cv_pthread_lib_lpthreads=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-ol_cv_pthread_lib_lpthreads=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+echo "$as_me:$LINENO: result: $ol_cv_func_pthread_detach" >&5
+echo "${ECHO_T}$ol_cv_func_pthread_detach" >&6
 
-               # restore the LIBS
-               LIBS="$ol_LIBS"
+                       if test $ol_cv_func_pthread_detach = no ; then
+                               { { echo "$as_me:$LINENO: error: could not locate pthread_detach()" >&5
+echo "$as_me: error: could not locate pthread_detach()" >&2;}
+   { (exit 1); exit 1; }; }
+                       fi
 
-fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_lib_lpthreads" >&5
-echo "${ECHO_T}$ol_cv_pthread_lib_lpthreads" >&6
 
-       if test $ol_cv_pthread_lib_lpthreads = yes ; then
-               ol_link_pthreads="-lpthreads"
-               ol_link_threads=posix
-       fi
-fi
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_DETACH 1
+_ACEOF
 
 
-               if test $ol_link_threads != no ; then
-                       LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads"
 
-                                               save_CPPFLAGS="$CPPFLAGS"
-                       save_LIBS="$LIBS"
-                       LIBS="$LTHREAD_LIBS $LIBS"
 
 
 
+for ac_func in \
+                               pthread_setconcurrency \
+                               pthread_getconcurrency \
+                               thr_setconcurrency \
+                               thr_getconcurrency \
 
-for ac_func in sched_yield pthread_yield thr_yield
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
 done
 
 
-                       if test $ac_cv_func_sched_yield = no &&
-                          test $ac_cv_func_pthread_yield = no &&
-                          test $ac_cv_func_thr_yield = no ; then
-                                                               echo "$as_me:$LINENO: checking for sched_yield in -lrt" >&5
-echo $ECHO_N "checking for sched_yield in -lrt... $ECHO_C" >&6
-if test "${ac_cv_lib_rt_sched_yield+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lrt  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char sched_yield ();
-int
-main ()
-{
-sched_yield ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_rt_sched_yield=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_rt_sched_yield=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_rt_sched_yield" >&5
-echo "${ECHO_T}$ac_cv_lib_rt_sched_yield" >&6
-if test $ac_cv_lib_rt_sched_yield = yes; then
-  LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SCHED_YIELD 1
-_ACEOF
-
-                                       ac_cv_func_sched_yield=yes
-else
-  ac_cv_func_sched_yield=no
-fi
-
-                       fi
-                       if test $ac_cv_func_sched_yield = no &&
-                          test $ac_cv_func_pthread_yield = no &&
-                          test "$ac_cv_func_thr_yield" = no ; then
-                               { echo "$as_me:$LINENO: WARNING: could not locate sched_yield() or pthread_yield()" >&5
-echo "$as_me: WARNING: could not locate sched_yield() or pthread_yield()" >&2;}
-                       fi
-
 
 
-for ac_func in pthread_kill pthread_rwlock_destroy
+for ac_func in pthread_kill_other_threads_np
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -24480,487 +24183,198 @@ _ACEOF
 fi
 done
 
+       echo "$as_me:$LINENO: checking for LinuxThreads implementation" >&5
+echo $ECHO_N "checking for LinuxThreads implementation... $ECHO_C" >&6
+if test "${ol_cv_sys_linux_threads+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np
+fi
+echo "$as_me:$LINENO: result: $ol_cv_sys_linux_threads" >&5
+echo "${ECHO_T}$ol_cv_sys_linux_threads" >&6
 
-                                                                       echo "$as_me:$LINENO: checking for pthread_detach with <pthread.h>" >&5
-echo $ECHO_N "checking for pthread_detach with <pthread.h>... $ECHO_C" >&6
-if test "${ol_cv_func_pthread_detach+set}" = set; then
+
+
+
+       echo "$as_me:$LINENO: checking for LinuxThreads consistency" >&5
+echo $ECHO_N "checking for LinuxThreads consistency... $ECHO_C" >&6
+if test "${ol_cv_linux_threads+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-                                                               cat >conftest.$ac_ext <<_ACEOF
+               if test $ol_cv_header_linux_threads = yes &&
+                  test $ol_cv_sys_linux_threads = yes; then
+                       ol_cv_linux_threads=yes
+               elif test $ol_cv_header_linux_threads = no &&
+                    test $ol_cv_sys_linux_threads = no; then
+                       ol_cv_linux_threads=no
+               else
+                       ol_cv_linux_threads=error
+               fi
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_linux_threads" >&5
+echo "${ECHO_T}$ol_cv_linux_threads" >&6
+
+
+                       if test $ol_cv_linux_threads = error; then
+                               { { echo "$as_me:$LINENO: error: LinuxThreads header/library mismatch" >&5
+echo "$as_me: error: LinuxThreads header/library mismatch" >&2;}
+   { (exit 1); exit 1; }; };
+                       fi
+
+                       echo "$as_me:$LINENO: checking if pthread_create() works" >&5
+echo $ECHO_N "checking if pthread_create() works... $ECHO_C" >&6
+if test "${ol_cv_pthread_create_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+                       if test "$cross_compiling" = yes; then
+                               ol_cv_pthread_create_works=yes
+else
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+/* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
 
-int
-main ()
+static void *task(p)
+       void *p;
 {
-pthread_detach(NULL);
-  ;
-  return 0;
+       return (void *) (p == NULL);
+}
+
+
+int main(argc, argv)
+       int argc;
+       char **argv;
+{
+
+       /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
+       pthread_t t;
+       int status;
+       int detach = PTHREAD_CREATE_DETACHED;
+
+#if HAVE_PTHREADS > 4
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
+#else
+       status = pthread_attr_setdetachstate(&attr, detach);
+#endif
+       if( status ) return status;
+       status = pthread_create( &t, &attr, task, NULL );
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
+#endif
+       if( status ) return status;
+#else
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return errno;
+
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
+
+       status = pthread_detach( &t );
+       if( status ) return errno;
+#endif
+
+#ifdef HAVE_LINUX_THREADS
+       pthread_kill_other_threads_np();
+#endif
+
+       return 0;
+
 }
+
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
+rm -f conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_func_pthread_detach=yes
+  ol_cv_pthread_create_works=yes
 else
-  echo "$as_me: failed program was:" >&5
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_func_pthread_detach=no
+( exit $ac_status )
+ol_cv_pthread_create_works=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ol_cv_func_pthread_detach" >&5
-echo "${ECHO_T}$ol_cv_func_pthread_detach" >&6
+fi
+echo "$as_me:$LINENO: result: $ol_cv_pthread_create_works" >&5
+echo "${ECHO_T}$ol_cv_pthread_create_works" >&6
 
-                       if test $ol_cv_func_pthread_detach = no ; then
-                               { { echo "$as_me:$LINENO: error: could not locate pthread_detach()" >&5
-echo "$as_me: error: could not locate pthread_detach()" >&2;}
+                       if test $ol_cv_pthread_create_works = no ; then
+                               { { echo "$as_me:$LINENO: error: pthread_create is not usable, check environment settings" >&5
+echo "$as_me: error: pthread_create is not usable, check environment settings" >&2;}
    { (exit 1); exit 1; }; }
                        fi
 
+                       ol_replace_broken_yield=no
+
+                       if test $ol_replace_broken_yield = yes ; then
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD_DETACH 1
+#define REPLACE_BROKEN_YIELD 1
 _ACEOF
 
+                       fi
 
-
-
-
-
-for ac_func in \
-                               pthread_setconcurrency \
-                               pthread_getconcurrency \
-                               thr_setconcurrency \
-                               thr_getconcurrency \
-
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+                                               if test $ol_with_yielding_select = auto ; then
+                               echo "$as_me:$LINENO: checking if select yields when using pthreads" >&5
+echo $ECHO_N "checking if select yields when using pthreads... $ECHO_C" >&6
+if test "${ol_cv_pthread_select_yields+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+
+                               if test "$cross_compiling" = yes; then
+  ol_cv_pthread_select_yields=cross
+else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-for ac_func in pthread_kill_other_threads_np
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-       echo "$as_me:$LINENO: checking for LinuxThreads implementation" >&5
-echo $ECHO_N "checking for LinuxThreads implementation... $ECHO_C" >&6
-if test "${ol_cv_sys_linux_threads+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np
-fi
-echo "$as_me:$LINENO: result: $ol_cv_sys_linux_threads" >&5
-echo "${ECHO_T}$ol_cv_sys_linux_threads" >&6
-
-
-
-
-       echo "$as_me:$LINENO: checking for LinuxThreads consistency" >&5
-echo $ECHO_N "checking for LinuxThreads consistency... $ECHO_C" >&6
-if test "${ol_cv_linux_threads+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-               if test $ol_cv_header_linux_threads = yes &&
-                  test $ol_cv_sys_linux_threads = yes; then
-                       ol_cv_linux_threads=yes
-               elif test $ol_cv_header_linux_threads = no &&
-                    test $ol_cv_sys_linux_threads = no; then
-                       ol_cv_linux_threads=no
-               else
-                       ol_cv_linux_threads=error
-               fi
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_linux_threads" >&5
-echo "${ECHO_T}$ol_cv_linux_threads" >&6
-
-
-                       if test $ol_cv_linux_threads = error; then
-                               { { echo "$as_me:$LINENO: error: LinuxThreads header/library mismatch" >&5
-echo "$as_me: error: LinuxThreads header/library mismatch" >&2;}
-   { (exit 1); exit 1; }; };
-                       fi
-
-                       echo "$as_me:$LINENO: checking if pthread_create() works" >&5
-echo $ECHO_N "checking if pthread_create() works... $ECHO_C" >&6
-if test "${ol_cv_pthread_create_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-                       if test "$cross_compiling" = yes; then
-                               ol_cv_pthread_create_works=yes
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* pthread test headers */
-#include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
-#ifndef NULL
-#define NULL (void*)0
-#endif
-
-static void *task(p)
-       void *p;
-{
-       return (void *) (p == NULL);
-}
-
-
-int main(argc, argv)
-       int argc;
-       char **argv;
-{
-
-       /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
-       pthread_t t;
-       int status;
-       int detach = PTHREAD_CREATE_DETACHED;
-
-#if HAVE_PTHREADS > 4
-       /* Final pthreads */
-       pthread_attr_t attr;
-
-       status = pthread_attr_init(&attr);
-       if( status ) return status;
-
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
-#else
-       status = pthread_attr_setdetachstate(&attr, detach);
-#endif
-       if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
-#endif
-       if( status ) return status;
-#else
-       /* Draft 4 pthreads */
-       status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
-
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
-
-       status = pthread_detach( &t );
-       if( status ) return errno;
-#endif
-
-#ifdef HAVE_LINUX_THREADS
-       pthread_kill_other_threads_np();
-#endif
-
-       return 0;
-
-}
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ol_cv_pthread_create_works=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ol_cv_pthread_create_works=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ol_cv_pthread_create_works" >&5
-echo "${ECHO_T}$ol_cv_pthread_create_works" >&6
-
-                       if test $ol_cv_pthread_create_works = no ; then
-                               { { echo "$as_me:$LINENO: error: pthread_create is not usable, check environment settings" >&5
-echo "$as_me: error: pthread_create is not usable, check environment settings" >&2;}
-   { (exit 1); exit 1; }; }
-                       fi
-
-                       ol_replace_broken_yield=no
-
-                       if test $ol_replace_broken_yield = yes ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_BROKEN_YIELD 1
-_ACEOF
-
-                       fi
-
-                                               if test $ol_with_yielding_select = auto ; then
-                               echo "$as_me:$LINENO: checking if select yields when using pthreads" >&5
-echo $ECHO_N "checking if select yields when using pthreads... $ECHO_C" >&6
-if test "${ol_cv_pthread_select_yields+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-                               if test "$cross_compiling" = yes; then
-  ol_cv_pthread_select_yields=cross
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <pthread.h>
-#ifndef NULL
-#define NULL (void*) 0
-#endif
+#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <pthread.h>
+#ifndef NULL
+#define NULL (void*) 0
+#endif
 
 static int fildes[2];
 
@@ -25017,7 +24431,7 @@ int main(argc, argv)
 #endif
 
        /* make sure task runs first */
-#if HAVE_THR_YIELD
+#ifdef HAVE_THR_YIELD
        thr_yield();
 #elif defined( HAVE_SCHED_YIELD )
        sched_yield();
@@ -27639,83 +27053,902 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_func_gethostbyname_r_nargs6=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ol_cv_func_gethostbyname_r_nargs6=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+       if test $ol_cv_func_gethostbyname_r_nargs5 = yes &&
+          test $ol_cv_func_gethostbyname_r_nargs6 = no ; then
+
+               ol_cv_func_gethostbyname_r_nargs=5
+
+       elif test $ol_cv_func_gethostbyname_r_nargs5 = no &&
+            test $ol_cv_func_gethostbyname_r_nargs6 = yes ; then
+
+               ol_cv_func_gethostbyname_r_nargs=6
+
+       else
+               ol_cv_func_gethostbyname_r_nargs=0
+       fi
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_func_gethostbyname_r_nargs" >&5
+echo "${ECHO_T}$ol_cv_func_gethostbyname_r_nargs" >&6
+  if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
+
+cat >>confdefs.h <<_ACEOF
+#define GETHOSTBYNAME_R_NARGS $ol_cv_func_gethostbyname_r_nargs
+_ACEOF
+
+  fi
+
+else
+       ol_cv_func_gethostbyname_r_nargs=0
+fi
+
+if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
+       echo "$as_me:$LINENO: checking number of arguments of gethostbyaddr_r" >&5
+echo $ECHO_N "checking number of arguments of gethostbyaddr_r... $ECHO_C" >&6
+if test "${ol_cv_func_gethostbyaddr_r_nargs+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#define BUFSIZE (sizeof(struct hostent)+10)
+int
+main ()
+{
+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);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_func_gethostbyaddr_r_nargs7=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ol_cv_func_gethostbyaddr_r_nargs7=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#define BUFSIZE (sizeof(struct hostent)+10)
+int
+main ()
+{
+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);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_func_gethostbyaddr_r_nargs8=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ol_cv_func_gethostbyaddr_r_nargs8=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+       if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes &&
+          test $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
+
+               ol_cv_func_gethostbyaddr_r_nargs=7
+
+       elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no &&
+            test $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
+
+               ol_cv_func_gethostbyaddr_r_nargs=8
+
+       else
+               ol_cv_func_gethostbyaddr_r_nargs=0
+       fi
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_func_gethostbyaddr_r_nargs" >&5
+echo "${ECHO_T}$ol_cv_func_gethostbyaddr_r_nargs" >&6
+  if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
+
+cat >>confdefs.h <<_ACEOF
+#define GETHOSTBYADDR_R_NARGS $ol_cv_func_gethostbyaddr_r_nargs
+_ACEOF
+
+  fi
+
+else
+       ol_cv_func_gethostbyaddr_r_nargs=0
+fi
+
+ol_link_bdb=no
+
+if test $ol_enable_bdb/$ol_enable_hdb != no/no; then
+       ol_cv_berkeley_db=no
+
+for ac_header in db.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to <http://www.openldap.org/its/> ##
+## --------------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+if test $ac_cv_header_db_h = yes; then
+       ol_cv_lib_db=no
+
+echo "$as_me:$LINENO: checking for Berkeley DB major version" >&5
+echo $ECHO_N "checking for Berkeley DB major version... $ECHO_C" >&6
+if test "${ol_cv_bdb_major+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       ol_cv_bdb_major=0
+       if test $ol_cv_bdb_major = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MAJOR
+#      define DB_VERSION_MAJOR 1
+#endif
+#if DB_VERSION_MAJOR == 4
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_major=4
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_major = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MAJOR
+#      define DB_VERSION_MAJOR 1
+#endif
+#if DB_VERSION_MAJOR == 3
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_major=3
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_major = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MAJOR
+#      define DB_VERSION_MAJOR 1
+#endif
+#if DB_VERSION_MAJOR == 2
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_major=2
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_major = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MAJOR
+#      define DB_VERSION_MAJOR 1
+#endif
+#if DB_VERSION_MAJOR == 1
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_major=1
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+
+       if test $ol_cv_bdb_major = 0 ; then
+               { { echo "$as_me:$LINENO: error: Unknown Berkeley DB major version" >&5
+echo "$as_me: error: Unknown Berkeley DB major version" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_bdb_major" >&5
+echo "${ECHO_T}$ol_cv_bdb_major" >&6
+
+echo "$as_me:$LINENO: checking for Berkeley DB minor version" >&5
+echo $ECHO_N "checking for Berkeley DB minor version... $ECHO_C" >&6
+if test "${ol_cv_bdb_minor+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       ol_cv_bdb_minor=0
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 9
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=9
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 8
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=8
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 7
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=7
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 6
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=6
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 5
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=5
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 4
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=4
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 3
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=3
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 2
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=2
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+       if test $ol_cv_bdb_minor = 0 ; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <db.h>
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
+#if DB_VERSION_MINOR == 1
+__db_version
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "__db_version" >/dev/null 2>&1; then
+  ol_cv_bdb_minor=1
+else
+  :
+fi
+rm -f conftest*
+
+       fi
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_bdb_minor" >&5
+echo "${ECHO_T}$ol_cv_bdb_minor" >&6
+
+if test $ol_cv_bdb_major = 4 ; then
+       if test $ol_cv_bdb_minor = 6 ; then
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4.6)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-4.6)... $ECHO_C" >&6
+if test "${ol_cv_db_db_4_dot_6+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       ol_DB_LIB=-ldb-4.6
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
+#endif
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
+#endif
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
+int
+main ()
+{
+
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
+#endif
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_func_gethostbyname_r_nargs6=yes
+  ol_cv_db_db_4_dot_6=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_func_gethostbyname_r_nargs6=no
+ol_cv_db_db_4_dot_6=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-       if test $ol_cv_func_gethostbyname_r_nargs5 = yes &&
-          test $ol_cv_func_gethostbyname_r_nargs6 = no ; then
-
-               ol_cv_func_gethostbyname_r_nargs=5
-
-       elif test $ol_cv_func_gethostbyname_r_nargs5 = no &&
-            test $ol_cv_func_gethostbyname_r_nargs6 = yes ; then
-
-               ol_cv_func_gethostbyname_r_nargs=6
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 
-       else
-               ol_cv_func_gethostbyname_r_nargs=0
-       fi
+       LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_func_gethostbyname_r_nargs" >&5
-echo "${ECHO_T}$ol_cv_func_gethostbyname_r_nargs" >&6
-  if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
-
-cat >>confdefs.h <<_ACEOF
-#define GETHOSTBYNAME_R_NARGS $ol_cv_func_gethostbyname_r_nargs
-_ACEOF
-
-  fi
+echo "$as_me:$LINENO: result: $ol_cv_db_db_4_dot_6" >&5
+echo "${ECHO_T}$ol_cv_db_db_4_dot_6" >&6
 
-else
-       ol_cv_func_gethostbyname_r_nargs=0
+       if test $ol_cv_db_db_4_dot_6 = yes ; then
+               ol_cv_lib_db=-ldb-4.6
+       fi
 fi
 
-if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
-       echo "$as_me:$LINENO: checking number of arguments of gethostbyaddr_r" >&5
-echo $ECHO_N "checking number of arguments of gethostbyaddr_r... $ECHO_C" >&6
-if test "${ol_cv_func_gethostbyaddr_r_nargs+set}" = set; then
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb46)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb46)... $ECHO_C" >&6
+if test "${ol_cv_db_db46+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+
+       ol_DB_LIB=-ldb46
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#define BUFSIZE (sizeof(struct hostent)+10)
+
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
+#endif
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
+#endif
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
 int
 main ()
 {
-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);
+
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
+#endif
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
+#endif
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -27729,20 +27962,43 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_func_gethostbyaddr_r_nargs7=yes
+  ol_cv_db_db46=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_func_gethostbyaddr_r_nargs7=no
+ol_cv_db_db46=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+       LIBS="$ol_LIBS"
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_db_db46" >&5
+echo "${ECHO_T}$ol_cv_db_db46" >&6
+
+       if test $ol_cv_db_db46 = yes ; then
+               ol_cv_lib_db=-ldb46
+       fi
+fi
+
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-46)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-46)... $ECHO_C" >&6
+if test "${ol_cv_db_db_46+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       ol_DB_LIB=-ldb-46
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -27750,29 +28006,58 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#define BUFSIZE (sizeof(struct hostent)+10)
+
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
+#endif
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
+#endif
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
 int
 main ()
 {
-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);
+
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
+#endif
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
+#endif
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -27786,82 +28071,102 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_func_gethostbyaddr_r_nargs8=yes
+  ol_cv_db_db_46=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_func_gethostbyaddr_r_nargs8=no
+ol_cv_db_db_46=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-       if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes &&
-          test $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
-
-               ol_cv_func_gethostbyaddr_r_nargs=7
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 
-       elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no &&
-            test $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
+       LIBS="$ol_LIBS"
 
-               ol_cv_func_gethostbyaddr_r_nargs=8
+fi
+echo "$as_me:$LINENO: result: $ol_cv_db_db_46" >&5
+echo "${ECHO_T}$ol_cv_db_db_46" >&6
 
-       else
-               ol_cv_func_gethostbyaddr_r_nargs=0
+       if test $ol_cv_db_db_46 = yes ; then
+               ol_cv_lib_db=-ldb-46
        fi
-
 fi
-echo "$as_me:$LINENO: result: $ol_cv_func_gethostbyaddr_r_nargs" >&5
-echo "${ECHO_T}$ol_cv_func_gethostbyaddr_r_nargs" >&6
-  if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
-
-cat >>confdefs.h <<_ACEOF
-#define GETHOSTBYADDR_R_NARGS $ol_cv_func_gethostbyaddr_r_nargs
-_ACEOF
-
-  fi
 
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4-6)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-4-6)... $ECHO_C" >&6
+if test "${ol_cv_db_db_4_6+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-       ol_cv_func_gethostbyaddr_r_nargs=0
-fi
-
-ol_link_bdb=no
 
-if test $ol_enable_bdb/$ol_enable_hdb != no/no; then
-       ol_cv_berkeley_db=no
+       ol_DB_LIB=-ldb-4-6
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
-for ac_header in db.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
+#endif
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
+#endif
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
+int
+main ()
+{
+
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
+#endif
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
+#endif
+
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -27875,496 +28180,479 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
+  ol_cv_db_db_4_6=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## --------------------------------------------- ##
-## Report this to <http://www.openldap.org/its/> ##
-## --------------------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-if test $ac_cv_header_db_h = yes; then
-       ol_cv_lib_db=no
-
-echo "$as_me:$LINENO: checking for Berkeley DB major version" >&5
-echo $ECHO_N "checking for Berkeley DB major version... $ECHO_C" >&6
-if test "${ol_cv_bdb_major+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-       ol_cv_bdb_major=0
-       if test $ol_cv_bdb_major = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <db.h>
-#ifndef DB_VERSION_MAJOR
-#      define DB_VERSION_MAJOR 1
-#endif
-#if DB_VERSION_MAJOR == 4
-__db_version
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_major=4
-else
-  :
-fi
-rm -f conftest*
-
-       fi
-       if test $ol_cv_bdb_major = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <db.h>
-#ifndef DB_VERSION_MAJOR
-#      define DB_VERSION_MAJOR 1
-#endif
-#if DB_VERSION_MAJOR == 3
-__db_version
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_major=3
-else
-  :
-fi
-rm -f conftest*
-
-       fi
-       if test $ol_cv_bdb_major = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <db.h>
-#ifndef DB_VERSION_MAJOR
-#      define DB_VERSION_MAJOR 1
-#endif
-#if DB_VERSION_MAJOR == 2
-__db_version
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_major=2
-else
-  :
+ol_cv_db_db_4_6=no
 fi
-rm -f conftest*
-
-       fi
-       if test $ol_cv_bdb_major = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <db.h>
-#ifndef DB_VERSION_MAJOR
-#      define DB_VERSION_MAJOR 1
-#endif
-#if DB_VERSION_MAJOR == 1
-__db_version
-#endif
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_major=1
-else
-  :
-fi
-rm -f conftest*
+       LIBS="$ol_LIBS"
 
-       fi
+fi
+echo "$as_me:$LINENO: result: $ol_cv_db_db_4_6" >&5
+echo "${ECHO_T}$ol_cv_db_db_4_6" >&6
 
-       if test $ol_cv_bdb_major = 0 ; then
-               { { echo "$as_me:$LINENO: error: Unknown Berkeley DB major version" >&5
-echo "$as_me: error: Unknown Berkeley DB major version" >&2;}
-   { (exit 1); exit 1; }; }
+       if test $ol_cv_db_db_4_6 = yes ; then
+               ol_cv_lib_db=-ldb-4-6
        fi
-
 fi
-echo "$as_me:$LINENO: result: $ol_cv_bdb_major" >&5
-echo "${ECHO_T}$ol_cv_bdb_major" >&6
 
-echo "$as_me:$LINENO: checking for Berkeley DB minor version" >&5
-echo $ECHO_N "checking for Berkeley DB minor version... $ECHO_C" >&6
-if test "${ol_cv_bdb_minor+set}" = set; then
+       elif test $ol_cv_bdb_minor = 5 ; then
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4.5)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-4.5)... $ECHO_C" >&6
+if test "${ol_cv_db_db_4_dot_5+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_cv_bdb_minor=0
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
+       ol_DB_LIB=-ldb-4.5
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
 #endif
-#if DB_VERSION_MINOR == 9
-__db_version
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
 #endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=9
-else
-  :
-fi
-rm -f conftest*
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
 
-       fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+int
+main ()
+{
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
 #endif
-#if DB_VERSION_MINOR == 8
-__db_version
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
 #endif
 
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=8
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_db_db_4_dot_5=yes
 else
-  :
-fi
-rm -f conftest*
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-       fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+ol_cv_db_db_4_dot_5=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
-#endif
-#if DB_VERSION_MINOR == 7
-__db_version
-#endif
+       LIBS="$ol_LIBS"
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=7
-else
-  :
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ol_cv_db_db_4_dot_5" >&5
+echo "${ECHO_T}$ol_cv_db_db_4_dot_5" >&6
 
+       if test $ol_cv_db_db_4_dot_5 = yes ; then
+               ol_cv_lib_db=-ldb-4.5
        fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
+fi
+
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb45)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb45)... $ECHO_C" >&6
+if test "${ol_cv_db_db45+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       ol_DB_LIB=-ldb45
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
 #endif
-#if DB_VERSION_MINOR == 6
-__db_version
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
 #endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=6
-else
-  :
-fi
-rm -f conftest*
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
 
-       fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+int
+main ()
+{
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
 #endif
-#if DB_VERSION_MINOR == 5
-__db_version
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
 #endif
 
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_db_db45=yes
 else
-  :
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ol_cv_db_db45=no
 fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+       LIBS="$ol_LIBS"
 
+fi
+echo "$as_me:$LINENO: result: $ol_cv_db_db45" >&5
+echo "${ECHO_T}$ol_cv_db_db45" >&6
+
+       if test $ol_cv_db_db45 = yes ; then
+               ol_cv_lib_db=-ldb45
        fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
+fi
+
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-45)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-45)... $ECHO_C" >&6
+if test "${ol_cv_db_db_45+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       ol_DB_LIB=-ldb-45
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
 #endif
-#if DB_VERSION_MINOR == 4
-__db_version
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
 #endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=4
-else
-  :
-fi
-rm -f conftest*
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
 
-       fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+int
+main ()
+{
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
 #endif
-#if DB_VERSION_MINOR == 3
-__db_version
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
 #endif
 
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=3
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_db_db_45=yes
 else
-  :
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ol_cv_db_db_45=no
 fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+       LIBS="$ol_LIBS"
+
+fi
+echo "$as_me:$LINENO: result: $ol_cv_db_db_45" >&5
+echo "${ECHO_T}$ol_cv_db_db_45" >&6
 
+       if test $ol_cv_db_db_45 = yes ; then
+               ol_cv_lib_db=-ldb-45
        fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
+fi
+
+               if test $ol_cv_lib_db = no ; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4-5)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-4-5)... $ECHO_C" >&6
+if test "${ol_cv_db_db_4_5+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       ol_DB_LIB=-ldb-4-5
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
 #endif
-#if DB_VERSION_MINOR == 2
-__db_version
+
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
 #endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=2
-else
-  :
-fi
-rm -f conftest*
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
 
-       fi
-       if test $ol_cv_bdb_minor = 0 ; then
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+int
+main ()
+{
 
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-#      define DB_VERSION_MINOR 0
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\theader: %s\n\tlibrary: %s\n",
+                               DB_VERSION_STRING, version);
+                       return 1;
+               }
+       }
 #endif
-#if DB_VERSION_MINOR == 1
-__db_version
+
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
+       db_appexit( NULL );
+#else
+       (void) dbopen( NULL, 0, 0, 0, NULL);
 #endif
 
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "__db_version" >/dev/null 2>&1; then
-  ol_cv_bdb_minor=1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ol_cv_db_db_4_5=yes
 else
-  :
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ol_cv_db_db_4_5=no
 fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 
-       fi
+       LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_bdb_minor" >&5
-echo "${ECHO_T}$ol_cv_bdb_minor" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db_4_5" >&5
+echo "${ECHO_T}$ol_cv_db_db_4_5" >&6
 
-if test $ol_cv_bdb_major = 4 ; then
-       if test $ol_cv_bdb_minor = 4 ; then
+       if test $ol_cv_db_db_4_5 = yes ; then
+               ol_cv_lib_db=-ldb-4-5
+       fi
+fi
+
+       elif test $ol_cv_bdb_minor = 4 ; then
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb44)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb44)... $ECHO_C" >&6
-if test "${ol_cv_db_db44+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4.4)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-4.4)... $ECHO_C" >&6
+if test "${ol_cv_db_db_4_dot_4+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb44
+       ol_DB_LIB=-ldb-4.4
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -28445,12 +28733,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db44=yes
+  ol_cv_db_db_4_dot_4=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db44=no
+ol_cv_db_db_4_dot_4=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -28458,22 +28746,22 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db44" >&5
-echo "${ECHO_T}$ol_cv_db_db44" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db_4_dot_4" >&5
+echo "${ECHO_T}$ol_cv_db_db_4_dot_4" >&6
 
-       if test $ol_cv_db_db44 = yes ; then
-               ol_cv_lib_db=-ldb44
+       if test $ol_cv_db_db_4_dot_4 = yes ; then
+               ol_cv_lib_db=-ldb-4.4
        fi
 fi
 
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-44)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-44)... $ECHO_C" >&6
-if test "${ol_cv_db_db_44+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb44)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb44)... $ECHO_C" >&6
+if test "${ol_cv_db_db44+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb-44
+       ol_DB_LIB=-ldb44
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -28554,12 +28842,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db_44=yes
+  ol_cv_db_db44=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db_44=no
+ol_cv_db_db44=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -28567,22 +28855,22 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_44" >&5
-echo "${ECHO_T}$ol_cv_db_db_44" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db44" >&5
+echo "${ECHO_T}$ol_cv_db_db44" >&6
 
-       if test $ol_cv_db_db_44 = yes ; then
-               ol_cv_lib_db=-ldb-44
+       if test $ol_cv_db_db44 = yes ; then
+               ol_cv_lib_db=-ldb44
        fi
 fi
 
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4.4)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-4.4)... $ECHO_C" >&6
-if test "${ol_cv_db_db_4_dot_4+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-44)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-44)... $ECHO_C" >&6
+if test "${ol_cv_db_db_44+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb-4.4
+       ol_DB_LIB=-ldb-44
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -28663,12 +28951,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db_4_dot_4=yes
+  ol_cv_db_db_44=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db_4_dot_4=no
+ol_cv_db_db_44=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -28676,11 +28964,11 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_4_dot_4" >&5
-echo "${ECHO_T}$ol_cv_db_db_4_dot_4" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db_44" >&5
+echo "${ECHO_T}$ol_cv_db_db_44" >&6
 
-       if test $ol_cv_db_db_4_dot_4 = yes ; then
-               ol_cv_lib_db=-ldb-4.4
+       if test $ol_cv_db_db_44 = yes ; then
+               ol_cv_lib_db=-ldb-44
        fi
 fi
 
@@ -28794,224 +29082,6 @@ echo "${ECHO_T}$ol_cv_db_db_4_4" >&6
 fi
 
        elif test $ol_cv_bdb_minor = 3 ; then
-               if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb43)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb43)... $ECHO_C" >&6
-if test "${ol_cv_db_db43+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-       ol_DB_LIB=-ldb43
-       ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#ifdef HAVE_DB_185_H
-# include <db_185.h>
-#else
-# include <db.h>
-#endif
-
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-int
-main ()
-{
-
-#if DB_VERSION_MAJOR > 1
-       {
-               char *version;
-               int major, minor, patch;
-
-               version = db_version( &major, &minor, &patch );
-
-               if( major != DB_VERSION_MAJOR ||
-                       minor < DB_VERSION_MINOR )
-               {
-                       printf("Berkeley DB version mismatch\n"
-                               "\theader: %s\n\tlibrary: %s\n",
-                               DB_VERSION_STRING, version);
-                       return 1;
-               }
-       }
-#endif
-
-#if DB_VERSION_MAJOR > 2
-       db_env_create( NULL, 0 );
-#elif DB_VERSION_MAJOR > 1
-       db_appexit( NULL );
-#else
-       (void) dbopen( NULL, 0, 0, 0, NULL);
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ol_cv_db_db43=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ol_cv_db_db43=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-
-       LIBS="$ol_LIBS"
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db43" >&5
-echo "${ECHO_T}$ol_cv_db_db43" >&6
-
-       if test $ol_cv_db_db43 = yes ; then
-               ol_cv_lib_db=-ldb43
-       fi
-fi
-
-               if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-43)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-43)... $ECHO_C" >&6
-if test "${ol_cv_db_db_43+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-       ol_DB_LIB=-ldb-43
-       ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#ifdef HAVE_DB_185_H
-# include <db_185.h>
-#else
-# include <db.h>
-#endif
-
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-int
-main ()
-{
-
-#if DB_VERSION_MAJOR > 1
-       {
-               char *version;
-               int major, minor, patch;
-
-               version = db_version( &major, &minor, &patch );
-
-               if( major != DB_VERSION_MAJOR ||
-                       minor < DB_VERSION_MINOR )
-               {
-                       printf("Berkeley DB version mismatch\n"
-                               "\theader: %s\n\tlibrary: %s\n",
-                               DB_VERSION_STRING, version);
-                       return 1;
-               }
-       }
-#endif
-
-#if DB_VERSION_MAJOR > 2
-       db_env_create( NULL, 0 );
-#elif DB_VERSION_MAJOR > 1
-       db_appexit( NULL );
-#else
-       (void) dbopen( NULL, 0, 0, 0, NULL);
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ol_cv_db_db_43=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ol_cv_db_db_43=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-
-       LIBS="$ol_LIBS"
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_43" >&5
-echo "${ECHO_T}$ol_cv_db_db_43" >&6
-
-       if test $ol_cv_db_db_43 = yes ; then
-               ol_cv_lib_db=-ldb-43
-       fi
-fi
-
                if test $ol_cv_lib_db = no ; then
        echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4.3)" >&5
 echo $ECHO_N "checking for Berkeley DB link (-ldb-4.3)... $ECHO_C" >&6
@@ -29122,13 +29192,13 @@ echo "${ECHO_T}$ol_cv_db_db_4_dot_3" >&6
 fi
 
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4-3)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-4-3)... $ECHO_C" >&6
-if test "${ol_cv_db_db_4_3+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb43)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb43)... $ECHO_C" >&6
+if test "${ol_cv_db_db43+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb-4-3
+       ol_DB_LIB=-ldb43
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -29209,12 +29279,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db_4_3=yes
+  ol_cv_db_db43=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db_4_3=no
+ol_cv_db_db43=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -29222,23 +29292,22 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_4_3" >&5
-echo "${ECHO_T}$ol_cv_db_db_4_3" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db43" >&5
+echo "${ECHO_T}$ol_cv_db_db43" >&6
 
-       if test $ol_cv_db_db_4_3 = yes ; then
-               ol_cv_lib_db=-ldb-4-3
+       if test $ol_cv_db_db43 = yes ; then
+               ol_cv_lib_db=-ldb43
        fi
 fi
 
-       elif test $ol_cv_bdb_minor = 2 ; then
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb42)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb42)... $ECHO_C" >&6
-if test "${ol_cv_db_db42+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-43)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-43)... $ECHO_C" >&6
+if test "${ol_cv_db_db_43+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb42
+       ol_DB_LIB=-ldb-43
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -29319,12 +29388,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db42=yes
+  ol_cv_db_db_43=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db42=no
+ol_cv_db_db_43=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -29332,22 +29401,22 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db42" >&5
-echo "${ECHO_T}$ol_cv_db_db42" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db_43" >&5
+echo "${ECHO_T}$ol_cv_db_db_43" >&6
 
-       if test $ol_cv_db_db42 = yes ; then
-               ol_cv_lib_db=-ldb42
+       if test $ol_cv_db_db_43 = yes ; then
+               ol_cv_lib_db=-ldb-43
        fi
 fi
 
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-42)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-42)... $ECHO_C" >&6
-if test "${ol_cv_db_db_42+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4-3)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-4-3)... $ECHO_C" >&6
+if test "${ol_cv_db_db_4_3+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb-42
+       ol_DB_LIB=-ldb-4-3
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -29428,12 +29497,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db_42=yes
+  ol_cv_db_db_4_3=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db_42=no
+ol_cv_db_db_4_3=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -29441,14 +29510,15 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_42" >&5
-echo "${ECHO_T}$ol_cv_db_db_42" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db_4_3" >&5
+echo "${ECHO_T}$ol_cv_db_db_4_3" >&6
 
-       if test $ol_cv_db_db_42 = yes ; then
-               ol_cv_lib_db=-ldb-42
+       if test $ol_cv_db_db_4_3 = yes ; then
+               ol_cv_lib_db=-ldb-4-3
        fi
 fi
 
+       elif test $ol_cv_bdb_minor = 2 ; then
                if test $ol_cv_lib_db = no ; then
        echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4.2)" >&5
 echo $ECHO_N "checking for Berkeley DB link (-ldb-4.2)... $ECHO_C" >&6
@@ -29559,232 +29629,13 @@ echo "${ECHO_T}$ol_cv_db_db_4_dot_2" >&6
 fi
 
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4-2)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-4-2)... $ECHO_C" >&6
-if test "${ol_cv_db_db_4_2+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-       ol_DB_LIB=-ldb-4-2
-       ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#ifdef HAVE_DB_185_H
-# include <db_185.h>
-#else
-# include <db.h>
-#endif
-
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-int
-main ()
-{
-
-#if DB_VERSION_MAJOR > 1
-       {
-               char *version;
-               int major, minor, patch;
-
-               version = db_version( &major, &minor, &patch );
-
-               if( major != DB_VERSION_MAJOR ||
-                       minor < DB_VERSION_MINOR )
-               {
-                       printf("Berkeley DB version mismatch\n"
-                               "\theader: %s\n\tlibrary: %s\n",
-                               DB_VERSION_STRING, version);
-                       return 1;
-               }
-       }
-#endif
-
-#if DB_VERSION_MAJOR > 2
-       db_env_create( NULL, 0 );
-#elif DB_VERSION_MAJOR > 1
-       db_appexit( NULL );
-#else
-       (void) dbopen( NULL, 0, 0, 0, NULL);
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ol_cv_db_db_4_2=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ol_cv_db_db_4_2=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-
-       LIBS="$ol_LIBS"
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_4_2" >&5
-echo "${ECHO_T}$ol_cv_db_db_4_2" >&6
-
-       if test $ol_cv_db_db_4_2 = yes ; then
-               ol_cv_lib_db=-ldb-4-2
-       fi
-fi
-
-       elif test $ol_cv_bdb_minor = 1 ; then
-               if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb41)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb41)... $ECHO_C" >&6
-if test "${ol_cv_db_db41+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-       ol_DB_LIB=-ldb41
-       ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#ifdef HAVE_DB_185_H
-# include <db_185.h>
-#else
-# include <db.h>
-#endif
-
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-int
-main ()
-{
-
-#if DB_VERSION_MAJOR > 1
-       {
-               char *version;
-               int major, minor, patch;
-
-               version = db_version( &major, &minor, &patch );
-
-               if( major != DB_VERSION_MAJOR ||
-                       minor < DB_VERSION_MINOR )
-               {
-                       printf("Berkeley DB version mismatch\n"
-                               "\theader: %s\n\tlibrary: %s\n",
-                               DB_VERSION_STRING, version);
-                       return 1;
-               }
-       }
-#endif
-
-#if DB_VERSION_MAJOR > 2
-       db_env_create( NULL, 0 );
-#elif DB_VERSION_MAJOR > 1
-       db_appexit( NULL );
-#else
-       (void) dbopen( NULL, 0, 0, 0, NULL);
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ol_cv_db_db41=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ol_cv_db_db41=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-
-       LIBS="$ol_LIBS"
-
-fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db41" >&5
-echo "${ECHO_T}$ol_cv_db_db41" >&6
-
-       if test $ol_cv_db_db41 = yes ; then
-               ol_cv_lib_db=-ldb41
-       fi
-fi
-
-               if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-41)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-41)... $ECHO_C" >&6
-if test "${ol_cv_db_db_41+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb42)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb42)... $ECHO_C" >&6
+if test "${ol_cv_db_db42+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb-41
+       ol_DB_LIB=-ldb42
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -29865,12 +29716,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db_41=yes
+  ol_cv_db_db42=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db_41=no
+ol_cv_db_db42=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -29878,22 +29729,22 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_41" >&5
-echo "${ECHO_T}$ol_cv_db_db_41" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db42" >&5
+echo "${ECHO_T}$ol_cv_db_db42" >&6
 
-       if test $ol_cv_db_db_41 = yes ; then
-               ol_cv_lib_db=-ldb-41
+       if test $ol_cv_db_db42 = yes ; then
+               ol_cv_lib_db=-ldb42
        fi
 fi
 
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4.1)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-4.1)... $ECHO_C" >&6
-if test "${ol_cv_db_db_4_dot_1+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-42)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-42)... $ECHO_C" >&6
+if test "${ol_cv_db_db_42+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb-4.1
+       ol_DB_LIB=-ldb-42
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -29974,12 +29825,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db_4_dot_1=yes
+  ol_cv_db_db_42=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db_4_dot_1=no
+ol_cv_db_db_42=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -29987,22 +29838,22 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_4_dot_1" >&5
-echo "${ECHO_T}$ol_cv_db_db_4_dot_1" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db_42" >&5
+echo "${ECHO_T}$ol_cv_db_db_42" >&6
 
-       if test $ol_cv_db_db_4_dot_1 = yes ; then
-               ol_cv_lib_db=-ldb-4.1
+       if test $ol_cv_db_db_42 = yes ; then
+               ol_cv_lib_db=-ldb-42
        fi
 fi
 
                if test $ol_cv_lib_db = no ; then
-       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4-1)" >&5
-echo $ECHO_N "checking for Berkeley DB link (-ldb-4-1)... $ECHO_C" >&6
-if test "${ol_cv_db_db_4_1+set}" = set; then
+       echo "$as_me:$LINENO: checking for Berkeley DB link (-ldb-4-2)" >&5
+echo $ECHO_N "checking for Berkeley DB link (-ldb-4-2)... $ECHO_C" >&6
+if test "${ol_cv_db_db_4_2+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       ol_DB_LIB=-ldb-4-1
+       ol_DB_LIB=-ldb-4-2
        ol_LIBS=$LIBS
        LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
@@ -30083,12 +29934,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ol_cv_db_db_4_1=yes
+  ol_cv_db_db_4_2=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ol_cv_db_db_4_1=no
+ol_cv_db_db_4_2=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
@@ -30096,11 +29947,11 @@ rm -f conftest.err conftest.$ac_objext \
        LIBS="$ol_LIBS"
 
 fi
-echo "$as_me:$LINENO: result: $ol_cv_db_db_4_1" >&5
-echo "${ECHO_T}$ol_cv_db_db_4_1" >&6
+echo "$as_me:$LINENO: result: $ol_cv_db_db_4_2" >&5
+echo "${ECHO_T}$ol_cv_db_db_4_2" >&6
 
-       if test $ol_cv_db_db_4_1 = yes ; then
-               ol_cv_lib_db=-ldb-4-1
+       if test $ol_cv_db_db_4_2 = yes ; then
+               ol_cv_lib_db=-ldb-4-2
        fi
 fi
 
@@ -31350,9 +31201,9 @@ main()
        }
 
 #if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
-       rc = env->open( env, NULL, flags, 0 );
+       rc = (env->open)( env, NULL, flags, 0 );
 #else
-       rc = env->open( env, NULL, NULL, flags, 0 );
+       rc = (env->open)( env, NULL, NULL, flags, 0 );
 #endif
 
        if ( rc == 0 ) {
@@ -31461,8 +31312,8 @@ cat >>conftest.$ac_ext <<_ACEOF
 #      define DB_VERSION_MINOR 0
 #endif
 
-/* require 4.2 or later */
-#if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 2)
+/* require 4.2 or later, but exclude 4.3 */
+#if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 2) && (DB_VERSION_MINOR !=3)
        __db_version_compat
 #endif
 
@@ -32063,7 +31914,15 @@ done
        sql_LIBS="$LIBS"
        LIBS="$LTHREAD_LIBS"
 
-       echo "$as_me:$LINENO: checking for SQLDriverConnect in -liodbc" >&5
+       if test $ol_with_odbc = auto ; then
+               ol_with_odbc="iodbc unixodbc"
+       fi
+
+       for odbc in $ol_with_odbc ; do
+               if test $ol_link_sql = no ; then
+                       case $odbc in
+                       iodbc)
+                               echo "$as_me:$LINENO: checking for SQLDriverConnect in -liodbc" >&5
 echo $ECHO_N "checking for SQLDriverConnect in -liodbc... $ECHO_C" >&6
 if test "${ac_cv_lib_iodbc_SQLDriverConnect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -32133,10 +31992,13 @@ else
   have_iodbc=no
 fi
 
-       if test $have_iodbc = yes ; then
-               ol_link_sql="-liodbc"
-       else
-               echo "$as_me:$LINENO: checking for SQLDriverConnect in -lodbc" >&5
+                               if test $have_iodbc = yes ; then
+                                       ol_link_sql="-liodbc"
+                               fi
+                               ;;
+
+                       unixodbc)
+                               echo "$as_me:$LINENO: checking for SQLDriverConnect in -lodbc" >&5
 echo $ECHO_N "checking for SQLDriverConnect in -lodbc... $ECHO_C" >&6
 if test "${ac_cv_lib_odbc_SQLDriverConnect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -32206,10 +32068,19 @@ else
   have_odbc=no
 fi
 
-               if test $have_odbc = yes ; then
-                       ol_link_sql="-lodbc"
+                               if test $have_odbc = yes ; then
+                                       ol_link_sql="-lodbc"
+                               fi
+                               ;;
+
+                       *)
+                               { { echo "$as_me:$LINENO: error: unknown ODBC library" >&5
+echo "$as_me: error: unknown ODBC library" >&2;}
+   { (exit 1); exit 1; }; }
+                               ;;
+                       esac
                fi
-       fi
+       done
 
        LIBS="$sql_LIBS"
 
@@ -33914,96 +33785,295 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_type_ssize_t=yes
+  ac_cv_type_ssize_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_ssize_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
+echo "${ECHO_T}$ac_cv_type_ssize_t" >&6
+if test $ac_cv_type_ssize_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define ssize_t signed int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for caddr_t" >&5
+echo $ECHO_N "checking for caddr_t... $ECHO_C" >&6
+if test "${ac_cv_type_caddr_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((caddr_t *) 0)
+  return 0;
+if (sizeof (caddr_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_caddr_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_caddr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_caddr_t" >&5
+echo "${ECHO_T}$ac_cv_type_caddr_t" >&6
+if test $ac_cv_type_caddr_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define caddr_t char *
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+  return 0;
+if (sizeof (size_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_size_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_size_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6
+if test "${ac_cv_type_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((long long *) 0)
+  return 0;
+if (sizeof (long long))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_long_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6
+if test $ac_cv_type_long_long = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
+
+fi
+
+echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
+echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6
+if test "${ac_cv_type_ptrdiff_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((ptrdiff_t *) 0)
+  return 0;
+if (sizeof (ptrdiff_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_ptrdiff_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_ssize_t=no
+ac_cv_type_ptrdiff_t=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
-echo "${ECHO_T}$ac_cv_type_ssize_t" >&6
-if test $ac_cv_type_ssize_t = yes; then
-  :
-else
+echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
+echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6
+if test $ac_cv_type_ptrdiff_t = yes; then
 
 cat >>confdefs.h <<_ACEOF
-#define ssize_t signed int
+#define HAVE_PTRDIFF_T 1
 _ACEOF
 
-fi
-
-echo "$as_me:$LINENO: checking for caddr_t" >&5
-echo $ECHO_N "checking for caddr_t... $ECHO_C" >&6
-if test "${ac_cv_type_caddr_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((caddr_t *) 0)
-  return 0;
-if (sizeof (caddr_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_caddr_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_caddr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_caddr_t" >&5
-echo "${ECHO_T}$ac_cv_type_caddr_t" >&6
-if test $ac_cv_type_caddr_t = yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define caddr_t char *
-_ACEOF
 
-fi
 
-echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6
-if test "${ac_cv_type_size_t+set}" = set; then
+echo "$as_me:$LINENO: checking for socklen_t" >&5
+echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
+if test "${ac_cv_type_socklen_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -34013,12 +34083,16 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
 int
 main ()
 {
-if ((size_t *) 0)
+if ((socklen_t *) 0)
   return 0;
-if (sizeof (size_t))
+if (sizeof (socklen_t))
   return 0;
   ;
   return 0;
@@ -34046,112 +34120,47 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_type_size_t=yes
+  ac_cv_type_socklen_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_size_t=no
+ac_cv_type_socklen_t=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6
-if test $ac_cv_type_size_t = yes; then
-  :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned
-_ACEOF
-
-fi
+echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
+echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
 
 
-echo "$as_me:$LINENO: checking for long long" >&5
-echo $ECHO_N "checking for long long... $ECHO_C" >&6
-if test "${ac_cv_type_long_long+set}" = set; then
+echo "$as_me:$LINENO: checking the type of arg 3 to accept()" >&5
+echo $ECHO_N "checking the type of arg 3 to accept()... $ECHO_C" >&6
+if test "${ol_cv_type_ber_socklen_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+
+       set socklen_t int unsigned "unsigned long" long size_t
+       test "$ac_cv_type_socklen_t" = yes || shift
+       ol_cv_type_ber_socklen_t=$1 guessing="guessing "
+       for lentype in "$@" ; do for addrtype in "struct sockaddr" void ; do
+               cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+extern int accept(int s, $addrtype *ap, $lentype *lp);
+
 int
 main ()
 {
-if ((long long *) 0)
-  return 0;
-if (sizeof (long long))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_long_long=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_long_long=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
-echo "${ECHO_T}$ac_cv_type_long_long" >&6
-if test $ac_cv_type_long_long = yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
+accept(0, (struct sockaddr *) 0, ($lentype *) 0);
 
-
-fi
-
-echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
-echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6
-if test "${ac_cv_type_ptrdiff_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((ptrdiff_t *) 0)
-  return 0;
-if (sizeof (ptrdiff_t))
-  return 0;
   ;
   return 0;
 }
@@ -34178,94 +34187,28 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_type_ptrdiff_t=yes
+  ol_cv_type_ber_socklen_t=$lentype guessing= ; break 2
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_ptrdiff_t=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+       done ; done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
-echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6
-if test $ac_cv_type_ptrdiff_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PTRDIFF_T 1
-_ACEOF
 
+echo "$as_me:$LINENO: result: $guessing$ol_cv_type_ber_socklen_t *" >&5
+echo "${ECHO_T}$guessing$ol_cv_type_ber_socklen_t *" >&6
 
-fi
-
-
-echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
-if test "${ac_cv_type_socklen_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define ber_socklen_t $ol_cv_type_ber_socklen_t
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
 
-int
-main ()
-{
-if ((socklen_t *) 0)
-  return 0;
-if (sizeof (socklen_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_socklen_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_socklen_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
-if test $ac_cv_type_socklen_t = yes; then
-  :
-else
+if test "$ac_cv_type_socklen_t" != yes; then
 
 cat >>confdefs.h <<_ACEOF
-#define socklen_t int
+#define socklen_t $ol_cv_type_ber_socklen_t
 _ACEOF
 
 fi
@@ -39085,6 +39028,7 @@ fi
 
 
 
+
 
 
 for ac_func in \
@@ -39096,17 +39040,18 @@ for ac_func in \
        fcntl                   \
        flock                   \
        fstat                   \
-       getdtablesize   \
+       getdtablesize           \
        getgrgid                \
        gethostname             \
        getpass                 \
-       getpassphrase   \
+       getpassphrase           \
        getpwuid                \
        getpwnam                \
        getspnam                \
-       gettimeofday    \
+       gettimeofday            \
        initgroups              \
        inet_ntoa_b             \
+       ioctl                   \
        lockf                   \
        memcpy                  \
        memmove                 \
@@ -39704,6 +39649,268 @@ _ACEOF
 fi
 
                fi
+               echo "$as_me:$LINENO: checking for struct stat.st_fstype" >&5
+echo $ECHO_N "checking for struct stat.st_fstype... $ECHO_C" >&6
+if test "${ac_cv_member_struct_stat_st_fstype+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_fstype)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_stat_st_fstype=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_fstype)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_stat_st_fstype=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_stat_st_fstype=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_fstype" >&5
+echo "${ECHO_T}$ac_cv_member_struct_stat_st_fstype" >&6
+if test $ac_cv_member_struct_stat_st_fstype = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_FSTYPE 1
+_ACEOF
+
+
+fi
+echo "$as_me:$LINENO: checking for struct stat.st_vfstype" >&5
+echo $ECHO_N "checking for struct stat.st_vfstype... $ECHO_C" >&6
+if test "${ac_cv_member_struct_stat_st_vfstype+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_vfstype)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_stat_st_vfstype=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_vfstype)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_stat_st_vfstype=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_stat_st_vfstype=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_vfstype" >&5
+echo "${ECHO_T}$ac_cv_member_struct_stat_st_vfstype" >&6
+if test $ac_cv_member_struct_stat_st_vfstype = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_VFSTYPE 1
+_ACEOF
+
+
+fi
+
+               if test "$ac_cv_member_struct_stat_st_fstype" = yes; then
+                       cat >conftest.$ac_ext <<_ACEOF
+struct stat st; char *ptr=st.st_fstype;
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_STAT_ST_FSTYPE_CHAR 1
+_ACEOF
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_STAT_ST_FSTYPE_INT 1
+_ACEOF
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+               fi
        fi
        LIBSRCS="$LIBSRCS getpeereid.c"
 fi
@@ -39993,13 +40200,6 @@ cat >>confdefs.h <<\_ACEOF
 #define LDAP_SYSLOG 1
 _ACEOF
 
-fi
-if test "$ol_link_kbind" != no ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND LDAP_VENDOR_VERSION
-_ACEOF
-
 fi
 if test "$ol_enable_proctitle" != no ; then
 
@@ -40301,6 +40501,23 @@ _ACEOF
 
 fi
 
+if test "$ol_enable_sock" != no ; then
+       BUILD_SLAPD=yes
+       BUILD_SOCK=$ol_enable_sock
+       if test "$ol_enable_sock" = mod ; then
+               SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-sock"
+               MFLAG=SLAPD_MOD_DYNAMIC
+       else
+               SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-sock"
+               MFLAG=SLAPD_MOD_STATIC
+       fi
+
+cat >>confdefs.h <<_ACEOF
+#define SLAPD_SOCK $MFLAG
+_ACEOF
+
+fi
+
 if test "$ol_link_sql" != no ; then
        BUILD_SLAPD=yes
        BUILD_SQL=$ol_enable_sql
@@ -40382,22 +40599,6 @@ _ACEOF
 
 fi
 
-if test "$ol_enable_denyop" != no ; then
-       BUILD_DENYOP=$ol_enable_denyop
-       if test "$ol_enable_denyop" = mod ; then
-               MFLAG=SLAPD_MOD_DYNAMIC
-               SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS denyop.la"
-       else
-               MFLAG=SLAPD_MOD_STATIC
-               SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS denyop.o"
-       fi
-
-cat >>confdefs.h <<_ACEOF
-#define SLAPD_OVER_DENYOP $MFLAG
-_ACEOF
-
-fi
-
 if test "$ol_enable_dyngroup" != no ; then
        BUILD_DYNGROUP=$ol_enable_dyngroup
        if test "$ol_enable_dyngroup" = mod ; then
@@ -40430,18 +40631,18 @@ _ACEOF
 
 fi
 
-if test "$ol_enable_lastmod" != no ; then
-       BUILD_LASTMOD=$ol_enable_lastmod
-       if test "$ol_enable_lastmod" = mod ; then
+if test "$ol_enable_memberof" != no ; then
+       BUILD_MEMBEROF=$ol_enable_memberof
+       if test "$ol_enable_memberof" = mod ; then
                MFLAG=SLAPD_MOD_DYNAMIC
-               SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS lastmod.la"
+               SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS memberof.la"
        else
                MFLAG=SLAPD_MOD_STATIC
-               SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS lastmod.o"
+               SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS memberof.o"
        fi
 
 cat >>confdefs.h <<_ACEOF
-#define SLAPD_OVER_LASTMOD $MFLAG
+#define SLAPD_OVER_MEMBEROF $MFLAG
 _ACEOF
 
 fi
@@ -40607,12 +40808,6 @@ _ACEOF
 
 fi
 
-if test "$ol_enable_slurpd" != no &&
-   test "$ol_link_threads" != no &&
-   test $BUILD_SLAPD = yes ; then
-       BUILD_SLURPD=yes
-fi
-
 if test "$ol_enable_rewrite" != no ; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -40732,7 +40927,7 @@ if test "${with_xxinstall+set}" = set; then
 fi;
 
 
-                                                                                                                                                                                                                                                                                                                                                                                                      ac_config_files="$ac_config_files Makefile:build/top.mk:Makefile.in:build/dir.mk doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk include/Makefile:build/top.mk:include/Makefile.in libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk libraries/liblunicode/Makefile:build/top.mk:libraries/liblunicode/Makefile.in:build/lib.mk:build/lib-static.mk libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk libraries/librewrite/Makefile:build/top.mk:libraries/librewrite/Makefile.in:build/lib.mk:build/lib-static.mk servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk servers/slapd/back-bdb/Makefile:build/top.mk:servers/slapd/back-bdb/Makefile.in:build/mod.mk servers/slapd/back-dnssrv/Makefile:build/top.mk:servers/slapd/back-dnssrv/Makefile.in:build/mod.mk servers/slapd/back-hdb/Makefile:build/top.mk:servers/slapd/back-hdb/Makefile.in:build/mod.mk servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk servers/slapd/back-ldif/Makefile:build/top.mk:servers/slapd/back-ldif/Makefile.in:build/mod.mk servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk servers/slapd/back-null/Makefile:build/top.mk:servers/slapd/back-null/Makefile.in:build/mod.mk servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk servers/slapd/back-relay/Makefile:build/top.mk:servers/slapd/back-relay/Makefile.in:build/mod.mk servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk servers/slapd/overlays/Makefile:build/top.mk:servers/slapd/overlays/Makefile.in:build/lib.mk servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk tests/run tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk"
+                                                                                                                                                                                                                                                                                                                                                                                                      ac_config_files="$ac_config_files Makefile:build/top.mk:Makefile.in:build/dir.mk doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk include/Makefile:build/top.mk:include/Makefile.in libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk libraries/liblunicode/Makefile:build/top.mk:libraries/liblunicode/Makefile.in:build/lib.mk:build/lib-static.mk libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk libraries/librewrite/Makefile:build/top.mk:libraries/librewrite/Makefile.in:build/lib.mk:build/lib-static.mk servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk servers/slapd/back-bdb/Makefile:build/top.mk:servers/slapd/back-bdb/Makefile.in:build/mod.mk servers/slapd/back-dnssrv/Makefile:build/top.mk:servers/slapd/back-dnssrv/Makefile.in:build/mod.mk servers/slapd/back-hdb/Makefile:build/top.mk:servers/slapd/back-hdb/Makefile.in:build/mod.mk servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk servers/slapd/back-ldif/Makefile:build/top.mk:servers/slapd/back-ldif/Makefile.in:build/mod.mk servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk servers/slapd/back-null/Makefile:build/top.mk:servers/slapd/back-null/Makefile.in:build/mod.mk servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk servers/slapd/back-relay/Makefile:build/top.mk:servers/slapd/back-relay/Makefile.in:build/mod.mk servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk servers/slapd/back-sock/Makefile:build/top.mk:servers/slapd/back-sock/Makefile.in:build/mod.mk servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk servers/slapd/overlays/Makefile:build/top.mk:servers/slapd/overlays/Makefile.in:build/lib.mk tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk tests/run tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk"
 
 
           ac_config_commands="$ac_config_commands default"
   "servers/slapd/back-perl/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk" ;;
   "servers/slapd/back-relay/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/back-relay/Makefile:build/top.mk:servers/slapd/back-relay/Makefile.in:build/mod.mk" ;;
   "servers/slapd/back-shell/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk" ;;
+  "servers/slapd/back-sock/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/back-sock/Makefile:build/top.mk:servers/slapd/back-sock/Makefile.in:build/mod.mk" ;;
   "servers/slapd/back-sql/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk" ;;
   "servers/slapd/shell-backends/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk" ;;
   "servers/slapd/slapi/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk" ;;
   "servers/slapd/overlays/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slapd/overlays/Makefile:build/top.mk:servers/slapd/overlays/Makefile.in:build/lib.mk" ;;
-  "servers/slurpd/Makefile" ) CONFIG_FILES="$CONFIG_FILES servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk" ;;
   "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk" ;;
   "tests/run" ) CONFIG_FILES="$CONFIG_FILES tests/run" ;;
   "tests/progs/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk" ;;
@@ -41470,6 +41665,7 @@ s,@BUILD_PASSWD@,$BUILD_PASSWD,;t t
 s,@BUILD_RELAY@,$BUILD_RELAY,;t t
 s,@BUILD_PERL@,$BUILD_PERL,;t t
 s,@BUILD_SHELL@,$BUILD_SHELL,;t t
+s,@BUILD_SOCK@,$BUILD_SOCK,;t t
 s,@BUILD_SQL@,$BUILD_SQL,;t t
 s,@BUILD_ACCESSLOG@,$BUILD_ACCESSLOG,;t t
 s,@BUILD_AUDITLOG@,$BUILD_AUDITLOG,;t t
@@ -41479,6 +41675,7 @@ s,@BUILD_DENYOP@,$BUILD_DENYOP,;t t
 s,@BUILD_DYNGROUP@,$BUILD_DYNGROUP,;t t
 s,@BUILD_DYNLIST@,$BUILD_DYNLIST,;t t
 s,@BUILD_LASTMOD@,$BUILD_LASTMOD,;t t
+s,@BUILD_MEMBEROF@,$BUILD_MEMBEROF,;t t
 s,@BUILD_PPOLICY@,$BUILD_PPOLICY,;t t
 s,@BUILD_PROXYCACHE@,$BUILD_PROXYCACHE,;t t
 s,@BUILD_REFINT@,$BUILD_REFINT,;t t
@@ -41489,10 +41686,8 @@ s,@BUILD_SYNCPROV@,$BUILD_SYNCPROV,;t t
 s,@BUILD_TRANSLUCENT@,$BUILD_TRANSLUCENT,;t t
 s,@BUILD_UNIQUE@,$BUILD_UNIQUE,;t t
 s,@BUILD_VALSORT@,$BUILD_VALSORT,;t t
-s,@BUILD_SLURPD@,$BUILD_SLURPD,;t t
 s,@LDAP_LIBS@,$LDAP_LIBS,;t t
 s,@SLAPD_LIBS@,$SLAPD_LIBS,;t t
-s,@SLURPD_LIBS@,$SLURPD_LIBS,;t t
 s,@BDB_LIBS@,$BDB_LIBS,;t t
 s,@LTHREAD_LIBS@,$LTHREAD_LIBS,;t t
 s,@LUTIL_LIBS@,$LUTIL_LIBS,;t t
@@ -42214,7 +42409,7 @@ rm -f $BACKENDSC
 cat > $BACKENDSC << ENDX
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42265,7 +42460,7 @@ rm -f $OVERLAYSC
 cat > $OVERLAYSC << ENDX
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 /* end of generated file */
 ENDX
 
-echo Please run \"make depend\" to build dependencies
+if test "${ol_cv_mkdep}" = no; then
+       echo '(Do not "make depend"; we do not know how to build dependencies)'
+else
+       echo 'Please run "make depend" to build dependencies'
+fi
  ;;
   esac
 done