]> git.sur5r.net Git - openldap/blobdiff - configure
Prepare for release
[openldap] / configure
index 214318b211c5ec6e65ea7abdd03b8a7ec7c94386..abbc879967d78a4d791a7f66bd545b2b064aa15e 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,13 +1,17 @@
 #! /bin/sh
 # $OpenLDAP$
-# from OpenLDAP: pkg/ldap/configure.in,v 1.256 1999/09/10 00:10:20 kdz Exp  
+# from OpenLDAP: pkg/ldap/configure.in,v 1.223.2.36 2001/12/04 18:15:24 kurt Exp  
 
-# Copyright 1998,1999 The OpenLDAP Foundation.  All Rights Reserved.
+# Copyright 1998-2001 The OpenLDAP Foundation.  All Rights Reserved.
 # 
-# Redistribution and use in source and binary forms are permitted only
-# as authorized by the OpenLDAP Public License.  A copy of this
-# license is available at http://www.OpenLDAP.org/license.html or
-# in file LICENSE in the top-level directory of the distribution.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted only as authorized by the OpenLDAP
+# Public License.  A copy of this license is available at
+# http://www.OpenLDAP.org/license.html or in file LICENSE in the
+# top-level directory of the distribution.
+
+echo "Copyright 1998-2001 The OpenLDAP Foundation,  All Rights Reserved."
+echo "Restrictions apply, see COPYRIGHT and LICENSE files."
 
 # Guess values for system-dependent variables and create Makefiles.
 # Generated automatically using autoconf version 2.13.1 
@@ -22,99 +26,95 @@ ac_default_prefix=/usr/local
 # Any additions from configure.in:
 ac_default_prefix=/usr/local
 ac_help="$ac_help
-  --with-subdir=DIR change default subdirectory used for installs"
+  --with-subdir=DIR      change default subdirectory used for installs"
 ac_help="$ac_help
-  --enable-debug       enable debugging (yes)"
+  --enable-debug         enable debugging [yes]"
 ac_help="$ac_help
-  --enable-syslog      enable syslog support (auto)"
+  --enable-syslog        enable syslog support [auto]"
 ac_help="$ac_help
-  --enable-proctitle   enable proctitle support (yes)"
+  --enable-proctitle     enable proctitle support [yes]"
 ac_help="$ac_help
-  --enable-cache       enable caching (yes)"
+  --enable-cache         enable caching (experimental) [no]"
 ac_help="$ac_help
-  --enable-dns         enable V2 DX Referrals extension (no)"
+  --enable-referrals     enable LDAPv2+ Referrals (experimental) [no]"
 ac_help="$ac_help
-  --enable-referrals   enable V2 Referrals extension (yes)"
+  --enable-kbind         enable LDAPv2+ Kerberos IV bind (deprecated) [no]"
 ac_help="$ac_help
-  --enable-cldap       enable connectionless ldap (no)"
+  --enable-ipv6          enable IPv6 support [auto]"
 ac_help="$ac_help
-  --enable-x-compile   enable cross compiling (no)"
+  --enable-local         enable AF_LOCAL (AF_UNIX) socket support [auto]"
 ac_help="$ac_help
-  --enable-dmalloc     enable debug malloc support (no)"
+  --enable-x-compile     enable cross compiling [no]"
 ac_help="$ac_help
-  --with-cyrus-sasl    with Cyrus SASL support (auto)"
+  --with-cyrus-sasl      with Cyrus SASL support [auto]"
 ac_help="$ac_help
-  --with-fetch         with fetch URL support (auto)"
+  --with-fetch           with fetch URL support [auto]"
 ac_help="$ac_help
-  --with-kerberos      with Kerberos support (auto)"
+  --with-kerberos        with Kerberos support [auto]"
 ac_help="$ac_help
-  --with-readline      with readline support (auto)"
+  --with-readline        with readline support [auto]"
 ac_help="$ac_help
-  --with-threads       use threads (auto)"
+  --with-threads         with threads [auto]"
 ac_help="$ac_help
-  --with-tls           with TLS/SSL support (auto)"
+  --with-tls             with TLS/SSL support [auto]"
 ac_help="$ac_help
-  --with-yielding-select       with implicitly yielding select (auto)"
+  --with-yielding-select  with implicitly yielding select [auto]"
 ac_help="$ac_help
 SLAPD (Standalone LDAP Daemon) Options:"
 ac_help="$ac_help
-  --enable-slapd       enable building slapd (yes)"
-ac_help="$ac_help
-    --enable-cleartext enable cleartext passwords (yes)"
+  --enable-slapd         enable building slapd [yes]"
 ac_help="$ac_help
-    --enable-crypt     enable crypt(3) passwords (auto)"
+    --enable-cleartext   enable cleartext passwords [yes]"
 ac_help="$ac_help
-    --enable-modules   enable dynamic module support (no)"
+    --enable-crypt       enable crypt(3) passwords [auto]"
 ac_help="$ac_help
-    --enable-multimaster       enable multimaster replication (no)"
+    --enable-kpasswd     enable kerberos password verification [no]"
 ac_help="$ac_help
-    --enable-phonetic  enable phonetic/soundex (no)"
+    --enable-spasswd     enable (Cyrus) SASL password verification [no]"
 ac_help="$ac_help
-    --enable-quipu     build quipu migration tools (no)"
+    --enable-modules     enable dynamic module support [no]"
 ac_help="$ac_help
-    --enable-rlookups  enable reverse lookups (auto)"
+    --enable-phonetic    enable phonetic/soundex [no]"
 ac_help="$ac_help
-    --enable-aci       enable per-object ACIs (no)"
+    --enable-rlookups    enable reverse lookups [no]"
 ac_help="$ac_help
-    --enable-discreteaci       enable discrete rights in ACIs (no)"
+    --enable-aci         enable per-object ACIs [no]"
 ac_help="$ac_help
-    --enable-wrappers  enable tcp wrapper support (no)"
+    --enable-wrappers    enable tcp wrapper support [no]"
 ac_help="$ac_help
-    --enable-bdb2      enable bdb2 backend (no)"
+    --enable-dynamic     enable linking built binaries with dynamic libs [no]"
 ac_help="$ac_help
-      --with-bdb2-module       module type (static)"
+    --enable-dnssrv      enable dnssrv backend [no]"
 ac_help="$ac_help
-    --enable-ldap      enable ldap backend (no)"
+    --with-dnssrv-module  module type [static]"
 ac_help="$ac_help
-      --with-ldap-module       module type (static)"
+    --enable-ldap        enable ldap backend [no]"
 ac_help="$ac_help
-    --enable-ldbm      enable ldbm backend (yes)"
+    --with-ldap-module   module type [static]"
 ac_help="$ac_help
-      --with-ldbm-api  use LDBM API (auto)"
+    --enable-ldbm        enable ldbm backend [yes]"
 ac_help="$ac_help
-      --with-ldbm-module       module type (static)"
+    --with-ldbm-api       with LDBM API [auto]"
 ac_help="$ac_help
-      --with-ldbm-type use LDBM type (auto)"
+    --with-ldbm-module   module type [static]"
 ac_help="$ac_help
-    --enable-passwd    enable passwd backend (no)"
+    --with-ldbm-type     use LDBM type [auto]"
 ac_help="$ac_help
-      --with-passwd-module     module type (static)"
+    --enable-passwd      enable passwd backend [no]"
 ac_help="$ac_help
-    --enable-perl      enable perl backend (no)"
+    --with-passwd-module  module type [static]"
 ac_help="$ac_help
-      --with-perl-module       module type (static)"
+    --enable-shell       enable shell backend [no]"
 ac_help="$ac_help
-    --enable-shell     enable shell backend (no)"
+    --with-shell-module          module type [static]"
 ac_help="$ac_help
-      --with-shell-module      module type (static)"
+    --enable-sql         enable sql backend [no]"
 ac_help="$ac_help
-    --enable-tcl       enable tcl backend (no)"
-ac_help="$ac_help
-      --with-tcl-module        module type (static)"
+    --with-sql-module    module type [static]"
 ac_help="$ac_help
 SLURPD (Replication Daemon) Options:"
 ac_help="$ac_help
-  --enable-slurpd      enable building slurpd (auto)"
+  --enable-slurpd        enable building slurpd [auto]"
 ac_help="$ac_help
 Library Generation & Linking Options"
 ac_help="$ac_help
@@ -629,6 +629,16 @@ else
   ac_n= ac_c='\c' ac_t=
 fi
 
+
+# set unset (borrowed from autoconf 2.49c)
+if (OL_FOO=OL_FOO; unset OL_FOO) >/dev/null 2>&1; then
+  ol_unset=unset
+else
+  ol_unset=false
+fi
+# unset CDPATH
+$ol_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
+
 ac_aux_dir=
 for ac_dir in build $srcdir/build; do
   if test -f $ac_dir/install-sh; then
@@ -639,6 +649,10 @@ for ac_dir in build $srcdir/build; do
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install.sh -c"
     break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
   fi
 done
 if test -z "$ac_aux_dir"; then
@@ -653,9 +667,11 @@ if test -z "$OL_VERSION"; then
        { echo "configure: error: could not determine version" 1>&2; exit 1; }
 fi
 
+echo "Configuring OpenLDAP $OL_VERSION ..."
+
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:659: checking host system type" >&5
+echo "configure:675: checking host system type" >&5
 if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
 
 # Make sure we can run config.sub.
@@ -696,7 +712,7 @@ host_os=$ac_cv_host_os
 
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:700: checking target system type" >&5
+echo "configure:716: checking target system type" >&5
 if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
 
 # Make sure we can run config.sub.
@@ -736,7 +752,7 @@ target_os=$ac_cv_target_os
 
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:740: checking build system type" >&5
+echo "configure:756: checking build system type" >&5
 if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
 
 # Make sure we can run config.sub.
@@ -813,7 +829,7 @@ test "$host_alias" != "$target_alias" &&
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:817: checking for a BSD compatible install" >&5
+echo "configure:833: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -870,7 +886,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:874: checking whether build environment is sane" >&5
+echo "configure:890: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -931,7 +947,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:935: checking for $ac_word" >&5
+echo "configure:951: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -961,7 +977,7 @@ test -n "$AWK" && break
 done
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:965: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:981: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1001,7 +1017,7 @@ fi
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1005: checking for working aclocal" >&5
+echo "configure:1021: checking for working aclocal" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1014,7 +1030,7 @@ else
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1018: checking for working autoconf" >&5
+echo "configure:1034: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1027,7 +1043,7 @@ else
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1031: checking for working automake" >&5
+echo "configure:1047: checking for working automake" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1040,7 +1056,7 @@ else
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1044: checking for working autoheader" >&5
+echo "configure:1060: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1053,7 +1069,7 @@ else
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1057: checking for working makeinfo" >&5
+echo "configure:1073: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1073,7 +1089,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1077: checking for $ac_word" >&5
+echo "configure:1093: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1110,8 +1126,6 @@ if test -n "$AMTAR"; then
   fi
 fi
 
-
-
 cat >> confdefs.h <<EOF
 #define OPENLDAP_PACKAGE "$PACKAGE"
 EOF
@@ -1124,7 +1138,7 @@ EOF
 
 
 echo $ac_n "checking configure arguments""... $ac_c" 1>&6
-echo "configure:1128: checking configure arguments" >&5
+echo "configure:1142: checking configure arguments" >&5
 
 
 top_builddir=`pwd`
@@ -1227,13 +1241,13 @@ if test "${enable_cache+set}" = set; then
        ol_enable_cache="$ol_arg"
 
 else
-       ol_enable_cache="yes"
+       ol_enable_cache="no"
 fi
 # end --enable-cache
-# OpenLDAP --enable-dns
-       # Check whether --enable-dns or --disable-dns was given.
-if test "${enable_dns+set}" = set; then
-  enableval="$enable_dns"
+# OpenLDAP --enable-referrals
+       # Check whether --enable-referrals or --disable-referrals was given.
+if test "${enable_referrals+set}" = set; then
+  enableval="$enable_referrals"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1242,18 +1256,18 @@ if test "${enable_dns+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-dns" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-referrals" 1>&2; exit 1; }
        fi
-       ol_enable_dns="$ol_arg"
+       ol_enable_referrals="$ol_arg"
 
 else
-       ol_enable_dns="no"
+       ol_enable_referrals="no"
 fi
-# end --enable-dns
-# OpenLDAP --enable-referrals
-       # Check whether --enable-referrals or --disable-referrals was given.
-if test "${enable_referrals+set}" = set; then
-  enableval="$enable_referrals"
+# end --enable-referrals
+# OpenLDAP --enable-kbind
+       # Check whether --enable-kbind or --disable-kbind was given.
+if test "${enable_kbind+set}" = set; then
+  enableval="$enable_kbind"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1262,18 +1276,18 @@ if test "${enable_referrals+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-referrals" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-kbind" 1>&2; exit 1; }
        fi
-       ol_enable_referrals="$ol_arg"
+       ol_enable_kbind="$ol_arg"
 
 else
-       ol_enable_referrals="yes"
+       ol_enable_kbind="no"
 fi
-# end --enable-referrals
-# OpenLDAP --enable-cldap
-       # Check whether --enable-cldap or --disable-cldap was given.
-if test "${enable_cldap+set}" = set; then
-  enableval="$enable_cldap"
+# end --enable-kbind
+# OpenLDAP --enable-ipv6
+       # Check whether --enable-ipv6 or --disable-ipv6 was given.
+if test "${enable_ipv6+set}" = set; then
+  enableval="$enable_ipv6"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1282,55 +1296,55 @@ if test "${enable_cldap+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-cldap" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-ipv6" 1>&2; exit 1; }
        fi
-       ol_enable_cldap="$ol_arg"
+       ol_enable_ipv6="$ol_arg"
 
 else
-       ol_enable_cldap="no"
+       ol_enable_ipv6="auto"
 fi
-# end --enable-cldap
-# OpenLDAP --enable-x_compile
-       # Check whether --enable-x_compile or --disable-x_compile was given.
-if test "${enable_x_compile+set}" = set; then
-  enableval="$enable_x_compile"
+# end --enable-ipv6
+# OpenLDAP --enable-local
+       # Check whether --enable-local or --disable-local was given.
+if test "${enable_local+set}" = set; then
+  enableval="$enable_local"
   
        ol_arg=invalid
-       for ol_val in yes no ; do
+       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 "configure: error: bad value $enableval for --enable-x_compile" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-local" 1>&2; exit 1; }
        fi
-       ol_enable_x_compile="$ol_arg"
+       ol_enable_local="$ol_arg"
 
 else
-       ol_enable_x_compile="no"
+       ol_enable_local="auto"
 fi
-# end --enable-x_compile
-
-# OpenLDAP --enable-dmalloc
-       # Check whether --enable-dmalloc or --disable-dmalloc was given.
-if test "${enable_dmalloc+set}" = set; then
-  enableval="$enable_dmalloc"
+# end --enable-local
+# OpenLDAP --enable-x_compile
+       # Check whether --enable-x_compile or --disable-x_compile was given.
+if test "${enable_x_compile+set}" = set; then
+  enableval="$enable_x_compile"
   
        ol_arg=invalid
-       for ol_val in auto yes no ; do
+       for ol_val in yes no ; do
                if test "$enableval" = "$ol_val" ; then
                        ol_arg="$ol_val"
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-dmalloc" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-x_compile" 1>&2; exit 1; }
        fi
-       ol_enable_dmalloc="$ol_arg"
+       ol_enable_x_compile="$ol_arg"
 
 else
-       ol_enable_dmalloc="no"
+       ol_enable_x_compile="no"
 fi
-# end --enable-dmalloc
+# end --enable-x_compile
+
 
 # OpenLDAP --with-cyrus_sasl
        # Check whether --with-cyrus_sasl or --without-cyrus_sasl was given.
@@ -1380,7 +1394,7 @@ if test "${with_kerberos+set}" = set; then
   withval="$with_kerberos"
   
        ol_arg=invalid
-       for ol_val in auto k5 k4 afs yes no ; do
+       for ol_val in auto k5 k5only k425 kth k4 afs yes no ; do
                if test "$withval" = "$ol_val" ; then
                        ol_arg="$ol_val"
                fi
@@ -1422,7 +1436,7 @@ if test "${with_threads+set}" = set; then
   withval="$with_threads"
   
        ol_arg=invalid
-       for ol_val in auto posix mach pth lwp yes no manual  ; do
+       for ol_val in auto nt posix mach pth lwp yes no manual  ; do
                if test "$withval" = "$ol_val" ; then
                        ol_arg="$ol_val"
                fi
@@ -1547,10 +1561,10 @@ else
        ol_enable_crypt="auto"
 fi
 # end --enable-crypt
-# OpenLDAP --enable-modules
-       # Check whether --enable-modules or --disable-modules was given.
-if test "${enable_modules+set}" = set; then
-  enableval="$enable_modules"
+# OpenLDAP --enable-kpasswd
+       # Check whether --enable-kpasswd or --disable-kpasswd was given.
+if test "${enable_kpasswd+set}" = set; then
+  enableval="$enable_kpasswd"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1559,18 +1573,18 @@ if test "${enable_modules+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-modules" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-kpasswd" 1>&2; exit 1; }
        fi
-       ol_enable_modules="$ol_arg"
+       ol_enable_kpasswd="$ol_arg"
 
 else
-       ol_enable_modules="no"
+       ol_enable_kpasswd="no"
 fi
-# end --enable-modules
-# OpenLDAP --enable-multimaster
-       # Check whether --enable-multimaster or --disable-multimaster was given.
-if test "${enable_multimaster+set}" = set; then
-  enableval="$enable_multimaster"
+# end --enable-kpasswd
+# OpenLDAP --enable-spasswd
+       # Check whether --enable-spasswd or --disable-spasswd was given.
+if test "${enable_spasswd+set}" = set; then
+  enableval="$enable_spasswd"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1579,18 +1593,18 @@ if test "${enable_multimaster+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-multimaster" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-spasswd" 1>&2; exit 1; }
        fi
-       ol_enable_multimaster="$ol_arg"
+       ol_enable_spasswd="$ol_arg"
 
 else
-       ol_enable_multimaster="no"
+       ol_enable_spasswd="no"
 fi
-# end --enable-multimaster
-# OpenLDAP --enable-phonetic
-       # Check whether --enable-phonetic or --disable-phonetic was given.
-if test "${enable_phonetic+set}" = set; then
-  enableval="$enable_phonetic"
+# end --enable-spasswd
+# OpenLDAP --enable-modules
+       # Check whether --enable-modules or --disable-modules was given.
+if test "${enable_modules+set}" = set; then
+  enableval="$enable_modules"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1599,18 +1613,18 @@ if test "${enable_phonetic+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-phonetic" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-modules" 1>&2; exit 1; }
        fi
-       ol_enable_phonetic="$ol_arg"
+       ol_enable_modules="$ol_arg"
 
 else
-       ol_enable_phonetic="no"
+       ol_enable_modules="no"
 fi
-# end --enable-phonetic
-# OpenLDAP --enable-quipu
-       # Check whether --enable-quipu or --disable-quipu was given.
-if test "${enable_quipu+set}" = set; then
-  enableval="$enable_quipu"
+# end --enable-modules
+# OpenLDAP --enable-phonetic
+       # Check whether --enable-phonetic or --disable-phonetic was given.
+if test "${enable_phonetic+set}" = set; then
+  enableval="$enable_phonetic"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1619,14 +1633,14 @@ if test "${enable_quipu+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-quipu" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-phonetic" 1>&2; exit 1; }
        fi
-       ol_enable_quipu="$ol_arg"
+       ol_enable_phonetic="$ol_arg"
 
 else
-       ol_enable_quipu="no"
+       ol_enable_phonetic="no"
 fi
-# end --enable-quipu
+# end --enable-phonetic
 # OpenLDAP --enable-rlookups
        # Check whether --enable-rlookups or --disable-rlookups was given.
 if test "${enable_rlookups+set}" = set; then
@@ -1644,7 +1658,7 @@ if test "${enable_rlookups+set}" = set; then
        ol_enable_rlookups="$ol_arg"
 
 else
-       ol_enable_rlookups="auto"
+       ol_enable_rlookups="no"
 fi
 # end --enable-rlookups
 # OpenLDAP --enable-aci
@@ -1667,10 +1681,10 @@ else
        ol_enable_aci="no"
 fi
 # end --enable-aci
-# OpenLDAP --enable-discreteaci
-       # Check whether --enable-discreteaci or --disable-discreteaci was given.
-if test "${enable_discreteaci+set}" = set; then
-  enableval="$enable_discreteaci"
+# OpenLDAP --enable-wrappers
+       # Check whether --enable-wrappers or --disable-wrappers was given.
+if test "${enable_wrappers+set}" = set; then
+  enableval="$enable_wrappers"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1679,18 +1693,18 @@ if test "${enable_discreteaci+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-discreteaci" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-wrappers" 1>&2; exit 1; }
        fi
-       ol_enable_discreteaci="$ol_arg"
+       ol_enable_wrappers="$ol_arg"
 
 else
-       ol_enable_discreteaci="no"
+       ol_enable_wrappers="no"
 fi
-# end --enable-discreteaci
-# OpenLDAP --enable-wrappers
-       # Check whether --enable-wrappers or --disable-wrappers was given.
-if test "${enable_wrappers+set}" = set; then
-  enableval="$enable_wrappers"
+# end --enable-wrappers
+# OpenLDAP --enable-dynamic
+       # Check whether --enable-dynamic or --disable-dynamic was given.
+if test "${enable_dynamic+set}" = set; then
+  enableval="$enable_dynamic"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1699,19 +1713,19 @@ if test "${enable_wrappers+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-wrappers" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-dynamic" 1>&2; exit 1; }
        fi
-       ol_enable_wrappers="$ol_arg"
+       ol_enable_dynamic="$ol_arg"
 
 else
-       ol_enable_wrappers="no"
+       ol_enable_dynamic="no"
 fi
-# end --enable-wrappers
+# end --enable-dynamic
 
-# OpenLDAP --enable-bdb2
-       # Check whether --enable-bdb2 or --disable-bdb2 was given.
-if test "${enable_bdb2+set}" = set; then
-  enableval="$enable_bdb2"
+# OpenLDAP --enable-dnssrv
+       # Check whether --enable-dnssrv or --disable-dnssrv was given.
+if test "${enable_dnssrv+set}" = set; then
+  enableval="$enable_dnssrv"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1720,18 +1734,18 @@ if test "${enable_bdb2+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-bdb2" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-dnssrv" 1>&2; exit 1; }
        fi
-       ol_enable_bdb2="$ol_arg"
+       ol_enable_dnssrv="$ol_arg"
 
 else
-       ol_enable_bdb2="no"
+       ol_enable_dnssrv="no"
 fi
-# end --enable-bdb2
-# OpenLDAP --with-bdb2_module
-       # Check whether --with-bdb2_module or --without-bdb2_module was given.
-if test "${with_bdb2_module+set}" = set; then
-  withval="$with_bdb2_module"
+# end --enable-dnssrv
+# OpenLDAP --with-dnssrv_module
+       # Check whether --with-dnssrv_module or --without-dnssrv_module was given.
+if test "${with_dnssrv_module+set}" = set; then
+  withval="$with_dnssrv_module"
   
        ol_arg=invalid
        for ol_val in static dynamic ; do
@@ -1740,14 +1754,14 @@ if test "${with_bdb2_module+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $withval for --with-bdb2_module" 1>&2; exit 1; }
+               { echo "configure: error: bad value $withval for --with-dnssrv_module" 1>&2; exit 1; }
        fi
-       ol_with_bdb2_module="$ol_arg"
+       ol_with_dnssrv_module="$ol_arg"
 
 else
-       ol_with_bdb2_module="static"
+       ol_with_dnssrv_module="static"
 fi
-# end --with-bdb2_module
+# end --with-dnssrv_module
 
 # OpenLDAP --enable-ldap
        # Check whether --enable-ldap or --disable-ldap was given.
@@ -1816,7 +1830,7 @@ if test "${with_ldbm_api+set}" = set; then
   withval="$with_ldbm_api"
   
        ol_arg=invalid
-       for ol_val in auto db2 db mdbm gdbm ndbm manual ; do
+       for ol_val in auto berkeley bcompat mdbm gdbm ; do
                if test "$withval" = "$ol_val" ; then
                        ol_arg="$ol_val"
                fi
@@ -1873,7 +1887,6 @@ else
 fi
 # end --with-ldbm_type
 
-
 # OpenLDAP --enable-passwd
        # Check whether --enable-passwd or --disable-passwd was given.
 if test "${enable_passwd+set}" = set; then
@@ -1915,47 +1928,6 @@ else
 fi
 # end --with-passwd_module
 
-# OpenLDAP --enable-perl
-       # Check whether --enable-perl or --disable-perl was given.
-if test "${enable_perl+set}" = set; then
-  enableval="$enable_perl"
-  
-       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 "configure: error: bad value $enableval for --enable-perl" 1>&2; exit 1; }
-       fi
-       ol_enable_perl="$ol_arg"
-
-else
-       ol_enable_perl="no"
-fi
-# end --enable-perl
-# OpenLDAP --with-perl_module
-       # Check whether --with-perl_module or --without-perl_module was given.
-if test "${with_perl_module+set}" = set; then
-  withval="$with_perl_module"
-  
-       ol_arg=invalid
-       for ol_val in static dynamic ; do
-               if test "$withval" = "$ol_val" ; then
-                       ol_arg="$ol_val"
-               fi
-       done
-       if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $withval for --with-perl_module" 1>&2; exit 1; }
-       fi
-       ol_with_perl_module="$ol_arg"
-
-else
-       ol_with_perl_module="static"
-fi
-# end --with-perl_module
-
 # OpenLDAP --enable-shell
        # Check whether --enable-shell or --disable-shell was given.
 if test "${enable_shell+set}" = set; then
@@ -1997,10 +1969,10 @@ else
 fi
 # end --with-shell_module
 
-# OpenLDAP --enable-tcl
-       # Check whether --enable-tcl or --disable-tcl was given.
-if test "${enable_tcl+set}" = set; then
-  enableval="$enable_tcl"
+# OpenLDAP --enable-sql
+       # Check whether --enable-sql or --disable-sql was given.
+if test "${enable_sql+set}" = set; then
+  enableval="$enable_sql"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -2009,18 +1981,18 @@ if test "${enable_tcl+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $enableval for --enable-tcl" 1>&2; exit 1; }
+               { echo "configure: error: bad value $enableval for --enable-sql" 1>&2; exit 1; }
        fi
-       ol_enable_tcl="$ol_arg"
+       ol_enable_sql="$ol_arg"
 
 else
-       ol_enable_tcl="no"
+       ol_enable_sql="no"
 fi
-# end --enable-tcl
-# OpenLDAP --with-tcl_module
-       # Check whether --with-tcl_module or --without-tcl_module was given.
-if test "${with_tcl_module+set}" = set; then
-  withval="$with_tcl_module"
+# end --enable-sql
+# OpenLDAP --with-sql_module
+       # Check whether --with-sql_module or --without-sql_module was given.
+if test "${with_sql_module+set}" = set; then
+  withval="$with_sql_module"
   
        ol_arg=invalid
        for ol_val in static dynamic ; do
@@ -2029,14 +2001,14 @@ if test "${with_tcl_module+set}" = set; then
                fi
        done
        if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $withval for --with-tcl_module" 1>&2; exit 1; }
+               { echo "configure: error: bad value $withval for --with-sql_module" 1>&2; exit 1; }
        fi
-       ol_with_tcl_module="$ol_arg"
+       ol_with_sql_module="$ol_arg"
 
 else
-       ol_with_tcl_module="static"
+       ol_with_sql_module="static"
 fi
-# end --with-tcl_module
+# end --with-sql_module
 
 
 # Check whether --with-xxslurpdoptions or --without-xxslurpdoptions was given.
@@ -2119,20 +2091,11 @@ else
 fi
 
 
-# validate options
-if test $ol_enable_dns = yes ; then
-       if test $ol_enable_referrals = no ; then
-               { echo "configure: error: DNS requires --enable-referrals" 1>&2; exit 1; }
-       fi
-       if test $ol_enable_referrals = auto ; then
-               echo "configure: warning: DNS requires referrals, adding --enable-referrals" 1>&2
-               ol_enable_referrals=yes
-       fi
-fi
 
+# validate options
 if test $ol_enable_slapd = no ; then
-               if test $ol_enable_bdb2 = yes ; then
-               echo "configure: warning: slapd disabled, ignoring --enable-bdb2 argument" 1>&2
+               if test $ol_enable_dnssrv = yes ; then
+               echo "configure: warning: slapd disabled, ignoring --enable-dnssrv argument" 1>&2
        fi
        if test $ol_enable_ldap = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-ldap argument" 1>&2
@@ -2143,47 +2106,35 @@ if test $ol_enable_slapd = no ; then
        if test $ol_enable_passwd = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-passwd argument" 1>&2
        fi
-       if test $ol_enable_perl = yes ; then
-               echo "configure: warning: slapd disabled, ignoring --enable-perl argument" 1>&2
-       fi
        if test $ol_enable_shell = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-shell argument" 1>&2
        fi
-       if test $ol_enable_tcl = yes ; then
-               echo "configure: warning: slapd disabled, ignoring --enable-tcl argument" 1>&2
+       if test $ol_enable_sql = yes ; then
+               echo "configure: warning: slapd disabled, ignoring --enable-sql argument" 1>&2
        fi
        if test $ol_enable_modules = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-modules argument" 1>&2
        fi
-       if test $ol_enable_multimaster = yes ; then
-               echo "configure: warning: slapd disabled, ignoring --enable-multimaster argument" 1>&2
-       fi
        if test $ol_enable_wrappers = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-wrappers argument" 1>&2
        fi
        if test $ol_enable_phonetic = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-phonetic argument" 1>&2
        fi
-       if test $ol_enable_quipu = yes ; then
-               echo "configure: warning: slapd disabled, ignoring --enable-quipu argument" 1>&2
-       fi
        if test $ol_enable_rlookups = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-rlookups argument" 1>&2
        fi
        if test $ol_enable_aci = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-aci argument" 1>&2
        fi
-       if test $ol_enable_discreteaci = yes ; then
-               echo "configure: warning: slapd disabled, ignoring --enable-discreteaci argument" 1>&2
-       fi
        if test $ol_with_ldbm_api != auto ; then
                echo "configure: warning: slapd disabled, ignoring --with-ldbm-api argument" 1>&2
        fi
        if test $ol_with_ldbm_type != auto ; then
                echo "configure: warning: slapd disabled, ignoring --with-ldbm-type argument" 1>&2
        fi
-       if test $ol_with_bdb2_module != static ; then
-               echo "configure: warning: slapd disabled, ignoring --with-bdb2-module argument" 1>&2
+       if test $ol_with_dnssrv_module != static ; then
+               echo "configure: warning: slapd disabled, ignoring --with-dnssrv-module argument" 1>&2
        fi
        if test $ol_with_ldap_module != static ; then
                echo "configure: warning: slapd disabled, ignoring --with-ldap-module argument" 1>&2
@@ -2194,47 +2145,40 @@ if test $ol_enable_slapd = no ; then
        if test $ol_with_passwd_module != static ; then
                echo "configure: warning: slapd disabled, ignoring --with-passwd-module argument" 1>&2
        fi
-       if test $ol_with_perl_module != static ; then
-               echo "configure: warning: slapd disabled, ignoring --with-perl-module argument" 1>&2
-       fi
        if test $ol_with_shell_module != static ; then
                echo "configure: warning: slapd disabled, ignoring --with-shell-module argument" 1>&2
        fi
-       if test $ol_with_tcl_module != static ; then
-               echo "configure: warning: slapd disabled, ignoring --with-tcl-module argument" 1>&2
+       if test $ol_with_sql_module != static ; then
+               echo "configure: warning: slapd disabled, ignoring --with-sql-module argument" 1>&2
        fi
        if test $ol_enable_slurpd = yes ; then
                { echo "configure: error: slurpd requires slapd" 1>&2; exit 1; }
        fi
 
        # force settings to no
-       ol_enable_bdb2=no
+       ol_enable_dnssrv=no
        ol_enable_ldap=no
        ol_enable_ldbm=no
        ol_enable_passwd=no
-       ol_enable_perl=no
        ol_enable_shell=no
-       ol_enable_tcl=no
+       ol_enable_sql=no
 
        ol_enable_modules=no
-       ol_enable_multimaster=no
        ol_enable_phonetic=no
-       ol_enable_quipu=no
        ol_enable_rlookups=no
        ol_enable_aci=no
-       ol_enable_discreteaci=no
        ol_enable_wrappers=no
+       ol_enable_dynamic=no
 
        ol_with_ldbm_api=no
        ol_with_ldbm_type=no
 
-       ol_with_bdb2_module=static
+       ol_with_dnssrv_module=static
        ol_with_ldap_module=static
        ol_with_ldbm_module=static
        ol_with_passwd_module=static
-       ol_with_perl_module=static
        ol_with_shell_module=static
-       ol_with_tcl_module=static
+       ol_with_sql_module=static
 
        ol_enable_slurpd=no
 
@@ -2252,16 +2196,12 @@ elif test $ol_enable_ldbm = no ; then
                echo "configure: warning: LDBM disabled, ignoring --with-ldbm-module argument" 1>&2
        fi
 
-       if test $ol_enable_bdb2 = yes ; then
-               { echo "configure: error: BDB2 requires --enable-ldbm" 1>&2; exit 1; }
-       fi
-
        if test $ol_enable_modules != yes -a \
+               $ol_enable_dnssrv = no -a \
                $ol_enable_ldap = no -a \
                $ol_enable_passwd = no -a \
-               $ol_enable_perl = no -a \
                $ol_enable_shell = no -a \
-               $ol_enable_tcl = no ; then
+               $ol_enable_sql = no ; then
                { echo "configure: error: slapd requires a backend" 1>&2; exit 1; }
        fi
 
@@ -2269,26 +2209,8 @@ elif test $ol_enable_ldbm = no ; then
        ol_with_ldbm_type=no
        ol_with_ldbm_module=static
 
-elif test $ol_enable_bdb2 = yes ; then
-       
-       if test $ol_with_ldbm_api != auto -a \
-               $ol_with_ldbm_api != db2 ; then
-               { echo "configure: error: BDB2 requires LDBM API DB2" 1>&2; exit 1; }
-       fi
-
-       ol_with_ldbm_api=db2
-
 else
-       
-       if test $ol_enable_bdb2 != no ; then
-               if test $ol_with_ldbm_api != auto -a \
-                       $ol_with_ldbm_api != db2 ; then
-                       echo "configure: warning: BDB2 requires LDBM api db2 or auto" 1>&2
-                       ol_enable_bdb2=no
-               fi
-       fi
-
-       if test $ol_with_ldbm_api = gdbm -a \
+               if test $ol_with_ldbm_api = gdbm -a \
                $ol_with_ldbm_type = btree ; then
                { echo "configure: error: GDBM only supports LDBM type hash" 1>&2; exit 1; }
        fi
@@ -2308,9 +2230,31 @@ if test $ol_enable_slurpd = yes ; then
        fi
 fi
 
+if test $ol_enable_kbind = yes -o $ol_enable_kpasswd = yes ; then
+       if test $ol_with_kerberos = no ; then
+               { echo "configure: error: options require --with-kerberos" 1>&2; exit 1; }
+       elif test $ol_with_kerberos = auto ; then
+               ol_with_kerberos=yes
+       fi
+
+elif test $ol_enable_kbind = no -o $ol_enable_kpasswd = no ; then
+       if test $ol_with_kerberos = auto ; then
+               ol_with_kerberos=no
+       elif test $ol_with_kerberos != no ; then
+               echo "configure: warning: Kerberos detection enabled unnecessarily" 1>&2;
+               ol_with_kerberos=no
+       fi
+fi
+
+if test $ol_enable_spasswd = yes ; then
+       if test $ol_with_cyrus_sasl = no ; then
+               { echo "configure: error: options require --with-cyrus-sasl" 1>&2; exit 1; }
+       fi
+       ol_with_cyrus_sasl=yes
+fi
+
 echo "$ac_t""done" 1>&6
 
-## Initialize vars
 LDAP_LIBS=
 LDIF_LIBS=
 LDBM_LIBS=
@@ -2323,37 +2267,38 @@ SLURPD_LIBS=
 BUILD_SLAPD=no
 BUILD_SLURPD=no
 
-BUILD_BDB2=no
+BUILD_THREAD=no
+
+BUILD_DNSSRV=no
 BUILD_LDAP=no
 BUILD_LDBM=no
 BUILD_PASSWD=no
-BUILD_PERL=no
-BUILD_QUIPU=no
 BUILD_SHELL=no
-BUILD_TCL=no
-BUILD_THREAD=no
+BUILD_SQL=no
 
-BUILD_BDB2_DYNAMIC=static
+BUILD_DNSSRV_DYNAMIC=static
 BUILD_LDAP_DYNAMIC=static
 BUILD_LDBM_DYNAMIC=static
 BUILD_PASSWD_DYNAMIC=static
-BUILD_PERL_DYNAMIC=static
 BUILD_SHELL_DYNAMIC=static
-BUILD_TCL_DYNAMIC=static
+BUILD_SQL_DYNAMIC=static
 
 SLAPD_MODULES_LDFLAGS=
 SLAPD_MODULES_CPPFLAGS=
 SLAPD_MODULES_LIST=
 
-SLAPD_PERL_LDFLAGS=
-SLAPD_PERL_CPPFLAGS=
+SLAPD_SQL_LDFLAGS=
+SLAPD_SQL_LIBS=
+SLAPD_SQL_INCLUDES=
 
-KRB_LIBS=
+KRB4_LIBS=
+KRB5_LIBS=
 READLINE_LIBS=
 SASL_LIBS=
 TERMCAP_LIBS=
 TLS_LIBS=
 MODULES_LIBS=
+AUTH_LIBS=
 
 
 
@@ -2381,7 +2326,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2385: checking for $ac_word" >&5
+echo "configure:2330: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2433,7 +2378,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2437: checking for $ac_word" >&5
+echo "configure:2382: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2465,6 +2410,42 @@ done
 fi
 
 
+for ac_prog in ar gar
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2419: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_AR+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AR="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$AR" && break
+done
+
+
+
 
 # Check whether --enable-fast-install or --disable-fast-install was given.
 if test "${enable_fast_install+set}" = set; then
@@ -2492,7 +2473,7 @@ fi
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2496: checking for $ac_word" >&5
+echo "configure:2477: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2522,7 +2503,7 @@ fi
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2526: checking for $ac_word" >&5
+echo "configure:2507: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2552,7 +2533,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2556: checking for $ac_word" >&5
+echo "configure:2537: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2603,7 +2584,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2607: checking for $ac_word" >&5
+echo "configure:2588: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2635,7 +2616,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2639: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
+echo "configure:2620: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2646,12 +2627,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 2650 "configure"
+#line 2631 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -2677,12 +2658,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2681: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2662: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2686: checking whether we are using GNU C" >&5
+echo "configure:2667: checking whether we are using GNU C" >&5
 if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2691,7 +2672,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -2710,7 +2691,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2714: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2695: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2753,7 +2734,7 @@ ac_prog=ld
 if test "$ac_cv_prog_gcc" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
   echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:2757: checking for ld used by GCC" >&5
+echo "configure:2738: checking for ld used by GCC" >&5
   ac_prog=`($CC -print-prog-name=ld) 2>&5`
   case "$ac_prog" in
     # Accept absolute paths.
@@ -2777,10 +2758,10 @@ echo "configure:2757: checking for ld used by GCC" >&5
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:2781: checking for GNU ld" >&5
+echo "configure:2762: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:2784: checking for non-GNU ld" >&5
+echo "configure:2765: checking for non-GNU ld" >&5
 fi
 if eval "test \"\${ac_cv_path_LD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2814,9 +2795,8 @@ else
   echo "$ac_t""no" 1>&6
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
-
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:2820: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:2800: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"\${ac_cv_prog_gnu_ld+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2832,7 +2812,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:2836: checking for BSD-compatible nm" >&5
+echo "configure:2816: checking for BSD-compatible nm" >&5
 if eval "test \"\${ac_cv_path_NM+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2867,9 +2847,8 @@ fi
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
-
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:2873: checking whether ln -s works" >&5
+echo "configure:2852: checking whether ln -s works" >&5
 if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2889,6 +2868,17 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
 
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
@@ -2898,7 +2888,7 @@ test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast
 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
 libtool_flags="$libtool_flags --enable-dlopen"
-
+libtool_flags="$libtool_flags --enable-win32-dll"
 # Check whether --enable-libtool-lock or --disable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then
   enableval="$enable_libtool_lock"
@@ -2910,11 +2900,11 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
-case "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 2917 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:2918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 2907 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:2908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -2935,19 +2925,19 @@ case "$host" in
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2939: checking whether the C compiler needs -belf" >&5
+echo "configure:2929: checking whether the C compiler needs -belf" >&5
 if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2944 "configure"
+#line 2934 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -2966,96 +2956,299 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
   fi
   ;;
 
-
-esac
-
-
-# Save cache, so that ltconfig can load it
-
-
-# Actually configure libtool.  ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
-DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
-|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
-
-# Reload cache, that may have been modified by ltconfig
-
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
-
-
-for ac_prog in mawk gawk nawk awk
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
+*-*-cygwin* | *-*-mingw*)
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3005: checking for $ac_word" >&5
-if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
+echo "configure:2964: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_DLLTOOL+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_dummy="$PATH"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_AWK="$ac_prog"
+      ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
       break
     fi
   done
   IFS="$ac_save_ifs"
 fi
 fi
-AWK="$ac_cv_prog_AWK"
-if test -n "$AWK"; then
-  echo "$ac_t""$AWK" 1>&6
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
-test -n "$AWK" && break
-done
 
-# test for ln hardlink support
-echo $ac_n "checking whether ln works""... $ac_c" 1>&6
-echo "configure:3036: checking whether ln works" >&5
-if eval "test \"\${ol_cv_prog_LN_H+set}\" = set"; then
+if test -z "$ac_cv_prog_DLLTOOL"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2996: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_DLLTOOL+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  rm -f conftest.src conftest.dst
-echo "conftest" > conftest.src
-if ln conftest.src conftest.dst 2>/dev/null
-then
-  ol_cv_prog_LN_H="ln"
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
 else
-  ol_cv_prog_LN_H="cp"
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_DLLTOOL="dlltool"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
 fi
-rm -f conftest.src conftest.dst
-
 fi
-LN_H="$ol_cv_prog_LN_H"
-if test "$ol_cv_prog_LN_H" = "ln"; then
-       echo "$ac_t""yes" 1>&6
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
 else
-       echo "$ac_t""no" 1>&6
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  DLLTOOL="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3031: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_AS+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="${ac_tool_prefix}as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_AS"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3063: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_AS+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  AS="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3098: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_OBJDUMP+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_OBJDUMP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3130: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_OBJDUMP+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  OBJDUMP="false"
+fi
+fi
+
+  ;;
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+
+
+# Actually configure libtool.  ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+# Reload cache, that may have been modified by ltconfig
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+for ac_prog in mawk gawk nawk awk
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3198: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AWK="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AWK="$ac_cv_prog_AWK"
+if test -n "$AWK"; then
+  echo "$ac_t""$AWK" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$AWK" && break
+done
+
+# test for ln hardlink support
+echo $ac_n "checking whether ln works""... $ac_c" 1>&6
+echo "configure:3229: checking whether ln works" >&5
+if eval "test \"\${ol_cv_prog_LN_H+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftest.src conftest.dst
+echo "conftest" > conftest.src
+if ln conftest.src conftest.dst 2>/dev/null
+then
+  ol_cv_prog_LN_H="ln"
+else
+  ol_cv_prog_LN_H="cp"
+fi
+rm -f conftest.src conftest.dst
+
+fi
+LN_H="$ol_cv_prog_LN_H"
+if test "$ol_cv_prog_LN_H" = "ln"; then
+       echo "$ac_t""yes" 1>&6
+else
+       echo "$ac_t""no" 1>&6
 fi
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3059: checking whether ln -s works" >&5
+echo "configure:3252: checking whether ln -s works" >&5
 if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3083,7 +3276,7 @@ fi
 # Extract the first word of "sendmail", so it can be a program name with args.
 set dummy sendmail; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3087: checking for $ac_word" >&5
+echo "configure:3280: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_path_SENDMAIL+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3091,7 +3284,7 @@ else
   /*)
   ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
+  ?:/*)
   ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a dos path.
   ;;
   *)
@@ -3119,7 +3312,7 @@ fi
 # Extract the first word of "vi", so it can be a program name with args.
 set dummy vi; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3123: checking for $ac_word" >&5
+echo "configure:3316: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_path_EDITOR+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3127,7 +3320,7 @@ else
   /*)
   ac_cv_path_EDITOR="$EDITOR" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
+  ?:/*)
   ac_cv_path_EDITOR="$EDITOR" # Let the user override the test with a dos path.
   ;;
   *)
@@ -3155,7 +3348,7 @@ fi
 # Extract the first word of "finger", so it can be a program name with args.
 set dummy finger; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3159: checking for $ac_word" >&5
+echo "configure:3352: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_path_FINGER+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3163,7 +3356,7 @@ else
   /*)
   ac_cv_path_FINGER="$FINGER" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
+  ?:/*)
   ac_cv_path_FINGER="$FINGER" # Let the user override the test with a dos path.
   ;;
   *)
@@ -3189,60 +3382,8 @@ else
 fi
 
 
-ol_link_perl=no
-if test $ol_enable_perl != no ; then
-       # Extract the first word of "perl", so it can be a program name with args.
-set dummy perl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3198: checking for $ac_word" >&5
-if eval "test \"\${ac_cv_path_PERLBIN+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$PERLBIN" in
-  /*)
-  ac_cv_path_PERLBIN="$PERLBIN" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_PERLBIN="$PERLBIN" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_PERLBIN="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_PERLBIN" && ac_cv_path_PERLBIN="/usr/bin/perl"
-  ;;
-esac
-fi
-PERLBIN="$ac_cv_path_PERLBIN"
-if test -n "$PERLBIN"; then
-  echo "$ac_t""$PERLBIN" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-       if test "no$PERLBIN" = "no" ; then
-               if test $ol_enable_perl = yes ; then
-                       { echo "configure: error: could not locate perl" 1>&2; exit 1; }
-               fi
-
-       else
-               SLAPD_PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e s/-lc//`"
-               SLAPD_PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e ccopts`"
-
-                               ol_link_perl=yes
-       fi
-fi
-
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:3246: checking how to run the C preprocessor" >&5
+echo "configure:3387: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -3257,13 +3398,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 3261 "configure"
+#line 3402 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -3274,13 +3415,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 3278 "configure"
+#line 3419 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -3291,13 +3432,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 3295 "configure"
+#line 3436 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -3335,9 +3476,9 @@ elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
 fi
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:3339: checking for AIX" >&5
+echo "configure:3480: checking for AIX" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3341 "configure"
+#line 3482 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -3359,7 +3500,7 @@ rm -f conftest*
 
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:3363: checking for POSIXized ISC" >&5
+echo "configure:3504: checking for POSIXized ISC" >&5
 if test -d /etc/conf/kconfig.d &&
   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
 then
@@ -3381,17 +3522,17 @@ fi
 
 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:3385: checking for minix/config.h" >&5
+echo "configure:3526: checking for minix/config.h" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3390 "configure"
+#line 3531 "configure"
 #include "confdefs.h"
 #include <minix/config.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3430,12 +3571,12 @@ fi
 
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:3434: checking for Cygwin environment" >&5
+echo "configure:3575: checking for Cygwin environment" >&5
 if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3439 "configure"
+#line 3580 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3446,7 +3587,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:3450: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -3462,19 +3603,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:3466: checking for mingw32 environment" >&5
+echo "configure:3607: checking for mingw32 environment" >&5
 if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3471 "configure"
+#line 3612 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:3478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -3490,19 +3631,19 @@ echo "$ac_t""$ac_cv_mingw32" 1>&6
 MINGW32=
 test "$ac_cv_mingw32" = yes && MINGW32=yes
 echo $ac_n "checking for EMX OS/2 environment""... $ac_c" 1>&6
-echo "configure:3494: checking for EMX OS/2 environment" >&5
+echo "configure:3635: checking for EMX OS/2 environment" >&5
 if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3499 "configure"
+#line 3640 "configure"
 #include "confdefs.h"
 
 int main() {
 return __EMX__;
 ; return 0; }
 EOF
-if { (eval echo configure:3506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_emxos2=yes
 else
@@ -3521,7 +3662,7 @@ test "$ac_cv_emxos2" = yes && EMXOS2=yes
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:3525: checking for executable suffix" >&5
+echo "configure:3666: checking for executable suffix" >&5
 if eval "test \"\${ac_cv_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3531,7 +3672,7 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:3535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:3676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.C | *.o | *.obj | *.xcoff) ;;
@@ -3552,13 +3693,13 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6
 ac_exeext=$EXEEXT
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:3556: checking for object suffix" >&5
+echo "configure:3697: checking for object suffix" >&5
 if eval "test \"\${ac_cv_objext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftest*
 echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:3562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -3582,7 +3723,7 @@ EOF
 
 
 echo $ac_n "checking for be_app in -lbe""... $ac_c" 1>&6
-echo "configure:3586: checking for be_app in -lbe" >&5
+echo "configure:3727: checking for be_app in -lbe" >&5
 ac_lib_var=`echo be'_'be_app | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3590,7 +3731,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbe -lroot -lnet $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3594 "configure"
+#line 3735 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3601,7 +3742,7 @@ int main() {
 be_app()
 ; return 0; }
 EOF
-if { (eval echo configure:3605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3627,7 +3768,7 @@ fi
 
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:3631: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:3772: checking for ${CC-cc} option to accept ANSI C" >&5
 if eval "test \"\${am_cv_prog_cc_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3644,7 +3785,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO
 do
   CC="$ac_save_CC $ac_arg"
   cat > conftest.$ac_ext <<EOF
-#line 3648 "configure"
+#line 3789 "configure"
 #include "confdefs.h"
 #include <stdarg.h>
 #include <stdio.h>
@@ -3681,7 +3822,7 @@ return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
 
 ; return 0; }
 EOF
-if { (eval echo configure:3685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_prog_cc_stdc="$ac_arg"; break
 else
@@ -3715,7 +3856,7 @@ if test -z "${MKDEP}"; then
        OL_MKDEP="${CC-cc}"
        if test -z "${MKDEP_FLAGS}"; then
                echo $ac_n "checking for ${OL_MKDEP} depend flag""... $ac_c" 1>&6
-echo "configure:3719: checking for ${OL_MKDEP} depend flag" >&5
+echo "configure:3860: checking for ${OL_MKDEP} depend flag" >&5
 if eval "test \"\${ol_cv_mkdep+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3725,7 +3866,7 @@ else
                                cat > conftest.c <<EOF
  noCode;
 EOF
-                               if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:3729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } \
+                               if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:3870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } \
                                        | egrep '^conftest\.'"${ac_objext}" >/dev/null 2>&1
                                then
                                        if test ! -f conftest."${ac_object}" ; then
@@ -3757,23 +3898,71 @@ if test "${ol_cv_mkdep}" = no ; then
        echo "configure: warning: do not know how to generate dependencies" 1>&2
 fi
 
+echo $ac_n "checking for afopen in -ls""... $ac_c" 1>&6
+echo "configure:3903: checking for afopen in -ls" >&5
+ac_lib_var=`echo s'_'afopen | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ls  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3911 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char afopen();
+
+int main() {
+afopen()
+; return 0; }
+EOF
+if { (eval echo configure:3922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+       AUTH_LIBS=-ls
+       cat >> confdefs.h <<\EOF
+#define HAVE_AIX_SECURITY 1
+EOF
+
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
 ol_link_modules=no
 if test $ol_enable_modules != no ; then
        for ac_hdr in ltdl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3767: checking for $ac_hdr" >&5
+echo "configure:3956: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3772 "configure"
+#line 3961 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3966: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3802,11 +3991,10 @@ done
 
        if test $ac_cv_header_ltdl_h = no ; then
                { echo "configure: error: could not locate libtool ltdl.h" 1>&2; exit 1; }
-
        fi
 
        echo $ac_n "checking for lt_dlinit in -lltdl""... $ac_c" 1>&6
-echo "configure:3810: checking for lt_dlinit in -lltdl" >&5
+echo "configure:3998: checking for lt_dlinit in -lltdl" >&5
 ac_lib_var=`echo ltdl'_'lt_dlinit | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3814,7 +4002,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lltdl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3818 "configure"
+#line 4006 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3825,7 +4013,7 @@ int main() {
 lt_dlinit()
 ; return 0; }
 EOF
-if { (eval echo configure:3829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3840,41 +4028,40 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo ltdl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
+  
+           MODULES_LIBS=-lltdl
+           cat >> confdefs.h <<\EOF
+#define HAVE_LIBLTDL 1
 EOF
 
-  LIBS="-lltdl $LIBS"
-
+       
 else
   echo "$ac_t""no" 1>&6
 fi
 
+
        if test "$ac_cv_lib_ltdl_lt_dlinit" = no ; then
                { echo "configure: error: could not locate libtool -lltdl" 1>&2; exit 1; }
        fi
        ol_link_modules=yes
 else
-       ol_with_bdb2_module=static
+       ol_with_dnssrv_module=static
        ol_with_ldap_module=static
        ol_with_ldbm_module=static
        ol_with_passwd_module=static
-       ol_with_perl_module=static
        ol_with_shell_module=static
-       ol_with_tcl_module=static
+       ol_with_sql_module=static
 fi
 
 # test for EBCDIC
 echo $ac_n "checking for EBCDIC""... $ac_c" 1>&6
-echo "configure:3872: checking for EBCDIC" >&5
+echo "configure:4059: checking for EBCDIC" >&5
 if eval "test \"\${ol_cv_cpp_ebcdic+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 3878 "configure"
+#line 4065 "configure"
 #include "confdefs.h"
 
 #if !('M' == 0xd4)
@@ -3883,7 +4070,7 @@ else
 
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3907,12 +4094,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3911: checking for ANSI C header files" >&5
+echo "configure:4098: checking for ANSI C header files" >&5
 if eval "test \"\${ol_cv_header_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3916 "configure"
+#line 4103 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3920,7 +4107,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3937,7 +4124,7 @@ rm -f conftest*
 if test $ol_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3941 "configure"
+#line 4128 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3955,7 +4142,7 @@ fi
 if test $ol_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3959 "configure"
+#line 4146 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3976,7 +4163,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3980 "configure"
+#line 4167 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #ifndef HAVE_EBCDIC
@@ -3994,7 +4181,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4028,12 +4215,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:4032: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4219: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"\${ac_cv_header_dirent_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4037 "configure"
+#line 4224 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -4041,7 +4228,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4066,7 +4253,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4070: checking for opendir in -ldir" >&5
+echo "configure:4257: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4074,7 +4261,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4078 "configure"
+#line 4265 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4085,7 +4272,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4107,7 +4294,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4111: checking for opendir in -lx" >&5
+echo "configure:4298: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4115,7 +4302,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4119 "configure"
+#line 4306 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4126,7 +4313,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4149,12 +4336,12 @@ fi
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:4153: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:4340: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"\${ac_cv_header_sys_wait_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4158 "configure"
+#line 4345 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -4170,7 +4357,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:4174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -4191,12 +4378,12 @@ EOF
 fi
 
 echo $ac_n "checking POSIX termios""... $ac_c" 1>&6
-echo "configure:4195: checking POSIX termios" >&5
+echo "configure:4382: checking POSIX termios" >&5
 if eval "test \"\${am_cv_sys_posix_termios+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4200 "configure"
+#line 4387 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <unistd.h>
@@ -4206,7 +4393,7 @@ int main() {
    tcgetattr(0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:4210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_sys_posix_termios=yes
 else
@@ -4222,7 +4409,7 @@ echo "$ac_t""$am_cv_sys_posix_termios" 1>&6
 
 
  echo $ac_n "checking whether use of TIOCGWINSZ requires sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:4226: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5
+echo "configure:4413: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5
 if eval "test \"\${am_cv_sys_tiocgwinsz_needs_sys_ioctl_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4231,7 +4418,7 @@ else
   gwinsz_in_termios_h=no
   if test $am_cv_sys_posix_termios = yes; then
     cat > conftest.$ac_ext <<EOF
-#line 4235 "configure"
+#line 4422 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #     include <termios.h>
@@ -4251,7 +4438,7 @@ rm -f conftest*
 
   if test $gwinsz_in_termios_h = no; then
     cat > conftest.$ac_ext <<EOF
-#line 4255 "configure"
+#line 4442 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #     include <sys/ioctl.h>
@@ -4290,12 +4477,15 @@ for ac_hdr in \
        arpa/inet.h             \
        arpa/nameser.h  \
        assert.h                \
+       conio.h                 \
        crypt.h                 \
+       direct.h                \
        errno.h                 \
        fcntl.h                 \
        filio.h                 \
        getopt.h                \
        grp.h                   \
+       io.h                    \
        libutil.h               \
        limits.h                \
        locale.h                \
@@ -4304,6 +4494,7 @@ for ac_hdr in \
        memory.h                \
        psap.h                  \
        pwd.h                   \
+       process.h               \
        resolv.h                \
        sgtty.h                 \
        shadow.h                \
@@ -4325,21 +4516,22 @@ for ac_hdr in \
        syslog.h                \
        termios.h               \
        unistd.h                \
+       winsock.h               \
 
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4333: checking for $ac_hdr" >&5
+echo "configure:4525: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4338 "configure"
+#line 4530 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4343: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4535: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4368,21 +4560,21 @@ done
 
 
 
-echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:4373: checking for socket" >&5
-if eval "test \"\${ac_cv_func_socket+set}\" = set"; then
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:4565: checking for dlopen" >&5
+if eval "test \"\${ac_cv_func_dlopen+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4378 "configure"
+#line 4570 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char socket(); below.  */
+    which can conflict with char dlopen(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char socket();
+char dlopen();
 char (*f)();
 
 int main() {
@@ -4390,49 +4582,52 @@ int main() {
 /* 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_socket) || defined (__stub___socket)
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
 choke me
 #else
-f = socket;
+f = dlopen;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_socket=yes"
+  eval "ac_cv_func_dlopen=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_socket=no"
+  eval "ac_cv_func_dlopen=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
 else
   echo "$ac_t""no" 1>&6
-       
-       echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:4421: checking for main in -lsocket" >&5
-ac_lib_var=`echo socket'_'main | sed 'y%./+-:%__p__%'`
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:4612: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lsocket  $LIBS"
+LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4429 "configure"
+#line 4620 "configure"
 #include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
 
 int main() {
-main()
+dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4447,35 +4642,180 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_lib 1
 EOF
 
-  LIBS="-lsocket $LIBS"
+  LIBS="-ldl $LIBS"
 
 else
   echo "$ac_t""no" 1>&6
 fi
 
-       echo $ac_n "checking for main in -lnet""... $ac_c" 1>&6
-echo "configure:4464: checking for main in -lnet" >&5
-ac_lib_var=`echo net'_'main | sed 'y%./+-:%__p__%'`
+fi
+
+
+echo $ac_n "checking for sigset in -lV3""... $ac_c" 1>&6
+echo "configure:4662: checking for sigset in -lV3" >&5
+ac_lib_var=`echo V3'_'sigset | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lnet  $LIBS"
+LIBS="-lV3  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4670 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char sigset();
+
+int main() {
+sigset()
+; return 0; }
+EOF
+if { (eval echo configure:4681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo V3 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lV3 $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test $ac_cv_header_winsock_h = yes; then
+       echo $ac_n "checking for winsock""... $ac_c" 1>&6
+echo "configure:4711: checking for winsock" >&5
+if eval "test \"\${ol_cv_winsock+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4716 "configure"
+#include "confdefs.h"
+#include <winsock.h>
+int main() {
+
+                       socket(0,0,0);
+                       select(0,NULL,NULL,NULL,NULL);
+                       closesocket(0);
+                       gethostname(NULL,0);
+       
+; return 0; }
+EOF
+if { (eval echo configure:4728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_winsock=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_winsock=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ol_cv_winsock" 1>&6
+
+       if test $ol_cv_winsock = yes ; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_WINSOCK 1
+EOF
+
+               ac_cv_func_socket=yes
+               ac_cv_func_select=yes
+               ac_cv_func_closesocket=yes
+               ac_cv_func_gethostname=yes
+       fi
+fi
+
+
+echo $ac_n "checking for socket""... $ac_c" 1>&6
+echo "configure:4756: checking for socket" >&5
+if eval "test \"\${ac_cv_func_socket+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4761 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char socket(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char socket();
+char (*f)();
+
+int main() {
+
+/* 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_socket) || defined (__stub___socket)
+choke me
+#else
+f = socket;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_socket=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_socket=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+       
+       echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
+echo "configure:4804: checking for main in -lsocket" >&5
+ac_lib_var=`echo socket'_'main | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4472 "configure"
+#line 4812 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4490,39 +4830,35 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo net | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_lib 1
 EOF
 
-  LIBS="-lnet $LIBS"
+  LIBS="-lsocket $LIBS"
 
 else
   echo "$ac_t""no" 1>&6
 fi
 
-       echo $ac_n "checking for socket in -lnet""... $ac_c" 1>&6
-echo "configure:4507: checking for socket in -lnet" >&5
-ac_lib_var=`echo net'_'socket | sed 'y%./+-:%__p__%'`
+       echo $ac_n "checking for main in -lnet""... $ac_c" 1>&6
+echo "configure:4847: checking for main in -lnet" >&5
+ac_lib_var=`echo net'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4515 "configure"
+#line 4855 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char socket();
 
 int main() {
-socket()
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:4526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4550,7 +4886,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnsl_s""... $ac_c" 1>&6
-echo "configure:4554: checking for main in -lnsl_s" >&5
+echo "configure:4890: checking for main in -lnsl_s" >&5
 ac_lib_var=`echo nsl_s'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4558,14 +4894,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4562 "configure"
+#line 4898 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4593,7 +4929,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:4597: checking for main in -lnsl" >&5
+echo "configure:4933: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4601,14 +4937,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4605 "configure"
+#line 4941 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4636,7 +4972,7 @@ else
 fi
 
        echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6
-echo "configure:4640: checking for socket in -linet" >&5
+echo "configure:4976: checking for socket in -linet" >&5
 ac_lib_var=`echo inet'_'socket | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4644,7 +4980,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-linet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4648 "configure"
+#line 4984 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4655,7 +4991,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:4659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4683,7 +5019,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lgen""... $ac_c" 1>&6
-echo "configure:4687: checking for main in -lgen" >&5
+echo "configure:5023: checking for main in -lgen" >&5
 ac_lib_var=`echo gen'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4691,14 +5027,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgen  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4695 "configure"
+#line 5031 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4730,12 +5066,12 @@ fi
 
 
 echo $ac_n "checking for select""... $ac_c" 1>&6
-echo "configure:4734: checking for select" >&5
+echo "configure:5070: checking for select" >&5
 if eval "test \"\${ac_cv_func_select+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4739 "configure"
+#line 5075 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char select(); below.  */
@@ -4759,7 +5095,7 @@ f = select;
 
 ; return 0; }
 EOF
-if { (eval echo configure:4763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_select=yes"
 else
@@ -4780,8 +5116,9 @@ else
 fi
 
 
-echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6
-echo "configure:4785: checking types of arguments for select()" >&5
+if test "${ac_cv_header_winsock_h}" != yes; then
+                echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6
+echo "configure:5122: checking types of arguments for select()" >&5
  if eval "test \"\${ac_cv_func_select_arg234+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4795,7 +5132,7 @@ else
      for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
       for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
        cat > conftest.$ac_ext <<EOF
-#line 4799 "configure"
+#line 5136 "configure"
 #include "confdefs.h"
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -4814,7 +5151,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
           ac_not_found=no ; break 3
 else
@@ -4852,23 +5189,24 @@ EOF
 EOF
 
 
+fi
 
 
 for ac_hdr in regex.h 
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4862: checking for $ac_hdr" >&5
+echo "configure:5200: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4867 "configure"
+#line 5205 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5210: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4898,12 +5236,12 @@ if test "$ac_cv_header_regex_h" != yes ; then
        { echo "configure: error: POSIX regex.h required." 1>&2; exit 1; }
 fi
 echo $ac_n "checking for regfree""... $ac_c" 1>&6
-echo "configure:4902: checking for regfree" >&5
+echo "configure:5240: checking for regfree" >&5
 if eval "test \"\${ac_cv_func_regfree+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4907 "configure"
+#line 5245 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char regfree(); below.  */
@@ -4927,7 +5265,7 @@ f = regfree;
 
 ; return 0; }
 EOF
-if { (eval echo configure:4931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_regfree=yes"
 else
@@ -4950,7 +5288,7 @@ fi
 
 
 echo $ac_n "checking for compatible POSIX regex""... $ac_c" 1>&6
-echo "configure:4954: checking for compatible POSIX regex" >&5
+echo "configure:5292: checking for compatible POSIX regex" >&5
 if eval "test \"\${ol_cv_c_posix_regex+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4959,7 +5297,7 @@ else
   ol_cv_c_posix_regex=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 4963 "configure"
+#line 5301 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4985,7 +5323,7 @@ main()
        return rc;
 }
 EOF
-if { (eval echo configure:4989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_c_posix_regex=yes
 else
@@ -5005,69 +5343,72 @@ if test "$ol_cv_c_posix_regex" = no ; then
        { echo "configure: error: broken POSIX regex!" 1>&2; exit 1; }
 fi
 
-echo $ac_n "checking for sigset in -lV3""... $ac_c" 1>&6
-echo "configure:5010: checking for sigset in -lV3" >&5
-ac_lib_var=`echo V3'_'sigset | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+ol_link_dnssrv=no
+echo $ac_n "checking for res_query""... $ac_c" 1>&6
+echo "configure:5349: checking for res_query" >&5
+if eval "test \"\${ac_cv_func_res_query+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lV3  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5018 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 5354 "configure"
 #include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char res_query(); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char sigset();
+char res_query();
+char (*f)();
 
 int main() {
-sigset()
+
+/* 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_res_query) || defined (__stub___res_query)
+choke me
+#else
+f = res_query;
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:5029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  eval "ac_cv_func_res_query=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  eval "ac_cv_func_res_query=no"
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo V3 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lV3 $LIBS"
 
+if eval "test \"`echo '$ac_cv_func_'res_query`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
 else
   echo "$ac_t""no" 1>&6
 fi
 
-
-echo $ac_n "checking for res_search""... $ac_c" 1>&6
-echo "configure:5058: checking for res_search" >&5
-if eval "test \"\${ac_cv_func_res_search+set}\" = set"; then
+if test $ac_cv_func_res_query = no ; then 
+       echo $ac_n "checking for __res_query""... $ac_c" 1>&6
+echo "configure:5399: checking for __res_query" >&5
+if eval "test \"\${ac_cv_func___res_query+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5063 "configure"
+#line 5404 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char res_search(); below.  */
+    which can conflict with char __res_query(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char res_search();
+char __res_query();
 char (*f)();
 
 int main() {
@@ -5075,55 +5416,58 @@ int main() {
 /* 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_res_search) || defined (__stub___res_search)
+#if defined (__stub___res_query) || defined (__stub_____res_query)
 choke me
 #else
-f = res_search;
+f = __res_query;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_res_search=yes"
+  eval "ac_cv_func___res_query=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_res_search=no"
+  eval "ac_cv_func___res_query=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'res_search`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'__res_query`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
 else
   echo "$ac_t""no" 1>&6
 fi
 
-if test $ac_cv_func_res_search = no ; then 
-       echo $ac_n "checking for res_search in -lbind""... $ac_c" 1>&6
-echo "configure:5108: checking for res_search in -lbind" >&5
-ac_lib_var=`echo bind'_'res_search | sed 'y%./+-:%__p__%'`
+       ac_cv_func_res_query=$ac_cv_func___res_query
+fi
+
+if test $ac_cv_func_res_query = no ; then 
+       echo $ac_n "checking for res_query in -lbind""... $ac_c" 1>&6
+echo "configure:5452: checking for res_query in -lbind" >&5
+ac_lib_var=`echo bind'_'res_query | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5116 "configure"
+#line 5460 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char res_search();
+char res_query();
 
 int main() {
-res_search()
+res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:5127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5150,31 +5494,31 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
-       ac_cv_func_res_search=$ac_cv_lib_bind_res_search
+       ac_cv_func_res_query=$ac_cv_lib_bind_res_query
 fi
 
-if test $ac_cv_func_res_search = no ; then 
-       echo $ac_n "checking for __res_search in -lbind""... $ac_c" 1>&6
-echo "configure:5159: checking for __res_search in -lbind" >&5
-ac_lib_var=`echo bind'_'__res_search | sed 'y%./+-:%__p__%'`
+if test $ac_cv_func_res_query = no ; then 
+       echo $ac_n "checking for __res_query in -lbind""... $ac_c" 1>&6
+echo "configure:5503: checking for __res_query in -lbind" >&5
+ac_lib_var=`echo bind'_'__res_query | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5167 "configure"
+#line 5511 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char __res_search();
+char __res_query();
 
 int main() {
-__res_search()
+__res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5201,31 +5545,31 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
-       ac_cv_func_res_search=$ac_cv_lib_bind___res_search
+       ac_cv_func_res_query=$ac_cv_lib_bind___res_query
 fi
 
-if test $ac_cv_func_res_search = no ; then 
-       echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
-echo "configure:5210: checking for res_search in -lresolv" >&5
-ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-:%__p__%'`
+if test $ac_cv_func_res_query = no ; then 
+       echo $ac_n "checking for res_query in -lresolv""... $ac_c" 1>&6
+echo "configure:5554: checking for res_query in -lresolv" >&5
+ac_lib_var=`echo resolv'_'res_query | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5218 "configure"
+#line 5562 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char res_search();
+char res_query();
 
 int main() {
-res_search()
+res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:5229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5252,109 +5596,124 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
-       ac_cv_func_res_search=$ac_cv_lib_resolv_res_search
-fi
-
-if test "$ac_cv_func_res_search" = yes ; then
-       cat >> confdefs.h <<\EOF
-#define HAVE_RES_SEARCH 1
-EOF
-
-elif test $ol_enable_dns = yes ; then
-       { echo "configure: error: --enable-dns requires res_search" 1>&2; exit 1; }
-elif test $ol_enable_dns != no ; then
-       echo "configure: warning: no res_search, disabling DNS support" 1>&2
+       ac_cv_func_res_query=$ac_cv_lib_resolv_res_query
 fi
 
-
-# QUIPU
-if test $ol_enable_quipu != no ; then
-       for ac_hdr in quipu/commonarg.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5277: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+if test $ac_cv_func_res_query = no ; then 
+       echo $ac_n "checking for __res_query in -lresolv""... $ac_c" 1>&6
+echo "configure:5605: checking for __res_query in -lresolv" >&5
+ac_lib_var=`echo resolv'_'__res_query | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5282 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lresolv  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5613 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char __res_query();
+
+int main() {
+__res_query()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:5624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+    ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
   cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
+#define $ac_tr_lib 1
 EOF
+
+  LIBS="-lresolv $LIBS"
+
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
+       ac_cv_func_res_query=$ac_cv_lib_resolv___res_query
+fi
 
-       if test $ac_cv_header_quipu_commonarg_h = yes ; then
-               BUILD_QUIPU=yes
-       elif test $ol_enable_quipu = auto ; then
-               echo "configure: warning: no quipu for --enable-quipu=auto, disabling" 1>&2
-       else
-               { echo "configure: error: no quipu for --enable-quipu=$ol_enable_quipu" 1>&2; exit 1; }
+if test "$ac_cv_func_res_query" = yes ; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_RES_QUERY 1
+EOF
+
+
+       if test $ol_enable_dnssrv != no ; then
+               ol_link_dnssrv=yes
        fi
 fi
 
-ol_link_kerberos=no
+if test "$ol_enable_dnssrv" = yes -a "$ol_link_dnssrv" = no ; then
+       { echo "configure: error: DNSSRV requires res_query()" 1>&2; exit 1; }
+fi
 
-if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
-       for ac_hdr in kerberosIV/krb.h kerberosIV/des.h
+for ac_func in getaddrinfo inet_ntop 
 do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5330: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5672: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5335 "configure"
+#line 5677 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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();
+char (*f)();
+
+int main() {
+
+/* 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
+f = $ac_func;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
   cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
+#define $ac_tr_func 1
 EOF
  
 else
 done
 
 
-       if test $ac_cv_header_kerberosIV_krb_h = yes ; then
-               echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
-echo "configure:5369: checking for main in -lkrb4" >&5
-ac_lib_var=`echo krb4'_'main | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+ol_link_ipv6=no
+if test $ac_cv_func_getaddrinfo = no -o $ac_cv_func_inet_ntop = no ; then
+       if test $ol_enable_ipv6 = yes ; then
+               { echo "configure: error: IPv6 support requires getaddrinfo() and inet_ntop()" 1>&2; exit 1; }
+       fi
+else
+       for ac_func in gai_strerror 
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5735: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lkrb4 -lkrb5 -ldes425 $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5377 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 5740 "configure"
 #include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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();
+char (*f)();
 
 int main() {
-main()
+
+/* 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
+f = $ac_func;
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:5384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_k5=yes
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
 else
   echo "$ac_t""no" 1>&6
-have_k5=no
 fi
+done
 
 
-               if test $have_k5 = yes ; then
-                       ol_with_kerberos=found
-                       ol_link_kerberos=yes
-
-                       KRB_LIBS="-lkrb4 -lkrb5 -ldes425"
-
-                       LIBS="$KRB_LIBS $LIBS"
-
-                       echo $ac_n "checking for des_debug in Kerberos libraries""... $ac_c" 1>&6
-echo "configure:5415: checking for des_debug in Kerberos libraries" >&5
-if eval "test \"\${ol_cv_var_des_debug+set}\" = set"; then
+       echo $ac_n "checking INET6_ADDRSTRLEN""... $ac_c" 1>&6
+echo "configure:5790: checking INET6_ADDRSTRLEN" >&5
+if eval "test \"\${ol_cv_inet6_addrstrlen+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-                                                               save_LIBS="$LIBS"
-                               LIBS="$KRB_LIBS $LIBS"
-                               cat > conftest.$ac_ext <<EOF
-#line 5423 "configure"
+               cat > conftest.$ac_ext <<EOF
+#line 5796 "configure"
 #include "confdefs.h"
 
-#include <kerberosIV/krb.h>
-#include <kerberosIV/des.h>
-extern int des_debug;
-
-int main() {
-
-des_debug = 1;
-
-; return 0; }
+#                      include <netinet/in.h>
+#                      ifdef INET6_ADDRSTRLEN
+                               __has_inet6_addrstrlen__;
+#                      endif
+               
 EOF
-if { (eval echo configure:5436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "__has_inet6_addrstrlen__" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_var_des_debug=yes
+  ol_cv_inet6_addrstrlen=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_var_des_debug=no
+  ol_cv_inet6_addrstrlen=no
 fi
 rm -f conftest*
-                                                               LIBS="$save_LIBS"
-                       
-fi
 
-echo "$ac_t""$ol_cv_var_des_debug" 1>&6
-
-                       if test $ol_cv_var_des_debug = yes ; then
-                               cat >> confdefs.h <<\EOF
-#define HAVE_DES_DEBUG 1
-EOF
+fi
 
-                       fi
+echo "$ac_t""$ol_cv_inet6_addrstrlen" 1>&6
 
-                       LIBS="$save_LIBS"
-               fi
+       if test $ol_cv_inet6_addrstrlen = yes ; then
+               ol_link_ipv6=yes
+       elif test $ol_enable_ipv6 = yes ; then
+               { echo "configure: error: IPv6 support requires INET6_ADDRSTRLEN" 1>&2; exit 1; }
        fi
 fi
 
-if test $ol_with_kerberos = auto -o $ol_with_kerberos = k4 ; then
-       for ac_hdr in krb.h des.h
+if test $ol_enable_local != no ; then
+       for ac_hdr in sys/un.h 
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5469: checking for $ac_hdr" >&5
+echo "configure:5831: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5474 "configure"
+#line 5836 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5502,79 +5864,79 @@ fi
 done
 
 
-       if test $ac_cv_header_krb_h = yes ; then
-               echo $ac_n "checking for main in -lkrb""... $ac_c" 1>&6
-echo "configure:5508: checking for main in -lkrb" >&5
-ac_lib_var=`echo krb'_'main | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+       if test $ol_enable_local = auto ; then
+               ol_enable_local=$ac_cv_header_sys_un_h
+       elif test $ac_cv_header_sys_un_h = no ; then
+               { echo "configure: error: AF_LOCAL domain support requires sys/un.h" 1>&2; exit 1; }
+       fi
+fi
+
+ol_link_kbind=no
+ol_link_kpasswd=no
+ol_link_krb5=no
+ol_link_krb4=no
+
+if test $ol_with_kerberos = yes -o $ol_with_kerberos = auto \
+       -o $ol_with_kerberos = k5 -o $ol_with_kerberos = k5only \
+       -o $ol_with_kerberos = k425 ; then
+
+       for ac_hdr in krb5.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:5888: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lkrb -ldes $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5516 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 5893 "configure"
 #include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:5523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_k4=yes
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
 else
   echo "$ac_t""no" 1>&6
-have_k4=no
-fi
-
-
-               if test $have_k4 = yes ; then
-                       ol_with_kerberos=found
-                       ol_link_kerberos=yes
-
-                       KRB_LIBS="-lkrb -ldes"
-               fi
-       fi
 fi
+done
 
-if test $ol_link_kerberos = yes ; then
-       cat >> confdefs.h <<\EOF
-#define HAVE_KERBEROS 1
-EOF
-
-fi
 
-ol_link_tls=no
-if test $ol_with_tls != no ; then
-       
-       for ac_hdr in openssl/ssl.h ssl.h
+       if test $ac_cv_header_krb5_h = yes ; then
+                               for ac_hdr in heim_err.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5568: checking for $ac_hdr" >&5
+echo "configure:5930: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5573 "configure"
+#line 5935 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5600,29 +5962,30 @@ else
 fi
 done
 
-       
-       if test $ac_cv_header_openssl_ssl_h = yes -o $ac_cv_header_ssl_h = yes ; then
-               echo $ac_n "checking for SSLeay_add_ssl_algorithms in -lssl""... $ac_c" 1>&6
-echo "configure:5607: checking for SSLeay_add_ssl_algorithms in -lssl" >&5
-ac_lib_var=`echo ssl'_'SSLeay_add_ssl_algorithms | sed 'y%./+-:%__p__%'`
+               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 $ac_n "checking for main in -lk5crypto""... $ac_c" 1>&6
+echo "configure:5974: checking for main in -lk5crypto" >&5
+ac_lib_var=`echo k5crypto'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lssl -lcrypto $LIBS"
+LIBS="-lk5crypto  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5615 "configure"
+#line 5982 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char SSLeay_add_ssl_algorithms();
 
 int main() {
-SSLeay_add_ssl_algorithms()
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:5626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5637,36 +6000,30 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_ssleay=yes
-                       need_rsaref=no
+  krb5crypto=k5crypto
 else
   echo "$ac_t""no" 1>&6
-have_ssleay=no
+krb5crypto=crypto
 fi
 
-                       
-               if test $have_ssleay = no ; then
-                       echo $ac_n "checking for SSL_library_init in -lssl""... $ac_c" 1>&6
-echo "configure:5651: checking for SSL_library_init in -lssl" >&5
-ac_lib_var=`echo ssl'_'SSL_library_init | sed 'y%./+-:%__p__%'`
+
+                       echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6
+echo "configure:6012: checking for main in -lkrb5" >&5
+ac_lib_var=`echo krb5'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lssl -lcrypto $LIBS"
+LIBS="-lkrb5 -l$krb5crypto -lcom_err $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5659 "configure"
+#line 6020 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* 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() {
-SSL_library_init()
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:5670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5681,37 +6038,32 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_ssleay=yes
-                               need_rsaref=no
+  have_krb5=yes
+                               KRB5_LIBS="-lkrb5 -l$krb5crypto -lcom_err"
 else
   echo "$ac_t""no" 1>&6
-have_ssleay=no
+have_krb5=no
 fi
 
-               fi
 
-               if test $have_ssleay = no ; then
-                       echo $ac_n "checking for ssl3_accept in -lssl""... $ac_c" 1>&6
-echo "configure:5696: checking for ssl3_accept in -lssl" >&5
-ac_lib_var=`echo ssl'_'ssl3_accept | sed 'y%./+-:%__p__%'`
+               elif test $krb5_impl = heimdal; then
+                       echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6
+echo "configure:6052: checking for main in -lkrb5" >&5
+ac_lib_var=`echo krb5'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lssl -lcrypto -lRSAglue -lrsaref $LIBS"
+LIBS="-lkrb5 -ldes -lasn1 -lroken -lcom_err $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5704 "configure"
+#line 6060 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* 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() {
-ssl3_accept()
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:5715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5726,97 +6078,83 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_ssleay=yes
-                               need_rsaref=yes
+  have_krb5=yes
+                               KRB5_LIBS="-lkrb5 -ldes -lasn1 -lroken -lcom_err"
 else
   echo "$ac_t""no" 1>&6
-have_ssleay=no
+have_krb5=no
 fi
 
-               fi
-
-               if test $have_ssleay = yes ; then
-                       ol_with_tls=found
-                       ol_link_tls=yes
 
                        cat >> confdefs.h <<\EOF
-#define HAVE_SSLEAY 1
+#define HAVE_HEIMDAL_KERBEROS 1
 EOF
 
 
-                       if test $need_rsaref = yes; then
-                               cat >> confdefs.h <<\EOF
-#define HAVE_RSAREF 1
+               else
+                       have_krb5=no
+                       echo "configure: warning: Unrecongized Kerberos V Implementation" 1>&2
+               fi
+
+               if test $have_krb5 = yes ; then
+                       ol_link_krb5=yes
+
+                       cat >> confdefs.h <<\EOF
+#define HAVE_KRB5 1
 EOF
 
 
-                               TLS_LIBS="-lssl -lcrypto -lRSAglue -lrsaref"
-                       else
-                               TLS_LIBS="-lssl -lcrypto"
+                       if test $ol_enable_kpasswd != no ; then
+                               ol_link_kpasswd=yes;
                        fi
+
+                       if test $ol_with_kerberos = k5only ; then
+                               ol_with_kerberos=found
+                       fi
+
+               elif test $ol_with_kerberos != auto ; then
+                       { echo "configure: error: Required Kerberos 5 support not available" 1>&2; exit 1; }
                fi
+
        fi
 fi
 
-if test $ol_link_tls = yes ; then
-       cat >> confdefs.h <<\EOF
-#define HAVE_TLS 1
-EOF
-
-fi     
-
-for ac_func in \
-       ctime_r                 \
-       gethostbyname_r gethostbyaddr_r \
+if test $ol_link_krb5 = yes -a \( $ol_with_kerberos = yes -o \
+       $ol_with_kerberos = auto -o $ol_with_kerberos = k425 \) ; then
 
+       for ac_hdr in kerberosIV/krb.h kerberosIV/des.h
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5775: checking for $ac_func" >&5
-if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:6130: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5780 "configure"
+#line 6135 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* 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();
-char (*f)();
-
-int main() {
-
-/* 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
-f = $ac_func;
-#endif
-
-; return 0; }
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:5804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:6140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
 fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
   cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
+#define $ac_tr_hdr 1
 EOF
  
 else
 done
 
 
-if test "$ac_cv_func_ctime_r" = no ; then
-       ol_cv_func_ctime_r_nargs=0
-else
-       echo $ac_n "checking number of arguments of ctime_r""... $ac_c" 1>&6
-echo "configure:5833: checking number of arguments of ctime_r" >&5
-if eval "test \"\${ol_cv_func_ctime_r_nargs+set}\" = set"; then
+       if test $ac_cv_header_kerberosIV_krb_h = yes ; then
+               if test $krb5_impl = mit; then
+                       echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
+echo "configure:6170: checking for main in -lkrb4" >&5
+ac_lib_var=`echo krb4'_'main | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5838 "configure"
-#include "confdefs.h"
-#include <time.h>
-int main() {
-time_t ti; char *buffer; ctime_r(&ti,buffer,32);
-; return 0; }
-EOF
-if { (eval echo configure:5845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ol_cv_func_ctime_r_nargs=3
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  cat > conftest.$ac_ext <<EOF
-#line 5853 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lkrb4 -ldes425 -lkrb5 -l$krb5crypto -lcom_err $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6178 "configure"
 #include "confdefs.h"
-#include <time.h>
+
 int main() {
-time_t ti; char *buffer; ctime_r(&ti,buffer);
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:5860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_func_ctime_r_nargs=2
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_func_ctime_r_nargs=0
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-rm -f conftest*
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_k425=yes
+                               KRB4_LIBS="-lkrb4 -ldes425"
+else
+  echo "$ac_t""no" 1>&6
+have_k425=no
 fi
 
-echo "$ac_t""$ol_cv_func_ctime_r_nargs" 1>&6
-  if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
-    cat >> confdefs.h <<EOF
-#define CTIME_R_NARGS $ol_cv_func_ctime_r_nargs
-EOF
-
-  fi
-
-fi
 
-if test "$ac_cv_func_gethostbyname_r" = yes ; then
-       echo $ac_n "checking number of arguments of gethostbyname_r""... $ac_c" 1>&6
-echo "configure:5886: checking number of arguments of gethostbyname_r" >&5
-if eval "test \"\${ol_cv_func_gethostbyname_r_nargs+set}\" = set"; then
+               elif test $krb5_impl = heimdal; then
+                       echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
+echo "configure:6210: checking for main in -lkrb4" >&5
+ac_lib_var=`echo krb4'_'main | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5891 "configure"
-#include "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];
-               int bufsize=BUFSIZE;int h_errno;
-               (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
-                       buffer, bufsize, &h_errno);
-; return 0; }
-EOF
-if { (eval echo configure:5905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ol_cv_func_gethostbyname_r_nargs=5
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  cat > conftest.$ac_ext <<EOF
-#line 5913 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lkrb4 -lkrb5 -ldes -lasn1 -lroken -lcom_err $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6218 "configure"
 #include "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];
-                       int bufsize=BUFSIZE;int h_errno;
-                       (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
-                               &rhent, &h_errno);
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:5928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_func_gethostbyname_r_nargs=6
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_func_gethostbyname_r_nargs=0
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-rm -f conftest*
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_k425=yes
+                               KRB4_LIBS="-lkrb4"
+else
+  echo "$ac_t""no" 1>&6
+have_k425=no
 fi
 
-echo "$ac_t""$ol_cv_func_gethostbyname_r_nargs" 1>&6
-  if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
-       cat >> confdefs.h <<EOF
-#define GETHOSTBYNAME_R_NARGS $ol_cv_func_gethostbyname_r_nargs
+
+               else
+                       have_425=no
+                       echo "configure: warning: Unrecongized Kerberos5 Implementation" 1>&2
+               fi
+
+               if test $have_k425 = yes ; then
+                       ol_with_kerberos=found
+                       ol_link_krb4=yes
+
+                       cat >> confdefs.h <<\EOF
+#define HAVE_KRB425 1
 EOF
 
-  fi
+                       cat >> confdefs.h <<\EOF
+#define HAVE_KRB4 1
+EOF
 
-else
-       ol_cv_func_gethostbyname_r_nargs=0
-fi
-if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
-       echo $ac_n "checking number of arguments of gethostbyaddr_r""... $ac_c" 1>&6
-echo "configure:5956: checking number of arguments of gethostbyaddr_r" >&5
-if eval "test \"\${ol_cv_func_gethostbyaddr_r_nargs+set}\" = set"; then
+
+                       echo $ac_n "checking for des_debug in Kerberos libraries""... $ac_c" 1>&6
+echo "configure:6267: checking for des_debug in Kerberos libraries" >&5
+if eval "test \"\${ol_cv_var_des_debug+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5961 "configure"
-#include "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; }
-EOF
-if { (eval echo configure:5977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ol_cv_func_gethostbyaddr_r_nargs=7
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  cat > conftest.$ac_ext <<EOF
-#line 5985 "configure"
+  
+                                                               save_LIBS="$LIBS"
+                               LIBS="$KRB4_LIBS $KRB5_LIBS $LIBS"
+                               cat > conftest.$ac_ext <<EOF
+#line 6275 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#define BUFSIZE (sizeof(struct hostent)+10)
+
+#include <kerberosIV/krb.h>
+#include <kerberosIV/des.h>
+extern int des_debug;
+
 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);
+
+des_debug = 1;
+
 ; return 0; }
 EOF
-if { (eval echo configure:6003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_func_gethostbyaddr_r_nargs=8
+  ol_cv_var_des_debug=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_func_gethostbyaddr_r_nargs=0
-fi
-rm -f conftest*
+  ol_cv_var_des_debug=no
 fi
 rm -f conftest*
+                                                               LIBS="$save_LIBS"
+                       
 fi
 
-echo "$ac_t""$ol_cv_func_gethostbyaddr_r_nargs" 1>&6
-  if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
-    cat >> confdefs.h <<EOF
-#define GETHOSTBYADDR_R_NARGS $ol_cv_func_gethostbyaddr_r_nargs
+echo "$ac_t""$ol_cv_var_des_debug" 1>&6
+
+                       if test $ol_cv_var_des_debug = yes ; then
+                               cat >> confdefs.h <<\EOF
+#define HAVE_DES_DEBUG 1
 EOF
 
-  fi
+                       fi
 
-else
-       ol_cv_func_gethostbyaddr_r_nargs=0
+                       LIBS="$save_LIBS"
+               fi
+       fi
 fi
 
-if test "$ac_cv_func_ctime_r" = yes \
-       -a "$ol_cv_func_ctime_r_nargs" -ge 2 \
-       -a "$ol_cv_func_ctime_r_nargs" -le 3 \
-       -a "$ac_cv_func_gethostbyname_r" = yes \
-       -a "$ol_cv_func_gethostbyname_r_nargs" -ge 5 \
-       -a "$ol_cv_func_gethostbyname_r_nargs" -le 6 \
-       -a "$ac_cv_func_gethostbyaddr_r" = yes \
-       -a "$ol_cv_func_gethostbyaddr_r_nargs" -ge 5 \
-       -a "$ol_cv_func_gethostbyaddr_r_nargs" -le 6 \
-       ; then
-       cat >> confdefs.h <<\EOF
-#define LDAP_API_FEATURE_X_OPENLDAP_REENTRANT 1
-EOF
-
+if test $ol_link_krb5 = yes ; then
+       ol_with_kerberos=found
 fi
 
-ol_link_threads=no
-if test $ol_with_threads = auto -o $ol_with_threads = yes \
-       -o $ol_with_threads = posix ; then
+if test $ol_with_kerberos = yes -o $ol_with_kerberos = auto \
+       -o $ol_with_kerberos = k4 -o $ol_with_kerberos = kth ; then
 
-       for ac_hdr in pthread.h
+       for ac_hdr in krb.h des.h krb-archaeology.h 
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6054: checking for $ac_hdr" >&5
+echo "configure:6327: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6059 "configure"
+#line 6332 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6337: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 done
 
 
-       if test $ac_cv_header_pthread_h = yes ; then
-               echo $ac_n "checking POSIX thread version""... $ac_c" 1>&6
-echo "configure:6093: checking POSIX thread version" >&5
-if eval "test \"\${ol_cv_pthread_version+set}\" = set"; then
+       if test $ac_cv_header_krb_h = yes ; then
+               echo $ac_n "checking for main in -lkrb""... $ac_c" 1>&6
+echo "configure:6366: checking for main in -lkrb" >&5
+ac_lib_var=`echo krb'_'main | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  
-       cat > conftest.$ac_ext <<EOF
-#line 6099 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lkrb -ldes $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6374 "configure"
 #include "confdefs.h"
 
-#              include <pthread.h>
-               /* this check could be improved */
-#              ifdef PTHREAD_ONCE_INIT
-                       pthread_version_final
-#              endif
-       
+int main() {
+main()
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pthread_version_final" >/dev/null 2>&1; then
+if { (eval echo configure:6381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_pthread_final=yes
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_k4=yes
+else
+  echo "$ac_t""no" 1>&6
+have_k4=no
+fi
+
+
+               if test $have_k4 = yes ; then
+                       ol_with_kerberos=found
+                       ol_link_krb4=yes
+
+                       cat >> confdefs.h <<\EOF
+#define HAVE_KRB4 1
+EOF
+
+
+                       KRB4_LIBS="-lkrb -ldes"
+
+                       if test $ac_cv_header_krb_archaeology_h = yes ; then
+                               cat >> confdefs.h <<\EOF
+#define HAVE_KTH_KERBEROS 1
+EOF
+
+                       fi
+               fi
+       fi
+fi
+
+if test $ol_link_krb4 = yes -a $ol_enable_kpasswd != no ; then
+       ol_link_kpasswd=yes
+fi
+
+if test $ol_link_krb4 = yes -a $ol_enable_kbind != no ; then
+       ol_link_kbind=yes
+
+elif test $ol_enable_kbind = yes ; then
+       { echo "configure: error: Kerberos IV detection failed" 1>&2; exit 1; }
+fi
+
+if test $ol_link_krb4 = yes -o $ol_link_krb5 = yes ; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_KERBEROS 1
+EOF
+
+
+elif test $ol_with_kerberos != auto -a $ol_with_kerberos != no ; then
+       { echo "configure: error: Kerberos detection failed" 1>&2; exit 1; }
+fi
+
+ol_link_tls=no
+if test $ol_with_tls != no ; then
+       for ac_hdr in openssl/ssl.h ssl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:6451: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6456 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:6461: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+       
+       if test $ac_cv_header_openssl_ssl_h = yes -o $ac_cv_header_ssl_h = yes ; then
+               echo $ac_n "checking for SSLeay_add_ssl_algorithms in -lssl""... $ac_c" 1>&6
+echo "configure:6490: checking for SSLeay_add_ssl_algorithms in -lssl" >&5
+ac_lib_var=`echo ssl'_'SSLeay_add_ssl_algorithms | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lssl -lcrypto $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6498 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char SSLeay_add_ssl_algorithms();
+
+int main() {
+SSLeay_add_ssl_algorithms()
+; return 0; }
+EOF
+if { (eval echo configure:6509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_ssleay=yes
+                       need_rsaref=no
+else
+  echo "$ac_t""no" 1>&6
+have_ssleay=no
+fi
+
+                       
+               if test $have_ssleay = no ; then
+                       echo $ac_n "checking for SSL_library_init in -lssl""... $ac_c" 1>&6
+echo "configure:6534: checking for SSL_library_init in -lssl" >&5
+ac_lib_var=`echo ssl'_'SSL_library_init | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lssl -lcrypto $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6542 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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() {
+SSL_library_init()
+; return 0; }
+EOF
+if { (eval echo configure:6553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_ssleay=yes
+                               need_rsaref=no
+else
+  echo "$ac_t""no" 1>&6
+have_ssleay=no
+fi
+
+               fi
+
+               if test $have_ssleay = no ; then
+                       echo $ac_n "checking for ssl3_accept in -lssl""... $ac_c" 1>&6
+echo "configure:6579: checking for ssl3_accept in -lssl" >&5
+ac_lib_var=`echo ssl'_'ssl3_accept | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lssl -lcrypto -lRSAglue -lrsaref $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6587 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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() {
+ssl3_accept()
+; return 0; }
+EOF
+if { (eval echo configure:6598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_ssleay=yes
+                               need_rsaref=yes
+else
+  echo "$ac_t""no" 1>&6
+have_ssleay=no
+fi
+
+               fi
+
+               if test $have_ssleay = yes ; then
+                       ol_with_tls=found
+                       ol_link_tls=yes
+
+                       cat >> confdefs.h <<\EOF
+#define HAVE_SSLEAY 1
+EOF
+
+
+                       if test $need_rsaref = yes; then
+                               cat >> confdefs.h <<\EOF
+#define HAVE_RSAREF 1
+EOF
+
+
+                               TLS_LIBS="-lssl -lcrypto -lRSAglue -lrsaref"
+                       else
+                               TLS_LIBS="-lssl -lcrypto"
+                       fi
+               fi
+       fi
+
+else
+       echo "configure: warning: TLS privacy protection not supported!" 1>&2
+fi
+
+if test $ol_link_tls = yes ; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_TLS 1
+EOF
+
+
+elif test $ol_with_tls = auto ; then
+       echo "configure: warning: Could not locate TLS/SSL package" 1>&2
+       echo "configure: warning: TLS privacy protection not supported!" 1>&2
+
+elif test $ol_with_tls != no ; then
+       { echo "configure: error: Could not locate TLS/SSL package" 1>&2; exit 1; }
+fi
+
+for ac_func in \
+       ctime_r                 \
+       gethostbyname_r gethostbyaddr_r \
+
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6668: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6673 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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();
+char (*f)();
+
+int main() {
+
+/* 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
+f = $ac_func;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+if test "$ac_cv_func_ctime_r" = no ; then
+       ol_cv_func_ctime_r_nargs=0
+else
+       echo $ac_n "checking number of arguments of ctime_r""... $ac_c" 1>&6
+echo "configure:6726: checking number of arguments of ctime_r" >&5
+if eval "test \"\${ol_cv_func_ctime_r_nargs+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6731 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+time_t ti; char *buffer; ctime_r(&ti,buffer,32);
+; return 0; }
+EOF
+if { (eval echo configure:6738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_func_ctime_r_nargs3=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_func_ctime_r_nargs3=no
+fi
+rm -f conftest*
+
+       cat > conftest.$ac_ext <<EOF
+#line 6750 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+time_t ti; char *buffer; ctime_r(&ti,buffer);
+; return 0; }
+EOF
+if { (eval echo configure:6757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_func_ctime_r_nargs2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_func_ctime_r_nargs2=no
+fi
+rm -f conftest*
+
+       if test $ol_cv_func_ctime_r_nargs3 = yes -a \
+               $ol_cv_func_ctime_r_nargs2 = no ; then
+
+               ol_cv_func_ctime_r_nargs=3
+
+       elif test $ol_cv_func_ctime_r_nargs3 = no -a \
+               $ol_cv_func_ctime_r_nargs2 = yes ; then
+
+               ol_cv_func_ctime_r_nargs=2
+
+       else
+               ol_cv_func_ctime_r_nargs=0
+       fi
+  
+fi
+
+echo "$ac_t""$ol_cv_func_ctime_r_nargs" 1>&6
+
+  if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
+       cat >> confdefs.h <<EOF
+#define CTIME_R_NARGS $ol_cv_func_ctime_r_nargs
+EOF
+
+  fi
+
+fi
+
+if test "$ac_cv_func_gethostbyname_r" = yes ; then
+       echo $ac_n "checking number of arguments of gethostbyname_r""... $ac_c" 1>&6
+echo "configure:6797: checking number of arguments of gethostbyname_r" >&5
+if eval "test \"\${ol_cv_func_gethostbyname_r_nargs+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6802 "configure"
+#include "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];
+               int bufsize=BUFSIZE;int h_errno;
+               (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
+                       buffer, bufsize, &h_errno);
+; return 0; }
+EOF
+if { (eval echo configure:6816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_func_gethostbyname_r_nargs5=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_func_gethostbyname_r_nargs5=no
+fi
+rm -f conftest*
+
+       cat > conftest.$ac_ext <<EOF
+#line 6828 "configure"
+#include "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];
+               int bufsize=BUFSIZE;int h_errno;
+               (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
+                       &rhent, &h_errno);
+; return 0; }
+EOF
+if { (eval echo configure:6843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_func_gethostbyname_r_nargs6=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_func_gethostbyname_r_nargs6=no
+fi
+rm -f conftest*
+
+       if test $ol_cv_func_gethostbyname_r_nargs5 = yes -a \
+               $ol_cv_func_gethostbyname_r_nargs6 = no ; then
+
+               ol_cv_func_gethostbyname_r_nargs=5
+
+       elif test $ol_cv_func_gethostbyname_r_nargs5 = no -a \
+               $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 "$ac_t""$ol_cv_func_gethostbyname_r_nargs" 1>&6
+  if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
+       cat >> confdefs.h <<EOF
+#define GETHOSTBYNAME_R_NARGS $ol_cv_func_gethostbyname_r_nargs
+EOF
+
+  fi
+
+else
+       ol_cv_func_gethostbyname_r_nargs=0
+fi
+if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
+       echo $ac_n "checking number of arguments of gethostbyaddr_r""... $ac_c" 1>&6
+echo "configure:6884: checking number of arguments of gethostbyaddr_r" >&5
+if eval "test \"\${ol_cv_func_gethostbyaddr_r_nargs+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6889 "configure"
+#include "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; }
+EOF
+if { (eval echo configure:6905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_func_gethostbyaddr_r_nargs7=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_func_gethostbyaddr_r_nargs7=no
+fi
+rm -f conftest*
+
+       cat > conftest.$ac_ext <<EOF
+#line 6917 "configure"
+#include "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; }
+EOF
+if { (eval echo configure:6935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_func_gethostbyaddr_r_nargs8=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_func_gethostbyaddr_r_nargs8=no
+fi
+rm -f conftest*
+
+       if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes -a \
+               $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
+
+               ol_cv_func_gethostbyaddr_r_nargs=7
+
+       elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no -a \
+               $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
+
+               ol_cv_func_gethostbyaddr_r_nargs=8
+
+       else
+               ol_cv_func_gethostbyaddr_r_nargs=0
+       fi
+  
+fi
+
+echo "$ac_t""$ol_cv_func_gethostbyaddr_r_nargs" 1>&6
+  if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
+    cat >> confdefs.h <<EOF
+#define GETHOSTBYADDR_R_NARGS $ol_cv_func_gethostbyaddr_r_nargs
+EOF
+
+  fi
+
+else
+       ol_cv_func_gethostbyaddr_r_nargs=0
+fi
+
+if test "$ac_cv_func_ctime_r" = yes \
+       -a "$ol_cv_func_ctime_r_nargs" -ge 2 \
+       -a "$ol_cv_func_ctime_r_nargs" -le 3 \
+       -a "$ac_cv_func_gethostbyname_r" = yes \
+       -a "$ol_cv_func_gethostbyname_r_nargs" -ge 5 \
+       -a "$ol_cv_func_gethostbyname_r_nargs" -le 6 \
+       -a "$ac_cv_func_gethostbyaddr_r" = yes \
+       -a "$ol_cv_func_gethostbyaddr_r_nargs" -ge 5 \
+       -a "$ol_cv_func_gethostbyaddr_r_nargs" -le 6 \
+       ; then
+       cat >> confdefs.h <<\EOF
+#define LDAP_API_FEATURE_X_OPENLDAP_REENTRANT 1
+EOF
+
+fi
+
+ol_link_threads=no
+
+if test $ol_with_threads = auto -o $ol_with_threads = yes \
+       -o $ol_with_threads = nt ; then
+
+       
+       echo $ac_n "checking for _beginthread""... $ac_c" 1>&6
+echo "configure:6998: checking for _beginthread" >&5
+if eval "test \"\${ac_cv_func__beginthread+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7003 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _beginthread(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char _beginthread();
+char (*f)();
+
+int main() {
+
+/* 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
+f = _beginthread;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:7027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func__beginthread=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func__beginthread=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_beginthread`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+       if test $ac_cv_func__beginthread = yes ; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_NT_THREADS 1
+EOF
+
+       fi
+
+
+       if test "$ol_cv_nt_threads" = yes ; then
+       ol_link_threads=nt
+       ol_with_threads=found
+       ol_with_yielding_select=yes
+
+               cat >> confdefs.h <<\EOF
+#define HAVE_NT_SERVICE_MANAGER 1
+EOF
+
+               cat >> confdefs.h <<\EOF
+#define HAVE_NT_EVENT_LOG 1
+EOF
+
+       fi
+
+       if test $ol_with_threads = nt ; then
+               { echo "configure: error: could not locate NT Threads" 1>&2; exit 1; }
+       fi
+fi
+
+if test $ol_with_threads = auto -o $ol_with_threads = yes \
+       -o $ol_with_threads = posix ; then
+
+       for ac_hdr in pthread.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:7082: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7087 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+       if test $ac_cv_header_pthread_h = yes ; then
+               echo $ac_n "checking POSIX thread version""... $ac_c" 1>&6
+echo "configure:7121: checking POSIX thread version" >&5
+if eval "test \"\${ol_cv_pthread_version+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       cat > conftest.$ac_ext <<EOF
+#line 7127 "configure"
+#include "confdefs.h"
+
+#              include <pthread.h>
+               /* this check could be improved */
+#              ifdef PTHREAD_ONCE_INIT
+                       pthread_version_final;
+#              endif
+       
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "pthread_version_final" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ol_pthread_final=yes
 else
   rm -rf conftest*
   ol_pthread_final=no
@@ -6117,13 +7145,13 @@ rm -f conftest*
 
 
        cat > conftest.$ac_ext <<EOF
-#line 6121 "configure"
+#line 7149 "configure"
 #include "confdefs.h"
 
 #              include <pthread.h>
                /* this check could be improved */
 #              ifdef pthread_once_init
-                       pthread_version_draft4
+                       pthread_version_draft4;
 #              endif
        
 EOF
@@ -6170,12 +7198,12 @@ EOF
 
                
        echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:6174: checking for LinuxThreads pthread.h" >&5
+echo "configure:7202: checking for LinuxThreads pthread.h" >&5
 if eval "test \"\${ol_cv_header_linux_threads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6179 "configure"
+#line 7207 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 EOF
@@ -6202,16 +7230,16 @@ EOF
 
                
        echo $ac_n "checking for GNU Pth pthread.h""... $ac_c" 1>&6
-echo "configure:6206: checking for GNU Pth pthread.h" >&5
+echo "configure:7234: checking for GNU Pth pthread.h" >&5
 if eval "test \"\${ol_cv_header_gnu_pth_pthread_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6211 "configure"
+#line 7239 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 #ifdef _POSIX_THREAD_IS_GNU_PTH
-       __gnu_pth__
+       __gnu_pth__;
 #endif
 
 EOF
@@ -6236,17 +7264,17 @@ echo "$ac_t""$ol_cv_header_gnu_pth_pthread_h" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6240: checking for $ac_hdr" >&5
+echo "configure:7268: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6245 "configure"
+#line 7273 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7278: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6276,14 +7304,14 @@ done
 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                echo $ac_n "checking for pthread_create in default libraries""... $ac_c" 1>&6
-echo "configure:6280: checking for pthread_create in default libraries" >&5
+echo "configure:7308: checking for pthread_create in default libraries" >&5
 if eval "test \"\${ol_cv_pthread_create+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 6287 "configure"
+#line 7315 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6302,32 +7330,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_create=yes
 else
@@ -6339,7 +7404,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 6343 "configure"
+#line 7408 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6362,33 +7427,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:6392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_create=yes
 else
@@ -6413,7 +7515,7 @@ echo "$ac_t""$ol_cv_pthread_create" 1>&6
 if test "$ol_link_threads" = no ; then
        # try -kthread
        echo $ac_n "checking for pthread link with -kthread""... $ac_c" 1>&6
-echo "configure:6417: checking for pthread link with -kthread" >&5
+echo "configure:7519: checking for pthread link with -kthread" >&5
 if eval "test \"\${ol_cv_pthread_kthread+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6424,7 +7526,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 6428 "configure"
+#line 7530 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6443,32 +7545,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_kthread=yes
 else
@@ -6480,7 +7619,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 6484 "configure"
+#line 7623 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6503,33 +7642,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:6533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_kthread=yes
 else
@@ -6559,7 +7735,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -pthread
        echo $ac_n "checking for pthread link with -pthread""... $ac_c" 1>&6
-echo "configure:6563: checking for pthread link with -pthread" >&5
+echo "configure:7739: checking for pthread link with -pthread" >&5
 if eval "test \"\${ol_cv_pthread_pthread+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6570,7 +7746,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 6574 "configure"
+#line 7750 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6589,32 +7765,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_pthread=yes
 else
@@ -6626,7 +7839,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 6630 "configure"
+#line 7843 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6649,33 +7862,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:6679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_pthread=yes
 else
@@ -6705,7 +7955,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -pthreads
        echo $ac_n "checking for pthread link with -pthreads""... $ac_c" 1>&6
-echo "configure:6709: checking for pthread link with -pthreads" >&5
+echo "configure:7959: checking for pthread link with -pthreads" >&5
 if eval "test \"\${ol_cv_pthread_pthreads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6716,7 +7966,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 6720 "configure"
+#line 7970 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6735,32 +7985,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_pthreads=yes
 else
@@ -6772,7 +8059,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 6776 "configure"
+#line 8063 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6795,33 +8082,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:6825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_pthreads=yes
 else
@@ -6851,7 +8175,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -mthreads
        echo $ac_n "checking for pthread link with -mthreads""... $ac_c" 1>&6
-echo "configure:6855: checking for pthread link with -mthreads" >&5
+echo "configure:8179: checking for pthread link with -mthreads" >&5
 if eval "test \"\${ol_cv_pthread_mthreads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6862,7 +8186,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 6866 "configure"
+#line 8190 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6881,32 +8205,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_mthreads=yes
 else
@@ -6918,7 +8279,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 6922 "configure"
+#line 8283 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -6941,33 +8302,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:6971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_mthreads=yes
 else
@@ -6997,7 +8395,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -thread
        echo $ac_n "checking for pthread link with -thread""... $ac_c" 1>&6
-echo "configure:7001: checking for pthread link with -thread" >&5
+echo "configure:8399: checking for pthread link with -thread" >&5
 if eval "test \"\${ol_cv_pthread_thread+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7008,7 +8406,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 7012 "configure"
+#line 8410 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7027,32 +8425,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:7056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_thread=yes
 else
@@ -7064,7 +8499,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 7068 "configure"
+#line 8503 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7087,33 +8522,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:7117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_thread=yes
 else
@@ -7144,7 +8616,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthread -lmach -lexc -lc_r
        echo $ac_n "checking for pthread link with -lpthread -lmach -lexc -lc_r""... $ac_c" 1>&6
-echo "configure:7148: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
+echo "configure:8620: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
 if eval "test \"\${ol_cv_pthread_lpthread_lmach_lexc_lc_r+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7155,7 +8627,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 7159 "configure"
+#line 8631 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7174,32 +8646,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:7203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
 else
@@ -7211,7 +8720,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 7215 "configure"
+#line 8724 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7234,33 +8743,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:7264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
 else
@@ -7290,7 +8836,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthread -lmach -lexc
        echo $ac_n "checking for pthread link with -lpthread -lmach -lexc""... $ac_c" 1>&6
-echo "configure:7294: checking for pthread link with -lpthread -lmach -lexc" >&5
+echo "configure:8840: checking for pthread link with -lpthread -lmach -lexc" >&5
 if eval "test \"\${ol_cv_pthread_lpthread_lmach_lexc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7301,7 +8847,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 7305 "configure"
+#line 8851 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7320,32 +8866,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:7349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lpthread_lmach_lexc=yes
 else
@@ -7357,7 +8940,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 7361 "configure"
+#line 8944 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7380,33 +8963,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:7410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lpthread_lmach_lexc=yes
 else
@@ -7437,7 +9057,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthread -Wl,-woff,85
        echo $ac_n "checking for pthread link with -lpthread -Wl,-woff,85""... $ac_c" 1>&6
-echo "configure:7441: checking for pthread link with -lpthread -Wl,-woff,85" >&5
+echo "configure:9061: checking for pthread link with -lpthread -Wl,-woff,85" >&5
 if eval "test \"\${ol_cv_pthread_lib_lpthread_woff+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7448,7 +9068,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 7452 "configure"
+#line 9072 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7467,32 +9087,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:7496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lib_lpthread_woff=yes
 else
@@ -7504,7 +9161,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 7508 "configure"
+#line 9165 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7527,33 +9184,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:7557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lib_lpthread_woff=yes
 else
@@ -7584,7 +9278,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthread
        echo $ac_n "checking for pthread link with -lpthread""... $ac_c" 1>&6
-echo "configure:7588: checking for pthread link with -lpthread" >&5
+echo "configure:9282: checking for pthread link with -lpthread" >&5
 if eval "test \"\${ol_cv_pthread_lpthread+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7595,7 +9289,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 7599 "configure"
+#line 9293 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7614,32 +9308,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:7643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lpthread=yes
 else
@@ -7651,7 +9382,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 7655 "configure"
+#line 9386 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7674,33 +9405,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
 #endif
 
-       if( status ) exit( status );
+#else
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
-#else
-       status = pthread_detach( t );
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:7704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lpthread=yes
 else
@@ -7730,7 +9498,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lc_r
        echo $ac_n "checking for pthread link with -lc_r""... $ac_c" 1>&6
-echo "configure:7734: checking for pthread link with -lc_r" >&5
+echo "configure:9502: checking for pthread link with -lc_r" >&5
 if eval "test \"\${ol_cv_pthread_lc_r+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7741,7 +9509,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 7745 "configure"
+#line 9513 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7760,32 +9528,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:7789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lc_r=yes
 else
@@ -7797,7 +9602,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 7801 "configure"
+#line 9606 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7820,33 +9625,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:7850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lc_r=yes
 else
@@ -7877,7 +9719,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -threads
        echo $ac_n "checking for pthread link with -threads""... $ac_c" 1>&6
-echo "configure:7881: checking for pthread link with -threads" >&5
+echo "configure:9723: checking for pthread link with -threads" >&5
 if eval "test \"\${ol_cv_pthread_threads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7888,7 +9730,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 7892 "configure"
+#line 9734 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7907,32 +9749,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:7936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_threads=yes
 else
@@ -7944,7 +9823,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 7948 "configure"
+#line 9827 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -7967,33 +9846,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:7997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_threads=yes
 else
@@ -8024,7 +9940,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthreads -lmach -lexc -lc_r
        echo $ac_n "checking for pthread link with -lpthreads -lmach -lexc -lc_r""... $ac_c" 1>&6
-echo "configure:8028: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
+echo "configure:9944: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
 if eval "test \"\${ol_cv_pthread_lpthreads_lmach_lexc_lc_r+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8035,7 +9951,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 8039 "configure"
+#line 9955 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8054,32 +9970,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
 else
@@ -8091,7 +10044,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 8095 "configure"
+#line 10048 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8114,33 +10067,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:8144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
 else
@@ -8170,7 +10160,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthreads -lmach -lexc
        echo $ac_n "checking for pthread link with -lpthreads -lmach -lexc""... $ac_c" 1>&6
-echo "configure:8174: checking for pthread link with -lpthreads -lmach -lexc" >&5
+echo "configure:10164: checking for pthread link with -lpthreads -lmach -lexc" >&5
 if eval "test \"\${ol_cv_pthread_lpthreads_lmach_lexc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8181,7 +10171,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 8185 "configure"
+#line 10175 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8200,32 +10190,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lpthreads_lmach_lexc=yes
 else
@@ -8237,7 +10264,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 8241 "configure"
+#line 10268 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8260,33 +10287,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:8290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lpthreads_lmach_lexc=yes
 else
@@ -8316,7 +10380,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthreads -lexc
        echo $ac_n "checking for pthread link with -lpthreads -lexc""... $ac_c" 1>&6
-echo "configure:8320: checking for pthread link with -lpthreads -lexc" >&5
+echo "configure:10384: checking for pthread link with -lpthreads -lexc" >&5
 if eval "test \"\${ol_cv_pthread_lpthreads_lexc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8327,7 +10391,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 8331 "configure"
+#line 10395 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8346,32 +10410,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lpthreads_lexc=yes
 else
@@ -8383,7 +10484,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 8387 "configure"
+#line 10488 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8406,33 +10507,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:8436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lpthreads_lexc=yes
 else
@@ -8463,7 +10601,7 @@ fi
 if test "$ol_link_threads" = no ; then
        # try -lpthreads
        echo $ac_n "checking for pthread link with -lpthreads""... $ac_c" 1>&6
-echo "configure:8467: checking for pthread link with -lpthreads" >&5
+echo "configure:10605: checking for pthread link with -lpthreads" >&5
 if eval "test \"\${ol_cv_pthread_lib_lpthreads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8474,7 +10612,7 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 8478 "configure"
+#line 10616 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8493,32 +10631,69 @@ int main() {
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
 #endif
 
-       if( status ) exit( status );
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lib_lpthreads=yes
 else
@@ -8530,7 +10705,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 8534 "configure"
+#line 10709 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -8553,33 +10728,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:8583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_lib_lpthreads=yes
 else
@@ -8621,12 +10833,12 @@ EOF
                                                                                                for ac_func in sched_yield pthread_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8625: checking for $ac_func" >&5
+echo "configure:10837: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8630 "configure"
+#line 10842 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8650,7 +10862,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8678,7 +10890,7 @@ done
                        if test $ac_cv_func_sched_yield = no -a \
                                $ac_cv_func_pthread_yield = no ; then
                                                                echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:8682: checking for sched_yield in -lrt" >&5
+echo "configure:10894: checking for sched_yield in -lrt" >&5
 ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -8686,7 +10898,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8690 "configure"
+#line 10902 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -8697,7 +10909,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:8701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
                                                                                                for ac_func in thr_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8733: checking for $ac_func" >&5
+echo "configure:10945: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8738 "configure"
+#line 10950 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8758,7 +10970,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8789,15 +11001,15 @@ done
                                echo "configure: warning: could not locate sched_yield() or pthread_yield()" 1>&2
                        fi
 
-                                               for ac_func in pthread_kill
+                                               for ac_func in pthread_kill pthread_rwlock_destroy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8796: checking for $ac_func" >&5
+echo "configure:11008: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8801 "configure"
+#line 11013 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8821,7 +11033,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8847,13 +11059,13 @@ done
 
 
                                                                        echo $ac_n "checking for pthread_detach with <pthread.h>""... $ac_c" 1>&6
-echo "configure:8851: checking for pthread_detach with <pthread.h>" >&5
+echo "configure:11063: checking for pthread_detach with <pthread.h>" >&5
 if eval "test \"\${ol_cv_func_pthread_detach+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                                                                cat > conftest.$ac_ext <<EOF
-#line 8857 "configure"
+#line 11069 "configure"
 #include "confdefs.h"
 
 #include <pthread.h>
@@ -8865,7 +11077,7 @@ int main() {
 pthread_detach(NULL);
 ; return 0; }
 EOF
-if { (eval echo configure:8869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_func_pthread_detach=yes
 else
@@ -8897,12 +11109,12 @@ EOF
                        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8901: checking for $ac_func" >&5
+echo "configure:11113: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8906 "configure"
+#line 11118 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8926,7 +11138,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8952,21 +11164,23 @@ done
 
 
                        
-       echo $ac_n "checking for pthread_kill_other_threads_np""... $ac_c" 1>&6
-echo "configure:8957: checking for pthread_kill_other_threads_np" >&5
-if eval "test \"\${ac_cv_func_pthread_kill_other_threads_np+set}\" = set"; then
+       for ac_func in pthread_kill_other_threads_np
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11171: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8962 "configure"
+#line 11176 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char pthread_kill_other_threads_np(); below.  */
+    which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char pthread_kill_other_threads_np();
+char $ac_func();
 char (*f)();
 
 int main() {
@@ -8974,35 +11188,40 @@ int main() {
 /* 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_pthread_kill_other_threads_np) || defined (__stub___pthread_kill_other_threads_np)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-f = pthread_kill_other_threads_np;
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:8986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_pthread_kill_other_threads_np=yes"
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_pthread_kill_other_threads_np=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'pthread_kill_other_threads_np`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  :
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
 else
   echo "$ac_t""no" 1>&6
 fi
+done
 
        echo $ac_n "checking for LinuxThreads implementation""... $ac_c" 1>&6
-echo "configure:9006: checking for LinuxThreads implementation" >&5
+echo "configure:11225: checking for LinuxThreads implementation" >&5
 if eval "test \"\${ol_cv_sys_linux_threads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9015,7 +11234,7 @@ echo "$ac_t""$ol_cv_sys_linux_threads" 1>&6
        
        
        echo $ac_n "checking for LinuxThreads consistency""... $ac_c" 1>&6
-echo "configure:9019: checking for LinuxThreads consistency" >&5
+echo "configure:11238: checking for LinuxThreads consistency" >&5
 if eval "test \"\${ol_cv_linux_threads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9040,7 +11259,7 @@ echo "$ac_t""$ol_cv_linux_threads" 1>&6
                        fi
 
                        echo $ac_n "checking if pthread_create() works""... $ac_c" 1>&6
-echo "configure:9044: checking if pthread_create() works" >&5
+echo "configure:11263: checking if pthread_create() works" >&5
 if eval "test \"\${ol_cv_pthread_create_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9049,7 +11268,7 @@ else
                                ol_cv_pthread_create_works=yes
 else
   cat > conftest.$ac_ext <<EOF
-#line 9053 "configure"
+#line 11272 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
@@ -9072,33 +11291,70 @@ int main(argc, argv)
        /* pthread test function */
        pthread_t t;
        int status;
+       int detach = 1;
 
-       /* make sure pthread_create() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_create(&t, pthread_attr_default, task, NULL);
+#ifdef HAVE_PTHREADS_FINAL
+       /* Final pthreads */
+       pthread_attr_t attr;
+
+       status = pthread_attr_init(&attr);
+       if( status ) return status;
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_create(&t, NULL, task, NULL);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
 
-       if( status ) exit( status );
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
+       if( status ) return status;
+#endif
+
+       status = pthread_create( &t, &attr, task, NULL );
+       if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
 
-       /* make sure pthread_detach() isn't just a stub */
-#if HAVE_PTHREADS_D4
-       status = pthread_detach( &t );
 #else
-       status = pthread_detach( t );
+       /* Draft 4 pthreads */
+       status = pthread_create( &t, pthread_attr_default, task, NULL );
+       if( status ) return status;
+
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
        pthread_kill_other_threads_np();
 #endif
 
-       exit( status );
+       return 0;
 
 }
 
 EOF
-if { (eval echo configure:9102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_create_works=yes
 else
@@ -9120,7 +11376,7 @@ echo "$ac_t""$ol_cv_pthread_create_works" 1>&6
 
                                                if test $ol_with_yielding_select = auto ; then
                                echo $ac_n "checking if select yields when using pthreads""... $ac_c" 1>&6
-echo "configure:9124: checking if select yields when using pthreads" >&5
+echo "configure:11380: checking if select yields when using pthreads" >&5
 if eval "test \"\${ol_cv_pthread_select_yields+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9129,7 +11385,7 @@ else
   ol_cv_pthread_select_yields=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 9133 "configure"
+#line 11389 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9205,7 +11461,7 @@ int main(argc, argv)
        exit(2);
 }
 EOF
-if { (eval echo configure:9209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_pthread_select_yields=no
 else
@@ -9233,7 +11489,7 @@ echo "$ac_t""$ol_cv_pthread_select_yields" 1>&6
                                                CPPFLAGS="$save_CPPFLAGS"
                        LIBS="$save_LIBS"
                else
-                       { echo "configure: error: could not link with POSIX Threads" 1>&2; exit 1; }
+                       { echo "configure: error: could not locate usable POSIX Threads" 1>&2; exit 1; }
                fi
        fi
 
 if test $ol_with_threads = auto -o $ol_with_threads = yes \
        -o $ol_with_threads = mach ; then
 
-               for ac_hdr in mach/cthreads.h
+               for ac_hdr in mach/cthreads.h cthread.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9253: checking for $ac_hdr" >&5
+echo "configure:11509: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9258 "configure"
+#line 11514 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9289,12 +11545,12 @@ done
                ol_with_threads=found
 
                                echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:9293: checking for cthread_fork" >&5
+echo "configure:11549: checking for cthread_fork" >&5
 if eval "test \"\${ac_cv_func_cthread_fork+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9298 "configure"
+#line 11554 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char cthread_fork(); below.  */
@@ -9318,7 +11574,7 @@ f = cthread_fork;
 
 ; return 0; }
 EOF
-if { (eval echo configure:9322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_cthread_fork=yes"
 else
@@ -9340,7 +11596,7 @@ fi
 
                if test $ol_link_threads = no ; then
                                                                        echo $ac_n "checking for cthread_fork with -all_load""... $ac_c" 1>&6
-echo "configure:9344: checking for cthread_fork with -all_load" >&5
+echo "configure:11600: checking for cthread_fork with -all_load" >&5
 if eval "test \"\${ol_cv_cthread_all_load+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9348,7 +11604,7 @@ else
                                                                save_LIBS="$LIBS"
                                LIBS="-all_load $LIBS"
                                cat > conftest.$ac_ext <<EOF
-#line 9352 "configure"
+#line 11608 "configure"
 #include "confdefs.h"
 #include <mach/cthreads.h>
 int main() {
@@ -9357,7 +11613,7 @@ int main() {
                                        
 ; return 0; }
 EOF
-if { (eval echo configure:9361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_cthread_all_load=yes
 else
@@ -9379,20 +11635,82 @@ echo "$ac_t""$ol_cv_cthread_all_load" 1>&6
                        fi
                fi
 
-               if test $ol_link_threads != no ; then
-                       : check for cthread specific functionality here
-                       cat >> confdefs.h <<\EOF
-#define HAVE_MACH_CTHREADS 1
-EOF
+    elif test $ac_cv_header_cthreads_h = yes ; then
+                               
+               ol_with_threads=found
+                               save_LIBS="$LIBS"
+               LIBS="$LIBS -lthreads"
+               echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
+echo "configure:11646: checking for cthread_fork" >&5
+if eval "test \"\${ac_cv_func_cthread_fork+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11651 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char cthread_fork(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char cthread_fork();
+char (*f)();
+
+int main() {
+
+/* 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_cthread_fork) || defined (__stub___cthread_fork)
+choke me
+#else
+f = cthread_fork;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_cthread_fork=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_cthread_fork=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'cthread_fork`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  ol_link_threads=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+               LIBS="$save_LIBS"
 
+               if test $ol_link_threads = yes ; then
+                       LTHREAD_LIBS="-lthreads"
+                       ol_link_threads=mach
                else
                        { echo "configure: error: could not link with Mach CThreads" 1>&2; exit 1; }
                fi
-       fi
 
-       if test $ol_with_threads = mach ; then
+       elif test $ol_with_threads = mach ; then
                { echo "configure: error: could not locate Mach CThreads" 1>&2; exit 1; }
        fi
+
+       if test $ol_link_threads = mach ; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_MACH_CTHREADS 1
+EOF
+
+       elif test $ol_with_threads = found ; then
+               { echo "configure: error: could not link with Mach CThreads" 1>&2; exit 1; }
+       fi
 fi
 
 if test $ol_with_threads = auto -o $ol_with_threads = yes \
@@ -9402,17 +11720,17 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9406: checking for $ac_hdr" >&5
+echo "configure:11724: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9411 "configure"
+#line 11729 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9441,7 +11759,7 @@ done
 
        if test $ac_cv_header_pth_h = yes ; then
                echo $ac_n "checking for pth_version in -lpth""... $ac_c" 1>&6
-echo "configure:9445: checking for pth_version in -lpth" >&5
+echo "configure:11763: checking for pth_version in -lpth" >&5
 ac_lib_var=`echo pth'_'pth_version | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -9449,7 +11767,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpth  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9453 "configure"
+#line 11771 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -9460,7 +11778,7 @@ int main() {
 pth_version()
 ; return 0; }
 EOF
-if { (eval echo configure:9464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -9504,17 +11822,17 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9508: checking for $ac_hdr" >&5
+echo "configure:11826: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9513 "configure"
+#line 11831 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9542,7 +11860,7 @@ done
 
        if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
                echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6
-echo "configure:9546: checking for thr_create in -lthread" >&5
+echo "configure:11864: checking for thr_create in -lthread" >&5
 ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -9550,7 +11868,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9554 "configure"
+#line 11872 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -9561,7 +11879,7 @@ int main() {
 thr_create()
 ; return 0; }
 EOF
-if { (eval echo configure:9565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -9601,12 +11919,12 @@ EOF
                        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9605: checking for $ac_func" >&5
+echo "configure:11923: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9610 "configure"
+#line 11928 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9630,7 +11948,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:9634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -9661,17 +11979,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9665: checking for $ac_hdr" >&5
+echo "configure:11983: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9670 "configure"
+#line 11988 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9675: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9699,7 +12017,7 @@ done
 
        if test $ac_cv_header_lwp_lwp_h = yes ; then
                echo $ac_n "checking for lwp_create in -llwp""... $ac_c" 1>&6
-echo "configure:9703: checking for lwp_create in -llwp" >&5
+echo "configure:12021: checking for lwp_create in -llwp" >&5
 ac_lib_var=`echo lwp'_'lwp_create | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -9707,7 +12025,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-llwp  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9711 "configure"
+#line 12029 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -9718,7 +12036,7 @@ int main() {
 lwp_create()
 ; return 0; }
 EOF
-if { (eval echo configure:9722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -9771,17 +12089,17 @@ if test $ol_with_threads = manual ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9775: checking for $ac_hdr" >&5
+echo "configure:12093: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9780 "configure"
+#line 12098 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12103: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9810,12 +12128,12 @@ done
        for ac_func in sched_yield pthread_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9814: checking for $ac_func" >&5
+echo "configure:12132: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9819 "configure"
+#line 12137 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9839,7 +12157,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:9843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -9865,12 +12183,12 @@ done
 
        
        echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:9869: checking for LinuxThreads pthread.h" >&5
+echo "configure:12187: checking for LinuxThreads pthread.h" >&5
 if eval "test \"\${ol_cv_header_linux_threads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9874 "configure"
+#line 12192 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 EOF
@@ -9900,17 +12218,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9904: checking for $ac_hdr" >&5
+echo "configure:12222: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9909 "configure"
+#line 12227 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12232: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9940,17 +12258,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9944: checking for $ac_hdr" >&5
+echo "configure:12262: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9949 "configure"
+#line 12267 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9980,17 +12298,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9984: checking for $ac_hdr" >&5
+echo "configure:12302: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9989 "configure"
+#line 12307 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12312: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10018,7 +12336,7 @@ done
 
 fi
 
-if test $ol_link_threads != no ; then  
+if test $ol_link_threads != no -a $ol_link_threads != nt ; then  
                        cat >> confdefs.h <<\EOF
 #define REENTRANT 1
 EOF
@@ -10049,20 +12367,20 @@ EOF
 
 
                        echo $ac_n "checking for thread specific errno""... $ac_c" 1>&6
-echo "configure:10053: checking for thread specific errno" >&5
+echo "configure:12371: checking for thread specific errno" >&5
 if eval "test \"\${ol_cv_errno_thread_specific+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                cat > conftest.$ac_ext <<EOF
-#line 10059 "configure"
+#line 12377 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
 errno = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:10066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_errno_thread_specific=yes
 else
 echo "$ac_t""$ol_cv_errno_thread_specific" 1>&6
 
                        echo $ac_n "checking for thread specific h_errno""... $ac_c" 1>&6
-echo "configure:10082: checking for thread specific h_errno" >&5
+echo "configure:12400: checking for thread specific h_errno" >&5
 if eval "test \"\${ol_cv_h_errno_thread_specific+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                cat > conftest.$ac_ext <<EOF
-#line 10088 "configure"
+#line 12406 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 int main() {
 h_errno = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:10095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_h_errno_thread_specific=yes
 else
@@ -10138,77 +12456,29 @@ EOF
 
 fi
 
-
 ol_link_ldbm=no 
-if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
-       echo $ac_n "checking for DB2 library""... $ac_c" 1>&6
-echo "configure:10146: checking for DB2 library" >&5
-if eval "test \"\${ol_cv_lib_db2+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-       ol_LIBS="$LIBS"
-       echo $ac_n "checking for db_open in -ldb""... $ac_c" 1>&6
-echo "configure:10152: checking for db_open in -ldb" >&5
-ac_lib_var=`echo db'_'db_open | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldb  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 10160 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char db_open();
-
-int main() {
-db_open()
-; return 0; }
-EOF
-if { (eval echo configure:10171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  ol_cv_lib_db2=-ldb
-else
-  echo "$ac_t""no" 1>&6
-ol_cv_lib_db2=no
-fi
-
-       LIBS="$ol_LIBS"
+if test $ol_with_ldbm_api = auto \
+       -o $ol_with_ldbm_api = berkeley \
+       -o $ol_with_ldbm_api = bcompat ; then
 
-fi
-
-echo "$ac_t""$ol_cv_lib_db2" 1>&6
-
-for ac_hdr in db.h
+       if test $ol_with_ldbm_api = bcompat; then \
+               ol_cv_berkeley_db=no
+for ac_hdr in db_185.h db.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10202: checking for $ac_hdr" >&5
+echo "configure:12472: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10207 "configure"
+#line 12477 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 fi
 done
 
-if test $ac_cv_header_db_h = yes ; then
-       echo $ac_n "checking if db.h is DB2""... $ac_c" 1>&6
-echo "configure:10240: checking if db.h is DB2" >&5
-if eval "test \"\${ol_cv_header_db2+set}\" = set"; then
+if test $ac_cv_header_db_185_h = yes -o $ac_cv_header_db_h = yes; then
+       echo $ac_n "checking if Berkeley DB header compatibility""... $ac_c" 1>&6
+echo "configure:12510: checking if Berkeley DB header compatibility" >&5
+if eval "test \"\${ol_cv_header_db1+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                cat > conftest.$ac_ext <<EOF
-#line 10246 "configure"
+#line 12516 "configure"
 #include "confdefs.h"
 
-#                      include <db.h>
-                       /* this check could be improved */
-#                      ifdef DB_VERSION_MAJOR
-#                              if DB_VERSION_MAJOR == 2
-                                       __db_version_2
-#                              endif
-#                      endif
-               
+#if HAVE_DB_185_H
+#      include <db_185.h>
+#else
+#      include <db.h>
+#endif
+
+ /* this check could be improved */
+#ifndef DB_VERSION_MAJOR
+#      define DB_VERSION_MAJOR 1
+#endif
+
+#if DB_VERSION_MAJOR == 1 
+       __db_version_1
+#endif
+
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "__db_version_2" >/dev/null 2>&1; then
+  egrep "__db_version_1" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_header_db2=yes
+  ol_cv_header_db1=yes
 else
   rm -rf conftest*
-  ol_cv_header_db2=no
+  ol_cv_header_db1=no
 fi
 rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_header_db2" 1>&6
+echo "$ac_t""$ol_cv_header_db1" 1>&6
+
+       if test $ol_cv_header_db1 = yes ; then
+               ol_cv_lib_db=no
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (default)""... $ac_c" 1>&6
+echo "configure:12553: checking for Berkeley DB link (default)" >&5
+if eval "test \"\${ol_cv_db_none+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 12563 "configure"
+#include "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"
+                               "\texpected: %s\n\tgot: %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; }
+EOF
+if { (eval echo configure:12610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_none=yes
 else
-       ol_cv_header_db2=no
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_none=no
 fi
+rm -f conftest*
 
+       LIBS="$ol_LIBS"
 
- echo $ac_n "checking for Berkeley DB2""... $ac_c" 1>&6
-echo "configure:10278: checking for Berkeley DB2" >&5
-if eval "test \"\${ol_cv_berkeley_db2+set}\" = set"; then
+fi
+
+echo "$ac_t""$ol_cv_db_none" 1>&6
+
+       if test $ol_cv_db_none = yes ; then
+               ol_cv_lib_db=yes
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb)""... $ac_c" 1>&6
+echo "configure:12634: checking for Berkeley DB link (-ldb)" >&5
+if eval "test \"\${ol_cv_db_db+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       if test "$ol_cv_lib_db2" = no -o "$ol_cv_header_db2" = no ; then
-               ol_cv_berkeley_db2=no
-       else
-               ol_cv_berkeley_db2=yes
+       ol_DB_LIB=-ldb
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 12644 "configure"
+#include "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"
+                               "\texpected: %s\n\tgot: %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; }
+EOF
+if { (eval echo configure:12691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db" 1>&6
+
+       if test $ol_cv_db_db = yes ; then
+               ol_cv_lib_db=-ldb
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb3)""... $ac_c" 1>&6
+echo "configure:12715: checking for Berkeley DB link (-ldb3)" >&5
+if eval "test \"\${ol_cv_db_db3+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb3
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 12725 "configure"
+#include "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"
+                               "\texpected: %s\n\tgot: %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; }
+EOF
+if { (eval echo configure:12772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db3=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db3=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db3" 1>&6
+
+       if test $ol_cv_db_db3 = yes ; then
+               ol_cv_lib_db=-ldb3
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb2)""... $ac_c" 1>&6
+echo "configure:12796: checking for Berkeley DB link (-ldb2)" >&5
+if eval "test \"\${ol_cv_db_db2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb2
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 12806 "configure"
+#include "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"
+                               "\texpected: %s\n\tgot: %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; }
+EOF
+if { (eval echo configure:12853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db2=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db2" 1>&6
+
+       if test $ol_cv_db_db2 = yes ; then
+               ol_cv_lib_db=-ldb2
        fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb1)""... $ac_c" 1>&6
+echo "configure:12877: checking for Berkeley DB link (-ldb1)" >&5
+if eval "test \"\${ol_cv_db_db1+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb1
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 12887 "configure"
+#include "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"
+                               "\texpected: %s\n\tgot: %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; }
+EOF
+if { (eval echo configure:12934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db1=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db1=no
 fi
+rm -f conftest*
 
-echo "$ac_t""$ol_cv_berkeley_db2" 1>&6
- if test $ol_cv_berkeley_db2 = yes ; then
-       cat >> confdefs.h <<\EOF
-#define HAVE_BERKELEY_DB2 1
-EOF
-
- fi
-
+       LIBS="$ol_LIBS"
 
-       if test $ol_cv_berkeley_db2 = yes ; then
-               ol_link_ldbm=db2
-               ol_with_ldbm_api=db2
+fi
 
-               if test $ol_with_ldbm_type = hash ; then
-                       cat >> confdefs.h <<\EOF
-#define LDBM_USE_DBHASH 1
-EOF
+echo "$ac_t""$ol_cv_db_db1" 1>&6
 
-               else
-                       cat >> confdefs.h <<\EOF
-#define LDBM_USE_DBBTREE 1
-EOF
+       if test $ol_cv_db_db1 = yes ; then
+               ol_cv_lib_db=-ldb1
+       fi
+fi
 
-               fi
 
-                                               if test $ol_cv_lib_db2 != yes ; then
-                       LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db2"
+               if test "$ol_cv_lib_db" != no ; then
+                       ol_cv_berkeley_db=yes
                fi
        fi
 fi
 
-ol_link_bdb2=no
-if test $ol_link_ldbm = db2 -a $ol_enable_bdb2 != no ; then
-       ol_link_bdb2=yes
-fi
-
-if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
-       echo $ac_n "checking for Berkeley DB library""... $ac_c" 1>&6
-echo "configure:10329: checking for Berkeley DB library" >&5
-if eval "test \"\${ol_cv_lib_db+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
-       for ac_hdr in db1/db.h
+       else
+               ol_cv_berkeley_db=no
+for ac_hdr in db.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10338: checking for $ac_hdr" >&5
+echo "configure:12969: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10343 "configure"
+#line 12974 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12979: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 fi
 done
 
-       ol_LIBS="$LIBS"
-       echo $ac_n "checking for dbopen""... $ac_c" 1>&6
-echo "configure:10376: checking for dbopen" >&5
-if eval "test \"\${ac_cv_func_dbopen+set}\" = set"; then
+if test $ac_cv_header_db_h = yes; then
+       ol_cv_lib_db=no
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (default)""... $ac_c" 1>&6
+echo "configure:13009: checking for Berkeley DB link (default)" >&5
+if eval "test \"\${ol_cv_db_none+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 10381 "configure"
+  
+       ol_DB_LIB=
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 13019 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dbopen(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dbopen();
-char (*f)();
+
+#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() {
 
-/* 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_dbopen) || defined (__stub___dbopen)
-choke me
+#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"
+                               "\texpected: %s\n\tgot: %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
-f = dbopen;
+       (void) dbopen( NULL, 0, 0, 0, NULL);
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:10405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_dbopen=yes"
+  ol_cv_db_none=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_dbopen=no"
+  ol_cv_db_none=no
 fi
 rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
 fi
 
-if eval "test \"`echo '$ac_cv_func_'dbopen`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  ol_cv_lib_db=yes
-else
-  echo "$ac_t""no" 1>&6
+echo "$ac_t""$ol_cv_db_none" 1>&6
 
-               echo $ac_n "checking for dbopen in -ldb1""... $ac_c" 1>&6
-echo "configure:10424: checking for dbopen in -ldb1" >&5
-ac_lib_var=`echo db1'_'dbopen | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+       if test $ol_cv_db_none = yes ; then
+               ol_cv_lib_db=yes
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb)""... $ac_c" 1>&6
+echo "configure:13090: checking for Berkeley DB link (-ldb)" >&5
+if eval "test \"\${ol_cv_db_db+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldb1  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 10432 "configure"
+  
+       ol_DB_LIB=-ldb
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 13100 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dbopen();
+
+#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() {
-dbopen()
+
+#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"
+                               "\texpected: %s\n\tgot: %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; }
 EOF
-if { (eval echo configure:10443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ol_cv_db_db=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ol_cv_db_db=no
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
+
+       LIBS="$ol_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  ol_cv_lib_db=-ldb1
-else
-  echo "$ac_t""no" 1>&6
 
-                       echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
-echo "configure:10463: checking for dbopen in -ldb" >&5
-ac_lib_var=`echo db'_'dbopen | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+echo "$ac_t""$ol_cv_db_db" 1>&6
+
+       if test $ol_cv_db_db = yes ; then
+               ol_cv_lib_db=-ldb
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb3)""... $ac_c" 1>&6
+echo "configure:13171: checking for Berkeley DB link (-ldb3)" >&5
+if eval "test \"\${ol_cv_db_db3+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldb  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 10471 "configure"
+  
+       ol_DB_LIB=-ldb3
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 13181 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dbopen();
+
+#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() {
-dbopen()
+
+#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"
+                               "\texpected: %s\n\tgot: %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; }
 EOF
-if { (eval echo configure:10482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ol_cv_db_db3=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ol_cv_db_db3=no
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
 
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  ol_cv_lib_db=-ldb
-else
-  echo "$ac_t""no" 1>&6
-ol_cv_lib_db=no
+       LIBS="$ol_LIBS"
+
 fi
 
-               
+echo "$ac_t""$ol_cv_db_db3" 1>&6
+
+       if test $ol_cv_db_db3 = yes ; then
+               ol_cv_lib_db=-ldb3
+       fi
 fi
 
-       
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb2)""... $ac_c" 1>&6
+echo "configure:13252: checking for Berkeley DB link (-ldb2)" >&5
+if eval "test \"\${ol_cv_db_db2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb2
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 13262 "configure"
+#include "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"
+                               "\texpected: %s\n\tgot: %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; }
+EOF
+if { (eval echo configure:13309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db2=no
 fi
+rm -f conftest*
 
        LIBS="$ol_LIBS"
 
 fi
 
-echo "$ac_t""$ol_cv_lib_db" 1>&6
+echo "$ac_t""$ol_cv_db_db2" 1>&6
 
+       if test $ol_cv_db_db2 = yes ; then
+               ol_cv_lib_db=-ldb2
+       fi
+fi
 
-for ac_hdr in db_185.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10520: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb1)""... $ac_c" 1>&6
+echo "configure:13333: checking for Berkeley DB link (-ldb1)" >&5
+if eval "test \"\${ol_cv_db_db1+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 10525 "configure"
+  
+       ol_DB_LIB=-ldb1
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 13343 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+
+#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"
+                               "\texpected: %s\n\tgot: %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; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10530: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:13390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  ol_cv_db_db1=yes
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ol_cv_db_db1=no
 fi
 rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
+
+echo "$ac_t""$ol_cv_db_db1" 1>&6
+
+       if test $ol_cv_db_db1 = yes ; then
+               ol_cv_lib_db=-ldb1
+       fi
+fi
+
+
+       if test "$ol_cv_lib_db" != no ; then
+               ol_cv_berkeley_db=yes
+               echo $ac_n "checking for Berkeley DB thread support""... $ac_c" 1>&6
+echo "configure:13416: checking for Berkeley DB thread support" >&5
+if eval "test \"\${ol_cv_berkeley_db_thread+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_LIBS="$LIBS"
+       if test $ol_cv_lib_db != yes ; then
+               LIBS="$ol_cv_lib_db"
+       fi
+
+       if test "$cross_compiling" = yes; then
+  ol_cv_berkeley_db_thread=cross
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13430 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_DB_185_H
+       choke me;
+#else
+#include <db.h>
+#endif
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
+main()
+{
+       int rc;
+       u_int32_t flags = DB_CREATE |
+#ifdef DB_PRIVATE
+               DB_PRIVATE |
+#endif
+               DB_THREAD;
+
+#if DB_VERSION_MAJOR > 2
+       DB_ENV *env = NULL;
+
+       rc = db_env_create( &env, 0 );
+
+       flags |= DB_INIT_MPOOL;
+#ifdef DB_MPOOL_PRIVATE
+       flags |= DB_MPOOL_PRIVATE;
+#endif
+
+       if( rc ) {
+               printf("BerkeleyDB: %s\n", db_strerror(rc) );
+               return rc;
+       }
+
+#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
+       rc = env->open( env, NULL, flags, 0 );
+#else
+       rc = env->open( env, NULL, NULL, flags, 0 );
+#endif
+
+       if ( rc == 0 ) {
+               rc = env->close( env, 0 );
+       }
+
+       if( rc ) {
+               printf("BerkeleyDB: %s\n", db_strerror(rc) );
+               return rc;
+       }
+
+#else
+       DB_ENV env;
+       memset( &env, '\0', sizeof(env) );
+
+       rc = db_appinit( NULL, NULL, &env, flags );
+
+       if( rc == 0 ) {
+               db_appexit( &env );
+       }
+
+       unlink("__db_mpool.share");
+       unlink("__db_lock.share");
+#endif
+
+       return rc;
+}
 EOF
+if { (eval echo configure:13497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ol_cv_berkeley_db_thread=yes
 else
-  echo "$ac_t""no" 1>&6
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ol_cv_berkeley_db_thread=no
 fi
-done
-
-if test "$ol_cv_header_db2" = yes ; then
-       
-       ol_cv_header_db=$ac_cv_header_db_185_h
-else
-       ol_cv_header_db=$ac_cv_header_db_h
+rm -fr conftest*
 fi
 
 
- echo $ac_n "checking for Berkeley DB""... $ac_c" 1>&6
-echo "configure:10566: checking for Berkeley DB" >&5
-if eval "test \"\${ol_cv_berkeley_db+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
-       if test "$ol_cv_lib_db" = no -o "$ol_cv_header_db" = no ; then
-               ol_cv_berkeley_db=no
-       else
-               ol_cv_berkeley_db=yes
+       LIBS="$ol_LIBS"
+
+       if test $ol_cv_berkeley_db_thread != no ; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_BERKELEY_DB_THREAD 1
+EOF
+
        fi
 
 fi
 
-echo "$ac_t""$ol_cv_berkeley_db" 1>&6
- if test $ol_cv_berkeley_db = yes ; then
-       cat >> confdefs.h <<\EOF
+echo "$ac_t""$ol_cv_berkeley_db_thread" 1>&6
+       fi
+fi
+
+       fi
+
+       if test $ol_cv_berkeley_db != no ; then
+               cat >> confdefs.h <<\EOF
 #define HAVE_BERKELEY_DB 1
 EOF
 
- fi
-
 
-       if test $ol_cv_berkeley_db = yes ; then
-               ol_link_ldbm=db
+               ol_link_ldbm=berkeley
                ol_with_ldbm_api=db
 
                if test $ol_with_ldbm_type = hash ; then
@@ -10606,53 +13550,6 @@ EOF
        fi
 fi
 
-if test $ol_with_ldbm_api = manual ; then
-               ol_link_ldbm=yes
-
-       echo "configure: warning: LDBM defines and link options must be set manually" 1>&2
-
-       for ac_hdr in db.h db_185.h gdbm.h ndbm.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10619: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 10624 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-fi
-
 if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
        echo "configure: warning: Could not find LDBM with BTREE support" 1>&2
        ol_with_ldbm_api=none
 
 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = mdbm ; then
        echo $ac_n "checking for MDBM library""... $ac_c" 1>&6
-echo "configure:10664: checking for MDBM library" >&5
+echo "configure:13561: checking for MDBM library" >&5
 if eval "test \"\${ol_cv_lib_mdbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        ol_LIBS="$LIBS"
        echo $ac_n "checking for mdbm_set_chain""... $ac_c" 1>&6
-echo "configure:10670: checking for mdbm_set_chain" >&5
+echo "configure:13567: checking for mdbm_set_chain" >&5
 if eval "test \"\${ac_cv_func_mdbm_set_chain+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10675 "configure"
+#line 13572 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char mdbm_set_chain(); below.  */
@@ -10695,7 +13592,7 @@ f = mdbm_set_chain;
 
 ; return 0; }
 EOF
-if { (eval echo configure:10699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_mdbm_set_chain=yes"
 else
@@ -10714,7 +13611,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for mdbm_set_chain in -lmdbm""... $ac_c" 1>&6
-echo "configure:10718: checking for mdbm_set_chain in -lmdbm" >&5
+echo "configure:13615: checking for mdbm_set_chain in -lmdbm" >&5
 ac_lib_var=`echo mdbm'_'mdbm_set_chain | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -10722,7 +13619,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmdbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10726 "configure"
+#line 13623 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -10733,7 +13630,7 @@ int main() {
 mdbm_set_chain()
 ; return 0; }
 EOF
-if { (eval echo configure:10737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10768,17 +13665,17 @@ echo "$ac_t""$ol_cv_lib_mdbm" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10772: checking for $ac_hdr" >&5
+echo "configure:13669: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10777 "configure"
+#line 13674 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:13679: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10805,7 +13702,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:10809: checking for db" >&5
+echo "configure:13706: checking for db" >&5
 if eval "test \"\${ol_cv_mdbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 
 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
        echo $ac_n "checking for GDBM library""... $ac_c" 1>&6
-echo "configure:10842: checking for GDBM library" >&5
+echo "configure:13739: checking for GDBM library" >&5
 if eval "test \"\${ol_cv_lib_gdbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        ol_LIBS="$LIBS"
        echo $ac_n "checking for gdbm_open""... $ac_c" 1>&6
-echo "configure:10848: checking for gdbm_open" >&5
+echo "configure:13745: checking for gdbm_open" >&5
 if eval "test \"\${ac_cv_func_gdbm_open+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10853 "configure"
+#line 13750 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gdbm_open(); below.  */
@@ -10873,7 +13770,7 @@ f = gdbm_open;
 
 ; return 0; }
 EOF
-if { (eval echo configure:10877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gdbm_open=yes"
 else
@@ -10892,7 +13789,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:10896: checking for gdbm_open in -lgdbm" >&5
+echo "configure:13793: checking for gdbm_open in -lgdbm" >&5
 ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -10900,7 +13797,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgdbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10904 "configure"
+#line 13801 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -10911,7 +13808,7 @@ int main() {
 gdbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:10915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10946,17 +13843,17 @@ echo "$ac_t""$ol_cv_lib_gdbm" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10950: checking for $ac_hdr" >&5
+echo "configure:13847: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10955 "configure"
+#line 13852 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:13857: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10983,7 +13880,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:10987: checking for db" >&5
+echo "configure:13884: checking for db" >&5
 if eval "test \"\${ol_cv_gdbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -11015,22 +13912,20 @@ EOF
        fi
 fi
 
-if test $ol_with_ldbm_api = auto ; then
-       echo "configure: warning: skipping automatic checking for NDBM, must be manually enabled." 1>&2
-elif test $ol_with_ldbm_api = ndbm ; then
+if test $ol_with_ldbm_api = ndbm ; then
        echo $ac_n "checking for NDBM library""... $ac_c" 1>&6
-echo "configure:11023: checking for NDBM library" >&5
+echo "configure:13918: checking for NDBM library" >&5
 if eval "test \"\${ol_cv_lib_ndbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        ol_LIBS="$LIBS"
        echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:11029: checking for dbm_open" >&5
+echo "configure:13924: checking for dbm_open" >&5
 if eval "test \"\${ac_cv_func_dbm_open+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11034 "configure"
+#line 13929 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -11054,7 +13949,7 @@ f = dbm_open;
 
 ; return 0; }
 EOF
-if { (eval echo configure:11058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dbm_open=yes"
 else
@@ -11073,7 +13968,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:11077: checking for dbm_open in -lndbm" >&5
+echo "configure:13972: checking for dbm_open in -lndbm" >&5
 ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -11081,7 +13976,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lndbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11085 "configure"
+#line 13980 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -11092,7 +13987,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:11096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11112,7 +14007,7 @@ else
   echo "$ac_t""no" 1>&6
 
                        echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:11116: checking for dbm_open in -ldbm" >&5
+echo "configure:14011: checking for dbm_open in -ldbm" >&5
 ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -11120,7 +14015,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11124 "configure"
+#line 14019 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -11131,7 +14026,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:11135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11168,17 +14063,17 @@ echo "$ac_t""$ol_cv_lib_ndbm" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11172: checking for $ac_hdr" >&5
+echo "configure:14067: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11177 "configure"
+#line 14072 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -11205,7 +14100,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:11209: checking for db" >&5
+echo "configure:14104: checking for db" >&5
 if eval "test \"\${ol_cv_ndbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -11247,22 +14142,28 @@ if test $ol_link_ldbm = no -a $ol_enable_ldbm != no ; then
        ol_enable_ldbm=no
 fi
 
+if test $ol_enable_dynamic = yes -a $enable_shared = yes ; then
+       LINK_BINS_DYNAMIC="yes"
+else
+       LINK_BINS_DYNAMIC="no"
+fi
+
 if test $ol_enable_wrappers != no ; then
        for ac_hdr in tcpd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11256: checking for $ac_hdr" >&5
+echo "configure:14157: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11261 "configure"
+#line 14162 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11266: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -11292,43 +14193,27 @@ done
        if test $ac_cv_header_tcpd_h != yes ; then
                have_wrappers=no
        else
-               echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6
-echo "configure:11297: checking for main in -lwrap" >&5
-ac_lib_var=`echo wrap'_'main | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lwrap  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 11305 "configure"
+               cat > conftest.$ac_ext <<EOF
+#line 14198 "configure"
 #include "confdefs.h"
 
+int allow_severity = 0;
+int deny_severity  = 0;
+               
 int main() {
-main()
+hosts_access()
 ; return 0; }
 EOF
-if { (eval echo configure:11312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  have_wrappers=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  have_wrappers=no
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_wrappers=yes
-else
-  echo "$ac_t""no" 1>&6
-have_wrappers=no
-fi
-
        fi
 
        if test $have_wrappers = yes ; then
 #define HAVE_TCPD 1
 EOF
 
-               SLAPD_LIBS="$SLAPD_LIBS -lwrap"
+               WRAP_LIBS="-lwrap"
 
                                                echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:11343: checking for main in -lnsl" >&5
+echo "configure:14228: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -11347,14 +14232,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11351 "configure"
+#line 14236 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:11358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
 
                echo "configure: warning: disabling wrappers support" 1>&2
                ol_enable_wrappers=no
+               WRAP_LIBS=""
        fi
 fi
 
 if test $ol_enable_syslog != no ; then
        echo $ac_n "checking for openlog""... $ac_c" 1>&6
-echo "configure:11398: checking for openlog" >&5
+echo "configure:14284: checking for openlog" >&5
 if eval "test \"\${ac_cv_func_openlog+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11403 "configure"
+#line 14289 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char openlog(); below.  */
@@ -11423,7 +14309,7 @@ f = openlog;
 
 ; return 0; }
 EOF
-if { (eval echo configure:11427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_openlog=yes"
 else
        ol_enable_syslog=$ac_cv_func_openlog
 fi
 
-if test $ol_enable_dmalloc != no ; then
-       for ac_hdr in dmalloc.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11457: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 11462 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-       echo $ac_n "checking for dmalloc_shutdown in -ldmalloc""... $ac_c" 1>&6
-echo "configure:11494: checking for dmalloc_shutdown in -ldmalloc" >&5
-ac_lib_var=`echo dmalloc'_'dmalloc_shutdown | sed 'y%./+-:%__p__%'`
+ol_link_sql=no
+if test $ol_enable_sql != no ; then
+       echo $ac_n "checking for SQLDriverConnect in -liodbc""... $ac_c" 1>&6
+echo "configure:14341: checking for SQLDriverConnect in -liodbc" >&5
+ac_lib_var=`echo iodbc'_'SQLDriverConnect | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-ldmalloc  $LIBS"
+LIBS="-liodbc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11502 "configure"
+#line 14349 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char dmalloc_shutdown();
+char SQLDriverConnect();
 
 int main() {
-dmalloc_shutdown()
+SQLDriverConnect()
 ; return 0; }
 EOF
-if { (eval echo configure:11513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11524,161 +14371,36 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo dmalloc | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-ldmalloc $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-if test $ol_enable_tcl != no ; then
-       for ac_hdr in tcl.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11547: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 11552 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
+  have_iodbc=yes
 else
   echo "$ac_t""no" 1>&6
+have_iodbc=no
 fi
-done
 
-
-       if test $ac_cv_header_tcl_h != yes ; then
-               have_tcl=no
+       if test $have_iodbc = yes ; then
+               ol_link_sql="-liodbc"
        else
-               echo $ac_n "checking for main in -ltcl""... $ac_c" 1>&6
-echo "configure:11588: checking for main in -ltcl" >&5
-ac_lib_var=`echo tcl'_'main | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ltcl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 11596 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:11603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl"
-else
-  echo "$ac_t""no" 1>&6
-have_tcl=no
-fi
-
-
-               if test $have_tcl != yes; then
-                       echo $ac_n "checking for main in -ltcl7.6""... $ac_c" 1>&6
-echo "configure:11627: checking for main in -ltcl7.6" >&5
-ac_lib_var=`echo tcl7.6'_'main | sed 'y%./+-:%__p__%'`
-if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ltcl7.6  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 11635 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:11642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl7.6"
-else
-  echo "$ac_t""no" 1>&6
-have_tcl=no
-fi
-
-               fi
-
-               if test $have_tcl != yes; then
-                       echo $ac_n "checking for main in -ltcl8.0""... $ac_c" 1>&6
-echo "configure:11667: checking for main in -ltcl8.0" >&5
-ac_lib_var=`echo tcl8.0'_'main | sed 'y%./+-:%__p__%'`
+               echo $ac_n "checking for SQLDriverConnect in -lodbc""... $ac_c" 1>&6
+echo "configure:14385: checking for SQLDriverConnect in -lodbc" >&5
+ac_lib_var=`echo odbc'_'SQLDriverConnect | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-ltcl8.0  $LIBS"
+LIBS="-lodbc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11675 "configure"
+#line 14393 "configure"
 #include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char SQLDriverConnect();
 
 int main() {
-main()
+SQLDriverConnect()
 ; return 0; }
 EOF
-if { (eval echo configure:11682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11693,42 +14415,41 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl8.0"
+  have_odbc=yes
 else
   echo "$ac_t""no" 1>&6
-have_tcl=no
+have_odbc=no
 fi
 
+               if test $have_odbc = yes ; then
+                       ol_link_sql="-lodbc"
                fi
        fi
 
-       if test $have_tcl != yes ; then
-               echo "configure: warning: could not find -ltcl" 1>&2
-               if test $ol_enable_tcl = yes ; then
-                       { echo "configure: error: could not find tcl, select appropriate options or disable" 1>&2; exit 1; }
-               fi
+       if test $ol_link_sql != no ; then
+               SLAPD_SQL_LIBS="$ol_link_sql"
 
-               ol_enable_tcl=no
+       elif test $ol_enable_sql != auto ; then
+               { echo "configure: error: could not locate suitable ODBC library" 1>&2; exit 1; }
        fi
 fi
 
-# ud needs termcap (should insert check here)
 ol_link_termcap=no
 for ac_hdr in termcap.h ncurses.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11722: checking for $ac_hdr" >&5
+echo "configure:14443: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11727 "configure"
+#line 14448 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14453: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -11757,7 +14478,7 @@ done
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for tputs in -ltermcap""... $ac_c" 1>&6
-echo "configure:11761: checking for tputs in -ltermcap" >&5
+echo "configure:14482: checking for tputs in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tputs | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -11765,7 +14486,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11769 "configure"
+#line 14490 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -11776,7 +14497,7 @@ int main() {
 tputs()
 ; return 0; }
 EOF
-if { (eval echo configure:11780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11809,7 +14530,7 @@ fi
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:11813: checking for initscr in -lncurses" >&5
+echo "configure:14534: checking for initscr in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -11817,7 +14538,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11821 "configure"
+#line 14542 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -11828,7 +14549,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:11832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11868,20 +14589,23 @@ EOF
 fi
 
 ol_link_sasl=no
+ol_link_spasswd=no
 if test $ol_with_cyrus_sasl != no ; then
-       ac_safe=`echo "sasl.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for sasl.h""... $ac_c" 1>&6
-echo "configure:11875: checking for sasl.h" >&5
+       for ac_hdr in sasl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:14599: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11880 "configure"
+#line 14604 "configure"
 #include "confdefs.h"
-#include <sasl.h>
+#include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11885: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -11897,15 +14621,20 @@ rm -f conftest*
 fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  :
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
 else
   echo "$ac_t""no" 1>&6
 fi
+done
 
 
        if test $ac_cv_header_sasl_h = yes ; then
                echo $ac_n "checking for sasl_client_init in -lsasl""... $ac_c" 1>&6
-echo "configure:11909: checking for sasl_client_init in -lsasl" >&5
+echo "configure:14638: checking for sasl_client_init in -lsasl" >&5
 ac_lib_var=`echo sasl'_'sasl_client_init | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -11913,7 +14642,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsasl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 11917 "configure"
+#line 14646 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -11924,7 +14653,7 @@ int main() {
 sasl_client_init()
 ; return 0; }
 EOF
-if { (eval echo configure:11928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11956,23 +14685,62 @@ EOF
                fi
        fi
 
-       if test $ol_link_sasl = no -a $ol_with_cyrus_sasl = yes ; then
-               { echo "configure: error: no suitable API for --with-cyrus-sasl=$ol_with_cyrus_sasl" 1>&2; exit 1; }
+       if test $ol_link_sasl = no ; then
+               if test $ol_with_cyrus_sasl != auto ; then
+                       { echo "configure: error: Could not locate Cyrus SASL" 1>&2; exit 1; }
+               else
+                       echo "configure: warning: Could not locate Cyrus SASL" 1>&2
+                       echo "configure: warning: SASL authentication not supported!" 1>&2
+                       if test $ol_link_tls = no ; then
+                               echo "configure: warning: Strong authentication not supported!" 1>&2
+                       fi
+               fi
+
+       elif test $ol_enable_spasswd != no ; then
+               ol_link_spasswd=yes
+       fi
+
+else
+       echo "configure: warning: SASL authentication not supported!" 1>&2
+       if test $ol_link_tls = no ; then
+               echo "configure: warning: Strong authentication not supported!" 1>&2
+       fi
+fi
+
+if test $cross_compiling != yes ; then
+       dev=no
+       if test -r /dev/urandom ; then
+               dev="/dev/urandom";
+       elif test -r /idev/urandom ; then
+               dev="/idev/urandom";
+       elif test -r /dev/srandom ; then
+               dev="/dev/srandom";
+       elif test -r /dev/random ; then
+               dev="/dev/random";
+       elif test -r /idev/random ; then
+               dev="/idev/random";
+       fi
+
+       if test $dev != no ; then
+               cat >> confdefs.h <<EOF
+#define URANDOM_DEVICE "$dev"
+EOF
+
        fi
 fi
 
 ol_link_fetch=no
 if test $ol_with_fetch != no ; then
-       ol=$LIBS
+       ol_LIBS=$LIBS
 LIBS="-lfetch -lcom_err $LIBS"
 echo $ac_n "checking fetch(3) library""... $ac_c" 1>&6
-echo "configure:11970: checking fetch(3) library" >&5
+echo "configure:14738: checking fetch(3) library" >&5
 if eval "test \"\${ol_cv_lib_fetch+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 11976 "configure"
+#line 14744 "configure"
 #include "confdefs.h"
 
 #include <sys/param.h>
@@ -11982,7 +14750,7 @@ int main() {
 struct url *u = fetchParseURL("file:///"); 
 ; return 0; }
 EOF
-if { (eval echo configure:11986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_lib_fetch=yes
 else
@@ -12020,17 +14788,17 @@ if test $ol_with_readline != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:12024: checking for $ac_hdr" >&5
+echo "configure:14792: checking for $ac_hdr" >&5
 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12029 "configure"
+#line 14797 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:12034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -12061,7 +14829,7 @@ done
                save_LIBS="$LIBS"
                LIBS="$TERMCAP_LIBS $LIBS"
                echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:12065: checking for readline in -lreadline" >&5
+echo "configure:14833: checking for readline in -lreadline" >&5
 ac_lib_var=`echo readline'_'readline | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -12069,7 +14837,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lreadline  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 12073 "configure"
+#line 14841 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -12080,7 +14848,7 @@ int main() {
 readline()
 ; return 0; }
 EOF
-if { (eval echo configure:12084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -12120,15 +14888,14 @@ EOF
 fi
 
 
-# FreeBSD (and others) have crypt(3) in -lcrypt
 if test $ol_enable_crypt != no ; then
        echo $ac_n "checking for crypt""... $ac_c" 1>&6
-echo "configure:12127: checking for crypt" >&5
+echo "configure:14894: checking for crypt" >&5
 if eval "test \"\${ac_cv_func_crypt+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12132 "configure"
+#line 14899 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char crypt(); below.  */
@@ -12152,7 +14919,7 @@ f = crypt;
 
 ; return 0; }
 EOF
-if { (eval echo configure:12156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_crypt=yes"
 else
@@ -12171,7 +14938,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:12175: checking for crypt in -lcrypt" >&5
+echo "configure:14942: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -12179,7 +14946,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 12183 "configure"
+#line 14950 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -12190,7 +14957,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:12194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -12231,15 +14998,14 @@ EOF
        fi
 fi
 
-# FreeBSD (and others) have setproctitle(3) in -lutil
 if test $ol_enable_proctitle != no ; then
        echo $ac_n "checking for setproctitle""... $ac_c" 1>&6
-echo "configure:12238: checking for setproctitle" >&5
+echo "configure:15004: checking for setproctitle" >&5
 if eval "test \"\${ac_cv_func_setproctitle+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12243 "configure"
+#line 15009 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char setproctitle(); below.  */
@@ -12263,7 +15029,7 @@ f = setproctitle;
 
 ; return 0; }
 EOF
-if { (eval echo configure:12267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_setproctitle=yes"
 else
@@ -12282,7 +15048,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6
-echo "configure:12286: checking for setproctitle in -lutil" >&5
+echo "configure:15052: checking for setproctitle in -lutil" >&5
 ac_lib_var=`echo util'_'setproctitle | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -12290,7 +15056,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lutil  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 12294 "configure"
+#line 15060 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -12301,7 +15067,7 @@ int main() {
 setproctitle()
 ; return 0; }
 EOF
-if { (eval echo configure:12305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -12322,6 +15088,7 @@ else
   echo "$ac_t""no" 1>&6
 have_setproctitle=no
                        LIBOBJS="$LIBOBJS setproctitle.o"
+                       LIBSRCS="$LIBSRCS setproctitle.c"
 fi
 
 fi
        fi
 fi
 
-echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:12340: checking for uid_t in sys/types.h" >&5
-if eval "test \"\${ac_cv_type_uid_t+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 12345 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "uid_t" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_uid_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_uid_t=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_type_uid_t" 1>&6
-if test $ac_cv_type_uid_t = no; then
-  cat >> confdefs.h <<\EOF
-#define uid_t int
-EOF
-
-  cat >> confdefs.h <<\EOF
-#define gid_t int
-EOF
-
-fi
-
-echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:12374: checking type of array argument to getgroups" >&5
-if eval "test \"\${ac_cv_type_getgroups+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_type_getgroups=cross
-else
-  cat > conftest.$ac_ext <<EOF
-#line 12382 "configure"
-#include "confdefs.h"
-
-/* Thanks to Mike Rendell for this test.  */
-#include <sys/types.h>
-#define NGID 256
-#undef MAX
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-main()
-{
-  gid_t gidset[NGID];
-  int i, n;
-  union { gid_t gval; long lval; }  val;
-
-  val.lval = -1;
-  for (i = 0; i < NGID; i++)
-    gidset[i] = val.gval;
-  n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
-                 gidset);
-  /* Exit non-zero if getgroups seems to require an array of ints.  This
-     happens when gid_t is short but getgroups modifies an array of ints.  */
-  exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
-}
-
-EOF
-if { (eval echo configure:12407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-    ac_cv_type_getgroups=gid_t
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_type_getgroups=int
-fi
-rm -fr conftest*
-fi
-
-if test $ac_cv_type_getgroups = cross; then
-        cat > conftest.$ac_ext <<EOF
-#line 12421 "configure"
-#include "confdefs.h"
-#include <unistd.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_getgroups=gid_t
-else
-  rm -rf conftest*
-  ac_cv_type_getgroups=int
-fi
-rm -f conftest*
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_type_getgroups" 1>&6
-cat >> confdefs.h <<EOF
-#define GETGROUPS_T $ac_cv_type_getgroups
-EOF
-
- echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:12444: checking for ANSI C header files" >&5
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:15107: checking for ANSI C header files" >&5
 if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12449 "configure"
+#line 15112 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -12453,7 +15116,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:12457: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15120: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -12470,7 +15133,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 12474 "configure"
+#line 15137 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -12488,7 +15151,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 12492 "configure"
+#line 15155 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -12509,18 +15172,25 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 12513 "configure"
+#line 15176 "configure"
 #include "confdefs.h"
 #include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+#define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+#define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int main () { int i; for (i = 0; i < 256; i++)
 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:12524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:15194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -12544,18 +15214,19 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:12548: checking for mode_t" >&5
+echo "configure:15218: checking for mode_t" >&5
 if eval "test \"\${ac_cv_type_mode_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12553 "configure"
+#line 15223 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
 #endif
+
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
@@ -12579,18 +15250,19 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:12583: checking for off_t" >&5
+echo "configure:15254: checking for off_t" >&5
 if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12588 "configure"
+#line 15259 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
 #endif
+
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
@@ -12614,18 +15286,19 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:12618: checking for pid_t" >&5
+echo "configure:15290: checking for pid_t" >&5
 if eval "test \"\${ac_cv_type_pid_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12623 "configure"
+#line 15295 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
 #endif
+
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
@@ -12649,19 +15322,19 @@ EOF
 fi
 
 echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:12653: checking for ptrdiff_t" >&5
+echo "configure:15326: checking for ptrdiff_t" >&5
 if eval "test \"\${am_cv_type_ptrdiff_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12658 "configure"
+#line 15331 "configure"
 #include "confdefs.h"
 #include <stddef.h>
 int main() {
 ptrdiff_t p
 ; return 0; }
 EOF
-if { (eval echo configure:12665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15338: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_type_ptrdiff_t=yes
 else
@@ -12682,12 +15355,12 @@ EOF
    fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:12686: checking return type of signal handlers" >&5
+echo "configure:15359: checking return type of signal handlers" >&5
 if eval "test \"\${ac_cv_type_signal+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12691 "configure"
+#line 15364 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -12704,7 +15377,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:12708: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -12722,81 +15395,123 @@ cat >> confdefs.h <<EOF
 EOF
 
 
-echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6
-echo "configure:12727: checking for sig_atomic_t" >&5
-if eval "test \"\${ol_cv_type_sig_atomic_t+set}\" = set"; then
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:15400: checking for size_t" >&5
+if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12732 "configure"
+#line 15405 "configure"
 #include "confdefs.h"
-#include <signal.h>
-int main() {
-sig_atomic_t atomic;
-; return 0; }
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+
 EOF
-if { (eval echo configure:12739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_type_sig_atomic_t=yes
+  eval "ac_cv_type_size_t=yes"
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_type_sig_atomic_t=no
+  eval "ac_cv_type_size_t=no"
 fi
 rm -f conftest*
+
 fi
+if eval "test \"`echo '$ac_cv_type_'size_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
+#define size_t unsigned
+EOF
 
-echo "$ac_t""$ol_cv_type_sig_atomic_t" 1>&6
-  if test $ol_cv_type_sig_atomic_t = no; then
-    cat >> confdefs.h <<\EOF
-#define sig_atomic_t int
+fi
+
+
+echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
+echo "configure:15437: checking for ssize_t" >&5
+if eval "test \"\${ac_cv_type_ssize_t+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 15442 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  eval "ac_cv_type_ssize_t=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_type_ssize_t=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_type_'ssize_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
+#define ssize_t signed int
 EOF
 
-  fi
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:12760: checking for size_t" >&5
-if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
+fi
+
+echo $ac_n "checking for caddr_t""... $ac_c" 1>&6
+echo "configure:15473: checking for caddr_t" >&5
+if eval "test \"\${ac_cv_type_caddr_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12765 "configure"
+#line 15478 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
 #endif
+
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])caddr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
-  eval "ac_cv_type_size_t=yes"
+  eval "ac_cv_type_caddr_t=yes"
 else
   rm -rf conftest*
-  eval "ac_cv_type_size_t=no"
+  eval "ac_cv_type_caddr_t=no"
 fi
 rm -f conftest*
 
 fi
-if eval "test \"`echo '$ac_cv_type_'size_t`\" = yes"; then
+if eval "test \"`echo '$ac_cv_type_'caddr_t`\" = yes"; then
   echo "$ac_t""yes" 1>&6
 else
   echo "$ac_t""no" 1>&6
   cat >> confdefs.h <<EOF
-#define size_t unsigned
+#define caddr_t char *
 EOF
 
 fi
 
+
 echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
-echo "configure:12795: checking for socklen_t" >&5
+echo "configure:15510: checking for socklen_t" >&5
 if eval "test \"\${ol_cv_type_socklen_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12800 "configure"
+#line 15515 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -12810,7 +15525,7 @@ int main() {
 socklen_t len;
 ; return 0; }
 EOF
-if { (eval echo configure:12814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_type_socklen_t=yes
 else
@@ -12831,12 +15546,12 @@ EOF
   fi
  
 echo $ac_n "checking for member st_blksize in aggregate type struct stat""... $ac_c" 1>&6
-echo "configure:12835: checking for member st_blksize in aggregate type struct stat" >&5
+echo "configure:15550: checking for member st_blksize in aggregate type struct stat" >&5
 if eval "test \"\${ac_cv_c_struct_member_st_blksize+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12840 "configure"
+#line 15555 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -12844,7 +15559,7 @@ int main() {
 struct stat foo; foo.st_blksize;
 ; return 0; }
 EOF
-if { (eval echo configure:12848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_struct_member_st_blksize=yes
 else
@@ -12866,12 +15581,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:12870: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:15585: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"\${ac_cv_header_time+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12875 "configure"
+#line 15590 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -12880,7 +15595,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:12884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -12901,12 +15616,12 @@ EOF
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:12905: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:15620: checking whether struct tm is in sys/time.h or time.h" >&5
 if eval "test \"\${ac_cv_struct_tm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12910 "configure"
+#line 15625 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -12914,7 +15629,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:12918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15633: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -12934,15 +15649,84 @@ EOF
 
 fi
 
+echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
+echo "configure:15654: checking for uid_t in sys/types.h" >&5
+if eval "test \"\${ac_cv_type_uid_t+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 15659 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "uid_t" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_uid_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_uid_t" 1>&6
+if test $ac_cv_type_uid_t = no; then
+  cat >> confdefs.h <<\EOF
+#define uid_t int
+EOF
+
+  cat >> confdefs.h <<\EOF
+#define gid_t int
+EOF
+
+fi
+
+echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6
+echo "configure:15688: checking for sig_atomic_t" >&5
+if eval "test \"\${ol_cv_type_sig_atomic_t+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 15693 "configure"
+#include "confdefs.h"
+#include <signal.h>
+int main() {
+sig_atomic_t atomic;
+; return 0; }
+EOF
+if { (eval echo configure:15700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_type_sig_atomic_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_type_sig_atomic_t=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ol_cv_type_sig_atomic_t" 1>&6
+  if test $ol_cv_type_sig_atomic_t = no; then
+    cat >> confdefs.h <<\EOF
+#define sig_atomic_t int
+EOF
+
+  fi
+
+
 # test for pw_gecos in struct passwd
 echo $ac_n "checking struct passwd for pw_gecos""... $ac_c" 1>&6
-echo "configure:12940: checking struct passwd for pw_gecos" >&5
+echo "configure:15724: checking struct passwd for pw_gecos" >&5
 if eval "test \"\${ol_cv_struct_passwd_pw_gecos+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 12946 "configure"
+#line 15730 "configure"
 #include "confdefs.h"
 #include <pwd.h>
 int main() {
@@ -12952,7 +15736,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_struct_passwd_pw_gecos=yes
 else
 
 # test for pw_passwd in struct passwd
 echo $ac_n "checking struct passwd for pw_passwd""... $ac_c" 1>&6
-echo "configure:12978: checking struct passwd for pw_passwd" >&5
+echo "configure:15762: checking struct passwd for pw_passwd" >&5
 if eval "test \"\${ol_cv_struct_passwd_pw_passwd+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 12984 "configure"
+#line 15768 "configure"
 #include "confdefs.h"
 #include <pwd.h>
 int main() {
@@ -12990,7 +15774,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_struct_passwd_pw_passwd=yes
 else
@@ -13012,7 +15796,7 @@ fi
 
 
 echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
-echo "configure:13016: checking if toupper() requires islower()" >&5
+echo "configure:15800: checking if toupper() requires islower()" >&5
 if eval "test \"\${ol_cv_c_upper_lower+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13021,7 +15805,7 @@ else
   ol_cv_c_upper_lower=safe
 else
   cat > conftest.$ac_ext <<EOF
-#line 13025 "configure"
+#line 15809 "configure"
 #include "confdefs.h"
 
 #include <ctype.h>
@@ -13033,7 +15817,7 @@ main()
                exit(1);
 }
 EOF
-if { (eval echo configure:13037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:15821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ol_cv_c_upper_lower=no
 else
@@ -13056,12 +15840,12 @@ EOF
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:13060: checking for working const" >&5
+echo "configure:15844: checking for working const" >&5
 if eval "test \"\${ac_cv_c_const+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13065 "configure"
+#line 15849 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -13110,7 +15894,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:13114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -13131,12 +15915,12 @@ EOF
 fi
 
 echo $ac_n "checking if compiler understands volatile""... $ac_c" 1>&6
-echo "configure:13135: checking if compiler understands volatile" >&5
+echo "configure:15919: checking if compiler understands volatile" >&5
 if eval "test \"\${ol_cv_c_volatile+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13140 "configure"
+#line 15924 "configure"
 #include "confdefs.h"
 int x, y, z;
 int main() {
@@ -13145,7 +15929,7 @@ volatile int a; int * volatile b = x ? &y : &z;
       *b = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:13149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_c_volatile=yes
 else
@@ -13173,30 +15957,16 @@ if test $cross_compiling = yes ; then
 #define CROSS_COMPILING 1
 EOF
 
-
-       cat >> confdefs.h <<\EOF
-#define LBER_INT_T long
-EOF
-
-       cat >> confdefs.h <<\EOF
-#define LBER_TAG_T long
-EOF
-
-       cat >> confdefs.h <<\EOF
-#define LBER_SOCKET_T int
-EOF
-
-
 else
        echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:13193: checking whether byte ordering is bigendian" >&5
+echo "configure:15963: checking whether byte ordering is bigendian" >&5
 if eval "test \"\${ac_cv_c_bigendian+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 13200 "configure"
+#line 15970 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -13207,11 +15977,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:13211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 13215 "configure"
+#line 15985 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -13222,7 +15992,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:13226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -13242,7 +16012,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 13246 "configure"
+#line 16016 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -13255,7 +16025,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:13259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:16029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
 
 fi
 
-       echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:13283: checking size of short" >&5
+fi
+
+echo $ac_n "checking size of short""... $ac_c" 1>&6
+echo "configure:16055: checking size of short" >&5 
 if eval "test \"\${ac_cv_sizeof_short+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
+  for ac_size in 4 8 1 2 16  ; do # List sizes in rough order of prevalence. 
   cat > conftest.$ac_ext <<EOF
-#line 13291 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-main()
-{
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(short));
-  exit(0);
-}
+#line 16061 "configure"
+#include "confdefs.h"
+#include "confdefs.h" 
+#include <sys/types.h> 
+
+int main() {
+switch (0) case 0: case (sizeof (short) == $ac_size):;
+; return 0; }
 EOF
-if { (eval echo configure:13302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_sizeof_short=`cat conftestval`
+if { (eval echo configure:16071: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_sizeof_short=$ac_size
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_sizeof_short=0
-fi
-rm -fr conftest*
 fi
+rm -f conftest* 
+  if test x$ac_cv_sizeof_short != x ; then break; fi 
+done 
 
 fi
-echo "$ac_t""$ac_cv_sizeof_short" 1>&6
+if test x$ac_cv_sizeof_short = x ; then 
+  { echo "configure: error: cannot determine a size for short" 1>&2; exit 1; } 
+fi 
+echo "$ac_t""$ac_cv_sizeof_short" 1>&6 
 cat >> confdefs.h <<EOF
 #define SIZEOF_SHORT $ac_cv_sizeof_short
 EOF
-
  
-       echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:13322: checking size of int" >&5
+echo $ac_n "checking size of int""... $ac_c" 1>&6
+echo "configure:16094: checking size of int" >&5 
 if eval "test \"\${ac_cv_sizeof_int+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
+  for ac_size in 4 8 1 2 16  ; do # List sizes in rough order of prevalence. 
   cat > conftest.$ac_ext <<EOF
-#line 13330 "configure"
+#line 16100 "configure"
 #include "confdefs.h"
-#include <stdio.h>
-main()
-{
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(int));
-  exit(0);
-}
+#include "confdefs.h" 
+#include <sys/types.h> 
+
+int main() {
+switch (0) case 0: case (sizeof (int) == $ac_size):;
+; return 0; }
 EOF
-if { (eval echo configure:13341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_sizeof_int=`cat conftestval`
+if { (eval echo configure:16110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_sizeof_int=$ac_size
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_sizeof_int=0
-fi
-rm -fr conftest*
 fi
+rm -f conftest* 
+  if test x$ac_cv_sizeof_int != x ; then break; fi 
+done 
 
 fi
-echo "$ac_t""$ac_cv_sizeof_int" 1>&6
+if test x$ac_cv_sizeof_int = x ; then 
+  { echo "configure: error: cannot determine a size for int" 1>&2; exit 1; } 
+fi 
+echo "$ac_t""$ac_cv_sizeof_int" 1>&6 
 cat >> confdefs.h <<EOF
 #define SIZEOF_INT $ac_cv_sizeof_int
 EOF
-
  
-       echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:13361: checking size of long" >&5
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+echo "configure:16133: checking size of long" >&5 
 if eval "test \"\${ac_cv_sizeof_long+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
+  for ac_size in 4 8 1 2 16  ; do # List sizes in rough order of prevalence. 
   cat > conftest.$ac_ext <<EOF
-#line 13369 "configure"
+#line 16139 "configure"
 #include "confdefs.h"
-#include <stdio.h>
-main()
-{
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(long));
-  exit(0);
-}
+#include "confdefs.h" 
+#include <sys/types.h> 
+
+int main() {
+switch (0) case 0: case (sizeof (long) == $ac_size):;
+; return 0; }
 EOF
-if { (eval echo configure:13380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_sizeof_long=`cat conftestval`
+if { (eval echo configure:16149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_sizeof_long=$ac_size
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_sizeof_long=0
-fi
-rm -fr conftest*
 fi
+rm -f conftest* 
+  if test x$ac_cv_sizeof_long != x ; then break; fi 
+done 
 
 fi
-echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+if test x$ac_cv_sizeof_long = x ; then 
+  { echo "configure: error: cannot determine a size for long" 1>&2; exit 1; } 
+fi 
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6 
 cat >> confdefs.h <<EOF
 #define SIZEOF_LONG $ac_cv_sizeof_long
 EOF
 
 
+if test "$ac_cv_sizeof_int" -lt 4 ; then
+       echo "configure: warning: OpenLDAP requires 'int' to be 32 bits or greater." 1>&2
 
-       if test "$ac_cv_sizeof_int" -lt 4 ; then
-               echo "configure: warning: OpenLDAP requires 'int' to be 32 bits or greater." 1>&2
-
-               cat >> confdefs.h <<\EOF
+       cat >> confdefs.h <<\EOF
 #define LBER_INT_T long
 EOF
 
-               cat >> confdefs.h <<\EOF
-#define LBER_TAG_T long
-EOF
-
-               cat >> confdefs.h <<\EOF
-#define LBER_SOCKET_T int
-EOF
-
-       else
-               cat >> confdefs.h <<\EOF
+else
+       cat >> confdefs.h <<\EOF
 #define LBER_INT_T int
 EOF
 
-               cat >> confdefs.h <<\EOF
-#define LBER_TAG_T long
+fi
+
+cat >> confdefs.h <<\EOF
+#define LBER_LEN_T long
 EOF
 
-               cat >> confdefs.h <<\EOF
+cat >> confdefs.h <<\EOF
 #define LBER_SOCKET_T int
 EOF
 
-       fi
-fi
-
 cat >> confdefs.h <<\EOF
-#define LBER_LEN_T long
+#define LBER_TAG_T long
 EOF
 
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:13437: checking for 8-bit clean memcmp" >&5
+echo "configure:16200: checking for 8-bit clean memcmp" >&5
 if eval "test \"\${ac_cv_func_memcmp_clean+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13441,7 +16204,7 @@ else
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 13445 "configure"
+#line 16208 "configure"
 #include "confdefs.h"
 
 main()
@@ -13451,7 +16214,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:13455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:16218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_memcmp_clean=yes
 else
@@ -13469,12 +16232,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
 
 echo $ac_n "checking for strftime""... $ac_c" 1>&6
-echo "configure:13473: checking for strftime" >&5
+echo "configure:16236: checking for strftime" >&5
 if eval "test \"\${ac_cv_func_strftime+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13478 "configure"
+#line 16241 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strftime(); below.  */
@@ -13498,7 +16261,7 @@ f = strftime;
 
 ; return 0; }
 EOF
-if { (eval echo configure:13502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strftime=yes"
 else
@@ -13520,7 +16283,7 @@ else
   echo "$ac_t""no" 1>&6
 # strftime is in -lintl on SCO UNIX.
 echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6
-echo "configure:13524: checking for strftime in -lintl" >&5
+echo "configure:16287: checking for strftime in -lintl" >&5
 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -13528,7 +16291,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 13532 "configure"
+#line 16295 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -13539,7 +16302,7 @@ int main() {
 strftime()
 ; return 0; }
 EOF
-if { (eval echo configure:13543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
 
 
 echo $ac_n "checking for inet_aton()""... $ac_c" 1>&6
-echo "configure:13571: checking for inet_aton()" >&5
+echo "configure:16334: checking for inet_aton()" >&5
 if eval "test \"\${ol_cv_func_inet_aton+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13576 "configure"
+#line 16339 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -13594,7 +16357,7 @@ struct in_addr in;
 int rc = inet_aton( "255.255.255.255", &in );
 ; return 0; }
 EOF
-if { (eval echo configure:13598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_func_inet_aton=yes
 else
   fi
  
 
+echo $ac_n "checking for _spawnlp""... $ac_c" 1>&6
+echo "configure:16383: checking for _spawnlp" >&5
+if eval "test \"\${ac_cv_func__spawnlp+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 16388 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _spawnlp(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char _spawnlp();
+char (*f)();
+
+int main() {
+
+/* 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__spawnlp) || defined (__stub____spawnlp)
+choke me
+#else
+f = _spawnlp;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:16412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func__spawnlp=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func__spawnlp=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_spawnlp`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_SPAWNLP 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for _snprintf""... $ac_c" 1>&6
+echo "configure:16436: checking for _snprintf" >&5
+if eval "test \"\${ac_cv_func__snprintf+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 16441 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _snprintf(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char _snprintf();
+char (*f)();
+
+int main() {
+
+/* 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__snprintf) || defined (__stub____snprintf)
+choke me
+#else
+f = _snprintf;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:16465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func__snprintf=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func__snprintf=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_snprintf`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  ac_cv_func_snprintf=yes
+       cat >> confdefs.h <<\EOF
+#define snprintf _snprintf
+EOF
+
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for _vsnprintf""... $ac_c" 1>&6
+echo "configure:16491: checking for _vsnprintf" >&5
+if eval "test \"\${ac_cv_func__vsnprintf+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 16496 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _vsnprintf(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char _vsnprintf();
+char (*f)();
+
+int main() {
+
+/* 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__vsnprintf) || defined (__stub____vsnprintf)
+choke me
+#else
+f = _vsnprintf;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:16520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func__vsnprintf=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func__vsnprintf=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_vsnprintf`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  ac_cv_func_vsnprintf=yes
+       cat >> confdefs.h <<\EOF
+#define vsnprintf _vsnprintf
+EOF
+
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:13620: checking for vprintf" >&5
+echo "configure:16546: checking for vprintf" >&5
 if eval "test \"\${ac_cv_func_vprintf+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13625 "configure"
+#line 16551 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -13645,7 +16571,7 @@ f = vprintf;
 
 ; return 0; }
 EOF
-if { (eval echo configure:13649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:13673: checking for _doprnt" >&5
+echo "configure:16599: checking for _doprnt" >&5
 if eval "test \"\${ac_cv_func__doprnt+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13678 "configure"
+#line 16604 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -13698,7 +16624,7 @@ f = _doprnt;
 
 ; return 0; }
 EOF
-if { (eval echo configure:13702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -13727,12 +16653,12 @@ if test $ac_cv_func_vprintf = yes ; then
                for ac_func in vsnprintf vsprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:13731: checking for $ac_func" >&5
+echo "configure:16657: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13736 "configure"
+#line 16662 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -13756,7 +16682,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:13760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
 for ac_func in \
        bcopy                   \
        closesocket             \
+       chroot                  \
        endgrent                \
        endpwent                \
+       fcntl                   \
        flock                   \
        getdtablesize   \
        getgrgid                \
        gethostname             \
        getpass                 \
+       getpassphrase   \
        getpwuid                \
        getpwnam                \
        getspnam                \
@@ -13814,7 +16743,6 @@ for ac_func in \
        sigaction               \
        signal                  \
        sigset                  \
-       snprintf                \
        strdup                  \
        strerror                \
        strpbrk                 \
@@ -13825,6 +16753,7 @@ for ac_func in \
        strtoul                 \
        strspn                  \
        sysconf                 \
+       usleep                  \
        waitpid                 \
        wait4                   \
        write                   \
@@ -13833,12 +16762,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:13837: checking for $ac_func" >&5
+echo "configure:16766: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13842 "configure"
+#line 16771 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -13862,7 +16791,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:13866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -13890,12 +16819,12 @@ done
 for ac_func in getopt tempnam
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:13894: checking for $ac_func" >&5
+echo "configure:16823: checking for $ac_func" >&5
 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 13899 "configure"
+#line 16828 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -13919,7 +16848,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:13923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -13946,25 +16875,36 @@ done
 
 
 
+if test "$ac_cv_func_getopt" != yes; then
+    LIBSRCS="$LIBSRCS getopt.c"
+fi
+
+if test "$ac_cv_func_tempnam" != yes; then
+    LIBSRCS="$LIBSRCS tempnam.c"
+fi
+
 # Check Configuration
 echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:13952: checking declaration of sys_errlist" >&5
+echo "configure:16889: checking declaration of sys_errlist" >&5
 if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 13958 "configure"
+#line 16895 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
 #include <sys/types.h>
-#include <errno.h> 
+#include <errno.h>
+#ifdef WINNT
+#include <stdlib.h>
+#endif 
 int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:13968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_dcl_sys_errlist=yes
        ol_cv_have_sys_errlist=yes
@@ -13987,20 +16927,20 @@ EOF
 
 
        echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:13991: checking existence of sys_errlist" >&5
+echo "configure:16931: checking existence of sys_errlist" >&5
 if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                cat > conftest.$ac_ext <<EOF
-#line 13997 "configure"
+#line 16937 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:14004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_have_sys_errlist=yes
 else
@@ -14034,12 +16974,6 @@ if test "$ol_enable_syslog" = yes ; then
 #define LDAP_SYSLOG 1
 EOF
 
-fi
-if test "$ol_enable_libui" = yes ; then
-       cat >> confdefs.h <<\EOF
-#define LDAP_LIBUI 1
-EOF
-
 fi
 if test "$ol_enable_cache" = no ; then
        cat >> confdefs.h <<\EOF
@@ -14047,9 +16981,9 @@ if test "$ol_enable_cache" = no ; then
 EOF
 
 fi
-if test "$ol_enable_dns" != no ; then
+if test "$ol_link_kbind" != no ; then
        cat >> confdefs.h <<\EOF
-#define LDAP_API_FEATURE_X_OPENLDAP_V2_DNS LDAP_VENDOR_VERSION
+#define LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND LDAP_VENDOR_VERSION
 EOF
 
 fi
@@ -14065,28 +16999,39 @@ if test "$ol_enable_referrals" != no ; then
 EOF
 
 fi
-if test "$ol_enable_cldap" != no ; then
+if test "$ol_enable_local" != no; then
+       cat >> confdefs.h <<\EOF
+#define LDAP_PF_LOCAL 1
+EOF
+
+fi
+if test "$ol_link_ipv6" != no; then
        cat >> confdefs.h <<\EOF
-#define LDAP_CONNECTIONLESS 1
+#define LDAP_PF_INET6 1
 EOF
 
 fi
+if test "$ol_enable_cleartext" != no ; then
+       cat >> confdefs.h <<\EOF
+#define SLAPD_CLEARTEXT 1
+EOF
 
+fi
 if test "$ol_enable_crypt" != no ; then
        cat >> confdefs.h <<\EOF
 #define SLAPD_CRYPT 1
 EOF
 
 fi
-if test "$ol_enable_cleartext" != no ; then
+if test "$ol_link_kpasswd" != no ; then
        cat >> confdefs.h <<\EOF
-#define SLAPD_CLEARTEXT 1
+#define SLAPD_KPASSWD 1
 EOF
 
 fi
-if test "$ol_enable_multimaster" != no ; then
+if test "$ol_link_spasswd" != no ; then
        cat >> confdefs.h <<\EOF
-#define SLAPD_MULTIMASTER 1
+#define SLAPD_SPASSWD 1
 EOF
 
 fi
@@ -14107,12 +17052,6 @@ if test "$ol_enable_aci" != no ; then
 #define SLAPD_ACI_ENABLED 1
 EOF
 
-fi
-if test "$ol_enable_discreteaci" != no ; then
-       cat >> confdefs.h <<\EOF
-#define SLAPD_ACI_DISCRETE_RIGHTS 1
-EOF
-
 fi
 
 if test "$ol_link_modules" != no ; then
@@ -14121,25 +17060,24 @@ if test "$ol_link_modules" != no ; then
 EOF
 
        BUILD_SLAPD=yes
-       MODULES_LIBS=-lltdl
        SLAPD_MODULES_LDFLAGS="-dlopen self"
 fi
 
-if test "$ol_link_bdb2" != no ; then
+if test "$ol_link_dnssrv" != no ; then
        cat >> confdefs.h <<\EOF
-#define SLAPD_BDB2 1
+#define SLAPD_DNSSRV 1
 EOF
 
        BUILD_SLAPD=yes
-       BUILD_BDB2=yes
-       if test "$ol_with_bdb2_module" != static ; then
+       BUILD_DNSSRV=yes
+       if test "$ol_with_dnssrv_module" != static ; then
                cat >> confdefs.h <<\EOF
-#define SLAPD_BDB2_DYNAMIC 1
+#define SLAPD_DNSSRV_DYNAMIC 1
 EOF
 
-               BUILD_BDB2=mod
-               BUILD_BDB2_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-bdb2/back_bdb2.la"
+               BUILD_DNSSRV=mod
+               BUILD_DNSSRV_DYNAMIC=shared
+               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-dnssrv/back_dnssrv.la"
        fi
 fi
 
@@ -14197,24 +17135,6 @@ EOF
        fi
 fi
 
-if test "$ol_link_perl" != no ; then
-       cat >> confdefs.h <<\EOF
-#define SLAPD_PERL 1
-EOF
-
-       BUILD_SLAPD=yes
-       BUILD_PERL=yes
-       if test "$ol_with_perl_module" != static ; then
-               cat >> confdefs.h <<\EOF
-#define SLAPD_PERL_DYNAMIC 1
-EOF
-
-               BUILD_PERL=mod
-               BUILD_PERL_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-perl/back_perl.la"
-       fi
-fi
-
 if test "$ol_enable_shell" != no ; then
        cat >> confdefs.h <<\EOF
 #define SLAPD_SHELL 1
@@ -14233,21 +17153,21 @@ EOF
        fi
 fi
 
-if test "$ol_enable_tcl" != no ; then
+if test "$ol_enable_sql" != no ; then
        cat >> confdefs.h <<\EOF
-#define SLAPD_TCL 1
+#define SLAPD_SQL 1
 EOF
 
        BUILD_SLAPD=yes
-       BUILD_TCL=yes
-       if test "$ol_with_tcl_module" != static; then
+       BUILD_SQL=yes
+       if test "$ol_with_sql_module" != static; then
                cat >> confdefs.h <<\EOF
-#define SLAPD_TCL_DYNAMIC 1
+#define SLAPD_SQL_DYNAMIC 1
 EOF
 
-               BUILD_TCL=mod
-               BUILD_TCL_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-tcl/back_tcl.la"
+               BUILD_SQL=mod
+               BUILD_SQL_DYNAMIC=shared
+               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-sql/back_sql.la"
        fi
 fi
 
@@ -14257,6 +17177,29 @@ if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
 fi
 
 
+if test "$LINK_BINS_DYNAMIC" = yes; then
+    LIB_LINKAGE=DYN
+    LT_LIB_LINKAGE=shared
+else
+    LIB_LINKAGE=STAT
+    LT_LIB_LINKAGE=static
+fi
+
+if test "$ac_cv_mingw32" = yes ; then
+    PLAT=NT
+    DYN_EXT=dll
+else
+    PLAT=UNIX
+    DYN_EXT=so
+fi
+
+
+
+
+
+
+
+
 
   
   
   
   
   
-  
-  
-  
+
+
+
+
+
 
 
 
@@ -14368,6 +17313,7 @@ clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
 clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
+clients/maildap/Makefile:build/top.mk:clients/maildap/Makefile.in:build/rules.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     \
@@ -14380,13 +17326,12 @@ libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.
 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/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-bdb2/Makefile:build/top.mk:servers/slapd/back-bdb2/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-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk \
 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/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-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk \
-servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/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/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
@@ -14394,7 +17339,6 @@ tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
 tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
 contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \
 contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \
-contrib/web_ldap/Makefile:build/top.mk:contrib/web_ldap/Makefile.in:build/rules.mk \
  include/portable.h include/ldap_features.h include/lber_types.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
@@ -14460,38 +17404,41 @@ s%@SET_MAKE@%$SET_MAKE%g
 s%@top_builddir@%$top_builddir%g
 s%@ldap_subdir@%$ldap_subdir%g
 s%@CC@%$CC%g
+s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
-s%@LD@%$LD%g
-s%@NM@%$NM%g
 s%@LN_S@%$LN_S%g
+s%@DLLTOOL@%$DLLTOOL%g
+s%@AS@%$AS%g
+s%@OBJDUMP@%$OBJDUMP%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@LN_H@%$LN_H%g
 s%@SENDMAIL@%$SENDMAIL%g
 s%@EDITOR@%$EDITOR%g
 s%@FINGER@%$FINGER%g
-s%@PERLBIN@%$PERLBIN%g
 s%@CPP@%$CPP%g
 s%@EXEEXT@%$EXEEXT%g
 s%@OBJEXT@%$OBJEXT%g
 s%@OL_MKDEP@%$OL_MKDEP%g
 s%@OL_MKDEP_FLAGS@%$OL_MKDEP_FLAGS%g
 s%@LIBOBJS@%$LIBOBJS%g
+s%@LIBSRCS@%$LIBSRCS%g
+s%@PLAT@%$PLAT%g
+s%@LIB_LINKAGE@%$LIB_LINKAGE%g
+s%@LT_LIB_LINKAGE@%$LT_LIB_LINKAGE%g
+s%@DYN_EXT@%$DYN_EXT%g
 s%@BUILD_SLAPD@%$BUILD_SLAPD%g
-s%@BUILD_BDB2@%$BUILD_BDB2%g
+s%@BUILD_DNSSRV@%$BUILD_DNSSRV%g
 s%@BUILD_LDAP@%$BUILD_LDAP%g
 s%@BUILD_LDBM@%$BUILD_LDBM%g
 s%@BUILD_PASSWD@%$BUILD_PASSWD%g
-s%@BUILD_PERL@%$BUILD_PERL%g
-s%@BUILD_QUIPU@%$BUILD_QUIPU%g
 s%@BUILD_SHELL@%$BUILD_SHELL%g
-s%@BUILD_TCL@%$BUILD_TCL%g
-s%@BUILD_BDB2_DYNAMIC@%$BUILD_BDB2_DYNAMIC%g
+s%@BUILD_SQL@%$BUILD_SQL%g
+s%@BUILD_DNSSRV_DYNAMIC@%$BUILD_DNSSRV_DYNAMIC%g
 s%@BUILD_LDAP_DYNAMIC@%$BUILD_LDAP_DYNAMIC%g
 s%@BUILD_LDBM_DYNAMIC@%$BUILD_LDBM_DYNAMIC%g
 s%@BUILD_PASSWD_DYNAMIC@%$BUILD_PASSWD_DYNAMIC%g
-s%@BUILD_PERL_DYNAMIC@%$BUILD_PERL_DYNAMIC%g
 s%@BUILD_SHELL_DYNAMIC@%$BUILD_SHELL_DYNAMIC%g
-s%@BUILD_TCL_DYNAMIC@%$BUILD_TCL_DYNAMIC%g
+s%@BUILD_SQL_DYNAMIC@%$BUILD_SQL_DYNAMIC%g
 s%@BUILD_SLURPD@%$BUILD_SLURPD%g
 s%@LDAP_LIBS@%$LDAP_LIBS%g
 s%@LDIF_LIBS@%$LDIF_LIBS%g
@@ -14500,17 +17447,22 @@ s%@SLURPD_LIBS@%$SLURPD_LIBS%g
 s%@LDBM_LIBS@%$LDBM_LIBS%g
 s%@LTHREAD_LIBS@%$LTHREAD_LIBS%g
 s%@LUTIL_LIBS@%$LUTIL_LIBS%g
+s%@WRAP_LIBS@%$WRAP_LIBS%g
+s%@LINK_BINS_DYNAMIC@%$LINK_BINS_DYNAMIC%g
 s%@SLAPD_MODULES_CPPFLAGS@%$SLAPD_MODULES_CPPFLAGS%g
 s%@SLAPD_MODULES_LDFLAGS@%$SLAPD_MODULES_LDFLAGS%g
 s%@SLAPD_MODULES_LIST@%$SLAPD_MODULES_LIST%g
-s%@SLAPD_PERL_CPPFLAGS@%$SLAPD_PERL_CPPFLAGS%g
-s%@SLAPD_PERL_LDFLAGS@%$SLAPD_PERL_LDFLAGS%g
-s%@KRB_LIBS@%$KRB_LIBS%g
+s%@KRB4_LIBS@%$KRB4_LIBS%g
+s%@KRB5_LIBS@%$KRB5_LIBS%g
 s%@READLINE_LIBS@%$READLINE_LIBS%g
 s%@SASL_LIBS@%$SASL_LIBS%g
 s%@TERMCAP_LIBS@%$TERMCAP_LIBS%g
 s%@TLS_LIBS@%$TLS_LIBS%g
 s%@MODULES_LIBS@%$MODULES_LIBS%g
+s%@AUTH_LIBS@%$AUTH_LIBS%g
+s%@SLAPD_SQL_LDFLAGS@%$SLAPD_SQL_LDFLAGS%g
+s%@SLAPD_SQL_LIBS@%$SLAPD_SQL_LIBS%g
+s%@SLAPD_SQL_INCLUDES@%$SLAPD_SQL_INCLUDES%g
 
 CEOF
 EOF
@@ -14567,6 +17519,7 @@ clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
 clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
+clients/maildap/Makefile:build/top.mk:clients/maildap/Makefile.in:build/rules.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     \
@@ -14579,13 +17532,12 @@ libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.
 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/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-bdb2/Makefile:build/top.mk:servers/slapd/back-bdb2/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-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk \
 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/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-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk \
-servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/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/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
@@ -14593,7 +17545,6 @@ tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
 tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
 contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \
 contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \
-contrib/web_ldap/Makefile:build/top.mk:contrib/web_ldap/Makefile.in:build/rules.mk \
 "}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
@@ -14638,7 +17589,7 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
   rm -f "$ac_file"
   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
   case "$ac_file" in
-  *Makefile*) ac_comsub="1i\\
+  *[Mm]akefile*) ac_comsub="1i\\
 # $configure_input" ;;
   *) ac_comsub= ;;
   esac