]> git.sur5r.net Git - openldap/blobdiff - configure
Format %d -> %ld.
[openldap] / configure
index 23cbcde17acabb2b4a8a64bbf47587a6a98aa93a..2d1ffcd8542119e534609ae9e07665a44350960a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,17 +1,22 @@
 #! /bin/sh
 # $OpenLDAP$
-# from OpenLDAP: pkg/ldap/configure.in,v 1.399 2002/02/10 02:03:59 kurt Exp  
+# from OpenLDAP: pkg/ldap/configure.in,v 1.495 2003/11/26 03:17:26 kurt Exp  
 
-# Copyright 1998-2002 The OpenLDAP Foundation.  All Rights Reserved.
-# 
+# This work is part of OpenLDAP Software <http://www.openldap.org/>.
+#
+# Copyright 1998-2003 The OpenLDAP Foundation.
+# All rights reserved.
+#
 # 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.
+# Public License.
+#
+# A copy of this license is available in the file LICENSE in the
+# top-level directory of the distribution or, alternatively, at
+# <http://www.OpenLDAP.org/license.html>.
 
-echo "Copyright 1998-2002 The OpenLDAP Foundation,  All Rights Reserved."
-echo "Restrictions apply, see COPYRIGHT and LICENSE files."
+echo "Copyright 1998-2003 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 
@@ -29,32 +34,22 @@ ac_help="$ac_help
   --with-subdir=DIR       change default subdirectory used for installs"
 ac_help="$ac_help
   --enable-debug         enable debugging [yes]"
+ac_help="$ac_help
+  --enable-dynamic       enable linking built binaries with dynamic libs [no]"
 ac_help="$ac_help
   --enable-syslog        enable syslog support [auto]"
 ac_help="$ac_help
   --enable-proctitle     enable proctitle support [yes]"
-ac_help="$ac_help
-  --enable-cache         enable caching (experimental) [no]"
-ac_help="$ac_help
-  --enable-referrals     enable LDAPv2+ Referrals (experimental) [no]"
-ac_help="$ac_help
-  --enable-kbind         enable LDAPv2+ Kerberos IV bind (deprecated) [no]"
 ac_help="$ac_help
   --enable-ipv6          enable IPv6 support [auto]"
 ac_help="$ac_help
   --enable-local         enable AF_LOCAL (AF_UNIX) socket support [auto]"
-ac_help="$ac_help
-  --enable-rewrite       enable rewrite [no]"
 ac_help="$ac_help
   --enable-x-compile     enable cross compiling [no]"
 ac_help="$ac_help
   --with-cyrus-sasl      with Cyrus SASL support [auto]"
 ac_help="$ac_help
-  --with-fetch           with fetch URL support [auto]"
-ac_help="$ac_help
-  --with-kerberos        with Kerberos support [auto]"
-ac_help="$ac_help
-  --with-readline        with readline support [auto]"
+  --with-fetch           with fetch(3) URL support [auto]"
 ac_help="$ac_help
   --with-threads         with threads [auto]"
 ac_help="$ac_help
@@ -62,6 +57,7 @@ ac_help="$ac_help
 ac_help="$ac_help
   --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]"
@@ -71,10 +67,6 @@ ac_help="$ac_help
     --enable-cleartext   enable cleartext passwords [yes]"
 ac_help="$ac_help
     --enable-crypt       enable crypt(3) passwords [no]"
-ac_help="$ac_help
-    --enable-dynamic     enable linking built binaries with dynamic libs [no]"
-ac_help="$ac_help
-    --enable-kpasswd     enable Kerberos password verification [no]"
 ac_help="$ac_help
     --enable-lmpasswd    enable LAN Manager passwords [no]"
 ac_help="$ac_help
@@ -82,9 +74,11 @@ ac_help="$ac_help
 ac_help="$ac_help
     --enable-modules     enable dynamic module support [no]"
 ac_help="$ac_help
-    --enable-phonetic    enable phonetic/soundex [no]"
+    --enable-rewrite     enable DN rewriting in back-ldap and back-meta [no]"
+ac_help="$ac_help
+    --enable-rlookups    enable reverse lookups of client hostnames [no]"
 ac_help="$ac_help
-    --enable-rlookups    enable reverse lookups [no]"
+    --enable-slapi        enable SLAPI support (experimental) [no]"
 ac_help="$ac_help
     --enable-slp          enable SLPv2 support [no]"
 ac_help="$ac_help
@@ -92,56 +86,66 @@ ac_help="$ac_help
 ac_help="$ac_help
     --enable-bdb         enable Berkeley DB backend [yes]"
 ac_help="$ac_help
-    --with-bdb-module     module type [static]"
+    --with-bdb-module     module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-dnssrv      enable dnssrv backend [no]"
 ac_help="$ac_help
-    --with-dnssrv-module  module type [static]"
+    --with-dnssrv-module  module type static|dynamic [static]"
+ac_help="$ac_help
+    --enable-hdb         enable Hierarchical DB backend [no]"
+ac_help="$ac_help
+    --with-hdb-module     module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-ldap        enable ldap backend [no]"
 ac_help="$ac_help
-    --with-ldap-module   module type [static]"
+    --with-ldap-module   module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-ldbm        enable ldbm backend [no]"
 ac_help="$ac_help
-    --with-ldbm-api       with LDBM API [auto]"
+    --with-ldbm-api       with LDBM API auto|berkeley|bcompat|mdbm|gdbm [auto]"
 ac_help="$ac_help
-    --with-ldbm-module   module type [static]"
+    --with-ldbm-module   module type static|dynamic [static]"
 ac_help="$ac_help
-    --with-ldbm-type     use LDBM type [auto]"
+    --with-ldbm-type     use LDBM type auto|btree|hash [auto]"
 ac_help="$ac_help
     --enable-meta        enable metadirectory backend [no]"
 ac_help="$ac_help
-    --with-meta-module   module type [static]"
+    --with-meta-module   module type static|dynamic [static]"
 ac_help="$ac_help
-    --enable-monitor     enable monitor backend [no]"
+    --enable-monitor     enable monitor backend [yes]"
 ac_help="$ac_help
-    --with-monitor-module module type [static]"
+    --with-monitor-module module type static|dynamic [static]"
+ac_help="$ac_help
+    --enable-null        enable null backend [no]"
+ac_help="$ac_help
+    --with-null-module   module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-passwd      enable passwd backend [no]"
 ac_help="$ac_help
-    --with-passwd-module  module type [static]"
+    --with-passwd-module  module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-perl        enable perl backend [no]"
 ac_help="$ac_help
-    --with-perl-module   module type [static]"
+    --with-perl-module   module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-shell       enable shell backend [no]"
 ac_help="$ac_help
-    --with-shell-module          module type [static]"
+    --with-shell-module          module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-sql         enable sql backend [no]"
 ac_help="$ac_help
-    --with-sql-module    module type [static]"
+    --with-sql-module    module type static|dynamic [static]"
 ac_help="$ac_help
     --enable-tcl         enable tcl backend [no]"
 ac_help="$ac_help
-    --with-tcl-module    module type [static]"
+    --with-tcl-module    module type static|dynamic [static]"
 ac_help="$ac_help
+
 SLURPD (Replication Daemon) Options:"
 ac_help="$ac_help
   --enable-slurpd        enable building slurpd [auto]"
 ac_help="$ac_help
+
 Library Generation & Linking Options"
 ac_help="$ac_help
   --enable-static[=PKGS]  build static libraries [default=yes]"
@@ -314,6 +318,9 @@ ac_help="$ac_help
   --disable-libtool-lock  avoid locking (might break parallel builds)"
 ac_help="$ac_help
   --with-pic              try to use only PIC/non-PIC objects [default=use both]"
+ac_help="$ac_help
+
+See INSTALL file for further details."
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -854,15 +861,27 @@ if test -z "$OL_STRING"; then
        { echo "configure: error: could not determine version" 1>&2; exit 1; }
 fi
 
-ac_cv_shtool=$ac_aux_dir/shtool
-SHTOOL=$ac_cv_shtool
+if test -f "$ac_aux_dir/shtool" -a ! -d $ac_aux_dir/shtool; then
+       ac_cv_shtool="$ac_aux_dir/shtool"
+else
+       { echo "configure: error: no shtool found in $ac_aux_dir" 1>&2; exit 1; }
+fi
+
+SHTOOL="$ac_cv_shtool"
+
+TB="`$SHTOOL echo -e '%B' 2>/dev/null`"
+TN="`$SHTOOL echo -e '%b' 2>/dev/null`"
 
+OPENLDAP_CVS=""
+if test -d $ac_aux_dir/CVS; then
+       OPENLDAP_CVS="(from CVS sources) "
+fi
 
-$SHTOOL echo -e "Configuring %B${OL_STRING}%b ..."
+echo "Configuring ${TB}${OL_STRING}${TN} ${OPENLDAP_CVS}..."
 
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:866: checking host system type" >&5
+echo "configure:885: 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.
@@ -903,7 +922,7 @@ host_os=$ac_cv_host_os
 
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:907: checking target system type" >&5
+echo "configure:926: 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.
@@ -943,7 +962,7 @@ target_os=$ac_cv_target_os
 
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:947: checking build system type" >&5
+echo "configure:966: 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.
@@ -1020,7 +1039,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:1024: checking for a BSD compatible install" >&5
+echo "configure:1043: 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
@@ -1077,7 +1096,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:1081: checking whether build environment is sane" >&5
+echo "configure:1100: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -1138,7 +1157,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:1142: checking for $ac_word" >&5
+echo "configure:1161: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1168,7 +1187,7 @@ test -n "$AWK" && break
 done
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1172: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1191: 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
@@ -1208,7 +1227,7 @@ fi
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1212: checking for working aclocal" >&5
+echo "configure:1231: 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.
@@ -1221,7 +1240,7 @@ else
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1225: checking for working autoconf" >&5
+echo "configure:1244: 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.
@@ -1234,7 +1253,7 @@ else
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1238: checking for working automake" >&5
+echo "configure:1257: 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.
@@ -1247,7 +1266,7 @@ else
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1251: checking for working autoheader" >&5
+echo "configure:1270: 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.
@@ -1260,7 +1279,7 @@ else
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1264: checking for working makeinfo" >&5
+echo "configure:1283: 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.
@@ -1280,7 +1299,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:1284: checking for $ac_word" >&5
+echo "configure:1303: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1345,10 +1364,12 @@ EOF
 
 OPENLDAP_LIBVERSION=$OL_API_LIB
 
+OPENLDAP_RELEASE_DATE="$OL_RELEASE_DATE"
+
 
 
 echo $ac_n "checking configure arguments""... $ac_c" 1>&6
-echo "configure:1352: checking configure arguments" >&5
+echo "configure:1373: checking configure arguments" >&5
 
 
 top_builddir=`pwd`
@@ -1394,6 +1415,26 @@ else
        ol_enable_debug="yes"
 fi
 # end --enable-debug
+# 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
+               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-dynamic" 1>&2; exit 1; }
+       fi
+       ol_enable_dynamic="$ol_arg"
+
+else
+       ol_enable_dynamic="no"
+fi
+# end --enable-dynamic
 # OpenLDAP --enable-syslog
        # Check whether --enable-syslog or --disable-syslog was given.
 if test "${enable_syslog+set}" = set; then
@@ -1434,66 +1475,8 @@ else
        ol_enable_proctitle="yes"
 fi
 # end --enable-proctitle
-# OpenLDAP --enable-cache
-       # Check whether --enable-cache or --disable-cache was given.
-if test "${enable_cache+set}" = set; then
-  enableval="$enable_cache"
-  
-       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-cache" 1>&2; exit 1; }
-       fi
-       ol_enable_cache="$ol_arg"
-
-else
-       ol_enable_cache="no"
-fi
-# end --enable-cache
-# 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
-               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-referrals" 1>&2; exit 1; }
-       fi
-       ol_enable_referrals="$ol_arg"
-
-else
-       ol_enable_referrals="no"
-fi
-# 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
-               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-kbind" 1>&2; exit 1; }
-       fi
-       ol_enable_kbind="$ol_arg"
-
-else
-       ol_enable_kbind="no"
-fi
-# end --enable-kbind
+ol_enable_referrals=${ol_enable_referrals-no}
+ol_enable_kbind=${ol_enable_kbind-no}
 # OpenLDAP --enable-ipv6
        # Check whether --enable-ipv6 or --disable-ipv6 was given.
 if test "${enable_ipv6+set}" = set; then
@@ -1534,26 +1517,6 @@ else
        ol_enable_local="auto"
 fi
 # end --enable-local
-# OpenLDAP --enable-rewrite
-       # Check whether --enable-rewrite or --disable-rewrite was given.
-if test "${enable_rewrite+set}" = set; then
-  enableval="$enable_rewrite"
-  
-       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-rewrite" 1>&2; exit 1; }
-       fi
-       ol_enable_rewrite="$ol_arg"
-
-else
-       ol_enable_rewrite="no"
-fi
-# end --enable-rewrite
 # OpenLDAP --enable-x_compile
        # Check whether --enable-x_compile or --disable-x_compile was given.
 if test "${enable_x_compile+set}" = set; then
@@ -1618,48 +1581,7 @@ else
 fi
 # end --with-fetch
 
-# OpenLDAP --with-kerberos
-       # Check whether --with-kerberos or --without-kerberos was given.
-if test "${with_kerberos+set}" = set; then
-  withval="$with_kerberos"
-  
-       ol_arg=invalid
-       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
-       done
-       if test "$ol_arg" = "invalid" ; then
-               { echo "configure: error: bad value $withval for --with-kerberos" 1>&2; exit 1; }
-       fi
-       ol_with_kerberos="$ol_arg"
-
-else
-       ol_with_kerberos="auto"
-fi
-# end --with-kerberos
-
-# OpenLDAP --with-readline
-       # Check whether --with-readline or --without-readline was given.
-if test "${with_readline+set}" = set; then
-  withval="$with_readline"
-  
-       ol_arg=invalid
-       for ol_val in auto yes no  ; 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-readline" 1>&2; exit 1; }
-       fi
-       ol_with_readline="$ol_arg"
-
-else
-       ol_with_readline="auto"
-fi
-# end --with-readline
-
+ol_with_kerberos=${ol_with_kerberos-auto}
 # OpenLDAP --with-threads
        # Check whether --with-threads or --without-threads was given.
 if test "${with_threads+set}" = set; then
@@ -1811,46 +1733,7 @@ else
        ol_enable_crypt="no"
 fi
 # end --enable-crypt
-# 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
-               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-dynamic" 1>&2; exit 1; }
-       fi
-       ol_enable_dynamic="$ol_arg"
-
-else
-       ol_enable_dynamic="no"
-fi
-# end --enable-dynamic
-# 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
-               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-kpasswd" 1>&2; exit 1; }
-       fi
-       ol_enable_kpasswd="$ol_arg"
-
-else
-       ol_enable_kpasswd="no"
-fi
-# end --enable-kpasswd
+ol_enable_kpasswd=${ol_enable_kpasswd-no}
 # OpenLDAP --enable-lmpasswd
        # Check whether --enable-lmpasswd or --disable-lmpasswd was given.
 if test "${enable_lmpasswd+set}" = set; then
@@ -1911,10 +1794,11 @@ else
        ol_enable_modules="no"
 fi
 # 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_enable_multimaster=${ol_enable_multimaster-no}
+# OpenLDAP --enable-rewrite
+       # Check whether --enable-rewrite or --disable-rewrite was given.
+if test "${enable_rewrite+set}" = set; then
+  enableval="$enable_rewrite"
   
        ol_arg=invalid
        for ol_val in auto yes no ; do
@@ -1923,14 +1807,14 @@ 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-rewrite" 1>&2; exit 1; }
        fi
-       ol_enable_phonetic="$ol_arg"
+       ol_enable_rewrite="$ol_arg"
 
 else
-       ol_enable_phonetic="no"
+       ol_enable_rewrite="no"
 fi
-# end --enable-phonetic
+# end --enable-rewrite
 # OpenLDAP --enable-rlookups
        # Check whether --enable-rlookups or --disable-rlookups was given.
 if test "${enable_rlookups+set}" = set; then
@@ -1951,6 +1835,26 @@ else
        ol_enable_rlookups="no"
 fi
 # end --enable-rlookups
+# OpenLDAP --enable-slapi
+       # Check whether --enable-slapi or --disable-slapi was given.
+if test "${enable_slapi+set}" = set; then
+  enableval="$enable_slapi"
+  
+       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-slapi" 1>&2; exit 1; }
+       fi
+       ol_enable_slapi="$ol_arg"
+
+else
+       ol_enable_slapi="no"
+fi
+# end --enable-slapi
 # OpenLDAP --enable-slp
        # Check whether --enable-slp or --disable-slp was given.
 if test "${enable_slp+set}" = set; then
@@ -1992,6 +1896,7 @@ else
 fi
 # end --enable-wrappers
 
+
 # OpenLDAP --enable-bdb
        # Check whether --enable-bdb or --disable-bdb was given.
 if test "${enable_bdb+set}" = set; then
@@ -2074,6 +1979,47 @@ else
 fi
 # end --with-dnssrv_module
 
+# OpenLDAP --enable-hdb
+       # Check whether --enable-hdb or --disable-hdb was given.
+if test "${enable_hdb+set}" = set; then
+  enableval="$enable_hdb"
+  
+       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-hdb" 1>&2; exit 1; }
+       fi
+       ol_enable_hdb="$ol_arg"
+
+else
+       ol_enable_hdb="no"
+fi
+# end --enable-hdb
+# OpenLDAP --with-hdb_module
+       # Check whether --with-hdb_module or --without-hdb_module was given.
+if test "${with_hdb_module+set}" = set; then
+  withval="$with_hdb_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-hdb_module" 1>&2; exit 1; }
+       fi
+       ol_with_hdb_module="$ol_arg"
+
+else
+       ol_with_hdb_module="static"
+fi
+# end --with-hdb_module
+
 # OpenLDAP --enable-ldap
        # Check whether --enable-ldap or --disable-ldap was given.
 if test "${enable_ldap+set}" = set; then
@@ -2256,7 +2202,7 @@ if test "${enable_monitor+set}" = set; then
        ol_enable_monitor="$ol_arg"
 
 else
-       ol_enable_monitor="no"
+       ol_enable_monitor="yes"
 fi
 # end --enable-monitor
 # OpenLDAP --with-monitor_module
@@ -2280,6 +2226,47 @@ else
 fi
 # end --with-monitor_module
 
+# OpenLDAP --enable-null
+       # Check whether --enable-null or --disable-null was given.
+if test "${enable_null+set}" = set; then
+  enableval="$enable_null"
+  
+       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-null" 1>&2; exit 1; }
+       fi
+       ol_enable_null="$ol_arg"
+
+else
+       ol_enable_null="no"
+fi
+# end --enable-null
+# OpenLDAP --with-null_module
+       # Check whether --with-null_module or --without-null_module was given.
+if test "${with_null_module+set}" = set; then
+  withval="$with_null_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-null_module" 1>&2; exit 1; }
+       fi
+       ol_with_null_module="$ol_arg"
+
+else
+       ol_with_null_module="static"
+fi
+# end --with-null_module
+
 # OpenLDAP --enable-passwd
        # Check whether --enable-passwd or --disable-passwd was given.
 if test "${enable_passwd+set}" = set; then
@@ -2569,12 +2556,18 @@ fi
 
 # validate options
 if test $ol_enable_slapd = no ; then
-               if test $ol_enable_bdb = yes ; then
+               if test $ol_enable_slapi = yes ; then
+               echo "configure: warning: slapd disabled, ignoring --enable-slapi argument" 1>&2
+       fi
+       if test $ol_enable_bdb = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-bdb argument" 1>&2
        fi
        if test $ol_enable_dnssrv = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-dnssrv argument" 1>&2
        fi
+       if test $ol_enable_hdb = yes ; then
+               echo "configure: warning: slapd disabled, ignoring --enable-hdb argument" 1>&2
+       fi
        if test $ol_enable_ldap = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-ldap argument" 1>&2
        fi
@@ -2587,6 +2580,9 @@ if test $ol_enable_slapd = no ; then
        if test $ol_enable_monitor = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-monitor argument" 1>&2
        fi
+       if test $ol_enable_null = yes ; then
+               echo "configure: warning: slapd disabled, ignoring --enable-null argument" 1>&2
+       fi
        if test $ol_enable_passwd = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-passwd argument" 1>&2
        fi
@@ -2605,12 +2601,12 @@ if test $ol_enable_slapd = no ; then
        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_rlookups = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable-rlookups argument" 1>&2
        fi
@@ -2629,6 +2625,9 @@ if test $ol_enable_slapd = no ; then
        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_hdb_module != static ; then
+               echo "configure: warning: slapd disabled, ignoring --with-hdb-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
        fi
@@ -2641,6 +2640,9 @@ if test $ol_enable_slapd = no ; then
        if test $ol_with_monitor_module != static ; then
                echo "configure: warning: slapd disabled, ignoring --with-monitor-module argument" 1>&2
        fi
+       if test $ol_with_null_module != static ; then
+               echo "configure: warning: slapd disabled, ignoring --with-null-module argument" 1>&2
+       fi
        if test $ol_with_passwd_module != static ; then
                echo "configure: warning: slapd disabled, ignoring --with-passwd-module argument" 1>&2
        fi
@@ -2664,12 +2666,15 @@ if test $ol_enable_slapd = no ; then
        fi
 
        # force settings to no
+       ol_enable_slapi=no
        ol_enable_bdb=no
        ol_enable_dnssrv=no
+       ol_enable_hdb=no
        ol_enable_ldap=no
        ol_enable_ldbm=no
        ol_enable_meta=no
        ol_enable_monitor=no
+       ol_enable_null=no
        ol_enable_passwd=no
        ol_enable_perl=no
        ol_enable_shell=no
@@ -2677,7 +2682,7 @@ if test $ol_enable_slapd = no ; then
        ol_enable_sql=no
 
        ol_enable_modules=no
-       ol_enable_phonetic=no
+       ol_enable_multimaster=no
        ol_enable_rlookups=no
        ol_enable_aci=no
        ol_enable_wrappers=no
@@ -2688,10 +2693,12 @@ if test $ol_enable_slapd = no ; then
 
        ol_with_bdb_module=static
        ol_with_dnssrv_module=static
+       ol_with_hdb_module=static
        ol_with_ldap_module=static
        ol_with_ldbm_module=static
        ol_with_meta_module=static
        ol_with_monitor_module=static
+       ol_with_null_module=static
        ol_with_passwd_module=static
        ol_with_perl_module=static
        ol_with_shell_module=static
@@ -2719,9 +2726,11 @@ elif test $ol_enable_ldbm = no ; then
        if test $ol_enable_modules != yes -a \
                $ol_enable_bdb = no -a \
                $ol_enable_dnssrv = no -a \
+               $ol_enable_hdb = no -a \
                $ol_enable_ldap = no -a \
                $ol_enable_meta = no -a \
                $ol_enable_monitor = no -a \
+               $ol_enable_null = no -a \
                $ol_enable_passwd = no -a \
                $ol_enable_perl = no -a \
                $ol_enable_shell = no -a \
@@ -2740,7 +2749,7 @@ elif test $ol_enable_ldbm = no ; then
        ol_with_ldbm_type=no
        ol_with_ldbm_module=static
 
-       if test $ol_enable_bdb != no ; then
+       if test $ol_enable_bdb != no -o $ol_enable_hdb != no; then
                ol_with_ldbm_api=berkeley
        fi
 
@@ -2758,11 +2767,11 @@ else
                { echo "configure: error: NDBM only supports LDBM type hash" 1>&2; exit 1; }
        fi
 
-       if test $ol_enable_bdb = yes ; then
+       if test $ol_enable_bdb = yes -o $ol_enable_hdb = yes ; then
                if test $ol_with_ldbm_api = auto ; then
                        ol_with_ldbm_api=berkeley
                elif test $ol_with_ldbm_api != berkeley ; then
-                       { echo "configure: error: LDBM API not compatible with BDB" 1>&2; exit 1; }
+                       { echo "configure: error: LDBM API not compatible with BDB/HDB" 1>&2; exit 1; }
                fi
 
        elif test $ol_enable_bdb = auto ; then
@@ -2812,8 +2821,6 @@ fi
 echo "$ac_t""done" 1>&6
 
 LDAP_LIBS=
-LDIF_LIBS=
-LDBM_LIB=
 LDBM_LIBS=
 LTHREAD_LIBS=
 LUTIL_LIBS=
@@ -2826,12 +2833,18 @@ BUILD_SLURPD=no
 
 BUILD_THREAD=no
 
+BUILD_SLAPI=no
+SLAPD_SLAPI_DEPEND=
+
 BUILD_BDB=no
 BUILD_DNSSRV=no
+BUILD_HDB=no
 BUILD_LDAP=no
 BUILD_LDBM=no
 BUILD_META=no
 BUILD_MONITOR=no
+BUILD_CACHE=no
+BUILD_NULL=no
 BUILD_PASSWD=no
 BUILD_PERL=no
 BUILD_SHELL=no
@@ -2840,10 +2853,12 @@ BUILD_TCL=no
 
 BUILD_BDB_DYNAMIC=static
 BUILD_DNSSRV_DYNAMIC=static
+BUILD_HDB_DYNAMIC=static
 BUILD_LDAP_DYNAMIC=static
 BUILD_LDBM_DYNAMIC=static
 BUILD_META_DYNAMIC=static
 BUILD_MONITOR_DYNAMIC=static
+BUILD_NULL_DYNAMIC=static
 BUILD_PASSWD_DYNAMIC=static
 BUILD_PERL_DYNAMIC=static
 BUILD_SHELL_DYNAMIC=static
@@ -2852,7 +2867,6 @@ BUILD_SQL_DYNAMIC=static
 
 SLAPD_MODULES_LDFLAGS=
 SLAPD_MODULES_CPPFLAGS=
-SLAPD_MODULES_LIST=
 
 SLAPD_STATIC_BACKENDS=
 SLAPD_DYNAMIC_BACKENDS=
@@ -2868,30 +2882,100 @@ SLAPD_SQL_INCLUDES=
 MOD_TCL_LIB=
 KRB4_LIBS=
 KRB5_LIBS=
-READLINE_LIBS=
 SASL_LIBS=
 TERMCAP_LIBS=
 TLS_LIBS=
 MODULES_LIBS=
+SLAPI_LIBS=
+LIBSLAPI=
+LIBSLAPITOOLS=
 AUTH_LIBS=
 
 SLAPD_SLP_LIBS=
 
 
-
-cat >> confdefs.h <<\EOF
-#define HAVE_MKVERSION 1
-EOF
-
-
-
-
-ol_aix_threads=no
-case "$target" in
-*-*-aix*)      if test -z "$CC" ; then
-               case "$ol_with_threads" in
-               auto | yes |  posix) ol_aix_threads=yes ;;
-               esac
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# 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:2910: 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
+else
+    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+         if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$ac_dir/$ac_prog -c"
+           break 2
+         fi
+       fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+cat >> confdefs.h <<\EOF
+#define HAVE_MKVERSION 1
+EOF
+
+
+
+
+ol_aix_threads=no
+case "$target" in
+*-*-aix*)      if test -z "$CC" ; then
+               case "$ol_with_threads" in
+               auto | yes |  posix) ol_aix_threads=yes ;;
+               esac
        fi
 ;;
 esac
@@ -2903,7 +2987,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:2907: checking for $ac_word" >&5
+echo "configure:2991: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2950,12 +3034,12 @@ done
 fi
 
 if test -z "${CC}"; then
-       for ac_prog in cc
+       for ac_prog in cc gcc
 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:2959: checking for $ac_word" >&5
+echo "configure:3043: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2983,16 +3067,21 @@ fi
 
 test -n "$CC" && break
 done
+test -n "$CC" || CC="missing"
 
-fi
 
+       if test "${CC}" = "missing" ; then
+               { echo "configure: error: Unable to locate cc(1) or suitable replacement.  Check PATH or set CC." 1>&2; exit 1; }
+       fi
+fi
 
-for ac_prog in ar gar
+if test -z "${AR}"; then
+       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:2996: checking for $ac_word" >&5
+echo "configure:3085: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_AR+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3020,9 +3109,14 @@ fi
 
 test -n "$AR" && break
 done
-test -n "$AR" || AR="ar"
+test -n "$AR" || AR="missing"
 
 
+       if test "${AR}" = "missing" ; then
+               { echo "configure: error: Unable to locate ar(1) or suitable replacement.  Check PATH or set AR." 1>&2; exit 1; }
+       fi
+fi
+
 
 
 # Find the correct PATH separator.  Usually this is `:', but
@@ -3037,12 +3131,12 @@ if test "X${PATH_SEPARATOR+set}" != Xset; then
 fi
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:3041: checking for Cygwin environment" >&5
+echo "configure:3135: 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 3046 "configure"
+#line 3140 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3053,7 +3147,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:3057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -3069,19 +3163,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:3073: checking for mingw32 environment" >&5
+echo "configure:3167: 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 3078 "configure"
+#line 3172 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:3085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -3097,19 +3191,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:3101: checking for EMX OS/2 environment" >&5
+echo "configure:3195: 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 3106 "configure"
+#line 3200 "configure"
 #include "confdefs.h"
 
 int main() {
 return __EMX__;
 ; return 0; }
 EOF
-if { (eval echo configure:3113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3207: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_emxos2=yes
 else
@@ -3125,7 +3219,7 @@ echo "$ac_t""$ac_cv_emxos2" 1>&6
 EMXOS2=
 test "$ac_cv_emxos2" = yes && EMXOS2=yes
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:3129: checking how to run the C preprocessor" >&5
+echo "configure:3223: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -3140,13 +3234,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 3144 "configure"
+#line 3238 "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:3150: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3244: \"$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
   :
@@ -3157,13 +3251,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 3161 "configure"
+#line 3255 "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:3167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3261: \"$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
   :
@@ -3174,13 +3268,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 3178 "configure"
+#line 3272 "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:3184: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3278: \"$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
   :
@@ -3230,7 +3324,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:3234: checking for $ac_word" >&5
+echo "configure:3328: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3260,7 +3354,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:3264: checking for $ac_word" >&5
+echo "configure:3358: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3311,7 +3405,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:3315: checking for $ac_word" >&5
+echo "configure:3409: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3343,7 +3437,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:3347: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
+echo "configure:3441: 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.
@@ -3354,12 +3448,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 3358 "configure"
+#line 3452 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:3363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3457: \"$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
@@ -3385,12 +3479,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:3389: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:3483: 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:3394: checking whether we are using GNU C" >&5
+echo "configure:3488: 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
@@ -3399,7 +3493,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:3403: \"$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:3497: \"$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
@@ -3418,7 +3512,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:3422: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:3516: 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
@@ -3461,7 +3555,7 @@ ac_prog=ld
 if test "$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:3465: checking for ld used by GCC" >&5
+echo "configure:3559: checking for ld used by GCC" >&5
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -3491,10 +3585,10 @@ echo "configure:3465: 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:3495: checking for GNU ld" >&5
+echo "configure:3589: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:3498: checking for non-GNU ld" >&5
+echo "configure:3592: checking for non-GNU ld" >&5
 fi
 if eval "test \"\${lt_cv_path_LD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3529,7 +3623,7 @@ else
 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:3533: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:3627: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"\${lt_cv_prog_gnu_ld+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3546,7 +3640,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
 echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:3550: checking for $LD option to reload object files" >&5
+echo "configure:3644: checking for $LD option to reload object files" >&5
 if eval "test \"\${lt_cv_ld_reload_flag+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3558,7 +3652,7 @@ reload_flag=$lt_cv_ld_reload_flag
 test -n "$reload_flag" && reload_flag=" $reload_flag"
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:3562: checking for BSD-compatible nm" >&5
+echo "configure:3656: checking for BSD-compatible nm" >&5
 if eval "test \"\${lt_cv_path_NM+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3595,8 +3689,92 @@ fi
 NM="$lt_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
+echo $ac_n "checking for a sed that does not truncate output""... $ac_c" 1>&6
+echo "configure:3694: checking for a sed that does not truncate output" >&5
+if eval "test \"\${lt_cv_path_SED+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+
+fi
+
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+echo "$ac_t""$SED" 1>&6
+
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3600: checking whether ln -s works" >&5
+echo "configure:3778: 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
@@ -3616,8 +3794,8 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
-echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:3621: checking how to recognise dependant libraries" >&5
+echo $ac_n "checking how to recognise dependent libraries""... $ac_c" 1>&6
+echo "configure:3799: checking how to recognise dependent libraries" >&5
 if eval "test \"\${lt_cv_deplibs_check_method+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3694,9 +3872,9 @@ hpux10.20*|hpux11*)
   lt_cv_file_magic_test_file=/usr/lib/libc.sl
   ;;
 
-irix5* | irix6*)
+irix5* | irix6* | nonstopux*)
   case $host_os in
-  irix5*)
+  irix5* | nonstopux*)
     # this will be overridden with pass_all, but let us keep it just in case
     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
     ;;
@@ -3718,7 +3896,7 @@ irix5* | irix6*)
 # This must be Linux ELF.
 linux-gnu*)
   case $host_cpu in
-  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
     lt_cv_deplibs_check_method=pass_all ;;
   *)
     # glibc up to 2.1.1 does not perform some relocations on ARM
@@ -3789,6 +3967,9 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
     lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
     lt_cv_file_magic_test_file=/lib/libc.so
     ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
   esac
   ;;
 esac
@@ -3800,13 +3981,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:3804: checking for object suffix" >&5
+echo "configure:3985: 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:3810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -3827,7 +4008,7 @@ ac_objext=$ac_cv_objext
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:3831: checking for executable suffix" >&5
+echo "configure:4012: checking for executable suffix" >&5
 if eval "test \"\${ac_cv_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3837,7 +4018,7 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:3841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:4022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.C | *.o | *.obj | *.xcoff) ;;
@@ -3868,7 +4049,7 @@ fi
 
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
-echo "configure:3872: checking command to parse $NM output" >&5
+echo "configure:4053: checking command to parse $NM output" >&5
 if eval "test \"\${lt_cv_sys_global_symbol_pipe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3903,9 +4084,12 @@ hpux*) # Its linker distinguishes data from code symbols
   lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
   lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
   ;;
-irix*)
+irix* | nonstopux*)
   symcode='[BCDEGRST]'
   ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
 solaris* | sysv5*)
   symcode='[BDT]'
   ;;
@@ -3948,10 +4132,10 @@ void nm_test_func(){}
 int main(){nm_test_var='a';nm_test_func();return(0);}
 EOF
 
-  if { (eval echo configure:3952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  if { (eval echo configure:4136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { (eval echo configure:3955: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+    if { (eval echo configure:4139: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
        mv -f "$nlist"T "$nlist"
@@ -4002,7 +4186,7 @@ EOF
          save_CFLAGS="$CFLAGS"
          LIBS="conftstm.$ac_objext"
          CFLAGS="$CFLAGS$no_builtin_flag"
-         if { (eval echo configure:4006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+         if { (eval echo configure:4190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
            pipe_works=yes
          fi
          LIBS="$save_LIBS"
@@ -4051,17 +4235,17 @@ for ac_hdr in dlfcn.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4055: checking for $ac_hdr" >&5
+echo "configure:4239: 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 4060 "configure"
+#line 4244 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4065: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4249: \"$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*
@@ -4091,12 +4275,13 @@ done
 
 
 
+
 # Only perform the check for file, if the check method requires it
 case $deplibs_check_method in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:4100: checking for ${ac_tool_prefix}file" >&5
+echo "configure:4285: checking for ${ac_tool_prefix}file" >&5
 if eval "test \"\${lt_cv_path_MAGIC_CMD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4158,7 +4343,7 @@ fi
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:4162: checking for file" >&5
+echo "configure:4347: checking for file" >&5
 if eval "test \"\${lt_cv_path_MAGIC_CMD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4229,7 +4414,7 @@ esac
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4233: checking for $ac_word" >&5
+echo "configure:4418: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4261,7 +4446,7 @@ if test -n "$ac_tool_prefix"; then
   # 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:4265: checking for $ac_word" >&5
+echo "configure:4450: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4296,7 +4481,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4300: checking for $ac_word" >&5
+echo "configure:4485: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_STRIP+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4328,7 +4513,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4332: checking for $ac_word" >&5
+echo "configure:4517: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_STRIP+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4377,8 +4562,8 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 case $host in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4381 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:4382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 4566 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:4567: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case `/usr/bin/file conftest.$ac_objext` in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -4399,7 +4584,7 @@ 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:4403: checking whether the C compiler needs -belf" >&5
+echo "configure:4588: 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
@@ -4412,14 +4597,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
 cross_compiling=$ac_cv_prog_cc_cross
 
      cat > conftest.$ac_ext <<EOF
-#line 4416 "configure"
+#line 4601 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4608: \"$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
@@ -4449,7 +4634,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
   # 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:4453: checking for $ac_word" >&5
+echo "configure:4638: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_DLLTOOL+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4481,7 +4666,7 @@ 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:4485: checking for $ac_word" >&5
+echo "configure:4670: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_DLLTOOL+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4516,7 +4701,7 @@ 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:4520: checking for $ac_word" >&5
+echo "configure:4705: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_AS+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4548,7 +4733,7 @@ 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:4552: checking for $ac_word" >&5
+echo "configure:4737: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_AS+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4583,7 +4768,7 @@ 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:4587: checking for $ac_word" >&5
+echo "configure:4772: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_OBJDUMP+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4615,7 +4800,7 @@ 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:4619: checking for $ac_word" >&5
+echo "configure:4804: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_prog_OBJDUMP+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4651,12 +4836,12 @@ fi
   # recent cygwin and mingw systems supply a stub DllMain which the user
   # can override, but on older systems we have to supply one
   echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6
-echo "configure:4655: checking if libtool should supply DllMain function" >&5
+echo "configure:4840: checking if libtool should supply DllMain function" >&5
 if eval "test \"\${lt_cv_need_dllmain+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4660 "configure"
+#line 4845 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4664,7 +4849,7 @@ extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
       DllMain (0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:4668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_need_dllmain=no
 else
@@ -4685,19 +4870,19 @@ echo "$ac_t""$lt_cv_need_dllmain" 1>&6
     SAVE_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS -mdll"
     echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6
-echo "configure:4689: checking how to link DLLs" >&5
+echo "configure:4874: checking how to link DLLs" >&5
 if eval "test \"\${lt_cv_cc_dll_switch+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4694 "configure"
+#line 4879 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_dll_switch=-mdll
 else
@@ -4811,7 +4996,7 @@ set dummy $CC
 compiler="$2"
 
 echo $ac_n "checking for objdir""... $ac_c" 1>&6
-echo "configure:4815: checking for objdir" >&5
+echo "configure:5000: checking for objdir" >&5
 rm -f .libs 2>/dev/null
 mkdir .libs 2>/dev/null
 if test -d .libs; then
@@ -4838,7 +5023,7 @@ test -z "$pic_mode" && pic_mode=default
 # in isolation, and that seeing it set (from the cache) indicates that
 # the associated values are set (in the cache) correctly too.
 echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
-echo "configure:4842: checking for $compiler option to produce PIC" >&5
+echo "configure:5027: checking for $compiler option to produce PIC" >&5
 if eval "test \"\${lt_cv_prog_cc_pic+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4869,7 +5054,7 @@ else
       # like `-m68040'.
       lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
       ;;
-    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
     darwin* | rhapsody*)
@@ -4912,7 +5097,7 @@ else
       lt_cv_prog_cc_pic='+Z'
       ;;
 
-    irix5* | irix6*)
+    irix5* | irix6* | nonstopux*)
       lt_cv_prog_cc_wl='-Wl,'
       lt_cv_prog_cc_static='-non_shared'
       # PIC (with -KPIC) is the default.
@@ -4956,11 +5141,7 @@ else
     sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
       lt_cv_prog_cc_pic='-KPIC'
       lt_cv_prog_cc_static='-Bstatic'
-      if test "x$host_vendor" = xsni; then
-       lt_cv_prog_cc_wl='-LD'
-      else
-       lt_cv_prog_cc_wl='-Wl,'
-      fi
+      lt_cv_prog_cc_wl='-Wl,'
       ;;
 
     uts4*)
@@ -4990,21 +5171,21 @@ else
 
   # Check to make sure the pic_flag actually works.
   echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
-echo "configure:4994: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+echo "configure:5175: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
   if eval "test \"\${lt_cv_prog_cc_pic_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
       save_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
     cat > conftest.$ac_ext <<EOF
-#line 5001 "configure"
+#line 5182 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
         case $host_os in
       hpux9* | hpux10* | hpux11*)
@@ -5056,7 +5237,7 @@ if test -n "$lt_cv_prog_cc_shlib"; then
 fi
 
 echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
-echo "configure:5060: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+echo "configure:5241: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
 if eval "test \"\${lt_cv_prog_cc_static_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5064,14 +5245,14 @@ else
   save_LDFLAGS="$LDFLAGS"
   LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
   cat > conftest.$ac_ext <<EOF
-#line 5068 "configure"
+#line 5249 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_prog_cc_static_works=yes
 else
@@ -5098,7 +5279,7 @@ can_build_shared="$lt_cv_prog_cc_can_build_shared"
 
 # Check to see if options -o and -c are simultaneously supported by compiler
 echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
-echo "configure:5102: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo "configure:5283: checking if $compiler supports -c -o file.$ac_objext" >&5
 if eval "test \"\${lt_cv_compiler_c_o+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5117,7 +5298,7 @@ chmod -w .
 save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
 compiler_c_o=no
-if { (eval echo configure:5121: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:5302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
   # The compiler can only warn and ignore the option if not recognized
   # So say no if there are warnings
   if test -s out/conftest.err; then
@@ -5146,7 +5327,7 @@ echo "$ac_t""$compiler_c_o" 1>&6
 if test x"$compiler_c_o" = x"yes"; then
   # Check to see if we can write to a .lo
   echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
-echo "configure:5150: checking if $compiler supports -c -o file.lo" >&5
+echo "configure:5331: checking if $compiler supports -c -o file.lo" >&5
   if eval "test \"\${lt_cv_compiler_o_lo+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5157,14 +5338,14 @@ else
   save_objext="$ac_objext"
   ac_objext=lo
   cat > conftest.$ac_ext <<EOF
-#line 5161 "configure"
+#line 5342 "configure"
 #include "confdefs.h"
 
 int main() {
 int some_variable = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:5168: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
       # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings
@@ -5195,7 +5376,7 @@ hard_links="nottested"
 if test "$compiler_c_o" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
   echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
-echo "configure:5199: checking if we can lock with hard links" >&5
+echo "configure:5380: checking if we can lock with hard links" >&5
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
@@ -5214,20 +5395,20 @@ fi
 if test "$GCC" = yes; then
   # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
   echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
-echo "configure:5218: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo "configure:5399: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
   echo "int some_variable = 0;" > conftest.$ac_ext
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
   compiler_rtti_exceptions=no
   cat > conftest.$ac_ext <<EOF
-#line 5224 "configure"
+#line 5405 "configure"
 #include "confdefs.h"
 
 int main() {
 int some_variable = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:5231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5412: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
       # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings
@@ -5254,7 +5435,7 @@ fi
 
 # See if the linker supports building shared libraries.
 echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
-echo "configure:5258: checking whether the linker ($LD) supports shared libraries" >&5
+echo "configure:5439: checking whether the linker ($LD) supports shared libraries" >&5
 
 allow_undefined_flag=
 no_undefined_flag=
@@ -5410,7 +5591,7 @@ EOF
     # If the export-symbols file already is a .def file (1st line
     # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
        cp $export_symbols $output_objdir/$soname-def;
       else
        echo EXPORTS > $output_objdir/$soname-def;
@@ -5419,6 +5600,7 @@ EOF
         set dummy \$symbol;
         case \$# in
           2) echo "   \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+          4) echo "   \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
           *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
         esac;
         _lt_hint=`expr 1 + \$_lt_hint`;
@@ -5531,10 +5713,12 @@ else
       # need to do runtime linking.
       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
        for ld_flag in $LDFLAGS; do
-         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+         case $ld_flag in
+         *-brtl*)
            aix_use_runtimelinking=yes
            break
-         fi
+         ;;
+         esac
        done
       esac
 
@@ -5648,8 +5832,9 @@ else
     esac
     # FIXME: Relying on posixy $() will cause problems for
     #        cross-compilation, but unfortunately the echo tests do not
-    #        yet detect zsh echo's removal of \ escapes.
-    archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring'
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #       `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
     # We need to add '_' to the symbols in $export_symbols first
     #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
     hardcode_direct=yes
@@ -5701,13 +5886,14 @@ else
     export_dynamic_flag_spec='${wl}-E'
     ;;
 
-  irix5* | irix6*)
+  irix5* | irix6* | nonstopux*)
     if test "$GCC" = yes; then
       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     else
       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
     fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     hardcode_libdir_separator=:
     link_all_deplibs=yes
     ;;
@@ -5735,7 +5921,7 @@ else
     hardcode_direct=yes
     hardcode_shlibpath_var=no
     if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
       export_dynamic_flag_spec='${wl}-E'
     else
@@ -5745,7 +5931,7 @@ else
        hardcode_libdir_flag_spec='-R$libdir'
         ;;
       *)
-        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
         hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
         ;;
       esac
@@ -5857,13 +6043,23 @@ EOF
     ;;
 
   sysv4)
-    if test "x$host_vendor" = xsno; then
-      archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes # is this really true???
-    else
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=no #Motorola manual says yes, but my tests say they lie
-    fi
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
     runpath_var='LD_RUN_PATH'
     hardcode_shlibpath_var=no
     ;;
@@ -5938,7 +6134,7 @@ test "$ld_shlibs" = no && can_build_shared=no
 
 # Check hardcoding attributes.
 echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
-echo "configure:5942: checking how to hardcode library paths into programs" >&5
+echo "configure:6138: checking how to hardcode library paths into programs" >&5
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" || \
    test -n "$runpath_var"; then
@@ -5966,7 +6162,7 @@ echo "$ac_t""$hardcode_action" 1>&6
 striplib=
 old_striplib=
 echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
-echo "configure:5970: checking whether stripping libraries is possible" >&5
+echo "configure:6166: checking whether stripping libraries is possible" >&5
 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
@@ -5980,7 +6176,7 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 # PORTME Fill in your ld.so characteristics
 echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
-echo "configure:5984: checking dynamic linker characteristics" >&5
+echo "configure:6180: checking dynamic linker characteristics" >&5
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -6007,6 +6203,9 @@ aix3*)
 
 aix4* | aix5*)
   version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
   if test "$host_cpu" = ia64; then
     # AIX 5 supports IA64
     library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
@@ -6045,6 +6244,7 @@ aix4* | aix5*)
     fi
     shlibpath_var=LIBPATH
   fi
+  hardcode_into_libs=yes
   ;;
 
 amigaos*)
@@ -6092,7 +6292,7 @@ cygwin* | mingw* | pw32*)
     ;;
   yes,mingw*)
     library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
-    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
     ;;
   yes,pw32*)
     library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll'
@@ -6175,14 +6375,17 @@ hpux9* | hpux10* | hpux11*)
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-irix5* | irix6*)
-  version_type=irix
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
   need_lib_prefix=no
   need_version=no
   soname_spec='${libname}${release}.so$major'
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
   case $host_os in
-  irix5*)
+  irix5* | nonstopux*)
     libsuff= shlibsuff=
     ;;
   *)
@@ -6286,11 +6489,12 @@ os2*)
 osf3* | osf4* | osf5*)
   version_type=osf
   need_version=no
-  soname_spec='${libname}${release}.so'
-  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
   ;;
 
 sco3.2v5*)
@@ -6333,6 +6537,12 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
   case $host_vendor in
     sni)
       shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
       ;;
     motorola)
       need_lib_prefix=no
@@ -6377,11 +6587,11 @@ test "$dynamic_linker" = no && can_build_shared=no
 
 # Report the final consequences.
 echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
-echo "configure:6381: checking if libtool supports shared libraries" >&5
+echo "configure:6591: checking if libtool supports shared libraries" >&5
 echo "$ac_t""$can_build_shared" 1>&6
 
 echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
-echo "configure:6385: checking whether to build shared libraries" >&5
+echo "configure:6595: checking whether to build shared libraries" >&5
 test "$can_build_shared" = "no" && enable_shared=no
 
 # On AIX, shared libraries and static libraries use the same namespace, and
@@ -6404,7 +6614,7 @@ esac
 echo "$ac_t""$enable_shared" 1>&6
 
 echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
-echo "configure:6408: checking whether to build static libraries" >&5
+echo "configure:6618: checking whether to build static libraries" >&5
 # Make sure either enable_shared or enable_static is yes.
 test "$enable_shared" = yes || enable_static=yes
 echo "$ac_t""$enable_static" 1>&6
@@ -6445,12 +6655,12 @@ else
 
   *)
     echo $ac_n "checking for shl_load""... $ac_c" 1>&6
-echo "configure:6449: checking for shl_load" >&5
+echo "configure:6659: checking for shl_load" >&5
 if eval "test \"\${ac_cv_func_shl_load+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6454 "configure"
+#line 6664 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shl_load(); below.  */
@@ -6474,7 +6684,7 @@ f = shl_load;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_shl_load=yes"
 else
@@ -6492,7 +6702,7 @@ if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:6496: checking for shl_load in -ldld" >&5
+echo "configure:6706: checking for shl_load in -ldld" >&5
 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6500,7 +6710,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6504 "configure"
+#line 6714 "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
@@ -6511,7 +6721,7 @@ int main() {
 shl_load()
 ; return 0; }
 EOF
-if { (eval echo configure:6515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6725: \"$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
@@ -6530,12 +6740,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:6534: checking for dlopen" >&5
+echo "configure:6744: 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 6539 "configure"
+#line 6749 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
@@ -6559,7 +6769,7 @@ f = dlopen;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dlopen=yes"
 else
@@ -6577,7 +6787,7 @@ if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:6581: checking for dlopen in -ldl" >&5
+echo "configure:6791: 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
@@ -6585,7 +6795,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6589 "configure"
+#line 6799 "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
@@ -6596,7 +6806,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:6600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6810: \"$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
@@ -6615,7 +6825,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
-echo "configure:6619: checking for dlopen in -lsvld" >&5
+echo "configure:6829: checking for dlopen in -lsvld" >&5
 ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6623,7 +6833,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsvld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6627 "configure"
+#line 6837 "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
@@ -6634,7 +6844,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:6638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6848: \"$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
@@ -6653,7 +6863,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
-echo "configure:6657: checking for dld_link in -ldld" >&5
+echo "configure:6867: checking for dld_link in -ldld" >&5
 ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6661,7 +6871,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6665 "configure"
+#line 6875 "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
@@ -6672,7 +6882,7 @@ int main() {
 dld_link()
 ; return 0; }
 EOF
-if { (eval echo configure:6676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6886: \"$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
@@ -6728,7 +6938,7 @@ fi
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
     echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
-echo "configure:6732: checking whether a program can dlopen itself" >&5
+echo "configure:6942: checking whether a program can dlopen itself" >&5
 if eval "test \"\${lt_cv_dlopen_self+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6738,7 +6948,7 @@ else
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 6742 "configure"
+#line 6952 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -6799,7 +7009,7 @@ int main ()
     exit (status);
 }
 EOF
-  if { (eval echo configure:6803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  if { (eval echo configure:7013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -6822,7 +7032,7 @@ echo "$ac_t""$lt_cv_dlopen_self" 1>&6
     if test "x$lt_cv_dlopen_self" = xyes; then
       LDFLAGS="$LDFLAGS $link_static_flag"
       echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
-echo "configure:6826: checking whether a statically linked program can dlopen itself" >&5
+echo "configure:7036: checking whether a statically linked program can dlopen itself" >&5
 if eval "test \"\${lt_cv_dlopen_self_static+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6832,7 +7042,7 @@ else
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 6836 "configure"
+#line 7046 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -6893,7 +7103,7 @@ int main ()
     exit (status);
 }
 EOF
-  if { (eval echo configure:6897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  if { (eval echo configure:7107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -6942,14 +7152,14 @@ if test "$enable_shared" = yes && test "$GCC" = yes; then
     # systems, -lgcc has to come before -lc. If gcc already passes -lc
     # to ld, don't add -lc before -lgcc.
     echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
-echo "configure:6946: checking whether -lc should be explicitly linked in" >&5
+echo "configure:7156: checking whether -lc should be explicitly linked in" >&5
     if eval "test \"\${lt_cv_archive_cmds_need_lc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   $rm conftest*
     echo 'static int dummy;' > conftest.$ac_ext
 
-    if { (eval echo configure:6953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    if { (eval echo configure:7163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
       soname=conftest
       lib=conftest
       libobjs=conftest.$ac_objext
@@ -6962,7 +7172,7 @@ else
       libname=conftest
       save_allow_undefined_flag=$allow_undefined_flag
       allow_undefined_flag=
-      if { (eval echo configure:6966: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+      if { (eval echo configure:7176: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
       then
        lt_cv_archive_cmds_need_lc=no
       else
@@ -7002,7 +7212,7 @@ if test -f "$ltmain"; then
   # Now quote all the things that may contain metacharacters while being
   # careful not to overquote the AC_SUBSTed values.  We take copies of the
   # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS \
+  for var in echo old_CC old_CFLAGS SED \
     AR AR_FLAGS CC LD LN_S NM SHELL \
     reload_flag reload_cmds wl \
     pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
@@ -7064,8 +7274,11 @@ if test -f "$ltmain"; then
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+# A sed that does not truncate output.
+SED=$lt_SED
+
 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="sed -e s/^X//"
+Xsed="${SED} -e s/^X//"
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
@@ -7544,43 +7757,9 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
-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:7553: 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:7584: checking whether ln works" >&5
+echo "configure:7763: 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
@@ -7603,7 +7782,7 @@ else
 fi
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:7607: checking whether ln -s works" >&5
+echo "configure:7786: 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
@@ -7624,125 +7803,12 @@ else
 fi
 
 
-if test "$LN_H" = "cp" -a "$LN_S" = "ln"; then
-       LN_S="$LN_H"
-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:7635: checking for $ac_word" >&5
-if eval "test \"\${ac_cv_path_SENDMAIL+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$SENDMAIL" in
-  /*)
-  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.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH:/usr/libexec:/usr/lib:/usr/sbin:/usr/etc:/etc"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_SENDMAIL="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_SENDMAIL" && ac_cv_path_SENDMAIL="/usr/lib/sendmail"
-  ;;
-esac
-fi
-SENDMAIL="$ac_cv_path_SENDMAIL"
-if test -n "$SENDMAIL"; then
-  echo "$ac_t""$SENDMAIL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-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:7671: checking for $ac_word" >&5
-if eval "test \"\${ac_cv_path_EDITOR+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$EDITOR" in
-  /*)
-  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.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH:/usr/ucb"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_EDITOR="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_EDITOR" && ac_cv_path_EDITOR="/usr/ucb/vi"
-  ;;
-esac
-fi
-EDITOR="$ac_cv_path_EDITOR"
-if test -n "$EDITOR"; then
-  echo "$ac_t""$EDITOR" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-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:7707: checking for $ac_word" >&5
-if eval "test \"\${ac_cv_path_FINGER+set}\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$FINGER" in
-  /*)
-  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.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH:/usr/ucb"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_FINGER="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_FINGER" && ac_cv_path_FINGER="/usr/ucb/finger"
-  ;;
-esac
-fi
-FINGER="$ac_cv_path_FINGER"
-if test -n "$FINGER"; then
-  echo "$ac_t""$FINGER" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-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:7746: checking for $ac_word" >&5
+echo "configure:7812: checking for $ac_word" >&5
 if eval "test \"\${ac_cv_path_PERLBIN+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7783,17 +7849,19 @@ fi
 
        else
                PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e ccopts`"
+               PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e 's/ -lc / /'`"
+
                if test x"$ol_with_perl_module" = "xstatic" ; then
-                       SLAPD_PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e s/-lc//`"
+                       SLAPD_PERL_LDFLAGS="$PERL_LDFLAGS"
                else
-                       MOD_PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e s/-lc//`"
+                       MOD_PERL_LDFLAGS="$PERL_LDFLAGS"
                fi
                                ol_link_perl=yes
        fi
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:7797: checking how to run the C preprocessor" >&5
+echo "configure:7865: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -7808,13 +7876,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 7812 "configure"
+#line 7880 "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:7818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7886: \"$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
   :
@@ -7825,13 +7893,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 7829 "configure"
+#line 7897 "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:7835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7903: \"$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
   :
@@ -7842,13 +7910,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 7846 "configure"
+#line 7914 "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:7852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7920: \"$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
   :
@@ -7887,12 +7955,12 @@ fi
 
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:7891: checking for Cygwin environment" >&5
+echo "configure:7959: 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 7896 "configure"
+#line 7964 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -7903,7 +7971,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:7907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -7919,19 +7987,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:7923: checking for mingw32 environment" >&5
+echo "configure:7991: 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 7928 "configure"
+#line 7996 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:7935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -7950,7 +8018,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:7954: checking for executable suffix" >&5
+echo "configure:8022: checking for executable suffix" >&5
 if eval "test \"\${ac_cv_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7960,7 +8028,7 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:7964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:8032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.C | *.o | *.obj | *.xcoff) ;;
@@ -7981,13 +8049,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:7985: checking for object suffix" >&5
+echo "configure:8053: 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:7991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -8011,7 +8079,7 @@ EOF
 
 
 echo $ac_n "checking for be_app in -lbe""... $ac_c" 1>&6
-echo "configure:8015: checking for be_app in -lbe" >&5
+echo "configure:8083: 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
@@ -8019,7 +8087,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbe -lroot -lnet $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8023 "configure"
+#line 8091 "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
@@ -8030,7 +8098,7 @@ int main() {
 be_app()
 ; return 0; }
 EOF
-if { (eval echo configure:8034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8102: \"$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
@@ -8056,7 +8124,7 @@ fi
 
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:8060: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:8128: 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
@@ -8073,7 +8141,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 8077 "configure"
+#line 8145 "configure"
 #include "confdefs.h"
 #include <stdarg.h>
 #include <stdio.h>
@@ -8110,7 +8178,7 @@ return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
 
 ; return 0; }
 EOF
-if { (eval echo configure:8114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8182: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_prog_cc_stdc="$ac_arg"; break
 else
@@ -8144,7 +8212,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:8148: checking for ${OL_MKDEP} depend flag" >&5
+echo "configure:8216: 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
@@ -8154,7 +8222,7 @@ else
                                cat > conftest.c <<EOF
  noCode;
 EOF
-                               if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:8158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } \
+                               if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:8226: \"$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
@@ -8187,7 +8255,7 @@ if test "${ol_cv_mkdep}" = no ; then
 fi
 
 echo $ac_n "checking for afopen in -ls""... $ac_c" 1>&6
-echo "configure:8191: checking for afopen in -ls" >&5
+echo "configure:8259: 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
@@ -8195,7 +8263,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ls  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8199 "configure"
+#line 8267 "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
@@ -8206,7 +8274,7 @@ int main() {
 afopen()
 ; return 0; }
 EOF
-if { (eval echo configure:8210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8278: \"$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
@@ -8233,6 +8301,15 @@ else
 fi
 
 
+case "$target" in
+*-ibm-openedition)
+       ac_cv_func_getopt=no
+       cat >> confdefs.h <<\EOF
+#define BOTH_STRINGS_H 1
+EOF
+
+       ;;
+esac
 
 ol_link_modules=no
 if test $ol_enable_modules != no ; then
@@ -8240,17 +8317,17 @@ if test $ol_enable_modules != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8244: checking for $ac_hdr" >&5
+echo "configure:8321: 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 8249 "configure"
+#line 8326 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8331: \"$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*
@@ -8282,7 +8359,7 @@ done
        fi
 
        echo $ac_n "checking for lt_dlinit in -lltdl""... $ac_c" 1>&6
-echo "configure:8286: checking for lt_dlinit in -lltdl" >&5
+echo "configure:8363: 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
@@ -8290,7 +8367,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lltdl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8294 "configure"
+#line 8371 "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
@@ -8301,7 +8378,7 @@ int main() {
 lt_dlinit()
 ; return 0; }
 EOF
-if { (eval echo configure:8305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8382: \"$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
@@ -8335,10 +8412,12 @@ fi
 else
        ol_with_bdb_module=static
        ol_with_dnssrv_module=static
+       ol_with_hdb_module=static
        ol_with_ldap_module=static
        ol_with_ldbm_module=static
        ol_with_meta_module=static
        ol_with_monitor_module=static
+       ol_with_null_module=static
        ol_with_passwd_module=static
        ol_with_perl_module=static
        ol_with_shell_module=static
@@ -8348,13 +8427,13 @@ fi
 
 # test for EBCDIC
 echo $ac_n "checking for EBCDIC""... $ac_c" 1>&6
-echo "configure:8352: checking for EBCDIC" >&5
+echo "configure:8431: 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 8358 "configure"
+#line 8437 "configure"
 #include "confdefs.h"
 
 #if !('M' == 0xd4)
@@ -8363,7 +8442,7 @@ else
 
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8367: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8446: \"$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*
@@ -8387,12 +8466,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:8391: checking for ANSI C header files" >&5
+echo "configure:8470: 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 8396 "configure"
+#line 8475 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -8400,7 +8479,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8483: \"$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*
@@ -8417,7 +8496,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 8421 "configure"
+#line 8500 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -8435,7 +8514,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 8439 "configure"
+#line 8518 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -8456,7 +8535,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 8460 "configure"
+#line 8539 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #ifndef HAVE_EBCDIC
@@ -8474,7 +8553,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:8478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -8508,12 +8587,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:8512: checking for $ac_hdr that defines DIR" >&5
+echo "configure:8591: 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 8517 "configure"
+#line 8596 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -8521,7 +8600,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:8525: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -8546,7 +8625,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:8550: checking for opendir in -ldir" >&5
+echo "configure:8629: 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
@@ -8554,7 +8633,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8558 "configure"
+#line 8637 "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
@@ -8565,7 +8644,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:8569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8648: \"$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
@@ -8587,7 +8666,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:8591: checking for opendir in -lx" >&5
+echo "configure:8670: 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
@@ -8595,7 +8674,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8599 "configure"
+#line 8678 "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
@@ -8606,7 +8685,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:8610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8689: \"$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
@@ -8629,12 +8708,12 @@ fi
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:8633: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:8712: 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 8638 "configure"
+#line 8717 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -8650,7 +8729,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:8654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -8671,12 +8750,12 @@ EOF
 fi
 
 echo $ac_n "checking POSIX termios""... $ac_c" 1>&6
-echo "configure:8675: checking POSIX termios" >&5
+echo "configure:8754: 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 8680 "configure"
+#line 8759 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <unistd.h>
@@ -8686,7 +8765,7 @@ int main() {
    tcgetattr(0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:8690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8769: \"$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
@@ -8702,7 +8781,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:8706: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5
+echo "configure:8785: 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
@@ -8711,7 +8790,7 @@ else
   gwinsz_in_termios_h=no
   if test $am_cv_sys_posix_termios = yes; then
     cat > conftest.$ac_ext <<EOF
-#line 8715 "configure"
+#line 8794 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #     include <termios.h>
@@ -8731,7 +8810,7 @@ rm -f conftest*
 
   if test $gwinsz_in_termios_h = no; then
     cat > conftest.$ac_ext <<EOF
-#line 8735 "configure"
+#line 8814 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #     include <sys/ioctl.h>
@@ -8803,9 +8882,12 @@ for ac_hdr in \
        sys/resource.h  \
        sys/select.h    \
        sys/socket.h    \
+       sys/stat.h              \
        sys/syslog.h    \
        sys/time.h              \
        sys/types.h             \
+       sys/ucred.h             \
+       sys/uio.h               \
        syslog.h                \
        termios.h               \
        unistd.h                \
@@ -8815,17 +8897,17 @@ for ac_hdr in \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8819: checking for $ac_hdr" >&5
+echo "configure:8901: 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 8824 "configure"
+#line 8906 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8911: \"$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*
@@ -8855,12 +8937,12 @@ done
 
 
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:8859: checking for dlopen" >&5
+echo "configure:8941: 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 8864 "configure"
+#line 8946 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
@@ -8884,7 +8966,7 @@ f = dlopen;
 
 ; return 0; }
 EOF
-if { (eval echo configure:8888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dlopen=yes"
 else
@@ -8902,7 +8984,7 @@ if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:8906: checking for dlopen in -ldl" >&5
+echo "configure:8988: 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
@@ -8910,7 +8992,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8914 "configure"
+#line 8996 "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
@@ -8921,7 +9003,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:8925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9007: \"$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
@@ -8952,7 +9034,7 @@ fi
 
 
 echo $ac_n "checking for sigset in -lV3""... $ac_c" 1>&6
-echo "configure:8956: checking for sigset in -lV3" >&5
+echo "configure:9038: 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
@@ -8960,7 +9042,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lV3  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8964 "configure"
+#line 9046 "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
@@ -8971,7 +9053,7 @@ int main() {
 sigset()
 ; return 0; }
 EOF
-if { (eval echo configure:8975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9057: \"$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
@@ -9000,12 +9082,12 @@ fi
 
 
 echo $ac_n "checking for winsock""... $ac_c" 1>&6
-echo "configure:9004: checking for winsock" >&5
+echo "configure:9086: checking for winsock" >&5
 save_LIBS="$LIBS"
 for curlib in ws2_32 wsock32; do
        LIBS="$LIBS -l$curlib"
        cat > conftest.$ac_ext <<EOF
-#line 9009 "configure"
+#line 9091 "configure"
 #include "confdefs.h"
 
                        char socket@12();
@@ -9022,7 +9104,7 @@ int main() {
                        
 ; return 0; }
 EOF
-if { (eval echo configure:9026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   have_winsock=yes
 else
@@ -9057,12 +9139,12 @@ echo "$ac_t""$have_winsock" 1>&6
 
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:9061: checking for socket" >&5
+echo "configure:9143: 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 9066 "configure"
+#line 9148 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -9086,7 +9168,7 @@ f = socket;
 
 ; return 0; }
 EOF
-if { (eval echo configure:9090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9172: \"$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
@@ -9105,7 +9187,7 @@ else
   echo "$ac_t""no" 1>&6
        
        echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:9109: checking for main in -lsocket" >&5
+echo "configure:9191: 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
@@ -9113,14 +9195,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9117 "configure"
+#line 9199 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:9124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9206: \"$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
@@ -9148,7 +9230,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnet""... $ac_c" 1>&6
-echo "configure:9152: checking for main in -lnet" >&5
+echo "configure:9234: 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
@@ -9156,14 +9238,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9160 "configure"
+#line 9242 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:9167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9249: \"$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
@@ -9191,7 +9273,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnsl_s""... $ac_c" 1>&6
-echo "configure:9195: checking for main in -lnsl_s" >&5
+echo "configure:9277: 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
@@ -9199,14 +9281,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9203 "configure"
+#line 9285 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:9210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9292: \"$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
@@ -9234,7 +9316,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:9238: checking for main in -lnsl" >&5
+echo "configure:9320: 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
@@ -9242,14 +9324,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9246 "configure"
+#line 9328 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:9253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9335: \"$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
@@ -9277,7 +9359,7 @@ else
 fi
 
        echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6
-echo "configure:9281: checking for socket in -linet" >&5
+echo "configure:9363: 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
@@ -9285,7 +9367,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-linet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9289 "configure"
+#line 9371 "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
@@ -9296,7 +9378,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:9300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9382: \"$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
@@ -9324,7 +9406,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lgen""... $ac_c" 1>&6
-echo "configure:9328: checking for main in -lgen" >&5
+echo "configure:9410: 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
@@ -9332,14 +9414,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgen  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9336 "configure"
+#line 9418 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:9343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9425: \"$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
@@ -9371,12 +9453,12 @@ fi
 
 
 echo $ac_n "checking for select""... $ac_c" 1>&6
-echo "configure:9375: checking for select" >&5
+echo "configure:9457: 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 9380 "configure"
+#line 9462 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char select(); below.  */
@@ -9400,7 +9482,7 @@ f = select;
 
 ; return 0; }
 EOF
-if { (eval echo configure:9404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9486: \"$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
@@ -9423,7 +9505,7 @@ fi
 
 if test "${ac_cv_header_winsock_h}" != yes; then
                                echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6
-echo "configure:9427: checking types of arguments for select()" >&5
+echo "configure:9509: 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
@@ -9437,7 +9519,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 9441 "configure"
+#line 9523 "configure"
 #include "confdefs.h"
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -9456,7 +9538,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:9460: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9542: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
           ac_not_found=no ; break 3
 else
@@ -9501,17 +9583,17 @@ 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:9505: checking for $ac_hdr" >&5
+echo "configure:9587: 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 9510 "configure"
+#line 9592 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9597: \"$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,14 +9624,14 @@ if test "$ac_cv_header_regex_h" != yes ; then
 fi
 
 echo $ac_n "checking for library containing regfree""... $ac_c" 1>&6
-echo "configure:9546: checking for library containing regfree" >&5
+echo "configure:9628: checking for library containing regfree" >&5
 if eval "test \"\${ac_cv_search_regfree+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_regfree="no"
 cat > conftest.$ac_ext <<EOF
-#line 9553 "configure"
+#line 9635 "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
@@ -9560,7 +9642,7 @@ int main() {
 regfree()
 ; return 0; }
 EOF
-if { (eval echo configure:9564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_regfree="none required"
 else
@@ -9571,7 +9653,7 @@ rm -f conftest*
 test "$ac_cv_search_regfree" = "no" && for ac_lib in regex gnuregex; do
 LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9575 "configure"
+#line 9657 "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
@@ -9582,7 +9664,7 @@ int main() {
 regfree()
 ; return 0; }
 EOF
-if { (eval echo configure:9586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_regfree="-l$ac_lib"
 break
@@ -9605,7 +9687,7 @@ fi
 
 
 echo $ac_n "checking for compatible POSIX regex""... $ac_c" 1>&6
-echo "configure:9609: checking for compatible POSIX regex" >&5
+echo "configure:9691: 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
@@ -9614,7 +9696,7 @@ else
   ol_cv_c_posix_regex=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 9618 "configure"
+#line 9700 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9640,7 +9722,7 @@ main()
        return rc;
 }
 EOF
-if { (eval echo configure:9644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9726: \"$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
@@ -9660,12 +9742,132 @@ if test "$ol_cv_c_posix_regex" = no ; then
        { echo "configure: error: broken POSIX regex!" 1>&2; exit 1; }
 fi
 
-echo $ac_n "checking to see if -lrpcrt4 is needed for win32 UUID support""... $ac_c" 1>&6
-echo "configure:9665: checking to see if -lrpcrt4 is needed for win32 UUID support" >&5
-save_LIBS="$LIBS"
-LIBS="$LIBS -lrpcrt4"
+
+have_uuid=no
+for ac_hdr in sys/uuid.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9752: 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 9757 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9762: \"$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_sys_uuid_h = yes ; then
+       save_LIBS="$LIBS"
+       
+echo $ac_n "checking for library containing uuid_to_str""... $ac_c" 1>&6
+echo "configure:9792: checking for library containing uuid_to_str" >&5
+if eval "test \"\${ac_cv_search_uuid_to_str+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_func_search_save_LIBS="$LIBS"
+ac_cv_search_uuid_to_str="no"
+cat > conftest.$ac_ext <<EOF
+#line 9799 "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 uuid_to_str();
+
+int main() {
+uuid_to_str()
+; return 0; }
+EOF
+if { (eval echo configure:9810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_search_uuid_to_str="none required"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+test "$ac_cv_search_uuid_to_str" = "no" && for ac_lib in uuid; do
+LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9669 "configure"
+#line 9821 "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 uuid_to_str();
+
+int main() {
+uuid_to_str()
+; return 0; }
+EOF
+if { (eval echo configure:9832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_search_uuid_to_str="-l$ac_lib"
+break
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+LIBS="$ac_func_search_save_LIBS"
+fi
+
+echo "$ac_t""$ac_cv_search_uuid_to_str" 1>&6
+if test "$ac_cv_search_uuid_to_str" != "no"; then
+  test "$ac_cv_search_uuid_to_str" = "none required" || LIBS="$ac_cv_search_uuid_to_str $LIBS"
+  have_uuid=yes
+else :
+  :
+fi
+       LIBS="$save_LIBS"
+
+       if test have_uuid = yes ; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_UUID_TO_STR 1
+EOF
+
+
+               test "$ac_cv_search_uuid_to_str" = "none required" || \
+                       SLAPD_LIBS="$SLAPD_LIBS $ac_cv_search_uuid_to_str"
+       fi
+fi
+
+if test $have_uuid = no ; then
+       echo $ac_n "checking to see if -lrpcrt4 is needed for win32 UUID support""... $ac_c" 1>&6
+echo "configure:9867: checking to see if -lrpcrt4 is needed for win32 UUID support" >&5
+       save_LIBS="$LIBS"
+       LIBS="$LIBS -lrpcrt4"
+       cat > conftest.$ac_ext <<EOF
+#line 9871 "configure"
 #include "confdefs.h"
 
                char UuidCreate@4();
@@ -9678,7 +9880,7 @@ int main() {
                
 ; return 0; }
 EOF
-if { (eval echo configure:9682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   need_rpcrt=yes
 else
@@ -9688,20 +9890,21 @@ else
   need_rpcrt=no
 fi
 rm -f conftest*
-if test $need_rpcrt = yes; then
-       SLAPD_LIBS="$SLAPD_LIBS -lrpcrt4"
+       if test $need_rpcrt = yes; then
+               SLAPD_LIBS="$SLAPD_LIBS -lrpcrt4"
+       fi
+       LIBS="$save_LIBS"
+       echo "$ac_t""$need_rpcrt" 1>&6
 fi
-LIBS="$save_LIBS"
-echo "$ac_t""$need_rpcrt" 1>&6
 
 ol_link_dnssrv=no
 echo $ac_n "checking for res_query""... $ac_c" 1>&6
-echo "configure:9700: checking for res_query" >&5
+echo "configure:9903: 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 9705 "configure"
+#line 9908 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char res_query(); below.  */
@@ -9725,7 +9928,7 @@ f = res_query;
 
 ; return 0; }
 EOF
-if { (eval echo configure:9729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_res_query=yes"
 else
@@ -9746,12 +9949,12 @@ fi
 
 if test $ac_cv_func_res_query = no ; then 
        echo $ac_n "checking for __res_query""... $ac_c" 1>&6
-echo "configure:9750: checking for __res_query" >&5
+echo "configure:9953: 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 9755 "configure"
+#line 9958 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char __res_query(); below.  */
@@ -9775,7 +9978,7 @@ f = __res_query;
 
 ; return 0; }
 EOF
-if { (eval echo configure:9779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func___res_query=yes"
 else
@@ -9799,7 +10002,7 @@ 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:9803: checking for res_query in -lbind" >&5
+echo "configure:10006: 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
@@ -9807,7 +10010,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9811 "configure"
+#line 10014 "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
@@ -9818,7 +10021,7 @@ int main() {
 res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:9822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10025: \"$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
@@ -9850,7 +10053,7 @@ 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:9854: checking for __res_query in -lbind" >&5
+echo "configure:10057: 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
@@ -9858,7 +10061,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9862 "configure"
+#line 10065 "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
@@ -9869,7 +10072,7 @@ int main() {
 __res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:9873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10076: \"$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
@@ -9901,7 +10104,7 @@ fi
 
 if test $ac_cv_func_res_query = no ; then 
        echo $ac_n "checking for res_query in -lresolv""... $ac_c" 1>&6
-echo "configure:9905: checking for res_query in -lresolv" >&5
+echo "configure:10108: 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
@@ -9909,7 +10112,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9913 "configure"
+#line 10116 "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
@@ -9920,7 +10123,7 @@ int main() {
 res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:9924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10127: \"$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
@@ -9952,7 +10155,7 @@ fi
 
 if test $ac_cv_func_res_query = no ; then 
        echo $ac_n "checking for __res_query in -lresolv""... $ac_c" 1>&6
-echo "configure:9956: checking for __res_query in -lresolv" >&5
+echo "configure:10159: 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
@@ -9960,7 +10163,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9964 "configure"
+#line 10167 "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
@@ -9971,7 +10174,7 @@ int main() {
 __res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:9975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10178: \"$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
@@ -10016,15 +10219,15 @@ if test "$ol_enable_dnssrv" = yes -a "$ol_link_dnssrv" = no ; then
        { echo "configure: error: DNSSRV requires res_query()" 1>&2; exit 1; }
 fi
 
-for ac_func in getaddrinfo gai_strerror inet_ntop 
+for ac_func in getaddrinfo getnameinfo gai_strerror inet_ntop 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:10023: checking for $ac_func" >&5
+echo "configure:10226: 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 10028 "configure"
+#line 10231 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -10048,7 +10251,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:10052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10255: \"$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
@@ -10080,13 +10283,13 @@ if test $ac_cv_func_getaddrinfo = no -o $ac_cv_func_inet_ntop = no ; then
        fi
 elif test $ol_enable_ipv6 != no ; then
        echo $ac_n "checking INET6_ADDRSTRLEN""... $ac_c" 1>&6
-echo "configure:10084: checking INET6_ADDRSTRLEN" >&5
+echo "configure:10287: checking INET6_ADDRSTRLEN" >&5
 if eval "test \"\${ol_cv_inet6_addrstrlen+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                cat > conftest.$ac_ext <<EOF
-#line 10090 "configure"
+#line 10293 "configure"
 #include "confdefs.h"
 
 #                      include <netinet/in.h>
 
 echo "$ac_t""$ol_cv_inet6_addrstrlen" 1>&6
 
-       if test $ol_cv_inet6_addrstrlen = yes ; then
+
+       echo $ac_n "checking struct sockaddr_storage""... $ac_c" 1>&6
+echo "configure:10318: checking struct sockaddr_storage" >&5
+if eval "test \"\${ol_cv_struct_sockaddr_storage+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+               cat > conftest.$ac_ext <<EOF
+#line 10324 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int main() {
+
+                       struct sockaddr_storage ss;
+
+; return 0; }
+EOF
+if { (eval echo configure:10336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_struct_sockaddr_storage=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_struct_sockaddr_storage=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ol_cv_struct_sockaddr_storage" 1>&6
+
+       if test $ol_cv_inet6_addrstrlen = yes \
+               -a $ol_cv_struct_sockaddr_storage = yes ; then
                ol_link_ipv6=yes
-       elif test $ol_enable_ipv6 = yes ; then
+       elif test $ol_enable_ipv6 = yes \
+                       -a $ol_cv_inet6_addrstrlen = no ; then
                { echo "configure: error: IPv6 support requires INET6_ADDRSTRLEN" 1>&2; exit 1; }
+       elif test $ol_enable_ipv6 = yes \
+                       -a $ol_cv_struct_sockaddr_storage = no ; then
+               { echo "configure: error: IPv6 support requires struct sockaddr_storage" 1>&2; exit 1; }
        fi
 fi
 
@@ -10121,17 +10363,17 @@ if test $ol_enable_local != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10125: checking for $ac_hdr" >&5
+echo "configure:10367: 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 10130 "configure"
+#line 10372 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10377: \"$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*
@@ -10178,17 +10420,17 @@ if test $ol_with_kerberos = yes -o $ol_with_kerberos = auto \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10182: checking for $ac_hdr" >&5
+echo "configure:10424: 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 10187 "configure"
+#line 10429 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10434: \"$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*
@@ -10220,17 +10462,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10224: checking for $ac_hdr" >&5
+echo "configure:10466: 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 10229 "configure"
+#line 10471 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10476: \"$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*
@@ -10264,7 +10506,7 @@ done
 
                if test $krb5_impl = mit; then
                        echo $ac_n "checking for main in -lk5crypto""... $ac_c" 1>&6
-echo "configure:10268: checking for main in -lk5crypto" >&5
+echo "configure:10510: 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
@@ -10272,14 +10514,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lk5crypto  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10276 "configure"
+#line 10518 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:10283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10525: \"$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
@@ -10302,7 +10544,7 @@ fi
 
 
                        echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6
-echo "configure:10306: checking for main in -lkrb5" >&5
+echo "configure:10548: 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
@@ -10310,14 +10552,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lkrb5 -l$krb5crypto -lcom_err $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10314 "configure"
+#line 10556 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:10321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10563: \"$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
 
 
                elif test $krb5_impl = heimdal; then
+                       echo $ac_n "checking for main in -ldes""... $ac_c" 1>&6
+echo "configure:10588: checking for main in -ldes" >&5
+ac_lib_var=`echo des'_'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="-ldes  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 10596 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:10603: \"$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
+  krb5crypto=des
+else
+  echo "$ac_t""no" 1>&6
+krb5crypto=crypto
+fi
+
+
                        echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6
-echo "configure:10346: checking for main in -lkrb5" >&5
+echo "configure:10626: 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="-lkrb5 -ldes -lasn1 -lroken -lcom_err $LIBS"
+LIBS="-lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10354 "configure"
+#line 10634 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:10361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10641: \"$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
@@ -10373,7 +10653,7 @@ fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   have_krb5=yes
-                               KRB5_LIBS="-lkrb5 -ldes -lasn1 -lroken -lcom_err"
+                               KRB5_LIBS="-lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err"
 else
   echo "$ac_t""no" 1>&6
 have_krb5=no
@@ -10387,7 +10667,7 @@ EOF
 
                else
                        have_krb5=no
-                       echo "configure: warning: Unrecongized Kerberos5 Implementation" 1>&2
+                       echo "configure: warning: Unrecognized Kerberos5 Implementation" 1>&2
                fi
 
                if test $have_krb5 = yes ; then
@@ -10420,17 +10700,17 @@ if test $ol_link_krb5 = yes -a \( $ol_with_kerberos = yes -o \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10424: checking for $ac_hdr" >&5
+echo "configure:10704: 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 10429 "configure"
+#line 10709 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10714: \"$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*
@@ -10460,7 +10740,7 @@ done
        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:10464: checking for main in -lkrb4" >&5
+echo "configure:10744: 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
@@ -10468,14 +10748,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lkrb4 -ldes425 -lkrb5 -l$krb5crypto -lcom_err $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10472 "configure"
+#line 10752 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:10479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10759: \"$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
 
                elif test $krb5_impl = heimdal; then
                        echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
-echo "configure:10504: checking for main in -lkrb4" >&5
+echo "configure:10784: 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
   ac_save_LIBS="$LIBS"
-LIBS="-lkrb4 -lkrb5 -ldes -lasn1 -lroken -lcom_err $LIBS"
+LIBS="-lkrb4 -lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10512 "configure"
+#line 10792 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:10519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10799: \"$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
@@ -10557,7 +10837,7 @@ EOF
 
 
                        echo $ac_n "checking for des_debug in Kerberos libraries""... $ac_c" 1>&6
-echo "configure:10561: checking for des_debug in Kerberos libraries" >&5
+echo "configure:10841: 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
@@ -10565,7 +10845,7 @@ else
                                                                save_LIBS="$LIBS"
                                LIBS="$KRB4_LIBS $KRB5_LIBS $LIBS"
                                cat > conftest.$ac_ext <<EOF
-#line 10569 "configure"
+#line 10849 "configure"
 #include "confdefs.h"
 
 #include <kerberosIV/krb.h>
@@ -10578,7 +10858,7 @@ des_debug = 1;
 
 ; return 0; }
 EOF
-if { (eval echo configure:10582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_var_des_debug=yes
 else
@@ -10617,17 +10897,17 @@ if test $ol_with_kerberos = yes -o $ol_with_kerberos = auto \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10621: checking for $ac_hdr" >&5
+echo "configure:10901: 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 10626 "configure"
+#line 10906 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10631: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10911: \"$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*
@@ -10656,7 +10936,7 @@ done
 
        if test $ac_cv_header_krb_h = yes ; then
                echo $ac_n "checking for main in -lkrb""... $ac_c" 1>&6
-echo "configure:10660: checking for main in -lkrb" >&5
+echo "configure:10940: 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
@@ -10664,14 +10944,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lkrb -ldes $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10668 "configure"
+#line 10948 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:10675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10955: \"$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
@@ -10741,17 +11021,17 @@ if test $ol_with_tls != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10745: checking for $ac_hdr" >&5
+echo "configure:11025: 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 10750 "configure"
+#line 11030 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11035: \"$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_openssl_ssl_h = yes -o $ac_cv_header_ssl_h = yes ; then
+       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:10784: checking for SSLeay_add_ssl_algorithms in -lssl" >&5
+echo "configure:11065: 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
@@ -10788,7 +11069,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lssl -lcrypto $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10792 "configure"
+#line 11073 "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
@@ -10799,7 +11080,7 @@ int main() {
 SSLeay_add_ssl_algorithms()
 ; return 0; }
 EOF
-if { (eval echo configure:10803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11084: \"$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
@@ -10824,7 +11105,7 @@ fi
                        
                if test $have_ssleay = no ; then
                        echo $ac_n "checking for SSL_library_init in -lssl""... $ac_c" 1>&6
-echo "configure:10828: checking for SSL_library_init in -lssl" >&5
+echo "configure:11109: 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
@@ -10832,7 +11113,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lssl -lcrypto $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10836 "configure"
+#line 11117 "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
@@ -10843,7 +11124,7 @@ int main() {
 SSL_library_init()
 ; return 0; }
 EOF
-if { (eval echo configure:10847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11128: \"$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
@@ -10869,7 +11150,7 @@ fi
 
                if test $have_ssleay = no ; then
                        echo $ac_n "checking for ssl3_accept in -lssl""... $ac_c" 1>&6
-echo "configure:10873: checking for ssl3_accept in -lssl" >&5
+echo "configure:11154: 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
@@ -10877,7 +11158,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lssl -lcrypto -lRSAglue -lrsaref $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10881 "configure"
+#line 11162 "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
@@ -10888,7 +11169,7 @@ int main() {
 ssl3_accept()
 ; return 0; }
 EOF
-if { (eval echo configure:10892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11173: \"$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
@@ -10935,18 +11216,20 @@ EOF
        fi
 
 else
-       echo "configure: warning: TLS privacy protection not supported!" 1>&2
+       echo "configure: warning: TLS data protection not supported!" 1>&2
 fi
 
+WITH_TLS=no
 if test $ol_link_tls = yes ; then
        cat >> confdefs.h <<\EOF
 #define HAVE_TLS 1
 EOF
 
+       WITH_TLS=yes
 
 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
+       echo "configure: warning: TLS data 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; }
@@ -10963,26 +11246,27 @@ EOF
 
 fi
 
-for ac_func in \
-       ctime_r                 \
-       gethostbyname_r gethostbyaddr_r \
+ol_link_threads=no
 
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:10973: checking for $ac_func" >&5
-if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+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:11257: 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 10978 "configure"
+#line 11262 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    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 $ac_func();
+char _beginthread();
 char (*f)();
 
 int main() {
@@ -10990,558 +11274,264 @@ 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)
+#if defined (__stub__beginthread) || defined (__stub____beginthread)
 choke me
 #else
-f = $ac_func;
+f = _beginthread;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:11002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11286: \"$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"
+  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_$ac_func=no"
+  eval "ac_cv_func__beginthread=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'_beginthread`\" = 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:11031: checking number of arguments of ctime_r" >&5
-if eval "test \"\${ol_cv_func_ctime_r_nargs+set}\" = set"; then
+       if test $ac_cv_func__beginthread = yes ; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_NT_THREADS 1
+EOF
+
+               ol_cv_nt_threads=yes
+       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:11342: 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 11036 "configure"
+#line 11347 "configure"
 #include "confdefs.h"
-#include <time.h>
-int main() {
-time_t ti; char *buffer; ctime_r(&ti,buffer,32);
-; return 0; }
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:11043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:11352: \"$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*
-  ol_cv_func_ctime_r_nargs3=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*
-  ol_cv_func_ctime_r_nargs3=no
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
-
-       cat > conftest.$ac_ext <<EOF
-#line 11055 "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:11062: \"$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
+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
-
-  fi
-
+else
+  echo "$ac_t""no" 1>&6
 fi
+done
 
-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:11102: checking number of arguments of gethostbyname_r" >&5
-if eval "test \"\${ol_cv_func_gethostbyname_r_nargs+set}\" = set"; then
+
+       if test $ac_cv_header_pthread_h = yes ; then
+               echo $ac_n "checking POSIX thread version""... $ac_c" 1>&6
+echo "configure:11381: 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 11107 "configure"
+  
+       cat > conftest.$ac_ext <<EOF
+#line 11387 "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 <pthread.h>
+       
 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);
+
+               int i = PTHREAD_CREATE_JOINABLE;
+       
 ; return 0; }
 EOF
-if { (eval echo configure:11121: \"$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
+if { (eval echo configure:11398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ol_cv_func_gethostbyname_r_nargs5=no
-fi
-rm -f conftest*
-
+  
        cat > conftest.$ac_ext <<EOF
-#line 11133 "configure"
+#line 11402 "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; }
+#include <pthread.h>
 EOF
-if { (eval echo configure:11148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "pthread_detach" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_func_gethostbyname_r_nargs6=yes
+  ol_cv_pthread_version=10
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_func_gethostbyname_r_nargs6=no
+  ol_cv_pthread_version=8
 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
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
   
-fi
+       cat > conftest.$ac_ext <<EOF
+#line 11422 "configure"
+#include "confdefs.h"
 
-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
+#              include <pthread.h>
+#              ifdef PTHREAD_CREATE_UNDETACHED
+               draft7
+#              endif
+       
 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:11189: 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
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "draft7" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ol_cv_pthread_version=7
 else
-  cat > conftest.$ac_ext <<EOF
-#line 11194 "configure"
+  rm -rf conftest*
+  
+       cat > conftest.$ac_ext <<EOF
+#line 11439 "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; }
+#include <pthread.h>
 EOF
-if { (eval echo configure:11210: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "pthread_attr_init" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_func_gethostbyaddr_r_nargs7=yes
+  ol_cv_pthread_version=6
 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 11222 "configure"
+#line 11451 "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; }
+
+#              include <pthread.h>
+#ifdef         PTHREAD_MUTEX_INITIALIZER
+               draft5
+#endif
+       
 EOF
-if { (eval echo configure:11240: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "draft5" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_func_gethostbyaddr_r_nargs8=yes
+  ol_cv_pthread_version=5
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_func_gethostbyaddr_r_nargs8=no
+  ol_cv_pthread_version=4
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
 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
+fi
 
-               ol_cv_func_gethostbyaddr_r_nargs=8
+echo "$ac_t""$ol_cv_pthread_version" 1>&6
 
-       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
+               if test $ol_cv_pthread_version != 0 ; then
+                       cat >> confdefs.h <<EOF
+#define HAVE_PTHREADS $ol_cv_pthread_version
 EOF
 
-  fi
+               else
+                       { echo "configure: error: unknown pthread version" 1>&2; exit 1; }
+               fi
 
-else
-       ol_cv_func_gethostbyaddr_r_nargs=0
-fi
+               # consider threads found
+               ol_with_threads=found
 
-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
+               
+       echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
+echo "configure:11498: 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 11503 "configure"
+#include "confdefs.h"
+#include <pthread.h>
 EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "pthread_kill_other_threads_np" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ol_cv_header_linux_threads=yes
+else
+  rm -rf conftest*
+  ol_cv_header_linux_threads=no
+fi
+rm -f conftest*
 
+               
 fi
 
-ol_link_threads=no
+echo "$ac_t""$ol_cv_header_linux_threads" 1>&6
+       if test $ol_cv_header_linux_threads = yes; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_LINUX_THREADS 1
+EOF
 
-if test $ol_with_threads = auto -o $ol_with_threads = yes \
-       -o $ol_with_threads = nt ; then
+       fi
 
-       
-       echo $ac_n "checking for _beginthread""... $ac_c" 1>&6
-echo "configure:11303: checking for _beginthread" >&5
-if eval "test \"\${ac_cv_func__beginthread+set}\" = set"; then
+               
+       echo $ac_n "checking for GNU Pth pthread.h""... $ac_c" 1>&6
+echo "configure:11530: 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 11308 "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:11332: \"$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
-
-               ol_cv_nt_threads=yes
-       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:11388: 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 11393 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11398: \"$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:11427: 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 11433 "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
-fi
-rm -f conftest*
-
-
-       cat > conftest.$ac_ext <<EOF
-#line 11455 "configure"
-#include "confdefs.h"
-
-#              include <pthread.h>
-               /* this check could be improved */
-#              ifdef pthread_once_init
-                       pthread_version_draft4;
-#              endif
-       
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pthread_version_draft4" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ol_pthread_draft4=yes
-else
-  rm -rf conftest*
-  ol_pthread_draft4=no
-fi
-rm -f conftest*
-
-
-       if test $ol_pthread_final = yes -a $ol_pthread_draft4 = no; then
-               ol_cv_pthread_version=final
-       elif test $ol_pthread_final = no -a $ol_pthread_draft4 = yes; then
-               ol_cv_pthread_version=draft4
-       else
-               ol_cv_pthread_version=unknown
-       fi
-
-fi
-
-echo "$ac_t""$ol_cv_pthread_version" 1>&6
-
-
-               if test $ol_cv_pthread_version = final ; then
-                       cat >> confdefs.h <<\EOF
-#define HAVE_PTHREADS_FINAL 1
-EOF
-
-               elif test $ol_cv_pthread_version = draft4 ; then
-                       cat >> confdefs.h <<\EOF
-#define HAVE_PTHREADS_D4 1
-EOF
-
-               else
-                       { echo "configure: error: unknown pthread version" 1>&2; exit 1; }
-               fi
-
-               # consider threads found
-               ol_with_threads=found
-
-               
-       echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:11508: 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 11513 "configure"
-#include "confdefs.h"
-#include <pthread.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pthread_kill_other_threads_np" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ol_cv_header_linux_threads=yes
-else
-  rm -rf conftest*
-  ol_cv_header_linux_threads=no
-fi
-rm -f conftest*
-
-               
-fi
-
-echo "$ac_t""$ol_cv_header_linux_threads" 1>&6
-       if test $ol_cv_header_linux_threads = yes; then
-               cat >> confdefs.h <<\EOF
-#define HAVE_LINUX_THREADS 1
-EOF
-
-       fi
-
-               
-       echo $ac_n "checking for GNU Pth pthread.h""... $ac_c" 1>&6
-echo "configure:11540: 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 11545 "configure"
+#line 11535 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 #ifdef _POSIX_THREAD_IS_GNU_PTH
@@ -11570,17 +11560,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:11574: checking for $ac_hdr" >&5
+echo "configure:11564: 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 11579 "configure"
+#line 11569 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11574: \"$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*
@@ -11610,17 +11600,20 @@ done
 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                echo $ac_n "checking for pthread_create in default libraries""... $ac_c" 1>&6
-echo "configure:11614: checking for pthread_create in default libraries" >&5
+echo "configure:11604: 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 11621 "configure"
+#line 11611 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -11634,60 +11627,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -11698,7 +11674,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:11702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_create=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 11714 "configure"
+#line 11690 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -11731,60 +11710,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -11796,7 +11758,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:11800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11762: \"$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
@@ -11821,7 +11783,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:11825: checking for pthread link with -kthread" >&5
+echo "configure:11787: 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
@@ -11832,10 +11794,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 11836 "configure"
+#line 11798 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -11849,60 +11814,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -11913,7 +11861,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:11917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_kthread=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 11929 "configure"
+#line 11877 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -11946,60 +11897,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12011,7 +11945,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11949: \"$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
@@ -12041,7 +11975,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:12045: checking for pthread link with -pthread" >&5
+echo "configure:11979: 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
@@ -12052,10 +11986,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12056 "configure"
+#line 11990 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12069,60 +12006,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12133,7 +12053,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_pthread=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 12149 "configure"
+#line 12069 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12166,60 +12089,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12231,7 +12137,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12141: \"$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
@@ -12261,7 +12167,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:12265: checking for pthread link with -pthreads" >&5
+echo "configure:12171: 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
@@ -12272,10 +12178,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12276 "configure"
+#line 12182 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12289,60 +12198,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12353,7 +12245,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_pthreads=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 12369 "configure"
+#line 12261 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12386,60 +12281,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12451,7 +12329,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12333: \"$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
@@ -12481,7 +12359,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:12485: checking for pthread link with -mthreads" >&5
+echo "configure:12363: 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
@@ -12492,10 +12370,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12496 "configure"
+#line 12374 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12509,60 +12390,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12573,7 +12437,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_mthreads=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 12589 "configure"
+#line 12453 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12606,60 +12473,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12671,7 +12521,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12525: \"$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
@@ -12701,7 +12551,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:12705: checking for pthread link with -thread" >&5
+echo "configure:12555: 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
@@ -12712,10 +12562,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12716 "configure"
+#line 12566 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12729,60 +12582,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12793,7 +12629,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_thread=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 12809 "configure"
+#line 12645 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12826,60 +12665,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12891,7 +12713,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12717: \"$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
@@ -12922,7 +12744,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:12926: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
+echo "configure:12748: 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
@@ -12933,10 +12755,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12937 "configure"
+#line 12759 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -12950,60 +12775,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13014,7 +12822,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12826: \"$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
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 13030 "configure"
+#line 12838 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13047,60 +12858,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
-#endif
-
-#ifdef PTHREAD_CREATE_DETACHED
-       } else {
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13112,7 +12906,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12910: \"$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
@@ -13142,7 +12936,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:13146: checking for pthread link with -lpthread -lmach -lexc" >&5
+echo "configure:12940: 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
@@ -13153,10 +12947,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13157 "configure"
+#line 12951 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13170,60 +12967,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
-#endif
-
-#ifdef PTHREAD_CREATE_DETACHED
-       } else {
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13234,7 +13014,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13018: \"$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
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 13250 "configure"
+#line 13030 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13267,60 +13050,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13332,7 +13098,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13102: \"$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
@@ -13363,7 +13129,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:13367: checking for pthread link with -lpthread -Wl,-woff,85" >&5
+echo "configure:13133: 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
@@ -13374,10 +13140,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13378 "configure"
+#line 13144 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13391,60 +13160,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13455,7 +13207,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13211: \"$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
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 13471 "configure"
+#line 13223 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13488,60 +13243,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13553,7 +13291,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13295: \"$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
@@ -13584,7 +13322,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:13588: checking for pthread link with -lpthread" >&5
+echo "configure:13326: 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
@@ -13595,10 +13333,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13599 "configure"
+#line 13337 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13612,60 +13353,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13676,7 +13400,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_lpthread=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 13692 "configure"
+#line 13416 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13709,60 +13436,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13774,7 +13484,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13488: \"$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
@@ -13804,7 +13514,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:13808: checking for pthread link with -lc_r" >&5
+echo "configure:13518: 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
@@ -13815,10 +13525,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13819 "configure"
+#line 13529 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13832,60 +13545,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13896,7 +13592,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13900: \"$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*
   ol_cv_pthread_lc_r=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 13912 "configure"
+#line 13608 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -13929,60 +13628,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13994,7 +13676,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13680: \"$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
@@ -14025,7 +13707,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:14029: checking for pthread link with -threads" >&5
+echo "configure:13711: 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
@@ -14036,10 +13718,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14040 "configure"
+#line 13722 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14053,60 +13738,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14117,7 +13785,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_pthread_threads=yes
 else
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 14133 "configure"
+#line 13801 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14150,60 +13821,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14215,7 +13869,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13873: \"$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
@@ -14246,7 +13900,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:14250: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
+echo "configure:13904: 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
@@ -14257,10 +13911,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14261 "configure"
+#line 13915 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14274,60 +13931,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14338,7 +13978,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13982: \"$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
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 14354 "configure"
+#line 13994 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14371,60 +14014,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14436,7 +14062,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14066: \"$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
@@ -14466,7 +14092,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:14470: checking for pthread link with -lpthreads -lmach -lexc" >&5
+echo "configure:14096: 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
@@ -14477,10 +14103,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14481 "configure"
+#line 14107 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14494,60 +14123,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14558,7 +14170,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14174: \"$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
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 14574 "configure"
+#line 14186 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14591,60 +14206,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14656,7 +14254,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14258: \"$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
@@ -14686,7 +14284,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:14690: checking for pthread link with -lpthreads -lexc" >&5
+echo "configure:14288: 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
@@ -14697,10 +14295,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14701 "configure"
+#line 14299 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14714,60 +14315,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14778,7 +14362,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14366: \"$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
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 14794 "configure"
+#line 14378 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14811,60 +14398,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14876,7 +14446,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14450: \"$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
@@ -14907,7 +14477,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:14911: checking for pthread link with -lpthreads" >&5
+echo "configure:14481: 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
@@ -14918,10 +14488,13 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14922 "configure"
+#line 14492 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -14935,60 +14508,43 @@ static void *task(p)
 int main() {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14999,7 +14555,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:15003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14559: \"$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
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 15015 "configure"
+#line 14571 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -15032,60 +14591,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -15097,7 +14639,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:15101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14643: \"$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
 
 
                if test $ol_link_threads != no ; then
-                       cat >> confdefs.h <<\EOF
-#define HAVE_PTHREADS 1
-EOF
-
-
                        LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads"
 
                                                save_CPPFLAGS="$CPPFLAGS"
                        save_LIBS="$LIBS"
                        LIBS="$LTHREAD_LIBS $LIBS"
 
-                                                                                               for ac_func in sched_yield pthread_yield
+                                                                                               for ac_func in sched_yield pthread_yield thr_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15143: checking for $ac_func" >&5
+echo "configure:14680: 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 15148 "configure"
+#line 14685 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15168,7 +14705,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14709: \"$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
@@ -15194,9 +14731,10 @@ done
 
 
                        if test $ac_cv_func_sched_yield = no -a \
-                               $ac_cv_func_pthread_yield = no ; then
+                               $ac_cv_func_pthread_yield = no -a \
+                               $ac_cv_func_thr_yield = no ; then
                                                                echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:15200: checking for sched_yield in -lrt" >&5
+echo "configure:14738: 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
@@ -15204,7 +14742,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15208 "configure"
+#line 14746 "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
@@ -15215,7 +14753,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:15219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14757: \"$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
 
                        fi
                        if test $ac_cv_func_sched_yield = no -a \
-                               $ac_cv_func_pthread_yield = no ; then
-                                                                                               for ac_func in thr_yield
+                               $ac_cv_func_pthread_yield = no -a \
+                               "$ac_cv_func_thr_yield" = no ; then
+                               echo "configure: warning: could not locate sched_yield() or pthread_yield()" 1>&2
+                       fi
+
+                                               for ac_func in pthread_kill pthread_rwlock_destroy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15251: checking for $ac_func" >&5
+echo "configure:14793: 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 15256 "configure"
+#line 14798 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15276,7 +14818,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14822: \"$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
@@ -15300,90 +14842,27 @@ else
 fi
 done
 
-                       fi
-                       if test $ac_cv_func_sched_yield = no -a \
-                               $ac_cv_func_pthread_yield = no -a \
-                               "$ac_cv_func_thr_yield" = no ; then
-                               echo "configure: warning: could not locate sched_yield() or pthread_yield()" 1>&2
-                       fi
 
-                                               for ac_func in pthread_kill pthread_rwlock_destroy
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15314: checking for $ac_func" >&5
-if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+                                                                       echo $ac_n "checking for pthread_detach with <pthread.h>""... $ac_c" 1>&6
+echo "configure:14848: 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 15319 "configure"
+  
+                                                               cat > conftest.$ac_ext <<EOF
+#line 14854 "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:15343: \"$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
-
-
-                                                                       echo $ac_n "checking for pthread_detach with <pthread.h>""... $ac_c" 1>&6
-echo "configure:15369: 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 15375 "configure"
-#include "confdefs.h"
-
-#include <pthread.h>
-#ifndef NULL
-#define NULL (void*)0
+#include <pthread.h>
+#ifndef NULL
+#define NULL (void*)0
 #endif
 
 int main() {
 pthread_detach(NULL);
 ; return 0; }
 EOF
-if { (eval echo configure:15387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14866: \"$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
@@ -15415,12 +14894,12 @@ EOF
                        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15419: checking for $ac_func" >&5
+echo "configure:14898: 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 15424 "configure"
+#line 14903 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15444,7 +14923,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14927: \"$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
@@ -15473,12 +14952,12 @@ done
        for ac_func in pthread_kill_other_threads_np
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15477: checking for $ac_func" >&5
+echo "configure:14956: 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 15482 "configure"
+#line 14961 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15502,7 +14981,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14985: \"$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
@@ -15527,7 +15006,7 @@ fi
 done
 
        echo $ac_n "checking for LinuxThreads implementation""... $ac_c" 1>&6
-echo "configure:15531: checking for LinuxThreads implementation" >&5
+echo "configure:15010: 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
@@ -15540,7 +15019,7 @@ echo "$ac_t""$ol_cv_sys_linux_threads" 1>&6
        
        
        echo $ac_n "checking for LinuxThreads consistency""... $ac_c" 1>&6
-echo "configure:15544: checking for LinuxThreads consistency" >&5
+echo "configure:15023: checking for LinuxThreads consistency" >&5
 if eval "test \"\${ol_cv_linux_threads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -15565,7 +15044,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:15569: checking if pthread_create() works" >&5
+echo "configure:15048: 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
@@ -15574,10 +15053,13 @@ else
                                ol_cv_pthread_create_works=yes
 else
   cat > conftest.$ac_ext <<EOF
-#line 15578 "configure"
+#line 15057 "configure"
 #include "confdefs.h"
 /* pthread test headers */
 #include <pthread.h>
+#if HAVE_PTHREADS < 7
+#include <errno.h>
+#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -15595,60 +15077,43 @@ int main(argc, argv)
 {
 
        /* pthread test function */
+#ifndef PTHREAD_CREATE_DETACHED
+#define        PTHREAD_CREATE_DETACHED 1
+#endif
        pthread_t t;
        int status;
-       int detach = 1;
+       int detach = PTHREAD_CREATE_DETACHED;
 
-#ifdef HAVE_PTHREADS_FINAL
+#if HAVE_PTHREADS > 4
        /* 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);
+#if HAVE_PTHREADS < 7
+       status = pthread_attr_setdetachstate(&attr, &detach);
+       if( status < 0 ) status = errno;
 #else
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
-#endif
-
-#ifdef PTHREAD_CREATE_DETACHED
-       } else {
-               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+       status = pthread_attr_setdetachstate(&attr, detach);
 #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;
-       }
+#if HAVE_PTHREADS < 7
+       if( status < 0 ) status = errno;
 #endif
-
+       if( status ) return status;
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return status;
+       if( status ) return errno;
 
-       if( detach ) {
-               /* give thread a chance to complete */
-               /* it should remain joinable and hence detachable */
-               sleep( 1 );
+       /* give thread a chance to complete */
+       /* it should remain joinable and hence detachable */
+       sleep( 1 );
 
-               status = pthread_detach( &t );
-               if( status ) return status;
-       }
+       status = pthread_detach( &t );
+       if( status ) return errno;
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -15660,7 +15125,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:15664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:15129: \"$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
@@ -15682,7 +15147,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:15686: checking if select yields when using pthreads" >&5
+echo "configure:15151: 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
@@ -15691,7 +15156,7 @@ else
   ol_cv_pthread_select_yields=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 15695 "configure"
+#line 15160 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -15750,24 +15215,25 @@ int main(argc, argv)
 #endif
 #endif
 
-#if HAVE_PTHREADS_D4
+#if HAVE_PTHREADS < 6
        pthread_create(&t, pthread_attr_default, task, NULL);
 #else
        pthread_create(&t, NULL, task, NULL);
 #endif
 
-#if HAVE_SCHED_YIELD
-       sched_yield();  /* make sure task runs first */
-#else
-#ifdef HAVE_PTHREAD_YIELD
-       pthread_yield();        /* make sure task runs first */
-#endif
+       /* make sure task runs first */
+#if HAVE_THR_YIELD
+       thr_yield();
+#elif defined( HAVE_SCHED_YIELD )
+       sched_yield();
+#elif defined( HAVE_PTHREAD_YIELD )
+       pthread_yield();
 #endif
 
        exit(2);
 }
 EOF
-if { (eval echo configure:15771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:15237: \"$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
@@ -15811,17 +15277,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:15815: checking for $ac_hdr" >&5
+echo "configure:15281: 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 15820 "configure"
+#line 15286 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15291: \"$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*
@@ -15851,12 +15317,12 @@ done
                ol_with_threads=found
 
                                echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:15855: checking for cthread_fork" >&5
+echo "configure:15321: 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 15860 "configure"
+#line 15326 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char cthread_fork(); below.  */
@@ -15880,7 +15346,7 @@ f = cthread_fork;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15350: \"$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
@@ -15902,7 +15368,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:15906: checking for cthread_fork with -all_load" >&5
+echo "configure:15372: 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
@@ -15910,7 +15376,7 @@ else
                                                                save_LIBS="$LIBS"
                                LIBS="-all_load $LIBS"
                                cat > conftest.$ac_ext <<EOF
-#line 15914 "configure"
+#line 15380 "configure"
 #include "confdefs.h"
 #include <mach/cthreads.h>
 int main() {
@@ -15919,7 +15385,7 @@ int main() {
                                        
 ; return 0; }
 EOF
-if { (eval echo configure:15923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15389: \"$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
@@ -15949,12 +15415,12 @@ echo "$ac_t""$ol_cv_cthread_all_load" 1>&6
                                save_LIBS="$LIBS"
                LIBS="$LIBS -lthreads"
                echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:15953: checking for cthread_fork" >&5
+echo "configure:15419: 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 15958 "configure"
+#line 15424 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char cthread_fork(); below.  */
@@ -15978,7 +15444,7 @@ f = cthread_fork;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15448: \"$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
@@ -16028,17 +15494,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:16032: checking for $ac_hdr" >&5
+echo "configure:15498: 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 16037 "configure"
+#line 15503 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15508: \"$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*
@@ -16067,7 +15533,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:16071: checking for pth_version in -lpth" >&5
+echo "configure:15537: 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
@@ -16075,7 +15541,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpth  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 16079 "configure"
+#line 15545 "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
@@ -16086,7 +15552,7 @@ int main() {
 pth_version()
 ; return 0; }
 EOF
-if { (eval echo configure:16090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15556: \"$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
@@ -16131,17 +15597,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:16135: checking for $ac_hdr" >&5
+echo "configure:15601: 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 16140 "configure"
+#line 15606 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15611: \"$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*
@@ -16169,7 +15635,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:16173: checking for thr_create in -lthread" >&5
+echo "configure:15639: 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
@@ -16177,7 +15643,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 16181 "configure"
+#line 15647 "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
@@ -16188,7 +15654,7 @@ int main() {
 thr_create()
 ; return 0; }
 EOF
-if { (eval echo configure:16192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15658: \"$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
@@ -16228,12 +15694,12 @@ EOF
                        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:16232: checking for $ac_func" >&5
+echo "configure:15698: 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 16237 "configure"
+#line 15703 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -16257,7 +15723,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:16261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15727: \"$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
@@ -16288,17 +15754,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16292: checking for $ac_hdr" >&5
+echo "configure:15758: 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 16297 "configure"
+#line 15763 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15768: \"$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*
@@ -16326,7 +15792,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:16330: checking for lwp_create in -llwp" >&5
+echo "configure:15796: 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
@@ -16334,7 +15800,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-llwp  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 16338 "configure"
+#line 15804 "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
@@ -16345,7 +15811,7 @@ int main() {
 lwp_create()
 ; return 0; }
 EOF
-if { (eval echo configure:16349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15815: \"$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
@@ -16398,17 +15864,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:16402: checking for $ac_hdr" >&5
+echo "configure:15868: 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 16407 "configure"
+#line 15873 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15878: \"$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*
@@ -16437,12 +15903,12 @@ done
        for ac_func in sched_yield pthread_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:16441: checking for $ac_func" >&5
+echo "configure:15907: 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 16446 "configure"
+#line 15912 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -16455,89 +15921,2281 @@ 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
+/* 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:15936: \"$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
+
+       
+       echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
+echo "configure:15962: 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 15967 "configure"
+#include "confdefs.h"
+#include <pthread.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "pthread_kill_other_threads_np" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ol_cv_header_linux_threads=yes
+else
+  rm -rf conftest*
+  ol_cv_header_linux_threads=no
+fi
+rm -f conftest*
+
+               
+fi
+
+echo "$ac_t""$ol_cv_header_linux_threads" 1>&6
+       if test $ol_cv_header_linux_threads = yes; then
+               cat >> confdefs.h <<\EOF
+#define HAVE_LINUX_THREADS 1
+EOF
+
+       fi
+
+
+       for ac_hdr in mach/cthreads.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:15997: 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 16002 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:16007: \"$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
+
+       for ac_hdr in lwp/lwp.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:16037: 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 16042 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:16047: \"$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
+
+       for ac_hdr in thread.h synch.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:16077: 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 16082 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:16087: \"$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_threads != no -a $ol_link_threads != nt ; then  
+                       cat >> confdefs.h <<\EOF
+#define REENTRANT 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define THREAD_SAFE 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define THREADSAFE 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define _THREADSAFE 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define _SGI_MP_SOURCE 1
+EOF
+
+
+                       echo $ac_n "checking for thread specific errno""... $ac_c" 1>&6
+echo "configure:16146: 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 16152 "configure"
+#include "confdefs.h"
+#include <errno.h>
+int main() {
+errno = 0;
+; return 0; }
+EOF
+if { (eval echo configure:16159: \"$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 "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_errno_thread_specific=no
+fi
+rm -f conftest*
+       
+fi
+
+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:16175: 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 16181 "configure"
+#include "confdefs.h"
+#include <netdb.h>
+int main() {
+h_errno = 0;
+; return 0; }
+EOF
+if { (eval echo configure:16188: \"$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
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_h_errno_thread_specific=no
+fi
+rm -f conftest*
+       
+fi
+
+echo "$ac_t""$ol_cv_h_errno_thread_specific" 1>&6
+
+       if test $ol_cv_errno_thread_specific != yes \
+               -o $ol_cv_h_errno_thread_specific != yes ; then
+               LIBS="$LTHREAD_LIBS $LIBS"
+               LTHREAD_LIBS=""
+       fi
+
+fi  
+
+if test $ol_link_threads = no ; then
+       if test $ol_with_threads = yes ; then
+               { echo "configure: error: no suitable thread support" 1>&2; exit 1; }
+       fi
+
+       if test $ol_with_threads = auto ; then
+               echo "configure: warning: no suitable thread support, disabling threads" 1>&2
+               ol_with_threads=no
+       fi
+
+       cat >> confdefs.h <<\EOF
+#define NO_THREADS 1
+EOF
+
+       LTHREAD_LIBS=""
+fi
+
+if test $ol_link_threads != no ; then
+       cat >> confdefs.h <<\EOF
+#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE 1
+EOF
+
+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:16241: 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 16246 "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:16270: \"$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:16299: 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 16304 "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:16311: \"$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 16323 "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:16330: \"$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:16370: 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 16375 "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:16389: \"$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 16401 "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:16416: \"$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:16457: 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 16462 "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:16478: \"$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 16490 "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:16508: \"$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
+
+ol_link_ldbm=no 
+
+if test $ol_with_ldbm_api = auto \
+       -o $ol_with_ldbm_api = berkeley \
+       -o $ol_with_ldbm_api = bcompat ; then
+
+       if test $ol_with_ldbm_api = bcompat; then \
+               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:16558: 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 16563 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:16568: \"$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_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:16596: 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 16602 "configure"
+#include "confdefs.h"
+
+#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_1" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ol_cv_header_db1=yes
+else
+  rm -rf conftest*
+  ol_cv_header_db1=no
+fi
+rm -f conftest*
+
+fi
+
+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:16639: 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 $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 16649 "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:16696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_none=yes
+else
+  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"
+
+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 (-ldb42)""... $ac_c" 1>&6
+echo "configure:16720: checking for Berkeley DB link (-ldb42)" >&5
+if eval "test \"\${ol_cv_db_db42+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb42
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 16730 "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:16777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db42=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db42=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db42" 1>&6
+
+       if test $ol_cv_db_db42 = yes ; then
+               ol_cv_lib_db=-ldb42
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-42)""... $ac_c" 1>&6
+echo "configure:16801: checking for Berkeley DB link (-ldb-42)" >&5
+if eval "test \"\${ol_cv_db_db_42+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-42
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 16811 "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:16858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_42=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_42=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_42" 1>&6
+
+       if test $ol_cv_db_db_42 = yes ; then
+               ol_cv_lib_db=-ldb-42
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4.2)""... $ac_c" 1>&6
+echo "configure:16882: checking for Berkeley DB link (-ldb-4.2)" >&5
+if eval "test \"\${ol_cv_db_db_4_dot_2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-4.2
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 16892 "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:16939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_4_dot_2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_4_dot_2=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_4_dot_2" 1>&6
+
+       if test $ol_cv_db_db_4_dot_2 = yes ; then
+               ol_cv_lib_db=-ldb-4.2
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4-2)""... $ac_c" 1>&6
+echo "configure:16963: checking for Berkeley DB link (-ldb-4-2)" >&5
+if eval "test \"\${ol_cv_db_db_4_2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-4-2
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 16973 "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:17020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_4_2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_4_2=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_4_2" 1>&6
+
+       if test $ol_cv_db_db_4_2 = yes ; then
+               ol_cv_lib_db=-ldb-4-2
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4)""... $ac_c" 1>&6
+echo "configure:17044: checking for Berkeley DB link (-ldb-4)" >&5
+if eval "test \"\${ol_cv_db_db_4+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-4
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17054 "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:17101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_4=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_4=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_4" 1>&6
+
+       if test $ol_cv_db_db_4 = yes ; then
+               ol_cv_lib_db=-ldb-4
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
+echo "configure:17125: checking for Berkeley DB link (-ldb4)" >&5
+if eval "test \"\${ol_cv_db_db4+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb4
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17135 "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:17182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db4=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db4=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db4" 1>&6
+
+       if test $ol_cv_db_db4 = yes ; then
+               ol_cv_lib_db=-ldb4
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb41)""... $ac_c" 1>&6
+echo "configure:17206: checking for Berkeley DB link (-ldb41)" >&5
+if eval "test \"\${ol_cv_db_db41+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb41
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17216 "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:17263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db41=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db41=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db41" 1>&6
+
+       if test $ol_cv_db_db41 = yes ; then
+               ol_cv_lib_db=-ldb41
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-41)""... $ac_c" 1>&6
+echo "configure:17287: checking for Berkeley DB link (-ldb-41)" >&5
+if eval "test \"\${ol_cv_db_db_41+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-41
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17297 "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:17344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_41=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_41=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_41" 1>&6
+
+       if test $ol_cv_db_db_41 = yes ; then
+               ol_cv_lib_db=-ldb-41
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4.1)""... $ac_c" 1>&6
+echo "configure:17368: checking for Berkeley DB link (-ldb-4.1)" >&5
+if eval "test \"\${ol_cv_db_db_4_dot_1+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-4.1
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17378 "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:17425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_4_dot_1=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_4_dot_1=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_4_dot_1" 1>&6
+
+       if test $ol_cv_db_db_4_dot_1 = yes ; then
+               ol_cv_lib_db=-ldb-4.1
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4-1)""... $ac_c" 1>&6
+echo "configure:17449: checking for Berkeley DB link (-ldb-4-1)" >&5
+if eval "test \"\${ol_cv_db_db_4_1+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-4-1
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17459 "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:17506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_4_1=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_4_1=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_4_1" 1>&6
+
+       if test $ol_cv_db_db_4_1 = yes ; then
+               ol_cv_lib_db=-ldb-4-1
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4)""... $ac_c" 1>&6
+echo "configure:17530: checking for Berkeley DB link (-ldb-4)" >&5
+if eval "test \"\${ol_cv_db_db_4+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-4
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17540 "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:17587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_4=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_4=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_4" 1>&6
+
+       if test $ol_cv_db_db_4 = yes ; then
+               ol_cv_lib_db=-ldb-4
+       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:17611: 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
+  
+       ol_DB_LIB=-ldb
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17621 "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:17668: \"$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:17692: 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 $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17702 "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:17749: \"$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 (-ldb-3)""... $ac_c" 1>&6
+echo "configure:17773: checking for Berkeley DB link (-ldb-3)" >&5
+if eval "test \"\${ol_cv_db_db_3+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-3
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17783 "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:17830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_3=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_3=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_3" 1>&6
+
+       if test $ol_cv_db_db_3 = yes ; then
+               ol_cv_lib_db=-ldb-3
+       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:17854: 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 $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17864 "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:17911: \"$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 (-ldb-2)""... $ac_c" 1>&6
+echo "configure:17935: checking for Berkeley DB link (-ldb-2)" >&5
+if eval "test \"\${ol_cv_db_db_2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-2
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 17945 "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:17992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db_2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db_2=no
+fi
+rm -f conftest*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+echo "$ac_t""$ol_cv_db_db_2" 1>&6
+
+       if test $ol_cv_db_db_2 = yes ; then
+               ol_cv_lib_db=-ldb-2
+       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:18016: 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 $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 18026 "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:18073: \"$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*
+
+       LIBS="$ol_LIBS"
+
+fi
+
+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
+       echo $ac_n "checking for Berkeley DB link (-ldb-1)""... $ac_c" 1>&6
+echo "configure:18097: checking for Berkeley DB link (-ldb-1)" >&5
+if eval "test \"\${ol_cv_db_db_1+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-1
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 18107 "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
-f = $ac_func;
+       (void) dbopen( NULL, 0, 0, 0, NULL);
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:16470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18154: \"$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"
+  ol_cv_db_db_1=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  ol_cv_db_db_1=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
+       LIBS="$ol_LIBS"
 
-       
-       echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:16496: 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 16501 "configure"
-#include "confdefs.h"
-#include <pthread.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pthread_kill_other_threads_np" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ol_cv_header_linux_threads=yes
-else
-  rm -rf conftest*
-  ol_cv_header_linux_threads=no
 fi
-rm -f conftest*
 
-               
+echo "$ac_t""$ol_cv_db_db_1" 1>&6
+
+       if test $ol_cv_db_db_1 = yes ; then
+               ol_cv_lib_db=-ldb-1
+       fi
 fi
 
-echo "$ac_t""$ol_cv_header_linux_threads" 1>&6
-       if test $ol_cv_header_linux_threads = yes; then
-               cat >> confdefs.h <<\EOF
-#define HAVE_LINUX_THREADS 1
-EOF
 
+               if test "$ol_cv_lib_db" != no ; then
+                       ol_cv_berkeley_db=yes
+               fi
        fi
+fi
 
-
-       for ac_hdr in mach/cthreads.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:16531: checking for $ac_hdr" >&5
+echo "configure:18189: 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 16536 "configure"
+#line 18194 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16541: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:18199: \"$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
 
-       for ac_hdr in lwp/lwp.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16571: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+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:18229: 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 16576 "configure"
+  
+       ol_DB_LIB=
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 18239 "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:16581: \"$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:18286: \"$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_none=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_none=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
-EOF
-else
-  echo "$ac_t""no" 1>&6
+
+echo "$ac_t""$ol_cv_db_none" 1>&6
+
+       if test $ol_cv_db_none = yes ; then
+               ol_cv_lib_db=yes
+       fi
 fi
-done
 
-       for ac_hdr in thread.h synch.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16611: 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 (-ldb42)""... $ac_c" 1>&6
+echo "configure:18310: checking for Berkeley DB link (-ldb42)" >&5
+if eval "test \"\${ol_cv_db_db42+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 16616 "configure"
+  
+       ol_DB_LIB=-ldb42
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 18320 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16621: \"$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
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
+#endif
 
-if test $ol_link_threads != no -a $ol_link_threads != nt ; then  
-                       cat >> confdefs.h <<\EOF
-#define REENTRANT 1
-EOF
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
+#endif
 
-       cat >> confdefs.h <<\EOF
-#define _REENTRANT 1
-EOF
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
 
-       cat >> confdefs.h <<\EOF
-#define THREAD_SAFE 1
-EOF
+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
 
-       cat >> confdefs.h <<\EOF
-#define _THREAD_SAFE 1
+; return 0; }
 EOF
+if { (eval echo configure:18367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ol_cv_db_db42=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_db_db42=no
+fi
+rm -f conftest*
 
-       cat >> confdefs.h <<\EOF
-#define THREADSAFE 1
-EOF
+       LIBS="$ol_LIBS"
 
-       cat >> confdefs.h <<\EOF
-#define _THREADSAFE 1
-EOF
+fi
 
-       cat >> confdefs.h <<\EOF
-#define _SGI_MP_SOURCE 1
-EOF
+echo "$ac_t""$ol_cv_db_db42" 1>&6
 
+       if test $ol_cv_db_db42 = yes ; then
+               ol_cv_lib_db=-ldb42
+       fi
+fi
 
-                       echo $ac_n "checking for thread specific errno""... $ac_c" 1>&6
-echo "configure:16680: checking for thread specific errno" >&5
-if eval "test \"\${ol_cv_errno_thread_specific+set}\" = set"; then
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-42)""... $ac_c" 1>&6
+echo "configure:18391: checking for Berkeley DB link (-ldb-42)" >&5
+if eval "test \"\${ol_cv_db_db_42+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-               cat > conftest.$ac_ext <<EOF
-#line 16686 "configure"
+       ol_DB_LIB=-ldb-42
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 18401 "configure"
 #include "confdefs.h"
-#include <errno.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() {
-errno = 0;
+
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\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:16693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_errno_thread_specific=yes
+  ol_cv_db_db_42=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_errno_thread_specific=no
+  ol_cv_db_db_42=no
 fi
 rm -f conftest*
-       
+
+       LIBS="$ol_LIBS"
+
 fi
 
-echo "$ac_t""$ol_cv_errno_thread_specific" 1>&6
+echo "$ac_t""$ol_cv_db_db_42" 1>&6
 
-                       echo $ac_n "checking for thread specific h_errno""... $ac_c" 1>&6
-echo "configure:16709: checking for thread specific h_errno" >&5
-if eval "test \"\${ol_cv_h_errno_thread_specific+set}\" = set"; then
+       if test $ol_cv_db_db_42 = yes ; then
+               ol_cv_lib_db=-ldb-42
+       fi
+fi
+
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4.2)""... $ac_c" 1>&6
+echo "configure:18472: checking for Berkeley DB link (-ldb-4.2)" >&5
+if eval "test \"\${ol_cv_db_db_4_dot_2+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-               cat > conftest.$ac_ext <<EOF
-#line 16715 "configure"
+       ol_DB_LIB=-ldb-4.2
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 18482 "configure"
 #include "confdefs.h"
-#include <netdb.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() {
-h_errno = 0;
+
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
+
+               version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor < DB_VERSION_MINOR )
+               {
+                       printf("Berkeley DB version mismatch\n"
+                               "\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:16722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18529: \"$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
+  ol_cv_db_db_4_dot_2=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_h_errno_thread_specific=no
+  ol_cv_db_db_4_dot_2=no
 fi
 rm -f conftest*
-       
+
+       LIBS="$ol_LIBS"
+
 fi
 
-echo "$ac_t""$ol_cv_h_errno_thread_specific" 1>&6
+echo "$ac_t""$ol_cv_db_db_4_dot_2" 1>&6
 
-       if test $ol_cv_errno_thread_specific != yes \
-               -o $ol_cv_h_errno_thread_specific != yes ; then
-               LIBS="$LTHREAD_LIBS $LIBS"
-               LTHREAD_LIBS=""
+       if test $ol_cv_db_db_4_dot_2 = yes ; then
+               ol_cv_lib_db=-ldb-4.2
        fi
+fi
 
-fi  
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4-2)""... $ac_c" 1>&6
+echo "configure:18553: checking for Berkeley DB link (-ldb-4-2)" >&5
+if eval "test \"\${ol_cv_db_db_4_2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       ol_DB_LIB=-ldb-4-2
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
-if test $ol_link_threads = no ; then
-       if test $ol_with_threads = yes ; then
-               { echo "configure: error: no suitable thread support" 1>&2; exit 1; }
-       fi
+       cat > conftest.$ac_ext <<EOF
+#line 18563 "configure"
+#include "confdefs.h"
 
-       if test $ol_with_threads = auto ; then
-               echo "configure: warning: no suitable thread support, disabling threads" 1>&2
-               ol_with_threads=no
-       fi
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
+#else
+# include <db.h>
+#endif
 
-       cat >> confdefs.h <<\EOF
-#define NO_THREADS 1
-EOF
+#ifndef DB_VERSION_MAJOR
+# define DB_VERSION_MAJOR 1
+#endif
 
-       LTHREAD_LIBS=""
-fi
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
 
-if test $ol_link_threads != no ; then
-       cat >> confdefs.h <<\EOF
-#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE 1
-EOF
+int main() {
 
-fi
+#if DB_VERSION_MAJOR > 1
+       {
+               char *version;
+               int major, minor, patch;
 
-ol_link_ldbm=no 
+               version = db_version( &major, &minor, &patch );
 
-if test $ol_with_ldbm_api = auto \
-       -o $ol_with_ldbm_api = berkeley \
-       -o $ol_with_ldbm_api = bcompat ; then
+               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 test $ol_with_ldbm_api = bcompat; then \
-               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:16780: 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 16785 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
+#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:16790: \"$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:18610: \"$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_db_4_2=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_db_4_2=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
-EOF
-else
-  echo "$ac_t""no" 1>&6
+
+echo "$ac_t""$ol_cv_db_db_4_2" 1>&6
+
+       if test $ol_cv_db_db_4_2 = yes ; then
+               ol_cv_lib_db=-ldb-4-2
+       fi
 fi
-done
 
-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:16818: checking if Berkeley DB header compatibility" >&5
-if eval "test \"\${ol_cv_header_db1+set}\" = set"; then
+if test $ol_cv_lib_db = no ; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4)""... $ac_c" 1>&6
+echo "configure:18634: checking for Berkeley DB link (-ldb-4)" >&5
+if eval "test \"\${ol_cv_db_db_4+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-               cat > conftest.$ac_ext <<EOF
-#line 16824 "configure"
+       ol_DB_LIB=-ldb-4
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 18644 "configure"
 #include "confdefs.h"
 
-#if HAVE_DB_185_H
-#      include <db_185.h>
+#ifdef HAVE_DB_185_H
+# include <db_185.h>
 #else
-#      include <db.h>
+# include <db.h>
 #endif
 
- /* this check could be improved */
 #ifndef DB_VERSION_MAJOR
-#      define DB_VERSION_MAJOR 1
+# define DB_VERSION_MAJOR 1
 #endif
 
-#if DB_VERSION_MAJOR == 1 
-       __db_version_1
+#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 "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "__db_version_1" >/dev/null 2>&1; then
+if { (eval echo configure:18691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_header_db1=yes
+  ol_cv_db_db_4=yes
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_header_db1=no
+  ol_cv_db_db_4=no
 fi
 rm -f conftest*
 
+       LIBS="$ol_LIBS"
+
 fi
 
-echo "$ac_t""$ol_cv_header_db1" 1>&6
+echo "$ac_t""$ol_cv_db_db_4" 1>&6
+
+       if test $ol_cv_db_db_4 = yes ; then
+               ol_cv_lib_db=-ldb-4
+       fi
+fi
 
-       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:16861: checking for Berkeley DB link (default)" >&5
-if eval "test \"\${ol_cv_db_none+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
+echo "configure:18715: checking for Berkeley DB link (-ldb4)" >&5
+if eval "test \"\${ol_cv_db_db4+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=
+       ol_DB_LIB=-ldb4
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 16871 "configure"
+#line 18725 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -16914,14 +18768,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_none=yes
+  ol_cv_db_db4=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_none=no
+  ol_cv_db_db4=no
 fi
 rm -f conftest*
 
@@ -16929,26 +18783,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_none" 1>&6
+echo "$ac_t""$ol_cv_db_db4" 1>&6
 
-       if test $ol_cv_db_none = yes ; then
-               ol_cv_lib_db=yes
+       if test $ol_cv_db_db4 = yes ; then
+               ol_cv_lib_db=-ldb4
        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:16942: checking for Berkeley DB link (-ldb)" >&5
-if eval "test \"\${ol_cv_db_db+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb41)""... $ac_c" 1>&6
+echo "configure:18796: checking for Berkeley DB link (-ldb41)" >&5
+if eval "test \"\${ol_cv_db_db41+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb
+       ol_DB_LIB=-ldb41
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 16952 "configure"
+#line 18806 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -16995,14 +18849,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db=yes
+  ol_cv_db_db41=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db=no
+  ol_cv_db_db41=no
 fi
 rm -f conftest*
 
@@ -17010,26 +18864,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db" 1>&6
+echo "$ac_t""$ol_cv_db_db41" 1>&6
 
-       if test $ol_cv_db_db = yes ; then
-               ol_cv_lib_db=-ldb
+       if test $ol_cv_db_db41 = yes ; then
+               ol_cv_lib_db=-ldb41
        fi
 fi
 
 if test $ol_cv_lib_db = no ; then
-       echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
-echo "configure:17023: checking for Berkeley DB link (-ldb4)" >&5
-if eval "test \"\${ol_cv_db_db4+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-41)""... $ac_c" 1>&6
+echo "configure:18877: checking for Berkeley DB link (-ldb-41)" >&5
+if eval "test \"\${ol_cv_db_db_41+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb4
+       ol_DB_LIB=-ldb-41
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17033 "configure"
+#line 18887 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17076,14 +18930,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db4=yes
+  ol_cv_db_db_41=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db4=no
+  ol_cv_db_db_41=no
 fi
 rm -f conftest*
 
@@ -17091,26 +18945,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db4" 1>&6
+echo "$ac_t""$ol_cv_db_db_41" 1>&6
 
-       if test $ol_cv_db_db4 = yes ; then
-               ol_cv_lib_db=-ldb4
+       if test $ol_cv_db_db_41 = yes ; then
+               ol_cv_lib_db=-ldb-41
        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:17104: checking for Berkeley DB link (-ldb3)" >&5
-if eval "test \"\${ol_cv_db_db3+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4.1)""... $ac_c" 1>&6
+echo "configure:18958: checking for Berkeley DB link (-ldb-4.1)" >&5
+if eval "test \"\${ol_cv_db_db_4_dot_1+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb3
+       ol_DB_LIB=-ldb-4.1
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17114 "configure"
+#line 18968 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17157,14 +19011,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db3=yes
+  ol_cv_db_db_4_dot_1=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db3=no
+  ol_cv_db_db_4_dot_1=no
 fi
 rm -f conftest*
 
@@ -17172,26 +19026,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db3" 1>&6
+echo "$ac_t""$ol_cv_db_db_4_dot_1" 1>&6
 
-       if test $ol_cv_db_db3 = yes ; then
-               ol_cv_lib_db=-ldb3
+       if test $ol_cv_db_db_4_dot_1 = yes ; then
+               ol_cv_lib_db=-ldb-4.1
        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:17185: checking for Berkeley DB link (-ldb2)" >&5
-if eval "test \"\${ol_cv_db_db2+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4-1)""... $ac_c" 1>&6
+echo "configure:19039: checking for Berkeley DB link (-ldb-4-1)" >&5
+if eval "test \"\${ol_cv_db_db_4_1+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb2
+       ol_DB_LIB=-ldb-4-1
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17195 "configure"
+#line 19049 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17238,14 +19092,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db2=yes
+  ol_cv_db_db_4_1=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db2=no
+  ol_cv_db_db_4_1=no
 fi
 rm -f conftest*
 
@@ -17253,26 +19107,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db2" 1>&6
+echo "$ac_t""$ol_cv_db_db_4_1" 1>&6
 
-       if test $ol_cv_db_db2 = yes ; then
-               ol_cv_lib_db=-ldb2
+       if test $ol_cv_db_db_4_1 = yes ; then
+               ol_cv_lib_db=-ldb-4-1
        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:17266: checking for Berkeley DB link (-ldb1)" >&5
-if eval "test \"\${ol_cv_db_db1+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-4)""... $ac_c" 1>&6
+echo "configure:19120: checking for Berkeley DB link (-ldb-4)" >&5
+if eval "test \"\${ol_cv_db_db_4+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb1
+       ol_DB_LIB=-ldb-4
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17276 "configure"
+#line 19130 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17319,14 +19173,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db1=yes
+  ol_cv_db_db_4=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db1=no
+  ol_cv_db_db_4=no
 fi
 rm -f conftest*
 
@@ -17334,77 +19188,107 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db1" 1>&6
-
-       if test $ol_cv_db_db1 = yes ; then
-               ol_cv_lib_db=-ldb1
-       fi
-fi
-
+echo "$ac_t""$ol_cv_db_db_4" 1>&6
 
-               if test "$ol_cv_lib_db" != no ; then
-                       ol_cv_berkeley_db=yes
-               fi
+       if test $ol_cv_db_db_4 = yes ; then
+               ol_cv_lib_db=-ldb-4
        fi
 fi
 
-       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:17358: 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 (-ldb)""... $ac_c" 1>&6
+echo "configure:19201: 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
-  cat > conftest.$ac_ext <<EOF
-#line 17363 "configure"
+  
+       ol_DB_LIB=-ldb
+       ol_LIBS=$LIBS
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
+
+       cat > conftest.$ac_ext <<EOF
+#line 19211 "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:17368: \"$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:19258: \"$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_db=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_db=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
-EOF
-else
-  echo "$ac_t""no" 1>&6
+
+echo "$ac_t""$ol_cv_db_db" 1>&6
+
+       if test $ol_cv_db_db = yes ; then
+               ol_cv_lib_db=-ldb
+       fi
 fi
-done
 
-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:17398: checking for Berkeley DB link (default)" >&5
-if eval "test \"\${ol_cv_db_none+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb3)""... $ac_c" 1>&6
+echo "configure:19282: 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=
+       ol_DB_LIB=-ldb3
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17408 "configure"
+#line 19292 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17451,14 +19335,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_none=yes
+  ol_cv_db_db3=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_none=no
+  ol_cv_db_db3=no
 fi
 rm -f conftest*
 
@@ -17466,26 +19350,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_none" 1>&6
+echo "$ac_t""$ol_cv_db_db3" 1>&6
 
-       if test $ol_cv_db_none = yes ; then
-               ol_cv_lib_db=yes
+       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 (-ldb)""... $ac_c" 1>&6
-echo "configure:17479: checking for Berkeley DB link (-ldb)" >&5
-if eval "test \"\${ol_cv_db_db+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-3)""... $ac_c" 1>&6
+echo "configure:19363: checking for Berkeley DB link (-ldb-3)" >&5
+if eval "test \"\${ol_cv_db_db_3+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb
+       ol_DB_LIB=-ldb-3
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17489 "configure"
+#line 19373 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17532,14 +19416,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db=yes
+  ol_cv_db_db_3=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db=no
+  ol_cv_db_db_3=no
 fi
 rm -f conftest*
 
@@ -17547,26 +19431,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db" 1>&6
+echo "$ac_t""$ol_cv_db_db_3" 1>&6
 
-       if test $ol_cv_db_db = yes ; then
-               ol_cv_lib_db=-ldb
+       if test $ol_cv_db_db_3 = yes ; then
+               ol_cv_lib_db=-ldb-3
        fi
 fi
 
 if test $ol_cv_lib_db = no ; then
-       echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
-echo "configure:17560: checking for Berkeley DB link (-ldb4)" >&5
-if eval "test \"\${ol_cv_db_db4+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb2)""... $ac_c" 1>&6
+echo "configure:19444: 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=-ldb4
+       ol_DB_LIB=-ldb2
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17570 "configure"
+#line 19454 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17613,14 +19497,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db4=yes
+  ol_cv_db_db2=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db4=no
+  ol_cv_db_db2=no
 fi
 rm -f conftest*
 
@@ -17628,26 +19512,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db4" 1>&6
+echo "$ac_t""$ol_cv_db_db2" 1>&6
 
-       if test $ol_cv_db_db4 = yes ; then
-               ol_cv_lib_db=-ldb4
+       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 (-ldb3)""... $ac_c" 1>&6
-echo "configure:17641: checking for Berkeley DB link (-ldb3)" >&5
-if eval "test \"\${ol_cv_db_db3+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-2)""... $ac_c" 1>&6
+echo "configure:19525: checking for Berkeley DB link (-ldb-2)" >&5
+if eval "test \"\${ol_cv_db_db_2+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb3
+       ol_DB_LIB=-ldb-2
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17651 "configure"
+#line 19535 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17694,14 +19578,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db3=yes
+  ol_cv_db_db_2=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db3=no
+  ol_cv_db_db_2=no
 fi
 rm -f conftest*
 
@@ -17709,26 +19593,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db3" 1>&6
+echo "$ac_t""$ol_cv_db_db_2" 1>&6
 
-       if test $ol_cv_db_db3 = yes ; then
-               ol_cv_lib_db=-ldb3
+       if test $ol_cv_db_db_2 = yes ; then
+               ol_cv_lib_db=-ldb-2
        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:17722: checking for Berkeley DB link (-ldb2)" >&5
-if eval "test \"\${ol_cv_db_db2+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb1)""... $ac_c" 1>&6
+echo "configure:19606: 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=-ldb2
+       ol_DB_LIB=-ldb1
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17732 "configure"
+#line 19616 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17775,14 +19659,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db2=yes
+  ol_cv_db_db1=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db2=no
+  ol_cv_db_db1=no
 fi
 rm -f conftest*
 
@@ -17790,26 +19674,26 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db2" 1>&6
+echo "$ac_t""$ol_cv_db_db1" 1>&6
 
-       if test $ol_cv_db_db2 = yes ; then
-               ol_cv_lib_db=-ldb2
+       if test $ol_cv_db_db1 = yes ; then
+               ol_cv_lib_db=-ldb1
        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:17803: checking for Berkeley DB link (-ldb1)" >&5
-if eval "test \"\${ol_cv_db_db1+set}\" = set"; then
+       echo $ac_n "checking for Berkeley DB link (-ldb-1)""... $ac_c" 1>&6
+echo "configure:19687: checking for Berkeley DB link (-ldb-1)" >&5
+if eval "test \"\${ol_cv_db_db_1+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-       ol_DB_LIB=-ldb1
+       ol_DB_LIB=-ldb-1
        ol_LIBS=$LIBS
-       LIBS="$ol_DB_LIB $LIBS"
+       LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17813 "configure"
+#line 19697 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17856,14 +19740,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ol_cv_db_db1=yes
+  ol_cv_db_db_1=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_db_db1=no
+  ol_cv_db_db_1=no
 fi
 rm -f conftest*
 
@@ -17871,10 +19755,10 @@ rm -f conftest*
 
 fi
 
-echo "$ac_t""$ol_cv_db_db1" 1>&6
+echo "$ac_t""$ol_cv_db_db_1" 1>&6
 
-       if test $ol_cv_db_db1 = yes ; then
-               ol_cv_lib_db=-ldb1
+       if test $ol_cv_db_db_1 = yes ; then
+               ol_cv_lib_db=-ldb-1
        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:17886: checking for Berkeley DB thread support" >&5
+echo "configure:19770: 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"
+       LIBS="$LTHREAD_LIBS $LIBS"
        if test $ol_cv_lib_db != yes ; then
-               LIBS="$ol_cv_lib_db"
+               LIBS="$ol_cv_lib_db $LIBS"
        fi
 
        if test "$cross_compiling" = yes; then
   ol_cv_berkeley_db_thread=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 17900 "configure"
+#line 19785 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17963,7 +19848,7 @@ main()
        return rc;
 }
 EOF
-if { (eval echo configure:17967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:19852: \"$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
 
        LIBS="$ol_LIBS"
 
+fi
+
+echo "$ac_t""$ol_cv_berkeley_db_thread" 1>&6
+
        if test $ol_cv_berkeley_db_thread != no ; then
                cat >> confdefs.h <<\EOF
 #define HAVE_BERKELEY_DB_THREAD 1
@@ -17985,9 +19874,6 @@ EOF
 
        fi
 
-fi
-
-echo "$ac_t""$ol_cv_berkeley_db_thread" 1>&6
        fi
 fi
 
@@ -18024,13 +19910,13 @@ if test $ol_enable_bdb = yes -a $ol_link_ldbm != berkeley ; then
        { echo "configure: error: BDB: BerkeleyDB not available" 1>&2; exit 1; }
 elif test $ol_enable_bdb != no -a $ol_link_ldbm = berkeley ; then
        echo $ac_n "checking Berkeley DB version for BDB backend""... $ac_c" 1>&6
-echo "configure:18028: checking Berkeley DB version for BDB backend" >&5
+echo "configure:19914: checking Berkeley DB version for BDB backend" >&5
 if eval "test \"\${ol_cv_bdb_compat+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 18034 "configure"
+#line 19920 "configure"
 #include "confdefs.h"
 
 #include <db.h>
@@ -18039,9 +19925,12 @@ else
 #ifndef DB_VERSION_MAJOR
 #      define DB_VERSION_MAJOR 1
 #endif
+#ifndef DB_VERSION_MINOR
+#      define DB_VERSION_MINOR 0
+#endif
 
-/* require 4.0 or later */
-#if DB_VERSION_MAJOR >= 4 
+/* require 4.2 or later */
+#if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 2)
        __db_version_compat
 #endif
        
@@ -18069,6 +19958,9 @@ echo "$ac_t""$ol_cv_bdb_compat" 1>&6
                ol_enable_bdb=no
        fi
 fi
+if test $ol_enable_hdb = yes -a $ol_link_ldbm != berkeley ; then
+       { echo "configure: error: HDB: BerkeleyDB not available" 1>&2; exit 1; }
+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
 
 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:18081: checking for MDBM library" >&5
+echo "configure:19973: 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:18087: checking for mdbm_set_chain" >&5
+echo "configure:19979: 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 18092 "configure"
+#line 19984 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char mdbm_set_chain(); below.  */
@@ -18112,7 +20004,7 @@ f = mdbm_set_chain;
 
 ; return 0; }
 EOF
-if { (eval echo configure:18116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20008: \"$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
@@ -18131,7 +20023,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for mdbm_set_chain in -lmdbm""... $ac_c" 1>&6
-echo "configure:18135: checking for mdbm_set_chain in -lmdbm" >&5
+echo "configure:20027: 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
@@ -18139,7 +20031,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmdbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18143 "configure"
+#line 20035 "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
@@ -18150,7 +20042,7 @@ int main() {
 mdbm_set_chain()
 ; return 0; }
 EOF
-if { (eval echo configure:18154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20046: \"$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
@@ -18185,17 +20077,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:18189: checking for $ac_hdr" >&5
+echo "configure:20081: 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 18194 "configure"
+#line 20086 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18199: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20091: \"$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*
@@ -18222,7 +20114,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:18226: checking for db" >&5
+echo "configure:20118: 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:18259: checking for GDBM library" >&5
+echo "configure:20151: 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:18265: checking for gdbm_open" >&5
+echo "configure:20157: 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 18270 "configure"
+#line 20162 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gdbm_open(); below.  */
@@ -18290,7 +20182,7 @@ f = gdbm_open;
 
 ; return 0; }
 EOF
-if { (eval echo configure:18294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20186: \"$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
@@ -18309,7 +20201,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:18313: checking for gdbm_open in -lgdbm" >&5
+echo "configure:20205: 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
@@ -18317,7 +20209,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgdbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18321 "configure"
+#line 20213 "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
@@ -18328,7 +20220,7 @@ int main() {
 gdbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:18332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20224: \"$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
@@ -18363,17 +20255,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:18367: checking for $ac_hdr" >&5
+echo "configure:20259: 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 18372 "configure"
+#line 20264 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20269: \"$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*
@@ -18400,7 +20292,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:18404: checking for db" >&5
+echo "configure:20296: checking for db" >&5
 if eval "test \"\${ol_cv_gdbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 
 if test $ol_with_ldbm_api = ndbm ; then
        echo $ac_n "checking for NDBM library""... $ac_c" 1>&6
-echo "configure:18438: checking for NDBM library" >&5
+echo "configure:20330: 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:18444: checking for dbm_open" >&5
+echo "configure:20336: 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 18449 "configure"
+#line 20341 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -18469,7 +20361,7 @@ f = dbm_open;
 
 ; return 0; }
 EOF
-if { (eval echo configure:18473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20365: \"$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
@@ -18488,7 +20380,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:18492: checking for dbm_open in -lndbm" >&5
+echo "configure:20384: 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
@@ -18496,7 +20388,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lndbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18500 "configure"
+#line 20392 "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
@@ -18507,7 +20399,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:18511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20403: \"$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
@@ -18527,7 +20419,7 @@ else
   echo "$ac_t""no" 1>&6
 
                        echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:18531: checking for dbm_open in -ldbm" >&5
+echo "configure:20423: 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
@@ -18535,7 +20427,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18539 "configure"
+#line 20431 "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
@@ -18546,7 +20438,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:18550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20442: \"$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
@@ -18583,17 +20475,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:18587: checking for $ac_hdr" >&5
+echo "configure:20479: 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 18592 "configure"
+#line 20484 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18597: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20489: \"$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*
@@ -18620,7 +20512,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:18624: checking for db" >&5
+echo "configure:20516: checking for db" >&5
 if eval "test \"\${ol_cv_ndbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -18662,14 +20554,17 @@ 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
        BUILD_LIBS_DYNAMIC=shared
        cat >> confdefs.h <<\EOF
 #define LDAP_LIBS_DYNAMIC 1
 EOF
 
+       LTSTATIC=""
 else
        BUILD_LIBS_DYNAMIC=static
+       LTSTATIC="-static"
 fi
 
 if test $ol_enable_wrappers != no ; then
@@ -18677,17 +20572,17 @@ if test $ol_enable_wrappers != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:18681: checking for $ac_hdr" >&5
+echo "configure:20576: 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 18686 "configure"
+#line 20581 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18691: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20586: \"$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*
@@ -18709,11 +20604,11 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
 EOF
  
                echo $ac_n "checking for TCP wrappers library""... $ac_c" 1>&6
-echo "configure:18713: checking for TCP wrappers library" >&5
+echo "configure:20608: checking for TCP wrappers library" >&5
                save_LIBS="$LIBS"
                LIBS="$LIBS -lwrap"
                cat > conftest.$ac_ext <<EOF
-#line 18717 "configure"
+#line 20612 "configure"
 #include "confdefs.h"
 
 #include <tcpd.h>
@@ -18728,7 +20623,7 @@ hosts_access(req)
                
 ; return 0; }
 EOF
-if { (eval echo configure:18732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""-lwrap" 1>&6
                have_wrappers=yes
@@ -18740,7 +20635,7 @@ else
   
                                LIBS="$LIBS -lnsl"
                cat > conftest.$ac_ext <<EOF
-#line 18744 "configure"
+#line 20639 "configure"
 #include "confdefs.h"
 
 #include <tcpd.h>
@@ -18755,7 +20650,7 @@ hosts_access(req)
                
 ; return 0; }
 EOF
-if { (eval echo configure:18759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""-lwrap -lnsl" 1>&6
                have_wrappers=yes
 
 if test $ol_enable_syslog != no ; then
        echo $ac_n "checking for openlog""... $ac_c" 1>&6
-echo "configure:18799: checking for openlog" >&5
+echo "configure:20694: 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 18804 "configure"
+#line 20699 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char openlog(); below.  */
@@ -18824,7 +20719,7 @@ f = openlog;
 
 ; return 0; }
 EOF
-if { (eval echo configure:18828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20723: \"$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_link_sql=no
 if test $ol_enable_sql != no ; then
+       for ac_hdr in sql.h sqlext.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:20755: 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 20760 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:20765: \"$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
+{ echo "configure: error: could not locate SQL headers" 1>&2; exit 1; }
+       
+fi
+done
+
+
        echo $ac_n "checking for SQLDriverConnect in -liodbc""... $ac_c" 1>&6
-echo "configure:18857: checking for SQLDriverConnect in -liodbc" >&5
+echo "configure:20795: 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
@@ -18861,7 +20799,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-liodbc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18865 "configure"
+#line 20803 "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
@@ -18872,7 +20810,7 @@ int main() {
 SQLDriverConnect()
 ; return 0; }
 EOF
-if { (eval echo configure:18876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20814: \"$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
@@ -18897,7 +20835,7 @@ fi
                ol_link_sql="-liodbc"
        else
                echo $ac_n "checking for SQLDriverConnect in -lodbc""... $ac_c" 1>&6
-echo "configure:18901: checking for SQLDriverConnect in -lodbc" >&5
+echo "configure:20839: 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
@@ -18905,7 +20843,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lodbc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18909 "configure"
+#line 20847 "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
@@ -18916,7 +20854,7 @@ int main() {
 SQLDriverConnect()
 ; return 0; }
 EOF
-if { (eval echo configure:18920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20858: \"$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
@@ -18955,17 +20893,17 @@ if test $ol_enable_tcl != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:18959: checking for $ac_hdr" >&5
+echo "configure:20897: 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 18964 "configure"
+#line 20902 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20907: \"$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*
@@ -18997,7 +20935,7 @@ done
        else
                for lib in tcl tcl7.6 tcl8.0 tcl8.2 ; do
                        echo $ac_n "checking for main in -l$lib""... $ac_c" 1>&6
-echo "configure:19001: checking for main in -l$lib" >&5
+echo "configure:20939: checking for main in -l$lib" >&5
 ac_lib_var=`echo $lib'_'main | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -19005,14 +20943,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19009 "configure"
+#line 20947 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:19016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20954: \"$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
@@ -19056,17 +20994,17 @@ 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:19060: checking for $ac_hdr" >&5
+echo "configure:20998: 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 19065 "configure"
+#line 21003 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19070: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21008: \"$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*
@@ -19095,7 +21033,7 @@ done
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for tputs in -ltermcap""... $ac_c" 1>&6
-echo "configure:19099: checking for tputs in -ltermcap" >&5
+echo "configure:21037: 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
@@ -19103,7 +21041,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19107 "configure"
+#line 21045 "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
@@ -19114,7 +21052,7 @@ int main() {
 tputs()
 ; return 0; }
 EOF
-if { (eval echo configure:19118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21056: \"$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
@@ -19147,7 +21085,7 @@ fi
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:19151: checking for initscr in -lncurses" >&5
+echo "configure:21089: 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
@@ -19155,7 +21093,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19159 "configure"
+#line 21097 "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
@@ -19166,7 +21104,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:19170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21108: \"$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
 ol_link_sasl=no
 ol_link_spasswd=no
 if test $ol_with_cyrus_sasl != no ; then
-       for ac_hdr in sasl.h
+       for ac_hdr in sasl/sasl.h sasl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:19216: checking for $ac_hdr" >&5
+echo "configure:21154: 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 19221 "configure"
+#line 21159 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21164: \"$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_sasl_h = yes ; then
-               echo $ac_n "checking for sasl_client_init in -lsasl""... $ac_c" 1>&6
-echo "configure:19255: checking for sasl_client_init in -lsasl" >&5
+       if test $ac_cv_header_sasl_sasl_h = yes -o $ac_cv_header_sasl_h = yes; then
+               echo $ac_n "checking for sasl_client_init in -lsasl2""... $ac_c" 1>&6
+echo "configure:21193: checking for sasl_client_init in -lsasl2" >&5
+ac_lib_var=`echo sasl2'_'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
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsasl2  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 21201 "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 sasl_client_init();
+
+int main() {
+sasl_client_init()
+; return 0; }
+EOF
+if { (eval echo configure:21212: \"$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_link_sasl="-lsasl2"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for sasl_client_init in -lsasl""... $ac_c" 1>&6
+echo "configure:21231: 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
@@ -19259,7 +21235,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsasl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19263 "configure"
+#line 21239 "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
@@ -19270,7 +21246,7 @@ int main() {
 sasl_client_init()
 ; return 0; }
 EOF
-if { (eval echo configure:19274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21250: \"$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
@@ -19285,21 +21261,13 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_cyrus_sasl=yes
+  ol_link_sasl="-lsasl"
 else
   echo "$ac_t""no" 1>&6
-have_cyrus_sasl=no
 fi
 
+fi
 
-               if test $have_cyrus_sasl != no ; then
-                       SASL_LIBS="-lsasl"
-                       cat >> confdefs.h <<\EOF
-#define HAVE_CYRUS_SASL 1
-EOF
-
-                       ol_link_sasl=yes
-               fi
        fi
 
        if test $ol_link_sasl = 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 -a $ac_cv_mingw32 != 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=$LIBS
-LIBS="-lfetch -lcom_err $LIBS"
-echo $ac_n "checking fetch(3) library""... $ac_c" 1>&6
-echo "configure:19355: checking fetch(3) library" >&5
-if eval "test \"\${ol_cv_lib_fetch+set}\" = set"; then
+       else
+               echo $ac_n "checking Cyrus SASL library version""... $ac_c" 1>&6
+echo "configure:21286: checking Cyrus SASL library version" >&5
+if eval "test \"\${ol_cv_sasl_compat+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 19361 "configure"
+#line 21292 "configure"
 #include "confdefs.h"
 
-#include <sys/param.h>
-#include <stdio.h>
-#include <fetch.h>
-int main() {
-struct url *u = fetchParseURL("file:///"); 
-; return 0; }
+#ifdef HAVE_SASL_SASL_H
+#include <sasl/sasl.h>
+#else
+#include <sasl.h>
+#endif
+
+/* require 2.1.3 or later */
+#if SASL_VERSION_MAJOR == 2  && SASL_VERSION_MINOR > 1
+       char *__sasl_compat = "2.2+ or better okay (we guess)";
+#elif SASL_VERSION_MAJOR == 2  && SASL_VERSION_MINOR == 1 \
+       && SASL_VERSION_STEP >=3
+       char *__sasl_compat = "2.1.3+ or better okay";
+#endif
+       
 EOF
-if { (eval echo configure:19371: \"$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 "__sasl_compat" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_lib_fetch=yes
+  ol_cv_sasl_compat=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ol_cv_lib_fetch=no
+  ol_cv_sasl_compat=no
 fi
 rm -f conftest*
-fi
-
-echo "$ac_t""$ol_cv_lib_fetch" 1>&6
-LIBS=$ol_LIBS
-if test $ol_cv_lib_fetch != no ; then
-       ol_link_fetch="-lfetch -lcom_err"
-       cat >> confdefs.h <<\EOF
-#define HAVE_FETCH 1
-EOF
 
 fi
 
+echo "$ac_t""$ol_cv_sasl_compat" 1>&6
 
-       if test $ol_cv_lib_fetch != no ; then
-               LDIF_LIBS="$LDIF_LIBS $ol_link_fetch"
-               ol_link_fetch=freebsd
+               if test $ol_cv_sasl_compat = no ; then
+                       ol_link_sasl=no
+                       { echo "configure: error: Cyrus SASL library located but incompatible" 1>&2; exit 1; }
+               fi
 
-       elif test $ol_with_fetch != auto ; then
-               { echo "configure: error: no suitable API for --with-fetch=$ol_with_fetch" 1>&2; exit 1; }
-       fi 
-fi
+               cat >> confdefs.h <<\EOF
+#define HAVE_CYRUS_SASL 1
+EOF
 
-ol_link_readline=no
-if test $ol_with_readline != no ; then
-       for ac_hdr in readline/readline.h readline/history.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:19409: checking for $ac_hdr" >&5
-if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+               SASL_LIBS="$ol_link_sasl"
+               if test $ol_enable_spasswd != no ; then
+                       ol_link_spasswd=yes
+               fi
+
+               ac_save_LIBS="$LIBS"
+               LIBS="$LIBS $ol_link_sasl"
+               echo $ac_n "checking for sasl_version""... $ac_c" 1>&6
+echo "configure:21341: checking for sasl_version" >&5
+if eval "test \"\${ac_cv_func_sasl_version+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 19414 "configure"
+#line 21346 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char sasl_version(); 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 sasl_version();
+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_sasl_version) || defined (__stub___sasl_version)
+choke me
+#else
+f = sasl_version;
+#endif
+
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19419: \"$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:21370: \"$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_func_sasl_version=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_sasl_version=no"
 fi
 rm -f conftest*
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'sasl_version`\" = 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
+  cat >> confdefs.h <<\EOF
+#define HAVE_SASL_VERSION 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+               LIBS="$ac_save_LIBS"
+       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 -a "$ac_cv_mingw32" != 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
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
 
+       fi
+fi
 
-       if test $ac_cv_header_readline_readline_h = yes ; then
-               save_LIBS="$LIBS"
-               LIBS="$TERMCAP_LIBS $LIBS"
-               echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:19450: 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
+ol_link_fetch=no
+if test $ol_with_fetch != no ; then
+       ol_LIBS=$LIBS
+LIBS="-lfetch -lcom_err $LIBS"
+echo $ac_n "checking fetch(3) library""... $ac_c" 1>&6
+echo "configure:21429: checking fetch(3) library" >&5
+if eval "test \"\${ol_cv_lib_fetch+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lreadline  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 19458 "configure"
+  
+       cat > conftest.$ac_ext <<EOF
+#line 21435 "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 readline();
 
+#include <sys/param.h>
+#include <stdio.h>
+#include <fetch.h>
 int main() {
-readline()
+struct url *u = fetchParseURL("file:///"); 
 ; return 0; }
 EOF
-if { (eval echo configure:19469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21445: \"$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_lib_fetch=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_lib_fetch=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_readline=yes
-else
-  echo "$ac_t""no" 1>&6
-have_readline=no
-fi
-
-               LIBS="$save_LIBS"
-                       
-               if test $have_readline = yes ; then
-                       ol_with_readline=found
-                       ol_link_readline=yes
-
-                       READLINE_LIBS="-lreadline"
-               fi
-       fi
 fi
 
-if test $ol_link_readline = yes ; then
+echo "$ac_t""$ol_cv_lib_fetch" 1>&6
+LIBS=$ol_LIBS
+if test $ol_cv_lib_fetch != no ; then
+       ol_link_fetch="-lfetch -lcom_err"
        cat >> confdefs.h <<\EOF
-#define HAVE_READLINE 1
+#define HAVE_FETCH 1
 EOF
 
 fi
 
 
+       if test $ol_cv_lib_fetch != no ; then
+               LUTIL_LIBS="$LUTIL_LIBS $ol_link_fetch"
+               ol_link_fetch=freebsd
+
+       elif test $ol_with_fetch != auto ; then
+               { echo "configure: error: no suitable API for --with-fetch=$ol_with_fetch" 1>&2; exit 1; }
+       fi 
+fi
+
 if test $ol_enable_crypt != no ; then
+       save_LIBS="$LIBS"
+       LIBS="$TLS_LIBS $LIBS"
+
        echo $ac_n "checking for crypt""... $ac_c" 1>&6
-echo "configure:19511: checking for crypt" >&5
+echo "configure:21482: 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 19516 "configure"
+#line 21487 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char crypt(); below.  */
@@ -19536,7 +21507,7 @@ f = crypt;
 
 ; return 0; }
 EOF
-if { (eval echo configure:19540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21511: \"$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
@@ -19554,8 +21525,9 @@ if eval "test \"`echo '$ac_cv_func_'crypt`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 
+               LIBS="$save_LIBS"
                echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:19559: checking for crypt in -lcrypt" >&5
+echo "configure:21531: 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
@@ -19563,7 +21535,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19567 "configure"
+#line 21539 "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
@@ -19574,7 +21546,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:19578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21550: \"$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
@@ -19599,6 +21571,8 @@ fi
 fi
 
 
+       LIBS="$save_LIBS"
+
        if test $have_crypt = yes ; then
                cat >> confdefs.h <<\EOF
 #define HAVE_CRYPT 1
 
 if test $ol_enable_proctitle != no ; then
        echo $ac_n "checking for setproctitle""... $ac_c" 1>&6
-echo "configure:19621: checking for setproctitle" >&5
+echo "configure:21595: 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 19626 "configure"
+#line 21600 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char setproctitle(); below.  */
@@ -19646,7 +21620,7 @@ f = setproctitle;
 
 ; return 0; }
 EOF
-if { (eval echo configure:19650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21624: \"$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
@@ -19665,7 +21639,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6
-echo "configure:19669: checking for setproctitle in -lutil" >&5
+echo "configure:21643: 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
@@ -19673,7 +21647,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lutil  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19677 "configure"
+#line 21651 "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
@@ -19684,7 +21658,7 @@ int main() {
 setproctitle()
 ; return 0; }
 EOF
-if { (eval echo configure:19688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21662: \"$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
@@ -19724,17 +21698,17 @@ if test $ol_enable_slp != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:19728: checking for $ac_hdr" >&5
+echo "configure:21702: 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 19733 "configure"
+#line 21707 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21712: \"$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*
@@ -19763,7 +21737,7 @@ done
 
        if test $ac_cv_header_slp_h = yes ; then
                echo $ac_n "checking for SLPOpen in -lslp""... $ac_c" 1>&6
-echo "configure:19767: checking for SLPOpen in -lslp" >&5
+echo "configure:21741: checking for SLPOpen in -lslp" >&5
 ac_lib_var=`echo slp'_'SLPOpen | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -19771,7 +21745,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lslp  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19775 "configure"
+#line 21749 "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
@@ -19782,7 +21756,7 @@ int main() {
 SLPOpen()
 ; return 0; }
 EOF
-if { (eval echo configure:19786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21760: \"$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
@@ -19816,13 +21790,48 @@ EOF
        fi
 fi
 
+
+echo $ac_n "checking long long""... $ac_c" 1>&6
+echo "configure:21796: checking long long" >&5
+if eval "test \"\${ol_cv_type_long_long+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       cat > conftest.$ac_ext <<EOF
+#line 21802 "configure"
+#include "confdefs.h"
+
+int main() {
+long long x;
+; return 0; }
+EOF
+if { (eval echo configure:21809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_type_long_long=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_type_long_long=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ol_cv_type_long_long" 1>&6
+if test $ol_cv_type_long_long = yes; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_LONG_LONG 1
+EOF
+
+fi
+
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:19821: checking for ANSI C header files" >&5
+echo "configure:21830: 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 19826 "configure"
+#line 21835 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -19830,7 +21839,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21843: \"$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*
@@ -19847,7 +21856,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 19851 "configure"
+#line 21860 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -19865,7 +21874,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 19869 "configure"
+#line 21878 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -19886,7 +21895,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 19890 "configure"
+#line 21899 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #if ((' ' & 0x0FF) == 0x020)
@@ -19904,7 +21913,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:19908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:21917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -19928,12 +21937,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:19932: checking for mode_t" >&5
+echo "configure:21941: 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 19937 "configure"
+#line 21946 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -19964,12 +21973,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:19968: checking for off_t" >&5
+echo "configure:21977: 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 19973 "configure"
+#line 21982 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -20000,12 +22009,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:20004: checking for pid_t" >&5
+echo "configure:22013: 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 20009 "configure"
+#line 22018 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -20036,19 +22045,19 @@ EOF
 fi
 
 echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:20040: checking for ptrdiff_t" >&5
+echo "configure:22049: 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 20045 "configure"
+#line 22054 "configure"
 #include "confdefs.h"
 #include <stddef.h>
 int main() {
 ptrdiff_t p
 ; return 0; }
 EOF
-if { (eval echo configure:20052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_type_ptrdiff_t=yes
 else
@@ -20069,12 +22078,12 @@ EOF
    fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:20073: checking return type of signal handlers" >&5
+echo "configure:22082: 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 20078 "configure"
+#line 22087 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -20091,7 +22100,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:20095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22104: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -20110,12 +22119,12 @@ EOF
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:20114: checking for size_t" >&5
+echo "configure:22123: 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 20119 "configure"
+#line 22128 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 
 
 echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:20151: checking for ssize_t" >&5
+echo "configure:22160: 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 20156 "configure"
+#line 22165 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -20183,12 +22192,12 @@ EOF
 fi
 
 echo $ac_n "checking for caddr_t""... $ac_c" 1>&6
-echo "configure:20187: checking for caddr_t" >&5
+echo "configure:22196: 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 20192 "configure"
+#line 22201 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 
 
 echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
-echo "configure:20224: checking for socklen_t" >&5
+echo "configure:22233: 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 20229 "configure"
+#line 22238 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -20239,7 +22248,7 @@ int main() {
 socklen_t len;
 ; return 0; }
 EOF
-if { (eval echo configure:20243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_type_socklen_t=yes
 else
@@ -20260,12 +22269,12 @@ EOF
   fi
  
 echo $ac_n "checking for member st_blksize in aggregate type struct stat""... $ac_c" 1>&6
-echo "configure:20264: checking for member st_blksize in aggregate type struct stat" >&5
+echo "configure:22273: 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 20269 "configure"
+#line 22278 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -20273,7 +22282,7 @@ int main() {
 struct stat foo; foo.st_blksize;
 ; return 0; }
 EOF
-if { (eval echo configure:20277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_struct_member_st_blksize=yes
 else
@@ -20295,12 +22304,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:20299: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:22308: 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 20304 "configure"
+#line 22313 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -20309,7 +22318,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:20313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -20330,12 +22339,12 @@ EOF
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:20334: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:22343: 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 20339 "configure"
+#line 22348 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -20343,7 +22352,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:20347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -20364,12 +22373,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:20368: checking for uid_t in sys/types.h" >&5
+echo "configure:22377: 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 20373 "configure"
+#line 22382 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -20398,19 +22407,19 @@ EOF
 fi
 
 echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6
-echo "configure:20402: checking for sig_atomic_t" >&5
+echo "configure:22411: 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 20407 "configure"
+#line 22416 "configure"
 #include "confdefs.h"
 #include <signal.h>
 int main() {
 sig_atomic_t atomic;
 ; return 0; }
 EOF
-if { (eval echo configure:20414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22423: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_type_sig_atomic_t=yes
 else
@@ -20434,13 +22443,13 @@ EOF
 
 # test for pw_gecos in struct passwd
 echo $ac_n "checking struct passwd for pw_gecos""... $ac_c" 1>&6
-echo "configure:20438: checking struct passwd for pw_gecos" >&5
+echo "configure:22447: 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 20444 "configure"
+#line 22453 "configure"
 #include "confdefs.h"
 #include <pwd.h>
 int main() {
@@ -20450,7 +22459,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:20454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22463: \"$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:20476: checking struct passwd for pw_passwd" >&5
+echo "configure:22485: 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 20482 "configure"
+#line 22491 "configure"
 #include "confdefs.h"
 #include <pwd.h>
 int main() {
@@ -20488,7 +22497,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:20492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_struct_passwd_pw_passwd=yes
 else
@@ -20510,7 +22519,7 @@ fi
 
 
 echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
-echo "configure:20514: checking if toupper() requires islower()" >&5
+echo "configure:22523: 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
@@ -20519,7 +22528,7 @@ else
   ol_cv_c_upper_lower=safe
 else
   cat > conftest.$ac_ext <<EOF
-#line 20523 "configure"
+#line 22532 "configure"
 #include "confdefs.h"
 
 #include <ctype.h>
@@ -20531,7 +22540,7 @@ main()
                exit(1);
 }
 EOF
-if { (eval echo configure:20535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:22544: \"$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
@@ -20554,12 +22563,12 @@ EOF
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:20558: checking for working const" >&5
+echo "configure:22567: 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 20563 "configure"
+#line 22572 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -20608,7 +22617,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:20612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22621: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -20629,12 +22638,12 @@ EOF
 fi
 
 echo $ac_n "checking if compiler understands volatile""... $ac_c" 1>&6
-echo "configure:20633: checking if compiler understands volatile" >&5
+echo "configure:22642: 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 20638 "configure"
+#line 22647 "configure"
 #include "confdefs.h"
 int x, y, z;
 int main() {
@@ -20643,7 +22652,7 @@ volatile int a; int * volatile b = x ? &y : &z;
       *b = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:20647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_c_volatile=yes
 else
@@ -20673,14 +22682,14 @@ EOF
 
 else
        echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:20677: checking whether byte ordering is bigendian" >&5
+echo "configure:22686: 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 20684 "configure"
+#line 22693 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -20691,11 +22700,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:20695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22704: \"$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 20699 "configure"
+#line 22708 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -20706,7 +22715,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:20710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -20726,7 +22735,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 20730 "configure"
+#line 22739 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -20739,7 +22748,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:20743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:22752: \"$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:20769: checking size of short" >&5 
+echo "configure:22778: checking size of short" >&5 
 if eval "test \"\${ac_cv_sizeof_short+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   for ac_size in 4 8 1 2 16  ; do # List sizes in rough order of prevalence. 
   cat > conftest.$ac_ext <<EOF
-#line 20775 "configure"
+#line 22784 "configure"
 #include "confdefs.h"
 #include "confdefs.h" 
 #include <sys/types.h> 
@@ -20781,7 +22790,7 @@ int main() {
 switch (0) case 0: case (sizeof (short) == $ac_size):;
 ; return 0; }
 EOF
-if { (eval echo configure:20785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sizeof_short=$ac_size
 else
@@ -20804,13 +22813,13 @@ EOF
  
  
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:20808: checking size of int" >&5 
+echo "configure:22817: checking size of int" >&5 
 if eval "test \"\${ac_cv_sizeof_int+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   for ac_size in 4 8 1 2 16  ; do # List sizes in rough order of prevalence. 
   cat > conftest.$ac_ext <<EOF
-#line 20814 "configure"
+#line 22823 "configure"
 #include "confdefs.h"
 #include "confdefs.h" 
 #include <sys/types.h> 
@@ -20820,7 +22829,7 @@ int main() {
 switch (0) case 0: case (sizeof (int) == $ac_size):;
 ; return 0; }
 EOF
-if { (eval echo configure:20824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sizeof_int=$ac_size
 else
@@ -20843,13 +22852,13 @@ EOF
  
  
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:20847: checking size of long" >&5 
+echo "configure:22856: checking size of long" >&5 
 if eval "test \"\${ac_cv_sizeof_long+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   for ac_size in 4 8 1 2 16  ; do # List sizes in rough order of prevalence. 
   cat > conftest.$ac_ext <<EOF
-#line 20853 "configure"
+#line 22862 "configure"
 #include "confdefs.h"
 #include "confdefs.h" 
 #include <sys/types.h> 
@@ -20859,7 +22868,7 @@ int main() {
 switch (0) case 0: case (sizeof (long) == $ac_size):;
 ; return 0; }
 EOF
-if { (eval echo configure:20863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sizeof_long=$ac_size
 else
@@ -20910,7 +22919,7 @@ EOF
 
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:20914: checking for 8-bit clean memcmp" >&5
+echo "configure:22923: 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
@@ -20918,7 +22927,7 @@ else
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 20922 "configure"
+#line 22931 "configure"
 #include "confdefs.h"
 
 main()
@@ -20928,7 +22937,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:20932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:22941: \"$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
@@ -20946,12 +22955,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:20950: checking for strftime" >&5
+echo "configure:22959: 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 20955 "configure"
+#line 22964 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strftime(); below.  */
@@ -20975,7 +22984,7 @@ f = strftime;
 
 ; return 0; }
 EOF
-if { (eval echo configure:20979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22988: \"$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
@@ -20997,7 +23006,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:21001: checking for strftime in -lintl" >&5
+echo "configure:23010: 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
@@ -21005,7 +23014,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 21009 "configure"
+#line 23018 "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
@@ -21016,7 +23025,7 @@ int main() {
 strftime()
 ; return 0; }
 EOF
-if { (eval echo configure:21020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23029: \"$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:21048: checking for inet_aton()" >&5
+echo "configure:23057: 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 21053 "configure"
+#line 23062 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -21071,7 +23080,7 @@ struct in_addr in;
 int rc = inet_aton( "255.255.255.255", &in );
 ; return 0; }
 EOF
-if { (eval echo configure:21075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23084: \"$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
@@ -21093,12 +23102,12 @@ EOF
  
 
 echo $ac_n "checking for _spawnlp""... $ac_c" 1>&6
-echo "configure:21097: checking for _spawnlp" >&5
+echo "configure:23106: 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 21102 "configure"
+#line 23111 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _spawnlp(); below.  */
@@ -21122,7 +23131,7 @@ f = _spawnlp;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23135: \"$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 $ac_n "checking for _snprintf""... $ac_c" 1>&6
-echo "configure:21150: checking for _snprintf" >&5
+echo "configure:23159: 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 21155 "configure"
+#line 23164 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _snprintf(); below.  */
@@ -21175,7 +23184,7 @@ f = _snprintf;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23188: \"$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 $ac_n "checking for _vsnprintf""... $ac_c" 1>&6
-echo "configure:21205: checking for _vsnprintf" >&5
+echo "configure:23214: 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 21210 "configure"
+#line 23219 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _vsnprintf(); below.  */
@@ -21230,7 +23239,7 @@ f = _vsnprintf;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23243: \"$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 $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:21260: checking for vprintf" >&5
+echo "configure:23269: 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 21265 "configure"
+#line 23274 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -21285,7 +23294,7 @@ f = vprintf;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23298: \"$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:21313: checking for _doprnt" >&5
+echo "configure:23322: 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 21318 "configure"
+#line 23327 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -21338,7 +23347,7 @@ f = _doprnt;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23351: \"$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
 
 
 if test $ac_cv_func_vprintf = yes ; then
-               for ac_func in vsnprintf vsprintf
+               for ac_func in snprintf vsnprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:21371: checking for $ac_func" >&5
+echo "configure:23380: 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 21376 "configure"
+#line 23385 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -21396,7 +23405,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23409: \"$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
@@ -21430,6 +23439,7 @@ for ac_func in \
        endpwent                \
        fcntl                   \
        flock                   \
+       fstat                   \
        getdtablesize   \
        getgrgid                \
        gethostname             \
@@ -21466,6 +23476,9 @@ for ac_func in \
        strstr                  \
        strtol                  \
        strtoul                 \
+       strtoq                  \
+       strtouq                 \
+       strtoll                 \
        strspn                  \
        sysconf                 \
        usleep                  \
@@ -21473,16 +23486,17 @@ for ac_func in \
        wait4                   \
        write                   \
        send                    \
+       sendmsg                 \
        sendto                  \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:21481: checking for $ac_func" >&5
+echo "configure:23495: 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 21486 "configure"
+#line 23500 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -21506,7 +23520,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23524: \"$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
 done
 
 
-for ac_func in getopt
+for ac_func in getopt getpeereid
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:21538: checking for $ac_func" >&5
+echo "configure:23552: 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 21543 "configure"
+#line 23557 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -21563,7 +23577,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23581: \"$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
@@ -21593,16 +23607,67 @@ done
 if test "$ac_cv_func_getopt" != yes; then
        LIBSRCS="$LIBSRCS getopt.c"
 fi
+if test "$ac_cv_func_getpeereid" != yes; then
+       echo $ac_n "checking for msg_accrights in msghdr""... $ac_c" 1>&6
+echo "configure:23613: checking for msg_accrights in msghdr" >&5
+if eval "test \"\${ol_cv_msghdr_msg_accrights+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 23618 "configure"
+#include "confdefs.h"
+#include <sys/socket.h>
+int main() {
+struct msghdr m; m.msg_accrightslen=0
+; return 0; }
+EOF
+if { (eval echo configure:23625: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ol_cv_msghdr_msg_accrights=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_msghdr_msg_accrights=no
+fi
+rm -f conftest*
+       
+fi
+
+echo "$ac_t""$ol_cv_msghdr_msg_accrights" 1>&6
+  if test $ol_cv_msghdr_msg_accrights = "yes" ; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_MSGHDR_MSG_ACCRIGHTS 1
+EOF
+
+  fi
+
+       LIBSRCS="$LIBSRCS getpeereid.c"
+fi
+if test "$ac_cv_func_snprintf" != yes -o "$ac_cv_func_vsnprintf" != yes; then
+       if test "$ac_cv_func_snprintf" != yes; then
+               cat >> confdefs.h <<\EOF
+#define snprintf ber_pvt_snprintf
+EOF
+
+       fi
+       if test "$ac_cv_func_vsnprintf" != yes; then
+               cat >> confdefs.h <<\EOF
+#define vsnprintf ber_pvt_vsnprintf
+EOF
+
+       fi
+fi
 
 # Check Configuration
 echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:21600: checking declaration of sys_errlist" >&5
+echo "configure:23665: 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 21606 "configure"
+#line 23671 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -21615,7 +23680,7 @@ int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:21619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23684: \"$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
@@ -21638,20 +23703,20 @@ EOF
 
 
        echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:21642: checking existence of sys_errlist" >&5
+echo "configure:23707: 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 21648 "configure"
+#line 23713 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:21655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:23720: \"$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
 
 
 
-if test "$ol_enable_debug" != no ; then
+if test "$ol_enable_slapi" != 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:23748: 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 23753 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:23758: \"$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_ltdl_h != yes ; then
+               { echo "configure: error: could not locate <ltdl.h>" 1>&2; exit 1; }
+       fi
+       echo $ac_n "checking for lt_dlinit in -lltdl""... $ac_c" 1>&6
+echo "configure:23789: 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
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lltdl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 23797 "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 lt_dlinit();
+
+int main() {
+lt_dlinit()
+; return 0; }
+EOF
+if { (eval echo configure:23808: \"$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
+  
+               SLAPI_LIBS=-lltdl
+               LIBSLAPI=libslapi.a
+               LIBSLAPITOOLS=../libslapi.a
+               cat >> confdefs.h <<\EOF
+#define HAVE_LIBLTDL 1
+EOF
+
+       
+else
+  echo "$ac_t""no" 1>&6
+{ echo "configure: error: could not locate libtool -lltdl" 1>&2; exit 1; }
+fi
+
+
        cat >> confdefs.h <<\EOF
-#define LDAP_DEBUG 1
+#define LDAP_SLAPI 1
 EOF
 
 fi
-if test "$ol_enable_syslog" = yes ; then
+
+if test "$ol_enable_debug" != no ; then
        cat >> confdefs.h <<\EOF
-#define LDAP_SYSLOG 1
+#define LDAP_DEBUG 1
 EOF
 
 fi
-if test "$ol_enable_cache" = no ; then
+if test "$ol_enable_syslog" = yes ; then
        cat >> confdefs.h <<\EOF
-#define LDAP_NOCACHE 1
+#define LDAP_SYSLOG 1
 EOF
 
 fi
@@ -21746,9 +23906,9 @@ if test "$ol_link_spasswd" != no ; then
 EOF
 
 fi
-if test "$ol_enable_phonetic" != no ; then
+if test "$ol_enable_multimaster" != no ; then
        cat >> confdefs.h <<\EOF
-#define SLAPD_PHONETIC 1
+#define SLAPD_MULTIMASTER 1
 EOF
 
 fi
@@ -21788,7 +23948,6 @@ EOF
 
                BUILD_BDB=mod
                BUILD_BDB_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-bdb/back_bdb.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-bdb"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-bdb"
@@ -21809,13 +23968,32 @@ EOF
 
                BUILD_DNSSRV=mod
                BUILD_DNSSRV_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-dnssrv/back_dnssrv.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-dnssrv"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-dnssrv"
        fi
 fi
 
+if test "$ol_enable_hdb" != no ; then
+       cat >> confdefs.h <<\EOF
+#define SLAPD_HDB 1
+EOF
+
+       BUILD_SLAPD=yes
+       BUILD_HDB=yes
+       if test "$ol_with_hdb_module" != static ; then
+               cat >> confdefs.h <<\EOF
+#define SLAPD_HDB_DYNAMIC 1
+EOF
+
+               BUILD_HDB=mod
+               BUILD_HDB_DYNAMIC=shared
+               SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-hdb"
+       else
+               SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-hdb"
+       fi
+fi
+
 if test "$ol_enable_ldap" != no ; then
        cat >> confdefs.h <<\EOF
 #define SLAPD_LDAP 1
@@ -21830,7 +24008,6 @@ EOF
 
                BUILD_LDAP=mod
                BUILD_LDAP_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-ldap/back_ldap.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ldap"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ldap"
@@ -21844,7 +24021,6 @@ EOF
 
        BUILD_SLAPD=yes
        BUILD_LDBM=yes
-       LDBM_LIB="-lldbm"
        if test "$ol_with_ldbm_module" != static ; then
                cat >> confdefs.h <<\EOF
 #define SLAPD_LDBM_DYNAMIC 1
@@ -21852,7 +24028,6 @@ EOF
 
                BUILD_LDBM=mod
                BUILD_LDBM_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-ldbm/back_ldbm.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ldbm"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ldbm"
@@ -21872,6 +24047,11 @@ EOF
 
        BUILD_SLAPD=yes
        BUILD_META=yes
+       BUILD_REWRITE=yes
+        if test $ol_enable_ldbm = yes -o \
+               $ol_enable_bdb = yes ; then 
+                BUILD_CACHE=yes
+        fi
        if test "$ol_with_meta_module" != static ; then
                cat >> confdefs.h <<\EOF
 #define SLAPD_META_DYNAMIC 1
@@ -21879,7 +24059,6 @@ EOF
 
                BUILD_META=mod
                BUILD_META_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-meta/back_meta.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-meta"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-meta"
@@ -21900,13 +24079,32 @@ EOF
 
                BUILD_MONITOR=mod
                BUILD_MONITOR_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-monitor/back_monitor.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-monitor"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-monitor"
        fi
 fi
 
+if test "$ol_enable_null" != no ; then
+       cat >> confdefs.h <<\EOF
+#define SLAPD_NULL 1
+EOF
+
+       BUILD_SLAPD=yes
+       BUILD_NULL=yes
+       if test "$ol_with_null_module" != static ; then
+               cat >> confdefs.h <<\EOF
+#define SLAPD_NULL_DYNAMIC 1
+EOF
+
+               BUILD_NULL=mod
+               BUILD_NULL_DYNAMIC=shared
+               SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-null"
+       else
+               SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-null"
+       fi
+fi
+
 if test "$ol_enable_passwd" != no ; then
        cat >> confdefs.h <<\EOF
 #define SLAPD_PASSWD 1
@@ -21921,7 +24119,6 @@ EOF
 
                BUILD_PASSWD=mod
                BUILD_PASSWD_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-passwd/back_passwd.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-passwd"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-passwd"
@@ -21942,7 +24139,6 @@ EOF
 
                BUILD_PERL=mod
                BUILD_PERL_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-perl/back_perl.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-perl"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-perl"
@@ -21950,6 +24146,9 @@ EOF
 fi
 
 if test "$ol_enable_shell" != no ; then
+       if test "$ol_link_thread" != no ; then
+               echo "configure: warning: Use of --without-threads is recommended with back-shell" 1>&2
+       fi
        cat >> confdefs.h <<\EOF
 #define SLAPD_SHELL 1
 EOF
@@ -21963,7 +24162,6 @@ EOF
 
                BUILD_SHELL=mod
                BUILD_SHELL_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-shell/back_shell.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-shell"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-shell"
@@ -21984,7 +24182,6 @@ EOF
 
                BUILD_TCL=mod
                BUILD_TCL_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-tcl/back_tcl.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-tcl"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-tcl"
@@ -22005,7 +24202,6 @@ EOF
 
                BUILD_SQL=mod
                BUILD_SQL_DYNAMIC=shared
-               SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-sql/back_sql.la"
                SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-sql"
        else
                SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-sql"
@@ -22023,7 +24219,15 @@ if test "$ol_enable_rewrite" != no ; then
 EOF
 
        BUILD_REWRITE=yes
-       SLAPD_LIBS="$SLAPD_LIBS -lrewrite"
+fi
+
+if test "$ol_enable_slapi" != no ; then
+       cat >> confdefs.h <<\EOF
+#define ENABLE_SLAPI 1
+EOF
+
+       BUILD_SLAPI=yes
+       SLAPD_SLAPI_DEPEND=libslapi.a
 fi
 
 
 if test "$ac_cv_mingw32" = yes ; then
        PLAT=NT
        SLAPD_MODULES_LDFLAGS=
-       SLAPD_MODULES_LIST=
 else
        PLAT=UNIX
 fi
 
+if test -z "$SLAPD_STATIC_BACKENDS"; then
+       SLAPD_NO_STATIC='#'
+else
+       SLAPD_NO_STATIC=
+fi
+
+
 
 
 
   
   
   
+  
+  
+  
+  
+  
+  
+  
+
 
 
 
 
 
 
+# Check whether --with-xxinstall or --without-xxinstall was given.
+if test "${with_xxinstall+set}" = set; then
+  withval="$with_xxinstall"
+  :
+fi
 
 
 
@@ -22168,19 +24391,13 @@ doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
-clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
-clients/mail500/Makefile:build/top.mk:clients/mail500/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     \
-libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk   \
 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk \
 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk \
 libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk     \
 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk \
-libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk \
 libraries/liblunicode/Makefile:build/top.mk:libraries/liblunicode/Makefile.in:build/lib.mk:build/lib-static.mk \
 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk       \
 libraries/librewrite/Makefile:build/top.mk:libraries/librewrite/Makefile.in:build/lib.mk:build/lib-static.mk \
@@ -22188,19 +24405,23 @@ servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
 servers/slapd/back-bdb/Makefile:build/top.mk:servers/slapd/back-bdb/Makefile.in:build/mod.mk \
 servers/slapd/back-dnssrv/Makefile:build/top.mk:servers/slapd/back-dnssrv/Makefile.in:build/mod.mk \
+servers/slapd/back-hdb/Makefile:build/top.mk:servers/slapd/back-hdb/Makefile.in:build/mod.mk \
 servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk \
 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/mod.mk \
 servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk \
 servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk \
+servers/slapd/back-null/Makefile:build/top.mk:servers/slapd/back-null/Makefile.in:build/mod.mk \
 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk \
 servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk \
 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk \
 servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk \
 servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/Makefile.in:build/mod.mk \
 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
+servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk  \
 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
 tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
+tests/run \
 tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
  include/portable.h include/ldap_features.h include/lber_types.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
@@ -22234,7 +24455,6 @@ s%@includedir@%$includedir%g
 s%@oldincludedir@%$oldincludedir%g
 s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
-s%@SHTOOL@%$SHTOOL%g
 s%@host@%$host%g
 s%@host_alias@%$host_alias%g
 s%@host_cpu@%$host_cpu%g
@@ -22266,6 +24486,7 @@ s%@AWK@%$AWK%g
 s%@AMTARFLAGS@%$AMTARFLAGS%g
 s%@SET_MAKE@%$SET_MAKE%g
 s%@OPENLDAP_LIBVERSION@%$OPENLDAP_LIBVERSION%g
+s%@OPENLDAP_RELEASE_DATE@%$OPENLDAP_RELEASE_DATE%g
 s%@top_builddir@%$top_builddir%g
 s%@ldap_subdir@%$ldap_subdir%g
 s%@CC@%$CC%g
@@ -22282,23 +24503,27 @@ s%@OBJDUMP@%$OBJDUMP%g
 s%@CPP@%$CPP%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%@OL_MKDEP@%$OL_MKDEP%g
 s%@OL_MKDEP_FLAGS@%$OL_MKDEP_FLAGS%g
+s%@LTSTATIC@%$LTSTATIC%g
 s%@LIBOBJS@%$LIBOBJS%g
 s%@LIBSRCS@%$LIBSRCS%g
 s%@PLAT@%$PLAT%g
+s%@WITH_TLS@%$WITH_TLS%g
 s%@BUILD_LIBS_DYNAMIC@%$BUILD_LIBS_DYNAMIC%g
 s%@BUILD_SLAPD@%$BUILD_SLAPD%g
+s%@BUILD_SLAPI@%$BUILD_SLAPI%g
+s%@SLAPD_SLAPI_DEPEND@%$SLAPD_SLAPI_DEPEND%g
 s%@BUILD_BDB@%$BUILD_BDB%g
 s%@BUILD_DNSSRV@%$BUILD_DNSSRV%g
+s%@BUILD_HDB@%$BUILD_HDB%g
 s%@BUILD_LDAP@%$BUILD_LDAP%g
 s%@BUILD_LDBM@%$BUILD_LDBM%g
 s%@BUILD_META@%$BUILD_META%g
 s%@BUILD_MONITOR@%$BUILD_MONITOR%g
+s%@BUILD_CACHE@%$BUILD_CACHE%g
+s%@BUILD_NULL@%$BUILD_NULL%g
 s%@BUILD_PASSWD@%$BUILD_PASSWD%g
 s%@BUILD_PERL@%$BUILD_PERL%g
 s%@BUILD_SHELL@%$BUILD_SHELL%g
@@ -22306,19 +24531,19 @@ s%@BUILD_SQL@%$BUILD_SQL%g
 s%@BUILD_TCL@%$BUILD_TCL%g
 s%@BUILD_BDB_DYNAMIC@%$BUILD_BDB_DYNAMIC%g
 s%@BUILD_DNSSRV_DYNAMIC@%$BUILD_DNSSRV_DYNAMIC%g
+s%@BUILD_HDB_DYNAMIC@%$BUILD_HDB_DYNAMIC%g
 s%@BUILD_LDAP_DYNAMIC@%$BUILD_LDAP_DYNAMIC%g
 s%@BUILD_LDBM_DYNAMIC@%$BUILD_LDBM_DYNAMIC%g
 s%@BUILD_META_DYNAMIC@%$BUILD_META_DYNAMIC%g
 s%@BUILD_MONITOR_DYNAMIC@%$BUILD_MONITOR_DYNAMIC%g
+s%@BUILD_NULL_DYNAMIC@%$BUILD_NULL_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_SQL_DYNAMIC@%$BUILD_SQL_DYNAMIC%g
 s%@BUILD_TCL_DYNAMIC@%$BUILD_TCL_DYNAMIC%g
 s%@BUILD_SLURPD@%$BUILD_SLURPD%g
-s%@LDBM_LIB@%$LDBM_LIB%g
 s%@LDAP_LIBS@%$LDAP_LIBS%g
-s%@LDIF_LIBS@%$LDIF_LIBS%g
 s%@SLAPD_LIBS@%$SLAPD_LIBS%g
 s%@SLURPD_LIBS@%$SLURPD_LIBS%g
 s%@LDBM_LIBS@%$LDBM_LIBS%g
@@ -22328,7 +24553,7 @@ s%@WRAP_LIBS@%$WRAP_LIBS%g
 s%@MOD_TCL_LIB@%$MOD_TCL_LIB%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_NO_STATIC@%$SLAPD_NO_STATIC%g
 s%@SLAPD_STATIC_BACKENDS@%$SLAPD_STATIC_BACKENDS%g
 s%@SLAPD_DYNAMIC_BACKENDS@%$SLAPD_DYNAMIC_BACKENDS%g
 s%@PERL_CPPFLAGS@%$PERL_CPPFLAGS%g
@@ -22336,11 +24561,13 @@ s%@SLAPD_PERL_LDFLAGS@%$SLAPD_PERL_LDFLAGS%g
 s%@MOD_PERL_LDFLAGS@%$MOD_PERL_LDFLAGS%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%@SLAPI_LIBS@%$SLAPI_LIBS%g
+s%@LIBSLAPI@%$LIBSLAPI%g
+s%@LIBSLAPITOOLS@%$LIBSLAPITOOLS%g
 s%@AUTH_LIBS@%$AUTH_LIBS%g
 s%@SLAPD_SLP_LIBS@%$SLAPD_SLP_LIBS%g
 s%@SLAPD_SQL_LDFLAGS@%$SLAPD_SQL_LDFLAGS%g
@@ -22396,19 +24623,13 @@ doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
-clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
-clients/mail500/Makefile:build/top.mk:clients/mail500/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     \
-libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk   \
 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk \
 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk \
 libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk     \
 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk \
-libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk \
 libraries/liblunicode/Makefile:build/top.mk:libraries/liblunicode/Makefile.in:build/lib.mk:build/lib-static.mk \
 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk       \
 libraries/librewrite/Makefile:build/top.mk:libraries/librewrite/Makefile.in:build/lib.mk:build/lib-static.mk \
@@ -22416,19 +24637,23 @@ servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
 servers/slapd/back-bdb/Makefile:build/top.mk:servers/slapd/back-bdb/Makefile.in:build/mod.mk \
 servers/slapd/back-dnssrv/Makefile:build/top.mk:servers/slapd/back-dnssrv/Makefile.in:build/mod.mk \
+servers/slapd/back-hdb/Makefile:build/top.mk:servers/slapd/back-hdb/Makefile.in:build/mod.mk \
 servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk \
 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/mod.mk \
 servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk \
 servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk \
+servers/slapd/back-null/Makefile:build/top.mk:servers/slapd/back-null/Makefile.in:build/mod.mk \
 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk \
 servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk \
 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk \
 servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk \
 servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/Makefile.in:build/mod.mk \
 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
+servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk  \
 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
 tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
+tests/run \
 tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
 "}
 EOF
@@ -22602,8 +24827,9 @@ cat >> $CONFIG_STATUS <<EOF
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 
+chmod +x tests/run
 date > stamp-h
-echo Please \"make depend\" to build dependencies
+echo Please run \"make depend\" to build dependencies
 
 exit 0
 EOF